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