CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/DQM/EcalCommon/interface/EcalDQMStatusDictionary.h

Go to the documentation of this file.
00001 #ifndef EcalDQMStatusDictionary_H
00002 #define EcalDQMStatusDictionary_H
00003 
00012 #include <boost/cstdint.hpp>
00013 #include <iostream>
00014 #include <vector>
00015 
00016 #include "CondFormats/EcalObjects/interface/EcalDQMStatusHelper.h"
00017 
00018 class EcalDQMStatusDictionary {
00019 
00020  public:
00021 
00022   struct codeDef {
00023     uint32_t code;
00024     char desc[39];
00025   };
00026 
00027   static void getDictionary(std::vector<codeDef> &dict) {
00028     dict.clear();
00029     for (unsigned int i=0; i<DICTSIZE1+DICTSIZE2; i++) dict.push_back(getDef(i));
00030   }
00031 
00032   static void getCodes(std::vector<codeDef>& codeVec, uint32_t code) {
00033       codeVec.clear();
00034       for (unsigned int i=0; i<DICTSIZE1+DICTSIZE2; i++) {
00035         if (code & getDef(i).code) {
00036           codeVec.push_back(getDef(i));
00037       }
00038     }
00039   }
00040 
00041  private:
00042 
00043   EcalDQMStatusDictionary() {}; // Hidden to force static use
00044   ~EcalDQMStatusDictionary() {}; // Hidden to force static use
00045 
00046   const static unsigned int DICTSIZE1 = 30;
00047   const static unsigned int DICTSIZE2 =  7;
00048 
00049   static codeDef getDef(unsigned int i) {
00050     const static codeDef DICT[DICTSIZE1+DICTSIZE2] =
00051       {
00052 
00053         // single status codes
00054 
00055         { ((uint32_t) 1 << EcalDQMStatusHelper::CH_ID_ERROR), "CH_ID_ERROR" },
00056         { ((uint32_t) 1 << EcalDQMStatusHelper::CH_GAIN_ZERO_ERROR), "CH_GAIN_ZERO_ERROR" },
00057         { ((uint32_t) 1 << EcalDQMStatusHelper::CH_GAIN_SWITCH_ERROR), "CH_GAIN_SWITCH_ERROR" },
00058         { ((uint32_t) 1 << EcalDQMStatusHelper::TT_ID_ERROR), "TT_ID_ERROR"},
00059         { ((uint32_t) 1 << EcalDQMStatusHelper::TT_SIZE_ERROR), "TT_SIZE_ERROR"},
00060 
00061         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR), "PEDESTAL_LOW_GAIN_MEAN_ERROR"},
00062         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR), "PEDESTAL_MIDDLE_GAIN_MEAN_ERROR"},
00063         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR), "PEDESTAL_HIGH_GAIN_MEAN_ERROR"},
00064         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR), "PEDESTAL_LOW_GAIN_RMS_ERROR"},
00065         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR), "PEDESTAL_MIDDLE_GAIN_RMS_ERROR"},
00066         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR), "PEDESTAL_HIGH_GAIN_RMS_ERROR"},
00067 
00068         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR), "PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR"},
00069         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR), "PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR"},
00070 
00071         { ((uint32_t) 1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR), "TESTPULSE_LOW_GAIN_MEAN_ERROR"},
00072         { ((uint32_t) 1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR), "TESTPULSE_MIDDLE_GAIN_MEAN_ERROR"},
00073         { ((uint32_t) 1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR), "TESTPULSE_HIGH_GAIN_MEAN_ERROR"},
00074         { ((uint32_t) 1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR), "TESTPULSE_LOW_GAIN_RMS_ERROR"},
00075         { ((uint32_t) 1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR), "TESTPULSE_MIDDLE_GAIN_RMS_ERROR"},
00076         { ((uint32_t) 1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR), "TESTPULSE_HIGH_GAIN_RMS_ERROR"},
00077 
00078         { ((uint32_t) 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR), "LASER_MEAN_ERROR"},
00079         { ((uint32_t) 1 << EcalDQMStatusHelper::LASER_RMS_ERROR), "LASER_RMS_ERROR"},
00080         { ((uint32_t) 1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR), "LASER_TIMING_MEAN_ERROR"},
00081         { ((uint32_t) 1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR), "LASER_TIMING_RMS_ERROR"},
00082 
00083         { ((uint32_t) 1 << EcalDQMStatusHelper::LED_MEAN_ERROR), "LED_MEAN_ERROR"},
00084         { ((uint32_t) 1 << EcalDQMStatusHelper::LED_RMS_ERROR), "LED_RMS_ERROR"},
00085         { ((uint32_t) 1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR), "LED_TIMING_MEAN_ERROR"},
00086         { ((uint32_t) 1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR), "LED_TIMING_RMS_ERROR"},
00087 
00088         { ((uint32_t) 1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR), "STATUS_FLAG_ERROR"},
00089 
00090         { ((uint32_t) 1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING), "PHYSICS_BAD_CHANNEL_WARNING"},
00091         { ((uint32_t) 1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR), "PHYSICS_BAD_CHANNEL_ERROR"},
00092 
00093         // combined status codes
00094 
00095         { ((uint32_t) 1 << EcalDQMStatusHelper::TT_SIZE_ERROR |
00096                       1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR |
00097                       1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR |
00098                       1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR |
00099                       1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR |
00100                       1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR |
00101                       1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR |
00102                       1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR |
00103                       1 << EcalDQMStatusHelper::LASER_MEAN_ERROR |
00104                       1 << EcalDQMStatusHelper::LED_MEAN_ERROR |
00105                       1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING |
00106                       1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR), "disabled_channel"},
00107 
00108         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR |
00109                       1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR |
00110                       1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR |
00111                       1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR |
00112                       1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR |
00113                       1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR |
00114                       1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR |
00115                       1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR |
00116                       1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR |
00117                       1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR |
00118                       1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR |
00119                       1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR |
00120                       1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR |
00121                       1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR |
00122                       1 << EcalDQMStatusHelper::LASER_MEAN_ERROR |
00123                       1 << EcalDQMStatusHelper::LASER_RMS_ERROR |
00124                       1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR |
00125                       1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR |
00126                       1 << EcalDQMStatusHelper::LED_MEAN_ERROR |
00127                       1 << EcalDQMStatusHelper::LED_RMS_ERROR |
00128                       1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR | 
00129                       1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR |
00130                       1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING |
00131                       1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR), "dead_channel"},
00132 
00133         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR |
00134                       1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR |
00135                       1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_MEAN_ERROR |
00136                       1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR |
00137                       1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR |
00138                       1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR |
00139                       1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR |
00140                       1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR), "pedestal_problem"},
00141 
00142         { ((uint32_t) 1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_MEAN_ERROR |
00143                       1 << EcalDQMStatusHelper::TESTPULSE_LOW_GAIN_RMS_ERROR |
00144                       1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_MEAN_ERROR |
00145                       1 << EcalDQMStatusHelper::TESTPULSE_MIDDLE_GAIN_RMS_ERROR |
00146                       1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_MEAN_ERROR |
00147                       1 << EcalDQMStatusHelper::TESTPULSE_HIGH_GAIN_RMS_ERROR), "testpulse_problem"},
00148 
00149         { ((uint32_t) 1 << EcalDQMStatusHelper::LASER_MEAN_ERROR |
00150                       1 << EcalDQMStatusHelper::LASER_RMS_ERROR |
00151                       1 << EcalDQMStatusHelper::LASER_TIMING_MEAN_ERROR |
00152                       1 << EcalDQMStatusHelper::LASER_TIMING_RMS_ERROR), "laser_problem"},
00153 
00154         { ((uint32_t) 1 << EcalDQMStatusHelper::LED_MEAN_ERROR |
00155                       1 << EcalDQMStatusHelper::LED_RMS_ERROR |
00156                       1 << EcalDQMStatusHelper::LED_TIMING_MEAN_ERROR |
00157                       1 << EcalDQMStatusHelper::LED_TIMING_RMS_ERROR), "led_problem"},
00158 
00159         { ((uint32_t) 1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_RMS_ERROR |
00160                       1 << EcalDQMStatusHelper::PEDESTAL_MIDDLE_GAIN_RMS_ERROR |
00161                       1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_RMS_ERROR |
00162                       1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR |
00163                       1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR), "noise_problem"}
00164 
00165       };
00166 
00167     return DICT[i];
00168   }
00169 
00170 
00171 };
00172 
00173 #endif // EcalDQMStatusDictionary_H