48 auto initFunction = [propagateMC](
InitContext& ic) {
51 ic.options().get<std::string>(
"infile"));
52 auto treename = ic.options().get<std::string>(
"treename");
53 auto nofEvents = ic.options().get<
int>(
"nevents");
56 auto processAttributes = std::make_shared<ProcessAttributes>();
58 processAttributes->terminateOnEod = ic.options().get<
bool>(
"terminate-on-eod");
59 processAttributes->finished =
false;
60 processAttributes->datatype =
"PHOSDigit";
63 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
68 Output{
"PHS",
"DIGITS", subSpec},
"PHOSDigit"},
70 Output{
"PHS",
"DIGITTRIGREC", subSpec},
"PHOSDigitTrigRecords"},
71 Output{
"PHS",
"DIGITSMCTR", subSpec},
"PHOSDigitMCTruth");
73 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
78 Output{
"PHS",
"DIGITS", subSpec},
"PHOSDigit"},
80 Output{
"PHS",
"DIGITTRIGREC", subSpec},
"PHOSDigitTrigRecords"});
85 if (processAttributes->finished) {
89 auto publish = [&processAttributes, &pc, propagateMC]() {
91 if (processAttributes->reader->next()) {
92 (*processAttributes->reader)(pc, phosheader);
94 processAttributes->reader.reset();
105 pc.outputs().snapshot(
OutputRef{
"output", 0, {dummyheader}}, 0);
106 pc.outputs().snapshot(
OutputRef{
"outputTR", 0, {dummyheader}}, 0);
108 pc.outputs().snapshot(
OutputRef{
"outputMC", 0, {dummyheader}}, 0);
111 if ((processAttributes->finished = (
active ==
false)) && processAttributes->terminateOnEod) {
116 return processFunction;
119 std::vector<OutputSpec> outputSpecs;
120 outputSpecs.emplace_back(
OutputSpec{{
"output"},
"PHS",
"DIGITS", 0, Lifetime::Timeframe});
121 outputSpecs.emplace_back(
OutputSpec{{
"outputTR"},
"PHS",
"DIGITTRIGREC", 0, Lifetime::Timeframe});
123 outputSpecs.emplace_back(
OutputSpec{{
"outputMC"},
"PHS",
"DIGITSMCTR", 0, Lifetime::Timeframe});
132 {
"infile", VariantType::String,
"phosdigits.root", {
"Name of the input file"}},
133 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
134 {
"treename", VariantType::String,
"o2sim", {
"Name of input tree"}},
135 {
"nevents", VariantType::Int, -1, {
"number of events to run, -1: inf loop"}},
136 {
"terminate-on-eod", VariantType::Bool,
true, {
"terminate on end-of-data"}},
145 auto initFunction = [propagateMC](
InitContext& ic) {
148 ic.options().get<std::string>(
"infile"));
149 auto treename = ic.options().get<std::string>(
"treename");
150 auto nofEvents = ic.options().get<
int>(
"nevents");
153 auto processAttributes = std::make_shared<ProcessAttributes>();
155 processAttributes->terminateOnEod = ic.options().get<
bool>(
"terminate-on-eod");
156 processAttributes->finished =
false;
157 processAttributes->datatype =
"PHOSCell";
160 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
165 Output{
"PHS",
"CELLS", subSpec},
"PHOSCell"},
167 Output{
"PHS",
"CELLTRIGREC", subSpec},
"PHOSCellTrigRec"},
168 Output{
"PHS",
"CELLSMCTR", subSpec},
171 processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(),
176 Output{
"PHS",
"CELLS", subSpec},
"PHOSCell"},
178 Output{
"PHS",
"CELLTRIGREC", subSpec},
"PHOSCellTrigRec"});
183 if (processAttributes->finished) {
187 auto publish = [&processAttributes, &pc, propagateMC]() {
188 PHOSBlockHeader phosheader(
true);
189 if (processAttributes->reader->next()) {
190 (*processAttributes->reader)(pc, phosheader);
192 processAttributes->reader.reset();
202 PHOSBlockHeader dummyheader(
false);
203 pc.outputs().snapshot(
OutputRef{
"output", 0, {dummyheader}}, 0);
204 pc.outputs().snapshot(
OutputRef{
"outputTR", 0, {dummyheader}}, 0);
206 pc.outputs().snapshot(
OutputRef{
"outputMC", 0, {dummyheader}}, 0);
207 pc.outputs().snapshot(
OutputRef{
"outputMCmap", 0, {dummyheader}}, 0);
210 if ((processAttributes->finished = (
active ==
false)) && processAttributes->terminateOnEod) {
212 pc.services().get<
ControlService>().readyToQuit(framework::QuitRequest::Me);
215 return processFunction;
218 std::vector<OutputSpec> outputSpecs;
219 outputSpecs.emplace_back(
OutputSpec{{
"output"},
"PHS",
"CELLS", 0, Lifetime::Timeframe});
220 outputSpecs.emplace_back(
OutputSpec{{
"outputTR"},
"PHS",
"CELLTRIGREC", 0, Lifetime::Timeframe});
222 outputSpecs.emplace_back(
OutputSpec{{
"outputMC"},
"PHS",
"CELLSMCTR", 0, Lifetime::Timeframe});
223 outputSpecs.emplace_back(
OutputSpec{{
"outputMCmap"},
"PHS",
"CELLSMCMAP", 0, Lifetime::Timeframe});
232 {
"infile", VariantType::String,
"phoscells.root", {
"Name of the input file"}},
233 {
"input-dir", VariantType::String,
"none", {
"Input directory"}},
234 {
"treename", VariantType::String,
"o2sim", {
"Name of input tree"}},
235 {
"nevents", VariantType::Int, -1, {
"number of events to run, -1: inf loop"}},
236 {
"terminate-on-eod", VariantType::Bool,
true, {
"terminate on end-of-data"}},