CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <stdint.h>
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():
20  bits_(0)
21 {}
22 
23 
24 //======================================================================================
25 PixelROCStatus::PixelROCStatus(const std::set<ROCstatus>& stat){
26 
27  std::set<ROCstatus>::const_iterator i=stat.begin();
28 
29  for(;i!=stat.end();++i){
30  set(*i);
31  }
32 
33 }
34 
35 //======================================================================================
37 
38 //======================================================================================
40  reset() ;
41  bits_=bits_|(1<<stat);
42 }
43 
44 //======================================================================================
46  bits_=bits_&(0<<stat);
47 }
48 
49 //======================================================================================
50 // Added by Dario (March 4th 2008)
52  bits_=0;
53 }
54 
55 //======================================================================================
57  reset() ;
58  if (mode) {
59  set(stat);
60  }
61  else{
62  clear(stat);
63  }
64 }
65 
66 //======================================================================================
67 bool PixelROCStatus::get(ROCstatus stat) const{
68  return bits_&(1<<stat);
69 }
70 
71 //======================================================================================
73  if (stat==off) return "off";
74  if (stat==noHits) return "noHits";
75  if (stat==noInit) return "noInit";
76  if (stat==noAnalogSignal) return "noAnalogSignal";
77  assert(0);
78  return "";
79 }
80 
81 //======================================================================================
82 // modified by MR on 11-01-2008 15:06:28
84  string result = "" ;
85  for (ROCstatus istat=off; istat!=nStatus; istat=ROCstatus(istat+1))
86  {
87  if (get(istat))
88  {
89  result += statusName(istat) ;
90  }
91  }
92  return result ;
93 }
94 
95 //======================================================================================
96 void PixelROCStatus::set(const string& statName){
97 
98  if(statName != "")
99  {
100  for (ROCstatus istat=off; istat!=nStatus; istat=ROCstatus(istat+1)){
101  if (statName==statusName(istat)){
102  set(istat);
103  return;
104  }
105  }
106  cout << "[PixelROCStatus::set()] statName |"
107  << statName <<"| is an invalid keyword"<<endl;
108  ::abort();
109  }
110  else
111  {
112  reset() ;
113  }
114 }
int i
Definition: DBlmapReader.cc:9
bool get(ROCstatus stat) const
tuple result
Definition: query.py:137
void set(ROCstatus stat)
std::string statusName() const
tuple cout
Definition: gather_cfg.py:121
This class keeps the possible non-standard status a ROC can have.
void clear(ROCstatus stat)