ATLAS Offline Software
TileRodIdHash.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/Bootstrap.h"
7 #include "GaudiKernel/ISvcLocator.h"
8 #include "GaudiKernel/IToolSvc.h"
9 #include <iostream>
10 
11 // This class converts a TileReadoutModuleID into an integer,
12 //
13 
14 // default contructor
16  : m_size(0),
17  m_offset(0)
18 {
19 
20 }
21 
22 
24 
25 //
26 
27  std::vector<ID> rmod;
28  rmod.reserve(256);
29  if (runnum>318000) {
30  // new frag->ROB mapping since March 2017
31  // put 4 drawers in two subsequent RODs
32  // odd drawers in odd ROD, even drawers in even ROD
33  for(unsigned int i=0x510000;i<=0x51001f;i+=2){
34  rmod.push_back(i);
35  rmod.push_back(i+1);
36  rmod.push_back(i);
37  rmod.push_back(i+1);
38  }
39  for(unsigned int i=0x520000;i<=0x52001f;i+=2){
40  rmod.push_back(i);
41  rmod.push_back(i+1);
42  rmod.push_back(i);
43  rmod.push_back(i+1);
44  }
45  for(unsigned int i=0x530000;i<=0x53001f;i+=2){
46  rmod.push_back(i);
47  rmod.push_back(i+1);
48  rmod.push_back(i);
49  rmod.push_back(i+1);
50  }
51  for(unsigned int i=0x540000;i<=0x54001f;i+=2){
52  rmod.push_back(i);
53  rmod.push_back(i+1);
54  rmod.push_back(i);
55  rmod.push_back(i+1);
56  }
57  } else {
58  for(unsigned int i=0x510000;i<=0x51000f;i++){
59  rmod.push_back(i);
60  rmod.push_back(i);
61  rmod.push_back(i);
62  rmod.push_back(i);
63  }
64  for(unsigned int i=0x520000;i<=0x52000f;i++){
65  rmod.push_back(i);
66  rmod.push_back(i);
67  rmod.push_back(i);
68  rmod.push_back(i);
69  }
70  for(unsigned int i=0x530000;i<=0x53000f;i++){
71  rmod.push_back(i);
72  rmod.push_back(i);
73  rmod.push_back(i);
74  rmod.push_back(i);
75  }
76  for(unsigned int i=0x540000;i<=0x54000f;i++){
77  rmod.push_back(i);
78  rmod.push_back(i);
79  rmod.push_back(i);
80  rmod.push_back(i);
81  }
82  }
83 
84  initialize(offset,rmod);
85 }
86 
87 void TileRodIdHash::initialize( int offset, const std::vector<ID>& rmod ) {
88 
89 //
90 
91  m_offset = offset;
92 
93  std::vector<ID>::const_iterator
94  it = rmod.begin();
95  std::vector<ID>::const_iterator
96  it_end = rmod.end() ;
97 
98  int n = 0;
99  for (; it!=it_end;++it) {
100  ID id = *it;
101  unsigned int i = id;
102  m_lookup[i] = n ;
103  m_int2id.push_back(id);
104  ++n;
105  }
106 
107  m_size = n;
108 }
109 
110 
111 
113 
114  return m_int2id[index] ;
115 
116 }
117 
118 int TileRodIdHash::operator() (const ID& id) const {
119 
120  unsigned int i = id ;
121  std::map<unsigned int, int> ::const_iterator it= m_lookup.find(i);
122  if(it!=m_lookup.end()) return (*it).second;
123  std::cout <<" ERROR in TileRodIdHash : invalid Rod number"
124  <<std::endl;
125  return -1;
126 
127 }
128 
129 int TileRodIdHash::max() const {
130 
131 return m_size;
132 
133 }
134 
136 
137 return m_offset;
138 
139 }
140 
python.utils.AtlRunQueryDQUtils.runnum
runnum
Definition: AtlRunQueryDQUtils.py:214
TileRodIdHash::TileRodIdHash
TileRodIdHash()
Definition: TileRodIdHash.cxx:15
TileRodIdHash::operator()
int operator()(const ID &id) const
Convert ID to int.
Definition: TileRodIdHash.cxx:118
TileRodIdHash::m_lookup
std::map< unsigned int, int > m_lookup
test beam flag
Definition: TileRodIdHash.h:51
TileRodIdHash::offset
int offset() const
return offset
Definition: TileRodIdHash.cxx:135
index
Definition: index.py:1
TileRodIdHash::initialize
void initialize(int offset, int runnum)
initialize
Definition: TileRodIdHash.cxx:23
TileRodIdHash::m_offset
int m_offset
Definition: TileRodIdHash.h:56
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TileRodIdHash::ID
int ID
Definition: TileRodIdHash.h:23
TileRodIdHash.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
TileRodIdHash::m_int2id
std::vector< ID > m_int2id
reverse look up
Definition: TileRodIdHash.h:54
TileRodIdHash::m_size
int m_size
total number of IDs
Definition: TileRodIdHash.h:47
beamspotman.n
n
Definition: beamspotman.py:731
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
DeMoScan.index
string index
Definition: DeMoScan.py:364
TileRodIdHash::max
int max() const
return maximum number of IDs
Definition: TileRodIdHash.cxx:129
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
TileRodIdHash::identifier
ID identifier(int i) const
reverse conversion
Definition: TileRodIdHash.cxx:112