Project
Loading...
Searching...
No Matches
StrangenessTrackingSpec.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.
13
14#include "TGeoGlobalMagField.h"
16#include "Field/MagneticField.h"
26
31#include "ITStracking/IOUtils.h"
33
34#include <fmt/format.h>
35namespace o2
36{
37using namespace o2::framework;
38namespace strangeness_tracking
39{
40
43
44StrangenessTrackerSpec::StrangenessTrackerSpec(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool isMC) : mDataRequest{dr}, mGGCCDBRequest(gr), mUseMC{isMC}
45{
46 // no ops
47}
48
50{
51 mTimer.Stop();
52 mTimer.Reset();
53
54 // load propagator
55
59 mTracker.setupThreads(1);
60 mTracker.setupFitters();
61
62 LOG(info) << "Initialized strangeness tracker...";
63}
64
66{
67 mTimer.Start(false);
68 LOG(debug) << "Running strangeness tracker...";
69
71 recoData.collectData(pc, *mDataRequest.get());
72 updateTimeDependentParams(pc);
73
75 mTracker.loadData(recoData);
76 mTracker.prepareITStracks();
77 mTracker.process();
78 pc.outputs().snapshot(Output{"GLO", "STRANGETRACKS", 0}, mTracker.getStrangeTrackVec());
79 pc.outputs().snapshot(Output{"GLO", "CLUSUPDATES", 0}, mTracker.getClusAttachments());
80
81 if (mUseMC) {
82 pc.outputs().snapshot(Output{"GLO", "STRANGETRACKS_MC", 0}, mTracker.getStrangeTrackLabels());
83 }
84
85 mTimer.Stop();
86}
87
89void StrangenessTrackerSpec::updateTimeDependentParams(ProcessingContext& pc)
90{
92 static bool initOnceDone = false;
93 if (!initOnceDone) { // this params need to be queried only once
94 initOnceDone = true;
95 // pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldict"); // just to trigger the finaliseCCDB
96 if (pc.inputs().getPos("itsTGeo") >= 0) {
97 pc.inputs().get<o2::its::GeometryTGeo*>("itsTGeo");
98 }
101 }
102 if (o2::base::Propagator::Instance()->getNominalBz() != mTracker.getBz()) {
103 mTracker.setBz(o2::base::Propagator::Instance()->getNominalBz());
104 mTracker.setupFitters();
105 }
106 mTracker.setMCTruthOn(mUseMC);
107}
108
111{
113 return;
114 }
115 if (matcher == ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
116 LOG(info) << "cluster dictionary updated";
118 return;
119 }
120 if (matcher == ConcreteDataMatcher("ITS", "GEOMTGEO", 0)) {
121 LOG(info) << "ITS GeomtetryTGeo loaded from ccdb";
123 return;
124 }
125#ifdef ENABLE_UPGRADES
126 if (matcher == ConcreteDataMatcher("IT3", "CLUSDICT", 0)) {
127 LOG(info) << "it3 cluster dictionary updated";
128 mTracker.setClusterDictionaryIT3((const o2::its3::TopologyDictionary*)obj);
129 return;
130 }
131#endif
132}
133
135{
136 LOGF(info, "Strangeness tracking total timing: Cpu: %.3e Real: %.3e s in %d slots",
137 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
138}
139
141{
142 // ITS
143 auto dataRequest = std::make_shared<DataRequest>();
144 dataRequest->requestITSClusters(useMC);
145 dataRequest->requestTracks(src, useMC);
146 dataRequest->requestPrimaryVertices(useMC);
147 dataRequest->requestSecondaryVertices(useMC);
148
149 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
150 true, // GRPECS=true
151 false, // GRPLHCIF
152 true, // GRPMagField
153 true, // askMatLUT
155 dataRequest->inputs,
156 true);
157 if (!useGeom) {
158 ggRequest->addInput({"itsTGeo", "ITS", "GEOMTGEO", 0, Lifetime::Condition, framework::ccdbParamSpec("ITS/Config/Geometry")}, dataRequest->inputs);
159 }
160 std::vector<OutputSpec> outputs;
161 outputs.emplace_back("GLO", "STRANGETRACKS", 0, Lifetime::Timeframe);
162 outputs.emplace_back("GLO", "CLUSUPDATES", 0, Lifetime::Timeframe);
163 if (useMC) {
164 outputs.emplace_back("GLO", "STRANGETRACKS_MC", 0, Lifetime::Timeframe);
165 LOG(info) << "Strangeness tracker will use MC";
166 }
167
168 return DataProcessorSpec{
169 "strangeness-tracker",
170 dataRequest->inputs,
171 outputs,
172 AlgorithmSpec{adaptFromTask<StrangenessTrackerSpec>(dataRequest, ggRequest, useMC)},
173 Options{}};
174}
175
176} // namespace strangeness_tracking
177} // namespace o2
Wrapper container for different reconstructed object types.
Definition of the Names Generator class.
std::ostringstream debug
Header of the General Run Parameters object.
Definition of the ITSMFT ROFrame (trigger) record.
Definition of the MagF class.
Definition of the ITS track.
Result of refitting TPC-ITS matched track.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
Definition Propagator.h:175
void snapshot(const Output &spec, T const &object)
int getPos(const char *name) const
decltype(auto) get(R binding, int part=0) const
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
static GeometryTGeo * Instance()
void fillMatrixCache(int mask) override
static void adopt(GeometryTGeo *raw, bool canDelete=false)
StrangenessTrackerSpec(std::shared_ptr< DataRequest > dr, std::shared_ptr< o2::base::GRPGeomRequest > gr, bool isMC)
void finaliseCCDB(framework::ConcreteDataMatcher &matcher, void *obj) final
void run(framework::ProcessingContext &pc) final
void endOfStream(framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void setConfigParams(const StrangenessTrackingParamConfig *params)
std::vector< StrangeTrack > & getStrangeTrackVec(int iThread=0)
void setCorrType(const o2::base::PropagatorImpl< float >::MatCorrType &type)
std::vector< ClusAttachments > & getClusAttachments(int iThread=0)
void setClusterDictionaryITS(const o2::itsmft::TopologyDictionary *d)
bool loadData(const o2::globaltracking::RecoContainer &recoData)
std::vector< o2::MCCompLabel > & getStrangeTrackLabels(int iThread=0)
GLenum src
Definition glcorearb.h:1767
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
o2::framework::DataProcessorSpec getStrangenessTrackerSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC, bool useGeom)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
static constexpr int T2L
Definition Cartesian.h:55
static constexpr int T2GRot
Definition Cartesian.h:57
static constexpr int T2G
Definition Cartesian.h:56
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"