ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimTrack.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACK_H
6#define TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACK_H
7
11#include <vector>
12#include <iosfwd>
13#include <cmath>
14
16#include "TObject.h"
17
19
20 public:
21
22 FPGATrackSimTrack() = default;
23 virtual ~FPGATrackSimTrack();
24
27 bool getDoDeltaGPhis() const { return m_doDeltaGPhis; }
28 int getBankID() const { return m_bankID; }
29 int getPatternID() const { return m_patternID; }
30 int getFirstSectorID() const { return m_firstSectorID; }
31 int getSecondSectorID() const { return m_secondSectorID; }
32 int getTrackID() const { return m_trackID; }
33 float getParameter(int) const;
34 float getHoughX() const { return m_houghX; }
35 float getHoughY() const { return m_houghY; }
36 float getQOverPt() const { return m_qoverpt; }
37 float getPt() const { return m_qoverpt != 0 ? std::abs(1 / m_qoverpt) : 99999999.; }
38 float getD0() const { return m_d0; }
39 float getPhi() const { return m_phi; }
40 float getZ0() const { return m_z0; }
41 float getEta() const { return m_eta; }
42 float getTheta() const { return 2*std::atan(std::exp(-m_eta)); }
43 float getChi2() const { return m_chi2; }
44 float getChi2Phi() const { return m_chi2_phi; }
45 float getChi2Eta() const { return m_chi2_eta; }
46 float getOrigChi2() const { return m_origchi2; }
47 float getChi2ndof() const { return m_chi2 / (getNCoords() - m_nmissing - 5); }
48 float getOrigChi2ndof() const { return m_origchi2 / (getNCoords() - m_nmissing - 5); }
49 int getSubRegion() const { return m_subregion; }
50 int getRegion() const { return m_region; }
51 unsigned getHoughXBin() const { return m_xBin; }
52 unsigned getHoughYBin() const { return m_yBin; }
53
54 int getNMissing() const { return m_nmissing; } // missing coordinates
55 unsigned int getTypeMask() const { return m_typemask; }
56 unsigned int getHitMap() const { return m_hitmap; } // coordinate mask!!
57 //write a detmap
58 int getNCoords() const;
59 signed long getEventIndex() const { return m_eventindex; }
62 unsigned long barcode() const { return getBarcode(); }
63 float getBarcodeFrac() const { return m_barcode_frac; }
64 //Should be passed as const ref to avoid excessive copying.
65 const std::vector <FPGATrackSimHit>& getFPGATrackSimHits() const { return m_hits; }
66 std::vector<float> getCoords(unsigned ilayer) const;
67 // helper function to calculate coordinates for the methods based in idealized detector geometry. See https://cds.cern.ch/record/2633242
68 // in the delta global phis method, the coordinates are the ideal z, and the delta global phis.
69 // the delta global phis are the difference between the global phi of the input hit transformed to the ideal detector layer (this is hitGPhi)
70 // and the global phi of the Hough Transform "track" at the ideal layers radius (target_r, R') (this is expectedGPhi)
71 // expectedGPhi = phi_0 (from HT) - R' * A*q/pT - ((R' * A*q/pT)^3) / 6
72 // hitGPhi = GPhi (from hit) + (R - R') * A*q/pT + ((R * A*q/pT)^3) / 6
73 std::vector<float> computeIdealCoords(unsigned ilayer) const;
74 //Has some size protections
75 float getEtaCoord(int ilayer) const;
76 float getPhiCoord(int ilayer) const;
77
78 // Retrieve the idealized radius for a given layer.
79 double getIdealRadius(int ilayer) const { return m_idealRadii.at(ilayer); };
80
81 bool isValidCand() const { return m_isValidCand; }
82
85 void setDoDeltaGPhis(bool v) { m_doDeltaGPhis = v; }
86 void setBankID(int v) { m_bankID = v; }
87 void setPatternID(int v) { m_patternID = v; }
88 void setFirstSectorID(int v) { m_firstSectorID = v; }
90 void setTrackID(int v) { m_trackID = v; }
91 void setParameter(int, float);
92 void setHoughX(float v) { m_houghX = v; }
93 void setHoughY(float v) { m_houghY = v; }
94 void setQOverPt(float v) { m_qoverpt = v; }
95 void setD0(float v) { m_d0 = v; }
96 void setPhi(float v, bool ForceRange = true);
97 void setZ0(float v) { m_z0 = v; }
98 void setEta(float v) { m_eta = v; }
99 void setChi2(float v) { m_chi2 = v; }
100 void setChi2Phi(float v) { m_chi2_phi = v; }
101 void setChi2Eta(float v) { m_chi2_eta = v; }
102 void setOrigChi2(float v) { m_origchi2 = v; }
103 void setNMissing(int v) { m_nmissing = v; }
104 void setTypeMask(unsigned int v) { m_typemask = v; }
105 void setHitMap(unsigned int v) { m_hitmap = v; }
106 void setEventIndex(const signed long& v) { m_eventindex = v; }
109 void setBarcodeFrac(const float& v) { m_barcode_frac = v; }
110
111 void setSubRegion(unsigned v) { m_subregion = v; }
112 void setRegion(unsigned v) { m_region = v; }
113 void setHoughXBin(unsigned v) { m_xBin = v; }
114 void setHoughYBin(unsigned v) { m_yBin = v;}
115
116 void setValidCand(bool v) { m_isValidCand = v; }
117 void setIdealRadii(const std::vector<double>& v) { m_idealRadii = v; }
118
119 // Bin ID, if using FPGATrackSim binning.
120 void setBinIdx(std::vector<unsigned> x) { m_binIdx = std::move(x); }
121 const std::vector<unsigned>& getBinIdx() const { return m_binIdx; }
122
123 void calculateTruth(); // this will calculate the above quantities based on the hits
124 void setNLayers(int); //Reset/resize the track hits vector
125 void setFPGATrackSimHit(unsigned i, const FPGATrackSimHit& hit);
127 {
128 setQOverPt(pars.qOverPt);
129 setPhi(pars.phi, false);
130 setEta(pars.eta);
131 setD0(pars.d0);
132 setZ0(pars.z0);
133 }
134
137 pars.qOverPt = getQOverPt();
138 pars.eta = getEta();
139 pars.phi = getPhi();
140 pars.d0 = getD0();
141 pars.z0 = getZ0();
142
143 return pars;
144 }
145
146 // Functions for overlap removal
147 unsigned int passedOR() const { return m_ORcode; }
148 void setPassedOR(unsigned int);
149
150 friend std::ostream& operator<<(std::ostream&, const FPGATrackSimTrack&);
151
152 private:
153
154 TrackCorrType m_trackCorrType = TrackCorrType::None; // type of correction to make for track coordinates
155 TrackStage m_trackStage = TrackStage::FIRST; // Is this a 1st stage or second stage track?
156 bool m_doDeltaGPhis = false; // if it uses the delta phis method for fitting
157
158 int m_bankID = -1; // Bank ID of the road related to this track
159 int m_patternID = 0; // TODO add documentation
160 int m_firstSectorID = -1; // Sector identifier in the first stage tracking
161 int m_secondSectorID = -1; // Sector identifier in thesecond stage tracking
162 int m_trackID = -1; // Unique track ID in this bank
163
164 int m_IdealGeoCorr = 0; //
165
166 float m_houghX = 0.0F; // phi0 from FPGATrackSimRoad_Hough
167 float m_houghY = 0.0F; // QOverPt from FPGATrackSimRoad_Hough
168 float m_qoverpt = 0.0F; // charge over pT
169 float m_d0 = 0.0F; // impact paramter in the ATLAS reference system
170 float m_phi = 0.0F; // phi of the track
171 float m_z0 = 0.0F; // z0 in standard ATLAS reference system
172 float m_eta = 0.0F; // eta of the track
173 float m_chi2 = 0.0F; // chi2 of the track
174 float m_chi2_phi = 0.0F; // chi2 of the track for phi coord only (if used)
175 float m_chi2_eta = 0.0F; // chi2 of the track for eta coord only (if used)
176 float m_origchi2 = 0.0F; // In the case of majority recovery, this is the chi2 of
177
178 //TODO: Switch to matchedhits mask
179 unsigned int m_nmissing = 0; // number of missing coordinates
180 unsigned int m_typemask = 0; // set on in bits related to the step recovery were used, ex.: 0 no recovery, 01, rec 1st step, 11, recovery in the 1st and the 2nd stage
181 unsigned int m_hitmap = 0;
182
183 // Subregion (aka slice) number of the corresponding road.
184 int m_subregion = 0;
185 //Setting region for the bfield to work
186 int m_region = 0;
187 // Hough x, y bin numbers (needed for recreation of roads in extrapolation)
188 unsigned m_xBin = 0;
189 unsigned m_yBin = 0;
190
191 std::vector<FPGATrackSimHit> m_hits; //[m_nlayers] hits associated to the track
192
193 // bin ID. Just store this as a vector<unsigned>.
194 std::vector<unsigned> m_binIdx;
195
196 signed long m_eventindex = -1; // matched particle event index
197 HepMcParticleLink::barcode_type m_barcode = std::numeric_limits<HepMcParticleLink::barcode_type>::max(); // matched geant particle barcode
198 HepMcParticleLink::barcode_type m_uniqueID = std::numeric_limits<HepMcParticleLink::barcode_type>::max();
199 // HepMcParticleLink::barcode_type m_uniqueID = std::numeric_limits<HepMcParticleLink::barcode_type>::max();
200 float m_barcode_frac = 0.0F; // largest "matching fraction" with any "good"
201 // geant particle, corresponding to the
202 // particle with m_barcode
203
204 // Is this a valid track candidate for fitting?
205 // At the moment, this is only *not* true if the track candidate has an illegal mix of duplicated spacepoints.
206 bool m_isValidCand = true;
207
208 // Idealized radii used for the fit for this track. Unclear if it makes sense to store here,
209 // but the information is loaded into the region map class at runtime and needs to be propagated
210 // over to the track object (where the coordinate transform _currently_ lives) somehow.
211 std::vector<double> m_idealRadii;
212
213 // Overlap removal member
214 // There is currently only one algorithm
215 unsigned int m_ORcode = 1; // Each digit should represent pass/fail(1/0) result from a specific OR algorithm
216
217 ClassDefNV(FPGATrackSimTrack, 7)
218};
219
220#endif // TRIGFPGATrackSimOBJECTS_FPGATrackSimTRACK_H
: FPGATrackSim-specific class to represent an hit in the detector.
Structs that store the 5 track parameters.
TrackCorrType
#define x
TrackStage getTrackStage() const
void setParameter(int, float)
float getQOverPt() const
float getBarcodeFrac() const
void setRegion(unsigned v)
TrackCorrType m_trackCorrType
unsigned int getHitMap() const
void setSecondSectorID(int v)
void setPassedOR(unsigned int)
const std::vector< unsigned > & getBinIdx() const
void setHoughYBin(unsigned v)
void setHoughX(float v)
void setEventIndex(const signed long &v)
double getIdealRadius(int ilayer) const
void setOrigChi2(float v)
float getHoughX() const
void setChi2(float v)
float getEtaCoord(int ilayer) const
void setQOverPt(float v)
unsigned int passedOR() const
HepMcParticleLink::barcode_type getUniqueID() const
std::vector< unsigned > m_binIdx
unsigned long barcode() const
void setTrackStage(TrackStage v)
void setPhi(float v, bool ForceRange=true)
HepMcParticleLink::barcode_type getBarcode() const
bool getDoDeltaGPhis() const
float getOrigChi2() const
std::vector< float > getCoords(unsigned ilayer) const
void setIdealRadii(const std::vector< double > &v)
HepMcParticleLink::barcode_type m_barcode
float getOrigChi2ndof() const
float getChi2ndof() const
signed long getEventIndex() const
void setBarcode(const HepMcParticleLink::barcode_type &v)
void setChi2Eta(float v)
void setHoughY(float v)
void setPars(FPGATrackSimTrackPars const &pars)
void setTrackCorrType(TrackCorrType v)
float getChi2Phi() const
bool isValidCand() const
float getHoughY() const
unsigned getHoughYBin() const
int getFirstSectorID() const
std::vector< double > m_idealRadii
FPGATrackSimTrackPars getPars() const
void setBarcodeFrac(const float &v)
unsigned getHoughXBin() const
std::vector< float > computeIdealCoords(unsigned ilayer) const
void setHoughXBin(unsigned v)
TrackCorrType getTrackCorrType() const
void setChi2Phi(float v)
void setUniqueID(const HepMcParticleLink::barcode_type &v)
HepMcParticleLink::barcode_type m_uniqueID
void setNLayers(int)
set the number of layers in the track.
std::vector< FPGATrackSimHit > m_hits
void setHitMap(unsigned int v)
int getSecondSectorID() const
const std::vector< FPGATrackSimHit > & getFPGATrackSimHits() const
void setDoDeltaGPhis(bool v)
void setFPGATrackSimHit(unsigned i, const FPGATrackSimHit &hit)
void setBinIdx(std::vector< unsigned > x)
float getChi2Eta() const
float getPhiCoord(int ilayer) const
void setSubRegion(unsigned v)
FPGATrackSimTrack()=default
float getTheta() const
float getParameter(int) const
void setValidCand(bool v)
float getChi2() const
void setFirstSectorID(int v)
unsigned int getTypeMask() const
friend std::ostream & operator<<(std::ostream &, const FPGATrackSimTrack &)
void setTypeMask(unsigned int v)