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