56 mLabels = std::make_unique<TTreeReaderValue<dataformats::MCTruthContainer<MCLabel>>>(mTreeReader,
"MIDDigitMCLabels");
63 ic.
options().
get<std::string>(
"mid-digit-infile"));
82 TTreeReader mTreeReader{};
83 TTreeReaderValue<std::vector<ROFRecord>> mRofs = {mTreeReader,
"MIDROFRecords"};
84 TTreeReaderValue<std::vector<ColumnData>> mDigits = {mTreeReader,
"MIDDigit"};
85 std::unique_ptr<TTreeReaderValue<dataformats::MCTruthContainer<MCLabel>>> mLabels{};
87 bool mUseIRFrames =
false;
89 void connectTree(std::string
filename)
93 throw std::invalid_argument(fmt::format(
"Opening file {} failed",
filename));
96 auto tree =
file->Get<TTree>(
"o2sim");
98 throw std::invalid_argument(fmt::format(
"Tree o2sim not found in {}",
filename));
100 mTreeReader.SetTree(
tree);
101 mTreeReader.Restart();
107 if (!mTreeReader.Next()) {
108 throw std::invalid_argument(mTreeReader.fgEntryStatusText[mTreeReader.GetEntryStatus()]);
119 if (mTreeReader.GetCurrentEntry() + 1 >= mTreeReader.GetEntries()) {
127 std::vector<ROFRecord> rofs{};
128 std::vector<ColumnData>
digits{};
132 auto irFrames = pc.
inputs().
get<gsl::span<dataformats::IRFrame>>(
"driverInfo");
134 if (!irFrames.empty()) {
137 const auto irMin = irfSel.getIRFrames().front().getMin();
138 const auto irMax = irfSel.getIRFrames().back().getMax();
141 bool loadNextTF = mTreeReader.GetCurrentEntry() < 0;
145 if (loadNextTF && !mTreeReader.Next()) {
146 throw std::invalid_argument(mTreeReader.fgEntryStatusText[mTreeReader.GetEntryStatus()]);
150 if (!mRofs->empty() && mRofs->front().interactionRecord <= irMax &&
151 mRofs->back().interactionRecord >= irMin) {
152 for (
const auto& rof : *mRofs) {
153 if (irfSel.check(rof.interactionRecord) != -1) {
154 rofs.emplace_back(rof);
155 rofs.back().firstEntry =
digits.size();
156 rofs.back().nEntries = rof.nEntries;
157 digits.insert(
digits.end(), mDigits->begin() + rof.firstEntry, mDigits->begin() + rof.getEndIndex());
159 for (
auto idig = 0; idig < rof.nEntries; ++idig) {
160 labels.addElements(labels.getIndexedSize(), (*mLabels)->getLabels(rof.firstEntry + idig));
168 if ((mRofs->empty() || mRofs->back().interactionRecord < irMax) &&
169 mTreeReader.GetCurrentEntry() + 1 < mTreeReader.GetEntries()) {
186 if (irFrames.empty() || irFrames.back().isLast()) {
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.