CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
25  public:
26 
27  PixelROCName();
28 
29  explicit PixelROCName(std::string rocname);
30 
31 
32  explicit PixelROCName(std::ifstream& s);
33 
34  std::string rocname() const;
35 
36  char detsub() const {return (id_&0x80000000)?'B':'F';}
37  char mp() const {return id_&0x40000000?'p':'m';}
38  char IO() const {return id_&0x20000000?'I':'O';}
39  int roc() const {return id_&0xf;}
40 
41  //These methods only for FPix
42  int disk() const {assert((id_&0x80000000)==0); return (id_>>12)&0x3;}
43  int blade() const {assert((id_&0x80000000)==0); return (id_>>7)&0x1f;}
44  int panel() const {assert((id_&0x80000000)==0); return ((id_>>6)&0x1)+1;}
45  int plaquet() const {assert((id_&0x80000000)==0); return ((id_>>4)&0x3)+1;}
46 
47  //These methods only for BPix
48  int sec() const {assert((id_&0x80000000)!=0); return ((id_>>14)&0x7)+1;}
49  int layer() const {assert((id_&0x80000000)!=0); return (id_>>12)&0x3;}
50  int ladder() const {assert((id_&0x80000000)!=0); return (id_>>6)&0x1f;}
51  char HF() const {assert((id_&0x80000000)!=0); return id_&0x00000800?'F':'H';}
52  int module() const {assert((id_&0x80000000)!=0); return ((id_>>4)&0x3)+1;}
53 
54 
55  friend std::ostream& pos::operator<<(std::ostream& s, const PixelROCName& pixelroc);
56 
57 
58  const PixelROCName& operator=(const PixelROCName& aROC);
59 
60  const bool operator<(const PixelROCName& aROC) const{
61  return id_<aROC.id_;
62  }
63 
64  const bool operator==(const PixelROCName& aROC) const{
65  return id_==aROC.id_;
66  }
67 
68  unsigned int id() const {return id_;}
69 
70  private:
71 
72  void parsename(std::string name);
73 
74  void check(bool check, const std::string& name);
75 
76  void setIdFPix(char np, char LR,int disk,
77  int blade, int panel, int plaquet, int roc);
78 
79  void setIdBPix(char np, char LR,int sec,
80  int layer, int ladder, char HF,
81  int module, int roc);
82 
83 
84 
85  //BPix_BpI_SEC1_LYR1_LDR3F_MOD1_ROC0
86 
87 
88  //The id_ holds the following values for BPix
89  //bit [0,1,2,3] the ROC #
90  //bit [4,5] the module#
91  //bit [6,7,8,9,10] the ladder#
92  //bit [11] H or F (0 or 1)#
93  //bit [12,13] the layer#
94  //bit [14,15,16] the section#
95  //bit [29] I or 0 (0 or 1)
96  //bit [30] m or p (0 or 1)
97  //bit [31] = 1
98 
99 
100  //FPix_BpI_D1_BLD1_PNL1_PLQ1_ROC1
101 
102  //The id_ holds the following values for FPix
103  //bit [0,1,2,3] the ROC #
104  //bit [4,5] the plaquet#
105  //bit [6] the panel#
106  //bit [7,8,9,10,11] the blade#
107  //bit [12,13] the disk#
108  //bit [29] I or O (0 or 1)
109  //bit [30] m or p (0 or 1)
110  //bit [31] = 0
111 
112  unsigned int id_;
113 
114  };
115 }
116 #endif
void setIdFPix(char np, char LR, int disk, int blade, int panel, int plaquet, int roc)
Definition: PixelROCName.cc:29
int plaquet() const
Definition: PixelROCName.h:45
int ladder() const
Definition: PixelROCName.h:50
const PixelROCName & operator=(const PixelROCName &aROC)
int panel() const
Definition: PixelROCName.h:44
unsigned int id() const
Definition: PixelROCName.h:68
const bool operator<(const PixelROCName &aROC) const
Definition: PixelROCName.h:60
unsigned int id_
Definition: PixelROCName.h:112
void setIdBPix(char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc)
Definition: PixelROCName.cc:62
int layer() const
Definition: PixelROCName.h:49
int blade() const
Definition: PixelROCName.h:43
char IO() const
Definition: PixelROCName.h:38
std::string rocname() const
std::ostream & operator<<(std::ostream &s, const PixelCalibConfiguration &calib)
int np
Definition: AMPTWrapper.h:33
char HF() const
Definition: PixelROCName.h:51
int module() const
Definition: PixelROCName.h:52
void check(bool check, const std::string &name)
Definition: PixelROCName.cc:99
int roc() const
Definition: PixelROCName.h:39
void parsename(std::string name)
const bool operator==(const PixelROCName &aROC) const
Definition: PixelROCName.h:64
int sec() const
Definition: PixelROCName.h:48
This class implements..
Definition: PixelROCName.h:23
int disk() const
Definition: PixelROCName.h:42
char detsub() const
Definition: PixelROCName.h:36
Definition: vlib.h:209
char mp() const
Definition: PixelROCName.h:37