CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //----------------
28  dataVersion( " " ),
29  dBuf(new DTBufferTree<int,int>) {
30  dataList.reserve( 1000 );
31 }
32 
33 
35  dataVersion( version ),
36  dBuf(new DTBufferTree<int,int>) {
37  dataList.reserve( 1000 );
38 }
39 
40 
42  wheelId( 0 ),
43  stationId( 0 ),
44  sectorId( 0 ),
45  slId( 0 ),
46  layerId( 0 ),
47  cellId( 0 ) {
48 }
49 
50 
52  dead_HV( false ),
53  dead_TP( false ),
54  dead_RO( false ),
55  discCat( false ) {
56 }
57 
58 
59 //--------------
60 // Destructor --
61 //--------------
63 }
64 
65 
67 }
68 
69 
71 }
72 
73 
74 //--------------
75 // Operations --
76 //--------------
77 int DTDeadFlag::get( int wheelId,
78  int stationId,
79  int sectorId,
80  int slId,
81  int layerId,
82  int cellId,
83  bool& dead_HV,
84  bool& dead_TP,
85  bool& dead_RO,
86  bool& discCat ) const {
87 
88  dead_HV =
89  dead_TP =
90  dead_RO =
91  discCat = false;
92 
93  std::vector<int> chanKey;
94  chanKey.reserve(6);
95  chanKey.push_back( wheelId );
96  chanKey.push_back( stationId );
97  chanKey.push_back( sectorId );
98  chanKey.push_back( slId );
99  chanKey.push_back( layerId );
100  chanKey.push_back( cellId );
101  int ientry;
102  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
103  if ( !searchStatus ) {
104  const DTDeadFlagData& data( dataList[ientry].second );
105  dead_HV = data.dead_HV;
106  dead_TP = data.dead_TP;
107  dead_RO = data.dead_RO;
108  discCat = data.discCat;
109  }
110 
111  return searchStatus;
112 
113 }
114 
115 
116 int DTDeadFlag::get( const DTWireId& id,
117  bool& dead_HV,
118  bool& dead_TP,
119  bool& dead_RO,
120  bool& discCat ) const {
121  return get( id.wheel(),
122  id.station(),
123  id.sector(),
124  id.superLayer(),
125  id.layer(),
126  id.wire(),
127  dead_HV, dead_TP, dead_RO, discCat );
128 }
129 
130 
131 bool DTDeadFlag::getCellDead_HV( int wheelId,
132  int stationId,
133  int sectorId,
134  int slId,
135  int layerId,
136  int cellId ) const {
137 
138  bool dead_HV;
139  bool dead_TP;
140  bool dead_RO;
141  bool discCat;
142  get( wheelId,
143  stationId,
144  sectorId,
145  slId,
146  layerId,
147  cellId,
148  dead_HV, dead_TP, dead_RO, discCat );
149  return dead_HV;
150 
151 }
152 
153 
154 bool DTDeadFlag::getCellDead_HV( const DTWireId& id ) const {
155  return getCellDead_HV( id.wheel(),
156  id.station(),
157  id.sector(),
158  id.superLayer(),
159  id.layer(),
160  id.wire() );
161 }
162 
163 
164 bool DTDeadFlag::getCellDead_TP( int wheelId,
165  int stationId,
166  int sectorId,
167  int slId,
168  int layerId,
169  int cellId ) const {
170 
171  bool dead_HV;
172  bool dead_TP;
173  bool dead_RO;
174  bool discCat;
175  get( wheelId,
176  stationId,
177  sectorId,
178  slId,
179  layerId,
180  cellId,
181  dead_HV, dead_TP, dead_RO, discCat );
182  return dead_TP;
183 
184 }
185 
186 
187 bool DTDeadFlag::getCellDead_TP( const DTWireId& id ) const {
188  return getCellDead_TP( id.wheel(),
189  id.station(),
190  id.sector(),
191  id.superLayer(),
192  id.layer(),
193  id.wire() );
194 }
195 
196 
197 bool DTDeadFlag::getCellDead_RO( int wheelId,
198  int stationId,
199  int sectorId,
200  int slId,
201  int layerId,
202  int cellId ) const {
203 
204  bool dead_HV;
205  bool dead_TP;
206  bool dead_RO;
207  bool discCat;
208  get( wheelId,
209  stationId,
210  sectorId,
211  slId,
212  layerId,
213  cellId,
214  dead_HV, dead_TP, dead_RO, discCat );
215  return dead_RO;
216 
217 }
218 
219 
220 bool DTDeadFlag::getCellDead_RO( const DTWireId& id ) const {
221  return getCellDead_RO( id.wheel(),
222  id.station(),
223  id.sector(),
224  id.superLayer(),
225  id.layer(),
226  id.wire() );
227 }
228 
229 
230 bool DTDeadFlag::getCellDiscCat( int wheelId,
231  int stationId,
232  int sectorId,
233  int slId,
234  int layerId,
235  int cellId ) const {
236 
237  bool dead_HV;
238  bool dead_TP;
239  bool dead_RO;
240  bool discCat;
241  get( wheelId,
242  stationId,
243  sectorId,
244  slId,
245  layerId,
246  cellId,
247  dead_HV, dead_TP, dead_RO, discCat );
248  return discCat;
249 
250 }
251 
252 
253 bool DTDeadFlag::getCellDiscCat( const DTWireId& id ) const {
254  return getCellDiscCat( id.wheel(),
255  id.station(),
256  id.sector(),
257  id.superLayer(),
258  id.layer(),
259  id.wire() );
260 }
261 
262 
263 const
265  return dataVersion;
266 }
267 
268 
270  return dataVersion;
271 }
272 
273 
275  dataList.clear();
276  initialize();
277  return;
278 }
279 
280 
281 int DTDeadFlag::set( int wheelId,
282  int stationId,
283  int sectorId,
284  int slId,
285  int layerId,
286  int cellId,
287  bool dead_HV,
288  bool dead_TP,
289  bool dead_RO,
290  bool discCat ) {
291 
292  std::vector<int> chanKey;
293  chanKey.reserve(6);
294  chanKey.push_back( wheelId );
295  chanKey.push_back( stationId );
296  chanKey.push_back( sectorId );
297  chanKey.push_back( slId );
298  chanKey.push_back( layerId );
299  chanKey.push_back( cellId );
300  int ientry;
301  int searchStatus = dBuf->find( chanKey.begin(), chanKey.end(), ientry );
302 
303  if ( !searchStatus ) {
304  DTDeadFlagData& data( dataList[ientry].second );
305  data.dead_HV = dead_HV;
306  data.dead_TP = dead_TP;
307  data.dead_RO = dead_RO;
308  data.discCat = discCat;
309  return -1;
310  }
311  else {
313  key. wheelId = wheelId;
314  key.stationId = stationId;
315  key. sectorId = sectorId;
316  key. slId = slId;
317  key. layerId = layerId;
318  key. cellId = cellId;
320  data.dead_HV = dead_HV;
321  data.dead_TP = dead_TP;
322  data.dead_RO = dead_RO;
323  data.discCat = discCat;
324  ientry = dataList.size();
325  dataList.push_back( std::pair<const DTDeadFlagId,
326  DTDeadFlagData>( key, data ) );
327  dBuf->insert( chanKey.begin(), chanKey.end(), ientry );
328  return 0;
329  }
330 
331  return 99;
332 
333 }
334 
335 
336 int DTDeadFlag::set( const DTWireId& id,
337  bool dead_HV,
338  bool dead_TP,
339  bool dead_RO,
340  bool discCat ) {
341  return set( id.wheel(),
342  id.station(),
343  id.sector(),
344  id.superLayer(),
345  id.layer(),
346  id.wire(),
347  dead_HV, dead_TP, dead_RO, discCat );
348 }
349 
350 
351 int DTDeadFlag::setCellDead_HV( int wheelId,
352  int stationId,
353  int sectorId,
354  int slId,
355  int layerId,
356  int cellId,
357  bool flag ) {
358 
359  bool dead_HV;
360  bool dead_TP;
361  bool dead_RO;
362  bool discCat;
363  int status = cellStatus( wheelId,
364  stationId,
365  sectorId,
366  slId,
367  layerId,
368  cellId,
369  dead_HV, dead_TP, dead_RO, discCat );
370  setCellStatus( wheelId,
371  stationId,
372  sectorId,
373  slId,
374  layerId,
375  cellId,
376  flag, dead_TP, dead_RO, discCat );
377  return status;
378 
379 }
380 
381 
383  bool flag ) {
384  return setCellDead_HV( id.wheel(),
385  id.station(),
386  id.sector(),
387  id.superLayer(),
388  id.layer(),
389  id.wire(),
390  flag );
391 }
392 
393 
394 int DTDeadFlag::setCellDead_TP( int wheelId,
395  int stationId,
396  int sectorId,
397  int slId,
398  int layerId,
399  int cellId,
400  bool flag ) {
401 
402  bool dead_HV;
403  bool dead_TP;
404  bool dead_RO;
405  bool discCat;
406  int status = cellStatus( wheelId,
407  stationId,
408  sectorId,
409  slId,
410  layerId,
411  cellId,
412  dead_HV, dead_TP, dead_RO, discCat );
413  setCellStatus( wheelId,
414  stationId,
415  sectorId,
416  slId,
417  layerId,
418  cellId,
419  dead_HV, flag, dead_RO, discCat );
420  return status;
421 
422 }
423 
424 
426  bool flag ) {
427  return setCellDead_TP( id.wheel(),
428  id.station(),
429  id.sector(),
430  id.superLayer(),
431  id.layer(),
432  id.wire(),
433  flag );
434 }
435 
436 
437 int DTDeadFlag::setCellDead_RO( int wheelId,
438  int stationId,
439  int sectorId,
440  int slId,
441  int layerId,
442  int cellId,
443  bool flag ) {
444 
445  bool dead_HV;
446  bool dead_TP;
447  bool dead_RO;
448  bool discCat;
449  int status = cellStatus( wheelId,
450  stationId,
451  sectorId,
452  slId,
453  layerId,
454  cellId,
455  dead_HV, dead_TP, dead_RO, discCat );
456  setCellStatus( wheelId,
457  stationId,
458  sectorId,
459  slId,
460  layerId,
461  cellId,
462  dead_HV, dead_TP, flag, discCat );
463  return status;
464 
465 }
466 
467 
469  bool flag ) {
470  return setCellDead_RO( id.wheel(),
471  id.station(),
472  id.sector(),
473  id.superLayer(),
474  id.layer(),
475  id.wire(),
476  flag );
477 }
478 
479 
480 int DTDeadFlag::setCellDiscCat( int wheelId,
481  int stationId,
482  int sectorId,
483  int slId,
484  int layerId,
485  int cellId,
486  bool flag ) {
487 
488  bool dead_HV;
489  bool dead_TP;
490  bool dead_RO;
491  bool discCat;
492  int status = cellStatus( wheelId,
493  stationId,
494  sectorId,
495  slId,
496  layerId,
497  cellId,
498  dead_HV, dead_TP, dead_RO, discCat );
499  setCellStatus( wheelId,
500  stationId,
501  sectorId,
502  slId,
503  layerId,
504  cellId,
505  dead_HV, dead_TP, dead_RO, flag );
506  return status;
507 
508 }
509 
510 
512  bool flag ) {
513  return setCellDiscCat( id.wheel(),
514  id.station(),
515  id.sector(),
516  id.superLayer(),
517  id.layer(),
518  id.wire(),
519  flag );
520 }
521 
522 
524  return dataList.begin();
525 }
526 
527 
529  return dataList.end();
530 }
531 
532 
534  std::stringstream name;
535  name << dataVersion << "_map_DeadFlag" << this;
536  return name.str();
537 }
538 
539 
541 
542  dBuf->clear();
543 
544  int entryNum = 0;
545  int entryMax = dataList.size();
546  std::vector<int> chanKey;
547  chanKey.reserve(6);
548  while ( entryNum < entryMax ) {
549 
550  const DTDeadFlagId& chan = dataList[entryNum].first;
551 
552  chanKey.clear();
553  chanKey.push_back( chan. wheelId );
554  chanKey.push_back( chan.stationId );
555  chanKey.push_back( chan. sectorId );
556  chanKey.push_back( chan. slId );
557  chanKey.push_back( chan. layerId );
558  chanKey.push_back( chan. cellId );
559  dBuf->insert( chanKey.begin(), chanKey.end(), entryNum++ );
560 
561  }
562 
563  return;
564 
565 }
566 
edm::ConstRespectingPtr< DTBufferTree< int, int > > dBuf
Definition: DTDeadFlag.h:257
bool getCellDiscCat(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:230
int setCellDead_HV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:351
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:281
const_iterator begin() const
Definition: DTDeadFlag.cc:523
bool getCellDead_TP(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:164
std::vector< std::pair< DTDeadFlagId, DTDeadFlagData > > dataList
Definition: DTDeadFlag.h:255
int setCellDead_RO(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:437
int find(ElementKey fKey, ElementKey lKey, typename DTBufferTreeTrait< Content >::outputTypeOfConstFind &cont) const
U second(std::pair< T, U > const &p)
const_iterator end() const
Definition: DTDeadFlag.cc:528
std::string mapName() const
read and store full content
Definition: DTDeadFlag.cc:533
std::vector< std::pair< DTDeadFlagId, DTDeadFlagData > >::const_iterator const_iterator
Access methods to data.
Definition: DTDeadFlag.h:242
int setCellDiscCat(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:480
const std::string & version() const
access version
Definition: DTDeadFlag.cc:264
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
bool getCellDead_HV(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:131
int setCellDead_TP(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool flag)
Definition: DTDeadFlag.cc:394
std::string dataVersion
Definition: DTDeadFlag.h:253
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:164
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:77
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:90
void initialize()
Definition: DTDeadFlag.cc:540
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int insert(ElementKey fKey, ElementKey lKey, Content cont)
volatile std::atomic< bool > shutdown_flag false
tuple status
Definition: ntuplemaker.py:245
bool getCellDead_RO(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId) const
Definition: DTDeadFlag.cc:197
void clear()
reset content
Definition: DTDeadFlag.cc:274