File indexing completed on 2024-04-06 11:58:12
0001 #ifndef PixelFECConfig_h
0002 #define PixelFECConfig_h
0003
0004
0005
0006
0007
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
0018
0019
0020
0021
0022
0023
0024 class PixelFECConfig : public PixelConfigBase {
0025 public:
0026 PixelFECConfig(
0027 std::string
0028 filename);
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
0058
0059 private:
0060
0061 unsigned int FECSlotFromVMEBaseAddress(unsigned int VMEBaseAddress) {
0062 assert(VMEBaseAddress % 0x8000000 == 0);
0063 return VMEBaseAddress / 0x8000000;
0064 }
0065
0066
0067
0068
0069
0070
0071
0072 std::vector<PixelFECParameters> fecconfig_;
0073 };
0074 }
0075
0076 #endif