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
00022 public:
00023
00024 PixelROCName();
00025
00026 explicit PixelROCName(std::string rocname);
00027
00028
00029 explicit PixelROCName(std::ifstream& s);
00030
00031 std::string rocname() const;
00032
00033 char detsub() const {return (id_&0x80000000)?'B':'F';}
00034 char mp() const {return id_&0x40000000?'p':'m';}
00035 char IO() const {return id_&0x20000000?'I':'O';}
00036 int roc() const {return id_&0xf;}
00037
00038
00039 int disk() const {assert((id_&0x80000000)==0); return (id_>>12)&0x3;}
00040 int blade() const {assert((id_&0x80000000)==0); return (id_>>7)&0x1f;}
00041 int panel() const {assert((id_&0x80000000)==0); return ((id_>>6)&0x1)+1;}
00042 int plaquet() const {assert((id_&0x80000000)==0); return ((id_>>4)&0x3)+1;}
00043
00044
00045 int sec() const {assert((id_&0x80000000)!=0); return ((id_>>14)&0x7)+1;}
00046 int layer() const {assert((id_&0x80000000)!=0); return (id_>>12)&0x3;}
00047 int ladder() const {assert((id_&0x80000000)!=0); return (id_>>6)&0x1f;}
00048 char HF() const {assert((id_&0x80000000)!=0); return id_&0x00000800?'F':'H';}
00049 int module() const {assert((id_&0x80000000)!=0); return ((id_>>4)&0x3)+1;}
00050
00051
00052 friend std::ostream& pos::operator<<(std::ostream& s, const PixelROCName& pixelroc);
00053
00054
00055 const PixelROCName& operator=(const PixelROCName& aROC);
00056
00057 const bool operator<(const PixelROCName& aROC) const{
00058 return id_<aROC.id_;
00059 }
00060
00061 const bool operator==(const PixelROCName& aROC) const{
00062 return id_==aROC.id_;
00063 }
00064
00065 unsigned int id() const {return id_;}
00066
00067 private:
00068
00069 void parsename(std::string name);
00070
00071 void check(bool check, const std::string& name);
00072
00073 void setIdFPix(char np, char LR,int disk,
00074 int blade, int panel, int plaquet, int roc);
00075
00076 void setIdBPix(char np, char LR,int sec,
00077 int layer, int ladder, char HF,
00078 int module, int roc);
00079
00080
00081
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 unsigned int id_;
00110
00111 };
00112 std::ostream& operator<<(std::ostream& s, const PixelROCName& pixelroc);
00113 }
00114 #endif