ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimLogicalHitsProcessAlg.h
Go to the documentation of this file.
1// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3#ifndef FPGATrackSim_LOGICALHITSPROCESSALG_H
4#define FPGATrackSim_LOGICALHITSPROCESSALG_H
5
6/*
7 * Please put a description on what this class does
8 */
9
11#include "GaudiKernel/ToolHandle.h"
34
35#include <fstream>
36
50
53
60
62class FPGATrackSimHit;
68
70{
71 public:
72 FPGATrackSimLogicalHitsProcessAlg(const std::string& name, ISvcLocator* pSvcLocator);
74
75 virtual StatusCode initialize() override;
76 virtual StatusCode execute() override;
77 virtual StatusCode finalize() override;
78
79 private:
80
81 std::string m_description;
82
83 // Handles
84 ToolHandle<FPGATrackSimSpacePointsToolI> m_spacepointsTool {this, "SpacePointTool", "FPGATrackSimSpacePointsTool/FPGATrackSimSpacePointsTool", "Space Points Tool"};
85 ToolHandle<FPGATrackSimRoadUnionTool> m_roadFinderTool {this, "RoadFinder", "FPGATrackSimPatternMatchTool", "Road Finder Tool"};
86 ToolHandle<FPGATrackSimLLPRoadFilterTool> m_LRTRoadFilterTool {this, "LRTRoadFilter", "FPGATrackSimLLPRoadFilterTool/FPGATrackSimLLPRoadFilterTool", "LRT Road Filter Tool"};
87 ToolHandle<IFPGATrackSimRoadFinderTool> m_LRTRoadFinderTool {this, "LRTRoadFinder", "FPGATrackSimHoughTransform_d0phi0_Tool/FPGATrackSimHoughTransform_d0phi0_Tool", "LRT Road Finder Tool"};
88 ToolHandle<IFPGATrackSimRoadFilterTool> m_roadFilterTool {this, "RoadFilter", "FPGATrackSimEtaPatternFilterTool", "Road Filter Tool"};
89 ToolHandle<IFPGATrackSimRoadFilterTool> m_roadFilterTool2 {this, "RoadFilter2", "FPGATrackSimPhiRoadFilterTool", "Road Filter2 Tool"};
90 ToolHandle<FPGATrackSimNNTrackTool> m_NNTrackTool {this, "NNTrackTool", "FPGATrackSimNNTrackTool/FPGATrackSimNNTrackTool", "NN Track Tool"};
91 ToolHandle<FPGATrackSimHoughRootOutputTool> m_houghRootOutputTool {this, "HoughRootOutputTool", "FPGATrackSimHoughRootOutputTool/FPGATrackSimHoughRootOutputTool", "Hough ROOT Output Tool"};
92 ToolHandle<FPGATrackSimTrackFitterTool> m_trackFitterTool_1st {this, "TrackFitter_1st", "FPGATrackSimTrackFitterTool/FPGATrackSimTrackFitterTool_1st", "1st stage track fit tool"};
93 ToolHandle<FPGATrackSimOverlapRemovalTool> m_overlapRemovalTool_1st {this, "OverlapRemoval_1st", "FPGATrackSimOverlapRemovalTool/FPGATrackSimOverlapRemovalTool_1st", "1st stage overlap removal tool"};
94 ToolHandle<FPGATrackSimOutputHeaderTool> m_writeOutputTool {this, "OutputTool", "FPGATrackSimOutputHeaderTool/FPGATrackSimOutputHeaderTool", "Output tool"};
95 ToolHandle<FPGATrackSimSlicingEngineTool> m_slicingEngineTool {this, "SlicingEngineTool", "FPGATrackSimSlicingEngineTool/FPGATrackSimSlicingEngineTool", "Slicing engine tool"};
96 ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMapping", "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"};
97 ServiceHandle<IFPGATrackSimEventSelectionSvc> m_evtSel {this, "eventSelector", "", "Event selection Svc"};
98
99
101 ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"};
102
106 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_road_monitor {this, "FirstStageRoadMonitor", "FPGATrackSimTrackMonitor", "First Stage Road Monitor"};
108 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_road_post_filter_1_monitor {this, "FirstStageRoadPostFilter1Monitor", "FPGATrackSimTrackMonitor", "First Stage Road Post Filter1 Monitor"};
110 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_road_post_OLR_monitor {this, "FirstStageRoadPostOverlapRemovalMonitor", "FPGATrackSimTrackMonitor", "First Stage Road Post Overlap Removal Monitor"};
112 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_road_post_filter_2_monitor {this, "FirstStageRoadPostFilter2Monitor", "FPGATrackSimTrackMonitor", "First Stage Road Post Filter2 Monitor"};
113
115 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_track_monitor {this, "FirstStageTrackMonitor", "FPGATrackSimTrackMonitor", "First Stage Track Monitor"};
117 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_track_post_setTruth_monitor {this, "FirstStageTrackPostSetTruthMonitor", "FPGATrackSimTrackMonitor", "First Stage Track Post Set to TruthTracks Monitor"};
119 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_track_post_chi2_monitor {this, "FirstStageTrackPostChi2Monitor", "FPGATrackSimTrackMonitor", "First Stage Track Post Chi2 Monitor"};
121 ToolHandle<FPGATrackSimTrackMonitor> m_1st_stage_track_post_OLR_monitor {this, "FirstStageTrackPostOverlapRemovalTrackMonitor", "FPGATrackSimTrackMonitor", "First Stage Track Post Overlap Removal Monitor"};
122
123
124 // chrono service
125 ServiceHandle<IChronoStatSvc> m_chrono{this,"ChronoStatSvc","ChronoStatSvc"};
126
127 // Flags
128 Gaudi::Property<int> m_SetTruthParametersForTracks {this, "SetTruthParametersForTracks", -1, "flag to override track parameters and set them to the truth values"};
129 Gaudi::Property<bool> m_doSpacepoints {this, "Spacepoints", false, "flag to enable the spacepoint formation"};
130 Gaudi::Property<bool> m_doTracking {this, "tracking", false, "flag to enable the tracking"};
131 Gaudi::Property<bool> m_doMultiTruth{this, "doMultiTruth", true, "flag to enable the use of multi-truth information for hits"};
132 Gaudi::Property<bool> m_doOverlapRemoval {this, "doOverlapRemoval", true , "flag to enable the overlap removal"}; // defaul true to not change functionality
133 Gaudi::Property<bool> m_doMissingHitsChecks {this, "DoMissingHitsChecks", false};
134 Gaudi::Property<bool> m_filterRoads {this, "FilterRoads", false, "enable first road filter"};
135 Gaudi::Property<bool> m_filterRoads2 {this, "FilterRoads2", false, "enable second road filter"};
136 Gaudi::Property<bool> m_doHoughRootOutput1st {this, "DoHoughRootOutput1st", false, "Dump output from the Hough Transform to flat ntuples"};
137 Gaudi::Property<bool> m_doNNTrack {this, "DoNNTrack_1st", false, "Run NN track filtering for 1st stage"};
138 Gaudi::Property<bool> m_doGNNTrack {this, "DoGNNTrack", false, "Run tracking algorithm for GNN" };
139 Gaudi::Property<bool> m_doGNNPixelSeeding {this, "DoGNNPixelSeeding", false, "Flag to configure for GNN Pixel Seeding" };
140 Gaudi::Property<bool> m_doLRT {this, "doLRT", false, "Enable Large Radius Tracking"};
141 Gaudi::Property<bool> m_doLRTHitFiltering {this, "LRTHitFiltering", false, "flag to enable hit/cluster filtering for LRT"};
142 Gaudi::Property<bool> m_writeOutputData {this, "writeOutputData", true,"write the output TTree"};
143 Gaudi::Property<float> m_trackScoreCut {this, "TrackScoreCut", 25.0, "Minimum track score (e.g. chi2 or NN)." };
144 Gaudi::Property<std::vector<float>> m_track_Chi2PhiCut {this, "Chi2PhiCut", {-1.0,-1.0}, "Minimum Phi specific Chi2 cuts for vector starting with zero missed hits and counting up, negative is not active" };
145 Gaudi::Property<std::vector<float>> m_track_Chi2EtaCut {this, "Chi2EtaCut", {-1.0,-1.0}, "Minimum Eta specific Chi2 cuts for vector starting with zero missed hits and counting up, negative is not active" };
146 Gaudi::Property<int> m_keepHitsStrategy {this, "keepHitsStrategy", -1, "If this is less than 0, do nothing. If 1, pick 3 hits furthest apart. If 2, pick 3 inner hits. If 3, pick 3 outer hits. If 4, drop only middle hit for 5/5 otherwise keep all 4 hits for 4/5"};
147
148 Gaudi::Property<bool> m_writeOutNonSPStripHits {this, "writeOutNonSPStripHits", true, "Write tracks to RootOutput if they have strip hits which are not SPs"};
149 Gaudi::Property <int> m_NumOfHitPerGrouping { this, "NumOfHitPerGrouping", 5, "Number of minimum overlapping hits for a track candidate to be removed in the HoughRootOutputTool"};
150 Gaudi::Property<bool> m_passLowestChi2TrackOnly {this,"passLowestChi2TrackOnly", false, "case when passing only lowest chi2 track per road"};
151 Gaudi::Property<bool> m_secondStageStrips {this, "secondStageStrips", true, "If set to true, strip hits/SPs go to the second stage. Otherwise they go to the first." };
152 Gaudi::Property<bool> m_outputRoadUnionTool {this, "outputRoadUnionTool", false, "If set to true, create LogicalEventInputHeader in output ROOT file using road union tool."};
153 Gaudi::Property<int> m_region {this, "Region", 0, "Region ID to assign to tracks"};
154 Gaudi::Property<bool> m_writeInputBranches {this, "writeInputBranches", true, "If set to false, never write input branches"};
155 Gaudi::Property<int> m_writeRegion {this,"writeRegion", -1, "Only output selected region, default is -1 which means not requirement"};
156
157 // Properties for the output header tool.
158 Gaudi::Property<std::string> m_sliceBranch {this, "SliceBranchName", "LogicalEventSlicedHeader", "Name of the branch for sliced hits in output ROOT file." };
159 Gaudi::Property<std::string> m_outputBranch {this, "outputBranchName", "LogicalEventOutputHeader", "Name of the branch for output data in output ROOT file." };
160 Gaudi::Property<std::string> m_sliceFirstPixelBranch {this, "FirstPixelBranchName", "LogicalEventFirstPixelHeader", "Name of the branch for first stage pixel hits in output ROOT file"};
161 Gaudi::Property<std::string> m_sliceSecondPixelBranch {this, "SecondPixelBranchName", "LogicalEventSecondPixelHeader", "Name of the branch for second stage pixel hits in output ROOT file"};
162 Gaudi::Property<std::string> m_sliceStripBranch {this, "StripBranchName", "LogicalEventSpacepointHeader", "Name of the branch for (post-SP) strip hits in output ROOT file"};
163 Gaudi::Property<std::string> m_sliceStripBranchPreSP {this, "StripPreSPBranchName", "LogicalEventStripHeader", "Name of the branch for (pre-SP) strip hits in output ROOT file"};
164
165
166 // ROOT pointers.
173
174 // Event storage
176
177 // internal counters
178 double m_evt = 0; // number of events passing event selection, independent of truth
179 long m_nRoadsTot = 0; // total number of roads in those events
180 long m_nTracksTot = 0; // total number of tracks in those events
181 long m_nTracksChi2Tot = 0; // total number of tracks passing chi2 in those events
182 long m_nTracksChi2OLRTot = 0; // total number of tracks passing chi2 and OLR in those events
183
184 double m_evt_truth = 0; // number of events passing event selection and having a truth object
185 long m_nRoadsFound = 0; // total number of those events with at least one road
186 long m_nTracksFound = 0; // total number of those events with at least one track
187 long m_nTracksChi2Found = 0; // total number of those events with at least one track passing chi2
188 long m_nTracksChi2OLRFound = 0; // total number of those events with at least one track passing chi2 and OLR
189
190 unsigned long m_maxNRoadsFound = 0; // max number of roads in an event
191 unsigned long m_maxNTracksTot = 0; // max number of tracks in an event
192 unsigned long m_maxNTracksChi2Tot = 0; // max number of tracks passing chi2 in an event
193 unsigned long m_maxNTracksChi2OLRTot = 0; // max number of tracks passing chi2 and OLR in an events
194
195 StatusCode writeOutputData(const std::vector<FPGATrackSimRoad> & roads_1st, std::vector<FPGATrackSimTrack> const & tracks_1st,
196 FPGATrackSimDataFlowInfo const * dataFlowInfo);
197
198 void printHitSubregions(std::vector<FPGATrackSimHit> const & hits);
199
200 bool passesChi2Cut(const FPGATrackSimTrack& track);
201 std::vector<unsigned> PickHitsToUse(layer_bitmask_t) const;
202 void MakeSeedTracks(std::vector<FPGATrackSimTrack>& tracks);
203
204
205 // Read hits from data prep algorithm. TODO: regionalize.
206 SG::ReadHandleKey<FPGATrackSimHitCollection> m_FPGAHitKey {this, "FPGATrackSimHitKey","FPGAHits", "FPGATrackSim hits key"};
207
208 // Write out spacepoints too, since we do that after the slicing engine.
209 SG::WriteHandleKey<FPGATrackSimClusterCollection> m_FPGASpacePointsKey{this, "FPGATrackSimSpacePoints1stKey","FPGASpacePoints_1st","FPGATrackSim SpacePoints key"};
210
211 // Write out roads, hits in roads, and tracks.
212 SG::WriteHandleKey<ConstDataVector<FPGATrackSimHitCollection>> m_FPGAHitKey_1st{this, "FPGATrackSimHitKey_1st","FPGAHits_1st","FPGATrackSim 1st stage hits key"};
213 SG::WriteHandleKey<ConstDataVector<FPGATrackSimHitCollection>> m_FPGAHitKey_2nd{this, "FPGATrackSimHitKey_2nd","FPGAHits_2nd","FPGATrackSim 2nd stage hits key"};
214 SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitFilteredKey{this, "FPGATrackSimHitFiltered1stKey","FPGAHitsFiltered_1st","FPGATrackSim Filtered Hits 1st stage key"};
215 SG::WriteHandleKey<FPGATrackSimRoadCollection> m_FPGARoadKey{this, "FPGATrackSimRoad1stKey","FPGARoads_1st","FPGATrackSim Roads 1st stage key"};
216 SG::WriteHandleKey<FPGATrackSimTrackCollection> m_FPGATrackKey{this, "FPGATrackSimTrack1stKey","FPGATracks_1st","FPGATrackSim Tracks 1st stage key"};
217
218 SG::ReadHandleKey<FPGATrackSimTruthTrackCollection> m_FPGATruthTrackKey {this, "FPGATrackSimTruthTrackKey", "FPGATruthTracks", "FPGATrackSim truth tracks"};
219 SG::ReadHandleKey<FPGATrackSimOfflineTrackCollection> m_FPGAOfflineTrackKey {this, "FPGATrackSimOfflineTrackKey", "FPGAOfflineTracks", "FPGATrackSim offline tracks"};
220 SG::ReadHandleKey<FPGATrackSimEventInfo> m_FPGAEventInfoKey {this, "FPGATrackSimEventInfoKey", "FPGAEventInfo", "FPGATrackSim event info"};
221
222
223};
224
225
226#endif // FPGATrackSimLOGICALHITSTOALGORITHMS_h
DataVector adapter that acts like it holds const pointers.
Declares an abstract class that implements an interface for pixel clustering. This class is implement...
Output roads into a ROOT file.
This class reads/write FPGATrackSim output data from/to a ROOT file Designed to be not thread-safe.
Wrapper class to combine multiple road-finding tools.
Declares an abstract class that implements an interface for spacepoint formation. This class is imple...
This is the monitoring for the FPGATrackSimTrackMonitor.
uint32_t layer_bitmask_t
This declares a basic interface for input tools which provide the FPGATrackSimEventInputHeader data t...
Declares an abstract class that implements an interface for hit/cluster filtering....
Interface declaration for road filter tools.
Interface declaration for road finder tools.
Header file to be included by clients of the Monitored infrastructure.
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.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_road_monitor
Gaudi::Property< std::string > m_sliceSecondPixelBranch
FPGATrackSimLogicalEventInputHeader * m_slicedHitHeader
ToolHandle< FPGATrackSimSpacePointsToolI > m_spacepointsTool
ToolHandle< FPGATrackSimOverlapRemovalTool > m_overlapRemovalTool_1st
ToolHandle< GenericMonitoringTool > m_monTool
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_road_post_OLR_monitor
ToolHandle< FPGATrackSimSlicingEngineTool > m_slicingEngineTool
Gaudi::Property< std::string > m_sliceStripBranchPreSP
FPGATrackSimLogicalEventInputHeader * m_slicedStripHeaderPreSP
SG::WriteHandleKey< ConstDataVector< FPGATrackSimHitCollection > > m_FPGAHitKey_1st
ToolHandle< FPGATrackSimHoughRootOutputTool > m_houghRootOutputTool
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_road_post_filter_2_monitor
std::vector< FPGATrackSimTrack > m_tracks_2nd_nomiss
void MakeSeedTracks(std::vector< FPGATrackSimTrack > &tracks)
FPGATrackSimLogicalEventInputHeader * m_slicedFirstPixelHeader
std::vector< unsigned > PickHitsToUse(layer_bitmask_t) const
virtual ~FPGATrackSimLogicalHitsProcessAlg()=default
ToolHandle< IFPGATrackSimRoadFilterTool > m_roadFilterTool
FPGATrackSimLogicalEventInputHeader * m_slicedSecondPixelHeader
std::vector< FPGATrackSimTrack > m_tracks_1st_guessedcheck
SG::WriteHandleKey< FPGATrackSimRoadCollection > m_FPGARoadKey
ToolHandle< FPGATrackSimNNTrackTool > m_NNTrackTool
ToolHandle< FPGATrackSimLLPRoadFilterTool > m_LRTRoadFilterTool
std::vector< FPGATrackSimTrack > m_tracks_2nd_guessedcheck
bool passesChi2Cut(const FPGATrackSimTrack &track)
ToolHandle< IFPGATrackSimRoadFinderTool > m_LRTRoadFinderTool
std::vector< FPGATrackSimTrack > m_tracks_1st_nomiss
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_track_post_OLR_monitor
ToolHandle< FPGATrackSimOutputHeaderTool > m_writeOutputTool
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_track_post_setTruth_monitor
SG::ReadHandleKey< FPGATrackSimHitCollection > m_FPGAHitKey
Gaudi::Property< std::string > m_sliceFirstPixelBranch
ToolHandle< FPGATrackSimTrackFitterTool > m_trackFitterTool_1st
ToolHandle< IFPGATrackSimRoadFilterTool > m_roadFilterTool2
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_track_post_chi2_monitor
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_track_monitor
StatusCode writeOutputData(const std::vector< FPGATrackSimRoad > &roads_1st, std::vector< FPGATrackSimTrack > const &tracks_1st, FPGATrackSimDataFlowInfo const *dataFlowInfo)
FPGATrackSimLogicalEventOutputHeader * m_logicEventOutputHeader
SG::WriteHandleKey< FPGATrackSimClusterCollection > m_FPGASpacePointsKey
SG::WriteHandleKey< ConstDataVector< FPGATrackSimHitCollection > > m_FPGAHitKey_2nd
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_road_post_filter_1_monitor
Gaudi::Property< std::vector< float > > m_track_Chi2PhiCut
SG::ReadHandleKey< FPGATrackSimOfflineTrackCollection > m_FPGAOfflineTrackKey
Gaudi::Property< std::vector< float > > m_track_Chi2EtaCut
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
ToolHandle< FPGATrackSimRoadUnionTool > m_roadFinderTool
void printHitSubregions(std::vector< FPGATrackSimHit > const &hits)
SG::WriteHandleKey< FPGATrackSimTrackCollection > m_FPGATrackKey
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_evtSel
FPGATrackSimLogicalHitsProcessAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitFilteredKey
SG::ReadHandleKey< FPGATrackSimTruthTrackCollection > m_FPGATruthTrackKey
SG::ReadHandleKey< FPGATrackSimEventInfo > m_FPGAEventInfoKey
FPGATrackSimLogicalEventInputHeader * m_slicedStripHeader
Remove (mark) duplicate tracks This tool takes FPGATrackSimTrack as input and mark their status of pa...
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.