Go to the documentation of this file.00001 #ifndef PixelROCName_h
00002 #define PixelROCName_h
00003
00009 #include <iostream>
00010 #include <fstream>
00011 #include <string>
00012 #include <cassert>
00013
00014 namespace pos{
00020 class PixelROCName;
00021 std::ostream& operator<<(std::ostream& s, const PixelROCName& pixelroc);
00022
00023 class PixelROCName {
00024
00025 public:
00026
00027 PixelROCName();
00028
00029 explicit PixelROCName(std::string rocname);
00030
00031
00032 explicit PixelROCName(std::ifstream& s);
00033
00034 std::string rocname() const;
00035
00036 char detsub() const {return (id_&0x80000000)?'B':'F';}
00037 char mp() const {return id_&0x40000000?'p':'m';}
00038 char IO() const {return id_&0x20000000?'I':'O';}
00039 int roc() const {return id_&0xf;}
00040
00041
00042 int disk() const {assert((id_&0x80000000)==0); return (id_>>12)&0x3;}
00043 int blade() const {assert((id_&0x80000000)==0); return (id_>>7)&0x1f;}
00044 int panel() const {assert((id_&0x80000000)==0); return ((id_>>6)&0x1)+1;}
00045 int plaquet() const {assert((id_&0x80000000)==0); return ((id_>>4)&0x3)+1;}
00046
00047
00048 int sec() const {assert((id_&0x80000000)!=0); return ((id_>>14)&0x7)+1;}
00049 int layer() const {assert((id_&0x80000000)!=0); return (id_>>12)&0x3;}
00050 int ladder() const {assert((id_&0x80000000)!=0); return (id_>>6)&0x1f;}
00051 char HF() const {assert((id_&0x80000000)!=0); return id_&0x00000800?'F':'H';}
00052 int module() const {assert((id_&0x80000000)!=0); return ((id_>>4)&0x3)+1;}
00053
00054
00055 friend std::ostream& pos::operator<<(std::ostream& s, const PixelROCName& pixelroc);
00056
00057
00058 const PixelROCName& operator=(const PixelROCName& aROC);
00059
00060 const bool operator<(const PixelROCName& aROC) const{
00061 return id_<aROC.id_;
00062 }
00063
00064 const bool operator==(const PixelROCName& aROC) const{
00065 return id_==aROC.id_;
00066 }
00067
00068 unsigned int id() const {return id_;}
00069
00070 private:
00071
00072 void parsename(std::string name);
00073
00074 void check(bool check, const std::string& name);
00075
00076 void setIdFPix(char np, char LR,int disk,
00077 int blade, int panel, int plaquet, int roc);
00078
00079 void setIdBPix(char np, char LR,int sec,
00080 int layer, int ladder, char HF,
00081 int module, int roc);
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 unsigned int id_;
00113
00114 };
00115 }
00116 #endif