CMS 3D CMS Logo

PixelROCName.h
Go to the documentation of this file.
1 #ifndef PixelROCName_h
2 #define PixelROCName_h
3 
9 #include <iostream>
10 #include <fstream>
11 #include <string>
12 #include <cassert>
13 
14 namespace pos {
20  class PixelROCName;
21  std::ostream& operator<<(std::ostream& s, const PixelROCName& pixelroc);
22 
23  class PixelROCName {
24  public:
25  PixelROCName();
26 
28 
29  explicit PixelROCName(std::ifstream& s);
30 
31  std::string rocname() const;
32 
33  char detsub() const { return (id_ & 0x80000000) ? 'B' : 'F'; }
34  char mp() const { return id_ & 0x40000000 ? 'p' : 'm'; }
35  char IO() const { return id_ & 0x20000000 ? 'I' : 'O'; }
36  int roc() const { return id_ & 0xf; }
37 
38  //These methods only for FPix
39  int disk() const {
40  assert((id_ & 0x80000000) == 0);
41  return (id_ >> 12) & 0x3;
42  }
43  int blade() const {
44  assert((id_ & 0x80000000) == 0);
45  return (id_ >> 7) & 0x1f;
46  }
47  int panel() const {
48  assert((id_ & 0x80000000) == 0);
49  return ((id_ >> 6) & 0x1) + 1;
50  }
51  int plaquet() const {
52  assert((id_ & 0x80000000) == 0);
53  return ((id_ >> 4) & 0x3) + 1;
54  }
55 
56  //These methods only for BPix
57  int sec() const {
58  assert((id_ & 0x80000000) != 0);
59  return ((id_ >> 14) & 0x7) + 1;
60  }
61  int layer() const {
62  assert((id_ & 0x80000000) != 0);
63  return (id_ >> 12) & 0x3;
64  }
65  int ladder() const {
66  assert((id_ & 0x80000000) != 0);
67  return (id_ >> 6) & 0x1f;
68  }
69  char HF() const {
70  assert((id_ & 0x80000000) != 0);
71  return id_ & 0x00000800 ? 'F' : 'H';
72  }
73  int module() const {
74  assert((id_ & 0x80000000) != 0);
75  return ((id_ >> 4) & 0x3) + 1;
76  }
77 
78  friend std::ostream& pos::operator<<(std::ostream& s, const PixelROCName& pixelroc);
79 
80  const PixelROCName& operator=(const PixelROCName& aROC);
81 
82  const bool operator<(const PixelROCName& aROC) const { return id_ < aROC.id_; }
83 
84  const bool operator==(const PixelROCName& aROC) const { return id_ == aROC.id_; }
85 
86  unsigned int id() const { return id_; }
87 
88  private:
90 
91  void check(bool check, const std::string& name);
92 
93  void setIdFPix(char np, char LR, int disk, int blade, int panel, int plaquet, int roc);
94 
95  void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc);
96 
97  //BPix_BpI_SEC1_LYR1_LDR3F_MOD1_ROC0
98 
99  //The id_ holds the following values for BPix
100  //bit [0,1,2,3] the ROC #
101  //bit [4,5] the module#
102  //bit [6,7,8,9,10] the ladder#
103  //bit [11] H or F (0 or 1)#
104  //bit [12,13] the layer#
105  //bit [14,15,16] the section#
106  //bit [29] I or 0 (0 or 1)
107  //bit [30] m or p (0 or 1)
108  //bit [31] = 1
109 
110  //FPix_BpI_D1_BLD1_PNL1_PLQ1_ROC1
111 
112  //The id_ holds the following values for FPix
113  //bit [0,1,2,3] the ROC #
114  //bit [4,5] the plaquet#
115  //bit [6] the panel#
116  //bit [7,8,9,10,11] the blade#
117  //bit [12,13] the disk#
118  //bit [29] I or O (0 or 1)
119  //bit [30] m or p (0 or 1)
120  //bit [31] = 0
121 
122  unsigned int id_;
123  };
124 } // namespace pos
125 #endif
pos::PixelROCName::parsename
void parsename(std::string name)
Definition: PixelROCName.cc:97
pos::PixelROCName::rocname
std::string rocname() const
Definition: PixelROCName.cc:235
pos::PixelROCName::setIdBPix
void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc)
Definition: PixelROCName.cc:51
pos::PixelROCName::id
unsigned int id() const
Definition: PixelROCName.h:86
pos::PixelROCName::PixelROCName
PixelROCName()
Definition: PixelROCName.cc:17
pos::PixelROCName::disk
int disk() const
Definition: PixelROCName.h:39
pos::PixelROCName::layer
int layer() const
Definition: PixelROCName.h:61
pos::PixelROCName::ladder
int ladder() const
Definition: PixelROCName.h:65
pos::PixelROCName::roc
int roc() const
Definition: PixelROCName.h:36
pos
Definition: PixelAliasList.h:18
np
int np
Definition: AMPTWrapper.h:43
cms::cuda::assert
assert(be >=bs)
pos::PixelROCName::IO
char IO() const
Definition: PixelROCName.h:35
pos::PixelROCName::operator==
const bool operator==(const PixelROCName &aROC) const
Definition: PixelROCName.h:84
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
pos::PixelROCName::check
void check(bool check, const std::string &name)
Definition: PixelROCName.cc:85
pos::PixelROCName::operator<
const bool operator<(const PixelROCName &aROC) const
Definition: PixelROCName.h:82
pos::PixelROCName::plaquet
int plaquet() const
Definition: PixelROCName.h:51
pos::PixelROCName::panel
int panel() const
Definition: PixelROCName.h:47
pos::PixelROCName::id_
unsigned int id_
Definition: PixelROCName.h:122
pos::PixelROCName::mp
char mp() const
Definition: PixelROCName.h:34
pos::PixelROCName::module
int module() const
Definition: PixelROCName.h:73
pos::operator<<
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
Definition: PixelCalibConfiguration.cc:1325
pos::PixelROCName
This class implements..
Definition: PixelROCName.h:23
pos::PixelROCName::blade
int blade() const
Definition: PixelROCName.h:43
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pos::PixelROCName::setIdFPix
void setIdFPix(char np, char LR, int disk, int blade, int panel, int plaquet, int roc)
Definition: PixelROCName.cc:21
pos::PixelROCName::operator=
const PixelROCName & operator=(const PixelROCName &aROC)
Definition: PixelROCName.cc:290
pos::PixelROCName::detsub
char detsub() const
Definition: PixelROCName.h:33
pos::PixelROCName::HF
char HF() const
Definition: PixelROCName.h:69
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pos::PixelROCName::sec
int sec() const
Definition: PixelROCName.h:57