Project
Loading...
Searching...
No Matches
TrackerSpec.cxx
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <vector>
13#include <TMap.h>
14#include <TObjString.h>
23
24namespace o2
25{
26using namespace framework;
27namespace its
28{
29TrackerDPL::TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
30 bool isMC,
31 bool doStag,
32 int trgType,
33 const TrackingMode::Type trMode,
34 const bool overrBeamEst,
35 o2::gpu::gpudatatypes::DeviceType dType) : mGGCCDBRequest(gr),
36 mRecChain{o2::gpu::GPUReconstruction::CreateInstance(dType, true)},
37 mITSTrackingInterface{isMC, doStag, trgType, overrBeamEst}
38{
39 mITSTrackingInterface.setTrackingMode(trMode);
40}
41
43{
44 mTimer.Stop();
45 mTimer.Reset();
47 mChainITS.reset(mRecChain->AddChain<o2::gpu::GPUChainITS>());
48 mITSTrackingInterface.setTraitsFromProvider(mChainITS->GetITSVertexerTraits(),
49 mChainITS->GetITSTrackerTraits(),
50 mChainITS->GetITSTimeframe());
51}
52
54{
55 end();
56}
57
59{
60 auto cput = mTimer.CpuTime();
61 auto realt = mTimer.RealTime();
62 mTimer.Start(false);
63 mITSTrackingInterface.updateTimeDependentParams(pc);
64 storeConfigs(pc);
65 mITSTrackingInterface.run(pc);
66 mTimer.Stop();
67 LOGP(info, "CPU Reconstruction time for this TF {:.2f} s (cpu), {:.2f} s (wall)", mTimer.CpuTime() - cput, mTimer.RealTime() - realt);
68}
69
70void TrackerDPL::storeConfigs(ProcessingContext& pc)
71{
72 static bool first = true;
73 if (first) {
74 first = false;
76 const auto& vtconf = o2::its::VertexerParamConfig::Instance();
77 const auto& trconf = o2::its::TrackerParamConfig::Instance();
80 TMap md;
81 md.SetOwnerKeyValue();
82 md.Add(new TObjString(vtconf.getName().c_str()), new TObjString(o2::conf::ConfigurableParam::asJSON(vtconf.getName()).c_str()));
83 md.Add(new TObjString(trconf.getName().c_str()), new TObjString(o2::conf::ConfigurableParam::asJSON(trconf.getName()).c_str()));
84 pc.outputs().snapshot(Output{"META", "ITSTRACKER", 0}, md);
85 }
86 }
87}
88
90{
91 mITSTrackingInterface.finaliseCCDB(matcher, obj);
92}
93
98
99void TrackerDPL::end()
100{
101 if (static bool printOnce{false}; !printOnce) {
102 printOnce = true;
103 mITSTrackingInterface.printSummary();
104 LOGF(info, "ITS CA-Tracker total timing: Cpu: %.3e Real: %.3e s in %d slots", mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
105 }
106}
107
108DataProcessorSpec getTrackerSpec(bool useMC, bool doStag, bool useGeom, int trgType, TrackingMode::Type trMode, const bool overrBeamEst, o2::gpu::gpudatatypes::DeviceType dType)
109{
111 std::vector<InputSpec> inputs;
112 for (int iLayer = 0; iLayer < mLayers; ++iLayer) {
113 inputs.emplace_back("compClusters", "ITS", "COMPCLUSTERS", iLayer, Lifetime::Timeframe);
114 inputs.emplace_back("patterns", "ITS", "PATTERNS", iLayer, Lifetime::Timeframe);
115 inputs.emplace_back("ROframes", "ITS", "CLUSTERSROF", iLayer, Lifetime::Timeframe);
116 if (useMC) {
117 inputs.emplace_back("itsmclabels", "ITS", "CLUSTERSMCTR", iLayer, Lifetime::Timeframe);
118 }
119 }
120 if (trgType == 1) {
121 inputs.emplace_back("phystrig", "ITS", "PHYSTRIG", 0, Lifetime::Timeframe);
122 } else if (trgType == 2) {
123 inputs.emplace_back("phystrig", "TRD", "TRKTRGRD", 0, Lifetime::Timeframe);
124 }
125 inputs.emplace_back("itscldict", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary"));
126 inputs.emplace_back("itsalppar", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam"));
127 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
128 true, // GRPECS=true
129 false, // GRPLHCIF
130 true, // GRPMagField
131 true, // askMatLUT
133 inputs,
134 true);
135 if (!useGeom) {
136 ggRequest->addInput({"itsTGeo", "ITS", "GEOMTGEO", 0, Lifetime::Condition, framework::ccdbParamSpec("ITS/Config/Geometry")}, inputs);
137 }
138 if (overrBeamEst) {
139 inputs.emplace_back("meanvtx", "GLO", "MEANVERTEX", 0, Lifetime::Condition, ccdbParamSpec("GLO/Calib/MeanVertex", {}, 1));
140 }
141
142 std::vector<OutputSpec> outputs;
143 outputs.emplace_back("ITS", "TRACKS", 0, Lifetime::Timeframe);
144 outputs.emplace_back("ITS", "TRACKCLSID", 0, Lifetime::Timeframe);
145 outputs.emplace_back("ITS", "ITSTrackROF", 0, Lifetime::Timeframe);
146 outputs.emplace_back("ITS", "VERTICES", 0, Lifetime::Timeframe);
147 outputs.emplace_back("ITS", "VERTICESROF", 0, Lifetime::Timeframe);
148 outputs.emplace_back("ITS", "IRFRAMES", 0, Lifetime::Timeframe);
149 if (useMC) {
150 outputs.emplace_back("ITS", "VERTICESMCTR", 0, Lifetime::Timeframe);
151 outputs.emplace_back("ITS", "VERTICESMCPUR", 0, Lifetime::Timeframe);
152 outputs.emplace_back("ITS", "TRACKSMCTR", 0, Lifetime::Timeframe);
153 }
154 outputs.emplace_back("META", "ITSTRACKER", 0, Lifetime::Sporadic);
155
156 return DataProcessorSpec{
157 .name = "its-tracker",
158 .inputs = inputs,
159 .outputs = outputs,
160 .algorithm = AlgorithmSpec{adaptFromTask<TrackerDPL>(ggRequest,
161 useMC,
162 doStag,
163 trgType,
164 trMode,
165 overrBeamEst,
166 dType)},
167 .options = Options{}};
168}
169
170} // namespace its
171} // namespace o2
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
static std::string getConfigOutputFileName(const std::string &procName, const std::string &confName="", bool json=true)
Definition NameConf.cxx:120
static std::string asJSON(std::string const &keyOnly="")
static void write(std::string const &filename, std::string const &keyOnly="")
void snapshot(const Output &spec, T const &object)
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
ServiceRegistryRef services()
The services registry associated with this processing context.
void run(framework::ProcessingContext &pc)
void setTrackingMode(TrackingMode::Type mode=TrackingMode::Unset)
virtual void updateTimeDependentParams(framework::ProcessingContext &pc)
virtual void finaliseCCDB(framework::ConcreteDataMatcher &matcher, void *obj)
void setTraitsFromProvider(VertexerTraitsN *, TrackerTraitsN *, TimeFrameN *)
void stop() final
This is invoked on stop.
TrackerDPL(std::shared_ptr< o2::base::GRPGeomRequest > gr, bool isMC, bool doStag, int trgType, const TrackingMode::Type trMode=TrackingMode::Unset, const bool overrBeamEst=false, o2::gpu::gpudatatypes::DeviceType dType=o2::gpu::gpudatatypes::DeviceType::CPU)
void init(framework::InitContext &ic) final
void finaliseCCDB(framework::ConcreteDataMatcher &matcher, void *obj) final
void endOfStream(framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void run(framework::ProcessingContext &pc) final
GLuint GLuint end
Definition glcorearb.h:469
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
return true
framework::DataProcessorSpec getTrackerSpec(bool useMC, bool doStag, bool useGeom, int useTrig, TrackingMode::Type trMode, const bool overrBeamEst=false, o2::gpu::gpudatatypes::DeviceType dType=o2::gpu::gpudatatypes::DeviceType::CPU)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string name
The name of the associated DataProcessorSpec.
Definition DeviceSpec.h:50
size_t inputTimesliceId
The time pipelining id of this particular device.
Definition DeviceSpec.h:68
static constexpr int getNLayers()