CMS 3D CMS Logo

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