CMS 3D CMS Logo

pos::PixelFECConfig Class Reference
["Configuration Objects"]

This class specifies which FEC boards are used and how they are addressed. More...

#include <CalibFormats/SiPixelObjects/interface/PixelFECConfig.h>

Inheritance diagram for pos::PixelFECConfig:

pos::PixelConfigBase

List of all members.

Public Member Functions

unsigned int crateFromFECNumber (unsigned int fecnumber) const
unsigned int FECSlotFromFECNumber (unsigned int fecnumber)
unsigned int getCrate (unsigned int i) const
unsigned int getFECNumber (unsigned int i) const
unsigned int getFECSlot (unsigned int i)
unsigned int getNFECBoards () const
unsigned int getVMEBaseAddress (unsigned int i) const
 PixelFECConfig (std::vector< std::vector< std::string > > &tableMat)
 PixelFECConfig (std::string filename)
unsigned int VMEBaseAddressFromFECNumber (unsigned int fecnumber) const
void writeASCII (std::string dir="") const
virtual void writeXML (std::ofstream *out) const
void writeXML (pos::PixelConfigKey key, int version, std::string path) const
virtual void writeXMLHeader (pos::PixelConfigKey key, int version, std::string path, std::ofstream *out) const
virtual void writeXMLTrailer (std::ofstream *out) const

Private Member Functions

unsigned int FECSlotFromVMEBaseAddress (unsigned int VMEBaseAddress)

Private Attributes

std::vector< PixelFECParametersfecconfig_


Detailed Description

This class specifies which FEC boards are used and how they are addressed.

" "

Definition at line 24 of file PixelFECConfig.h.


Constructor & Destructor Documentation

PixelFECConfig::PixelFECConfig ( std::string  filename  ) 

Definition at line 87 of file PixelFECConfig.cc.

References GenMuonPlsPt100GeV_cfg::cout, dummy, lat::endl(), fecconfig_, in, pos::PixelFECParameters::setFECParameters(), and tmp.

00087                                                 :
00088     PixelConfigBase(" "," "," "){
00089 
00090     std::ifstream in(filename.c_str());
00091 
00092     if (!in.good()){
00093         std::cout << "[PixelFECConfig::PixelFECConfig()]\t\t\t    Could not open: "<<filename<<std::endl;
00094         assert(0);
00095     }
00096     else {
00097         std::cout << "[PixelFECConfig::PixelFECConfig()]\t\t\t    Opened: "<<filename<<std::endl;
00098     }
00099 
00100     std::string dummy;
00101 
00102     in >> dummy;
00103     in >> dummy;
00104     in >> dummy;
00105     in >> dummy;
00106     in >> dummy;
00107     in >> dummy;
00108 
00109     do {
00110         
00111         unsigned int fecnumber;
00112         unsigned int crate;
00113         unsigned int vme_base_address;
00114 
00115         in >> fecnumber >> crate >> std::hex>> vme_base_address >>std::dec ;
00116 
00117         if (!in.eof() ){
00118             //std::cout << fecnumber <<" "<< crate << " "  
00119             //      << std::hex << vme_base_address<<std::dec<<std::endl;
00120             
00121             PixelFECParameters tmp;
00122             
00123             tmp.setFECParameters(fecnumber , crate , vme_base_address);
00124             
00125             fecconfig_.push_back(tmp);
00126         }
00127 
00128     }
00129     while (!in.eof());
00130     in.close();
00131 }
 

PixelFECConfig::PixelFECConfig ( std::vector< std::vector< std::string > > &  tableMat  ) 

CONFIG_KEY_ID NOT NULL NUMBER(38) CONFIG_KEY NOT NULL VARCHAR2(80) VERSION VARCHAR2(40) KIND_OF_COND NOT NULL VARCHAR2(40) PIXEL_FEC NOT NULL VARCHAR2(200) CRATE NOT NULL NUMBER(38) SLOT_NUMBER NOT NULL NUMBER(38) VME_ADDRS_HEX VARCHAR2(17)

Definition at line 17 of file PixelFECConfig.cc.

References c, TestMuL1L2Filter_cff::cerr, lat::endl(), fecconfig_, n, r, and tmp.

00017                                                                           : PixelConfigBase(" "," "," "){
00018 
00019  std::map<std::string , int > colM;
00020  std::vector<std::string > colNames;
00032  colNames.push_back("CONFIG_KEY_ID"  );
00033  colNames.push_back("CONFIG_KEY"     );
00034  colNames.push_back("VERSION"        );
00035  colNames.push_back("KIND_OF_COND"   );
00036  colNames.push_back("PIXEL_FEC"      );
00037  colNames.push_back("CRATE"          );
00038  colNames.push_back("SLOT_NUMBER"    );
00039  colNames.push_back("VME_ADDRS_HEX"  );
00040 
00041 
00042  for(unsigned int c = 0 ; c < tableMat[0].size() ; c++)
00043    {
00044      for(unsigned int n=0; n<colNames.size(); n++)
00045        {
00046          if(tableMat[0][c] == colNames[n]){
00047            colM[colNames[n]] = c;
00048            break;
00049          }
00050        }
00051    }//end for
00052  for(unsigned int n=0; n<colNames.size(); n++)
00053    {
00054      if(colM.find(colNames[n]) == colM.end()){
00055        std::cerr << "[PixelFECConfig::PixelFECConfig()]\tCouldn't find in the database the column with name " << colNames[n] << std::endl;
00056        assert(0);
00057      }
00058    }
00059 
00060  fecconfig_.clear();
00061  for(unsigned int r = 1 ; r < tableMat.size() ; r++)    //Goes to every row of the Matrix
00062    {
00063      unsigned int fecnumber;
00064      unsigned int crate;
00065      unsigned int vme_base_address;
00066      
00067 //      01234567890123
00068 //      BPix_Pxl_FEC_1
00069      string fullFECName = tableMat[r][colM["PIXEL_FEC"]] ;
00070      fullFECName.replace(0,13,"") ;
00071      fecnumber = atoi(fullFECName.c_str()) ;
00072      crate     = atoi(tableMat[r][colM["CRATE"]].c_str()) ;
00073      string hexVMEAddr = tableMat[r][colM["VME_ADDRS_HEX"]] ;
00074      sscanf(hexVMEAddr.c_str(), "%x", &vme_base_address) ;
00075      PixelFECParameters tmp;
00076      
00077      tmp.setFECParameters(fecnumber , crate , vme_base_address);
00078      
00079      fecconfig_.push_back(tmp);
00080    }
00081  
00082 }// end contructor


Member Function Documentation

unsigned int PixelFECConfig::crateFromFECNumber ( unsigned int  fecnumber  )  const

Definition at line 174 of file PixelFECConfig.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fecconfig_, getCrate(), getFECNumber(), and i.

Referenced by pos::PixelCalibConfiguration::getFECCrates().

00174                                                                            {
00175 
00176     for(unsigned int i=0;i<fecconfig_.size();i++){
00177         if (fecconfig_[i].getFECNumber()==fecnumber) return fecconfig_[i].getCrate();
00178     }
00179 
00180     std::cout << "Could not find FEC number:"<<fecnumber<<std::endl;
00181 
00182     assert(0);
00183 
00184     return 0;
00185 
00186 }

unsigned int pos::PixelFECConfig::FECSlotFromFECNumber ( unsigned int  fecnumber  )  [inline]

Definition at line 40 of file PixelFECConfig.h.

References FECSlotFromVMEBaseAddress(), and VMEBaseAddressFromFECNumber().

unsigned int pos::PixelFECConfig::FECSlotFromVMEBaseAddress ( unsigned int  VMEBaseAddress  )  [inline, private]

Definition at line 53 of file PixelFECConfig.h.

Referenced by FECSlotFromFECNumber(), and getFECSlot().

00053 {assert(VMEBaseAddress%0x8000000 == 0); return VMEBaseAddress/0x8000000;}

unsigned int PixelFECConfig::getCrate ( unsigned int  i  )  const

Definition at line 158 of file PixelFECConfig.cc.

References fecconfig_.

Referenced by crateFromFECNumber().

00158                                                          {
00159 
00160     assert(i<fecconfig_.size());
00161     return fecconfig_[i].getCrate();
00162 
00163 }

unsigned int PixelFECConfig::getFECNumber ( unsigned int  i  )  const

Definition at line 150 of file PixelFECConfig.cc.

References fecconfig_.

Referenced by crateFromFECNumber(), and VMEBaseAddressFromFECNumber().

00150                                                              {
00151 
00152     assert(i<fecconfig_.size());
00153     return fecconfig_[i].getFECNumber();
00154 
00155 }

unsigned int pos::PixelFECConfig::getFECSlot ( unsigned int  i  )  [inline]

Definition at line 39 of file PixelFECConfig.h.

References FECSlotFromVMEBaseAddress(), and getVMEBaseAddress().

unsigned int PixelFECConfig::getNFECBoards (  )  const

Definition at line 144 of file PixelFECConfig.cc.

References fecconfig_.

00144                                                 {
00145 
00146     return fecconfig_.size();
00147 
00148 }

unsigned int PixelFECConfig::getVMEBaseAddress ( unsigned int  i  )  const

Definition at line 166 of file PixelFECConfig.cc.

References fecconfig_.

Referenced by getFECSlot(), and VMEBaseAddressFromFECNumber().

00166                                                                   {
00167 
00168     assert(i<fecconfig_.size());
00169     return fecconfig_[i].getVMEBaseAddress();
00170 
00171 }

unsigned int PixelFECConfig::VMEBaseAddressFromFECNumber ( unsigned int  fecnumber  )  const

Definition at line 188 of file PixelFECConfig.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fecconfig_, getFECNumber(), getVMEBaseAddress(), and i.

Referenced by FECSlotFromFECNumber().

00188                                                                                     {
00189 
00190     for(unsigned int i=0;i<fecconfig_.size();i++){
00191         if (fecconfig_[i].getFECNumber()==fecnumber) return fecconfig_[i].getVMEBaseAddress();
00192     }
00193 
00194     std::cout << "Could not find FEC number:"<<fecnumber<<std::endl;
00195 
00196     assert(0);
00197 
00198     return 0;
00199 
00200 }

void PixelFECConfig::writeASCII ( std::string  dir = ""  )  const [virtual]

Implements pos::PixelConfigBase.

Definition at line 202 of file PixelFECConfig.cc.

References lat::endl(), fecconfig_, EgammaValidation_cff::filename, i, and out.

00202                                                    {
00203 
00204   if (dir!="") dir+="/";
00205   std::string filename=dir+"fecconfig.dat";
00206   std::ofstream out(filename.c_str());
00207 
00208   std::vector< PixelFECParameters >::const_iterator i=fecconfig_.begin();
00209 
00210   out << "#FEC number     crate     vme base address" << endl;
00211   for(;i!=fecconfig_.end();++i){
00212     out << i->getFECNumber()<<"               "
00213         << i->getCrate()<<"         "
00214         << "0x"<<hex<<i->getVMEBaseAddress()<<dec<<endl;
00215   }
00216 
00217 }

virtual void pos::PixelFECConfig::writeXML ( std::ofstream *  out  )  const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 45 of file PixelFECConfig.h.

00045 {;}

void pos::PixelFECConfig::writeXML ( pos::PixelConfigKey  key,
int  version,
std::string  path 
) const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 43 of file PixelFECConfig.h.

00043 {;}

virtual void pos::PixelFECConfig::writeXMLHeader ( pos::PixelConfigKey  key,
int  version,
std::string  path,
std::ofstream *  out 
) const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 44 of file PixelFECConfig.h.

00044 {;}

virtual void pos::PixelFECConfig::writeXMLTrailer ( std::ofstream *  out  )  const [inline, virtual]

Reimplemented from pos::PixelConfigBase.

Definition at line 46 of file PixelFECConfig.h.

00046 {;}


Member Data Documentation

std::vector< PixelFECParameters > pos::PixelFECConfig::fecconfig_ [private]

Definition at line 61 of file PixelFECConfig.h.

Referenced by crateFromFECNumber(), getCrate(), getFECNumber(), getNFECBoards(), getVMEBaseAddress(), PixelFECConfig(), VMEBaseAddressFromFECNumber(), and writeASCII().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:50:34 2009 for CMSSW by  doxygen 1.5.4