Skip to content

Commit e79fe21

Browse files
committed
ITS3: make staggering optional
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent fa14293 commit e79fe21

17 files changed

Lines changed: 145 additions & 117 deletions

Detectors/Upgrades/ITS3/reconstruction/src/IOUtils.cxx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf,
7272

7373
// check for missing/empty/unset rofs
7474
// the code requires consistent monotonically increasing input without gaps
75-
const auto& timing = tf->getROFOverlapTableView().getLayer(layer);
75+
const auto& timing = tf->getROFOverlapTableView().getLayer(layer >= 0 ? layer : 0);
7676
if (timing.mNROFsTF != rofs.size()) {
7777
LOGP(fatal, "Received inconsistent number of rofs on layer:{} expected:{} received:{}", layer, timing.mNROFsTF, rofs.size());
7878
}
@@ -84,7 +84,7 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf,
8484
for (int clusterId{rof.getFirstEntry()}; clusterId < rof.getFirstEntry() + rof.getNEntries(); ++clusterId) {
8585
const auto& c = clusters[clusterId];
8686
const auto sensorID = c.getSensorID();
87-
const auto layer = geom->getLayer(sensorID);
87+
const auto lay = geom->getLayer(sensorID);
8888

8989
float sigmaY2{0}, sigmaZ2{0}, sigmaYZ{0};
9090
uint8_t clusterSize{0};
@@ -110,30 +110,37 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf,
110110
}
111111
math_utils::detail::bringToPMPi(alpha); // alpha is defined on -Pi,Pi
112112

113-
tf->addTrackingFrameInfoToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), x, alpha,
113+
tf->addTrackingFrameInfoToLayer(lay, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), x, alpha,
114114
std::array<float, 2>{y, trkXYZ.z()},
115115
std::array<float, 3>{sigmaY2, sigmaYZ, sigmaZ2});
116116

117117
/// Rotate to the global frame
118-
tf->addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), tf->getUnsortedClusters()[layer].size());
119-
tf->addClusterExternalIndexToLayer(layer, clusterId);
118+
tf->addClusterToLayer(lay, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), tf->getUnsortedClusters()[layer].size());
119+
tf->addClusterExternalIndexToLayer(lay, clusterId);
120+
}
121+
// effectively calculating an exclusive sum
122+
if (layer >= 0) {
123+
tf->mROFramesClusters[layer][iRof + 1] = tf->mUnsortedClusters[layer].size();
124+
} else {
125+
for (unsigned int iL{0}; iL < tf->mUnsortedClusters.size(); ++iL) {
126+
tf->mROFramesClusters[iL][iRof + 1] = tf->mUnsortedClusters[iL].size();
127+
}
120128
}
121-
tf->mROFramesClusters[layer][iRof + 1] = (int)tf->getUnsortedClusters()[layer].size();
122129
}
123130

124131
tf->setClusterSize(layer, clusterSizeVec);
125132

126-
if (layer == 1) {
127-
for (auto& v : tf->mNTrackletsPerCluster) {
128-
v.resize(tf->getUnsortedClusters()[1].size());
129-
}
130-
for (auto& v : tf->mNTrackletsPerClusterSum) {
131-
v.resize(tf->getUnsortedClusters()[1].size() + 1);
133+
if (layer == 1 || layer == -1) {
134+
for (auto i = 0; i < tf->mNTrackletsPerCluster.size(); ++i) {
135+
tf->mNTrackletsPerCluster[i].resize(tf->mUnsortedClusters[1].size());
136+
tf->mNTrackletsPerClusterSum[i].resize(tf->mUnsortedClusters[1].size() + 1);
132137
}
133138
}
134139

135140
if (mcLabels != nullptr) {
136-
tf->mClusterLabels[layer] = mcLabels;
141+
tf->mClusterLabels[layer >= 0 ? layer : 0] = mcLabels;
142+
} else {
143+
tf->mClusterLabels[layer >= 0 ? layer : 0] = nullptr;
137144
}
138145
return 0;
139146
}

Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ void Digitizer::process(const std::vector<itsmft::Hit>* hits, int evID, int srcI
9696
return (*hits)[lhs].GetDetectorID() < (*hits)[rhs].GetDetectorID();
9797
});
9898
for (int i : hitIdx | std::views::filter([&](int idx) {
99+
if (layer < 0) {
100+
return true;
101+
}
99102
return mGeometry->getLayer((*hits)[idx].GetDetectorID()) == layer;
100103
})) {
101104
processHit((*hits)[i], mROFrameMax, evID, srcID, layer);
@@ -170,7 +173,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast, int layer)
170173
auto& extra = *(mExtraBuff.front().get());
171174
for (size_t iChip{0}; iChip < mChips.size(); ++iChip) {
172175
auto& chip = mChips[iChip];
173-
if (chip.isDisabled() || mGeometry->getLayer(chip.getChipIndex()) != layer) {
176+
if (chip.isDisabled() || (layer >= 0 && mGeometry->getLayer(chip.getChipIndex()) != layer)) {
174177
continue;
175178
}
176179
chip.addNoise(mROFrameMin, mROFrameMin, &mParams);
@@ -216,7 +219,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast, int layer)
216219
}
217220
}
218221

219-
void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int layer)
222+
void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay)
220223
{
221224
// convert single hit to digits
222225
auto chipID = hit.GetDetectorID();
@@ -248,18 +251,16 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
248251
}
249252
float tTot = mParams.getSignalShape().getMaxDuration();
250253
// frame of the hit signal start wrt event ROFrame
251-
int roFrameRel = int(timeInROF * mParams.getROFrameLengthInv(layer));
254+
int roFrameRel = int(timeInROF * mParams.getROFrameLengthInv(lay));
252255
// frame of the hit signal end wrt event ROFrame: in the triggered mode we read just 1 frame
253-
uint32_t roFrameRelMax = mParams.isContinuous() ? (timeInROF + tTot) * mParams.getROFrameLengthInv(layer) : roFrameRel;
256+
uint32_t roFrameRelMax = mParams.isContinuous() ? (timeInROF + tTot) * mParams.getROFrameLengthInv(lay) : roFrameRel;
254257
int nFrames = roFrameRelMax + 1 - roFrameRel;
255258
uint32_t roFrameMax = mNewROFrame + roFrameRelMax;
256-
if (roFrameMax > maxFr) {
257-
maxFr = roFrameMax; // if signal extends beyond current maxFrame, increase the latter
258-
}
259+
maxFr = std::max(roFrameMax, maxFr); // if signal extends beyond current maxFrame, increase the latter
259260

260261
// here we start stepping in the depth of the sensor to generate charge diffision
261-
int detID{hit.GetDetectorID()};
262-
const auto& matrix = mGeometry->getMatrixL2G(detID);
262+
const int layer = mGeometry->getLayer(chipID);
263+
const auto& matrix = mGeometry->getMatrixL2G(chipID);
263264
int nSteps = chip.isIB() ? mParams.getIBNSimSteps() : mParams.getNSimSteps();
264265
float nStepsInv = chip.isIB() ? mParams.getIBNSimStepsInv() : mParams.getNSimStepsInv();
265266
math_utils::Vector3D<float> xyzLocS, xyzLocE;
@@ -422,7 +423,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
422423
continue;
423424
}
424425
uint16_t colIS = icol + colS;
425-
registerDigits(chip, roFrameAbs, timeInROF, nFrames, rowIS, colIS, nEle, lbl, layer);
426+
registerDigits(chip, roFrameAbs, timeInROF, nFrames, rowIS, colIS, nEle, lbl, lay);
426427
}
427428
}
428429
}

Detectors/Upgrades/ITS3/workflow/include/ITS3Workflow/ClustererSpec.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ClustererDPL : public Task
2929
public:
3030
static constexpr int NLayers = 7;
3131

32-
ClustererDPL(const std::shared_ptr<o2::base::GRPGeomRequest>& gr, bool useMC) : mGGCCDBRequest(gr), mUseMC(useMC) {}
32+
ClustererDPL(const std::shared_ptr<o2::base::GRPGeomRequest>& gr, bool useMC, bool doStag) : mGGCCDBRequest(gr), mUseMC(useMC), mDoStaggering(doStag) {}
3333
void init(InitContext& ic) final;
3434
void run(ProcessingContext& pc) final;
3535
void finaliseCCDB(ConcreteDataMatcher& matcher, void* obj) final;
@@ -42,13 +42,14 @@ class ClustererDPL : public Task
4242
bool mUseMC = true;
4343
int mNThreads = 1;
4444
bool mUseClusterDictionary = true;
45+
bool mDoStaggering = false;
4546
std::vector<InputSpec> mFilter;
4647
std::unique_ptr<o2::its3::Clusterer> mClusterer = nullptr;
4748
};
4849

4950
/// create a processor spec
5051
/// run ITS cluster finder
51-
framework::DataProcessorSpec getClustererSpec(bool useMC);
52+
framework::DataProcessorSpec getClustererSpec(bool useMC, bool doStag);
5253

5354
} // namespace o2::its3
5455

Detectors/Upgrades/ITS3/workflow/include/ITS3Workflow/DigitReaderSpec.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ITS3DigitReader final : public Task
3838
public:
3939
static constexpr int NLayers = 7;
4040

41-
ITS3DigitReader(bool useMC, bool useCalib);
41+
ITS3DigitReader(bool useMC, bool doStag, bool useCalib);
4242
~ITS3DigitReader() override = default;
4343
void init(InitContext& ic) final;
4444
void run(ProcessingContext& pc) final;
@@ -56,7 +56,10 @@ class ITS3DigitReader final : public Task
5656

5757
std::string getBranchName(const std::string& base, int index)
5858
{
59-
return base + "_" + std::to_string(index);
59+
if (mDoStaggering) {
60+
return base + "_" + std::to_string(index);
61+
}
62+
return base;
6063
}
6164

6265
template <typename Ptr>
@@ -67,6 +70,7 @@ class ITS3DigitReader final : public Task
6770

6871
bool mUseMC = true; // use MC truth
6972
bool mUseCalib = true; // send calib data
73+
bool mDoStaggering = false;
7074

7175
std::string mDetName;
7276
std::string mDetNameLC;
@@ -79,7 +83,7 @@ class ITS3DigitReader final : public Task
7983

8084
/// create a processor spec
8185
/// read ITS/MFT Digit data from a root file
82-
framework::DataProcessorSpec getITS3DigitReaderSpec(bool useMC = true, bool useCalib = false, std::string defname = "it3digits.root");
86+
framework::DataProcessorSpec getITS3DigitReaderSpec(bool useMC = true, bool doStag = false, bool useCalib = false, std::string defname = "it3digits.root");
8387

8488
} // namespace o2::its3
8589

Detectors/Upgrades/ITS3/workflow/include/ITS3Workflow/DigitWriterSpec.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@
1414

1515
#include "Framework/DataProcessorSpec.h"
1616

17-
namespace o2
17+
namespace o2::its3
1818
{
19-
namespace its3
20-
{
21-
22-
o2::framework::DataProcessorSpec getITS3DigitWriterSpec(bool mctruth = true, bool dec = false, bool calib = false);
23-
} // namespace its3
24-
} // end namespace o2
19+
o2::framework::DataProcessorSpec getITS3DigitWriterSpec(bool mctruth = true, bool doStag = false, bool dec = false, bool calib = false);
20+
} // namespace o2::its3
2521

2622
#endif /* STEER_ITSMFTDIGITWRITER_H_ */

Detectors/Upgrades/ITS3/workflow/include/ITS3Workflow/RecoWorkflow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace o2::its3::reco_workflow
2222
{
2323

2424
framework::WorkflowSpec getWorkflow(bool useMC,
25+
bool doStag,
2526
its::TrackingMode::Type trmode,
2627
o2::gpu::gpudatatypes::DeviceType dtype,
2728
bool useGPUWorkflow,

Detectors/Upgrades/ITS3/workflow/include/ITS3Workflow/TrackerSpec.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class TrackerDPL : public framework::Task
4242
public:
4343
TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
4444
bool isMC,
45+
bool doStag,
4546
int trgType,
4647
its::TrackingMode::Type trmode = its::TrackingMode::Unset,
4748
const bool overrBeamEst = false,
@@ -69,7 +70,7 @@ class TrackerDPL : public framework::Task
6970

7071
/// create a processor spec
7172
/// run ITS CA tracker
72-
framework::DataProcessorSpec getTrackerSpec(bool useMC, bool useGeom, int useTrig, its::TrackingMode::Type trMode, const bool overrBeamEst = false, gpu::gpudatatypes::DeviceType dType = gpu::gpudatatypes::DeviceType::CPU);
73+
framework::DataProcessorSpec getTrackerSpec(bool useMC, bool doStag, bool useGeom, int useTrig, its::TrackingMode::Type trMode, const bool overrBeamEst = false, gpu::gpudatatypes::DeviceType dType = gpu::gpudatatypes::DeviceType::CPU);
7374

7475
} // namespace o2::its3
7576

Detectors/Upgrades/ITS3/workflow/src/ClustererSpec.cxx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void ClustererDPL::init(InitContext& ic)
4444
mClusterer->setNChips(its3::constants::detID::nChips + itsmft::ChipMappingITS::getNChips(itsmft::ChipMappingITS::MB) + itsmft::ChipMappingITS::getNChips(itsmft::ChipMappingITS::OB));
4545

4646
// prepare data filter
47-
for (int iLayer = 0; iLayer < NLayers; ++iLayer) {
47+
for (int iLayer = 0; iLayer < (mDoStaggering ? NLayers : 1); ++iLayer) {
4848
mFilter.emplace_back("digits", "IT3", "DIGITS", iLayer, Lifetime::Timeframe);
4949
mFilter.emplace_back("ROframe", "IT3", "DIGITSROF", iLayer, Lifetime::Timeframe);
5050
if (mUseMC) {
@@ -82,18 +82,20 @@ void ClustererDPL::run(ProcessingContext& pc)
8282
uint64_t nClusters{0};
8383
TStopwatch sw;
8484
o2::itsmft::DigitPixelReader reader;
85-
for (uint32_t iLayer{0}; iLayer < NLayers; ++iLayer) {
85+
for (uint32_t iLayer{0}; iLayer < (mDoStaggering ? NLayers : 1); ++iLayer) {
86+
int layer = (mDoStaggering) ? iLayer : -1;
8687
sw.Start();
8788
LOG(info) << "IT3Clusterer on layer " << iLayer << " pulled " << digits[iLayer].size() << " digits, in " << rofs[iLayer].size() << " RO frames";
88-
mClusterer->setMaxROFDepthToSquash(mClusterer->getMaxROFDepthToSquash(iLayer));
89+
LOG(info) << "IT3Clusterer" << ((mDoStaggering) ? std::format(" on layer {}", layer) : "") << " pulled " << digits[iLayer].size() << " digits, in " << rofs[iLayer].size() << " RO frames";
90+
mClusterer->setMaxROFDepthToSquash(mClusterer->getMaxROFDepthToSquash(layer));
8991
o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel> labels(labelsbuffer[iLayer]);
90-
reader.setSquashingDepth(mClusterer->getMaxROFDepthToSquash(iLayer));
92+
reader.setSquashingDepth(mClusterer->getMaxROFDepthToSquash(layer));
9193
reader.setSquashingDist(mClusterer->getMaxRowColDiffToMask()); // Sharing same parameter/logic with masking
92-
reader.setMaxBCSeparationToSquash(mClusterer->getMaxBCSeparationToSquash(iLayer));
94+
reader.setMaxBCSeparationToSquash(mClusterer->getMaxBCSeparationToSquash(layer));
9395
reader.setDigits(digits[iLayer]);
9496
reader.setROFRecords(rofs[iLayer]);
9597
if (mUseMC) {
96-
LOG(info) << "IT3Clusterer on layer " << iLayer << " pulled " << labels.getNElements() << " labels ";
98+
LOG(info) << "IT3Clusterer" << ((mDoStaggering) ? std::format(" on layer {}", layer) : "") << " pulled " << labels.getNElements() << " labels ";
9799
reader.setDigitsMCTruth(labels.getIndexedSize() > 0 ? &labels : nullptr);
98100
}
99101
reader.init();
@@ -128,18 +130,18 @@ void ClustererDPL::run(ProcessingContext& pc)
128130
for (const auto& rof : clusROFVec) {
129131
const auto& ir = rof.getBCData();
130132
if (ir < firstIR) {
131-
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {} on layer {}", ir.asString(), firstTForbit, iLayer);
133+
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {}{}", ir.asString(), firstTForbit, ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
132134
continue;
133135
}
134136
auto irToFirst = ir - firstIR;
135137
if (irToFirst.toLong() - par.getROFDelayInBC(iLayer) < 0) {
136-
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {} due to imposed ROF delay on layer {}", ir.asString(), firstTForbit, iLayer);
138+
LOGP(warn, "Discard ROF {} preceding TF 1st orbit {} due to imposed ROF delay{}", ir.asString(), firstTForbit, ((mDoStaggering) ? std::format(" on layer {}", iLayer) : ""));
137139
continue;
138140
}
139141
irToFirst -= par.getROFDelayInBC(iLayer);
140142
const long irROF = irToFirst.toLong() / par.getROFLengthInBC(iLayer);
141143
if (irROF >= nROFsTF) {
142-
LOGP(warn, "Discard ROF {} exceeding TF orbit range on layer {}", ir.asString(), iLayer);
144+
LOGP(warn, "Discard ROF {} exceeding TF orbit range{}", ir.asString(), ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
143145
continue;
144146
}
145147
auto& expROF = expClusRofVec[irROF];
@@ -148,11 +150,11 @@ void ClustererDPL::run(ProcessingContext& pc)
148150
expROF.setNEntries(rof.getNEntries());
149151
} else {
150152
if (expROF.getNEntries() < rof.getNEntries()) {
151-
LOGP(warn, "Repeating {} with {} clusters, prefer to already processed instance with {} clusters on layer {}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), iLayer);
153+
LOGP(warn, "Repeating {} with {} clusters, prefer to already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
152154
expROF.setFirstEntry(rof.getFirstEntry());
153155
expROF.setNEntries(rof.getNEntries());
154156
} else {
155-
LOGP(warn, "Repeating {} with {} clusters, discard preferring already processed instance with {} clusters on layer {}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), iLayer);
157+
LOGP(warn, "Repeating {} with {} clusters, discard preferring already processed instance with {} clusters{}", rof.asString(), rof.getNEntries(), expROF.getNEntries(), ((mDoStaggering) ? std::format(" on layer {}", layer) : ""));
156158
}
157159
}
158160
}
@@ -257,11 +259,11 @@ void ClustererDPL::endOfStream(o2::framework::EndOfStreamContext& /*ec*/)
257259
mClusterer->print();
258260
}
259261

260-
DataProcessorSpec getClustererSpec(bool useMC)
262+
DataProcessorSpec getClustererSpec(bool useMC, bool doStag)
261263
{
262264
std::vector<InputSpec> inputs;
263265
std::vector<OutputSpec> outputs;
264-
for (uint32_t iLayer = 0; iLayer < ClustererDPL::NLayers; ++iLayer) {
266+
for (uint32_t iLayer = 0; iLayer < (doStag ? ClustererDPL::NLayers : 1); ++iLayer) {
265267
inputs.emplace_back("digits", "IT3", "DIGITS", iLayer, Lifetime::Timeframe);
266268
inputs.emplace_back("ROframes", "IT3", "DIGITSROF", iLayer, Lifetime::Timeframe);
267269
outputs.emplace_back("ITS", "COMPCLUSTERS", iLayer, Lifetime::Timeframe);
@@ -288,7 +290,7 @@ DataProcessorSpec getClustererSpec(bool useMC)
288290
.name = "its3-clusterer",
289291
.inputs = inputs,
290292
.outputs = outputs,
291-
.algorithm = AlgorithmSpec{adaptFromTask<ClustererDPL>(ggRequest, useMC)},
293+
.algorithm = AlgorithmSpec{adaptFromTask<ClustererDPL>(ggRequest, useMC, doStag)},
292294
.options = Options{
293295
{"ignore-cluster-dictionary", VariantType::Bool, false, {"do not use cluster dictionary, always store explicit patterns"}},
294296
{"nthreads", VariantType::Int, 1, {"Number of clustering threads"}}}};

Detectors/Upgrades/ITS3/workflow/src/DigitReaderSpec.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ using namespace o2::itsmft;
2929
namespace o2::its3
3030
{
3131

32-
ITS3DigitReader::ITS3DigitReader(bool useMC, bool useCalib) : mUseMC(useMC), mUseCalib(useCalib), mDetNameLC(mDetName = "IT3"), mDigTreeName("o2sim")
32+
ITS3DigitReader::ITS3DigitReader(bool useMC, bool doStag, bool useCalib) : mUseMC(useMC), mDoStaggering(doStag), mUseCalib(useCalib), mDetNameLC(mDetName = "IT3"), mDigTreeName("o2sim")
3333
{
3434
mDigBranchName = mDetName + mDigBranchName;
3535
mDigROFBranchName = mDetName + mDigROFBranchName;
@@ -50,7 +50,7 @@ void ITS3DigitReader::run(ProcessingContext& pc)
5050
assert(ent < mTree->GetEntries()); // this should not happen
5151

5252
mTree->GetEntry(ent);
53-
for (uint32_t iLayer = 0; iLayer < NLayers; ++iLayer) {
53+
for (uint32_t iLayer = 0; iLayer < (mDoStaggering ? NLayers : 1); ++iLayer) {
5454
if (!mDigROFRec[iLayer] || !mDigits[iLayer]) {
5555
throw std::runtime_error("ITS3 digit reader requires all 7 layer branches to be present and populated in every entry");
5656
}
@@ -90,11 +90,11 @@ void ITS3DigitReader::connectTree(const std::string& filename)
9090
assert(mFile && !mFile->IsZombie());
9191
mTree.reset((TTree*)mFile->Get(mDigTreeName.c_str()));
9292
assert(mTree);
93-
for (int iLayer = 0; iLayer < NLayers; ++iLayer) {
93+
for (int iLayer = 0; iLayer < (mDoStaggering ? NLayers : 1); ++iLayer) {
9494
const auto rofBranchName = getBranchName(mDigROFBranchName, iLayer);
9595
const auto digBranchName = getBranchName(mDigBranchName, iLayer);
9696
if (!mTree->GetBranch(rofBranchName.c_str()) || !mTree->GetBranch(digBranchName.c_str())) {
97-
throw std::runtime_error("ITS3 digit reader requires all 7 layer branches in the input file");
97+
throw std::runtime_error("ITS3 digit reader requires all branches in the input file");
9898
}
9999
setBranchAddress(mDigROFBranchName, mDigROFRec[iLayer], iLayer);
100100
setBranchAddress(mDigBranchName, mDigits[iLayer], iLayer);
@@ -110,10 +110,10 @@ void ITS3DigitReader::connectTree(const std::string& filename)
110110
LOG(info) << "Loaded tree from " << filename << " with " << mTree->GetEntries() << " entries";
111111
}
112112

113-
DataProcessorSpec getITS3DigitReaderSpec(bool useMC, bool useCalib, std::string defname)
113+
DataProcessorSpec getITS3DigitReaderSpec(bool useMC, bool doStag, bool useCalib, std::string defname)
114114
{
115115
std::vector<OutputSpec> outputSpec;
116-
for (uint32_t iLayer = 0; iLayer < ITS3DigitReader::NLayers; ++iLayer) {
116+
for (uint32_t iLayer = 0; iLayer < (doStag ? ITS3DigitReader::NLayers : 1); ++iLayer) {
117117
outputSpec.emplace_back("IT3", "DIGITS", iLayer, Lifetime::Timeframe);
118118
outputSpec.emplace_back("IT3", "DIGITSROF", iLayer, Lifetime::Timeframe);
119119
if (useMC) {
@@ -122,11 +122,11 @@ DataProcessorSpec getITS3DigitReaderSpec(bool useMC, bool useCalib, std::string
122122
}
123123

124124
return DataProcessorSpec{
125-
"its3-digit-reader",
126-
Inputs{},
127-
outputSpec,
128-
AlgorithmSpec{adaptFromTask<ITS3DigitReader>(useMC, useCalib)},
129-
Options{
125+
.name = "its3-digit-reader",
126+
.inputs = Inputs{},
127+
.outputs = outputSpec,
128+
.algorithm = AlgorithmSpec{adaptFromTask<ITS3DigitReader>(useMC, doStag, useCalib)},
129+
.options = Options{
130130
{"it3-digit-infile", VariantType::String, defname, {"Name of the input digit file"}}}};
131131
}
132132

0 commit comments

Comments
 (0)