ATLAS Offline Software
Loading...
Searching...
No Matches
EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/FPGATrackSimAlgorithms/TrackFitter.h
Go to the documentation of this file.
1// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3#ifndef TRACKFITTER_H
4#define TRACKFITTER_H
5
13
21
22#include <vector>
23
25 : public AthMessaging
26{
27 public:
28
30 // Main interface functions
31
32 int fitTracks(const std::vector<std::shared_ptr<const FPGATrackSimRoad>>& roads, std::vector<FPGATrackSimTrack>& tracks);
33
34 const std::vector<FPGATrackSimTrack>& getMissingHitsCheckTracks() {return m_tracks_missinghits_track;}
35
37 // Constructor and Initialization
38
39 TrackFitter(const FPGATrackSimFitConstantBank *nominalbank, const std::vector<const FPGATrackSimFitConstantBank*>& droppedLayerbanks, bool guessingHits);
40
42 // Simple getters and setters
43
44 void setIdentifyBadHit(bool flag) { m_identify_badhit = flag; }
45 bool getIdentifyBadHit() const { return m_identify_badhit; }
46
48 FPGATrackSimPlaneMap const * getPlaneMap() const { return m_pmap; }
49
51
53 int getNorecoveryNhits() const { return m_norecovery_nhits; }
54
55 void setRequireFirst(bool v) { m_require_first = v; }
56 bool getRequireFirst() const { return m_require_first; }
57
58 void setDoMajority(unsigned int v) { m_do_majority = v; }
59 unsigned getDoMajority() const { return m_do_majority; }
60
63
66
69
70 void setDoSecondStage(bool v) { m_do2ndStage = v; }
71 bool getDoSecondStage() const { return m_do2ndStage; }
72
75
76 void setDoDeltaGPhis(bool v) { m_doDeltaGPhis = v; }
77 bool getDoDeltaGPhis() const { return m_doDeltaGPhis; }
78
79 void setFitFromRoad(bool v) { m_fitFromRoad = v; }
80 bool getFitFromRoad() const { return m_fitFromRoad; }
81
83 // Getters of data flow quantities
84
85 int getNFits() { return m_nfits; }
86 int getNFitsMajority() { return m_nfits_maj; }
89 int getNFitsRecovery() { return m_nfits_rec; }
90
91
92 private:
94 // Configuration
95 bool m_do2ndStage = false;
96 bool m_guessinghits = true;
98 bool m_doDeltaGPhis = false;
99
100 // Hit Combation
101 const int m_max_ncomb = 10000; // maximum number of combinations to process per road
102 unsigned m_do_majority = 1; // Do majority fits. If >1, we only do majority fits if ALL full fits fail the chi2 cut
103 bool m_require_first = true; // Require a hit in the first layer when doing majority recovery
104 int m_norecovery_nhits = -1; // maximum number of hits per superstrip beyond which majority is not attempted
105
106 bool m_setDoMissingHitsCheck = false; // do missing hits check
107
108 // Chi2
109 float m_Chi2Dof_recovery_min = 40.; //Minimum chi2 cut to do recovery fits
110 float m_Chi2Dof_recovery_max = 1e30; //maximum chi2 cut to do recovery fits
111
112 // Output
113 bool m_identify_badhit = false; // enables the identification of the bad hits for the recovery
114
115 bool m_fitFromRoad = false;
116
118 // Storage
119
120 // Convenience pointer to mapping classes.
121 FPGATrackSimPlaneMap const *m_pmap = nullptr;
123
124 // Internally for iterating over track candidates to fit.
125 // Caching this information avoids needing to allocate all the track candidates before fitting,
126 // which can be hugely expensive in terms of memory.
127 std::vector<std::vector<int>> m_comboIndices;
128
129 // This bank should always exist. If we are guessing hits there is only one bank and it is this one
130 // and if we are not guessing hits it is for 8/8
131 // It is just a pointer from BankSvc->FitConstantBank1stStage() but we copy it;
133
134 // These are only used if we are not guessing hits, one for each plane missing
135 // Also just a set of pointers, but we copied them
136 std::vector<const FPGATrackSimFitConstantBank*> m_droppedLayerBanks;
137
138 // These are the tracks we store if we are doing the missing hits cross-check
139 std::vector<FPGATrackSimTrack> m_tracks_missinghits_track;
140
141 // Counters
142 int m_idbase = 0; // offset for new track ids
143 int m_nfits = 0; // number of fits tryied in a road
144 int m_nfits_maj = 0; // number of majority fits
145 int m_nfits_maj_SCT = 0; // number of majority fits with missing in SCT layer
146 int m_nfits_maj_pix = 0; // number of majority fits with missing in PIX layer
147 int m_nfits_rec = 0; // number of recoverd fits
148 int m_nfits_addrec = 0; // number of recoverd fits
149
150
152 // Helper Functions
153
154 void resetCounters();
155 int fitTracks(const std::shared_ptr<const FPGATrackSimRoad> &road, std::vector<FPGATrackSimTrack> &tracks);
156 void getMissingInfo(const FPGATrackSimRoad & road, int & nMissing, bool & missPixel, bool & missStrip,
157 layer_bitmask_t & missing_mask, layer_bitmask_t & norecovery_mask);
158 void makeTrackCandidates(const FPGATrackSimRoad & road, const FPGATrackSimTrack & temp, std::vector<FPGATrackSimTrack> &track_cands);
159 FPGATrackSimTrack makeTrackCandidate(const FPGATrackSimRoad & road, const FPGATrackSimTrack & temp, const std::vector<int>& hit_indices);
160 FPGATrackSimTrack recoverTrack(FPGATrackSimTrack const & t, sector_t sector, layer_bitmask_t norecovery_mask, double qoverpt);
161 void compute_truth(FPGATrackSimTrack & newtrk) const;
162};
163
164#endif // TRACKFITTER_H
Maps physical layers to logical layers.
Maps ITK module indices to FPGATrackSim regions.
Defines a class for roads.
int32_t sector_t
uint32_t layer_bitmask_t
TrackCorrType
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
void compute_truth(FPGATrackSimTrack &newtrk) const
FPGATrackSimTrack makeTrackCandidate(const FPGATrackSimRoad &road, const FPGATrackSimTrack &temp, const std::vector< int > &hit_indices)
std::vector< const FPGATrackSimFitConstantBank * > m_droppedLayerBanks
TrackFitter(const FPGATrackSimFitConstantBank *nominalbank, const std::vector< const FPGATrackSimFitConstantBank * > &droppedLayerbanks, bool guessingHits)
TrackFitter(void)
int fitTracks(const std::vector< std::shared_ptr< const FPGATrackSimRoad > > &roads, std::vector< FPGATrackSimTrack > &tracks)
void makeTrackCandidates(const FPGATrackSimRoad &road, const FPGATrackSimTrack &temp, std::vector< FPGATrackSimTrack > &track_cands)
Creates a list of track candidates by taking all possible combination of hits in road.
FPGATrackSimTrack recoverTrack(FPGATrackSimTrack const &t, sector_t sector, layer_bitmask_t norecovery_mask, double qoverpt)
Given a N/N track that has a bad chi2, try to refit the track by taking away a single hit,...
void getMissingInfo(const FPGATrackSimRoad &road, int &nMissing, bool &missPixel, bool &missStrip, layer_bitmask_t &missing_mask, layer_bitmask_t &norecovery_mask)
void resetCounters()
STL class.