CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/HcalMonitorTasks/interface/HcalDetDiagLEDMonitor.h

Go to the documentation of this file.
00001 #ifndef DQM_HCALMONITORTASKS_HCALDETDIAGLEDMONITOR_H
00002 #define DQM_HCALMONITORTASKS_HCALDETDIAGLEDMONITOR_H
00003 
00004 // user include files
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/Event.h"
00007 #include "FWCore/Framework/interface/MakerMacros.h"
00008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00009 
00010 #include "DQM/HcalMonitorTasks/interface/HcalBaseDQMonitor.h"
00011 #include "DQM/HcalMonitorTasks/interface/HcalEtaPhiHists.h"
00012 
00013 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00014 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00015 #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h"
00016 
00025 class HcalDetDiagLEDData;
00026 class HcalLogicalMapGenerator;
00027 class HcalLogicalMap;
00028 
00029 class HcalDetDiagLEDMonitor:public HcalBaseDQMonitor {
00030 public:
00031   HcalDetDiagLEDMonitor(const edm::ParameterSet& ps); 
00032   ~HcalDetDiagLEDMonitor(); 
00033 
00034   void beginRun(const edm::Run& run, const edm::EventSetup& c);
00035   void setup();
00036   void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup);// const HcalDbService& cond)
00037   void done();
00038   void reset();
00039   void cleanup(); 
00040   void fillHistos();
00041   int  GetStatistics(){ return ievt_; }
00042 private:
00043   HcalLogicalMapGenerator *gen;
00044   HcalElectronicsMap      emap;
00045   HcalLogicalMap          *lmap;
00046   // in principle functions below shold use DB interface (will be modefied when DB will be ready...)  
00047   void SaveReference();
00048   void LoadReference();
00049   void CheckStatus();
00050   
00051   HcalDetDiagLEDData* GetCalib(std::string sd,int eta,int phi){
00052     int SD=0,ETA=0,PHI=0;
00053     if(sd.compare("HB")==0) SD=1; 
00054     if(sd.compare("HE")==0) SD=2; 
00055     if(sd.compare("HO")==0) SD=3; 
00056     if(sd.compare("HF")==0) SD=4; 
00057     if(SD==1 || SD==2){
00058       if(eta>0) ETA=1; else ETA=-1;
00059       if(phi==71 ||phi==72 || phi==1 || phi==2) PHI=71; else PHI=((phi-3)/4)*4+3;
00060     }else if(SD==3){
00061       if(abs(eta)<=4){
00062         ETA=0;
00063         if(phi==71 ||phi==72 || phi==1 || phi==2 || phi==3 || phi==4) PHI=71; else PHI=((phi-5)/6)*6+5;
00064       }else{
00065         if(abs(eta)>4  && abs(eta)<=10)  ETA=1;
00066         if(abs(eta)>10 && abs(eta)<=15)  ETA=2;
00067         if(eta<0) ETA=-ETA;
00068         if(phi==71 ||phi==72 || (phi>=1 && phi<=10)) PHI=71; else PHI=((phi-11)/12)*12+11;
00069       }
00070     }else if(SD==4){
00071       if(eta>0) ETA=1; else ETA=-1;
00072       if(phi>=1  && phi<=18) PHI=1;
00073       if(phi>=19 && phi<=36) PHI=19;
00074       if(phi>=37 && phi<=54) PHI=37;
00075       if(phi>=55 && phi<=72) PHI=55;
00076     }
00077     return calib_data[SD][ETA+2][PHI-1];
00078   };
00079   int         ievt_;
00080   int         run_number;
00081   int         dataset_seq_number;
00082   bool        IsReference;
00083   
00084   double      LEDMeanTreshold;
00085   double      LEDRmsTreshold;
00086   bool        UseDB;
00087    
00088   std::string ReferenceData;
00089   std::string ReferenceRun;
00090   std::string OutputFilePath;
00091 
00092   MonitorElement *meEVT_;
00093   MonitorElement *RefRun_;
00094   MonitorElement *Energy;
00095   MonitorElement *Time;
00096   MonitorElement *EnergyHF;
00097   MonitorElement *TimeHF;
00098   MonitorElement *Time2Dhbhehf;
00099   MonitorElement *Time2Dho;
00100   MonitorElement *Energy2Dhbhehf;
00101   MonitorElement *Energy2Dho;
00102   MonitorElement *EnergyRMS;
00103   MonitorElement *TimeRMS;
00104   MonitorElement *EnergyRMSHF;
00105   MonitorElement *TimeRMSHF;
00106   MonitorElement *EnergyCorr;
00107   MonitorElement *HBPphi;
00108   MonitorElement *HBMphi;
00109   MonitorElement *HEPphi;
00110   MonitorElement *HEMphi;
00111   MonitorElement *HFPphi;
00112   MonitorElement *HFMphi;
00113   MonitorElement *HO0phi;
00114   MonitorElement *HO1Pphi;
00115   MonitorElement *HO2Pphi;
00116   MonitorElement *HO1Mphi;
00117   MonitorElement *HO2Mphi;
00118 
00119   HcalDetDiagLEDData* hb_data[85][72][4];
00120   HcalDetDiagLEDData* he_data[85][72][4];
00121   HcalDetDiagLEDData* ho_data[85][72][4];
00122   HcalDetDiagLEDData* hf_data[85][72][4];
00123   HcalDetDiagLEDData* calib_data[5][5][72];
00124   
00125   EtaPhiHists ChannelsLEDEnergy;
00126   EtaPhiHists ChannelsLEDEnergyRef;
00127   EtaPhiHists ChannelStatusMissingChannels;
00128   EtaPhiHists ChannelStatusUnstableChannels;
00129   EtaPhiHists ChannelStatusUnstableLEDsignal;
00130   EtaPhiHists ChannelStatusLEDMean;
00131   EtaPhiHists ChannelStatusLEDRMS;
00132   EtaPhiHists ChannelStatusTimeMean;
00133   EtaPhiHists ChannelStatusTimeRMS;
00134  
00135   edm::InputTag digiLabel_;
00136   edm::InputTag triggerLabel_;
00137   edm::InputTag calibDigiLabel_;
00138 
00139   void fill_channel_status(std::string subdet,int eta,int phi,int depth,int type,double status);
00140   void   fill_energy(std::string subdet,int eta,int phi,int depth,double e,int type);
00141   double get_energy(std::string subdet,int eta,int phi,int depth,int type);
00142 };
00143 
00144 #endif