Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:32:01

0001 #include "OnlineDB/EcalCondDB/interface/LMFPnPrimDat.h"
0002 
0003 LMFPnPrimDat::LMFPnPrimDat() : LMFColoredTable() { init(); }
0004 
0005 LMFPnPrimDat::LMFPnPrimDat(oracle::occi::Environment *env, oracle::occi::Connection *conn)
0006     : LMFColoredTable(env, conn) {
0007   init();
0008 }
0009 
0010 LMFPnPrimDat::LMFPnPrimDat(EcalDBConnection *c) : LMFColoredTable(c) { init(); }
0011 
0012 LMFPnPrimDat::LMFPnPrimDat(std::string color, std::string system) : LMFColoredTable() {
0013   init();
0014   setColor(color);
0015   setSystem(system);
0016 }
0017 
0018 LMFPnPrimDat::LMFPnPrimDat(oracle::occi::Environment *env,
0019                            oracle::occi::Connection *conn,
0020                            std::string color,
0021                            std::string system)
0022     : LMFColoredTable(env, conn) {
0023   init();
0024   setColor(color);
0025   setSystem(system);
0026 }
0027 
0028 LMFPnPrimDat::LMFPnPrimDat(EcalDBConnection *c, std::string color, std::string system, bool d) : LMFColoredTable(c) {
0029   if (d) {
0030     debug();
0031   }
0032   init();
0033   setColor(color);
0034   setSystem(system);
0035 }
0036 
0037 LMFPnPrimDat::LMFPnPrimDat(EcalDBConnection *c, std::string color, std::string system) : LMFColoredTable(c) {
0038   init();
0039   setColor(color);
0040   setSystem(system);
0041 }
0042 
0043 LMFPnPrimDat::LMFPnPrimDat(int color, std::string system) : LMFColoredTable() {
0044   init();
0045   setColor(color);
0046   setSystem(system);
0047 }
0048 
0049 LMFPnPrimDat::LMFPnPrimDat(oracle::occi::Environment *env, oracle::occi::Connection *conn, int color, std::string system)
0050     : LMFColoredTable(env, conn) {
0051   init();
0052   setColor(color);
0053   setSystem(system);
0054 }
0055 
0056 LMFPnPrimDat::LMFPnPrimDat(EcalDBConnection *c, int color, std::string system) : LMFColoredTable(c) {
0057   init();
0058   setColor(color);
0059   setSystem(system);
0060 }
0061 
0062 LMFPnPrimDat &LMFPnPrimDat::setSystem(std::string s) {
0063   // LED tables do not hold the shapecorr column. Drop it.
0064   std::transform(s.begin(), s.end(), s.begin(), toupper);
0065   if (s == "LED") {
0066     if (m_debug) {
0067       std::cout << "Erasing unwanted data" << std::endl;
0068     }
0069     m_type.erase(m_type.begin());
0070     m_keys.erase("SHAPECORRPN");
0071     if (m_debug) {
0072       std::cout << "Data: " << m_data.size() << " Keys: " << m_keys.size() << " Type: " << m_type.size() << std::endl;
0073     }
0074     std::map<std::string, unsigned int>::iterator i = m_keys.begin();
0075     std::map<std::string, unsigned int>::iterator e = m_keys.end();
0076     while (i != e) {
0077       // modify indexes
0078       (i->second)--;
0079       if (m_debug) {
0080         std::cout << "Key " << i->first << " = " << i->second << std::endl;
0081       }
0082       i++;
0083     }
0084   }
0085   LMFColoredTable::setSystem(s);
0086   return *this;
0087 }
0088 
0089 void LMFPnPrimDat::init() {
0090   m_className = "LMFPnPrimDat";
0091 
0092   m_keys["SHAPECORRPN"] = 0;
0093   m_keys["MEAN"] = 1;
0094   m_keys["RMS"] = 2;
0095   m_keys["M3"] = 3;
0096   m_keys["PNABMEAN"] = 4;
0097   m_keys["PNABRMS"] = 5;
0098   m_keys["PNABM3"] = 6;
0099   m_keys["FLAG"] = 7;
0100   m_keys["VMIN"] = 8;
0101   m_keys["VMAX"] = 9;
0102 
0103   m_type.resize(10);
0104   for (int i = 0; i < 10; i++) {
0105     m_type[i] = "NUMBER";
0106   }
0107 
0108   m_system = 0;
0109   m_color = 0;
0110 }
0111 
0112 bool LMFPnPrimDat::isValid() {
0113   bool ret = true;
0114   if ((getSystem() != "LASER") && (getSystem() != "LED")) {
0115     m_Error += " System name not properly set [" + getSystem() + "]";
0116     ret = false;
0117   }
0118   if ((getSystem() == "LASER") && (getColor() != "BLUE") && (getColor() != "IR")) {
0119     m_Error += " Color not properly set [" + getColor() + "]";
0120     ret = false;
0121   }
0122   if ((getSystem() == "LED") && (getColor() != "BLUE") && (getColor() != "ORANGE")) {
0123     m_Error += " Color not properly set [" + getColor() + "]";
0124     ret = false;
0125   }
0126   return ret;
0127 }
0128 
0129 LMFPnPrimDat &LMFPnPrimDat::setMean(EcalLogicID &id, float v) {
0130   LMFDat::setData(id, "MEAN", v);
0131   return *this;
0132 }
0133 
0134 LMFPnPrimDat &LMFPnPrimDat::setRMS(EcalLogicID &id, float v) {
0135   LMFDat::setData(id, "RMS", v);
0136   return *this;
0137 }
0138 
0139 LMFPnPrimDat &LMFPnPrimDat::setM3(EcalLogicID &id, float v) {
0140   LMFDat::setData(id, "M3", v);
0141   return *this;
0142 }
0143 
0144 LMFPnPrimDat &LMFPnPrimDat::setPN(EcalLogicID &id, float mean, float rms, float m3) {
0145   setMean(id, mean);
0146   setRMS(id, rms);
0147   setM3(id, m3);
0148   return *this;
0149 }
0150 LMFPnPrimDat &LMFPnPrimDat::setShapeCorr(EcalLogicID &id, float v) {
0151   if (getSystem() != "LED") {
0152     LMFDat::setData(id, "SHAPECORRPN", v);
0153   }
0154   return *this;
0155 }
0156 
0157 LMFPnPrimDat &LMFPnPrimDat::setPNAoverBM3(EcalLogicID &id, float v) {
0158   LMFDat::setData(id, "PNABM3", v);
0159   return *this;
0160 }
0161 
0162 LMFPnPrimDat &LMFPnPrimDat::setPNAoverBMean(EcalLogicID &id, float v) {
0163   LMFDat::setData(id, "PNABMEAN", v);
0164   return *this;
0165 }
0166 
0167 LMFPnPrimDat &LMFPnPrimDat::setPNAoverBRMS(EcalLogicID &id, float v) {
0168   LMFDat::setData(id, "PNABRMS", v);
0169   return *this;
0170 }
0171 
0172 LMFPnPrimDat &LMFPnPrimDat::setPNAoverB(EcalLogicID &id, float mean, float rms, float m3) {
0173   setPNAoverBMean(id, mean);
0174   setPNAoverBRMS(id, rms);
0175   setPNAoverBM3(id, m3);
0176   return *this;
0177 }
0178 LMFPnPrimDat &LMFPnPrimDat::setFlag(EcalLogicID &id, int v) {
0179   LMFDat::setData(id, "FLAG", v);
0180   return *this;
0181 }
0182 
0183 float LMFPnPrimDat::getMean(int id) { return getData(id, "MEAN"); }
0184 
0185 float LMFPnPrimDat::getShapeCor(int id) {
0186   float x = 0;
0187   if (getSystem() != "LED") {
0188     x = getData(id, "SHAPECORRPN");
0189   }
0190   return x;
0191 }
0192 
0193 float LMFPnPrimDat::getRMS(int id) { return getData(id, "RMS"); }
0194 
0195 float LMFPnPrimDat::getM3(int id) { return getData(id, "M3"); }
0196 
0197 float LMFPnPrimDat::getPNAoverBM3(int id) { return getData(id, "PNABM3"); }
0198 
0199 float LMFPnPrimDat::getPNAoverBMean(int id) { return getData(id, "PNABMEAN"); }
0200 
0201 float LMFPnPrimDat::getPNAoverBRMS(int id) { return getData(id, "PNABRMS"); }
0202 
0203 int LMFPnPrimDat::getFlag(int id) { return getData(id, "FLAG"); }
0204 
0205 float LMFPnPrimDat::getMean(EcalLogicID &id) { return getData(id, "MEAN"); }
0206 
0207 float LMFPnPrimDat::getShapeCor(EcalLogicID &id) {
0208   float x = 0.;
0209   if (getSystem() != "LED") {
0210     x = getData(id, "SHAPECORRPN");
0211   }
0212   return x;
0213 }
0214 
0215 float LMFPnPrimDat::getRMS(EcalLogicID &id) { return getData(id, "RMS"); }
0216 
0217 float LMFPnPrimDat::getM3(EcalLogicID &id) { return getData(id, "M3"); }
0218 
0219 float LMFPnPrimDat::getPNAoverBM3(EcalLogicID &id) { return getData(id, "PNABM3"); }
0220 
0221 float LMFPnPrimDat::getPNAoverBMean(EcalLogicID &id) { return getData(id, "PNABMEAN"); }
0222 
0223 float LMFPnPrimDat::getPNAoverBRMS(EcalLogicID &id) { return getData(id, "PNABRMS"); }
0224 
0225 int LMFPnPrimDat::getFlag(EcalLogicID &id) { return getData(id, "FLAG"); }