CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalTimingMonitorModule.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalTimingMonitorModule
4 // Class: HcalTimingMonitorModule
5 //
13 //
14 // Original Author: Dmitry Vishnevskiy
15 // Created: Thu Mar 27 08:12:02 CET 2008
16 // $Id: HcalTimingMonitorModule.cc,v 1.11 2012/10/09 18:16:14 wdd Exp $
17 //
18 //
19 
20 static const int MAXGEN =10;
21 static const int MAXRPC =20;
22 static const int MAXDTBX=20;
23 static const int MAXCSC =20;
24 static const int MAXGMT =20;
25 static const int TRIG_DT =1;
26 static const int TRIG_RPC=2;
27 static const int TRIG_GCT=4;
28 static const int TRIG_CSC=8;
29 
30 // system include files
31 #include <iostream>
32 #include <fstream>
33 #include <cmath>
34 #include <iosfwd>
35 #include <bitset>
36 #include <memory>
37 
38 // user include files
46 
47 // this is to retrieve HCAL digi's
53 
54 // this is to retrieve GT digi's
60 
61 // DQM stuff
65 
66 static const float adc2fC[128]={-0.5,0.5,1.5,2.5,3.5,4.5,5.5,6.5,7.5,8.5,9.5, 10.5,11.5,12.5,
67  13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
68  64.5,59.5,64.5,69.5,74.5,79.5,84.5,89.5,94.5,99.5,104.5,109.5,114.5,119.5,
69  124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
70  292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
71  559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
72  1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
73  1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
74  3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
75  5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
76 
77 
79  public:
82  void initialize();
83 
84  private:
85  virtual void beginJob() ;
86  virtual void analyze(const edm::Event&, const edm::EventSetup&);
87  virtual void endJob() ;
88 
89  double GetTime(double *data,int n){
90  int MaxI=-100; double Time=0,SumT=0,MaxT=-10;
91  for(int j=0;j<n;++j) if(MaxT<data[j]){ MaxT=data[j]; MaxI=j; }
92  if (MaxI>=0)
93  {
94  Time=MaxI*data[MaxI];
95  SumT=data[MaxI];
96  if(MaxI>0){ Time+=(MaxI-1)*data[MaxI-1]; SumT+=data[MaxI-1]; }
97  if(MaxI<(n-1)){ Time+=(MaxI+1)*data[MaxI+1]; SumT+=data[MaxI+1]; }
98  Time=Time/SumT;
99  }
100  return Time;
101  }
102  bool isSignal(double *data,int n){
103  int Imax=-1; double max=-100;
104  for(int i=0;i<n;i++) if(data[i]>max){max=data[i]; Imax=i;}
105  if(Imax==0 && Imax==(n-1)) return false;
106  float sum=data[Imax-1]+data[Imax+1];
107  if(data[Imax]>5.5 && sum>(data[Imax]*0.20)) return true;
108  return false;
109  }
112  // to be undependent from th DB we want to calculate pedestals using first 100 events
113  void set_hbhe(int eta,int phi,int depth,int cap,float val){
114  HBHE[eta+50][phi][depth][cap]+=val;
115  nHBHE[eta+50][phi][depth][cap]+=1.0;
116  }
117  void set_ho(int eta,int phi,int depth,int cap,float val){
118  HO[eta+50][phi][depth][cap]+=val;
119  nHO[eta+50][phi][depth][cap]+=1.0;
120  }
121  void set_hf(int eta,int phi,int depth,int cap,float val){
122  HF[eta+50][phi][depth][cap]+=val;
123  nHF[eta+50][phi][depth][cap]+=1.0;
124  }
125  double get_ped_hbhe(int eta,int phi,int depth,int cup){
126  if(nHBHE[eta+50][phi][depth][cup]<10) return 2.5;
127  if(nHBHE[eta+50][phi][depth][cup]!=0){
128  double ped=HBHE[eta+50][phi][depth][cup]/nHBHE[eta+50][phi][depth][cup];
129  if(ped>1.5 && ped<4.5) return ped;
130  }
131  return 99999;
132  }
133  double get_ped_ho(int eta,int phi,int depth,int cup){
134  if(nHO[eta+50][phi][depth][cup]<10) return 2.5;
135  if(nHO[eta+50][phi][depth][cup]!=0){
136  double ped=HO[eta+50][phi][depth][cup]/nHO[eta+50][phi][depth][cup];
137  if(ped>1.5 && ped<4.5) return ped;
138  }
139  return 99999;
140  }
141  double get_ped_hf(int eta,int phi,int depth,int cup){
142  if(nHF[eta+50][phi][depth][cup]<10) return 2.5;
143  if(nHF[eta+50][phi][depth][cup]!=0){
144  double ped=HF[eta+50][phi][depth][cup]/nHF[eta+50][phi][depth][cup];
145  if(ped>1.5 && ped<4.5) return ped;
146  }
147  return 99999;
148  }
149  double HBHE[100][73][5][4];
150  double nHBHE[100][73][5][4];
151  double HO[100][73][5][4];
152  double nHO[100][73][5][4];
153  double HF[100][73][5][4];
154  double nHF[100][73][5][4];
159 
161 
172  bool Debug_;
173 
176 
187 
198 
200 
204 };
205 
207  hbheDigiCollectionTag_(iConfig.getParameter<edm::InputTag>("hbheDigiCollectionTag")),
208  hoDigiCollectionTag_(iConfig.getParameter<edm::InputTag>("hoDigiCollectionTag")),
209  hfDigiCollectionTag_(iConfig.getParameter<edm::InputTag>("hfDigiCollectionTag")) {
210 
211  std::string str;
212  parameters_ = iConfig;
214  // Base folder for the contents of this job
215  std::string subsystemname = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "HcalTiming") ;
216 
217  monitorName_ = parameters_.getUntrackedParameter<std::string>("monitorName","HcalTiming");
218  if (monitorName_ != "" ) monitorName_ =subsystemname+"/"+monitorName_+"/" ;
219  counterEvt_=0;
220 
221  // some currently dummy things for compartability with GUI
222  dbe_->setCurrentFolder(subsystemname+"/EventInfo/");
223  str="reportSummary";
224  dbe_->bookFloat(str)->Fill(1); // Unknown status by default
225  str="reportSummaryMap";
226  MonitorElement* me=dbe_->book2D(str,str,5,0,5,1,0,1); // Unknown status by default
227  TH2F* myhist=me->getTH2F();
228  myhist->GetXaxis()->SetBinLabel(1,"HB");
229  myhist->GetXaxis()->SetBinLabel(2,"HE");
230  myhist->GetXaxis()->SetBinLabel(3,"HO");
231  myhist->GetXaxis()->SetBinLabel(4,"HF");
232  myhist->GetYaxis()->SetBinLabel(1,"Status");
233  // Unknown status by default
234  myhist->SetBinContent(1,1,-1);
235  myhist->SetBinContent(2,1,-1);
236  myhist->SetBinContent(3,1,-1);
237  myhist->SetBinContent(4,1,-1);
238  // Add ZDC at some point
239  myhist->GetXaxis()->SetBinLabel(5,"ZDC");
240  myhist->SetBinContent(5,1,-1); // no ZDC info known
241  myhist->SetOption("textcolz");
242 
243  run_number=0;
245  L1ADataLabel = iConfig.getUntrackedParameter<std::string>("L1ADataLabel" , "l1GtUnpack");
246  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", 1);
247  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", 1);
248  GCTTriggerBit1_= parameters_.getUntrackedParameter<int>("GCTTriggerBit1", -1);
249  GCTTriggerBit2_= parameters_.getUntrackedParameter<int>("GCTTriggerBit2", -1);
250  GCTTriggerBit3_= parameters_.getUntrackedParameter<int>("GCTTriggerBit3", -1);
251  GCTTriggerBit4_= parameters_.getUntrackedParameter<int>("GCTTriggerBit4", -1);
252  GCTTriggerBit5_= parameters_.getUntrackedParameter<int>("GCTTriggerBit5", -1);
253  CosmicsCorr_ = parameters_.getUntrackedParameter<bool>("CosmicsCorr", true);
254  Debug_ = parameters_.getUntrackedParameter<bool>("Debug", true);
255  initialize();
256 }
257 
259 
260 // ------------ method called once each job just before starting event loop ------------
262 // ------------ method called once each job just after ending the event loop ------------
264 
266  std::string str;
267  dbe_->setCurrentFolder(monitorName_+"DebugPlots");
268  str="L1MuGMTReadoutRecord_getDTBXCands"; DTcand =dbe_->book1D(str,str,5,-0.5,4.5);
269  str="L1MuGMTReadoutRecord_getBrlRPCCands"; RPCbcand=dbe_->book1D(str,str,5,-0.5,4.5);
270  str="L1MuGMTReadoutRecord_getFwdRPCCands"; RPCfcand=dbe_->book1D(str,str,5,-0.5,4.5);
271  str="L1MuGMTReadoutRecord_getCSCCands"; CSCcand =dbe_->book1D(str,str,5,-0.5,4.5);
272  str="DT_OR_RPCb_OR_RPCf_OR_CSC"; OR =dbe_->book1D(str,str,5,-0.5,4.5);
273 
274  str="HB Tower Energy (LinADC-PED)"; HBEnergy=dbe_->book1D(str,str,1000,-10,90);
275  str="HE Tower Energy (LinADC-PED)"; HEEnergy=dbe_->book1D(str,str,1000,-10,90);
276  str="HO Tower Energy (LinADC-PED)"; HOEnergy=dbe_->book1D(str,str,1000,-10,90);
277  str="HF Tower Energy (LinADC-PED)"; HFEnergy=dbe_->book1D(str,str,1000,-10,90);
278 
279  dbe_->setCurrentFolder(monitorName_+"ShapePlots");
280  str="HB Shape (DT Trigger)"; HBShapeDT =dbe_->book1D(str,str,10,-0.5,9.5);
281  str="HB Shape (RPC Trigger)"; HBShapeRPC =dbe_->book1D(str,str,10,-0.5,9.5);
282  str="HB Shape (GCT Trigger)"; HBShapeGCT =dbe_->book1D(str,str,10,-0.5,9.5);
283  str="HO Shape (DT Trigger)"; HOShapeDT =dbe_->book1D(str,str,10,-0.5,9.5);
284  str="HO Shape (RPC Trigger)"; HOShapeRPC =dbe_->book1D(str,str,10,-0.5,9.5);
285  str="HO Shape (GCT Trigger)"; HOShapeGCT =dbe_->book1D(str,str,10,-0.5,9.5);
286  str="HE+ Shape (CSC Trigger)"; HEShapeCSCp=dbe_->book1D(str,str,10,-0.5,9.5);
287  str="HE- Shape (CSC Trigger)"; HEShapeCSCm=dbe_->book1D(str,str,10,-0.5,9.5);
288  str="HF+ Shape (CSC Trigger)"; HFShapeCSCp=dbe_->book1D(str,str,10,-0.5,9.5);
289  str="HF- Shape (CSC Trigger)"; HFShapeCSCm=dbe_->book1D(str,str,10,-0.5,9.5);
290 
291  dbe_->setCurrentFolder(monitorName_+"TimingPlots");
292  str="HB Timing (DT Trigger)"; HBTimeDT =dbe_->book1D(str,str,100,0,10);
293  str="HB Timing (RPC Trigger)"; HBTimeRPC =dbe_->book1D(str,str,100,0,10);
294  str="HB Timing (GCT Trigger)"; HBTimeGCT =dbe_->book1D(str,str,100,0,10);
295  str="HO Timing (DT Trigger)"; HOTimeDT =dbe_->book1D(str,str,100,0,10);
296  str="HO Timing (RPC Trigger)"; HOTimeRPC =dbe_->book1D(str,str,100,0,10);
297  str="HO Timing (GCT Trigger)"; HOTimeGCT =dbe_->book1D(str,str,100,0,10);
298  str="HE+ Timing (CSC Trigger)"; HETimeCSCp =dbe_->book1D(str,str,100,0,10);
299  str="HE- Timing (CSC Trigger)"; HETimeCSCm =dbe_->book1D(str,str,100,0,10);
300  str="HF+ Timing (CSC Trigger)"; HFTimeCSCp =dbe_->book1D(str,str,100,0,10);
301  str="HF- Timing (CSC Trigger)"; HFTimeCSCm =dbe_->book1D(str,str,100,0,10);
302 }
303 
305 int HBcnt=0,HEcnt=0,HOcnt=0,HFcnt=0,eta,phi,depth,nTS;
306 int TRIGGER=0;
307  counterEvt_++;
308  if (prescaleEvt_<1) return;
309  if (counterEvt_%prescaleEvt_!=0) return;
310 
311  run_number=iEvent.id().run();
312  // Check GCT trigger bits
314 
315  if (!iEvent.getByLabel( L1ADataLabel, gtRecord))
316  return;
317  const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord();
318  const DecisionWord dWord = gtRecord->decisionWord();
319  //bool HFselfTrigger = tWord.at(9);
320  //bool HOselfTrigger = tWord.at(11);
321  bool GCTTrigger1 = dWord.at(GCTTriggerBit1_);
322  bool GCTTrigger2 = dWord.at(GCTTriggerBit2_);
323  bool GCTTrigger3 = dWord.at(GCTTriggerBit3_);
324  bool GCTTrigger4 = dWord.at(GCTTriggerBit4_);
325  bool GCTTrigger5 = dWord.at(GCTTriggerBit5_);
326  if(GCTTrigger1 || GCTTrigger2 || GCTTrigger3 || GCTTrigger4 || GCTTrigger5){ TrigGCT++; TRIGGER=+TRIG_GCT; }
327 
330  // define trigger trigger source (example from GMT group)
332  if (!iEvent.getByLabel(L1ADataLabel,gmtrc_handle)) return;
333  L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
334 
335  int idt =0;
336  int icsc =0;
337  int irpcb =0;
338  int irpcf =0;
339  int ndt[5] = {0,0,0,0,0};
340  int ncsc[5] = {0,0,0,0,0};
341  int nrpcb[5] = {0,0,0,0,0};
342  int nrpcf[5] = {0,0,0,0,0};
343  int N;
344 
345  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
346  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
347  N=0;
348  for(igmtrr=gmt_records.begin(); igmtrr!=gmt_records.end(); igmtrr++) {
349  std::vector<L1MuRegionalCand>::const_iterator iter1;
350  std::vector<L1MuRegionalCand> rmc;
351  // DTBX Trigger
352  rmc = igmtrr->getDTBXCands();
353  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
354  if ( idt < MAXDTBX && !(*iter1).empty() ) {
355  idt++;
356  if(N<5) ndt[N]++;
357 
358  }
359  }
360  // CSC Trigger
361  rmc = igmtrr->getCSCCands();
362  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
363  if ( icsc < MAXCSC && !(*iter1).empty() ) {
364  icsc++;
365  if(N<5) ncsc[N]++;
366  }
367  }
368  // RPCb Trigger
369  rmc = igmtrr->getBrlRPCCands();
370  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
371  if ( irpcb < MAXRPC && !(*iter1).empty() ) {
372  irpcb++;
373  if(N<5) nrpcb[N]++;
374 
375  }
376  }
377  // RPCfwd Trigger
378  rmc = igmtrr->getFwdRPCCands();
379  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
380  if ( irpcf < MAXRPC && !(*iter1).empty() ) {
381  irpcf++;
382  if(N<5) nrpcf[N]++;
383 
384  }
385  }
386 
387  N++;
388  }
389  if(ndt[0]) DTcand->Fill(0);
390  if(ndt[1]) DTcand->Fill(1);
391  if(ndt[2]) DTcand->Fill(2);
392  if(ndt[3]) DTcand->Fill(3);
393  if(ndt[4]) DTcand->Fill(4);
394  if(ncsc[0]) CSCcand->Fill(0);
395  if(ncsc[1]) CSCcand->Fill(1);
396  if(ncsc[2]) CSCcand->Fill(2);
397  if(ncsc[3]) CSCcand->Fill(3);
398  if(ncsc[4]) CSCcand->Fill(4);
399  if(nrpcb[0]) RPCbcand->Fill(0);
400  if(nrpcb[1]) RPCbcand->Fill(1);
401  if(nrpcb[2]) RPCbcand->Fill(2);
402  if(nrpcb[3]) RPCbcand->Fill(3);
403  if(nrpcb[4]) RPCbcand->Fill(4);
404  if(nrpcf[0]) RPCfcand->Fill(0);
405  if(nrpcf[1]) RPCfcand->Fill(1);
406  if(nrpcf[2]) RPCfcand->Fill(2);
407  if(nrpcf[3]) RPCfcand->Fill(3);
408  if(nrpcf[4]) RPCfcand->Fill(4);
409  if(ndt[0]||nrpcb[0]||nrpcf[0]||ncsc[0]) OR->Fill(0);
410  if(ndt[1]||nrpcb[1]||nrpcf[1]||ncsc[1]) OR->Fill(1);
411  if(ndt[2]||nrpcb[2]||nrpcf[2]||ncsc[2]) OR->Fill(2);
412  if(ndt[3]||nrpcb[3]||nrpcf[3]||ncsc[3]) OR->Fill(3);
413  if(ndt[4]||nrpcb[4]||nrpcf[4]||ncsc[4]) OR->Fill(4);
414 
415  if(ncsc[1]>0 ) { TrigCSC++; TRIGGER=+TRIG_CSC; }
416  if(ndt[1]>0 ) { TrigDT++; TRIGGER=+TRIG_DT; }
417  if(nrpcb[1]>0) { TrigRPC++; TRIGGER=+TRIG_RPC; }
418 
421  if(counterEvt_<100){
423  iEvent.getByLabel(hbheDigiCollectionTag_, hbhe);
424  if (hbhe.isValid())
425  {
426  for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){
427  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
428  if(digi->id().subdet()==HcalBarrel) HBcnt++;
429  if(digi->id().subdet()==HcalEndcap) HEcnt++;
430  for(int i=0;i<nTS;i++)
431  if(digi->sample(i).adc()<20) set_hbhe(eta,phi,depth,digi->sample(i).capid(),adc2fC[digi->sample(i).adc()]);
432  }
433  }
435  iEvent.getByLabel(hoDigiCollectionTag_, ho);
436  if (ho.isValid())
437  {
438  for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){
439  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
440  HOcnt++;
441  for(int i=0;i<nTS;i++)
442  if(digi->sample(i).adc()<20) set_ho(eta,phi,depth,digi->sample(i).capid(),adc2fC[digi->sample(i).adc()]);
443  }
444  } // if
445 
447  iEvent.getByLabel(hfDigiCollectionTag_, hf);
448  if (hf.isValid())
449  {
450  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
451  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
452  HFcnt++;
453  for(int i=0;i<nTS;i++)
454  if(digi->sample(i).adc()<20) set_hf(eta,phi,depth,digi->sample(i).capid(),adc2fC[digi->sample(i).adc()]);
455  }
456  }
457  } // if (counterEvt<100)
458  else{
460  double data[10];
461 
463  iEvent.getByLabel(hbheDigiCollectionTag_, hbhe);
464  if (hbhe.isValid())
465  {
466  for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){
467  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
468  if(nTS>10) nTS=10;
469  if(digi->id().subdet()==HcalBarrel) HBcnt++;
470  if(digi->id().subdet()==HcalEndcap) HEcnt++;
471  double energy=0;
472  for(int i=0;i<nTS;i++){
473  data[i]=adc2fC[digi->sample(i).adc()]-get_ped_hbhe(eta,phi,depth,digi->sample(i).capid());
474  energy+=data[i];
475  }
476  if(digi->id().subdet()==HcalBarrel) HBEnergy->Fill(energy);
477  if(digi->id().subdet()==HcalEndcap) HEEnergy->Fill(energy);
478  if(!isSignal(data,nTS)) continue;
479  for(int i=0;i<nTS;i++){
480  if(data[i]>-1.0){
481  if(digi->id().subdet()==HcalBarrel && (TRIGGER|TRIG_DT)==TRIG_DT) HBShapeDT->Fill(i,data[i]);
482  if(digi->id().subdet()==HcalBarrel && (TRIGGER|TRIG_RPC)==TRIG_RPC) HBShapeRPC->Fill(i,data[i]);
483  if(digi->id().subdet()==HcalBarrel && (TRIGGER|TRIG_GCT)==TRIG_GCT) HBShapeGCT->Fill(i,data[i]);
484  if(digi->id().subdet()==HcalEndcap && (TRIGGER|TRIG_CSC)==TRIG_CSC && eta>0) HEShapeCSCp->Fill(i,data[i]);
485  if(digi->id().subdet()==HcalEndcap && (TRIGGER|TRIG_CSC)==TRIG_CSC && eta<0) HEShapeCSCm->Fill(i,data[i]);
486  }
487  }
488  double Time=GetTime(data,nTS);
489  if(digi->id().subdet()==HcalBarrel){
490  if(CosmicsCorr_) Time+=(7.5*sin((phi*5.0)/180.0*3.14159))/25.0;
491  if((TRIGGER&TRIG_DT)==TRIG_DT) HBTimeDT ->Fill(GetTime(data,nTS));
492  if((TRIGGER&TRIG_RPC)==TRIG_RPC) HBTimeRPC->Fill(GetTime(data,nTS));
493  if((TRIGGER&TRIG_GCT)==TRIG_GCT) HBTimeGCT->Fill(GetTime(data,nTS));
494  }else{
495  if(CosmicsCorr_) Time+=(3.5*sin((phi*5.0)/180.0*3.14159))/25.0;
496  if(digi->id().subdet()==HcalEndcap && (TRIGGER&TRIG_CSC)==TRIG_CSC && eta>0) HETimeCSCp->Fill(Time);
497  if(digi->id().subdet()==HcalEndcap && (TRIGGER&TRIG_CSC)==TRIG_CSC && eta<0) HETimeCSCm->Fill(Time);
498  }
499  }
500  } // if (...)
501 
503  iEvent.getByLabel(hoDigiCollectionTag_, ho);
504  if (ho.isValid())
505  {
506  for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){
507  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
508  if(nTS>10) nTS=10;
509  HOcnt++;
510  double energy=0;
511  for(int i=0;i<nTS;i++){
512  data[i]=adc2fC[digi->sample(i).adc()]-get_ped_ho(eta,phi,depth,digi->sample(i).capid());
513  energy+=data[i];
514  }
515  HOEnergy->Fill(energy);
516  if(!isSignal(data,nTS)) continue;
517  for(int i=0;i<nTS;i++){
518  if(data[i]>-1.0){
519  if((TRIGGER&TRIG_DT)==TRIG_DT) HOShapeDT->Fill(i,data[i]);
520  if((TRIGGER&TRIG_RPC)==TRIG_RPC) HOShapeRPC->Fill(i,data[i]);
521  if((TRIGGER&TRIG_GCT)==TRIG_GCT) HOShapeGCT->Fill(i,data[i]);
522  }
523  }
524  double Time=GetTime(data,nTS);
525  if(CosmicsCorr_) Time+=(12.0*sin((phi*5.0)/180.0*3.14159))/25.0;
526  if((TRIGGER&TRIG_DT)==TRIG_DT) HOTimeDT->Fill(Time);
527  if((TRIGGER&TRIG_RPC)==TRIG_RPC) HOTimeRPC->Fill(Time);
528  if((TRIGGER&TRIG_GCT)==TRIG_GCT) HOTimeGCT->Fill(Time);
529  }
530  }// if (ho)
531 
533  iEvent.getByLabel(hfDigiCollectionTag_, hf);
534  if (hf.isValid())
535  {
536  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
537  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
538  if(nTS>10) nTS=10;
539  HFcnt++;
540  double energy=0;
541  for(int i=0;i<nTS;i++){
542  data[i]=adc2fC[digi->sample(i).adc()]-get_ped_hf(eta,phi,depth,digi->sample(i).capid());
543  energy+=data[i];
544  }
545  HFEnergy->Fill(energy);
546  if(energy<15.0) continue;
547  for(int i=0;i<nTS;i++){
548  if(data[i]>-1.0){
549  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta>0) HFShapeCSCp->Fill(i,data[i]);
550  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta<0) HFShapeCSCm->Fill(i,data[i]);
551  }
552  }
553  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta>0) HFTimeCSCp->Fill(GetTime(data,nTS));
554  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta<0) HFTimeCSCm->Fill(GetTime(data,nTS));
555  }
556  } // if (hf)
559  }
560  if(Debug_) if((counterEvt_%100)==0) printf("Run: %i,Events processed: %i (HB: %i towers,HE: %i towers,HO: %i towers,HF: %i towers)"
561  " CSC: %i DT: %i RPC: %i GCT: %i\n",
562  run_number,counterEvt_,HBcnt,HEcnt,HOcnt,HFcnt,TrigCSC,TrigDT,TrigRPC,TrigGCT);
565 }
566 //define this as a plug-in
568 
569 
RunNumber_t run() const
Definition: EventID.h:42
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
static const int MAXCSC
static const int TRIG_RPC
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
HcalTimingMonitorModule(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double GetTime(double *data, int n)
double get_ped_ho(int eta, int phi, int depth, int cup)
std::vector< T >::const_iterator const_iterator
static const int TRIG_GCT
static const int MAXRPC
void set_hf(int eta, int phi, int depth, int cap, float val)
T eta() const
static const int MAXGEN
static const float adc2fC[128]
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:659
bool isSignal(double *data, int n)
void Fill(long long x)
static const int TRIG_CSC
int iEvent
Definition: GenABIO.cc:243
static const int MAXDTBX
const T & max(const T &a, const T &b)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< bool > DecisionWord
typedefs
int j
Definition: DBlmapReader.cc:9
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
double get_ped_hbhe(int eta, int phi, int depth, int cup)
void set_hbhe(int eta, int phi, int depth, int cap, float val)
#define N
Definition: blowfish.cc:9
void set_ho(int eta, int phi, int depth, int cap, float val)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:56
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
static const int MAXGMT
TH2F * getTH2F(void) const
static const int TRIG_DT
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:850
double get_ped_hf(int eta, int phi, int depth, int cup)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
Definition: DDAxes.h:10