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