 |
ATLAS Offline Software
|
Go to the documentation of this file.
26 #include "GaudiKernel/IEventProcessor.h"
30 #ifdef BENCHMARK_FPGATRACKSIM
51 while (std::getline(
ss,
line,
'\n')) {
57 const std::vector<Gaudi::Details::PropertyBase*> props = this->getProperties();
58 for( Gaudi::Details::PropertyBase* prop : props ) {
59 if (prop->ownerTypeName()==this->type()) {
60 ATH_MSG_DEBUG(
"Property:\t" << prop->name() <<
"\t : \t" << prop->toString());
99 return StatusCode::SUCCESS;
109 const EventContext& ctx = getContext();
116 SmartIF<IEventProcessor> appMgr{service(
"ApplicationMgr")};
118 ATH_MSG_ERROR(
"Failed to retrieve ApplicationMgr as IEventProcessor");
119 return StatusCode::FAILURE;
121 return appMgr->stopRun();
125 ATH_CHECK( FPGAHits.
record (std::make_unique<FPGATrackSimHitCollection>()));
128 ATH_CHECK( FPGAHitUnmapped.
record (std::make_unique<FPGATrackSimHitCollection>()));
131 ATH_CHECK( FPGAClusters.
record (std::make_unique<FPGATrackSimClusterCollection>()));
134 ATH_CHECK(truthLinkVec.
record(std::make_unique<xAODTruthParticleLinkVector>()));
137 ATH_CHECK(FPGATruthTracks.
record(std::make_unique<FPGATrackSimTruthTrackCollection>()));
140 ATH_CHECK(FPGAOfflineTracks.
record(std::make_unique<FPGATrackSimOfflineTrackCollection>()));
143 bool acceptEvent =
false;
159 if (!truthParticleContainer.
isValid()) {
160 ATH_MSG_ERROR(
"No valid truth particle container with key " << truthParticleContainer.
key());
161 return StatusCode::FAILURE;
164 std::unordered_map<HepMcParticleLink::barcode_type, std::pair<const xAOD::TruthParticle*, size_t>> truthParticlesMap;
165 size_t truthParticleIndex = 0;
167 truthParticlesMap.insert(std::make_pair(
HepMC::uniqueID(truthParticle), std::make_pair(truthParticle,truthParticleIndex)));
168 truthParticleIndex++;
171 truthLinkVec->
reserve(fpgaTruthTracks.size());
172 ATH_MSG_DEBUG(
"begin truth matching for " << fpgaTruthTracks.size() <<
" FPGA truth tracks");
174 auto it = truthParticlesMap.find(fpgaTruthTrack.getUniqueID());
175 if (
it != truthParticlesMap.end()) {
183 if (truthLinkVec->
empty()) {
184 ATH_MSG_DEBUG(
"No truth particles selected. Skipping event...");
185 return StatusCode::SUCCESS;
207 FPGATruthTracks->push_back(truthtrack);
212 FPGAOfflineTracks->push_back(offlineTrack);
233 FPGAHits->reserve(
hits.size());
234 for (
const auto& hit :
hits) {
235 if (hit.isReal()) FPGAHits->push_back(hit);
257 return StatusCode::SUCCESS;
272 return StatusCode::SUCCESS;
281 ATH_MSG_DEBUG(
"Cannot read more events from file, returning");
282 return StatusCode::SUCCESS;
294 ATH_MSG_INFO(
"Cannot read more events from file, returning");
295 return StatusCode::SUCCESS;
301 return StatusCode::SUCCESS;
338 unsigned npix(0), nstrip(0);
340 if (cluster.getClusterEquiv().isPixel()) npix++;
349 FPGAClusters->insert(
356 return StatusCode::SUCCESS;
364 ATH_MSG_INFO(
"PRINTING FPGATRACKSIM SIMPLE DATAPREP STATS");
365 ATH_MSG_INFO(
"========================================================================================");
372 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
Gaudi::Property< bool > m_writePreClusterBranch
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.
Gaudi::Property< int > m_writeRegion
unsigned long m_nPixClusters