Skip to content

Commit 32451dc

Browse files
authored
DPL Analysis: add tf-offset option to mctracks-to-aod converter (#13711)
1 parent 0c73418 commit 32451dc

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

run/o2sim_mctracks_to_aod.cxx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,40 +49,46 @@ struct MctracksToAod {
4949
"Interaction rate to simulate"};
5050
Configurable<bool> filt{"filter-mctracks", false,
5151
"Filter tracks"};
52+
Configurable<uint64_t> tfOffset{"tf-offset", 0, "Start TF counter from an offset"};
5253
/** @} */
5354

5455
/** Number of timeframes */
5556
uint64_t mTimeFrame = 0;
5657
/** Interaction simulation */
5758
InteractionSampler mSampler;
58-
/** Whether to filter tracks */
59-
bool mFilter;
6059

6160
/** Initialize */
6261
void init(o2::framework::InitContext& /*ic*/)
6362
{
6463
mSampler.setInteractionRate(IR);
6564
mSampler.setFirstIR({0, 0});
6665
mSampler.init();
67-
mFilter = filt;
66+
67+
mTimeFrame = tfOffset;
6868
}
6969

7070
/** Run the conversion */
7171
void run(o2::framework::ProcessingContext& pc)
7272
{
73-
LOG(info) << "=== Running extended MC AOD exporter ===";
73+
LOG(debug) << "=== Running extended MC AOD exporter ===";
7474
using namespace o2::aodmchelpers;
7575
using McHeader = o2::dataformats::MCEventHeader;
7676
using McTrack = o2::MCTrack;
7777
using McTracks = std::vector<McTrack>;
7878

7979
auto nParts = pc.inputs().getNofParts(0);
8080
auto nPartsVerify = pc.inputs().getNofParts(1);
81+
82+
using o2::framework::Lifetime;
83+
using o2::framework::Output;
84+
8185
if (nParts != nPartsVerify) {
8286
LOG(warn) << "Mismatch between number of MC headers and "
8387
<< "number of track vectors: " << nParts
8488
<< " != " << nPartsVerify
8589
<< ", shipping the empty timeframe";
90+
pc.outputs().snapshot(Output{"TFF", "TFFilename", 0}, "");
91+
pc.outputs().snapshot(Output{"TFN", "TFNumber", 0}, ++mTimeFrame);
8692
return;
8793
}
8894
// TODO: include BC simulation
@@ -115,18 +121,15 @@ struct MctracksToAod {
115121
tracks,
116122
preselect,
117123
offset,
118-
mFilter,
124+
(bool)filt,
119125
false);
120126

121127
LOG(debug) << "Increment BC counter";
122128
bcCounter++;
123129
}
124-
using o2::framework::Lifetime;
125-
using o2::framework::Output;
126130

127-
++mTimeFrame;
128131
pc.outputs().snapshot(Output{"TFF", "TFFilename", 0}, "");
129-
pc.outputs().snapshot(Output{"TFN", "TFNumber", 0}, mTimeFrame);
132+
pc.outputs().snapshot(Output{"TFN", "TFNumber", 0}, ++mTimeFrame);
130133
}
131134
};
132135

0 commit comments

Comments
 (0)