ATLAS Offline Software
Loading...
Searching...
No Matches
TrigFastTrackFinder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6//
7// filename: TrigFastTrackFinder.h
8//
9// Description: a part of HLT ID tracking
10//
11// date: 16/04/2013
12//
13// -------------------------------
14// ATLAS Collaboration
16
17#ifndef TRIGFASTTRACKFINDER_TRIGFASTTRACKFINDER_H
18#define TRIGFASTTRACKFINDER_TRIGFASTTRACKFINDER_H
19
20
21
24
27
29
32
36
37
39
40#include "TrkTrack/TrackCollection.h" //typedef, cannot fwd declare
41
46
50
51// for UTT
55
56//for GPU acceleration
57
61
62#include <string>
63#include <vector>
64#include <tuple>
65#include <map>
66#include <memory>
67#include <array>
68
69namespace Trk {
70 class Track;
71}
72class SCT_ID;
73class PixelID;
76
77namespace InDet {
79 {
80 public:
82 if (!key.key().empty()) {
84 if (!m_prdToTrackMap.isValid()) {
85 throw std::runtime_error(std::string("Failed to get PRD to track map:") + key.key());
86 }
88 }
89 }
90 private:
91 void dummy() {}
93 };
94}
95
97
98 public:
99
100 TrigFastTrackFinder(const std::string& name, ISvcLocator* pSvcLocator);
101 virtual ~TrigFastTrackFinder();
102 virtual StatusCode initialize() override;
103 virtual StatusCode finalize() override;
104 virtual StatusCode start() override;
105
106 virtual StatusCode execute(const EventContext& ctx) const override;
107
108 StatusCode findTracks(InDet::SiTrackMakerEventData_xk &event_data,
109 const TrigRoiDescriptor& roi,
110 const TrackCollection* inputTracks,
111 TrackCollection& outputTracks,
112 const EventContext& ctx) const;
113
114 double trackQuality(const Trk::Track* Tr) const;
115 void filterSharedTracks(std::vector<std::tuple<bool, double, Trk::Track*>>& QT) const;
116
125
126protected:
127 static constexpr size_t N_BARREL_LAYERS{8};//previously hardcoded in function
129 int nHits{};
130 float chiSq{};
131 int nDof{};
132 int nGood{};
133 };
134
135 void updateClusterMap(long int, const Trk::Track*, std::map<Identifier, std::vector<long int> >&) const;
136 void extractClusterIds(const Trk::SpacePoint*, std::vector<Identifier>&) const;
137 bool usedByAnyTrack(const std::vector<Identifier>&, std::map<Identifier, std::vector<long int> >&) const;
138
139 private:
140
141 // AlgTools and Services
142
143 ToolHandle<ITrigL2LayerNumberTool> m_numberingTool {this, "LayerNumberTool", "TrigL2LayerNumberTool"};
144 ToolHandle<ITrigSpacePointConversionTool> m_spacePointTool {this, "SpacePointProviderTool", "TrigSpacePointConversionTool"};
145 ToolHandle<InDet::ISiTrackMaker> m_trackMaker;
146 ToolHandle<ITrigInDetTrackFitter> m_trigInDetTrackFitter;
147 ToolHandle<ITrigZFinder> m_trigZFinder;
148 ToolHandle< Trk::ITrackSummaryTool > m_trackSummaryTool;
149 ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" };
150 ToolHandle< Trk::IExtrapolator > m_extrapolator { this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator" };
151 ToolHandle< Trk::ITrackFitter > m_disTrkFitter;
152
153 //for GPU acceleration
154 ToolHandle<ITrigInDetAccelerationTool> m_accelTool {this, "TrigAccelerationTool", ""};
155 ServiceHandle<ITrigInDetAccelerationSvc> m_accelSvc {this, "TrigAccelerationSvc", ""};
156
157 //DataHandles
161
164
168
169 // Control flags
170
172
174
177
179
181
183
184 // Cuts and settings
186
188
189 int m_nfreeCut; // Min number free clusters
190
191
193 float m_pTmin;
195 float m_Z0Max;
197
198 SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
199
200 // Monitoring member functions
201
202 void fillMon(const TrackCollection& tracks, const TrigVertexCollection& vertices, const TrigRoiDescriptor& roi, const EventContext& ctx) const;
203 void runResidualMonitoring(const Trk::Track& track, const EventContext&) const;
204
205 // Internal bookkeeping
206
207
208 mutable std::atomic<unsigned int> m_countTotalRoI;
209 mutable std::atomic<unsigned int> m_countRoIwithEnoughHits;
210 mutable std::atomic<unsigned int> m_countRoIwithTracks;
211
215
216
217 Trk::ParticleHypothesis m_particleHypothesis;//particle hypothesis to attach to each track - usually pion, can be set to other values
218
220
221 // GPU acceleration
222
224
225 void makeSeedsOnGPU(const TrigCombinatorialSettings&, const IRoiDescriptor*, const std::vector<TrigSiSpacePointBase>&, std::vector<TrigInDetTriplet>&) const;
226
227 // read input tracks and remove previously-used clusters from seed-making
228
229 // Large Radius Tracking
233
234 std::string m_trigseedML_LUT;//ML-based track seeding LUT name
235
236 // create UTT EDMs (to avoid crash in case of findTrack's quitting before UTT algos)
237 StatusCode createEmptyUTTEDMs(const EventContext&) const;
238
239 // Hit-based displaced vertex
240 int getSPLayer(int, float) const;
241
242 // dEdx calculation
244 StatusCode calcdEdx(const EventContext&, const TrackCollection&) const;
245 StatusCode finddEdxTrk(const EventContext&, const TrackCollection&) const;
246 float dEdx(const Trk::Track*, int&, int&, std::vector<float>&, std::vector<float>&,
247 std::vector<float>&, std::vector<float>&, std::vector<int>&, std::vector<int>&, std::vector<int>&) const;
248
249 // disappearing track
251 int recoAndFillDisTrkCand(const std::string&, TrackCollection*, std::vector<Trk::Track*>&, xAOD::TrigCompositeContainer*,
252 const std::vector<double>&, const std::vector<double>&, const std::vector<double>&, bool, const EventContext&) const;
253 void print_disTrk(const Trk::Track* t) const;
254 std::unique_ptr<Trk::Track> disTrk_refit(Trk::Track* t, const EventContext& ctx) const;
255
256 std::array<OneLayerInfo_t, N_BARREL_LAYERS> getTrkBarrelLayerInfo(Trk::Track* aTrack) const;
257 bool isCleaningPassDisTrack(const TrigInDetTriplet&, Trk::Track*, bool) const;
258 double disTrackQuality(const Trk::Track*) const;
259 void recoVertexForDisTrack(const EventContext&, TrackCollection&, std::vector<double>&, std::vector<double>&, std::vector<double>&) const;
260 bool isPreselPassDisTrackBeforeRefit(Trk::Track*, double, double) const;
261 bool isPreselPassDisTrackAfterRefit(Trk::Track*, Trk::Track*, double, double) const;
262 bool isGoodForDisTrackVertex(Trk::Track*, const EventContext&) const;
263 std::unique_ptr<const Trk::TrackParameters> extrapolateDisTrackToBS(Trk::Track*, const std::vector<double>&, const std::vector<double>&, const std::vector<double>&, const EventContext&) const;
264 void filterSharedDisTracks(std::vector<std::tuple<bool, double,Trk::Track*>>&) const;
265 void fillDisTrkCand(xAOD::TrigComposite*, const std::string&, Trk::Track*, const std::unique_ptr<const Trk::TrackParameters>&) const;
266 void fillDisTrkCand(xAOD::TrigComposite*, const std::string&, Trk::Track*, const std::unique_ptr<const Trk::TrackParameters>&, bool, std::vector<Trk::Track*>&) const;
268 StatusCode findDisTracks(const EventContext&, TrackCollection&,
269 std::vector<std::tuple<bool, double, Trk::Track*>>&,
270 std::vector<std::tuple<bool, double, Trk::Track*>>&,
272 const std::vector<double>&, const std::vector<double>&, const std::vector<double>&) const;
273
274 // Phase II
277
278 ToolHandle<ITrigInDetTrackSeedingTool> m_seedingTool{this, "TrackSeedingTool", ""};
279
280 Gaudi::Property<bool> m_useEtaBinning {this, "UseEtaBinning", true, "Split layers into eta bins"};
281 Gaudi::Property<bool> m_doCloneRemoval{this, "doCloneRemoval", true, "Remove tracks sharing too many hits"};
282 Gaudi::Property<bool> m_doTrackRefit {this, "doTrackRefit", true, "Refit tracks after the combinatorial track following"};
283 Gaudi::Property<bool> m_useTracklets {this, "UseTracklets", false, "Use tracklet seeds from ITk track seeding"};
284
285};
286
287
288#endif // not TRIGFASTTRACKFINDER_TRIGFASTTRACKFINDER_H
Header file to be included by clients of the Monitored infrastructure.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
An algorithm that can be simultaneously executed in multiple threads.
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Describes the API of the Region of Ineterest geometry.
ExtendedSiTrackMakerEventData_xk(const SG::ReadHandleKey< Trk::PRDtoTrackMap > &key, const EventContext &ctx)
SG::ReadHandle< Trk::PRDtoTrackMap > m_prdToTrackMap
InDet::SiTrackMakerEventData_xk holds event dependent data used by ISiTrackMaker.
void setPRDtoTrackMap(const Trk::PRDtoTrackMap *prd_to_track_map)
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
void updateClusterMap(long int, const Trk::Track *, std::map< Identifier, std::vector< long int > > &) const
ToolHandle< ITrigInDetTrackFitter > m_trigInDetTrackFitter
ToolHandle< ITrigSpacePointConversionTool > m_spacePointTool
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< bool > m_useEtaBinning
void runResidualMonitoring(const Trk::Track &track, const EventContext &) const
bool isGoodForDisTrackVertex(Trk::Track *, const EventContext &) const
TrigFastTrackFinder::DisTrkCategory getDisTrkCategory(Trk::Track *trk) const
std::unique_ptr< const Trk::TrackParameters > extrapolateDisTrackToBS(Trk::Track *, const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, const EventContext &) const
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_dEdxHitKey
void filterSharedDisTracks(std::vector< std::tuple< bool, double, Trk::Track * > > &) const
ToolHandle< ITrigL2LayerNumberTool > m_numberingTool
StatusCode calcdEdx(const EventContext &, const TrackCollection &) const
ToolHandle< ITrigInDetTrackSeedingTool > m_seedingTool
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
virtual StatusCode start() override
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_prdToTrackMap
ToolHandle< ITrigInDetAccelerationTool > m_accelTool
Gaudi::Property< bool > m_useTracklets
Gaudi::Property< bool > m_doCloneRemoval
void fillMon(const TrackCollection &tracks, const TrigVertexCollection &vertices, const TrigRoiDescriptor &roi, const EventContext &ctx) const
bool isPreselPassDisTrackBeforeRefit(Trk::Track *, double, double) const
int recoAndFillDisTrkCand(const std::string &, TrackCollection *, std::vector< Trk::Track * > &, xAOD::TrigCompositeContainer *, const std::vector< double > &, const std::vector< double > &, const std::vector< double > &, bool, const EventContext &) const
SG::ReadHandleKey< TrackCollection > m_inputTracksKey
StatusCode findTracks(InDet::SiTrackMakerEventData_xk &event_data, const TrigRoiDescriptor &roi, const TrackCollection *inputTracks, TrackCollection &outputTracks, const EventContext &ctx) const
Trk::ParticleHypothesis m_particleHypothesis
void extractClusterIds(const Trk::SpacePoint *, std::vector< Identifier > &) const
Gaudi::Property< bool > m_doTrackRefit
const AtlasDetectorID * m_idHelper
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
double trackQuality(const Trk::Track *Tr) const
void fillDisTrkCand(xAOD::TrigComposite *, const std::string &, Trk::Track *, const std::unique_ptr< const Trk::TrackParameters > &) const
ToolHandle< Trk::ITrackSummaryTool > m_trackSummaryTool
double disTrackQuality(const Trk::Track *) const
virtual StatusCode initialize() override
std::array< OneLayerInfo_t, N_BARREL_LAYERS > getTrkBarrelLayerInfo(Trk::Track *aTrack) const
void recoVertexForDisTrack(const EventContext &, TrackCollection &, std::vector< double > &, std::vector< double > &, std::vector< double > &) const
void print_disTrk(const Trk::Track *t) const
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_dEdxTrkKey
SG::WriteHandleKey< TrackCollection > m_outputTracksKey
std::atomic< unsigned int > m_countRoIwithEnoughHits
bool isPreselPassDisTrackAfterRefit(Trk::Track *, Trk::Track *, double, double) const
std::atomic< unsigned int > m_countRoIwithTracks
std::unique_ptr< Trk::Track > disTrk_refit(Trk::Track *t, const EventContext &ctx) const
StatusCode finddEdxTrk(const EventContext &, const TrackCollection &) const
std::atomic< unsigned int > m_countTotalRoI
ToolHandle< ITrigZFinder > m_trigZFinder
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_disTrkCandKey
int getSPLayer(int, float) const
void filterSharedTracks(std::vector< std::tuple< bool, double, Trk::Track * > > &QT) const
ToolHandle< InDet::ISiTrackMaker > m_trackMaker
TrigCombinatorialSettings m_tcs
ToolHandle< Trk::ITrackFitter > m_disTrkFitter
ToolHandle< Trk::IExtrapolator > m_extrapolator
virtual StatusCode finalize() override
ServiceHandle< ITrigInDetAccelerationSvc > m_accelSvc
ToolHandle< GenericMonitoringTool > m_monTool
StatusCode createEmptyUTTEDMs(const EventContext &) const
StatusCode findDisTracks(const EventContext &, TrackCollection &, std::vector< std::tuple< bool, double, Trk::Track * > > &, std::vector< std::tuple< bool, double, Trk::Track * > > &, TrackCollection &, const std::vector< double > &, const std::vector< double > &, const std::vector< double > &) const
bool usedByAnyTrack(const std::vector< Identifier > &, std::map< Identifier, std::vector< long int > > &) const
void makeSeedsOnGPU(const TrigCombinatorialSettings &, const IRoiDescriptor *, const std::vector< TrigSiSpacePointBase > &, std::vector< TrigInDetTriplet > &) const
bool isCleaningPassDisTrack(const TrigInDetTriplet &, Trk::Track *, bool) const
float dEdx(const Trk::Track *, int &, int &, std::vector< float > &, std::vector< float > &, std::vector< float > &, std::vector< float > &, std::vector< int > &, std::vector< int > &, std::vector< int > &) const
static constexpr size_t N_BARREL_LAYERS
TrigFastTrackFinder(const std::string &name, ISvcLocator *pSvcLocator)
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
Primary Vertex Finder.
Ensure that the ATLAS eigen extensions are properly loaded.
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.
TrigComposite_v1 TrigComposite
Declare the latest version of the class.