ATLAS Offline Software
FPGATrackSimDataPrepAlg.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2024 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"
40 
43 
50 
52 class FPGATrackSimHit;
55 
57 {
58  public:
59  FPGATrackSimDataPrepAlg(const std::string& name, ISvcLocator* pSvcLocator);
60  virtual ~FPGATrackSimDataPrepAlg() = default;
61 
62  virtual StatusCode initialize() override;
63  virtual StatusCode execute() override;
64  virtual StatusCode finalize() override;
65 
66  private:
67 
68  std::string m_description;
69  int m_ev = 0;
70 
71  // Handles
72  ToolHandle<IFPGATrackSimInputTool> m_hitSGInputTool {this, "SGInputTool", "", "Input tool from SG"};
73  ToolHandle<IFPGATrackSimEventInputHeaderTool> m_hitInputTool {this, "InputTool", "FPGATrackSimSGToRawHitsTool/FPGATrackSimSGToRawHitsTool", "Input Tool"};
74  ToolHandle<FPGATrackSimReadRawRandomHitsTool> m_hitInputTool2 {this, "InputTool2", "FPGATrackSimReadRawRandomHitsTool/FPGATrackSimReadRawRandomHitsTool", "Potential 2nd input Tool to load data from more than one source"};
75  ToolHandle<FPGATrackSimRawToLogicalHitsTool> m_hitMapTool {this, "RawToLogicalHitsTool", "FPGATrackSim_RawToLogicalHitsTool/FPGATrackSim_RawToLogicalHitsTool", "Raw To Logical Tool"};
76  ToolHandle<IFPGATrackSimHitFilteringTool> m_hitFilteringTool {this, "HitFilteringTool", "FPGATrackSimHitFilteringTool/FPGATrackSimHitFilteringTool", "Hit Filtering Tool"};
77  ToolHandle<FPGATrackSimClusteringToolI> m_clusteringTool {this, "ClusteringTool", "FPGATrackSimClusteringTool/FPGATrackSimClusteringTool", "Hit Clustering Tool"};
78  ToolHandle<FPGATrackSimSpacePointsToolI> m_spacepointsTool {this, "SpacePointTool", "FPGATrackSimSpacePointsTool/FPGATrackSimSpacePointsTool", "Space Points Tool"};
79  ToolHandle<FPGATrackSimOutputHeaderTool> m_writeOutputTool {this, "OutputTool", "FPGATrackSimOutputHeaderTool/FPGATrackSimOutputHeaderTool", "Output tool"};
80  ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMapping", "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"};
81  ServiceHandle<IFPGATrackSimEventSelectionSvc> m_evtSel {this, "eventSelector", "FPGATrackSimEventSelectionSvc", "Event selection Svc"};
82 
83  // Flags
84  Gaudi::Property<int> m_firstInputToolN {this, "FirstInputToolN", 1, "number of times to use event from first input tool"};
85  Gaudi::Property<int> m_secondInputToolN {this, "SecondInputToolN", 0, "number of times to use event from second input tool"};
86  Gaudi::Property<bool> m_doHitFiltering {this, "HitFiltering", false, "flag to enable hit/cluster filtering"};
87  Gaudi::Property<int> m_clustering {this, "Clustering", 0, "int to enable the clustering and say how many times to run it"};
88  Gaudi::Property<bool> m_doSpacepoints {this, "Spacepoints", false, "flag to enable the spacepoint formation"};
89  Gaudi::Property<bool> m_writeOutputData {this, "writeOutputData", true,"write the output TTree"};
90  Gaudi::Property<bool> m_doEvtSel {this, "doEvtSel", true, "do event selection"};
91  Gaudi::Property<bool> m_runOnRDO {this,"runOnRDO", false, "case when runnin on RDO file (and not or wrapper)"};
92 
93  // Properties for the output header tool.
94  Gaudi::Property<std::string> m_preClusterBranch {this, "preClusterBranch", "LogicalEventInputHeader_PreCluster", "Name of the branch for pre-cluster input data in output ROOT file." };
95  Gaudi::Property<std::string> m_postClusterBranch {this, "postClusterBranch", "LogicalEventInputHeader_PostCluster", "Name of the branch for post-cluster input data in output ROOT file." };
96 
97  // ROOT pointers
102 
103  // Event storage
104  std::vector<FPGATrackSimCluster> m_clusters, m_clusters_original;
105  std::vector<FPGATrackSimCluster> m_spacepoints;
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  StatusCode readInputs(bool & done);
116 
117  ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"};
118 
119  // NOTE: the clusters collection(s) contain ALL Clusters, not just "first stage" clusters.
120  SG::WriteHandleKeyArray<FPGATrackSimClusterCollection> m_FPGAClusterKey{this, "FPGATrackSimClusterKey",{"FPGAClusters_1st"},"FPGATrackSim Clusters key"};
121  SG::WriteHandleKey<FPGATrackSimClusterCollection> m_FPGAClusterFilteredKey{this, "FPGATrackSimClusterFilteredKey","FPGAClustersFiltered","FPGATrackSim Filtered Clusters key"};
122  SG::WriteHandleKeyArray<FPGATrackSimClusterCollection> m_FPGASpacePointsKey{this, "FPGATrackSimSpacePoints1stKey",{"FPGASpacePoints_1st","FPGASpacePoints_2nd"},"FPGATrackSim SpacePoints key"};
123  SG::WriteHandleKeyArray<FPGATrackSimHitCollection> m_FPGAHitKey{this, "FPGATrackSimHitKey",{"FPGAHits_1st", "FPGAHits_2nd"},"FPGATrackSim Hits key"};
124  SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitUnmappedKey{this, "FPGATrackSimHitUnmappedKey","FPGAHitsUnmapped_1st","FPGATrackSim Unmapped Hits 1st stage key"};
125 
126  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_inputTruthParticleContainerKey{this, "TruthTrackContainer", "TruthParticles", "Truth Particle Container"};
127  SG::WriteHandleKey<xAODTruthParticleLinkVector> m_truthLinkContainerKey{this, "TruthLinks", "xAODFPGATruthLinks", "Output EF xAODTruthLinks container"};
128 
129  SG::WriteHandleKey<FPGATrackSimTruthTrackCollection> m_FPGATruthTrackKey {this, "FPGATrackSimTruthTrackKey", "FPGATruthTracks", "FPGATrackSim truth tracks"};
130  SG::WriteHandleKey<FPGATrackSimOfflineTrackCollection> m_FPGAOfflineTrackKey {this, "FPGATrackSimOfflineTrackKey", "FPGAOfflineTracks", "FPGATrackSim offline tracks"};
131 
132 };
133 
134 
135 #endif // FPGATrackSimLOGICALHITSTOALGORITHMS_h
ReadHandleKeyArray.h
FPGATrackSimDataPrepAlg::readInputs
StatusCode readInputs(bool &done)
Definition: FPGATrackSimDataPrepAlg.cxx:267
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
FPGATrackSimDataPrepAlg::m_evt
double m_evt
Definition: FPGATrackSimDataPrepAlg.h:109
FPGATrackSimLLPRoadFilterTool
Definition: FPGATrackSimLLPRoadFilterTool.h:19
FPGATrackSimDataPrepAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: FPGATrackSimDataPrepAlg.h:117
FPGATrackSimLogicalEventInputHeader
Definition: FPGATrackSimLogicalEventInputHeader.h:21
FPGATrackSimDataPrepAlg::m_hitSGInputTool
ToolHandle< IFPGATrackSimInputTool > m_hitSGInputTool
Definition: FPGATrackSimDataPrepAlg.h:72
FPGATrackSimOfflineTrackCollection.h
IFPGATrackSimInputTool.h
FPGATrackSimDataPrepAlg::m_hitInputTool2
ToolHandle< FPGATrackSimReadRawRandomHitsTool > m_hitInputTool2
Definition: FPGATrackSimDataPrepAlg.h:74
FPGATrackSimDataPrepAlg::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimDataPrepAlg.cxx:49
FPGATrackSimDataPrepAlg::m_eventHeader
FPGATrackSimEventInputHeader m_eventHeader
Definition: FPGATrackSimDataPrepAlg.h:98
FPGATrackSimDataPrepAlg::m_hitMapTool
ToolHandle< FPGATrackSimRawToLogicalHitsTool > m_hitMapTool
Definition: FPGATrackSimDataPrepAlg.h:75
FPGATrackSimCluster
Definition: FPGATrackSimCluster.h:24
FPGATrackSimHitCollection.h
FPGATrackSimDataPrepAlg::execute
virtual StatusCode execute() override
Definition: FPGATrackSimDataPrepAlg.cxx:106
FPGATrackSimLLPRoadFilterTool.h
FPGATrackSimDataPrepAlg::m_logicEventHeader_precluster
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader_precluster
Definition: FPGATrackSimDataPrepAlg.h:100
FPGATrackSimDataPrepAlg::m_doSpacepoints
Gaudi::Property< bool > m_doSpacepoints
Definition: FPGATrackSimDataPrepAlg.h:88
FPGATrackSimDataPrepAlg::m_logicEventHeader
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader
Definition: FPGATrackSimDataPrepAlg.h:101
IFPGATrackSimMappingSvc.h
TruthParticleContainer.h
FPGATrackSimDataPrepAlg::m_ev
int m_ev
Definition: FPGATrackSimDataPrepAlg.h:69
SG::HandleKeyArray
Definition: StoreGate/StoreGate/HandleKeyArray.h:38
FPGATrackSimReadRawRandomHitsTool.h
FPGATrackSimDataPrepAlg::m_evtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_evtSel
Definition: FPGATrackSimDataPrepAlg.h:81
SG::ReadHandleKey< xAOD::TruthParticleContainer >
FPGATrackSimDataPrepAlg::m_description
std::string m_description
Definition: FPGATrackSimDataPrepAlg.h:68
FPGATrackSimTrackFitterTool
Definition: FPGATrackSimTrackFitterTool.h:27
FPGATrackSimDataPrepAlg::m_FPGAOfflineTrackKey
SG::WriteHandleKey< FPGATrackSimOfflineTrackCollection > m_FPGAOfflineTrackKey
Definition: FPGATrackSimDataPrepAlg.h:130
FPGATrackSimHit
Definition: FPGATrackSimHit.h:41
FPGATrackSimDataPrepAlg::m_FPGAClusterFilteredKey
SG::WriteHandleKey< FPGATrackSimClusterCollection > m_FPGAClusterFilteredKey
Definition: FPGATrackSimDataPrepAlg.h:121
FPGATrackSimNNTrackTool
Definition: FPGATrackSimNNTrackTool.h:38
AthAlgorithm.h
FPGATrackSimDataPrepAlg::m_writeOutputData
Gaudi::Property< bool > m_writeOutputData
Definition: FPGATrackSimDataPrepAlg.h:89
FPGATrackSimDataPrepAlg::m_hitFilteringTool
ToolHandle< IFPGATrackSimHitFilteringTool > m_hitFilteringTool
Definition: FPGATrackSimDataPrepAlg.h:76
FPGATrackSimDataPrepAlg::m_spacepointsTool
ToolHandle< FPGATrackSimSpacePointsToolI > m_spacepointsTool
Definition: FPGATrackSimDataPrepAlg.h:78
FPGATrackSimDataPrepAlg::m_doEvtSel
Gaudi::Property< bool > m_doEvtSel
Definition: FPGATrackSimDataPrepAlg.h:90
FPGATrackSimDataPrepAlg::m_spacepoints
std::vector< FPGATrackSimCluster > m_spacepoints
Definition: FPGATrackSimDataPrepAlg.h:105
SG::WriteHandleKey< FPGATrackSimClusterCollection >
FPGATrackSimDataPrepAlg::~FPGATrackSimDataPrepAlg
virtual ~FPGATrackSimDataPrepAlg()=default
FPGATrackSimDataPrepAlg::m_doHitFiltering
Gaudi::Property< bool > m_doHitFiltering
Definition: FPGATrackSimDataPrepAlg.h:86
FPGATrackSimDataPrepAlg::m_FPGAHitUnmappedKey
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitUnmappedKey
Definition: FPGATrackSimDataPrepAlg.h:124
FPGATrackSimClusterCollection.h
FPGATrackSimDataPrepAlg::m_clustering
Gaudi::Property< int > m_clustering
Definition: FPGATrackSimDataPrepAlg.h:87
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPGATrackSimDataPrepAlg::m_inputTruthParticleContainerKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_inputTruthParticleContainerKey
Definition: FPGATrackSimDataPrepAlg.h:126
FPGATrackSimRawToLogicalHitsTool.h
FPGATrackSimDataPrepAlg
Definition: FPGATrackSimDataPrepAlg.h:57
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:40
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:228
FPGATrackSimDataPrepAlg::m_secondInputToolN
Gaudi::Property< int > m_secondInputToolN
Definition: FPGATrackSimDataPrepAlg.h:85
FPGATrackSimDataPrepAlg::m_FPGAClusterKey
SG::WriteHandleKeyArray< FPGATrackSimClusterCollection > m_FPGAClusterKey
Definition: FPGATrackSimDataPrepAlg.h:120
FPGATrackSimDataPrepAlg::m_runOnRDO
Gaudi::Property< bool > m_runOnRDO
Definition: FPGATrackSimDataPrepAlg.h:91
FPGATrackSimDataPrepAlg::m_clusters_original
std::vector< FPGATrackSimCluster > m_clusters_original
Definition: FPGATrackSimDataPrepAlg.h:104
FPGATrackSimDataPrepAlg::m_writeOutputTool
ToolHandle< FPGATrackSimOutputHeaderTool > m_writeOutputTool
Definition: FPGATrackSimDataPrepAlg.h:79
FPGATrackSimHitContainer.h
FPGATrackSimTruthTrackCollection.h
FPGATrackSimSpacePointsToolI.h
Declares an abstract class that implements an interface for spacepoint formation. This class is imple...
FPGATrackSimDataPrepAlg::m_clusteringTool
ToolHandle< FPGATrackSimClusteringToolI > m_clusteringTool
Definition: FPGATrackSimDataPrepAlg.h:77
FPGATrackSimDataPrepAlg::m_preClusterBranch
Gaudi::Property< std::string > m_preClusterBranch
Definition: FPGATrackSimDataPrepAlg.h:94
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
FPGATrackSimDataPrepAlg::m_FPGAHitKey
SG::WriteHandleKeyArray< FPGATrackSimHitCollection > m_FPGAHitKey
Definition: FPGATrackSimDataPrepAlg.h:123
FPGATrackSimDataPrepAlg::m_postClusterBranch
Gaudi::Property< std::string > m_postClusterBranch
Definition: FPGATrackSimDataPrepAlg.h:95
IFPGATrackSimEventSelectionSvc.h
FPGATrackSimDataPrepAlg::m_clusters
std::vector< FPGATrackSimCluster > m_clusters
Definition: FPGATrackSimDataPrepAlg.h:104
FPGATrackSimDataPrepAlg::m_truthLinkContainerKey
SG::WriteHandleKey< xAODTruthParticleLinkVector > m_truthLinkContainerKey
Definition: FPGATrackSimDataPrepAlg.h:127
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:84
FPGATrackSimDataPrepAlg::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimDataPrepAlg.h:80
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:43
FPGATrackSimDataPrepAlg::m_hitInputTool
ToolHandle< IFPGATrackSimEventInputHeaderTool > m_hitInputTool
Definition: FPGATrackSimDataPrepAlg.h:73
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:99
FPGATrackSimDataPrepAlg::m_FPGASpacePointsKey
SG::WriteHandleKeyArray< FPGATrackSimClusterCollection > m_FPGASpacePointsKey
Definition: FPGATrackSimDataPrepAlg.h:122
FPGATrackSimDataPrepAlg::processInputs
StatusCode processInputs(SG::WriteHandle< FPGATrackSimHitCollection > &FPGAHitUnmapped, SG::WriteHandle< FPGATrackSimClusterCollection > &FPGAClusters, SG::WriteHandle< FPGATrackSimClusterCollection > &FPGAClustersFiltered, SG::WriteHandle< FPGATrackSimClusterCollection > &FPGASpacePoints)
Definition: FPGATrackSimDataPrepAlg.cxx:308
FPGATrackSimDataPrepAlg::finalize
virtual StatusCode finalize() override
Definition: FPGATrackSimDataPrepAlg.cxx:377
StoreGateSvc.h
FPGATrackSimDataPrepAlg::m_FPGATruthTrackKey
SG::WriteHandleKey< FPGATrackSimTruthTrackCollection > m_FPGATruthTrackKey
Definition: FPGATrackSimDataPrepAlg.h:129
FPGATrackSimOverlapRemovalTool
Remove (mark) duplicate tracks This tool takes FPGATrackSimTrack as input and mark their status of pa...
Definition: FPGATrackSimOverlapRemovalTool.h:33
ServiceHandle< IFPGATrackSimMappingSvc >