CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/CalibFormats/SiPixelObjects/interface/PixelFECConfig.h

Go to the documentation of this file.
00001 #ifndef PixelFECConfig_h
00002 #define PixelFECConfig_h
00003 
00009 #include <iostream>
00010 #include <vector>
00011 #include <string>
00012 #include <cassert>
00013 #include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
00014 #include "CalibFormats/SiPixelObjects/interface/PixelFECParameters.h"
00015 
00016 namespace pos{
00024   class PixelFECConfig: public PixelConfigBase {
00025 
00026   public:
00027 
00028     PixelFECConfig(std::string filename);  //  <---- Modified for the conversion from parallel vectors to object that contain the configuration
00029    
00030     PixelFECConfig(std::vector<std::vector<std::string> >& tableMat ); 
00031 
00032     unsigned int getNFECBoards() const;
00033 
00034     unsigned int getFECNumber(unsigned int i) const;
00035     unsigned int getCrate(unsigned int i) const;
00036     unsigned int getVMEBaseAddress(unsigned int i) const;
00037     unsigned int crateFromFECNumber(unsigned int fecnumber) const;
00038     unsigned int VMEBaseAddressFromFECNumber(unsigned int fecnumber) const;
00039     unsigned int getFECSlot(unsigned int i) {return FECSlotFromVMEBaseAddress(getVMEBaseAddress(i));}
00040     unsigned int FECSlotFromFECNumber(unsigned int fecnumber) {return FECSlotFromVMEBaseAddress(VMEBaseAddressFromFECNumber(fecnumber));}
00041 
00042     void writeASCII(std::string dir="") const;
00043     void         writeXML(        pos::PixelConfigKey key, int version, std::string path)  const {;}
00044     virtual void writeXMLHeader(  pos::PixelConfigKey key, 
00045                                   int version, 
00046                                   std::string path, 
00047                                   std::ofstream *out,
00048                                   std::ofstream *out1 = NULL,
00049                                   std::ofstream *out2 = NULL
00050                                   ) const ;
00051     virtual void writeXML(        std::ofstream *out,                                                      
00052                                   std::ofstream *out1 = NULL ,
00053                                   std::ofstream *out2 = NULL ) const ;
00054     virtual void writeXMLTrailer( std::ofstream *out, 
00055                                   std::ofstream *out1 = NULL,
00056                                   std::ofstream *out2 = NULL
00057                                   ) const ;
00058 
00059     //friend std::ostream& operator<<(std::ostream& s, const PixelDetectorconfig& config);
00060 
00061   private:
00062 
00063     // VMEBaseAddress = (FEC slot)x(0x8000000)
00064     unsigned int FECSlotFromVMEBaseAddress(unsigned int VMEBaseAddress) {assert(VMEBaseAddress%0x8000000 == 0); return VMEBaseAddress/0x8000000;}
00065 
00066     //Already fixed from parallel vectors to vector of objects .... the object that contains the FEC config is PixelFECParameters       
00067    
00068     //    std::vector<unsigned int> fecnumber_;   
00069     //    std::vector<unsigned int> crate_;   
00070     //    std::vector<unsigned int> vmebaseaddress_;
00071     
00072     std::vector< PixelFECParameters > fecconfig_;
00073     
00074     
00075  
00076   };
00077 }
00078 /* @} */
00079 #endif