Skip to content

Commit 95b10aa

Browse files
committed
Support per-layer ITS clusters in trd-tracking-workflow
1 parent c40c61d commit 95b10aa

3 files changed

Lines changed: 24 additions & 15 deletions

File tree

‎Detectors/TRD/workflow/include/TRDWorkflow/TRDGlobalTrackingSpec.h‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "GPUTRDRecoParam.h"
2424
#include "ReconstructionDataFormats/GlobalTrackID.h"
2525
#include "DataFormatsGlobalTracking/RecoContainer.h"
26+
#include "DataFormatsITSMFT/ClustersPerLayer.h"
2627
#include "DataFormatsTRD/TrackTRD.h"
2728
#include "DataFormatsTRD/TrackTriggerRecord.h"
2829
#include "DataFormatsTRD/PID.h"
@@ -51,6 +52,8 @@ namespace trd
5152
class TRDGlobalTracking : public o2::framework::Task
5253
{
5354
public:
55+
using ITSClusters = o2::itsmft::ClustersPerLayer<o2::BaseCluster<float>>;
56+
5457
TRDGlobalTracking(bool useMC, bool withPID, PIDPolicy policy, std::shared_ptr<o2::globaltracking::DataRequest> dataRequest, std::shared_ptr<o2::base::GRPGeomRequest> gr,
5558
o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool requestCTPLumi) : mUseMC(useMC), mWithPID(withPID), mDataRequest(dataRequest), mGGCCDBRequest(gr), mTrkMask(src), mTrigRecFilter(trigRecFilterActive), mStrict(strict), mPolicy(policy), mRequestCTPLumi(requestCTPLumi) {}
5659
~TRDGlobalTracking() override = default;
@@ -99,7 +102,7 @@ class TRDGlobalTracking : public o2::framework::Task
99102
gsl::span<const o2::itsmft::TrkClusRef> mITSABRefsArray; ///< input ITS-TPC Afterburner ITS tracklets references
100103
gsl::span<const int> mITSTrackClusIdx; ///< input ITS track cluster indices span
101104
gsl::span<const int> mITSABTrackClusIdx; ///< input ITSAB track cluster indices span
102-
std::vector<o2::BaseCluster<float>> mITSClustersArray; ///< ITS clusters created in run() method from compact clusters
105+
ITSClusters mITSClustersArray; ///< ITS clusters created in run() from compact clusters, by composed ID
103106
const o2::itsmft::TopologyDictionary* mITSDict = nullptr; ///< ITS cluster patterns dictionary
104107
#ifdef ENABLE_UPGRADES
105108
const o2::its3::TopologyDictionary* mIT3Dict = nullptr; ///< IT3 cluster patterns dictionary
@@ -114,7 +117,7 @@ class TRDGlobalTracking : public o2::framework::Task
114117
};
115118

116119
/// create a processor spec
117-
framework::DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict /* = false*/, bool withPID /* = false*/, PIDPolicy policy /* = PIDPolicy::DEFAULT*/, bool requestCTPLumi);
120+
framework::DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, o2::dataformats::GlobalTrackID::mask_t src, bool trigRecFilterActive, bool strict /* = false*/, bool withPID /* = false*/, PIDPolicy policy /* = PIDPolicy::DEFAULT*/, bool requestCTPLumi, bool itsStag);
118121

119122
} // namespace trd
120123
} // namespace o2

‎Detectors/TRD/workflow/src/TRDGlobalTrackingSpec.cxx‎

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -331,20 +331,24 @@ void TRDGlobalTracking::run(ProcessingContext& pc)
331331
mITSTrackClusIdx = inputTracks.getITSTracksClusterRefs();
332332
mITSABRefsArray = inputTracks.getITSABRefs();
333333
mITSABTrackClusIdx = inputTracks.getITSABClusterRefs();
334-
const auto clusITS = inputTracks.getITSClusters();
335-
const auto patterns = inputTracks.getITSClustersPatterns();
336-
auto pattIt = patterns.begin();
337-
mITSClustersArray.clear();
338-
mITSClustersArray.reserve(clusITS.size());
334+
int nLr = mDataRequest->getITSPerLayer() ? o2::globaltracking::MaxITSLayers : 1;
335+
mITSClustersArray.init(nLr);
336+
for (int lr = 0; lr < nLr; lr++) { // with a single (monolithic) input all clusters are in the layer slot 0
337+
mITSClustersArray.beginLayer(lr);
338+
const auto clusITS = inputTracks.getITSClusters(lr);
339+
auto pattIt = inputTracks.getITSClustersPatterns(lr).begin();
340+
mITSClustersArray.getClusters().reserve(mITSClustersArray.size() + clusITS.size());
339341
#ifdef ENABLE_UPGRADES
340-
if (o2::GlobalParams::Instance().withITS3) {
341-
o2::its3::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray, mIT3Dict);
342-
} else {
343-
o2::its::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray, mITSDict);
344-
}
342+
if (o2::GlobalParams::Instance().withITS3) {
343+
o2::its3::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray.getClusters(), mIT3Dict);
344+
} else {
345+
o2::its::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray.getClusters(), mITSDict);
346+
}
345347
#else
346-
o2::its::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray, mITSDict);
348+
o2::its::ioutils::convertCompactClusters(clusITS, pattIt, mITSClustersArray.getClusters(), mITSDict);
347349
#endif
350+
}
351+
mITSClustersArray.finalize();
348352
}
349353

350354
LOGF(info, "There are %i tracklets in total from %i trigger records", mChainTracking->mIOPtrs.nTRDTracklets, mChainTracking->mIOPtrs.nTRDTriggerRecords);
@@ -971,11 +975,12 @@ void TRDGlobalTracking::endOfStream(EndOfStreamContext& ec)
971975
mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
972976
}
973977

974-
DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool withPID, PIDPolicy policy, bool requestCTPLumi)
978+
DataProcessorSpec getTRDGlobalTrackingSpec(bool useMC, GTrackID::mask_t src, bool trigRecFilterActive, bool strict, bool withPID, PIDPolicy policy, bool requestCTPLumi, bool itsStag)
975979
{
976980
std::vector<OutputSpec> outputs;
977981
uint32_t ss = o2::globaltracking::getSubSpec(strict ? o2::globaltracking::MatchingType::Strict : o2::globaltracking::MatchingType::Standard);
978982
std::shared_ptr<DataRequest> dataRequest = std::make_shared<DataRequest>();
983+
dataRequest->setITSPerLayer(itsStag);
979984
if (strict) {
980985
dataRequest->setMatchingInputStrict();
981986
}

‎Detectors/TRD/workflow/src/trd-tracking-workflow.cxx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
8989
auto pulseHeight = configcontext.options().get<bool>("enable-ph");
9090
auto digitsSpec = configcontext.options().get<int>("trd-digits-spec");
9191
auto sclOpt = o2::tpc::CorrectionMapsOptions::parseGlobalOptions(configcontext.options());
92+
auto doStag = o2::itsmft::DPLAlpideParamInitializer::isITSStaggeringEnabled(configcontext);
9293
bool rootInput = !configcontext.options().get<bool>("disable-root-input");
9394
GTrackID::mask_t srcTRD = allowedSources & GTrackID::getSourcesMask(configcontext.options().get<std::string>("track-sources"));
9495
if (strict && (srcTRD & ~GTrackID::getSourcesMask("TPC")).any()) {
@@ -118,7 +119,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
118119
if (!configcontext.options().get<bool>("disable-root-input")) {
119120
specs.emplace_back(o2::tpc::getTPCScalerSpec(sclOpt));
120121
}
121-
specs.emplace_back(o2::trd::getTRDGlobalTrackingSpec(useMC, srcTRD, trigRecFilterActive, strict, pid, policy, sclOpt.requestCTPLumi));
122+
specs.emplace_back(o2::trd::getTRDGlobalTrackingSpec(useMC, srcTRD, trigRecFilterActive, strict, pid, policy, sclOpt.requestCTPLumi, doStag));
122123
if (vdexb || gain) {
123124
specs.emplace_back(o2::trd::getTRDTrackBasedCalibSpec(srcTRD, vdexb, gain));
124125
}

0 commit comments

Comments
 (0)