ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimLogicalHitsProcessAlg.h
Go to the documentation of this file.
1// Copyright (C) 2002-2025 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<bool> m_writeOutNonSPStripHits {this, "writeOutNonSPStripHits", true, "Write tracks to RootOutput if they have strip hits which are not SPs"};
145 Gaudi::Property <int> m_NumOfHitPerGrouping { this, "NumOfHitPerGrouping", 5, "Number of minimum overlapping hits for a track candidate to be removed in the HoughRootOutputTool"};
146 Gaudi::Property<bool> m_passLowestChi2TrackOnly {this,"passLowestChi2TrackOnly", false, "case when passing only lowest chi2 track per road"};
147 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." };
148 Gaudi::Property<bool> m_outputRoadUnionTool {this, "outputRoadUnionTool", false, "If set to true, create LogicalEventInputHeader in output ROOT file using road union tool."};
149 Gaudi::Property<int> m_region {this, "Region", 0, "Region ID to assign to tracks"};
150 Gaudi::Property<bool> m_writeInputBranches {this, "writeInputBranches", true, "If set to false, never write input branches"};
151 Gaudi::Property<int> m_writeRegion {this,"writeRegion", -1, "Only output selected region, default is -1 which means not requirement"};
152
153 // Properties for the output header tool.
154 Gaudi::Property<std::string> m_sliceBranch {this, "SliceBranchName", "LogicalEventSlicedHeader", "Name of the branch for sliced hits in output ROOT file." };
155 Gaudi::Property<std::string> m_outputBranch {this, "outputBranchName", "LogicalEventOutputHeader", "Name of the branch for output data in output ROOT file." };
156 Gaudi::Property<std::string> m_sliceFirstPixelBranch {this, "FirstPixelBranchName", "LogicalEventFirstPixelHeader", "Name of the branch for first stage pixel hits in output ROOT file"};
157 Gaudi::Property<std::string> m_sliceSecondPixelBranch {this, "SecondPixelBranchName", "LogicalEventSecondPixelHeader", "Name of the branch for second stage pixel hits in output ROOT file"};
158 Gaudi::Property<std::string> m_sliceStripBranch {this, "StripBranchName", "LogicalEventSpacepointHeader", "Name of the branch for (post-SP) strip hits in output ROOT file"};
159 Gaudi::Property<std::string> m_sliceStripBranchPreSP {this, "StripPreSPBranchName", "LogicalEventStripHeader", "Name of the branch for (pre-SP) strip hits in output ROOT file"};
160
161
162 // ROOT pointers.
169
170 // Event storage
172 std::vector<FPGATrackSimCluster> m_spacepoints{};
173
174 // internal counters
175 double m_evt = 0; // number of events passing event selection, independent of truth
176 long m_nRoadsTot = 0; // total number of roads in those events
177 long m_nTracksTot = 0; // total number of tracks in those events
178 long m_nTracksChi2Tot = 0; // total number of tracks passing chi2 in those events
179 long m_nTracksChi2OLRTot = 0; // total number of tracks passing chi2 and OLR in those events
180
181 double m_evt_truth = 0; // number of events passing event selection and having a truth object
182 long m_nRoadsFound = 0; // total number of those events with at least one road
183 long m_nTracksFound = 0; // total number of those events with at least one track
184 long m_nTracksChi2Found = 0; // total number of those events with at least one track passing chi2
185 long m_nTracksChi2OLRFound = 0; // total number of those events with at least one track passing chi2 and OLR
186
187 unsigned long m_maxNRoadsFound = 0; // max number of roads in an event
188 unsigned long m_maxNTracksTot = 0; // max number of tracks in an event
189 unsigned long m_maxNTracksChi2Tot = 0; // max number of tracks passing chi2 in an event
190 unsigned long m_maxNTracksChi2OLRTot = 0; // max number of tracks passing chi2 and OLR in an events
191
192 StatusCode writeOutputData(const std::vector<std::shared_ptr<const FPGATrackSimRoad>> & roads_1st, std::vector<FPGATrackSimTrack> const & tracks_1st,
193 FPGATrackSimDataFlowInfo const * dataFlowInfo);
194
195 void printHitSubregions(std::vector<FPGATrackSimHit> const & hits);
196
197
198 // Read hits from data prep algorithm. TODO: regionalize.
199 SG::ReadHandleKey<FPGATrackSimHitCollection> m_FPGAHitKey {this, "FPGATrackSimHitKey","FPGAHits", "FPGATrackSim hits key"};
200
201 // Write out spacepoints too, since we do that after the slicing engine.
202 SG::WriteHandleKey<FPGATrackSimClusterCollection> m_FPGASpacePointsKey{this, "FPGATrackSimSpacePoints1stKey","FPGASpacePoints_1st","FPGATrackSim SpacePoints key"};
203
204 // Write out roads, hits in roads, and tracks.
205 SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitKey_1st{this, "FPGATrackSimHitKey_1st","FPGAHits_1st","FPGATrackSim 1st stage hits key"};
206 SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitKey_2nd{this, "FPGATrackSimHitKey_2nd","FPGAHits_2nd","FPGATrackSim 2nd stage hits key"};
207 SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitFilteredKey{this, "FPGATrackSimHitFiltered1stKey","FPGAHitsFiltered_1st","FPGATrackSim Filtered Hits 1st stage key"};
208 SG::WriteHandleKey<FPGATrackSimHitContainer> m_FPGAHitInRoadsKey{this, "FPGATrackSimHitInRoads1stKey","FPGAHitsInRoads_1st","FPGATrackSim Hits in 1st stage roads key"};
209 SG::WriteHandleKey<FPGATrackSimRoadCollection> m_FPGARoadKey{this, "FPGATrackSimRoad1stKey","FPGARoads_1st","FPGATrackSim Roads 1st stage key"};
210 SG::WriteHandleKey<FPGATrackSimTrackCollection> m_FPGATrackKey{this, "FPGATrackSimTrack1stKey","FPGATracks_1st","FPGATrackSim Tracks 1st stage key"};
211
212 SG::ReadHandleKey<FPGATrackSimTruthTrackCollection> m_FPGATruthTrackKey {this, "FPGATrackSimTruthTrackKey", "FPGATruthTracks", "FPGATrackSim truth tracks"};
213 SG::ReadHandleKey<FPGATrackSimOfflineTrackCollection> m_FPGAOfflineTrackKey {this, "FPGATrackSimOfflineTrackKey", "FPGAOfflineTracks", "FPGATrackSim offline tracks"};
214 SG::ReadHandleKey<FPGATrackSimEventInfo> m_FPGAEventInfoKey {this, "FPGATrackSimEventInfoKey", "FPGAEventInfo", "FPGATrackSim event info"};
215};
216
217
218#endif // FPGATrackSimLOGICALHITSTOALGORITHMS_h
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.
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
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitKey_2nd
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
ToolHandle< FPGATrackSimHoughRootOutputTool > m_houghRootOutputTool
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_road_post_filter_2_monitor
std::vector< FPGATrackSimTrack > m_tracks_2nd_nomiss
FPGATrackSimLogicalEventInputHeader * m_slicedFirstPixelHeader
virtual ~FPGATrackSimLogicalHitsProcessAlg()=default
ToolHandle< IFPGATrackSimRoadFilterTool > m_roadFilterTool
StatusCode writeOutputData(const std::vector< std::shared_ptr< const FPGATrackSimRoad > > &roads_1st, std::vector< FPGATrackSimTrack > const &tracks_1st, FPGATrackSimDataFlowInfo const *dataFlowInfo)
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
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
FPGATrackSimLogicalEventOutputHeader * m_logicEventOutputHeader
SG::WriteHandleKey< FPGATrackSimClusterCollection > m_FPGASpacePointsKey
ToolHandle< FPGATrackSimTrackMonitor > m_1st_stage_road_post_filter_1_monitor
SG::WriteHandleKey< FPGATrackSimHitContainer > m_FPGAHitInRoadsKey
SG::ReadHandleKey< FPGATrackSimOfflineTrackCollection > m_FPGAOfflineTrackKey
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
ToolHandle< FPGATrackSimRoadUnionTool > m_roadFinderTool
void printHitSubregions(std::vector< FPGATrackSimHit > const &hits)
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitKey_1st
SG::WriteHandleKey< FPGATrackSimTrackCollection > m_FPGATrackKey
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_evtSel
std::vector< FPGATrackSimCluster > m_spacepoints
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.