Project
Loading...
Searching...
No Matches
MatchCosmics.h
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
15
16#ifndef ALICEO2_MATCH_COSMICS
17#define ALICEO2_MATCH_COSMICS
18
19#include <Rtypes.h>
20#include <array>
21#include <cstdint>
32
33#define _ALLOW_DEBUG_TREES_COSM // to allow debug and control tree output
34
35namespace o2
36{
37namespace tpc
38{
39class VDriftCorrFact;
40}
41namespace gpu
42{
43class TPCFastTransformPOD;
44class GPUO2InterfaceRefit;
45} // namespace gpu
46namespace globaltracking
47{
48
49namespace o2d = o2::dataformats;
50
53class RecoContainer;
54
56{
57 public:
58 static constexpr int Zero = 0;
59 static constexpr int MinusOne = -1;
60 static constexpr int MinusTen = -10;
61 static constexpr int Validated = -2;
62 static constexpr int Reject = MinusTen;
77
78 using InfoAccessor = o2d::AbstractRefAccessor<int, GTrackID::NSources>; // there is no unique <Info> structure, so the default return type is dummy (int)
79
81 struct MatchRecord {
82 int id0 = MinusOne;
83 int id1 = MinusOne;
84 float chi2 = -1.f;
85 int next = MinusOne;
86 float tCommon = 0.f;
87 float tCommonErr = -1.f;
88 float tofScore = -1.f;
89 float tCommonNoTOF = 0.f;
90 float tCommonErrNoTOF = -1.f;
91 };
92
93 struct TOFCandidate {
94 int index = -1;
95 double timeNS = 0.;
96 float dy = 0.f;
97 float dz = 0.f;
98 float gx = 0.f;
99 float gy = 0.f;
100 float gz = 0.f;
101 };
102
107 short vtIDMin = -1;
108 short vtIDMax = -1;
109 float tRef = 0.f;
111 std::array<float, 3> xyzRef{};
112 bool nearBeam = false;
113 };
116 void setITSROFrameLengthMUS(float fums) { mITSROFrameLengthMUS = fums; }
117 void setITSDict(const o2::itsmft::TopologyDictionary* dict) { mITSDict = dict; }
119 void setUseMC(bool mc) { mUseMC = mc; }
120 void setUsePVInfo(bool v) { mUsePVInfo = v; }
121 void setSeedSources(GTrackID::mask_t src) { mSeedSources = src; }
122 void setPVVetoSources(GTrackID::mask_t src) { mPVVetoSources = src; }
123 void init();
124 void end();
125
126 auto getCosmicTracks() const { return mCosmicTracks; }
127 auto getCosmicTracksLbl() const { return mCosmicTracksLbl; }
128
129#ifdef _ALLOW_DEBUG_TREES_COSM
130 enum DebugFlagTypes : UInt_t {
132 MatchTreeAccOnly = 0x1 << 1
133 };
135 bool isDebugFlag(UInt_t flags) const { return mDBGFlags & flags; }
136
138 UInt_t getDebugFlags() const { return mDBGFlags; }
139
141 void setDebugFlag(UInt_t flag, bool on = true);
142
144 void setDebugTreeFileName(std::string name)
145 {
146 if (!name.empty()) {
147 mDebugTreeFileName = name;
148 }
149 }
150
152 const std::string& getDebugTreeFileName() const { return mDebugTreeFileName; }
153#endif
154
155 private:
156 void updateTimeDependentParams();
157 RejFlag checkPair(int i, int j);
158 bool refitSeedAtTime(const TrackSeed& seed, float timeMUS, TrackSeed& out);
159 void registerMatch(int i, int j, float chi2, float tCommon = 0.f, float tCommonErr = -1.f, float tofScore = -1.f, float tCommonNoTOF = 0.f, float tCommonErrNoTOF = -1.f);
160 void prepareTOFClusters(const o2::globaltracking::RecoContainer& data);
161 const std::vector<TOFCandidate>& getTOFCandidates(int iseed);
162 float findTOFFlightPair(int i, int j, float tMinMUS, float tMaxMUS, float& tofTimeMUS);
163 void suppressMatch(int partner0, int partner1);
164 void createSeeds(const o2::globaltracking::RecoContainer& data);
165 bool validateMatch(int partner0);
166 void selectWinners();
167 void refitWinners(const o2::globaltracking::RecoContainer& data);
169
170 std::vector<TrackSeed> mSeeds;
171 std::vector<MatchRecord> mRecords;
172 std::vector<int> mWinners;
173 const o2::itsmft::TopologyDictionary* mITSDict = nullptr; // cluster patterns dictionary
174 const o2::gpu::TPCFastTransformPOD* mTPCCorrMaps = nullptr;
175 int mTFCount = 0;
176 float mTPCVDriftRef = -1.;
177 float mTPCVDriftCorrFact = 1.;
178 float mTPCVDrift = -1.;
179 float mTPCDriftTimeOffset = 0.;
180 float mTPCTBinMUS = 0.;
181 float mBz = 0;
182 bool mFieldON = true;
183 bool mUsePVInfo = false;
184 bool mUseMC = true;
185 GTrackID::mask_t mSeedSources{GTrackID::MASK_ALL};
186 GTrackID::mask_t mPVVetoSources{GTrackID::MASK_NONE};
187 float mITSROFrameLengthMUS = 0.;
188 float mQ2PtCutoff = 1e9;
189 float mQ2PtCutoffOppositeSides = 1e9;
190 const MatchCosmicsParams* mMatchParams = nullptr;
191 const o2::globaltracking::RecoContainer* mRecoData = nullptr;
192 o2::gpu::GPUO2InterfaceRefit* mTPCRefitter = nullptr;
193 size_t mNRefitsCommonTime = 0;
194 std::vector<int> mTOFClusterOrder;
195 std::vector<float> mTOFClusterTimeMUS;
196 std::vector<std::vector<TOFCandidate>> mSeedTOFCandidates;
197 std::vector<bool> mSeedTOFDone;
198 size_t mNTOFConfirmed = 0;
199 size_t mNTOFFallbacks = 0;
200 size_t mNSeedsNearBeam = 0;
201 size_t mNNearBeamConfirmed = 0;
202 size_t mNSeedsPVContributors = 0;
203
204 std::vector<o2d::TrackCosmics> mCosmicTracks;
205 std::vector<o2::MCCompLabel> mCosmicTracksLbl;
206
207#ifdef _ALLOW_DEBUG_TREES_COSM
208 std::unique_ptr<o2::utils::TreeStreamRedirector> mDBGOut;
209 UInt_t mDBGFlags = 0;
210 std::string mDebugTreeFileName = "dbg_cosmics_match.root";
211#endif
212
213 ClassDefNV(MatchCosmics, 1);
214};
215
216} // namespace globaltracking
217} // namespace o2
218
219#endif
Container of the ITS/MFT clusters addressed by the composed (layer,index) ID.
Definition of the ClusterTopology class.
int32_t i
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
Accessor for TrackParCov derived objects from multiple containers.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
float chi2
Configurable params for cosmics matching.
Declarations of 2D primitives.
uint32_t j
Definition RawData.h:0
Result of top-bottom cosmic tracks leg matching.
void setITSROFrameLengthMUS(float fums)
@ MatchTreeAll
produce matching candidates tree for all candidates
@ MatchTreeAccOnly
fill the matching candidates tree only once the cut is passed
static constexpr int Validated
bool isDebugFlag(UInt_t flags) const
get debug trees flags
void setPVVetoSources(GTrackID::mask_t src)
sources whose PV contributors veto the legs they contain
void setITSDict(const o2::itsmft::TopologyDictionary *dict)
void setDebugFlag(UInt_t flag, bool on=true)
set the name of output debug file
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
static constexpr int Reject
void setDebugTreeFileName(std::string name)
get the name of output debug file
void setSeedSources(GTrackID::mask_t src)
track sources used as legs (other loaded ones resolve PV contributors)
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD *maph)
static constexpr int MinusOne
@ RejNoTOF
a leg kept by minSeedDCAxyTOF only, and no TOF flight pair
static constexpr int MinusTen
UInt_t getDebugFlags() const
set or unset debug stream flag
const std::string & getDebugTreeFileName() const
GLenum src
Definition glcorearb.h:1767
const GLdouble * v
Definition glcorearb.h:832
GLuint const GLchar * name
Definition glcorearb.h:781
GLbitfield flags
Definition glcorearb.h:1570
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
detail::Bracket< float > Bracketf_t
Definition Primitive2D.h:40
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
< record about matchig of 2 tracks
int next
index of eventual next record
float tofScore
score of the top / bottom TOF hit pair matching the muon's flight (tofFlightSelection; < 0: none); a ...
float tCommonErr
its 1 sigma error [mus]; < 0: not fixed, the refit uses the centre of the time-bracket overlap and th...
float tCommonErrNoTOF
tCommonErr before a TOF flight pair replaced it
float tCommon
common time [mus] fixed by z continuity of TPC-only legs on opposite TPC sides
float tCommonNoTOF
tCommon before a TOF flight pair replaced it: the refit falls back to it if the refit at the TOF time...
double timeNS
its time since the start of the TF [ns]
float dz
cluster - predicted z, the leg's z taken at its own reference time tRef [cm]
float gx
global position of the cluster [cm]
float dy
cluster - predicted y in the frame of the cluster's sector [cm]
short vtIDMax
id of the last compatible vertex
int8_t tpcSide
TPC-only seed with clusters on one side: +1 A, -1 C (z = z(t) - side*vD*(t-tRef)); 0: z absolute.
short vtIDMin
id of the 1st compatible vertex
int matchID
entry (none if MinusOne) of its match in the vector of matches
float tRef
time [mus] the z of the parameters refers to (TPC-only: the TrackTPC time0; others: bracket centre)
TBracket tBracket
bracketing time-bins
bool nearBeam
kept by the looser minSeedDCAxyTOF cuts only: usable in TOF-confirmed pairs only
std::array< float, 3 > xyzRef
global position of the reference point before the propagation to the DCA (same-half veto)