Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:54

0001 #ifndef LMFCOLOREDTABLE_H
0002 #define LMFCOLOREDTABLE_H
0003 
0004 /*
0005  Last updated by  Giovanni.Organtini@roma1.infn.it 2010
0006  */
0007 
0008 #include "OnlineDB/EcalCondDB/interface/LMFDat.h"
0009 #include <map>
0010 
0011 /**
0012  *   LMF_YYYY_XXX_ZZZ interface
0013  *        ^    ^   ^
0014  *        |    |   |
0015  *        |    |   \- table
0016  *        |    \_____ color
0017  *        \---------- system
0018  */
0019 
0020 class LMFColoredTable : public LMFDat {
0021 public:
0022   LMFColoredTable();
0023   LMFColoredTable(EcalDBConnection* c);
0024   LMFColoredTable(oracle::occi::Environment* env, oracle::occi::Connection* conn);
0025   ~LMFColoredTable() override {}
0026 
0027   std::string getTableName() const override = 0;
0028 
0029   std::string getColor() const;
0030   virtual std::string getSystem() const;
0031 
0032   LMFColoredTable& setColor(int color) {
0033     if (COLOR.find(color) != COLOR.end()) {
0034       m_color = color;
0035       m_className += "/C=" + COLOR[color];
0036     }
0037     return *this;
0038   }
0039   LMFColoredTable& setColor(std::string color);
0040   virtual LMFColoredTable& setSystem(int system) {
0041     if (SYSTEM.find(system) != SYSTEM.end()) {
0042       m_system = system;
0043       m_className += "/S=" + SYSTEM[system];
0044     }
0045     return *this;
0046   }
0047   virtual LMFColoredTable& setSystem(std::string s);
0048   LMFColoredTable& setVmin(EcalLogicID& id, int v) {
0049     setData(id, "VMIN", v);
0050     return *this;
0051   }
0052   LMFColoredTable& setVmax(EcalLogicID& id, int v) {
0053     setData(id, "VMAX", v);
0054     return *this;
0055   }
0056 
0057   LMFColoredTable& setVersions(EcalLogicID& id, int vmin, int vmax) {
0058     setData(id, "VMIN", vmin);
0059     setData(id, "VMAX", vmax);
0060     return *this;
0061   }
0062 
0063   int getVmin(EcalLogicID& id) { return getData(id, "VMIN"); }
0064 
0065   int getVmax(EcalLogicID& id) { return getData(id, "VMAX"); }
0066 
0067   int writeDB() noexcept(false) override;
0068 
0069 protected:
0070   int m_color;
0071   int m_system;
0072 
0073 private:
0074   std::map<int, std::string> COLOR;
0075   std::map<int, std::string> SYSTEM;
0076 };
0077 
0078 #endif