ATLAS Offline Software
Loading...
Searching...
No Matches
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

Public Member Functions

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

Private Attributes

int m_size {0}
 total number of IDs
std::map< unsigned int, int > m_lookup
 test beam flag
std::vector< IDm_int2id
 reverse look up
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}
std::vector< ID > m_int2id
reverse look up
str index
Definition DeMoScan.py:362

◆ 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
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}
static int subDet(const HWIdentifier &id)
return sub-detector identifier
static int rodFragId(const HWIdentifier &id)
return ROD fragment identifier ( == ROL == ROB identifier )
unsigned int ID
definition of ID type
std::map< unsigned int, int > m_lookup
test beam flag
int m_size
total number of IDs
int offset() const
return offset
setEventNumber uint32_t

◆ max()

int LArRodIdHash::max ( ) const

return maximum number of IDs

Definition at line 82 of file LArRodIdHash.cxx.

82 {
83
84return m_size;
85
86}

◆ offset()

int LArRodIdHash::offset ( ) const

return offset

Definition at line 88 of file LArRodIdHash.cxx.

88 {
89
90return 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.

58{0};

◆ m_size

int LArRodIdHash::m_size {0}
private

total number of IDs

Definition at line 50 of file LArRodIdHash.h.

50{0}; // total number of IDs

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