 |
ATLAS Offline Software
|
Go to the documentation of this file.
24 #include "GaudiKernel/IEventProcessor.h"
28 #ifdef BENCHMARK_FPGATRACKSIM
49 while (std::getline(
ss,
line,
'\n')) {
89 return StatusCode::SUCCESS;
99 const EventContext& ctx = getContext();
106 SmartIF<IEventProcessor> appMgr{service(
"ApplicationMgr")};
108 ATH_MSG_ERROR(
"Failed to retrieve ApplicationMgr as IEventProcessor");
109 return StatusCode::FAILURE;
111 return appMgr->stopRun();
115 ATH_CHECK( FPGAHits.
record (std::make_unique<FPGATrackSimHitCollection>()));
118 ATH_CHECK( FPGAHitUnmapped.
record (std::make_unique<FPGATrackSimHitCollection>()));
121 ATH_CHECK( FPGAClusters.
record (std::make_unique<FPGATrackSimClusterCollection>()));
124 ATH_CHECK(truthLinkVec.
record(std::make_unique<xAODTruthParticleLinkVector>()));
127 ATH_CHECK(FPGATruthTracks.
record(std::make_unique<FPGATrackSimTruthTrackCollection>()));
130 ATH_CHECK(FPGAOfflineTracks.
record(std::make_unique<FPGATrackSimOfflineTrackCollection>()));
133 bool acceptEvent =
false;
146 if (!truthParticleContainer.
isValid()) {
147 ATH_MSG_ERROR(
"No valid truth particle container with key " << truthParticleContainer.
key());
148 return StatusCode::FAILURE;
151 std::unordered_map<HepMcParticleLink::barcode_type, std::pair<const xAOD::TruthParticle*, size_t>> truthParticlesMap;
152 size_t truthParticleIndex = 0;
154 truthParticlesMap.insert(std::make_pair(
HepMC::uniqueID(truthParticle), std::make_pair(truthParticle,truthParticleIndex)));
155 truthParticleIndex++;
158 truthLinkVec->
reserve(fpgaTruthTracks.size());
159 ATH_MSG_DEBUG(
"begin truth matching for " << fpgaTruthTracks.size() <<
" FPGA truth tracks");
161 auto it = truthParticlesMap.find(fpgaTruthTrack.getUniqueID());
162 if (
it != truthParticlesMap.end()) {
170 if (truthLinkVec->
empty()) {
171 ATH_MSG_DEBUG(
"No truth particles selected. Skipping event...");
172 return StatusCode::SUCCESS;
194 FPGATruthTracks->push_back(truthtrack);
199 FPGAOfflineTracks->push_back(offlineTrack);
220 FPGAHits->reserve(
hits.size());
221 for (
const auto& hit :
hits) {
222 if (hit.isReal()) FPGAHits->push_back(hit);
244 return StatusCode::SUCCESS;
259 return StatusCode::SUCCESS;
268 ATH_MSG_DEBUG(
"Cannot read more events from file, returning");
269 return StatusCode::SUCCESS;
281 ATH_MSG_INFO(
"Cannot read more events from file, returning");
282 return StatusCode::SUCCESS;
288 return StatusCode::SUCCESS;
325 unsigned npix(0), nstrip(0);
327 if (cluster.getClusterEquiv().isPixel()) npix++;
336 FPGAClusters->insert(
343 return StatusCode::SUCCESS;
351 ATH_MSG_INFO(
"PRINTING FPGATRACKSIM SIMPLE DATAPREP STATS");
352 ATH_MSG_INFO(
"========================================================================================");
359 return StatusCode::SUCCESS;
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
StatusCode readInputs(bool &done)
ServiceHandle< IChronoStatSvc > m_chrono
Gaudi::Property< bool > m_recordHits
ToolHandle< GenericMonitoringTool > m_monTool
Group
Properties of a chain group.
ToolHandle< IFPGATrackSimInputTool > m_hitSGInputTool
const std::vector< FPGATrackSimOfflineTrack > & getOfflineTracks() const
Stores slice definitions for FPGATrackSim regions.
ToolHandle< FPGATrackSimReadRawRandomHitsTool > m_hitInputTool2
unsigned m_nMaxStripClusters
virtual StatusCode initialize() override
FPGATrackSimEventInputHeader m_eventHeader
virtual StatusCode execute() override
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader_precluster
Gaudi::Property< bool > m_useInternalTruthTracks
FPGATrackSimLogicalEventInputHeader * m_logicEventHeader
ToolHandleArray< FPGATrackSimRawToLogicalHitsTool > m_hitMapTools
SG::WriteHandleKey< FPGATrackSimEventInfo > m_FPGAEventInfoKey
std::string m_description
SG::WriteHandleKey< FPGATrackSimOfflineTrackCollection > m_FPGAOfflineTrackKey
const std::vector< FPGATrackSimTruthTrack > & getTruthTracks() const
Maps ITK module indices to FPGATrackSim regions.
unsigned long m_nStripClusters
Gaudi::Property< bool > m_writeOutputData
ToolHandle< IFPGATrackSimHitFilteringTool > m_hitFilteringTool
Gaudi::Property< bool > m_doEvtSel
a link optimized in size for a GenParticle in a McEventCollection
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitKey
unsigned m_nMaxPixClusters
Gaudi::Property< bool > m_doHitFiltering
SG::WriteHandleKey< FPGATrackSimHitCollection > m_FPGAHitUnmappedKey
Gaudi::Property< int > m_clustering
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_inputTruthParticleContainerKey
Class describing a truth particle in the MC record.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ElementLink implementation for ROOT usage.
Gaudi::Property< int > m_secondInputToolN
SG::WriteHandleKeyArray< FPGATrackSimClusterCollection > m_FPGAClusterKey
: FPGATrackSim-specific class to represent an hit in the detector.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ToolHandle< FPGATrackSimOutputHeaderTool > m_writeOutputTool
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
ToolHandle< FPGATrackSimClusteringToolI > m_clusteringTool
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Gaudi::Property< std::string > m_preClusterBranch
StatusCode processInputs(SG::WriteHandle< FPGATrackSimHitCollection > &FPGAHitUnmapped, SG::WriteHandle< FPGATrackSimClusterCollection > &FPGAClusters)
Gaudi::Property< std::string > m_postClusterBranch
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std::unique_ptr< FPGATrackSimClusterCollection > m_clusters
SG::WriteHandleKey< xAODTruthParticleLinkVector > m_truthLinkContainerKey
Gaudi::Property< int > m_firstInputToolN
std::pair< HepMcParticleLink, ElementLink< xAOD::TruthParticleContainer > > xAODTruthParticleLink
std::vector< FPGATrackSimHit > m_hits_miss
FPGATrackSimDataPrepAlg(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandleArray< FPGATrackSim::FPGATrackSimEventSelectionTool > m_eventSelectionTools
constexpr bool enableBenchmark
ToolHandle< IFPGATrackSimEventInputHeaderTool > m_hitInputTool
Defines a class for roads.
Declare a monitored scalar variable.
FPGATrackSimEventInputHeader m_firstInputHeader
virtual StatusCode finalize() override
SG::WriteHandleKey< FPGATrackSimTruthTrackCollection > m_FPGATruthTrackKey
std::vector< FPGATrackSimTruthTrack > FPGATrackSimTruthTrackCollection
bool empty() const noexcept
Returns true if the collection is empty.
Structs that store the 5 track parameters.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
unsigned long m_nPixClusters