ATLAS Offline Software
FPGATrackSimDataPrepAlg.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_DATAPREPALG_H
4 #define FPGATrackSim_DATAPREPALG_H
5 
6 /*
7  * Please put a description on what this class does
8  */
9 
11 #include "GaudiKernel/ToolHandle.h"
25 
27 
28 #include <fstream>
29 
30 #include "StoreGate/StoreGateSvc.h"
41 
44 
51 
53 class FPGATrackSimHit;
56 
58 {
59  public:
60  FPGATrackSimDataPrepAlg(const std::string& name, ISvcLocator* pSvcLocator);
61  virtual ~FPGATrackSimDataPrepAlg() = default;
62 
63  virtual StatusCode initialize() override;
64  virtual StatusCode execute() override;
65  virtual StatusCode finalize() override;
66 
67  private:
68 
69  std::string m_description;
70  int m_ev = 0;
71 
72  // Handles
73  ToolHandle<IFPGATrackSimInputTool> m_hitSGInputTool {this, "SGInputTool", "", "Input tool from SG"};
74  ToolHandle<IFPGATrackSimEventInputHeaderTool> m_hitInputTool {this, "InputTool", "FPGATrackSimSGToRawHitsTool/FPGATrackSimSGToRawHitsTool", "Input Tool"};
75  ToolHandle<FPGATrackSimReadRawRandomHitsTool> m_hitInputTool2 {this, "InputTool2", "FPGATrackSimReadRawRandomHitsTool/FPGATrackSimReadRawRandomHitsTool", "Potential 2nd input Tool to load data from more than one source"};
76  ToolHandleArray<FPGATrackSimRawToLogicalHitsTool> m_hitMapTools {this, "RawToLogicalHitsTools", {}, "Raw To Logical Tools"};
77  ToolHandle<IFPGATrackSimHitFilteringTool> m_hitFilteringTool {this, "HitFilteringTool", "FPGATrackSimHitFilteringTool/FPGATrackSimHitFilteringTool", "Hit Filtering Tool"};
78  ToolHandle<FPGATrackSimClusteringToolI> m_clusteringTool {this, "ClusteringTool", "FPGATrackSimClusteringTool/FPGATrackSimClusteringTool", "Hit Clustering Tool"};
79  ToolHandle<FPGATrackSimOutputHeaderTool> m_writeOutputTool {this, "OutputTool", "FPGATrackSimOutputHeaderTool/FPGATrackSimOutputHeaderTool", "Output tool"};
80  ToolHandleArray<FPGATrackSim::FPGATrackSimEventSelectionTool> m_eventSelectionTools {this, "eventSelectors", {}, "Event selection Tools"};
81  // chrono service
82  ServiceHandle<IChronoStatSvc> m_chrono{this,"ChronoStatSvc","ChronoStatSvc"};
83 
84  // Flags
85  Gaudi::Property<int> m_firstInputToolN {this, "FirstInputToolN", 1, "number of times to use event from first input tool"};
86  Gaudi::Property<int> m_secondInputToolN {this, "SecondInputToolN", 0, "number of times to use event from second input tool"};
87  Gaudi::Property<bool> m_doHitFiltering {this, "HitFiltering", false, "flag to enable hit/cluster filtering"};
88  Gaudi::Property<int> m_clustering {this, "Clustering", 0, "int to enable the clustering and say how many times to run it"};
89  Gaudi::Property<bool> m_writeOutputData {this, "writeOutputData", true,"write the output TTree"};
90  Gaudi::Property<bool> m_doEvtSel {this, "doEvtSel", false, "do event selection"};
91  Gaudi::Property<bool> m_useInternalTruthTracks {this,"useInternalTruthTracks", false, "case when runnin on RDO file (and not or wrapper)"};
92  Gaudi::Property<bool> m_recordHits {this,"recordHits", true, "For F-100 this is not needed"};
93 
94  // Properties for the output header tool.
95  Gaudi::Property<std::string> m_preClusterBranch {this, "preClusterBranch", "LogicalEventInputHeader_PreCluster", "Name of the branch for pre-cluster input data in output ROOT file." };
96  Gaudi::Property<std::string> m_postClusterBranch {this, "postClusterBranch", "LogicalEventInputHeader_PostCluster", "Name of the branch for post-cluster input data in output ROOT file." };
97 
98  // ROOT pointers
103 
104  // Event storage
105  std::unique_ptr<FPGATrackSimClusterCollection> m_clusters = std::make_unique<FPGATrackSimClusterCollection>();
106  std::vector<FPGATrackSimHit> m_hits_miss{};
107 
108  // internal counters
109  double m_evt = 0; // number of events passing event selection, independent of truth
110 
111  unsigned long m_nPixClusters = 0; // number of clusters for pix, total
112  unsigned m_nMaxPixClusters = 0; // max number of pixel clusters in an event
113  unsigned long m_nStripClusters = 0; // number of clusters for strip, total
114  unsigned m_nMaxStripClusters = 0; // max number of strip clusters in an event
115  unsigned m_nMaxClusters = 0; // max number of total clusters in an event
116 
117 
118  StatusCode readInputs(bool & done);
121 
122  ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"};
123 
124  // NOTE: the clusters collection(s) contain ALL Clusters, not just "first stage" clusters.
125  SG::WriteHandleKeyArray<FPGATrackSimClusterCollection> m_FPGAClusterKey{this, "FPGATrackSimClusterKey",{"FPGAClusters_1st"},"FPGATrackSim Clusters key"};
126  SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitKey{this, "FPGATrackSimHitKey","FPGAHits", "FPGATrackSim Hits key"};
127  SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitUnmappedKey{this, "FPGATrackSimHitUnmappedKey","FPGAHitsUnmapped_1st","FPGATrackSim Unmapped Hits 1st stage key"};
128 
129  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_inputTruthParticleContainerKey{this, "TruthTrackContainer", "TruthParticles", "Truth Particle Container"};
130  SG::WriteHandleKey<xAODTruthParticleLinkVector> m_truthLinkContainerKey{this, "TruthLinks", "xAODFPGATruthLinks", "Output EF xAODTruthLinks container"};
131 
132  SG::WriteHandleKey<FPGATrackSimTruthTrackCollection> m_FPGATruthTrackKey {this, "FPGATrackSimTruthTrackKey", "FPGATruthTracks", "FPGATrackSim truth tracks"};
133  SG::WriteHandleKey<FPGATrackSimOfflineTrackCollection> m_FPGAOfflineTrackKey {this, "FPGATrackSimOfflineTrackKey", "FPGAOfflineTracks", "FPGATrackSim offline tracks"};
134  SG::WriteHandleKey<FPGATrackSimEventInfo> m_FPGAEventInfoKey{this, "FPGATrackSimEventInfoKey", "FPGAEventInfo", "FPGATrackSim event info"};
135 
136 };
137 
138 
139 #endif // FPGATrackSimLOGICALHITSTOALGORITHMS_h
ReadHandleKeyArray.h
FPGATrackSimDataPrepAlg::readInputs
StatusCode readInputs(bool &done)
Definition: FPGATrackSimDataPrepAlg.cxx:252
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
FPGATrackSimDataPrepAlg::m_chrono
ServiceHandle< IChronoStatSvc > m_chrono
Definition: FPGATrackSimDataPrepAlg.h:82
FPGATrackSimDataPrepAlg::m_evt
double m_evt
Definition: FPGATrackSimDataPrepAlg.h:109
FPGATrackSimLLPRoadFilterTool
Definition: FPGATrackSimLLPRoadFilterTool.h:19
FPGATrackSimDataPrepAlg::m_recordHits
Gaudi::Property< bool > m_recordHits
Definition: FPGATrackSimDataPrepAlg.h:92
FPGATrackSimDataPrepAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: FPGATrackSimDataPrepAlg.h:122
FPGATrackSimLogicalEventInputHeader
Definition: FPGATrackSimLogicalEventInputHeader.h:21
FPGATrackSimDataPrepAlg::m_hitSGInputTool
ToolHandle< IFPGATrackSimInputTool > m_hitSGInputTool
Definition: FPGATrackSimDataPrepAlg.h:73
FPGATrackSimOfflineTrackCollection.h
IFPGATrackSimInputTool.h
FPGATrackSimDataPrepAlg::m_hitInputTool2
ToolHandle< FPGATrackSimReadRawRandomHitsTool > m_hitInputTool2
Definition: FPGATrackSimDataPrepAlg.h:75
FPGATrackSimDataPrepAlg::m_nMaxStripClusters
unsigned m_nMaxStripClusters
Definition: FPGATrackSimDataPrepAlg.h:114
FPGATrackSimDataPrepAlg::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimDataPrepAlg.cxx:43
FPGATrackSimDataPrepAlg::m_eventHeader
FPGATrackSimEventInputHeader m_eventHeader
Definition: FPGATrackSimDataPrepAlg.h:99
FPGATrackSimCluster
Definition: FPGATrackSimCluster.h:24
FPGATrackSimHitCollection.h
FPGATrackSimDataPrepAlg::execute
virtual StatusCode execute() override
Definition: FPGATrackSimDataPrepAlg.cxx:97
FPGATrackSimLLPRoadFilterTool.h
FPGATrackSimDataPrepAlg::m_logicEventHeader_precluster
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader_precluster
Definition: FPGATrackSimDataPrepAlg.h:101
FPGATrackSimDataPrepAlg::m_useInternalTruthTracks
Gaudi::Property< bool > m_useInternalTruthTracks
Definition: FPGATrackSimDataPrepAlg.h:91
FPGATrackSimDataPrepAlg::m_logicEventHeader
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader
Definition: FPGATrackSimDataPrepAlg.h:102
IFPGATrackSimMappingSvc.h
TruthParticleContainer.h
FPGATrackSimDataPrepAlg::m_hitMapTools
ToolHandleArray< FPGATrackSimRawToLogicalHitsTool > m_hitMapTools
Definition: FPGATrackSimDataPrepAlg.h:76
FPGATrackSimDataPrepAlg::m_ev
int m_ev
Definition: FPGATrackSimDataPrepAlg.h:70
FPGATrackSimDataPrepAlg::m_FPGAEventInfoKey
SG::WriteHandleKey< FPGATrackSimEventInfo > m_FPGAEventInfoKey
Definition: FPGATrackSimDataPrepAlg.h:134
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
FPGATrackSimReadRawRandomHitsTool.h
SG::ReadHandleKey< xAOD::TruthParticleContainer >
FPGATrackSimDataPrepAlg::m_description
std::string m_description
Definition: FPGATrackSimDataPrepAlg.h:69
FPGATrackSimTrackFitterTool
Definition: FPGATrackSimTrackFitterTool.h:27
FPGATrackSimDataPrepAlg::m_FPGAOfflineTrackKey
SG::WriteHandleKey< FPGATrackSimOfflineTrackCollection > m_FPGAOfflineTrackKey
Definition: FPGATrackSimDataPrepAlg.h:133
FPGATrackSimHit
Definition: FPGATrackSimHit.h:41
FPGATrackSimNNTrackTool
Definition: FPGATrackSimNNTrackTool.h:38
FPGATrackSimDataPrepAlg::m_nStripClusters
unsigned long m_nStripClusters
Definition: FPGATrackSimDataPrepAlg.h:113
AthAlgorithm.h
FPGATrackSimDataPrepAlg::m_writeOutputData
Gaudi::Property< bool > m_writeOutputData
Definition: FPGATrackSimDataPrepAlg.h:89
FPGATrackSimDataPrepAlg::m_hitFilteringTool
ToolHandle< IFPGATrackSimHitFilteringTool > m_hitFilteringTool
Definition: FPGATrackSimDataPrepAlg.h:77
FPGATrackSimDataPrepAlg::m_doEvtSel
Gaudi::Property< bool > m_doEvtSel
Definition: FPGATrackSimDataPrepAlg.h:90
FPGATrackSimDataPrepAlg::m_FPGAHitKey
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitKey
Definition: FPGATrackSimDataPrepAlg.h:126
SG::WriteHandleKey< FPGATrackSimHitCollection >
FPGATrackSimDataPrepAlg::~FPGATrackSimDataPrepAlg
virtual ~FPGATrackSimDataPrepAlg()=default
FPGATrackSimDataPrepAlg::m_nMaxPixClusters
unsigned m_nMaxPixClusters
Definition: FPGATrackSimDataPrepAlg.h:112
FPGATrackSimDataPrepAlg::m_doHitFiltering
Gaudi::Property< bool > m_doHitFiltering
Definition: FPGATrackSimDataPrepAlg.h:87
FPGATrackSimDataPrepAlg::m_FPGAHitUnmappedKey
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitUnmappedKey
Definition: FPGATrackSimDataPrepAlg.h:127
FPGATrackSimClusterCollection.h
FPGATrackSimDataPrepAlg::m_clustering
Gaudi::Property< int > m_clustering
Definition: FPGATrackSimDataPrepAlg.h:88
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPGATrackSimEventInfo.h
FPGATrackSimDataPrepAlg::m_inputTruthParticleContainerKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_inputTruthParticleContainerKey
Definition: FPGATrackSimDataPrepAlg.h:129
FPGATrackSimRawToLogicalHitsTool.h
FPGATrackSimDataPrepAlg
Definition: FPGATrackSimDataPrepAlg.h:58
FPGATrackSimEventInputHeader
Definition: FPGATrackSimEventInputHeader.h:22
FPGATrackSimEtaPatternFilterTool
Definition: FPGATrackSimEtaPatternFilterTool.h:36
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
AthAlgorithm
Definition: AthAlgorithm.h:47
FPGATrackSimHoughRootOutputTool
Definition: FPGATrackSimHoughRootOutputTool.h:42
FPGATrackSimOutputHeaderTool.h
FPGATrackSimHoughRootOutputTool.h
Output roads into a ROOT file.
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
WriteHandleKeyArray.h
FPGATrackSimEventInputHeader.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FPGATrackSimDataPrepAlg::m_secondInputToolN
Gaudi::Property< int > m_secondInputToolN
Definition: FPGATrackSimDataPrepAlg.h:86
FPGATrackSimDataPrepAlg::m_FPGAClusterKey
SG::WriteHandleKeyArray< FPGATrackSimClusterCollection > m_FPGAClusterKey
Definition: FPGATrackSimDataPrepAlg.h:125
FPGATrackSimDataPrepAlg::m_nMaxClusters
unsigned m_nMaxClusters
Definition: FPGATrackSimDataPrepAlg.h:115
FPGATrackSimDataPrepAlg::m_writeOutputTool
ToolHandle< FPGATrackSimOutputHeaderTool > m_writeOutputTool
Definition: FPGATrackSimDataPrepAlg.h:79
FPGATrackSimHitContainer.h
FPGATrackSimEventSelectionTool.h
FPGATrackSimTruthTrackCollection.h
FPGATrackSimDataPrepAlg::m_clusteringTool
ToolHandle< FPGATrackSimClusteringToolI > m_clusteringTool
Definition: FPGATrackSimDataPrepAlg.h:78
FPGATrackSimDataPrepAlg::m_preClusterBranch
Gaudi::Property< std::string > m_preClusterBranch
Definition: FPGATrackSimDataPrepAlg.h:95
FPGATrackSimDataPrepAlg::processInputs
StatusCode processInputs(SG::WriteHandle< FPGATrackSimHitCollection > &FPGAHitUnmapped, SG::WriteHandle< FPGATrackSimClusterCollection > &FPGAClusters)
Definition: FPGATrackSimDataPrepAlg.cxx:293
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
FPGATrackSimDataPrepAlg::m_postClusterBranch
Gaudi::Property< std::string > m_postClusterBranch
Definition: FPGATrackSimDataPrepAlg.h:96
FPGATrackSimDataPrepAlg::m_clusters
std::unique_ptr< FPGATrackSimClusterCollection > m_clusters
Definition: FPGATrackSimDataPrepAlg.h:105
FPGATrackSimDataPrepAlg::m_truthLinkContainerKey
SG::WriteHandleKey< xAODTruthParticleLinkVector > m_truthLinkContainerKey
Definition: FPGATrackSimDataPrepAlg.h:130
IFPGATrackSimHitFilteringTool.h
Declares an abstract class that implements an interface for hit/cluster filtering....
IFPGATrackSimEventInputHeaderTool.h
FPGATrackSimDataPrepAlg::m_firstInputToolN
Gaudi::Property< int > m_firstInputToolN
Definition: FPGATrackSimDataPrepAlg.h:85
FPGATrackSimDataPrepAlg::m_hits_miss
std::vector< FPGATrackSimHit > m_hits_miss
Definition: FPGATrackSimDataPrepAlg.h:106
FPGATrackSimLogicalEventOutputHeader
Definition: FPGATrackSimLogicalEventOutputHeader.h:12
FPGATrackSimDataPrepAlg::FPGATrackSimDataPrepAlg
FPGATrackSimDataPrepAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FPGATrackSimDataPrepAlg.cxx:37
FPGATrackSimDataPrepAlg::m_eventSelectionTools
ToolHandleArray< FPGATrackSim::FPGATrackSimEventSelectionTool > m_eventSelectionTools
Definition: FPGATrackSimDataPrepAlg.h:80
FPGATrackSimDataPrepAlg::m_hitInputTool
ToolHandle< IFPGATrackSimEventInputHeaderTool > m_hitInputTool
Definition: FPGATrackSimDataPrepAlg.h:74
FPGATrackSimEventInfoCollection.h
FPGATrackSimClusteringToolI.h
Declares an abstract class that implements an interface for pixel clustering. This class is implement...
FPGATrackSimDataPrepAlg::m_firstInputHeader
FPGATrackSimEventInputHeader m_firstInputHeader
Definition: FPGATrackSimDataPrepAlg.h:100
FPGATrackSimDataPrepAlg::finalize
virtual StatusCode finalize() override
Definition: FPGATrackSimDataPrepAlg.cxx:349
StoreGateSvc.h
FPGATrackSimDataPrepAlg::m_FPGATruthTrackKey
SG::WriteHandleKey< FPGATrackSimTruthTrackCollection > m_FPGATruthTrackKey
Definition: FPGATrackSimDataPrepAlg.h:132
FPGATrackSimOverlapRemovalTool
Remove (mark) duplicate tracks This tool takes FPGATrackSimTrack as input and mark their status of pa...
Definition: FPGATrackSimOverlapRemovalTool.h:35
FPGATrackSimDataPrepAlg::m_nPixClusters
unsigned long m_nPixClusters
Definition: FPGATrackSimDataPrepAlg.h:111
ServiceHandle< IChronoStatSvc >