CMS 3D CMS Logo

DTDeadFlag.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //----------------------
9 // This Class' Header --
10 //----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
17 
18 //---------------
19 // C++ Headers --
20 //---------------
21 #include <iostream>
22 #include <sstream>
23 
24 //----------------
25 // Constructors --
26 //----------------
27 DTDeadFlag::DTDeadFlag() : dataVersion(" "), dBuf(new DTBufferTree<int, int>) { dataList.reserve(1000); }
28 
29 DTDeadFlag::DTDeadFlag(const std::string& version) : dataVersion(version), dBuf(new DTBufferTree<int, int>) {
30  dataList.reserve(1000);
31 }
32 
33 DTDeadFlagId::DTDeadFlagId() : wheelId(0), stationId(0), sectorId(0), slId(0), layerId(0), cellId(0) {}
34 
35 DTDeadFlagData::DTDeadFlagData() : dead_HV(false), dead_TP(false), dead_RO(false), discCat(false) {}
36 
37 //--------------
38 // Destructor --
39 //--------------
41 
43 
45 
46 //--------------
47 // Operations --
48 //--------------
49 int DTDeadFlag::get(int wheelId,
50  int stationId,
51  int sectorId,
52  int slId,
53  int layerId,
54  int cellId,
55  bool& dead_HV,
56  bool& dead_TP,
57  bool& dead_RO,
58  bool& discCat) const {
59  dead_HV = dead_TP = dead_RO = discCat = false;
60 
61  std::vector<int> chanKey;
62  chanKey.reserve(6);
63  chanKey.push_back(wheelId);
64  chanKey.push_back(stationId);
65  chanKey.push_back(sectorId);
66  chanKey.push_back(slId);
67  chanKey.push_back(layerId);
68  chanKey.push_back(cellId);
69  int ientry;
70  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
71  if (!searchStatus) {
72  const DTDeadFlagData& data(dataList[ientry].second);
73  dead_HV = data.dead_HV;
74  dead_TP = data.dead_TP;
75  dead_RO = data.dead_RO;
76  discCat = data.discCat;
77  }
78 
79  return searchStatus;
80 }
81 
82 int DTDeadFlag::get(const DTWireId& id, bool& dead_HV, bool& dead_TP, bool& dead_RO, bool& discCat) const {
83  return get(
84  id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), dead_HV, dead_TP, dead_RO, discCat);
85 }
86 
87 bool DTDeadFlag::getCellDead_HV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const {
88  bool dead_HV;
89  bool dead_TP;
90  bool dead_RO;
91  bool discCat;
92  get(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
93  return dead_HV;
94 }
95 
96 bool DTDeadFlag::getCellDead_HV(const DTWireId& id) const {
97  return getCellDead_HV(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire());
98 }
99 
100 bool DTDeadFlag::getCellDead_TP(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const {
101  bool dead_HV;
102  bool dead_TP;
103  bool dead_RO;
104  bool discCat;
105  get(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
106  return dead_TP;
107 }
108 
109 bool DTDeadFlag::getCellDead_TP(const DTWireId& id) const {
110  return getCellDead_TP(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire());
111 }
112 
113 bool DTDeadFlag::getCellDead_RO(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const {
114  bool dead_HV;
115  bool dead_TP;
116  bool dead_RO;
117  bool discCat;
118  get(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
119  return dead_RO;
120 }
121 
122 bool DTDeadFlag::getCellDead_RO(const DTWireId& id) const {
123  return getCellDead_RO(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire());
124 }
125 
126 bool DTDeadFlag::getCellDiscCat(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const {
127  bool dead_HV;
128  bool dead_TP;
129  bool dead_RO;
130  bool discCat;
131  get(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
132  return discCat;
133 }
134 
135 bool DTDeadFlag::getCellDiscCat(const DTWireId& id) const {
136  return getCellDiscCat(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire());
137 }
138 
139 const std::string& DTDeadFlag::version() const { return dataVersion; }
140 
142 
144  dataList.clear();
145  initialize();
146  return;
147 }
148 
149 int DTDeadFlag::set(int wheelId,
150  int stationId,
151  int sectorId,
152  int slId,
153  int layerId,
154  int cellId,
155  bool dead_HV,
156  bool dead_TP,
157  bool dead_RO,
158  bool discCat) {
159  std::vector<int> chanKey;
160  chanKey.reserve(6);
161  chanKey.push_back(wheelId);
162  chanKey.push_back(stationId);
163  chanKey.push_back(sectorId);
164  chanKey.push_back(slId);
165  chanKey.push_back(layerId);
166  chanKey.push_back(cellId);
167  int ientry;
168  int searchStatus = dBuf->find(chanKey.begin(), chanKey.end(), ientry);
169 
170  if (!searchStatus) {
172  data.dead_HV = dead_HV;
173  data.dead_TP = dead_TP;
174  data.dead_RO = dead_RO;
175  data.discCat = discCat;
176  return -1;
177  } else {
179  key.wheelId = wheelId;
180  key.stationId = stationId;
181  key.sectorId = sectorId;
182  key.slId = slId;
183  key.layerId = layerId;
184  key.cellId = cellId;
186  data.dead_HV = dead_HV;
187  data.dead_TP = dead_TP;
188  data.dead_RO = dead_RO;
189  data.discCat = discCat;
190  ientry = dataList.size();
191  dataList.push_back(std::pair<const DTDeadFlagId, DTDeadFlagData>(key, data));
192  dBuf->insert(chanKey.begin(), chanKey.end(), ientry);
193  return 0;
194  }
195 
196  return 99;
197 }
198 
199 int DTDeadFlag::set(const DTWireId& id, bool dead_HV, bool dead_TP, bool dead_RO, bool discCat) {
200  return set(
201  id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), dead_HV, dead_TP, dead_RO, discCat);
202 }
203 
204 int DTDeadFlag::setCellDead_HV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag) {
205  bool dead_HV;
206  bool dead_TP;
207  bool dead_RO;
208  bool discCat;
209  int status = cellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
210  setCellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, flag, dead_TP, dead_RO, discCat);
211  return status;
212 }
213 
215  return setCellDead_HV(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), flag);
216 }
217 
218 int DTDeadFlag::setCellDead_TP(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag) {
219  bool dead_HV;
220  bool dead_TP;
221  bool dead_RO;
222  bool discCat;
223  int status = cellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
224  setCellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, flag, dead_RO, discCat);
225  return status;
226 }
227 
229  return setCellDead_TP(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), flag);
230 }
231 
232 int DTDeadFlag::setCellDead_RO(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag) {
233  bool dead_HV;
234  bool dead_TP;
235  bool dead_RO;
236  bool discCat;
237  int status = cellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
238  setCellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, flag, discCat);
239  return status;
240 }
241 
243  return setCellDead_RO(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), flag);
244 }
245 
246 int DTDeadFlag::setCellDiscCat(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag) {
247  bool dead_HV;
248  bool dead_TP;
249  bool dead_RO;
250  bool discCat;
251  int status = cellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, discCat);
252  setCellStatus(wheelId, stationId, sectorId, slId, layerId, cellId, dead_HV, dead_TP, dead_RO, flag);
253  return status;
254 }
255 
257  return setCellDiscCat(id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), id.wire(), flag);
258 }
259 
261 
263 
265  std::stringstream name;
266  name << dataVersion << "_map_DeadFlag" << this;
267  return name.str();
268 }
269 
271  dBuf->clear();
272 
273  int entryNum = 0;
274  int entryMax = dataList.size();
275  std::vector<int> chanKey;
276  chanKey.reserve(6);
277  while (entryNum < entryMax) {
278  const DTDeadFlagId& chan = dataList[entryNum].first;
279 
280  chanKey.clear();
281  chanKey.push_back(chan.wheelId);
282  chanKey.push_back(chan.stationId);
283  chanKey.push_back(chan.sectorId);
284  chanKey.push_back(chan.slId);
285  chanKey.push_back(chan.layerId);
286  chanKey.push_back(chan.cellId);
287  dBuf->insert(chanKey.begin(), chanKey.end(), entryNum++);
288  }
289 
290  return;
291 }
bool getCellDead_RO(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:113
bool getCellDiscCat(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:126
std::vector< std::pair< DTDeadFlagId, DTDeadFlagData > > dataList
Definition: DTDeadFlag.h:178
int setCellDead_HV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:204
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool dead_HV, bool dead_TP, bool dead_RO, bool discCat)
Definition: DTDeadFlag.cc:149
const std::string & version() const
access version
Definition: DTDeadFlag.cc:139
std::string mapName() const
read and store full content
Definition: DTDeadFlag.cc:264
std::vector< std::pair< DTDeadFlagId, DTDeadFlagData > >::const_iterator const_iterator
Access methods to data.
Definition: DTDeadFlag.h:169
int setCellDead_RO(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:232
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool &dead_HV, bool &dead_TP, bool &dead_RO, bool &discCat) const
Definition: DTDeadFlag.cc:49
U second(std::pair< T, U > const &p)
const_iterator begin() const
Definition: DTDeadFlag.cc:260
int setCellDiscCat(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:246
key
prepare the HTCondor submission files and eventually submit them
int setCellDead_TP(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:218
std::string dataVersion
Definition: DTDeadFlag.h:176
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
Definition: DTDeadFlag.h:180
int setCellStatus(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool dead_HV, bool dead_TP, bool dead_RO, bool discCat)
Definition: DTDeadFlag.h:128
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...
bool getCellDead_TP(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:100
void initialize()
Definition: DTDeadFlag.cc:270
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
const_iterator end() const
Definition: DTDeadFlag.cc:262
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
int insert(ElementKey fKey, ElementKey lKey, Content cont)
void clear()
reset content
Definition: DTDeadFlag.cc:143
bool getCellDead_HV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:87
int cellStatus(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool &dead_HV, bool &dead_TP, bool &dead_RO, bool &discCat) const
get content
Definition: DTDeadFlag.h:82