CMS 3D CMS Logo

PixelROCStatus.cc
Go to the documentation of this file.
1 //
2 // This class keeps the possible non-standard
3 // status a ROC can have.
4 //
5 //
6 //
7 
8 #include <cstdint>
9 #include <set>
10 #include <iostream>
11 #include <cassert>
12 #include <cstdlib>
14 
15 using namespace std;
16 using namespace pos;
17 
18 //======================================================================================
19 PixelROCStatus::PixelROCStatus() : bits_(0) {}
20 
21 //======================================================================================
22 PixelROCStatus::PixelROCStatus(const std::set<ROCstatus>& stat) {
23  std::set<ROCstatus>::const_iterator i = stat.begin();
24 
25  for (; i != stat.end(); ++i) {
26  set(*i);
27  }
28 }
29 
30 //======================================================================================
32 
33 //======================================================================================
35  reset();
36  bits_ = bits_ | (1 << stat);
37 }
38 
39 //======================================================================================
41 
42 //======================================================================================
43 // Added by Dario (March 4th 2008)
44 void PixelROCStatus::reset(void) { bits_ = 0; }
45 
46 //======================================================================================
48  reset();
49  if (mode) {
50  set(stat);
51  } else {
52  clear(stat);
53  }
54 }
55 
56 //======================================================================================
57 bool PixelROCStatus::get(ROCstatus stat) const { return bits_ & (1 << stat); }
58 
59 //======================================================================================
61  if (stat == off)
62  return "off";
63  if (stat == noHits)
64  return "noHits";
65  if (stat == noInit)
66  return "noInit";
67  if (stat == noAnalogSignal)
68  return "noAnalogSignal";
69  assert(0);
70  return "";
71 }
72 
73 //======================================================================================
74 // modified by MR on 11-01-2008 15:06:28
76  string result = "";
77  for (ROCstatus istat = off; istat != nStatus; istat = ROCstatus(istat + 1)) {
78  if (get(istat)) {
79  result += statusName(istat);
80  }
81  }
82  return result;
83 }
84 
85 //======================================================================================
86 void PixelROCStatus::set(const string& statName) {
87  if (!statName.empty()) {
88  for (ROCstatus istat = off; istat != nStatus; istat = ROCstatus(istat + 1)) {
89  if (statName == statusName(istat)) {
90  set(istat);
91  return;
92  }
93  }
94  cout << "[PixelROCStatus::set()] statName |" << statName << "| is an invalid keyword" << endl;
95  ::abort();
96  } else {
97  reset();
98  }
99 }
mps_fire.i
i
Definition: mps_fire.py:355
pos::PixelROCStatus::noInit
Definition: PixelROCStatus.h:26
PixelROCStatus.h
This class keeps the possible non-standard status a ROC can have.
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
cms::cuda::assert
assert(be >=bs)
pos::PixelROCStatus::PixelROCStatus
PixelROCStatus()
Definition: PixelROCStatus.cc:19
pos::PixelROCStatus::bits_
uint32_t bits_
Definition: PixelROCStatus.h:22
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1111
pos::PixelROCStatus::nStatus
Definition: PixelROCStatus.h:26
pos::PixelROCStatus::statusName
std::string statusName() const
Definition: PixelROCStatus.cc:75
pos::PixelROCStatus::reset
void reset(void)
Definition: PixelROCStatus.cc:44
pos::PixelROCStatus::noAnalogSignal
Definition: PixelROCStatus.h:26
std
Definition: JetResolutionObject.h:76
pos::PixelROCStatus::clear
void clear(ROCstatus stat)
Definition: PixelROCStatus.cc:40
pos::PixelROCStatus::~PixelROCStatus
virtual ~PixelROCStatus()
Definition: PixelROCStatus.cc:31
pos::PixelROCStatus::off
Definition: PixelROCStatus.h:26
mps_fire.result
result
Definition: mps_fire.py:303
pos::PixelROCStatus::ROCstatus
ROCstatus
Definition: PixelROCStatus.h:26
pos::PixelROCStatus::set
void set(ROCstatus stat)
Definition: PixelROCStatus.cc:34
pos::PixelROCStatus::get
bool get(ROCstatus stat) const
Definition: PixelROCStatus.cc:57
pos::PixelROCStatus::noHits
Definition: PixelROCStatus.h:26