Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:58:12

0001 #ifndef PixelFECConfig_h
0002 #define PixelFECConfig_h
0003 /**
0004 *   \file CalibFormats/SiPixelObjects/interface/PixelFECConfig.h
0005 *   \brief This class specifies which FEC boards are used and how they are addressed
0006 *
0007 *   A longer explanation will be placed here later
0008 */
0009 #include <iostream>
0010 #include <vector>
0011 #include <string>
0012 #include <cassert>
0013 #include "CalibFormats/SiPixelObjects/interface/PixelConfigBase.h"
0014 #include "CalibFormats/SiPixelObjects/interface/PixelFECParameters.h"
0015 
0016 namespace pos {
0017   /*!  \ingroup ConfigurationObjects "Configuration Objects"
0018 *    
0019 *  @{
0020 *
0021 *  \class PixelFECConfig PixelFECConfig.h
0022 *  \brief This class specifies which FEC boards are used and how they are addressed
0023 */
0024   class PixelFECConfig : public PixelConfigBase {
0025   public:
0026     PixelFECConfig(
0027         std::string
0028             filename);  //  <---- Modified for the conversion from parallel vectors to object that contain the configuration
0029 
0030     PixelFECConfig(std::vector<std::vector<std::string> > &tableMat);
0031 
0032     unsigned int getNFECBoards() const;
0033 
0034     unsigned int getFECNumber(unsigned int i) const;
0035     unsigned int getCrate(unsigned int i) const;
0036     unsigned int getVMEBaseAddress(unsigned int i) const;
0037     unsigned int crateFromFECNumber(unsigned int fecnumber) const;
0038     unsigned int VMEBaseAddressFromFECNumber(unsigned int fecnumber) const;
0039     unsigned int getFECSlot(unsigned int i) { return FECSlotFromVMEBaseAddress(getVMEBaseAddress(i)); }
0040     unsigned int FECSlotFromFECNumber(unsigned int fecnumber) {
0041       return FECSlotFromVMEBaseAddress(VMEBaseAddressFromFECNumber(fecnumber));
0042     }
0043 
0044     void writeASCII(std::string dir = "") const override;
0045     void writeXML(pos::PixelConfigKey key, int version, std::string path) const override { ; }
0046     void writeXMLHeader(pos::PixelConfigKey key,
0047                         int version,
0048                         std::string path,
0049                         std::ofstream *out,
0050                         std::ofstream *out1 = nullptr,
0051                         std::ofstream *out2 = nullptr) const override;
0052     void writeXML(std::ofstream *out, std::ofstream *out1 = nullptr, std::ofstream *out2 = nullptr) const override;
0053     void writeXMLTrailer(std::ofstream *out,
0054                          std::ofstream *out1 = nullptr,
0055                          std::ofstream *out2 = nullptr) const override;
0056 
0057     //friend std::ostream& operator<<(std::ostream& s, const PixelDetectorconfig& config);
0058 
0059   private:
0060     // VMEBaseAddress = (FEC slot)x(0x8000000)
0061     unsigned int FECSlotFromVMEBaseAddress(unsigned int VMEBaseAddress) {
0062       assert(VMEBaseAddress % 0x8000000 == 0);
0063       return VMEBaseAddress / 0x8000000;
0064     }
0065 
0066     //Already fixed from parallel vectors to vector of objects .... the object that contains the FEC config is PixelFECParameters
0067 
0068     //    std::vector<unsigned int> fecnumber_;
0069     //    std::vector<unsigned int> crate_;
0070     //    std::vector<unsigned int> vmebaseaddress_;
0071 
0072     std::vector<PixelFECParameters> fecconfig_;
0073   };
0074 }  // namespace pos
0075 /* @} */
0076 #endif