CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Friends

pos::PixelROCName Class Reference

This class implements.. More...

#include <interface/PixelROCName.h>

List of all members.

Public Member Functions

int blade () const
char detsub () const
int disk () const
char HF () const
unsigned int id () const
char IO () const
int ladder () const
int layer () const
int module () const
char mp () const
const bool operator< (const PixelROCName &aROC) const
const PixelROCNameoperator= (const PixelROCName &aROC)
const bool operator== (const PixelROCName &aROC) const
int panel () const
 PixelROCName (std::string rocname)
 PixelROCName ()
 PixelROCName (std::ifstream &s)
int plaquet () const
int roc () const
std::string rocname () const
int sec () const

Private Member Functions

void check (bool check, const std::string &name)
void parsename (std::string name)
void setIdBPix (char np, char LR, int sec, int layer, int ladder, char HF, int module, int roc)
void setIdFPix (char np, char LR, int disk, int blade, int panel, int plaquet, int roc)

Private Attributes

unsigned int id_

Friends

std::ostream & pos::operator<< (std::ostream &s, const PixelROCName &pixelroc)

Detailed Description

This class implements..

A longer explanation will be placed here later

Definition at line 23 of file PixelROCName.h.


Constructor & Destructor Documentation

PixelROCName::PixelROCName ( )

Definition at line 18 of file PixelROCName.cc.

                          :
    id_(0)
{}
PixelROCName::PixelROCName ( std::string  rocname) [explicit]

Definition at line 22 of file PixelROCName.cc.

References parsename().

PixelROCName::PixelROCName ( std::ifstream &  s) [explicit]

Definition at line 248 of file PixelROCName.cc.

References parsename(), and tmp.

                                        {

    std::string tmp;

    s >> tmp;

    parsename(tmp);

}

Member Function Documentation

int pos::PixelROCName::blade ( ) const [inline]

Definition at line 43 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)==0); return (id_>>7)&0x1f;}    
void pos::PixelROCName::check ( bool  check,
const std::string &  name 
) [private]
char pos::PixelROCName::detsub ( ) const [inline]

Definition at line 36 of file PixelROCName.h.

References id_.

Referenced by rocname().

{return (id_&0x80000000)?'B':'F';}    
int pos::PixelROCName::disk ( ) const [inline]

Definition at line 42 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)==0); return (id_>>12)&0x3;}    
char pos::PixelROCName::HF ( ) const [inline]

Definition at line 51 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)!=0); return id_&0x00000800?'F':'H';}
unsigned int pos::PixelROCName::id ( void  ) const [inline]

Definition at line 68 of file PixelROCName.h.

References id_.

Referenced by pos::PixelModuleName::PixelModuleName().

{return id_;}
char pos::PixelROCName::IO ( ) const [inline]

Definition at line 38 of file PixelROCName.h.

References id_.

Referenced by rocname().

{return id_&0x20000000?'I':'O';}    
int pos::PixelROCName::ladder ( ) const [inline]

Definition at line 50 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)!=0); return (id_>>6)&0x1f;}    
int pos::PixelROCName::layer ( ) const [inline]

Definition at line 49 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)!=0); return (id_>>12)&0x3;}    
int pos::PixelROCName::module ( ) const [inline]

Definition at line 52 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)!=0); return ((id_>>4)&0x3)+1;}    
char pos::PixelROCName::mp ( ) const [inline]

Definition at line 37 of file PixelROCName.h.

References id_.

Referenced by rocname().

{return id_&0x40000000?'p':'m';}    
const bool pos::PixelROCName::operator< ( const PixelROCName aROC) const [inline]

Definition at line 60 of file PixelROCName.h.

References id_.

                                                        {
      return id_<aROC.id_;
    }
const PixelROCName & PixelROCName::operator= ( const PixelROCName aROC)

Definition at line 322 of file PixelROCName.cc.

References id_.

                                                                   {
    
    id_=aROC.id_;

    return *this;

}
const bool pos::PixelROCName::operator== ( const PixelROCName aROC) const [inline]

Definition at line 64 of file PixelROCName.h.

References id_.

                                                         {
      return id_==aROC.id_;
    }
int pos::PixelROCName::panel ( ) const [inline]

Definition at line 44 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)==0); return ((id_>>6)&0x1)+1;}    
void PixelROCName::parsename ( std::string  name) [private]

Definition at line 113 of file PixelModuleName.cc.

References pos::PixelModuleName::check(), pos::PixelModuleName::disk(), pos::PixelModuleName::HF(), pos::PixelModuleName::ladder(), pos::PixelModuleName::layer(), runTheMatrix::np, evf::evtn::offset(), pos::PixelModuleName::sec(), pos::PixelModuleName::setIdBPix(), and pos::PixelModuleName::setIdFPix().

Referenced by PixelROCName().

                                          {

   //
    // The name should be on the format
    //
    // FPix_BpR_D1_BLD1_PNL1
    //

    //cout << "ROC name:"<<name<<endl;

    check(name[0]=='F'||name[0]=='B',name);

    if (name[0]=='F'){
        check(name[0]=='F',name);
        check(name[1]=='P',name);
        check(name[2]=='i',name);
        check(name[3]=='x',name);
        check(name[4]=='_',name);
        check(name[5]=='B',name);
        check((name[6]=='m')||(name[6]=='p'),name);
        char np=name[6];
        check((name[7]=='I')||(name[7]=='O'),name);
        char LR=name[7];
        check(name[8]=='_',name);
        check(name[9]=='D',name);
        char digit[2]={0,0};
        digit[0]=name[10];
        int disk=atoi(digit);
        check(name[11]=='_',name);
        check(name[12]=='B',name);
        check(name[13]=='L',name);
        check(name[14]=='D',name);
        check(isdigit(name[15]),name);
        digit[0]=name[15];
        int bld=atoi(digit);
        unsigned int offset=0;
        if (isdigit(name[16])){
            digit[0]=name[16];
            bld=10*bld+atoi(digit);
            offset++;
        }

        check(name[16+offset]=='_',name);
        check(name[17+offset]=='P',name);
        check(name[18+offset]=='N',name);
        check(name[19+offset]=='L',name);
        check(isdigit(name[20+offset]),name);
        digit[0]=name[20+offset];
        int pnl=atoi(digit);
    
        setIdFPix(np,LR,disk,bld,pnl);
    }
    else{
        check(name[0]=='B',name);
        check(name[1]=='P',name);
        check(name[2]=='i',name);
        check(name[3]=='x',name);
        check(name[4]=='_',name);
        check(name[5]=='B',name);
        check((name[6]=='m')||(name[6]=='p'),name);
        char np=name[6];
        check((name[7]=='I')||(name[7]=='O'),name);
        char LR=name[7];
        check(name[8]=='_',name);
        check(name[9]=='S',name);
        check(name[10]=='E',name);
        check(name[11]=='C',name);
        char digit[2]={0,0};
        digit[0]=name[12];
        int sec=atoi(digit);
        check(name[13]=='_',name);
        check(name[14]=='L',name);
        check(name[15]=='Y',name);
        check(name[16]=='R',name);
        check(isdigit(name[17]),name);
        digit[0]=name[17];
        int layer=atoi(digit);
        check(name[18]=='_',name);
        check(name[19]=='L',name);
        check(name[20]=='D',name);
        check(name[21]=='R',name);
        check(isdigit(name[22]),name);
        digit[0]=name[22];
        int ladder=atoi(digit);
        unsigned int offset=0;
        if (isdigit(name[23])){
            offset++;
            digit[0]=name[22+offset];
            ladder=10*ladder+atoi(digit);
        }
        check(name[23+offset]=='H'||name[23+offset]=='F',name);
        char HF=name[23+offset];
        check(name[24+offset]=='_',name);
        check(name[25+offset]=='M',name);
        check(name[26+offset]=='O',name);
        check(name[27+offset]=='D',name);
        check(isdigit(name[28+offset]),name);
        digit[0]=name[28+offset];
        int module=atoi(digit);
        setIdBPix(np,LR,sec,layer,ladder,HF,module);
    }

}
int pos::PixelROCName::plaquet ( ) const [inline]

Definition at line 45 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)==0); return ((id_>>4)&0x3)+1;}    
int pos::PixelROCName::roc ( ) const [inline]

Definition at line 39 of file PixelROCName.h.

References id_.

Referenced by rocname(), setIdBPix(), and setIdFPix().

{return id_&0xf;}    
std::string PixelROCName::rocname ( ) const

Definition at line 259 of file PixelROCName.cc.

References blade(), detsub(), disk(), HF(), IO(), ladder(), layer(), module(), mp(), panel(), plaquet(), roc(), asciidump::s, and sec().

Referenced by pos::operator<<(), pos::PixelNameTranslation::PixelNameTranslation(), pos::PixelTBMSettings::writeASCII(), pos::PixelROCTrimBits::writeASCII(), pos::PixelROCMaskBits::writeASCII(), pos::PixelROCTrimBits::writeBinary(), pos::PixelTBMSettings::writeBinary(), pos::PixelROCMaskBits::writeBinary(), pos::PixelROCMaskBits::writeXML(), pos::PixelROCTrimBits::writeXML(), and pos::PixelTBMSettings::writeXML().

                                     {

    std::string s;

    std::ostringstream s1;

    if (detsub()=='F') {
        s1<<"FPix"; 
        s1<<"_B";
        s1<<mp();
        s1<<IO();
        s1<<"_D";
        s1<<disk();
        s1<<"_BLD";
        s1<<blade();
        s1<<"_PNL";
        s1<<panel();
        s1<<"_PLQ";
        s1<<plaquet();
        s1<<"_ROC";
        s1<<roc();

        assert(roc()>=0&&roc()<=10);
    }
    else{
        s1<<"BPix"; 
        s1<<"_B";
        s1<<mp();
        s1<<IO();
        s1<<"_SEC";
        s1<<sec();
        s1<<"_LYR";
        s1<<layer();
        s1<<"_LDR";
        s1<<ladder();
        s1<<HF();
        s1<<"_MOD";
        s1<<module();
        s1<<"_ROC";
        s1<<roc();
        
        assert(roc()>=0&&roc()<=15);
    }

    s=s1.str();
   
    return s;

} 
int pos::PixelROCName::sec ( ) const [inline]

Definition at line 48 of file PixelROCName.h.

References id_.

Referenced by rocname().

{assert((id_&0x80000000)!=0); return ((id_>>14)&0x7)+1;}    
void PixelROCName::setIdBPix ( char  np,
char  LR,
int  sec,
int  layer,
int  ladder,
char  HF,
int  module,
int  roc 
) [private]

Definition at line 62 of file PixelROCName.cc.

References id_, and roc().

                                                 {

    id_=0;

    //std::cout<< __LINE__ << "]\t" << mthn <<"BPix ladder:"<<ladder<<std::endl; 
    //std::cout<< __LINE__ << "]\t" << mthn <<"np  : " << np   << std::endl; 
    //std::cout<< __LINE__ << "]\t" << mthn <<"LR  : " << LR   << std::endl; 
    //std::cout<< __LINE__ << "]\t" << mthn <<"disk: " << disk << std::endl; 

    
    assert(roc>=0&&roc<16);

    id_=0x80000000;

    if (np=='p') id_=(id_|0x40000000);
    //std::cout<< __LINE__ << "]\t" << mthn <<"2 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    if (LR=='I') id_=(id_|0x20000000);
    //std::cout<< __LINE__ << "]\t" << mthn <<"3 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|((sec-1)<<14));
    //std::cout<< __LINE__ << "]\t" << mthn <<"4 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    if (HF=='F') id_=(id_|0x00000800);

    id_=(id_|(layer<<12));
    //std::cout<< __LINE__ << "]\t" << mthn <<"5 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|(ladder<<6));
    //std::cout<< __LINE__ << "]\t" << mthn <<"6 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|((module-1)<<4));
    //std::cout<< __LINE__ << "]\t" << mthn <<"7 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|roc);

    //std::cout<< __LINE__ << "]\t" << mthn <<"final id_="<<std::hex<<id_<<std::dec<<std::endl; 

}
void PixelROCName::setIdFPix ( char  np,
char  LR,
int  disk,
int  blade,
int  panel,
int  plaquet,
int  roc 
) [private]

Definition at line 29 of file PixelROCName.cc.

References id_, and roc().

                                                                    {

    std::string mthn = "[PixelROCName::setIdFPix()]\t\t\t\t    " ;
    id_=0;

    //std::cout << __LINE__ << "]\t" << mthn << "subdet: " << subdet << std::endl; 
    //std::cout << __LINE__ << "]\t" << mthn << "np    : " << np     << std::endl;
    //std::cout << __LINE__ << "]\t" << mthn << "LR    : " << LR     << std::endl;
    //std::cout << __LINE__ << "]\t" << mthn << "disk  : " << disk   << std::endl;

    
    assert(roc>=0&&roc<10);

    if (np=='p') id_=(id_|0x40000000);
    //std::cout<< __LINE__ << "]\t" << mthn <<"2 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    if (LR=='I') id_=(id_|0x20000000);
    //std::cout<< __LINE__ << "]\t" << mthn <<"3 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|(disk<<12));
    //std::cout<< __LINE__ << "]\t" << mthn <<"4 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|(blade<<7));
    //std::cout<< __LINE__ << "]\t" << mthn <<"5 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|((panel-1)<<6));
    //std::cout<< __LINE__ << "]\t" << mthn <<"6 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|((plaquet-1)<<4));
    //std::cout<< __LINE__ << "]\t" << mthn <<"7 id_="<<std::hex<<id_<<std::dec<<std::endl; 
    id_=(id_|roc);

    //std::cout<< __LINE__ << "]\t" << mthn <<"final id_="<<std::hex<<id_<<std::dec<<std::endl; 

}

Friends And Related Function Documentation

std::ostream& pos::operator<< ( std::ostream &  s,
const PixelROCName pixelroc 
) [friend]

Member Data Documentation

unsigned int pos::PixelROCName::id_ [private]