50 auto initFunction = [propagateMC](
InitContext& ic) {
53 ic.options().get<std::string>(
"infile"));
54 auto treename = ic.options().get<std::string>(
"treename");
55 auto nofEvents = ic.options().get<
int>(
"nevents");
57 auto processAttributes = std::make_shared<ProcessAttributes>();
59 processAttributes->terminateOnEod = ic.options().get<
bool>(
"terminate-on-eod");
60 processAttributes->finished =
false;
61 processAttributes->datatype =
"CPVDigit";
64 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
72 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
82 if (processAttributes->finished) {
86 auto publish = [&processAttributes, &pc, propagateMC]() {
88 if (processAttributes->reader->next()) {
89 (*processAttributes->reader)(pc, cpvheader);
91 processAttributes->reader.reset();
102 pc.outputs().snapshot(
OutputRef{
"output", 0, {dummyheader}}, 0);
103 pc.outputs().snapshot(
OutputRef{
"outputTR", 0, {dummyheader}}, 0);
105 pc.outputs().snapshot(
OutputRef{
"outputMC", 0, {dummyheader}}, 0);
108 if ((processAttributes->finished = (
active ==
false)) && processAttributes->terminateOnEod) {
113 return processFunction;
116 std::vector<OutputSpec> outputSpecs;
117 outputSpecs.emplace_back(
OutputSpec{{
"output"},
"CPV",
"DIGITS", 0, Lifetime::Timeframe});
118 outputSpecs.emplace_back(
OutputSpec{{
"outputTR"},
"CPV",
"DIGITTRIGREC", 0, Lifetime::Timeframe});
120 outputSpecs.emplace_back(
OutputSpec{{
"outputMC"},
"CPV",
"DIGITSMCTR", 0, Lifetime::Timeframe});
129 {
"infile", VariantType::String,
"cpvdigits.root", {
"Name of the input file"}},
130 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
131 {
"treename", VariantType::String,
"o2sim", {
"Name of input tree"}},
132 {
"nevents", VariantType::Int, -1, {
"number of events to run, -1: inf loop"}},
133 {
"terminate-on-eod", VariantType::Bool,
true, {
"terminate on end-of-data"}},
140 auto initFunction = [propagateMC](
InitContext& ic) {
143 auto treename = ic.options().get<std::string>(
"treename");
144 auto nofEvents = ic.options().get<
int>(
"nevents");
147 auto processAttributes = std::make_shared<ProcessAttributes>();
149 processAttributes->terminateOnEod = ic.options().get<
bool>(
"terminate-on-eod");
150 processAttributes->finished =
false;
151 processAttributes->datatype =
"CPVCluster";
152 constexpr auto persistency = Lifetime::Timeframe;
155 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
163 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
173 if (processAttributes->finished) {
177 auto publish = [&processAttributes, &pc, propagateMC]() {
179 if (processAttributes->reader->next()) {
180 (*processAttributes->reader)(pc, cpvheader);
182 processAttributes->reader.reset();
193 pc.outputs().snapshot(
OutputRef{
"output", 0, {dummyheader}}, 0);
194 pc.outputs().snapshot(
OutputRef{
"outputTR", 0, {dummyheader}}, 0);
196 pc.outputs().snapshot(
OutputRef{
"outputMC", 0, {dummyheader}}, 0);
199 if ((processAttributes->finished = (
active ==
false)) && processAttributes->terminateOnEod) {
201 pc.services().get<
ControlService>().readyToQuit(framework::QuitRequest::Me);
204 return processFunction;
207 std::vector<OutputSpec> outputSpecs;
208 outputSpecs.emplace_back(
OutputSpec{{
"output"},
"CPV",
"CLUSTERS", 0, Lifetime::Timeframe});
209 outputSpecs.emplace_back(
OutputSpec{{
"outputTR"},
"CPV",
"CLUSTERTRIGRECS", 0, Lifetime::Timeframe});
211 outputSpecs.emplace_back(
OutputSpec{{
"outputMC"},
"CPV",
"CLUSTERTRUEMC", 0, Lifetime::Timeframe});
215 "cpv-cluster-reader",
220 {
"infile", VariantType::String,
"cpvclusters.root", {
"Name of the input file"}},
221 {
"treename", VariantType::String,
"o2sim", {
"Name of input tree"}},
222 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
223 {
"nevents", VariantType::Int, -1, {
"number of events to run, -1: inf loop"}},
224 {
"terminate-on-eod", VariantType::Bool,
true, {
"terminate on end-of-data"}},