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

TileCal RoI map to offline Identifier. More...

#include <TileRoI_Map.h>

Inheritance diagram for TileRoI_Map:

Classes

class  EtaPhiRegion

Public Types

typedef Identifier TT_ID
typedef int COLL_ID

Public Member Functions

 TileRoI_Map (const std::string &type, const std::string &name, const IInterface *parent)
 constructor
StatusCode initialize ()
 define a RoI identifier type, two ints.
virtual ~TileRoI_Map ()
TT_ID TrigTowerID (const Identifier &id) const
 return TrigTowerID for various queries.
TT_ID TrigTowerID (const HWIdentifier &id) const
const std::vector< COLL_ID > & CollectionID (const TT_ID &id) const
 reserve lookup.
bool validId (const TT_ID &tt_id) const
 check validity
bool getEtaPhiRegion (unsigned int hashid, float &etamin, float &etamax, float &phimin, float &phimax) const
 returns Eta-Phi Region for a hashed ID of the Collection.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool InterfaceID.

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 std::map< Identifier, TT_IDOFFMAP
 Map for offline ID and online id.
typedef std::map< HWIdentifier, TT_IDONLMAP
typedef std::vector< COLL_IDCOLL_ID_VEC
typedef std::map< TT_ID, COLL_ID_VECROIMAP
typedef std::map< int, EtaPhiRegionE_P_MAP
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

bool addEntry (const HWIdentifier &adc_hwid)
void printEtaPhiRegions ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

OFFMAP m_offmap
ONLMAP m_onlmap
ROIMAP m_roimap
E_P_MAP m_epmap
const TileIDm_tileID {nullptr}
const TileHWIDm_tileHWID {nullptr}
const TileDetDescrManagerm_tileMgr {nullptr}
const TileCablingServicem_cablingSvc {nullptr}
TileFragHash m_idhash
Gaudi::Property< bool > m_print {this, "Print", false}
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

TileCal RoI map to offline Identifier.

Author
Alexandre Solodkov
Version
00-00-01 , 26/08/2002

Definition at line 32 of file TileRoI_Map.h.

Member Typedef Documentation

◆ COLL_ID

typedef int TileRoI_Map::COLL_ID

Definition at line 47 of file TileRoI_Map.h.

◆ COLL_ID_VEC

typedef std::vector<COLL_ID> TileRoI_Map::COLL_ID_VEC
private

Definition at line 113 of file TileRoI_Map.h.

◆ E_P_MAP

typedef std::map<int, EtaPhiRegion > TileRoI_Map::E_P_MAP
private

Definition at line 116 of file TileRoI_Map.h.

◆ OFFMAP

typedef std::map<Identifier, TT_ID> TileRoI_Map::OFFMAP
private

Map for offline ID and online id.

Definition at line 111 of file TileRoI_Map.h.

◆ ONLMAP

typedef std::map<HWIdentifier, TT_ID> TileRoI_Map::ONLMAP
private

Definition at line 112 of file TileRoI_Map.h.

◆ ROIMAP

typedef std::map<TT_ID, COLL_ID_VEC > TileRoI_Map::ROIMAP
private

Definition at line 114 of file TileRoI_Map.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ TT_ID

Definition at line 46 of file TileRoI_Map.h.

Constructor & Destructor Documentation

◆ TileRoI_Map()

TileRoI_Map::TileRoI_Map ( const std::string & type,
const std::string & name,
const IInterface * parent )

constructor

Definition at line 24 of file TileRoI_Map.cxx.

26: AthAlgTool(type,name,parent)
27{
28 declareInterface<TileRoI_Map>( this );
29}
AthAlgTool()
Default constructor:

◆ ~TileRoI_Map()

TileRoI_Map::~TileRoI_Map ( )
virtual

Definition at line 62 of file TileRoI_Map.cxx.

63{
64}

Member Function Documentation

◆ addEntry()

bool TileRoI_Map::addEntry ( const HWIdentifier & adc_hwid)
private

Definition at line 67 of file TileRoI_Map.cxx.

68{
69
70 Identifier adc_id = m_cablingSvc->h2s_adc_id(adc_hwid);
71
72 if (adc_id.is_valid()) {
73
74 Identifier pmt_id = m_tileID->pmt_id(adc_id);
75 Identifier cell_id = m_tileID->cell_id(adc_id);
76
77 Identifier rId = m_cablingSvc->pmt2tt_id(pmt_id);
78
79 m_offmap[ cell_id ] = rId; // mapping for Cell id
80 m_offmap[ pmt_id ] = rId; // mapping for PMT id
81 m_offmap[ adc_id ] = rId; // mapping for ADC id
82
83 HWIdentifier chan_id = m_tileHWID->channel_id(adc_hwid);
84 m_onlmap[ chan_id ] = rId; // mapping for online channel id
85 m_onlmap[ adc_hwid ] = rId; // mapping for online ADC id
86
87 std::cout
88 << " HW id " << m_tileHWID->to_string(adc_hwid)
89 << " id " << m_tileID->to_string(adc_id)
90 << " tt id " << rId // don't know how to print TT ID
91 << std::endl;
92
93 // add entry for RoI to COLL_ID map.
94 // make an Tile frag ID
95 int frag = m_tileHWID->frag(chan_id);
96 COLL_ID_VEC& v = m_roimap[rId];
97 COLL_ID_VEC::const_iterator it = v.begin();
98 COLL_ID_VEC::const_iterator it_end = v.end();
99 bool found = false;
100
101 const CaloDetDescrElement* caloDDE = m_tileMgr->get_cell_element(cell_id);
102 m_epmap[frag].set(caloDDE->eta(),caloDDE->phi());
103
104 for(; it != it_end; ++it)
105 if(frag == (*it) ) found = true;
106 if(!found) {
107// std::cout <<" Mapped RoI "<<rId.sample()<<" "<<rId.eta()<<" "
108// <<rId.phi()<<" to frag "<<std::hex<<frag<<std::dec<<std::endl;
109 v.push_back(frag);
110 }
111 } else
112 {
113 std::cout <<" Failed to get Identifier in TileRoI_Map::add "<< std::endl;
114 return false;
115 }
116
117 return true;
118
119}
bool is_valid() const
Check if id is in a valid state.
const TileDetDescrManager * m_tileMgr
const TileCablingService * m_cablingSvc
OFFMAP m_offmap
const TileID * m_tileID
ROIMAP m_roimap
ONLMAP m_onlmap
std::vector< COLL_ID > COLL_ID_VEC
E_P_MAP m_epmap
const TileHWID * m_tileHWID

◆ CollectionID()

const TileRoI_Map::COLL_ID_VEC & TileRoI_Map::CollectionID ( const TT_ID & id) const

reserve lookup.

given RoI, get CollectionID

Definition at line 157 of file TileRoI_Map.cxx.

159{
160 ROIMAP::const_iterator it = m_roimap.find(RoIid);
161 if(it !=m_roimap.end()) {
162 return (*it).second;
163 }
164 std::cout <<" TileRoI_Map::CollectionID: can not find RoI" << std::endl;
165 static const COLL_ID_VEC v ;
166 return v;
167}

◆ 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

◆ getEtaPhiRegion()

bool TileRoI_Map::getEtaPhiRegion ( unsigned int hashid,
float & etamin,
float & etamax,
float & phimin,
float & phimax ) const

returns Eta-Phi Region for a hashed ID of the Collection.

return false for invalid ID.

Definition at line 208 of file TileRoI_Map.cxx.

212{
213 if( (int)hashid >= m_idhash.max() ) return false;
214
215 int frag = m_idhash.identifier(hashid);
216 E_P_MAP::const_iterator it = m_epmap.find(frag);
217 if(it == m_epmap.end()) return false;
218
219 etamin = (*it).second.etamin;
220 etamax = (*it).second.etamax;
221 phimin = (*it).second.phimin;
222 phimax = (*it).second.phimax;
223
224 return true;
225
226}
TileFragHash m_idhash

◆ initialize()

StatusCode TileRoI_Map::initialize ( )

define a RoI identifier type, two ints.

iterator over all ADC Identifiers

Definition at line 31 of file TileRoI_Map.cxx.

32{
34 ATH_CHECK( detStore()->retrieve(m_tileID, "TileID") );
35 ATH_CHECK( detStore()->retrieve(m_tileHWID, "TileHWID") );
36
37 // get the pointer to CablingSvc
39
40 m_idhash.initialize(m_tileHWID);
41
42 // intialize the internal map
43
45 std::vector<HWIdentifier>::const_iterator first = m_tileHWID->adc_begin();
46 std::vector<HWIdentifier>::const_iterator last = m_tileHWID->adc_end();
47
48 int nADC = 0;
49 for ( ; first!=last; ++first) {
50 if ( addEntry(*first) ) ++nADC;
51 }
52
53 if (m_print) {
54 std::cout << " number of ADCs made in TileRoI_Map " << nADC<< std::endl;
55 }
56
58
59 return StatusCode::SUCCESS;
60}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
static const TileCablingService * getInstance()
get pointer to service instance
Gaudi::Property< bool > m_print
bool addEntry(const HWIdentifier &adc_hwid)
void printEtaPhiRegions()
bool first
Definition DeMoScan.py:534
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.

◆ interfaceID()

const InterfaceID & TileRoI_Map::interfaceID ( )
static

AlgTool InterfaceID.

Definition at line 20 of file TileRoI_Map.cxx.

21{ return IID_ITileRoI_Map; }
static const InterfaceID IID_ITileRoI_Map("TileRoI_Map", 1, 0)

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

◆ printEtaPhiRegions()

void TileRoI_Map::printEtaPhiRegions ( )
private

Definition at line 176 of file TileRoI_Map.cxx.

177{
178 // print all Collection ID and eta phi region
179
180 E_P_MAP::const_iterator it = m_epmap.begin();
181 E_P_MAP::const_iterator it_end = m_epmap.end();
182
183 std::cout <<" COLLECTION ID , HASHID, ETAMIN, ETAMAX, PHIMIN, PHIMAX "<<std::endl ;
184
185 TileHWID tileHW;
186
187 for(; it!=it_end;++it){
188 int frag = (*it).first;
189 int hashid = m_idhash(frag);
190
191 float e1,e2,p1,p2 ;
192
193 // check getEtaPhiRegion method.
194 getEtaPhiRegion(hashid,e1,e2,p1,p2);
195
196 // print them out.
197 std::cout <<std::hex<< frag
198 << " " <<hashid << " "
199 <<e1 << " "
200 <<e2 << " "
201 <<p1 << " "
202 <<p2 << std::endl;
203 }
204 std::cout << std::dec << std::endl;
205
206}
bool getEtaPhiRegion(unsigned int hashid, float &etamin, float &etamax, float &phimin, float &phimax) const
returns Eta-Phi Region for a hashed ID of the Collection.
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling

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

◆ TrigTowerID() [1/2]

TileRoI_Map::TT_ID TileRoI_Map::TrigTowerID ( const HWIdentifier & id) const

Definition at line 141 of file TileRoI_Map.cxx.

143{
144 ONLMAP::const_iterator it = m_onlmap.find( id );
145 if(it==m_onlmap.end() )
146 {
147 std::string err(" TileRoI_Map::TrigTowerID(const HWIdentifier&): no entry for HWID ");
148 err += m_tileHWID->to_string(id,-1) ;
149 TileID_Exception except(err,2);
150 throw except;
151 }
152
153 return (*it).second;
154
155}

◆ TrigTowerID() [2/2]

TileRoI_Map::TT_ID TileRoI_Map::TrigTowerID ( const Identifier & id) const

return TrigTowerID for various queries.

Definition at line 123 of file TileRoI_Map.cxx.

125{
126 OFFMAP::const_iterator it = m_offmap.find(id);
127 if( it==m_offmap.end() )
128 {
129 std::string err(" TileRoI_Map: not entry for ID ");
130 err += m_tileID->to_string(id,-1) ;
131 TileID_Exception except(err,1);
132 throw except;
133 }
134
135 return (*it).second;
136
137}

◆ 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

◆ validId()

bool TileRoI_Map::validId ( const TT_ID & tt_id) const

check validity

Definition at line 169 of file TileRoI_Map.cxx.

171{
172 ROIMAP::const_iterator it = m_roimap.find(RoIid);
173 return it !=m_roimap.end() ;
174}

Member Data Documentation

◆ m_cablingSvc

const TileCablingService* TileRoI_Map::m_cablingSvc {nullptr}
private

Definition at line 127 of file TileRoI_Map.h.

127{nullptr};

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

E_P_MAP TileRoI_Map::m_epmap
private

Definition at line 122 of file TileRoI_Map.h.

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

TileFragHash TileRoI_Map::m_idhash
private

Definition at line 129 of file TileRoI_Map.h.

◆ m_offmap

OFFMAP TileRoI_Map::m_offmap
private

Definition at line 118 of file TileRoI_Map.h.

◆ m_onlmap

ONLMAP TileRoI_Map::m_onlmap
private

Definition at line 119 of file TileRoI_Map.h.

◆ m_print

Gaudi::Property<bool> TileRoI_Map::m_print {this, "Print", false}
private

Definition at line 130 of file TileRoI_Map.h.

130{this, "Print", false};

◆ m_roimap

ROIMAP TileRoI_Map::m_roimap
private

Definition at line 120 of file TileRoI_Map.h.

◆ m_tileHWID

const TileHWID* TileRoI_Map::m_tileHWID {nullptr}
private

Definition at line 125 of file TileRoI_Map.h.

125{nullptr};

◆ m_tileID

const TileID* TileRoI_Map::m_tileID {nullptr}
private

Definition at line 124 of file TileRoI_Map.h.

124{nullptr};

◆ m_tileMgr

const TileDetDescrManager* TileRoI_Map::m_tileMgr {nullptr}
private

Definition at line 126 of file TileRoI_Map.h.

126{nullptr};

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