CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDetDiagTimingMonitor.h
Go to the documentation of this file.
1 #ifndef DQM_HCALMONITORTASKS_HCALDETDIAGTIMINGMONITOR_H
2 #define DQM_HCALMONITORTASKS_HCALDETDIAGTIMINGMONITOR_H
3 
4 // user include files
9 
13 
16 
20 // this is to retrieve HCAL digi's
22 
29 public:
32 
33  double GetTime(double *data,int n){
34  int MaxI=-100; double Time=0,SumT=0,MaxT=-10;
35  for(int j=0;j<n;++j) if(MaxT<data[j]){ MaxT=data[j]; MaxI=j; }
36  if(MaxI>=0){
37  Time=MaxI*data[MaxI];
38  SumT=data[MaxI];
39  if(MaxI>0){ Time+=(MaxI-1)*data[MaxI-1]; SumT+=data[MaxI-1]; }
40  if(MaxI<(n-1)){ Time+=(MaxI+1)*data[MaxI+1]; SumT+=data[MaxI+1]; }
41  Time=Time/SumT;
42  }
43  return Time;
44  }
45  bool isSignal(double *data,int n){
46  int Imax=-1; double max=-100;
47  for(int i=0;i<n;i++) if(data[i]>max){max=data[i]; Imax=i;}
48  if(Imax==0 && Imax==(n-1)) return false;
49  float sum=data[Imax-1]+data[Imax+1];
50  if(data[Imax]>5.5 && sum>(data[Imax]*0.25)) return true;
51  return false;
52  }
55  void set_hbhe(int eta,int phi,int depth,int cap,float val){
56  HBHE[eta+50][phi][depth][cap]+=val;
57  nHBHE[eta+50][phi][depth][cap]+=1.0;
58  }
59  void set_ho(int eta,int phi,int depth,int cap,float val){
60  HO[eta+50][phi][depth][cap]+=val;
61  nHO[eta+50][phi][depth][cap]+=1.0;
62  }
63  void set_hf(int eta,int phi,int depth,int cap,float val){
64  HF[eta+50][phi][depth][cap]+=val;
65  nHF[eta+50][phi][depth][cap]+=1.0;
66  }
67  double get_ped_hbhe(int eta,int phi,int depth,int cup){
68  if(nHBHE[eta+50][phi][depth][cup]<10) return 2.5;
69  if(nHBHE[eta+50][phi][depth][cup]!=0){
70  double ped=HBHE[eta+50][phi][depth][cup]/nHBHE[eta+50][phi][depth][cup];
71  if(ped>1.5 && ped<4.5) return ped;
72  }
73  return 9999;
74  }
75  double get_ped_ho(int eta,int phi,int depth,int cup){
76  if(nHO[eta+50][phi][depth][cup]<10) return 2.5;
77  if(nHO[eta+50][phi][depth][cup]!=0){
78  double ped=HO[eta+50][phi][depth][cup]/nHO[eta+50][phi][depth][cup];
79  if(ped>1.5 && ped<4.5) return ped;
80  }
81  return 9999;
82  }
83  double get_ped_hf(int eta,int phi,int depth,int cup){
84  if(nHF[eta+50][phi][depth][cup]<10) return 2.5;
85  if(nHF[eta+50][phi][depth][cup]!=0){
86  double ped=HF[eta+50][phi][depth][cup]/nHF[eta+50][phi][depth][cup];
87  if(ped>1.5 && ped<4.5) return ped;
88  }
89  return 9999;
90  }
91  double HBHE[100][73][5][4];
92  double nHBHE[100][73][5][4];
93  double HO[100][73][5][4];
94  double nHO[100][73][5][4];
95  double HF[100][73][5][4];
96  double nHF[100][73][5][4];
99 // noise/crazy channels masking
100  double occHBHE[100][73][5];
101  double occHO [100][73][5];
102  double occHF [100][73][5];
103  double occSum;
106  void setup();
107  void beginRun(const edm::Run& run, const edm::EventSetup& c);
108  void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup);
109  void done();
110  void reset();
111  void cleanup();
112 
113 private:
116 
123 
130 
146 
147  void CheckTiming();
148 };
149 
150 #endif
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void set_hf(int eta, int phi, int depth, int cap, float val)
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
T eta() const
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::EDGetTokenT< HFDigiCollection > tok_hf_
int iEvent
Definition: GenABIO.cc:243
const T & max(const T &a, const T &b)
bool isSignal(double *data, int n)
double get_ped_ho(int eta, int phi, int depth, int cup)
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< L1MuGMTReadoutCollection > tok_l1mu_
void set_ho(int eta, int phi, int depth, int cap, float val)
HcalDetDiagTimingMonitor(const edm::ParameterSet &ps)
double get_ped_hbhe(int eta, int phi, int depth, int cup)
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > tok_l1_
double get_ped_hf(int eta, int phi, int depth, int cup)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void beginRun(const edm::Run &run, const edm::EventSetup &c)
void set_hbhe(int eta, int phi, int depth, int cap, float val)
double GetTime(double *data, int n)
edm::EDGetTokenT< HODigiCollection > tok_ho_
Definition: Run.h:41
Definition: DDAxes.h:10