ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
LArRodIdHash Class Reference

class that provides LArReadoutModuleID to integer hash ID mapping. More...

#include <LArRodIdHash.h>

Collaboration diagram for LArRodIdHash:

Public Types

typedef unsigned int ID
 definition of ID type More...
 

Public Member Functions

void initialize (int offset, const std::vector< HWIdentifier > &roms)
 Initialize. More...
 
int operator() (const ID &id) const
 Convert ID to int. More...
 
int max () const
 return maximum number of IDs More...
 
ID identifier (int i) const
 reverse conversion More...
 
int offset () const
 return offset More...
 

Private Attributes

int m_size {0}
 total number of IDs More...
 
std::map< unsigned int, int > m_lookup
 test beam flag More...
 
std::vector< IDm_int2id
 reverse look up More...
 
int m_offset {0}
 

Detailed Description

class that provides LArReadoutModuleID to integer hash ID mapping.


Definition at line 26 of file LArRodIdHash.h.

Member Typedef Documentation

◆ ID

typedef unsigned int LArRodIdHash::ID

definition of ID type

Definition at line 31 of file LArRodIdHash.h.

Member Function Documentation

◆ identifier()

LArRodIdHash::ID LArRodIdHash::identifier ( int  i) const

reverse conversion

Definition at line 65 of file LArRodIdHash.cxx.

65  {
66 
67  return m_int2id[index] ;
68 
69 }

◆ initialize()

void LArRodIdHash::initialize ( int  offset,
const std::vector< HWIdentifier > &  roms 
)

Initialize.

Here real map is built

Definition at line 20 of file LArRodIdHash.cxx.

20  {
21 
22 //
23 
24  m_offset = offset;
25 
26  LArReadoutModuleService larROMService;
27  eformat::SubDetector detid ;
28  std::vector<ID> rmod;
29  std::vector<HWIdentifier>::const_iterator tit = roms.begin();
30  std::vector<HWIdentifier>::const_iterator tit_end = roms.end();
31 
32  for(; tit!=tit_end; ++tit)
33  {
34 
35  HWIdentifier mId = (*tit);
36  detid = (eformat::SubDetector) larROMService.subDet(mId);
37  uint8_t m = larROMService.rodFragId(mId);
38 
39  SourceIdentifier sid = SourceIdentifier(detid,m);
40  uint32_t rod_id = sid.code();
41  rmod.push_back(rod_id);
42 
43  }
44 
45  std::vector<ID>::const_iterator
46  it = rmod.begin();
47  std::vector<ID>::const_iterator
48  it_end = rmod.end() ;
49 
50  int n = 0;
51  for (; it!=it_end;++it) {
52  ID id = *it;
53  // std::cout << " LArReadoutModuleID = "<<id.id()<<std::endl;
54  unsigned int i = id;
55  m_lookup[i] = n ;
56  m_int2id.push_back(id);
57  ++n;
58  }
59 
60  // cout << " Number of LArReadoutModuleID valid ID "<< n <<endl;
61  m_size = n;
62 
63 }

◆ max()

int LArRodIdHash::max ( ) const

return maximum number of IDs

Definition at line 82 of file LArRodIdHash.cxx.

82  {
83 
84 return m_size;
85 
86 }

◆ offset()

int LArRodIdHash::offset ( ) const

return offset

Definition at line 88 of file LArRodIdHash.cxx.

88  {
89 
90 return m_offset;
91 
92 }

◆ operator()()

int LArRodIdHash::operator() ( const ID id) const

Convert ID to int.

Definition at line 71 of file LArRodIdHash.cxx.

71  {
72 
73  unsigned int i = id ;
74  std::map<unsigned int, int> ::const_iterator it= m_lookup.find(i);
75  if(it!=m_lookup.end()) return (*it).second;
76  std::cout <<" ERROR in LArRodIdHash : invalid Rod number"
77  <<std::endl;
78  return -1;
79 
80 }

Member Data Documentation

◆ m_int2id

std::vector<ID> LArRodIdHash::m_int2id
private

reverse look up

Definition at line 56 of file LArRodIdHash.h.

◆ m_lookup

std::map<unsigned int, int> LArRodIdHash::m_lookup
private

test beam flag

Definition at line 53 of file LArRodIdHash.h.

◆ m_offset

int LArRodIdHash::m_offset {0}
private

Definition at line 58 of file LArRodIdHash.h.

◆ m_size

int LArRodIdHash::m_size {0}
private

total number of IDs

Definition at line 50 of file LArRodIdHash.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
LArReadoutModuleService::subDet
static int subDet(const HWIdentifier &id)
return sub-detector identifier
Definition: LArReadoutModuleService.cxx:162
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LArRodIdHash::offset
int offset() const
return offset
Definition: LArRodIdHash.cxx:88
LArReadoutModuleService::rodFragId
static int rodFragId(const HWIdentifier &id)
return ROD fragment identifier ( == ROL == ROB identifier )
Definition: LArReadoutModuleService.cxx:211
skel.it
it
Definition: skel.GENtoEVGEN.py:423
HWIdentifier
Definition: HWIdentifier.h:13
LArRodIdHash::m_size
int m_size
total number of IDs
Definition: LArRodIdHash.h:50
LArReadoutModuleService
Service for creating and interpreting LAr readout modules identifiers.
Definition: LArReadoutModuleService.h:20
TileDCSDataPlotter.tit
tit
Definition: TileDCSDataPlotter.py:890
LArRodIdHash::m_lookup
std::map< unsigned int, int > m_lookup
test beam flag
Definition: LArRodIdHash.h:53
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
DeMoScan.index
string index
Definition: DeMoScan.py:362
LArRodIdHash::m_int2id
std::vector< ID > m_int2id
reverse look up
Definition: LArRodIdHash.h:56
LArRodIdHash::m_offset
int m_offset
Definition: LArRodIdHash.h:58