Go to the documentation of this file.00001 #ifndef DQM_HCALMONITORTASKS_HCALDETDIAGTIMINGMONITOR_H
00002 #define DQM_HCALMONITORTASKS_HCALDETDIAGTIMINGMONITOR_H
00003
00004
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 "DQMServices/Core/interface/DQMStore.h"
00011 #include "DQMServices/Core/interface/MonitorElement.h"
00012 #include "DQM/HcalMonitorTasks/interface/HcalBaseDQMonitor.h"
00013
00014 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
00015 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
00016
00017
00025 class HcalDetDiagTimingMonitor:public HcalBaseDQMonitor {
00026 public:
00027 HcalDetDiagTimingMonitor(const edm::ParameterSet& ps);
00028 ~HcalDetDiagTimingMonitor();
00029
00030 double GetTime(double *data,int n){
00031 int MaxI=-100; double Time=0,SumT=0,MaxT=-10;
00032 for(int j=0;j<n;++j) if(MaxT<data[j]){ MaxT=data[j]; MaxI=j; }
00033 if(MaxI>=0){
00034 Time=MaxI*data[MaxI];
00035 SumT=data[MaxI];
00036 if(MaxI>0){ Time+=(MaxI-1)*data[MaxI-1]; SumT+=data[MaxI-1]; }
00037 if(MaxI<(n-1)){ Time+=(MaxI+1)*data[MaxI+1]; SumT+=data[MaxI+1]; }
00038 Time=Time/SumT;
00039 }
00040 return Time;
00041 }
00042 bool isSignal(double *data,int n){
00043 int Imax=-1; double max=-100;
00044 for(int i=0;i<n;i++) if(data[i]>max){max=data[i]; Imax=i;}
00045 if(Imax==0 && Imax==(n-1)) return false;
00046 float sum=data[Imax-1]+data[Imax+1];
00047 if(data[Imax]>5.5 && sum>(data[Imax]*0.25)) return true;
00048 return false;
00049 }
00052 void set_hbhe(int eta,int phi,int depth,int cap,float val){
00053 HBHE[eta+50][phi][depth][cap]+=val;
00054 nHBHE[eta+50][phi][depth][cap]+=1.0;
00055 }
00056 void set_ho(int eta,int phi,int depth,int cap,float val){
00057 HO[eta+50][phi][depth][cap]+=val;
00058 nHO[eta+50][phi][depth][cap]+=1.0;
00059 }
00060 void set_hf(int eta,int phi,int depth,int cap,float val){
00061 HF[eta+50][phi][depth][cap]+=val;
00062 nHF[eta+50][phi][depth][cap]+=1.0;
00063 }
00064 double get_ped_hbhe(int eta,int phi,int depth,int cup){
00065 if(nHBHE[eta+50][phi][depth][cup]<10) return 2.5;
00066 if(nHBHE[eta+50][phi][depth][cup]!=0){
00067 double ped=HBHE[eta+50][phi][depth][cup]/nHBHE[eta+50][phi][depth][cup];
00068 if(ped>1.5 && ped<4.5) return ped;
00069 }
00070 return 9999;
00071 }
00072 double get_ped_ho(int eta,int phi,int depth,int cup){
00073 if(nHO[eta+50][phi][depth][cup]<10) return 2.5;
00074 if(nHO[eta+50][phi][depth][cup]!=0){
00075 double ped=HO[eta+50][phi][depth][cup]/nHO[eta+50][phi][depth][cup];
00076 if(ped>1.5 && ped<4.5) return ped;
00077 }
00078 return 9999;
00079 }
00080 double get_ped_hf(int eta,int phi,int depth,int cup){
00081 if(nHF[eta+50][phi][depth][cup]<10) return 2.5;
00082 if(nHF[eta+50][phi][depth][cup]!=0){
00083 double ped=HF[eta+50][phi][depth][cup]/nHF[eta+50][phi][depth][cup];
00084 if(ped>1.5 && ped<4.5) return ped;
00085 }
00086 return 9999;
00087 }
00088 double HBHE[100][73][5][4];
00089 double nHBHE[100][73][5][4];
00090 double HO[100][73][5][4];
00091 double nHO[100][73][5][4];
00092 double HF[100][73][5][4];
00093 double nHF[100][73][5][4];
00096
00097 double occHBHE[100][73][5];
00098 double occHO [100][73][5];
00099 double occHF [100][73][5];
00100 double occSum;
00103 void setup();
00104 void beginRun(const edm::Run& run, const edm::EventSetup& c);
00105 void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup);
00106 void done();
00107 void reset();
00108 void cleanup();
00109
00110 private:
00111 edm::InputTag inputLabelDigi_;
00112 edm::InputTag L1ADataLabel_;
00113 edm::InputTag FEDRawDataCollection_;
00114
00115 int GCTTriggerBit1_;
00116 int GCTTriggerBit2_;
00117 int GCTTriggerBit3_;
00118 int GCTTriggerBit4_;
00119 int GCTTriggerBit5_;
00120 bool CosmicsCorr_;
00121
00122 MonitorElement *HBTimeDT;
00123 MonitorElement *HBTimeRPC;
00124 MonitorElement *HBTimeGCT;
00125 MonitorElement *HBTimeHO;
00126 MonitorElement *HOTimeDT;
00127 MonitorElement *HOTimeRPC;
00128 MonitorElement *HOTimeGCT;
00129 MonitorElement *HOTimeHO;
00130 MonitorElement *HETimeCSCp;
00131 MonitorElement *HETimeCSCm;
00132 MonitorElement *HETimeRPCp;
00133 MonitorElement *HETimeRPCm;
00134 MonitorElement *HFTimeCSCp;
00135 MonitorElement *HFTimeCSCm;
00136 MonitorElement *Summary;
00137
00138 void CheckTiming();
00139 };
00140
00141 #endif