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

#include <FPGATrackSimDetectorTool.h>

Inheritance diagram for FPGATrackSimDetectorTool:
Collaboration diagram for FPGATrackSimDetectorTool:

Public Member Functions

 FPGATrackSimDetectorTool (const std::string &, const std::string &, const IInterface *)
virtual ~FPGATrackSimDetectorTool ()=default
virtual StatusCode initialize () override
void dumpGlobalToLocalModuleMap ()
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", "FPGATrackSimMappingSvc"}
Gaudi::Property< std::string > m_global2local_path {this,"GlobalToLocalMapPath", "global-to-local-map.moduleidmap"}
Gaudi::Property< std::string > m_sram_path_pix {this, "SRAMPathPixel", "sram_lookup_pixel.txt"}
Gaudi::Property< std::string > m_sram_path_sct {this, "SRAMPathSCT", "sram_lookup_sct.txt"}
Gaudi::Property< bool > m_dumpAllModules {this, "dumpAllModules", false}
const InDetDD::SiDetectorManagerm_PIX_mgr = nullptr
const PixelIDm_pixelId = nullptr
const SCT_IDm_sctId = nullptr
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 33 of file FPGATrackSimDetectorTool.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

◆ FPGATrackSimDetectorTool()

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

Definition at line 14 of file FPGATrackSimDetectorTool.cxx.

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

◆ ~FPGATrackSimDetectorTool()

virtual FPGATrackSimDetectorTool::~FPGATrackSimDetectorTool ( )
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.

◆ dumpGlobalToLocalModuleMap()

void FPGATrackSimDetectorTool::dumpGlobalToLocalModuleMap ( )

Definition at line 33 of file FPGATrackSimDetectorTool.cxx.

33 {
34 /* All the modules are collected as FPGATrackSimHit, allowing to interact efficiently
35 * with FPGATrackSim elements as PMAP or RMAP
36 */
37 std::list<FPGATrackSimHit> CompleteIDModuleList;
38
39 // To save the SRAM lookup into an output file
40 std::ofstream fout_pix(m_sram_path_pix);
41 std::ofstream fout_sct(m_sram_path_sct);
42 Int_t countForSRAM(0);
43
44 for( InDetDD::SiDetectorElementCollection::const_iterator i=m_PIX_mgr->getDetectorElementBegin(), f=m_PIX_mgr->getDetectorElementEnd() ; i!=f; ++i ) {
45 const InDetDD::SiDetectorElement* sielement( *i );
46 Identifier id = sielement->identify();
47 IdentifierHash idhash = sielement->identifyHash();
48
49 FPGATrackSimHit tmpmodraw;
50
53 tmpmodraw.setDetectorZone(static_cast<DetectorZone>(m_pixelId->barrel_ec(id)));
54 tmpmodraw.setLayerDisk(m_pixelId->layer_disk(id));
55 tmpmodraw.setPhiModule(m_pixelId->phi_module(id));
56 tmpmodraw.setEtaModule(m_pixelId->eta_module(id));
57 tmpmodraw.setPhiIndex(m_pixelId->phi_index(id));
58 tmpmodraw.setEtaIndex(m_pixelId->eta_index(id));
59 tmpmodraw.setIdentifierHash(idhash);
60
61 fout_pix << m_pixelId->barrel_ec(id) << "\t" << m_pixelId->layer_disk(id) << "\t" << m_pixelId->phi_module(id) << "\t" << m_pixelId->eta_module(id) << "\t" << countForSRAM << std::endl;
62 countForSRAM++;
63
64 CompleteIDModuleList.push_back(tmpmodraw);
65 }
66
67 countForSRAM = 0;
68
69 SCT_ID::const_id_iterator wafer_it = m_sctId->wafer_begin();
70 SCT_ID::const_id_iterator wafer_end = m_sctId->wafer_end();
71 for (; wafer_it!=wafer_end; ++wafer_it) {
72 const Identifier id = *wafer_it;
73 const IdentifierHash idhash = m_sctId->wafer_hash(id);
74
75 FPGATrackSimHit tmpmodraw;
76
79 tmpmodraw.setDetectorZone(static_cast<DetectorZone>(m_sctId->barrel_ec(id)));
80 tmpmodraw.setLayerDisk(m_sctId->layer_disk(id));
81 tmpmodraw.setPhiModule(m_sctId->phi_module(id));
82 tmpmodraw.setEtaModule(m_sctId->eta_module(id));
83 tmpmodraw.setPhiIndex(m_sctId->side(id));
84 tmpmodraw.setEtaIndex(m_sctId->strip(id));
85 tmpmodraw.setIdentifierHash(idhash);
86
87 fout_sct << m_sctId->barrel_ec(id) << "\t" << m_sctId->layer_disk(id) << "\t" << m_sctId->phi_module(id) << "\t" << m_sctId->eta_module(id) << "\t" << countForSRAM << std::endl;
88 countForSRAM++;
89
90 CompleteIDModuleList.push_back(tmpmodraw);
91 }
92
93
94
95 /* The modules are store by tower and by logical layer */
96 unsigned int nregions(m_FPGATrackSimMapping->RegionMap_2nd()->getNRegions()); // get the number of towers
97 unsigned int nplanes(m_FPGATrackSimMapping->PlaneMap_2nd(0)->getNLogiLayers());
98 std::set<unsigned int> **grouped_modules = new std::set<unsigned int>*[nregions];
99 for (unsigned int ireg=0;ireg!=nregions;++ireg) grouped_modules[ireg] = new std::set<unsigned int>[nplanes];
100
101 for (auto& curmodrawhit: CompleteIDModuleList) { // loop over the modules, represente as raw hits
102 // verify if accoring the current pmap this is module that has to be mapped
103
104 // convert the FPGATrackSimHit representation in FPGATrackSimHit to interact with the PMAP
105 m_FPGATrackSimMapping->PlaneMap_2nd(0)->map(curmodrawhit);
106
107 bool hasOneRegion(false); // it will become true if at least 1 tower is associated with the module
108 for (unsigned int ireg=0;ireg!=nregions;++ireg) { // loop over the regions
109 if (m_FPGATrackSimMapping->RegionMap_2nd()->isInRegion(ireg,curmodrawhit)) {
110 hasOneRegion = true;
111 // the module is compatible with the current
112 grouped_modules[ireg][curmodrawhit.getLayer()].insert(curmodrawhit.getIdentifierHash());
113 }
114 } // end loop over the regions
115
116 if (!hasOneRegion) ATH_MSG_WARNING ( "The module with hash " << curmodrawhit.getIdentifierHash() << " and FPGATrackSim ID (" << curmodrawhit.getLayer() << "," << curmodrawhit.getSection() << ") is not associated to a tower");
117 } // end loop over the modules
118
119 // Save the map into the output file and print at screen a small message
120 std::ofstream fout(m_global2local_path.value().c_str());
121 for (unsigned int ireg=0;ireg!=nregions;++ireg) { // loop over the regions
122 for (unsigned int ip=0;ip!=nplanes;++ip) { // loop over the regions
123 ATH_MSG_DEBUG ( "Region " << ireg << ", layer" << ip << " has " << grouped_modules[ireg][ip].size() << " modules");
124 unsigned int modnumber(0);
125 for (const auto &curhash: grouped_modules[ireg][ip]) {
126 fout << ireg << '\t' << ip << '\t' << curhash << '\t' << modnumber++ << std::endl;
127 }
128 }
129 }
130 fout.close();
131
132 // Close SRAM lookup tables
133 fout_pix.close();
134 fout_sct.close();
135
136 // clear the memory
137 for (unsigned int ireg=0;ireg!=nregions;++ireg) delete [] grouped_modules[ireg];
138 delete [] grouped_modules;
139}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
DetectorZone
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
Gaudi::Property< std::string > m_sram_path_pix
Gaudi::Property< std::string > m_sram_path_sct
const InDetDD::SiDetectorManager * m_PIX_mgr
Gaudi::Property< std::string > m_global2local_path
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
void setPhiModule(unsigned v)
void setIdentifierHash(unsigned v)
void setEtaIndex(unsigned v)
void setPhiIndex(unsigned v)
void setHitType(HitType type)
void setLayerDisk(unsigned v)
void setEtaModule(int v)
void setDetectorZone(DetectorZone detZone)
void setDetType(SiliconTech detType)
std::vector< Identifier >::const_iterator const_id_iterator
Definition SCT_ID.h:73
static TFile * fout
Definition listroot.cxx:40

◆ 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 FPGATrackSimDetectorTool::initialize ( )
overridevirtual

Definition at line 19 of file FPGATrackSimDetectorTool.cxx.

19 {
20 ATH_CHECK( detStore()->retrieve(m_PIX_mgr, "Pixel"));
21 ATH_CHECK( detStore()->retrieve(m_pixelId, "PixelID") );
22 ATH_CHECK( detStore()->retrieve(m_sctId, "SCT_ID") );
23 ATH_CHECK( m_FPGATrackSimMapping.retrieve() ) ;
24 return StatusCode::SUCCESS;
25}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ 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.

◆ 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 }

◆ 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_dumpAllModules

Gaudi::Property<bool> FPGATrackSimDetectorTool::m_dumpAllModules {this, "dumpAllModules", false}
private

Definition at line 46 of file FPGATrackSimDetectorTool.h.

46{this, "dumpAllModules", false};

◆ 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> FPGATrackSimDetectorTool::m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}
private

Definition at line 42 of file FPGATrackSimDetectorTool.h.

42{this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"};

◆ m_global2local_path

Gaudi::Property<std::string> FPGATrackSimDetectorTool::m_global2local_path {this,"GlobalToLocalMapPath", "global-to-local-map.moduleidmap"}
private

Definition at line 43 of file FPGATrackSimDetectorTool.h.

43{this,"GlobalToLocalMapPath", "global-to-local-map.moduleidmap"};

◆ m_PIX_mgr

const InDetDD::SiDetectorManager* FPGATrackSimDetectorTool::m_PIX_mgr = nullptr
private

Definition at line 49 of file FPGATrackSimDetectorTool.h.

◆ m_pixelId

const PixelID* FPGATrackSimDetectorTool::m_pixelId = nullptr
private

Definition at line 50 of file FPGATrackSimDetectorTool.h.

◆ m_sctId

const SCT_ID* FPGATrackSimDetectorTool::m_sctId = nullptr
private

Definition at line 51 of file FPGATrackSimDetectorTool.h.

◆ m_sram_path_pix

Gaudi::Property<std::string> FPGATrackSimDetectorTool::m_sram_path_pix {this, "SRAMPathPixel", "sram_lookup_pixel.txt"}
private

Definition at line 44 of file FPGATrackSimDetectorTool.h.

44{this, "SRAMPathPixel", "sram_lookup_pixel.txt"};

◆ m_sram_path_sct

Gaudi::Property<std::string> FPGATrackSimDetectorTool::m_sram_path_sct {this, "SRAMPathSCT", "sram_lookup_sct.txt"}
private

Definition at line 45 of file FPGATrackSimDetectorTool.h.

45{this, "SRAMPathSCT", "sram_lookup_sct.txt"};

◆ 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: