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 bool operator<(const PixelROCName& aROC) const { return id_ < aROC.id_; }
81 
82  const bool operator==(const PixelROCName& aROC) const { return id_ == aROC.id_; }
83 
84  unsigned int id() const { return id_; }
85 
86  private:
88 
89  void check(bool check, const std::string& name);
90 
91  void setIdFPix(char np, char LR, int disk, int blade, int panel, int plaquet, int roc);
92 
93  void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc);
94 
95  //BPix_BpI_SEC1_LYR1_LDR3F_MOD1_ROC0
96 
97  //The id_ holds the following values for BPix
98  //bit [0,1,2,3] the ROC #
99  //bit [4,5] the module#
100  //bit [6,7,8,9,10] the ladder#
101  //bit [11] H or F (0 or 1)#
102  //bit [12,13] the layer#
103  //bit [14,15,16] the section#
104  //bit [29] I or 0 (0 or 1)
105  //bit [30] m or p (0 or 1)
106  //bit [31] = 1
107 
108  //FPix_BpI_D1_BLD1_PNL1_PLQ1_ROC1
109 
110  //The id_ holds the following values for FPix
111  //bit [0,1,2,3] the ROC #
112  //bit [4,5] the plaquet#
113  //bit [6] the panel#
114  //bit [7,8,9,10,11] the blade#
115  //bit [12,13] the disk#
116  //bit [29] I or O (0 or 1)
117  //bit [30] m or p (0 or 1)
118  //bit [31] = 0
119 
120  unsigned int id_;
121  };
122 } // namespace pos
123 #endif
void setIdFPix(char np, char LR, int disk, int blade, int panel, int plaquet, int roc)
Definition: PixelROCName.cc:21
unsigned int id_
Definition: PixelROCName.h:120
void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc)
Definition: PixelROCName.cc:51
int roc() const
Definition: PixelROCName.h:36
char detsub() const
Definition: PixelROCName.h:33
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
assert(be >=bs)
char HF() const
Definition: PixelROCName.h:69
int sec() const
Definition: PixelROCName.h:57
unsigned int id() const
Definition: PixelROCName.h:84
int layer() const
Definition: PixelROCName.h:61
int np
Definition: AMPTWrapper.h:43
void check(bool check, const std::string &name)
Definition: PixelROCName.cc:85
void parsename(std::string name)
Definition: PixelROCName.cc:97
std::string rocname() const
int panel() const
Definition: PixelROCName.h:47
char mp() const
Definition: PixelROCName.h:34
char IO() const
Definition: PixelROCName.h:35
int ladder() const
Definition: PixelROCName.h:65
const bool operator<(const PixelROCName &aROC) const
Definition: PixelROCName.h:80
int plaquet() const
Definition: PixelROCName.h:51
int disk() const
Definition: PixelROCName.h:39
This class implements..
Definition: PixelROCName.h:23
const bool operator==(const PixelROCName &aROC) const
Definition: PixelROCName.h:82
int module() const
Definition: PixelROCName.h:73
int blade() const
Definition: PixelROCName.h:43