ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimSlicingEngineTool Class Reference

#include <FPGATrackSimSlicingEngineTool.h>

Inheritance diagram for FPGATrackSimSlicingEngineTool:
Collaboration diagram for FPGATrackSimSlicingEngineTool:

Public Member Functions

 FPGATrackSimSlicingEngineTool (const std::string &, const std::string &, const IInterface *)
virtual ~FPGATrackSimSlicingEngineTool ()=default
virtual StatusCode initialize () override
void readLayerMap ()
void sliceHits (const std::vector< std::shared_ptr< const FPGATrackSimHit > > &hits, std::vector< std::shared_ptr< const FPGATrackSimHit > > &firstHits, std::vector< std::shared_ptr< const FPGATrackSimHit > > &secondHits)
void setupSlices (FPGATrackSimLogicalEventInputHeader *slicedFirstPixelHeader, FPGATrackSimLogicalEventInputHeader *slicedSecondPixelHeader, FPGATrackSimLogicalEventInputHeader *slicedStripHeader)
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ServiceHandle< IFPGATrackSimMappingSvcm_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", ""}
Gaudi::Property< bool > m_rootOutput {this, "RootOutput", true, "Wite output ROOT branches"}
Gaudi::Property< std::string > m_layerMap {this, "LayerMap", "", "Binning layer map file, only read if doSecondStage = true."}
Gaudi::Property< bool > m_doSecondStage {this, "doSecondStage", true, "Split hits between first and second stage. If set to false all hits are first stage" }
FPGATrackSimLogicalEventInputHeaderm_slicedFirstPixelHeader = nullptr
FPGATrackSimLogicalEventInputHeaderm_slicedSecondPixelHeader = nullptr
FPGATrackSimLogicalEventInputHeaderm_slicedStripHeader = nullptr
std::set< unsigned > m_layerMapModules
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 22 of file FPGATrackSimSlicingEngineTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ FPGATrackSimSlicingEngineTool()

FPGATrackSimSlicingEngineTool::FPGATrackSimSlicingEngineTool ( const std::string & algname,
const std::string & name,
const IInterface * ifc )

Definition at line 14 of file FPGATrackSimSlicingEngineTool.cxx.

14 :
15 AthAlgTool(algname,name,ifc) {}
AthAlgTool()
Default constructor:

◆ ~FPGATrackSimSlicingEngineTool()

virtual FPGATrackSimSlicingEngineTool::~FPGATrackSimSlicingEngineTool ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode FPGATrackSimSlicingEngineTool::initialize ( )
overridevirtual

Definition at line 18 of file FPGATrackSimSlicingEngineTool.cxx.

19{
20 ATH_MSG_INFO("Reading first stage module/layer map in slicing engine: " << m_layerMap);
22 return StatusCode::SUCCESS;
23}
#define ATH_MSG_INFO(x)
Gaudi::Property< std::string > m_layerMap

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ readLayerMap()

void FPGATrackSimSlicingEngineTool::readLayerMap ( )

Definition at line 25 of file FPGATrackSimSlicingEngineTool.cxx.

25 {
26 // Adapted from FPGATrackSimBinnedHits
27 std::ifstream stream(m_layerMap);
28 nlohmann::json data = nlohmann::json::parse(stream);
29
30 std::set<unsigned> modules;
31
32 // Loop over entries in the layer map.
33 for (const auto &binelem : data) {
34 std::vector<unsigned> bin;
35 binelem.at("bin").get_to(bin);
36 auto& lyrmap = binelem["lyrmap"];
37 ATH_MSG_DEBUG("bin = " << bin);
38 ATH_MSG_DEBUG("lyrmap = " << lyrmap);
39 for (auto &lyrelem : lyrmap) {
40 unsigned layer;
41 lyrelem.at("lyr").get_to(layer);
42 lyrelem.at("mods").get_to(modules);
43 ATH_MSG_DEBUG("layer = " << layer);
44 ATH_MSG_DEBUG("mods = " << modules);
45
46 // Build a single set containing all module ID hashes used in the layer map.
47 // NOTE: this assumes the pixel module hashes are all unique?
48 m_layerMapModules.merge(modules);
49 }
50 }
51
52 ATH_MSG_DEBUG("Region Modules: " << m_layerMapModules);
53}
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
@ layer
Definition HitInfo.h:79

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setupSlices()

void FPGATrackSimSlicingEngineTool::setupSlices ( FPGATrackSimLogicalEventInputHeader * slicedFirstPixelHeader,
FPGATrackSimLogicalEventInputHeader * slicedSecondPixelHeader,
FPGATrackSimLogicalEventInputHeader * slicedStripHeader )
inline

Definition at line 35 of file FPGATrackSimSlicingEngineTool.h.

37 {
38 m_slicedFirstPixelHeader = slicedFirstPixelHeader;
39 m_slicedSecondPixelHeader = slicedSecondPixelHeader;
40 m_slicedStripHeader = slicedStripHeader;
41 };
FPGATrackSimLogicalEventInputHeader * m_slicedSecondPixelHeader
FPGATrackSimLogicalEventInputHeader * m_slicedFirstPixelHeader
FPGATrackSimLogicalEventInputHeader * m_slicedStripHeader

◆ sliceHits()

void FPGATrackSimSlicingEngineTool::sliceHits ( const std::vector< std::shared_ptr< const FPGATrackSimHit > > & hits,
std::vector< std::shared_ptr< const FPGATrackSimHit > > & firstHits,
std::vector< std::shared_ptr< const FPGATrackSimHit > > & secondHits )

Definition at line 57 of file FPGATrackSimSlicingEngineTool.cxx.

59 {
60
61 const FPGATrackSimRegionMap* rmap_1st = m_FPGATrackSimMapping->SubRegionMap();
62 const FPGATrackSimRegionMap* rmap_2nd = m_FPGATrackSimMapping->SubRegionMap_2nd();
63
64 // NOTE: this now assumes that there is ONE "slice" for each of the three configurations (1st pixels,
65 // 2nd pixels, strips). the subregion map is NO LONGER USED.
66 if (m_rootOutput) {
67 FPGATrackSimTowerInputHeader towerFirstPixel = FPGATrackSimTowerInputHeader(0);
68 FPGATrackSimTowerInputHeader towerSecondPixel = FPGATrackSimTowerInputHeader(0);
69 m_slicedFirstPixelHeader->addTower(towerFirstPixel);
70 m_slicedSecondPixelHeader->addTower(towerSecondPixel);
71 }
72
73 // We need to process the strips into a header object no matter what.
74 FPGATrackSimTowerInputHeader towerStrips = FPGATrackSimTowerInputHeader(0);
75 m_slicedStripHeader->addTower(towerStrips);
76
77 // Loop over all of the hits. Test if they pass region boundaries or not.
78 for (const std::shared_ptr<const FPGATrackSimHit>& hit : hits) {
79 // If the hit falls within the boundaries of ANY subregion in the first or second stage,
80 // it's to be considered "IN REGION". Technically the second stage *should* be a superset
81 // of the first stage but let's be redundant to be safe here.
82 if ((rmap_1st->getRegions(*hit).size() == 0) && (rmap_2nd->getRegions(*hit).size() == 0)) {
83 continue;
84 }
85
86 // Test if the remaining hit is strip or pixel, sort accordingly.
87 // If doSecondStage is false, then all hits are first stage-- so don't worry about the layer map.
88 if (hit->isPixel()) {
89 // In this case, test using the layer map (if we are doing second stage).
90 if (!m_doSecondStage || m_layerMapModules.contains(hit->getIdentifierHash())) {
91 firstHits.push_back(hit);
92 if (m_rootOutput) m_slicedFirstPixelHeader->getTower(0)->addHit(*hit);
93 }
94 if (m_doSecondStage) {
95 secondHits.push_back(hit);
96 if (m_rootOutput) m_slicedSecondPixelHeader->getTower(0)->addHit(*hit);
97 }
98 } else {
99 // Strip hits need to be post-processed in LogicalHitsProcessAlg, so we only put them in a header here.
100 // Unfortunately this has to happen no matter what.
101 m_slicedStripHeader->getTower(0)->addHit(*hit);
102 }
103 }
104
105 ATH_MSG_DEBUG("From " << hits.size() << " total input hits, sent " << firstHits.size() << " (" << secondHits.size() << ") to first (second) stage in region");
106}
std::vector< uint32_t > getRegions(const FPGATrackSimHit &hit) const
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doSecondStage

Gaudi::Property<bool> FPGATrackSimSlicingEngineTool::m_doSecondStage {this, "doSecondStage", true, "Split hits between first and second stage. If set to false all hits are first stage" }
private

Definition at line 50 of file FPGATrackSimSlicingEngineTool.h.

50{this, "doSecondStage", true, "Split hits between first and second stage. If set to false all hits are first stage" };

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_FPGATrackSimMapping

ServiceHandle<IFPGATrackSimMappingSvc> FPGATrackSimSlicingEngineTool::m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", ""}
private

Definition at line 46 of file FPGATrackSimSlicingEngineTool.h.

46{this, "FPGATrackSimMappingSvc", ""};

◆ m_layerMap

Gaudi::Property<std::string> FPGATrackSimSlicingEngineTool::m_layerMap {this, "LayerMap", "", "Binning layer map file, only read if doSecondStage = true."}
private

Definition at line 49 of file FPGATrackSimSlicingEngineTool.h.

49{this, "LayerMap", "", "Binning layer map file, only read if doSecondStage = true."};

◆ m_layerMapModules

std::set<unsigned> FPGATrackSimSlicingEngineTool::m_layerMapModules
private

Definition at line 60 of file FPGATrackSimSlicingEngineTool.h.

◆ m_rootOutput

Gaudi::Property<bool> FPGATrackSimSlicingEngineTool::m_rootOutput {this, "RootOutput", true, "Wite output ROOT branches"}
private

Definition at line 48 of file FPGATrackSimSlicingEngineTool.h.

48{this, "RootOutput", true, "Wite output ROOT branches"};

◆ m_slicedFirstPixelHeader

FPGATrackSimLogicalEventInputHeader* FPGATrackSimSlicingEngineTool::m_slicedFirstPixelHeader = nullptr
private

Definition at line 54 of file FPGATrackSimSlicingEngineTool.h.

◆ m_slicedSecondPixelHeader

FPGATrackSimLogicalEventInputHeader* FPGATrackSimSlicingEngineTool::m_slicedSecondPixelHeader = nullptr
private

Definition at line 55 of file FPGATrackSimSlicingEngineTool.h.

◆ m_slicedStripHeader

FPGATrackSimLogicalEventInputHeader* FPGATrackSimSlicingEngineTool::m_slicedStripHeader = nullptr
private

Definition at line 56 of file FPGATrackSimSlicingEngineTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: