ATLAS Offline Software
Loading...
Searching...
No Matches
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
40
43
50
52class 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(const EventContext& ctx) const override final;
64 virtual StatusCode finalize() override;
65
66 private:
67
68 std::string m_description;
69 mutable std::atomic<unsigned> 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 ToolHandleArray<FPGATrackSimRawToLogicalHitsTool> m_hitMapTools {this, "RawToLogicalHitsTools", {}, "Raw To Logical Tools"};
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<FPGATrackSimOutputHeaderTool> m_writeOutputTool {this, "OutputTool", "FPGATrackSimOutputHeaderTool/FPGATrackSimOutputHeaderTool", "Output tool"};
79 ToolHandleArray<FPGATrackSim::FPGATrackSimEventSelectionTool> m_eventSelectionTools {this, "eventSelectors", {}, "Event selection Tools"};
80 // chrono service
81 ServiceHandle<IChronoStatSvc> m_chrono{this,"ChronoStatSvc","ChronoStatSvc"};
82
83 // Flags
84 Gaudi::Property<bool> m_isDataPrepPipeline {this, "isDataPrepPipeline", false, "If True, this is for data prep pipeline only, thus skipping unecessary steps"};
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_writePreClusterBranch {this, "writePreClusterBranch", true, "If set to false, never write precluster branches"};
91 // Properties for the output header tool.
92
93 Gaudi::Property<bool> m_doEvtSel {this, "doEvtSel", false, "do event selection"};
94 Gaudi::Property<bool> m_useInternalTruthTracks {this,"useInternalTruthTracks", false, "case when runnin on RDO file (and not or wrapper)"};
95 Gaudi::Property<bool> m_recordHits {this,"recordHits", true, "For F-100 this is not needed"};
96 Gaudi::Property<int> m_writeRegion {this,"writeRegion", -1, "Only output selected region, default is -1 which means not requirement"};
97
98 // Properties for the output header tool.
99 Gaudi::Property<std::string> m_preClusterBranch {this, "preClusterBranch", "LogicalEventInputHeader_PreCluster", "Name of the branch for pre-cluster input data in output ROOT file." };
100 Gaudi::Property<std::string> m_postClusterBranch {this, "postClusterBranch", "LogicalEventInputHeader_PostCluster", "Name of the branch for post-cluster input data in output ROOT file." };
101
102 // ROOT pointers
105
106 // internal counters
107 mutable std::atomic<size_t> m_evt = 0; // number of events passing event selection, independent of truth
108
109 mutable std::atomic<unsigned long> m_nPixClusters = 0; // number of clusters for pix, total
110 mutable std::atomic<unsigned> m_nMaxPixClusters = 0; // max number of pixel clusters in an event
111 mutable std::atomic<unsigned long> m_nStripClusters = 0; // number of clusters for strip, total
112 mutable std::atomic<unsigned> m_nMaxStripClusters = 0; // max number of strip clusters in an event
113 mutable std::atomic<unsigned> m_nMaxClusters = 0; // max number of total clusters in an event
114
115
116 StatusCode readInputs(const EventContext& ctx,
117 FPGATrackSimEventInputHeader& eventHeader,
118 FPGATrackSimEventInputHeader& firstInputHeader,
119 bool& done) const;
120
121 StatusCode processInputs(const FPGATrackSimEventInputHeader& eventHeader,
122 FPGATrackSimLogicalEventInputHeader& logicEventHeader,
123 FPGATrackSimLogicalEventInputHeader& logicEventHeader_precluster,
124 std::vector<std::unique_ptr<FPGATrackSimHit>>& hits_miss,
128
129 ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"};
130
131 // NOTE: the clusters collection(s) contain ALL Clusters, not just "first stage" clusters.
132 SG::WriteHandleKeyArray<FPGATrackSimClusterCollection> m_FPGAClusterKey{this, "FPGATrackSimClusterKey",{"FPGAClusters_1st"},"FPGATrackSim Clusters key"};
133 SG::WriteHandleKey<ConstDataVector<FPGATrackSimHitCollection>> m_FPGAHitKey{this, "FPGATrackSimHitKey","FPGAHits", "FPGATrackSim Hits key"};
134 SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitUnmappedKey{this, "FPGATrackSimHitUnmappedKey","FPGAHitsUnmapped_1st","FPGATrackSim Unmapped Hits 1st stage key"};
135
136 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_inputTruthParticleContainerKey{this, "TruthTrackContainer", "TruthParticles", "Truth Particle Container"};
137 SG::WriteHandleKey<xAODTruthParticleLinkVector> m_truthLinkContainerKey{this, "TruthLinks", "xAODFPGATruthLinks", "Output EF xAODTruthLinks container"};
138
139 SG::WriteHandleKey<FPGATrackSimTruthTrackCollection> m_FPGATruthTrackKey {this, "FPGATrackSimTruthTrackKey", "FPGATruthTracks", "FPGATrackSim truth tracks"};
140 SG::WriteHandleKey<FPGATrackSimOfflineTrackCollection> m_FPGAOfflineTrackKey {this, "FPGATrackSimOfflineTrackKey", "FPGAOfflineTracks", "FPGATrackSim offline tracks"};
141 SG::WriteHandleKey<FPGATrackSimEventInfo> m_FPGAEventInfoKey{this, "FPGATrackSimEventInfoKey", "FPGAEventInfo", "FPGATrackSim event info"};
142
143 mutable std::mutex m_rootWriteMutex; // Protect ROOT writes in const execute()
144
145};
146
147
148#endif // FPGATrackSimLOGICALHITSTOALGORITHMS_h
std::vector< FPGATrackSimCluster > FPGATrackSimClusterCollection
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.
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....
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.
An algorithm that can be simultaneously executed in multiple threads.
ToolHandleArray< FPGATrackSimRawToLogicalHitsTool > m_hitMapTools
SG::WriteHandleKey< FPGATrackSimOfflineTrackCollection > m_FPGAOfflineTrackKey
virtual StatusCode execute(const EventContext &ctx) const override final
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitUnmappedKey
Gaudi::Property< std::string > m_preClusterBranch
Gaudi::Property< bool > m_isDataPrepPipeline
Gaudi::Property< std::string > m_postClusterBranch
virtual StatusCode finalize() override
virtual ~FPGATrackSimDataPrepAlg()=default
Gaudi::Property< bool > m_doEvtSel
SG::WriteHandleKey< FPGATrackSimTruthTrackCollection > m_FPGATruthTrackKey
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader_precluster
ToolHandle< IFPGATrackSimInputTool > m_hitSGInputTool
Gaudi::Property< int > m_firstInputToolN
ToolHandle< FPGATrackSimOutputHeaderTool > m_writeOutputTool
StatusCode processInputs(const FPGATrackSimEventInputHeader &eventHeader, FPGATrackSimLogicalEventInputHeader &logicEventHeader, FPGATrackSimLogicalEventInputHeader &logicEventHeader_precluster, std::vector< std::unique_ptr< FPGATrackSimHit > > &hits_miss, FPGATrackSimClusterCollection &clusters, SG::WriteHandle< FPGATrackSimHitCollection > &FPGAHitUnmapped, SG::WriteHandle< FPGATrackSimClusterCollection > &FPGAClusters) const
SG::WriteHandleKey< ConstDataVector< FPGATrackSimHitCollection > > m_FPGAHitKey
virtual StatusCode initialize() override
Gaudi::Property< int > m_secondInputToolN
std::atomic< unsigned > m_nMaxStripClusters
ToolHandleArray< FPGATrackSim::FPGATrackSimEventSelectionTool > m_eventSelectionTools
std::atomic< unsigned > m_nMaxClusters
ToolHandle< FPGATrackSimReadRawRandomHitsTool > m_hitInputTool2
Gaudi::Property< bool > m_writePreClusterBranch
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_inputTruthParticleContainerKey
ToolHandle< GenericMonitoringTool > m_monTool
Gaudi::Property< bool > m_useInternalTruthTracks
std::atomic< unsigned long > m_nPixClusters
ToolHandle< IFPGATrackSimEventInputHeaderTool > m_hitInputTool
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader
std::atomic< unsigned > m_nMaxPixClusters
Gaudi::Property< int > m_writeRegion
Gaudi::Property< int > m_clustering
std::atomic< unsigned long > m_nStripClusters
SG::WriteHandleKey< FPGATrackSimEventInfo > m_FPGAEventInfoKey
Gaudi::Property< bool > m_writeOutputData
SG::WriteHandleKeyArray< FPGATrackSimClusterCollection > m_FPGAClusterKey
ServiceHandle< IChronoStatSvc > m_chrono
ToolHandle< FPGATrackSimClusteringToolI > m_clusteringTool
FPGATrackSimDataPrepAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_doHitFiltering
Gaudi::Property< bool > m_recordHits
std::atomic< unsigned > m_ev
ToolHandle< IFPGATrackSimHitFilteringTool > m_hitFilteringTool
SG::WriteHandleKey< xAODTruthParticleLinkVector > m_truthLinkContainerKey
StatusCode readInputs(const EventContext &ctx, FPGATrackSimEventInputHeader &eventHeader, FPGATrackSimEventInputHeader &firstInputHeader, bool &done) const
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.
HandleKeyArray< WriteHandle< T >, WriteHandleKey< T >, Gaudi::DataHandle::Writer > WriteHandleKeyArray