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"
24
29#include "ITStracking/IOUtils.h"
31
32#include <fmt/format.h>
33namespace o2
34{
35using namespace o2::framework;
36namespace strangeness_tracking
37{
38
41
42StrangenessTrackerSpec::StrangenessTrackerSpec(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool isMC) : mDataRequest{dr}, mGGCCDBRequest(gr), mUseMC{isMC}
43{
44 // no ops
45}
46
48{
49 mTimer.Stop();
50 mTimer.Reset();
51
52 // load propagator
53
57 mTracker.setupThreads(1);
58 mTracker.setupFitters();
59
60 LOG(info) << "Initialized strangeness tracker...";
61}
62
64{
65 mTimer.Start(false);
66 LOG(debug) << "Running strangeness tracker...";
67
69 recoData.collectData(pc, *mDataRequest.get());
70 updateTimeDependentParams(pc);
71
73 mTracker.loadData(recoData);
74 mTracker.prepareITStracks();
75 mTracker.process();
76 pc.outputs().snapshot(Output{"GLO", "STRANGETRACKS", 0}, mTracker.getStrangeTrackVec());
77 pc.outputs().snapshot(Output{"GLO", "CLUSUPDATES", 0}, mTracker.getClusAttachments());
78
79 if (mUseMC) {
80 pc.outputs().snapshot(Output{"GLO", "STRANGETRACKS_MC", 0}, mTracker.getStrangeTrackLabels());
81 }
82
83 mTimer.Stop();
84}
85
87void StrangenessTrackerSpec::updateTimeDependentParams(ProcessingContext& pc)
88{
90 static bool initOnceDone = false;
91 if (!initOnceDone) { // this params need to be queried only once
92 initOnceDone = true;
93 // pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldict"); // just to trigger the finaliseCCDB
94 if (pc.inputs().getPos("itsTGeo") >= 0) {
95 pc.inputs().get<o2::its::GeometryTGeo*>("itsTGeo");
96 }
99 }
100 if (o2::base::Propagator::Instance()->getNominalBz() != mTracker.getBz()) {
101 mTracker.setBz(o2::base::Propagator::Instance()->getNominalBz());
102 mTracker.setupFitters();
103 }
104 mTracker.setMCTruthOn(mUseMC);
105}
106
109{
111 return;
112 }
113 if (matcher == ConcreteDataMatcher("ITS", "CLUSDICT", 0)) {
114 LOG(info) << "cluster dictionary updated";
116 return;
117 }
118 if (matcher == ConcreteDataMatcher("ITS", "GEOMTGEO", 0)) {
119 LOG(info) << "ITS GeomtetryTGeo loaded from ccdb";
121 return;
122 }
123#ifdef ENABLE_UPGRADES
124 if (matcher == ConcreteDataMatcher("IT3", "CLUSDICT", 0)) {
125 LOG(info) << "it3 cluster dictionary updated";
126 mTracker.setClusterDictionaryIT3((const o2::its3::TopologyDictionary*)obj);
127 return;
128 }
129#endif
130}
131
133{
134 LOGF(info, "Strangeness tracking total timing: Cpu: %.3e Real: %.3e s in %d slots",
135 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
136}
137
139{
140 // ITS
141 auto dataRequest = std::make_shared<DataRequest>();
142 dataRequest->requestITSClusters(useMC);
143 dataRequest->requestTracks(src, useMC);
144 dataRequest->requestPrimaryVertices(useMC);
145 dataRequest->requestSecondaryVertices(useMC);
146
147 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
148 true, // GRPECS=true
149 false, // GRPLHCIF
150 true, // GRPMagField
151 true, // askMatLUT
153 dataRequest->inputs,
154 true);
155 if (!useGeom) {
156 ggRequest->addInput({"itsTGeo", "ITS", "GEOMTGEO", 0, Lifetime::Condition, framework::ccdbParamSpec("ITS/Config/Geometry")}, dataRequest->inputs);
157 }
158 std::vector<OutputSpec> outputs;
159 outputs.emplace_back("GLO", "STRANGETRACKS", 0, Lifetime::Timeframe);
160 outputs.emplace_back("GLO", "CLUSUPDATES", 0, Lifetime::Timeframe);
161 if (useMC) {
162 outputs.emplace_back("GLO", "STRANGETRACKS_MC", 0, Lifetime::Timeframe);
163 LOG(info) << "Strangeness tracker will use MC";
164 }
165
166 return DataProcessorSpec{
167 "strangeness-tracker",
168 dataRequest->inputs,
169 outputs,
170 AlgorithmSpec{adaptFromTask<StrangenessTrackerSpec>(dataRequest, ggRequest, useMC)},
171 Options{}};
172}
173
174} // namespace strangeness_tracking
175} // 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:178
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"