File indexing completed on 2024-04-06 12:00:05
0001 #ifndef hcal_ConfigurationDatabase_hh_included
0002 #define hcal_ConfigurationDatabase_hh_included 1
0003
0004 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseException.hh"
0005 #include "xercesc/dom/DOMDocument.hpp"
0006 #include <cstdint>
0007 #include <map>
0008 #include <string>
0009 #include <vector>
0010
0011 #ifdef HAVE_XDAQ
0012 #include "log4cplus/logger.h"
0013 #else
0014 #include "CaloOnlineTools/HcalOnlineDb/interface/xdaq_compat.h" // Includes typedef for log4cplus::Logger
0015 #endif
0016
0017 namespace hcal {
0018
0019 class ConfigurationDatabaseImpl;
0020
0021
0022
0023
0024
0025
0026 class ConfigurationDatabase {
0027 public:
0028 ConfigurationDatabase(log4cplus::Logger logger);
0029
0030
0031 void open(const std::string& accessor) noexcept(false);
0032
0033 typedef xercesc::DOMDocument* ApplicationConfig;
0034
0035
0036
0037
0038
0039 ApplicationConfig getApplicationConfig(const std::string& tag,
0040 const std::string& classname,
0041 int instance) noexcept(false);
0042
0043
0044 std::string getConfigurationDocument(const std::string& tag) noexcept(false);
0045
0046
0047
0048 unsigned int getFirmwareChecksum(const std::string& board, unsigned int version) noexcept(false);
0049
0050 void getFirmwareMCS(const std::string& board,
0051 unsigned int version,
0052 std::vector<std::string>& mcsLines) noexcept(false);
0053
0054 typedef enum FPGASelectionEnum { Bottom = 0, Top = 1 } FPGASelection;
0055
0056 struct FPGAId {
0057 FPGAId() {}
0058 FPGAId(int cr, int sl, FPGASelection fp) : crate(cr), slot(sl), fpga(fp) {}
0059 bool operator<(const FPGAId& a) const;
0060 int crate;
0061 int slot;
0062 FPGASelection fpga;
0063 };
0064
0065 typedef enum LUTTypeEnum { LinearizerLUT = 1, CompressionLUT = 2 } LUTType;
0066
0067
0068 struct LUTId : public FPGAId {
0069 LUTId() {}
0070 LUTId(int crate_, int slot_, FPGASelection fpga_, int fiberorslb_, int chan_, LUTType lt)
0071 : FPGAId(crate_, slot_, fpga_), fiber_slb(fiberorslb_), channel(chan_), lut_type(lt) {}
0072 bool operator<(const LUTId& a) const;
0073 int fiber_slb;
0074 int channel;
0075 LUTType lut_type;
0076 };
0077 typedef std::vector<unsigned int> LUT;
0078
0079
0080
0081
0082
0083
0084
0085 void getLUTs(const std::string& tag, int crate, int slot, std::map<LUTId, LUT>& LUTs) noexcept(false);
0086
0087 typedef std::vector<unsigned char> MD5Fingerprint;
0088
0089
0090
0091
0092
0093 void getLUTChecksums(const std::string& tag, std::map<LUTId, MD5Fingerprint>& checksums) noexcept(false);
0094
0095 struct PatternId : public FPGAId {
0096 bool operator<(const PatternId& a) const;
0097 PatternId(int cr, int sl, FPGASelection f, int fib) : FPGAId(cr, sl, f), fiber(fib) {}
0098 int fiber;
0099 };
0100 typedef std::vector<unsigned int> HTRPattern;
0101
0102
0103
0104
0105
0106
0107
0108 void getPatterns(const std::string& tag,
0109 int crate,
0110 int slot,
0111 std::map<PatternId, HTRPattern>& patterns) noexcept(false);
0112
0113
0114 struct ZSChannelId : public FPGAId {
0115 ZSChannelId() {}
0116 ZSChannelId(int crate_, int slot_, FPGASelection fpga_, int fiber_, int chan_)
0117 : FPGAId(crate_, slot_, fpga_), fiber(fiber_), channel(chan_) {}
0118 bool operator<(const ZSChannelId& a) const;
0119 int fiber;
0120 int channel;
0121 };
0122
0123
0124
0125
0126
0127
0128
0129 void getZSThresholds(const std::string& tag,
0130 int crate,
0131 int slot,
0132 std::map<ZSChannelId, int>& thresholds) noexcept(false);
0133
0134 struct HLXMasks {
0135 uint32_t occMask;
0136 uint32_t lhcMask;
0137 uint32_t sumEtMask;
0138 };
0139
0140
0141
0142
0143
0144
0145
0146 void getHLXMasks(const std::string& tag, int crate, int slot, std::map<FPGAId, HLXMasks>& masks) noexcept(false);
0147
0148 typedef enum RBXdatumTypeEnum {
0149 eRBXdelay = 1,
0150 eRBXpedestal = 2,
0151 eRBXttcrxPhase = 3,
0152 eRBXgolCurrent = 4,
0153 eRBXbroadcast = 5,
0154 eRBXqieResetDelay = 6,
0155 eRBXledData = 7,
0156 eRBXccaPatterns = 8
0157 } RBXdatumType;
0158 typedef enum LEDdatumTypeEnum {
0159 eLEDnotApplicable = 0,
0160 eLEDenable = 1,
0161 eLEDamplitude = 2,
0162 eLEDtiming_hb = 3,
0163 eLEDtiming_lb = 4
0164 } LEDdatumType;
0165 struct RBXdatumId {
0166 bool operator<(const RBXdatumId& a) const;
0167 RBXdatumId(LEDdatumType lt) : rm(0), card(0), qie_or_gol(0), dtype(eRBXledData), ltype(lt) {}
0168 RBXdatumId(int r, int c, int qg, RBXdatumType dt)
0169 : rm(r), card(c), qie_or_gol(qg), dtype(dt), ltype(eLEDnotApplicable) {}
0170 RBXdatumId(RBXdatumType dt) : rm(0), card(0), qie_or_gol(0), dtype(dt), ltype(eLEDnotApplicable) {}
0171 int rm;
0172 int card;
0173 int qie_or_gol;
0174 RBXdatumType dtype;
0175 LEDdatumType ltype;
0176 };
0177
0178 typedef unsigned char RBXdatum;
0179
0180
0181
0182
0183
0184
0185
0186 void getRBXdata(const std::string& tag,
0187 const std::string& rbx,
0188 RBXdatumType dtype,
0189 std::map<RBXdatumId, RBXdatum>& RBXdata) noexcept(false);
0190
0191 typedef std::vector<unsigned char> RBXpattern;
0192
0193
0194
0195
0196
0197
0198 void getRBXpatterns(const std::string& tag,
0199 const std::string& rbx,
0200 std::map<RBXdatumId, RBXpattern>& patterns) noexcept(false);
0201
0202
0203 void close();
0204
0205
0206
0207
0208
0209
0210 ConfigurationDatabaseImpl* getImplementation() { return m_implementation; }
0211
0212 private:
0213 std::vector<ConfigurationDatabaseImpl*> m_implementationOptions;
0214 ConfigurationDatabaseImpl* m_implementation;
0215 log4cplus::Logger m_logger;
0216 };
0217
0218 }
0219
0220 #endif