CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/CondTools/Ecal/interface/EcalErrorDictionary.h

Go to the documentation of this file.
00001 #ifndef CondFormats_EcalObjects_EcalErrorDictionary_H
00002 #define CondFormats_EcalObjects_EcalErrorDictionary_H
00003 
00011 #include <boost/cstdint.hpp>
00012 #include <iostream>
00013 #include <vector>
00014 
00015 class EcalErrorDictionary {
00016  public:
00017   struct errorDef_t {
00018     uint64_t bitmask;
00019     char shortDesc[64];
00020     char longDesc[128];
00021   };
00022 
00023   static uint64_t hasError(std::string shortDesc, uint64_t bitcode)
00024     {
00025       return getMask(shortDesc) & bitcode;
00026     }
00027 
00028   static uint64_t getMask(std::string shortDesc)
00029     {
00030       for (unsigned int i=0; i<DICTSIZE; i++) {
00031         if (getDef(i).shortDesc == shortDesc) {
00032           return getDef(i).bitmask;
00033         }
00034       }
00035       return 0;
00036     }
00037   
00038   static void printErrors(uint64_t bitcode)
00039     {
00040       for (unsigned int i=0; i<DICTSIZE; i++) {
00041         if (bitcode & getDef(i).bitmask) {
00042         }
00043       }
00044     }
00045 
00046   static void getErrors(std::vector<errorDef_t>& errorVec, uint64_t bitcode)
00047     {
00048       errorVec.clear();
00049       for (unsigned int i=0; i<DICTSIZE; i++) {
00050         if (bitcode & getDef(i).bitmask) {
00051           errorVec.push_back(getDef(i));
00052         }
00053       }
00054     }
00055 
00056   static void getDictionary(std::vector<errorDef_t> &dict)
00057     {
00058       dict.clear();
00059       for (unsigned int i=0; i<DICTSIZE; i++) {
00060         dict.push_back(getDef(i));
00061       }
00062     }
00063 
00064  private:
00065   EcalErrorDictionary() {}; // Hidden to force static use
00066   ~EcalErrorDictionary() {};  // Hidden to force static use
00067 
00068   const static unsigned int DICTSIZE = 55;
00069   
00070   static errorDef_t getDef(unsigned int i) {
00071     const static errorDef_t ERRORDICT[DICTSIZE] =
00072       {
00073 
00074         { ((uint64_t)1<<0), "CH_ID_WARNING" , "Channel id warning"},
00075         { ((uint64_t)1<<1), "CH_GAIN_ZERO_WARNING" , "Channel gain zero warning"},
00076         { ((uint64_t)1<<2), "CH_GAIN_SWITCH_WARNING" , "Channel gain switch warning"},
00077         { ((uint64_t)1<<3), "CH_ID_ERROR" , "Channel id error"},
00078         { ((uint64_t)1<<4), "CH_GAIN_ZERO_ERROR" , "Channel gain zero error"},
00079         { ((uint64_t)1<<5), "CH_GAIN_SWITCH_ERROR" , "Channel gain switch error"},
00080 
00081         { ((uint64_t)1<<6), "TT_ID_WARNING" , "TT id warning"},
00082         { ((uint64_t)1<<7), "TT_SIZE_WARNING" , "TT size warning"},
00083         { ((uint64_t)1<<8), "TT_LV1_WARNING" , "TT LV1 warning"},
00084         { ((uint64_t)1<<9), "TT_BUNCH_X_WARNING" , "TT bunch-x warning"},
00085         { ((uint64_t)1<<10), "TT_ID_ERROR" , "TT id error"},
00086         { ((uint64_t)1<<11), "TT_SIZE_ERROR" , "TT size error"},
00087         { ((uint64_t)1<<12), "TT_LV1_ERROR" , "TT LV1 error"},
00088         { ((uint64_t)1<<13), "TT_BUNCH_X_ERROR" , "TT bunch-x error"},
00089 
00090         { ((uint64_t)1<<16) , "PEDESTAL_LOW_GAIN_MEAN_WARNING" , "Pedestal low gain mean amplitude outside range"},
00091         { ((uint64_t)1<<17) , "PEDESTAL_MIDDLE_GAIN_MEAN_WARNING" , "Pedestal middle gain mean amplitude outside range"},
00092         { ((uint64_t)1<<18) , "PEDESTAL_HIGH_GAIN_MEAN_WARNING" , "Pedestal high gain mean amplitude outside range"},
00093         { ((uint64_t)1<<19) , "PEDESTAL_LOW_GAIN_MEAN_ERROR" , "Pedestal low gain mean amplitude error"},
00094         { ((uint64_t)1<<20) , "PEDESTAL_MIDDLE_GAIN_MEAN_ERROR" , "Pedestal middle gain mean amplitude error"},
00095         { ((uint64_t)1<<21) , "PEDESTAL_HIGH_GAIN_MEAN_ERROR" , "Pedestal high gain mean amplitude error"},
00096 
00097         { ((uint64_t)1<<22) , "PEDESTAL_LOW_GAIN_RMS_WARNING" , "Pedestal low gain rms amplitude outside range"},
00098         { ((uint64_t)1<<23) , "PEDESTAL_MIDDLE_GAIN_RMS_WARNING" , "Pedestal middle gain rms amplitude outside range"},
00099         { ((uint64_t)1<<24) , "PEDESTAL_HIGH_GAIN_RMS_WARNING" , "Pedestal high gain rms amplitude outside range"},
00100         { ((uint64_t)1<<25) , "PEDESTAL_LOW_GAIN_RMS_ERROR" , "Pedestal low gain rms amplitude error"},
00101         { ((uint64_t)1<<26), "PEDESTAL_MIDDLE_GAIN_RMS_ERROR" , "Pedestal middle gain rms amplitude error"},
00102         { ((uint64_t)1<<27), "PEDESTAL_HIGH_GAIN_RMS_ERROR" , "Pedestal high gain rms amplitude error"},
00103 
00104         { ((uint64_t)1<<28), "PEDESTAL_ONLINE_HIGH_GAIN_MEAN_WARNING" , "Pedestal online high gain mean amplitude outside range"},
00105         { ((uint64_t)1<<29), "PEDESTAL_ONLINE_HIGH_GAIN_RMS_WARNING" , "Pedestal online high gain rms amplitude outside range"},
00106         { ((uint64_t)1<<30), "PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR" ,  "Pedestal online high gain mean amplitude error"},
00107         { ((uint64_t)1<<31), "PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR" , "Pedestal online high gain rms amplitude error"},
00108 
00109         { ((uint64_t)1<<32), "TESTPULSE_LOW_GAIN_MEAN_WARNING" , "Testpulse low gain mean amplitude outside range"},
00110         { ((uint64_t)1<<33), "TESTPULSE_MIDDLE_GAIN_MEAN_WARNING" , "Testpulse middle gain mean amplitude outside range"},
00111         { ((uint64_t)1<<34), "TESTPULSE_HIGH_GAIN_MEAN_WARNING" , "Testpulse high gain mean amplitude outside range"},
00112         { ((uint64_t)1<<35), "TESTPULSE_LOW_GAIN_RMS_WARNING" , "Testpulse low gain rms amplitude outside range"},
00113         { ((uint64_t)1<<36), "TESTPULSE_MIDDLE_GAIN_RMS_WARNING" , "Testpulse middle gain rms amplitude outside range"},
00114         { ((uint64_t)1<<37), "TESTPULSE_HIGH_GAIN_RMS_WARNING" , "Testpulse high gain rms amplitude outside range"},
00115 
00116         { ((uint64_t)1<<38), "LASER_MEAN_WARNING" , "Laser mean amplitude outside range"},
00117         { ((uint64_t)1<<39), "LASER_RMS_WARNING" , "Laser rms amplitude outside range"},
00118 
00119         { ((uint64_t)1<<40), "LASER_MEAN_OVER_PN_WARNING" , "Laser mean amplitude over PN outside range"},
00120         { ((uint64_t)1<<41), "LASER_RMS_OVER_PN_WARNING" , "Laser rms amplitude over PN outside range"},
00121 
00122         { ((uint64_t)1<<42), "LASER_MEAN_TIMING_WARNING" , "Laser channel mean timing outside range"},
00123         { ((uint64_t)1<<43), "LASER_RMS_TIMING_WARNING" , "Laser channel rms timing outside range"},
00124 
00125         { ((uint64_t)1<<44), "LASER_MEAN_TT_TIMING_WARNING" , "Laser tower mean timing outside range"},
00126         { ((uint64_t)1<<45), "LASER_RMS_TT_TIMING_WARNING" , "Laser tower rms timing outside range"},
00127 
00128         { ((uint64_t)1<<46), "PHYSICS_MEAN_TIMING_WARNING" , "Channel mean timing outside range for physics events"},
00129         { ((uint64_t)1<<47), "PHYSICS_RMS_TIMING_WARNING" , "Channel rms timing outside range for physics events"},
00130 
00131         { ((uint64_t)1<<48), "PHYSICS_MEAN_TT_TIMING_WARNING" , "TT mean timing outside range for physics events"},
00132         { ((uint64_t)1<<49), "PHYSICS_RMS_TT_TIMING_WARNING" , "TT rms timing outside range for physics events"},
00133 
00134         { ((uint64_t)1<<50), "PHYSICS_BAD_CHANNEL_WARNING" , "Bad signal for physics events"},
00135         { ((uint64_t)1<<51), "PHYSICS_BAD_CHANNEL_ERROR" , "No signal for physics events"},
00136 
00137         { ((uint64_t)1<<52), "STATUS_FLAG_ERROR" , "Readout tower front end error (any type)"},
00138 
00139         { ((uint64_t)1<<53), "LED_MEAN_WARNING" , "Led mean amplitude outside range"},
00140         { ((uint64_t)1<<54), "LED_RMS_WARNING" , "Led rms amplitude outside range"}
00141 
00142       };
00143 
00144     return ERRORDICT[i];
00145   }
00146 
00147 
00148 };
00149 #endif