Project
Loading...
Searching...
No Matches
TrackerSpec.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 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
18
19namespace o2
20{
21using namespace framework;
22namespace its
23{
25
26TrackerDPL::TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
27 bool isMC,
28 int trgType,
29 const TrackingMode& trMode,
30 const bool overrBeamEst,
31 o2::gpu::GPUDataTypes::DeviceType dType) : mGGCCDBRequest(gr),
32 mRecChain{o2::gpu::GPUReconstruction::CreateInstance(dType, true)},
33 mITSTrackingInterface{isMC, trgType, overrBeamEst}
34{
35 mITSTrackingInterface.setTrackingMode(trMode);
36}
37
38void TrackerDPL::init(InitContext& ic)
39{
40 mTimer.Stop();
41 mTimer.Reset();
43 mChainITS.reset(mRecChain->AddChain<o2::gpu::GPUChainITS>());
44 mITSTrackingInterface.setTraitsFromProvider(mChainITS->GetITSVertexerTraits(),
45 mChainITS->GetITSTrackerTraits(),
46 mChainITS->GetITSTimeframe());
47 // mITSTrackingInterface.initialise() will be called from the ITSTrackingInterface::updateTimeDependentParams at 1st initialization since it needs some run conditions
48}
49
50void TrackerDPL::stop()
51{
52 LOGF(info, "CPU Reconstruction total timing: Cpu: %.3e Real: %.3e s in %d slots", mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
53}
54
55void TrackerDPL::run(ProcessingContext& pc)
56{
57 auto cput = mTimer.CpuTime();
58 auto realt = mTimer.RealTime();
59 mTimer.Start(false);
60 mITSTrackingInterface.updateTimeDependentParams(pc);
61 mITSTrackingInterface.run(pc);
62 mTimer.Stop();
63 LOGP(info, "CPU Reconstruction time for this TF {} s (cpu), {} s (wall)", mTimer.CpuTime() - cput, mTimer.RealTime() - realt);
64}
65
66void TrackerDPL::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
67{
68 mITSTrackingInterface.finaliseCCDB(matcher, obj);
69}
70
71void TrackerDPL::endOfStream(EndOfStreamContext& ec)
72{
73 LOGF(info, "ITS CA-Tracker total timing: Cpu: %.3e Real: %.3e s in %d slots", mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
74}
75
76DataProcessorSpec getTrackerSpec(bool useMC, bool useGeom, int trgType, const std::string& trModeS, const bool overrBeamEst, o2::gpu::GPUDataTypes::DeviceType dType)
77{
78 std::vector<InputSpec> inputs;
79
80 inputs.emplace_back("compClusters", "ITS", "COMPCLUSTERS", 0, Lifetime::Timeframe);
81 inputs.emplace_back("patterns", "ITS", "PATTERNS", 0, Lifetime::Timeframe);
82 inputs.emplace_back("ROframes", "ITS", "CLUSTERSROF", 0, Lifetime::Timeframe);
83 if (trgType == 1) {
84 inputs.emplace_back("phystrig", "ITS", "PHYSTRIG", 0, Lifetime::Timeframe);
85 } else if (trgType == 2) {
86 inputs.emplace_back("phystrig", "TRD", "TRKTRGRD", 0, Lifetime::Timeframe);
87 }
88 inputs.emplace_back("itscldict", "ITS", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary"));
89 inputs.emplace_back("itsalppar", "ITS", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam"));
90 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
91 true, // GRPECS=true
92 false, // GRPLHCIF
93 true, // GRPMagField
94 true, // askMatLUT
96 inputs,
97 true);
98 if (!useGeom) {
99 ggRequest->addInput({"itsTGeo", "ITS", "GEOMTGEO", 0, Lifetime::Condition, framework::ccdbParamSpec("ITS/Config/Geometry")}, inputs);
100 }
101 if (overrBeamEst) {
102 inputs.emplace_back("meanvtx", "GLO", "MEANVERTEX", 0, Lifetime::Condition, ccdbParamSpec("GLO/Calib/MeanVertex", {}, 1));
103 }
104
105 std::vector<OutputSpec> outputs;
106 outputs.emplace_back("ITS", "TRACKS", 0, Lifetime::Timeframe);
107 outputs.emplace_back("ITS", "TRACKCLSID", 0, Lifetime::Timeframe);
108 outputs.emplace_back("ITS", "ITSTrackROF", 0, Lifetime::Timeframe);
109 outputs.emplace_back("ITS", "VERTICES", 0, Lifetime::Timeframe);
110 outputs.emplace_back("ITS", "VERTICESROF", 0, Lifetime::Timeframe);
111 outputs.emplace_back("ITS", "IRFRAMES", 0, Lifetime::Timeframe);
112
113 if (useMC) {
114 inputs.emplace_back("itsmclabels", "ITS", "CLUSTERSMCTR", 0, Lifetime::Timeframe);
115 inputs.emplace_back("ITSMC2ROframes", "ITS", "CLUSTERSMC2ROF", 0, Lifetime::Timeframe);
116 outputs.emplace_back("ITS", "VERTICESMCTR", 0, Lifetime::Timeframe);
117 outputs.emplace_back("ITS", "VERTICESMCPUR", 0, Lifetime::Timeframe);
118 outputs.emplace_back("ITS", "TRACKSMCTR", 0, Lifetime::Timeframe);
119 outputs.emplace_back("ITS", "ITSTrackMC2ROF", 0, Lifetime::Timeframe);
120 }
121
122 return DataProcessorSpec{
123 "its-tracker",
124 inputs,
125 outputs,
126 AlgorithmSpec{adaptFromTask<TrackerDPL>(ggRequest,
127 useMC,
128 trgType,
129 trModeS == "sync" ? o2::its::TrackingMode::Sync : trModeS == "async" ? o2::its::TrackingMode::Async
131 overrBeamEst,
132 dType)},
133 Options{}};
134}
135
136} // namespace its
137} // namespace o2
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
TrackerDPL(std::shared_ptr< o2::base::GRPGeomRequest > gr, bool isMC, int trgType, const TrackingMode &trMode=TrackingMode::Unset, const bool overrBeamEst=false, gpu::GPUDataTypes::DeviceType dType=gpu::GPUDataTypes::DeviceType::CPU)
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
framework::DataProcessorSpec getTrackerSpec(bool useMC, bool useGeom, int useTrig, const std::string &trMode, const bool overrBeamEst=false, gpu::GPUDataTypes::DeviceType dType=gpu::GPUDataTypes::DeviceType::CPU)
o2::dataformats::Vertex< o2::dataformats::TimeStamp< int > > Vertex
Definition ROframe.h:37
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...