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.9 2010/04/04 15:49:24 temple 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
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() ;
85  virtual void analyze(const edm::Event&, const edm::EventSetup&);
86  virtual void endJob() ;
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 
163  std::string monitorName_;
171  bool Debug_;
172 
175 
186 
197 
198  std::string L1ADataLabel;
199 };
200 
202  std::string str;
203  parameters_ = iConfig;
205  // Base folder for the contents of this job
206  std::string subsystemname = parameters_.getUntrackedParameter<std::string>("subSystemFolder", "HcalTiming") ;
207 
208  monitorName_ = parameters_.getUntrackedParameter<std::string>("monitorName","HcalTiming");
209  if (monitorName_ != "" ) monitorName_ =subsystemname+"/"+monitorName_+"/" ;
210  counterEvt_=0;
211 
212  // some currently dummy things for compartability with GUI
213  dbe_->setCurrentFolder(subsystemname+"/EventInfo/");
214  str="reportSummary";
215  dbe_->bookFloat(str)->Fill(1); // Unknown status by default
216  str="reportSummaryMap";
217  MonitorElement* me=dbe_->book2D(str,str,5,0,5,1,0,1); // Unknown status by default
218  TH2F* myhist=me->getTH2F();
219  myhist->GetXaxis()->SetBinLabel(1,"HB");
220  myhist->GetXaxis()->SetBinLabel(2,"HE");
221  myhist->GetXaxis()->SetBinLabel(3,"HO");
222  myhist->GetXaxis()->SetBinLabel(4,"HF");
223  myhist->GetYaxis()->SetBinLabel(1,"Status");
224  // Unknown status by default
225  myhist->SetBinContent(1,1,-1);
226  myhist->SetBinContent(2,1,-1);
227  myhist->SetBinContent(3,1,-1);
228  myhist->SetBinContent(4,1,-1);
229  // Add ZDC at some point
230  myhist->GetXaxis()->SetBinLabel(5,"ZDC");
231  myhist->SetBinContent(5,1,-1); // no ZDC info known
232  myhist->SetOption("textcolz");
233 
234  run_number=0;
236  L1ADataLabel = iConfig.getUntrackedParameter<std::string>("L1ADataLabel" , "l1GtUnpack");
237  prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", 1);
238  prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", 1);
239  GCTTriggerBit1_= parameters_.getUntrackedParameter<int>("GCTTriggerBit1", -1);
240  GCTTriggerBit2_= parameters_.getUntrackedParameter<int>("GCTTriggerBit2", -1);
241  GCTTriggerBit3_= parameters_.getUntrackedParameter<int>("GCTTriggerBit3", -1);
242  GCTTriggerBit4_= parameters_.getUntrackedParameter<int>("GCTTriggerBit4", -1);
243  GCTTriggerBit5_= parameters_.getUntrackedParameter<int>("GCTTriggerBit5", -1);
244  CosmicsCorr_ = parameters_.getUntrackedParameter<bool>("CosmicsCorr", true);
245  Debug_ = parameters_.getUntrackedParameter<bool>("Debug", true);
246  initialize();
247 }
248 
250 
251 // ------------ method called once each job just before starting event loop ------------
253 // ------------ method called once each job just after ending the event loop ------------
255 
257  std::string str;
258  dbe_->setCurrentFolder(monitorName_+"DebugPlots");
259  str="L1MuGMTReadoutRecord_getDTBXCands"; DTcand =dbe_->book1D(str,str,5,-0.5,4.5);
260  str="L1MuGMTReadoutRecord_getBrlRPCCands"; RPCbcand=dbe_->book1D(str,str,5,-0.5,4.5);
261  str="L1MuGMTReadoutRecord_getFwdRPCCands"; RPCfcand=dbe_->book1D(str,str,5,-0.5,4.5);
262  str="L1MuGMTReadoutRecord_getCSCCands"; CSCcand =dbe_->book1D(str,str,5,-0.5,4.5);
263  str="DT_OR_RPCb_OR_RPCf_OR_CSC"; OR =dbe_->book1D(str,str,5,-0.5,4.5);
264 
265  str="HB Tower Energy (LinADC-PED)"; HBEnergy=dbe_->book1D(str,str,1000,-10,90);
266  str="HE Tower Energy (LinADC-PED)"; HEEnergy=dbe_->book1D(str,str,1000,-10,90);
267  str="HO Tower Energy (LinADC-PED)"; HOEnergy=dbe_->book1D(str,str,1000,-10,90);
268  str="HF Tower Energy (LinADC-PED)"; HFEnergy=dbe_->book1D(str,str,1000,-10,90);
269 
270  dbe_->setCurrentFolder(monitorName_+"ShapePlots");
271  str="HB Shape (DT Trigger)"; HBShapeDT =dbe_->book1D(str,str,10,-0.5,9.5);
272  str="HB Shape (RPC Trigger)"; HBShapeRPC =dbe_->book1D(str,str,10,-0.5,9.5);
273  str="HB Shape (GCT Trigger)"; HBShapeGCT =dbe_->book1D(str,str,10,-0.5,9.5);
274  str="HO Shape (DT Trigger)"; HOShapeDT =dbe_->book1D(str,str,10,-0.5,9.5);
275  str="HO Shape (RPC Trigger)"; HOShapeRPC =dbe_->book1D(str,str,10,-0.5,9.5);
276  str="HO Shape (GCT Trigger)"; HOShapeGCT =dbe_->book1D(str,str,10,-0.5,9.5);
277  str="HE+ Shape (CSC Trigger)"; HEShapeCSCp=dbe_->book1D(str,str,10,-0.5,9.5);
278  str="HE- Shape (CSC Trigger)"; HEShapeCSCm=dbe_->book1D(str,str,10,-0.5,9.5);
279  str="HF+ Shape (CSC Trigger)"; HFShapeCSCp=dbe_->book1D(str,str,10,-0.5,9.5);
280  str="HF- Shape (CSC Trigger)"; HFShapeCSCm=dbe_->book1D(str,str,10,-0.5,9.5);
281 
282  dbe_->setCurrentFolder(monitorName_+"TimingPlots");
283  str="HB Timing (DT Trigger)"; HBTimeDT =dbe_->book1D(str,str,100,0,10);
284  str="HB Timing (RPC Trigger)"; HBTimeRPC =dbe_->book1D(str,str,100,0,10);
285  str="HB Timing (GCT Trigger)"; HBTimeGCT =dbe_->book1D(str,str,100,0,10);
286  str="HO Timing (DT Trigger)"; HOTimeDT =dbe_->book1D(str,str,100,0,10);
287  str="HO Timing (RPC Trigger)"; HOTimeRPC =dbe_->book1D(str,str,100,0,10);
288  str="HO Timing (GCT Trigger)"; HOTimeGCT =dbe_->book1D(str,str,100,0,10);
289  str="HE+ Timing (CSC Trigger)"; HETimeCSCp =dbe_->book1D(str,str,100,0,10);
290  str="HE- Timing (CSC Trigger)"; HETimeCSCm =dbe_->book1D(str,str,100,0,10);
291  str="HF+ Timing (CSC Trigger)"; HFTimeCSCp =dbe_->book1D(str,str,100,0,10);
292  str="HF- Timing (CSC Trigger)"; HFTimeCSCm =dbe_->book1D(str,str,100,0,10);
293 }
294 
296 int HBcnt=0,HEcnt=0,HOcnt=0,HFcnt=0,eta,phi,depth,nTS;
297 int TRIGGER=0;
298  counterEvt_++;
299  if (prescaleEvt_<1) return;
300  if (counterEvt_%prescaleEvt_!=0) return;
301 
302  run_number=iEvent.id().run();
303  // Check GCT trigger bits
305 
306  if (!iEvent.getByLabel( L1ADataLabel, gtRecord))
307  return;
308  const TechnicalTriggerWord tWord = gtRecord->technicalTriggerWord();
309  const DecisionWord dWord = gtRecord->decisionWord();
310  //bool HFselfTrigger = tWord.at(9);
311  //bool HOselfTrigger = tWord.at(11);
312  bool GCTTrigger1 = dWord.at(GCTTriggerBit1_);
313  bool GCTTrigger2 = dWord.at(GCTTriggerBit2_);
314  bool GCTTrigger3 = dWord.at(GCTTriggerBit3_);
315  bool GCTTrigger4 = dWord.at(GCTTriggerBit4_);
316  bool GCTTrigger5 = dWord.at(GCTTriggerBit5_);
317  if(GCTTrigger1 || GCTTrigger2 || GCTTrigger3 || GCTTrigger4 || GCTTrigger5){ TrigGCT++; TRIGGER=+TRIG_GCT; }
318 
321  // define trigger trigger source (example from GMT group)
323  if (!iEvent.getByLabel(L1ADataLabel,gmtrc_handle)) return;
324  L1MuGMTReadoutCollection const* gmtrc = gmtrc_handle.product();
325 
326  int idt =0;
327  int icsc =0;
328  int irpcb =0;
329  int irpcf =0;
330  int ndt[5] = {0,0,0,0,0};
331  int ncsc[5] = {0,0,0,0,0};
332  int nrpcb[5] = {0,0,0,0,0};
333  int nrpcf[5] = {0,0,0,0,0};
334  int N;
335 
336  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
337  std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr;
338  N=0;
339  for(igmtrr=gmt_records.begin(); igmtrr!=gmt_records.end(); igmtrr++) {
340  std::vector<L1MuRegionalCand>::const_iterator iter1;
341  std::vector<L1MuRegionalCand> rmc;
342  // DTBX Trigger
343  rmc = igmtrr->getDTBXCands();
344  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
345  if ( idt < MAXDTBX && !(*iter1).empty() ) {
346  idt++;
347  if(N<5) ndt[N]++;
348 
349  }
350  }
351  // CSC Trigger
352  rmc = igmtrr->getCSCCands();
353  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
354  if ( icsc < MAXCSC && !(*iter1).empty() ) {
355  icsc++;
356  if(N<5) ncsc[N]++;
357  }
358  }
359  // RPCb Trigger
360  rmc = igmtrr->getBrlRPCCands();
361  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
362  if ( irpcb < MAXRPC && !(*iter1).empty() ) {
363  irpcb++;
364  if(N<5) nrpcb[N]++;
365 
366  }
367  }
368  // RPCfwd Trigger
369  rmc = igmtrr->getFwdRPCCands();
370  for(iter1=rmc.begin(); iter1!=rmc.end(); iter1++) {
371  if ( irpcf < MAXRPC && !(*iter1).empty() ) {
372  irpcf++;
373  if(N<5) nrpcf[N]++;
374 
375  }
376  }
377 
378  N++;
379  }
380  if(ndt[0]) DTcand->Fill(0);
381  if(ndt[1]) DTcand->Fill(1);
382  if(ndt[2]) DTcand->Fill(2);
383  if(ndt[3]) DTcand->Fill(3);
384  if(ndt[4]) DTcand->Fill(4);
385  if(ncsc[0]) CSCcand->Fill(0);
386  if(ncsc[1]) CSCcand->Fill(1);
387  if(ncsc[2]) CSCcand->Fill(2);
388  if(ncsc[3]) CSCcand->Fill(3);
389  if(ncsc[4]) CSCcand->Fill(4);
390  if(nrpcb[0]) RPCbcand->Fill(0);
391  if(nrpcb[1]) RPCbcand->Fill(1);
392  if(nrpcb[2]) RPCbcand->Fill(2);
393  if(nrpcb[3]) RPCbcand->Fill(3);
394  if(nrpcb[4]) RPCbcand->Fill(4);
395  if(nrpcf[0]) RPCfcand->Fill(0);
396  if(nrpcf[1]) RPCfcand->Fill(1);
397  if(nrpcf[2]) RPCfcand->Fill(2);
398  if(nrpcf[3]) RPCfcand->Fill(3);
399  if(nrpcf[4]) RPCfcand->Fill(4);
400  if(ndt[0]||nrpcb[0]||nrpcf[0]||ncsc[0]) OR->Fill(0);
401  if(ndt[1]||nrpcb[1]||nrpcf[1]||ncsc[1]) OR->Fill(1);
402  if(ndt[2]||nrpcb[2]||nrpcf[2]||ncsc[2]) OR->Fill(2);
403  if(ndt[3]||nrpcb[3]||nrpcf[3]||ncsc[3]) OR->Fill(3);
404  if(ndt[4]||nrpcb[4]||nrpcf[4]||ncsc[4]) OR->Fill(4);
405 
406  if(ncsc[1]>0 ) { TrigCSC++; TRIGGER=+TRIG_CSC; }
407  if(ndt[1]>0 ) { TrigDT++; TRIGGER=+TRIG_DT; }
408  if(nrpcb[1]>0) { TrigRPC++; TRIGGER=+TRIG_RPC; }
409 
412  if(counterEvt_<100){
414  iEvent.getByType(hbhe);
415  if (hbhe.isValid())
416  {
417  for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){
418  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
419  if(digi->id().subdet()==HcalBarrel) HBcnt++;
420  if(digi->id().subdet()==HcalEndcap) HEcnt++;
421  for(int i=0;i<nTS;i++)
422  if(digi->sample(i).adc()<20) set_hbhe(eta,phi,depth,digi->sample(i).capid(),adc2fC[digi->sample(i).adc()]);
423  }
424  }
426  iEvent.getByType(ho);
427  if (ho.isValid())
428  {
429  for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){
430  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
431  HOcnt++;
432  for(int i=0;i<nTS;i++)
433  if(digi->sample(i).adc()<20) set_ho(eta,phi,depth,digi->sample(i).capid(),adc2fC[digi->sample(i).adc()]);
434  }
435  } // if
436 
438  iEvent.getByType(hf);
439  if (hf.isValid())
440  {
441  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
442  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
443  HFcnt++;
444  for(int i=0;i<nTS;i++)
445  if(digi->sample(i).adc()<20) set_hf(eta,phi,depth,digi->sample(i).capid(),adc2fC[digi->sample(i).adc()]);
446  }
447  }
448  } // if (counterEvt<100)
449  else{
451  double data[10];
452 
454  iEvent.getByType(hbhe);
455  if (hbhe.isValid())
456  {
457  for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){
458  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
459  if(nTS>10) nTS=10;
460  if(digi->id().subdet()==HcalBarrel) HBcnt++;
461  if(digi->id().subdet()==HcalEndcap) HEcnt++;
462  double energy=0;
463  for(int i=0;i<nTS;i++){
464  data[i]=adc2fC[digi->sample(i).adc()]-get_ped_hbhe(eta,phi,depth,digi->sample(i).capid());
465  energy+=data[i];
466  }
467  if(digi->id().subdet()==HcalBarrel) HBEnergy->Fill(energy);
468  if(digi->id().subdet()==HcalEndcap) HEEnergy->Fill(energy);
469  if(!isSignal(data,nTS)) continue;
470  for(int i=0;i<nTS;i++){
471  if(data[i]>-1.0){
472  if(digi->id().subdet()==HcalBarrel && (TRIGGER|TRIG_DT)==TRIG_DT) HBShapeDT->Fill(i,data[i]);
473  if(digi->id().subdet()==HcalBarrel && (TRIGGER|TRIG_RPC)==TRIG_RPC) HBShapeRPC->Fill(i,data[i]);
474  if(digi->id().subdet()==HcalBarrel && (TRIGGER|TRIG_GCT)==TRIG_GCT) HBShapeGCT->Fill(i,data[i]);
475  if(digi->id().subdet()==HcalEndcap && (TRIGGER|TRIG_CSC)==TRIG_CSC && eta>0) HEShapeCSCp->Fill(i,data[i]);
476  if(digi->id().subdet()==HcalEndcap && (TRIGGER|TRIG_CSC)==TRIG_CSC && eta<0) HEShapeCSCm->Fill(i,data[i]);
477  }
478  }
479  double Time=GetTime(data,nTS);
480  if(digi->id().subdet()==HcalBarrel){
481  if(CosmicsCorr_) Time+=(7.5*sin((phi*5.0)/180.0*3.14159))/25.0;
482  if((TRIGGER&TRIG_DT)==TRIG_DT) HBTimeDT ->Fill(GetTime(data,nTS));
483  if((TRIGGER&TRIG_RPC)==TRIG_RPC) HBTimeRPC->Fill(GetTime(data,nTS));
484  if((TRIGGER&TRIG_GCT)==TRIG_GCT) HBTimeGCT->Fill(GetTime(data,nTS));
485  }else{
486  if(CosmicsCorr_) Time+=(3.5*sin((phi*5.0)/180.0*3.14159))/25.0;
487  if(digi->id().subdet()==HcalEndcap && (TRIGGER&TRIG_CSC)==TRIG_CSC && eta>0) HETimeCSCp->Fill(Time);
488  if(digi->id().subdet()==HcalEndcap && (TRIGGER&TRIG_CSC)==TRIG_CSC && eta<0) HETimeCSCm->Fill(Time);
489  }
490  }
491  } // if (...)
492 
494  iEvent.getByType(ho);
495  if (ho.isValid())
496  {
497  for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){
498  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
499  if(nTS>10) nTS=10;
500  HOcnt++;
501  double energy=0;
502  for(int i=0;i<nTS;i++){
503  data[i]=adc2fC[digi->sample(i).adc()]-get_ped_ho(eta,phi,depth,digi->sample(i).capid());
504  energy+=data[i];
505  }
506  HOEnergy->Fill(energy);
507  if(!isSignal(data,nTS)) continue;
508  for(int i=0;i<nTS;i++){
509  if(data[i]>-1.0){
510  if((TRIGGER&TRIG_DT)==TRIG_DT) HOShapeDT->Fill(i,data[i]);
511  if((TRIGGER&TRIG_RPC)==TRIG_RPC) HOShapeRPC->Fill(i,data[i]);
512  if((TRIGGER&TRIG_GCT)==TRIG_GCT) HOShapeGCT->Fill(i,data[i]);
513  }
514  }
515  double Time=GetTime(data,nTS);
516  if(CosmicsCorr_) Time+=(12.0*sin((phi*5.0)/180.0*3.14159))/25.0;
517  if((TRIGGER&TRIG_DT)==TRIG_DT) HOTimeDT->Fill(Time);
518  if((TRIGGER&TRIG_RPC)==TRIG_RPC) HOTimeRPC->Fill(Time);
519  if((TRIGGER&TRIG_GCT)==TRIG_GCT) HOTimeGCT->Fill(Time);
520  }
521  }// if (ho)
522 
524  iEvent.getByType(hf);
525  if (hf.isValid())
526  {
527  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
528  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
529  if(nTS>10) nTS=10;
530  HFcnt++;
531  double energy=0;
532  for(int i=0;i<nTS;i++){
533  data[i]=adc2fC[digi->sample(i).adc()]-get_ped_hf(eta,phi,depth,digi->sample(i).capid());
534  energy+=data[i];
535  }
536  HFEnergy->Fill(energy);
537  if(energy<15.0) continue;
538  for(int i=0;i<nTS;i++){
539  if(data[i]>-1.0){
540  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta>0) HFShapeCSCp->Fill(i,data[i]);
541  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta<0) HFShapeCSCm->Fill(i,data[i]);
542  }
543  }
544  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta>0) HFTimeCSCp->Fill(GetTime(data,nTS));
545  if((TRIGGER&TRIG_CSC)==TRIG_CSC && eta<0) HFTimeCSCm->Fill(GetTime(data,nTS));
546  }
547  } // if (hf)
550  }
551  if(Debug_) if((counterEvt_%100)==0) printf("Run: %i,Events processed: %i (HB: %i towers,HE: %i towers,HO: %i towers,HF: %i towers)"
552  " CSC: %i DT: %i RPC: %i GCT: %i\n",
553  run_number,counterEvt_,HBcnt,HEcnt,HOcnt,HFcnt,TrigCSC,TrigDT,TrigRPC,TrigGCT);
556 }
557 //define this as a plug-in
559 
560 
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:514
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
bool getByType(Handle< PROD > &result) const
Definition: Event.h:397
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:451
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:355
double get_ped_hbhe(int eta, int phi, int depth, int cup)
std::vector< L1MuGMTReadoutRecord > getRecords() const
void set_hbhe(int eta, int phi, int depth, int cap, float val)
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
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:642
double get_ped_hf(int eta, int phi, int depth, int cup)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
Definition: DDAxes.h:10