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
41
44
51
53class 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(const EventContext& ctx) const override final;
65 virtual StatusCode finalize() override;
66
67 private:
68
69 std::string m_description;
70 mutable std::atomic<unsigned> 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<bool> m_isDataPrepPipeline {this, "isDataPrepPipeline", false, "If True, this is for data prep pipeline only, thus skipping unecessary steps"};
86 Gaudi::Property<int> m_firstInputToolN {this, "FirstInputToolN", 1, "number of times to use event from first input tool"};
87 Gaudi::Property<int> m_secondInputToolN {this, "SecondInputToolN", 0, "number of times to use event from second input tool"};
88 Gaudi::Property<bool> m_doHitFiltering {this, "HitFiltering", false, "flag to enable hit/cluster filtering"};
89 Gaudi::Property<int> m_clustering {this, "Clustering", 0, "int to enable the clustering and say how many times to run it"};
90 Gaudi::Property<bool> m_writeOutputData {this, "writeOutputData", true,"write the output TTree"};
91 Gaudi::Property<bool> m_writePreClusterBranch {this, "writePreClusterBranch", true, "If set to false, never write precluster branches"};
92 // Properties for the output header tool.
93
94 Gaudi::Property<bool> m_doEvtSel {this, "doEvtSel", false, "do event selection"};
95 Gaudi::Property<bool> m_useInternalTruthTracks {this,"useInternalTruthTracks", false, "case when runnin on RDO file (and not or wrapper)"};
96 Gaudi::Property<bool> m_recordHits {this,"recordHits", true, "For F-100 this is not needed"};
97 Gaudi::Property<int> m_writeRegion {this,"writeRegion", -1, "Only output selected region, default is -1 which means not requirement"};
98
99 // Properties for the output header tool.
100 Gaudi::Property<std::string> m_preClusterBranch {this, "preClusterBranch", "LogicalEventInputHeader_PreCluster", "Name of the branch for pre-cluster input data in output ROOT file." };
101 Gaudi::Property<std::string> m_postClusterBranch {this, "postClusterBranch", "LogicalEventInputHeader_PostCluster", "Name of the branch for post-cluster input data in output ROOT file." };
102
103 // ROOT pointers
106
107 // internal counters
108 mutable std::atomic<size_t> m_evt = 0; // number of events passing event selection, independent of truth
109
110 mutable std::atomic<unsigned long> m_nPixClusters = 0; // number of clusters for pix, total
111 mutable std::atomic<unsigned> m_nMaxPixClusters = 0; // max number of pixel clusters in an event
112 mutable std::atomic<unsigned long> m_nStripClusters = 0; // number of clusters for strip, total
113 mutable std::atomic<unsigned> m_nMaxStripClusters = 0; // max number of strip clusters in an event
114 mutable std::atomic<unsigned> m_nMaxClusters = 0; // max number of total clusters in an event
115
116
117 StatusCode readInputs(const EventContext& ctx,
118 FPGATrackSimEventInputHeader& eventHeader,
119 FPGATrackSimEventInputHeader& firstInputHeader,
120 bool& done) const;
121
122 StatusCode processInputs(const FPGATrackSimEventInputHeader& eventHeader,
123 FPGATrackSimLogicalEventInputHeader& logicEventHeader,
124 FPGATrackSimLogicalEventInputHeader& logicEventHeader_precluster,
125 std::vector<FPGATrackSimHit>& hits_miss,
129
130 ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool", "", "Monitoring tool"};
131
132 // NOTE: the clusters collection(s) contain ALL Clusters, not just "first stage" clusters.
133 SG::WriteHandleKeyArray<FPGATrackSimClusterCollection> m_FPGAClusterKey{this, "FPGATrackSimClusterKey",{"FPGAClusters_1st"},"FPGATrackSim Clusters key"};
134 SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitKey{this, "FPGATrackSimHitKey","FPGAHits", "FPGATrackSim Hits key"};
135 SG::WriteHandleKey<FPGATrackSimHitCollection> m_FPGAHitUnmappedKey{this, "FPGATrackSimHitUnmappedKey","FPGAHitsUnmapped_1st","FPGATrackSim Unmapped Hits 1st stage key"};
136
137 SG::ReadHandleKey<xAOD::TruthParticleContainer> m_inputTruthParticleContainerKey{this, "TruthTrackContainer", "TruthParticles", "Truth Particle Container"};
138 SG::WriteHandleKey<xAODTruthParticleLinkVector> m_truthLinkContainerKey{this, "TruthLinks", "xAODFPGATruthLinks", "Output EF xAODTruthLinks container"};
139
140 SG::WriteHandleKey<FPGATrackSimTruthTrackCollection> m_FPGATruthTrackKey {this, "FPGATrackSimTruthTrackKey", "FPGATruthTracks", "FPGATrackSim truth tracks"};
141 SG::WriteHandleKey<FPGATrackSimOfflineTrackCollection> m_FPGAOfflineTrackKey {this, "FPGATrackSimOfflineTrackKey", "FPGAOfflineTracks", "FPGATrackSim offline tracks"};
142 SG::WriteHandleKey<FPGATrackSimEventInfo> m_FPGAEventInfoKey{this, "FPGATrackSimEventInfoKey", "FPGAEventInfo", "FPGATrackSim event info"};
143
144 mutable std::mutex m_rootWriteMutex; // Protect ROOT writes in const execute()
145
146};
147
148
149#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< FPGATrackSimHit > &hits_miss, FPGATrackSimClusterCollection &clusters, SG::WriteHandle< FPGATrackSimHitCollection > &FPGAHitUnmapped, SG::WriteHandle< FPGATrackSimClusterCollection > &FPGAClusters) const
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
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitKey
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