CMS 3D CMS Logo

PixelROCName.h

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 <assert.h>
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     //These methods only for FPix
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     //These methods only for BPix
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   private:
00066 
00067     void parsename(std::string name);
00068 
00069     void check(bool check, const std::string& name);
00070 
00071     void setIdFPix(char np, char LR,int disk,
00072                    int blade, int panel, int plaquet, int roc);
00073 
00074     void setIdBPix(char np, char LR,int sec,
00075                    int layer, int ladder, char HF, 
00076                    int module, int roc);
00077 
00078     
00079 
00080     //BPix_BpI_SEC1_LYR1_LDR3F_MOD1_ROC0
00081 
00082 
00083     //The id_ holds the following values for BPix
00084     //bit [0,1,2,3] the ROC #
00085     //bit [4,5] the module#
00086     //bit [6,7,8,9,10] the ladder#
00087     //bit [11] H or F (0 or 1)#
00088     //bit [12,13] the layer#
00089     //bit [14,15,16] the section#
00090     //bit [29] I or 0 (0 or 1)
00091     //bit [30] m or p (0 or 1)
00092     //bit [31] = 1
00093 
00094 
00095     //FPix_BpI_D1_BLD1_PNL1_PLQ1_ROC1
00096 
00097     //The id_ holds the following values for FPix
00098     //bit [0,1,2,3] the ROC #
00099     //bit [4,5] the plaquet#
00100     //bit [6] the panel#
00101     //bit [7,8,9,10,11] the blade#
00102     //bit [12,13] the disk#
00103     //bit [29] I or O (0 or 1)
00104     //bit [30] m or p (0 or 1)
00105     //bit [31] = 0
00106 
00107     unsigned int id_;
00108     
00109   };
00110 }
00111 #endif

Generated on Tue Jun 9 17:25:24 2009 for CMSSW by  doxygen 1.5.4