CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDetDiagLaserMonitor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalDetDiagLaserMonitor
4 // Class: HcalDetDiagLaserMonitor
5 //
13 //
14 // Original Author: Dmitry Vishnevskiy,591 R-013,+41227674265,
15 // Created: Wed Mar 3 12:14:16 CET 2010
16 //
17 //
18 
25 
29 
32 
33 #include <math.h>
34 
35 // this is to retrieve HCAL digi's
37 // to retrive trigger information (local runs only)
39 
42 
49 
50 #include "TFile.h"
51 #include "TTree.h"
52 #include "TSystem.h"
53 #include "TF1.h"
54 
57 
58 #include <iostream>
59 #include <fstream>
60 
62 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,
63  13.5,15.,17.,19.,21.,23.,25.,27.,29.5,32.5,35.5,38.5,42.,46.,50.,54.5,59.5,
64  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,
65  124.5,129.5,137.,147.,157.,167.,177.,187.,197.,209.5,224.5,239.5,254.5,272.,
66  292.,312.,334.5,359.5,384.5,359.5,384.5,409.5,434.5,459.5,484.5,509.5,534.5,
67  559.5,584.5,609.5,634.5,659.5,684.5,709.5,747.,797.,847.,897.,947.,997.,
68  1047.,1109.5,1184.5,1259.5,1334.5,1422.,1522.,1622.,1734.5,1859.5,1984.5,
69  1859.5,1984.5,2109.5,2234.5,2359.5,2484.5,2609.5,2734.5,2859.5,2984.5,
70  3109.5,3234.5,3359.5,3484.5,3609.5,3797.,4047.,4297.,4547.,4797.,5047.,
71  5297.,5609.5,5984.5,6359.5,6734.5,7172.,7672.,8172.,8734.5,9359.5,9984.5};
73 typedef struct{
74 int eta;
75 int phi;
76 int depth;
77 }Raddam_ch;
78 
79 Raddam_ch RADDAM_CH[56]={{-30,35,1},{-30,71,1},{-32,15,1},{-32,51,1},{-34,35,1},{-34,71,1},{-36,15,1},
80  {-36,51,1},{-38,35,1},{-38,71,1},{-40,15,1},{-40,51,1},{-41,35,1},{-41,71,1},
81  {30,21,1}, {30,57,1}, {32,1,1}, {32,37,1}, {34,21,1}, {34,57,1}, {36,1,1 },
82  {36,37,1}, {38,21,1}, {38,57,1}, {40,35,1}, {40,71,1}, {41,19,1}, {41,55,1 },
83  {-30,15,2},{-30,51,2},{-32,35,2},{-32,71,2},{-34,15,2},{-34,51,2},{-36,35,2},
84  {-36,71,2},{-38,15,2},{-38,51,2},{-40,35,2},{-40,71,2},{-41,15,2},{-41,51,2},
85  {30,1,2}, {30,37,2}, {32,21,2}, {32,57,2}, {34,1,2}, {34,37,2}, {36,21,2 },
86  {36,57,2}, {38,1,2}, {38,37,2}, {40,19,2}, {40,55,2}, {41,35,2}, {41,71,2}};
88  public:
90  for(int i=0;i<128;i++) s1_adc[i]=s2_adc[i]=0;
94  }
96  int TOTEVNT;
97  int CUT1EVNT;
98  int CUT2EVNT;
99  float S1MEAN,S2MEAN;
100  float S1RMS,S2RMS;
104  float S1CHI2,S2CHI2;
105  float S1NDF,S2NDF;
107  int s1_adc[128];
108  int s2_adc[128];
109 };
110 
112 
114 public:
116  IsRefetence=false;
119  status=0;
120  reset();
121  reset1();
122  }
123  void reset(){
124  Xe=XXe=Xt=XXt=n=0;
125  overflow=0;
126  undeflow=0;
127  }
128  void reset1(){
129  Xe1=0;
130  XXe1=0;
131  Xt1=0;
132  XXt1=0;
133  n1=0;
134  overflow1=0;
135  undeflow1=0;
136  }
137  void add_statistics(double *data,int nTS){
138  double e=GetEnergy(data,nTS);
139  double t=GetTime(data,nTS);
140  if(e<20){ undeflow++;undeflow1++; }else if(e>10000){ overflow++;overflow1++; }else{
141  n++; Xe+=e; XXe+=e*e; Xt+=t; XXt+=t*t;
142  n1++; Xe1+=e; XXe1+=e*e; Xt1+=t; XXt1+=t*t;
143  }
144  }
145  void set_reference(float val,float rms,float time,float time_rms){
146  ref_amp=val; ref_rms=rms;
147  ref_time=time; ref_time_rms=time_rms;
148  IsRefetence=true;
149  }
150  void set_data(float val,float rms,float time,float time_rms){
151  ds_amp=val; ds_rms=rms;
152  ds_time=time; ds_time_rms=time_rms;
153  }
154  void change_status(int val){
155  status|=val;
156  }
157  int get_status(){
158  return status;
159  }
160  bool get_reference(double *val,double *rms,double *time,double *time_rms){
161  *val=ref_amp; *rms=ref_rms;
162  *time=ref_time; *time_rms=ref_time_rms;
163  return IsRefetence;
164  }
165  bool get_average_amp(double *ave,double *rms){
166  if(ds_time>-10){ *ave=ds_amp; *rms=ds_rms; return true; }
167  if(n>0){ *ave=Xe/n; *rms=sqrt(XXe/n-(Xe*Xe)/(n*n));} else return false;
168  return true;
169  }
170  bool get_average_time(double *ave,double *rms){
171  if(ds_time>-10){ *ave=ds_time; *rms=ds_time_rms; return true; }
172  if(n>0){ *ave=Xt/n; *rms=sqrt(XXt/n-(Xt*Xt)/(n*n));} else return false;
173  return true;
174  }
176  return (int)n;
177  }
178  void set_statistics(int stat){
179  n=stat;
180  }
181  void set_statistics1(int stat){
182  n1=stat;
183  }
185  return overflow;
186  }
188  return undeflow;
189  }
190  bool get_average_amp1(double *ave,double *rms){
191  if(ds_time>-10){ *ave=ds_amp; *rms=ds_rms; return true; }
192  if(n1>0){ *ave=Xe1/n1; *rms=sqrt(XXe1/n1-(Xe1*Xe1)/(n1*n1));} else return false;
193  return true;
194  }
195  bool get_average_time1(double *ave,double *rms){
196  if(ds_time>-10){ *ave=ds_time; *rms=ds_time_rms; return true; }
197  if(n1>0){ *ave=Xt1/n1; *rms=sqrt(XXt1/n1-(Xt1*Xt1)/(n1*n1));} else return false;
198  return true;
199  }
201  return (int)n1;
202  }
204  return overflow1;
205  }
207  return undeflow1;
208  }
209  double GetEnergy(double *data,int n){
210  int MaxI=0; double Energy,MaxE=0;
211  for(int j=0;j<n;++j) if(MaxE<data[j]){ MaxE=data[j]; MaxI=j; }
212  Energy=data[MaxI];
213  if(MaxI>0) Energy+=data[MaxI-1];
214  if(MaxI>1) Energy+=data[MaxI-2];
215  if(MaxI<(n-1)) Energy+=data[MaxI+1];
216  if(MaxI<(n-2)) Energy+=data[MaxI+2];
217  return Energy;
218  }
219  double GetTime(double *data,int n=10){
220  int MaxI=-100; double Time=-9999,SumT=0,MaxT=-10;
221  for(int j=0;j<n;++j) if(MaxT<data[j]){ MaxT=data[j]; MaxI=j; }
222  if (MaxI>=0) // dummy protection so that compiler doesn't think MaxI=-100
223  {
224  Time=MaxI*data[MaxI];
225  SumT=data[MaxI];
226  if(MaxI>0){ Time+=(MaxI-1)*data[MaxI-1]; SumT+=data[MaxI-1]; }
227  if(MaxI<(n-1)){ Time+=(MaxI+1)*data[MaxI+1]; SumT+=data[MaxI+1]; }
228  Time=Time/SumT;
229  }
230  return Time;
231  }
232  int overflow;
233  int undeflow;
236  double Xe,XXe,Xt,XXt,n;
237  double Xe1,XXe1,Xt1,XXt1,n1;
239  float ref_amp;
240  float ref_rms;
241  float ref_time;
243  float ds_amp;
244  float ds_rms;
245  float ds_time;
246  float ds_time_rms;
247  int status;
249 };
250 
252  public:
255 
256  private:
258  int SD=0,ETA=0,PHI=0;
259  if(sd.compare("HB")==0) SD=1;
260  if(sd.compare("HE")==0) SD=2;
261  if(sd.compare("HO")==0) SD=3;
262  if(sd.compare("HF")==0) SD=4;
263  if(SD==1 || SD==2){
264  if(eta>0) ETA=1; else ETA=-1;
265  if(phi==71 ||phi==72 || phi==1 || phi==2) PHI=71; else PHI=((phi-3)/4)*4+3;
266  }else if(SD==3){
267  if(abs(eta)<=4){
268  ETA=0;
269  if(phi==71 ||phi==72 || phi==1 || phi==2 || phi==3 || phi==4) PHI=71; else PHI=((phi-5)/6)*6+5;
270  }else{
271  if(abs(eta)>4 && abs(eta)<=10) ETA=1;
272  if(abs(eta)>10 && abs(eta)<=15) ETA=2;
273  if(eta<0) ETA=-ETA;
274  if(phi==71 ||phi==72 || (phi>=1 && phi<=10)) PHI=71; else PHI=((phi-11)/12)*12+11;
275  }
276  }else if(SD==4){
277  if(eta>0) ETA=1; else ETA=-1;
278  if(phi>=1 && phi<=18) PHI=1;
279  if(phi>=19 && phi<=36) PHI=19;
280  if(phi>=37 && phi<=54) PHI=37;
281  if(phi>=55 && phi<=72) PHI=55;
282  }
283  return &calib_data[SD][ETA+2][PHI-1];
284  };
285  void beginRun(const edm::Run& run, const edm::EventSetup& c) override;
286  void endRun(const edm::Run& run, const edm::EventSetup& c) override;
287  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& c) override ;
288  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& c) override;
289  void analyze(const edm::Event&, const edm::EventSetup&) override;
290 
293 
300 
301  void SaveReference();
302  void SaveRaddamData();
303  void LoadReference();
304  void LoadDataset();
305 
306  bool get_ave_rbx(int sd,int side,int rbx,float *ave,float *rms);
307  bool get_ave_subdet(int sd,float *ave_t,float *ave_e,float *ave_t_r,float *ave_e_r);
308  void fillHistos(int sd);
309  void fillProblems(int sd);
312 
313  int ievt_;
318  int nHB,nHE,nHO,nHF;
325  bool Online_;
326  bool Overwrite;
327 
328  // to create html from processed dataset
332 
347 
356 
361 
363  TH1F *S1[56],*S2[56];
364 
367  std::vector<std::string> problemnames_;
368 
371 
377 
378  std::map<unsigned int, int> KnownBadCells_;
379 };
380 
382 
383 
384  ievt_=-1;
385  emap=0;
387  run_number=-1;
388  IsReference=false;
389  LocalRun=RaddamRun=false;
390  createHTMLonly=false;
391  nHB=nHE=nHO=nHF=0;
393 
394  inputLabelDigi_ = iConfig.getUntrackedParameter<edm::InputTag>("digiLabel",edm::InputTag("hcalDigis"));
395 
396  ReferenceData = iConfig.getUntrackedParameter<std::string>("LaserReferenceData" ,"");
397  OutputFilePath = iConfig.getUntrackedParameter<std::string>("OutputFilePath", "");
398  DatasetName = iConfig.getUntrackedParameter<std::string>("LaserDatasetName", "");
399  htmlOutputPath = iConfig.getUntrackedParameter<std::string>("htmlOutputPath", "");
400  XmlFilePath = iConfig.getUntrackedParameter<std::string>("XmlFilePath", "");
401  Online_ = iConfig.getUntrackedParameter<bool> ("online",false);
402  Overwrite = iConfig.getUntrackedParameter<bool> ("Overwrite",true);
403  prefixME_ = iConfig.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
404  if (prefixME_.size()>0 && prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
405  prefixME_.append("/");
406  subdir_ = iConfig.getUntrackedParameter<std::string>("TaskFolder","DetDiagPedestalMonitor_Hcal/");
407  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
408  subdir_.append("/");
409  subdir_=prefixME_+subdir_;
410  debug_ = iConfig.getUntrackedParameter<int>("debug",0);
411 
412  LaserTimingThreshold = iConfig.getUntrackedParameter<double>("LaserTimingThreshold",0.2);
413  LaserEnergyThreshold = iConfig.getUntrackedParameter<double>("LaserEnergyThreshold",0.1);
414  RaddamThreshold1 = iConfig.getUntrackedParameter<double>("RaddamThreshold1",10.0);
415  RaddamThreshold2 = iConfig.getUntrackedParameter<double>("RaddamThreshold2",0.95);
416 
417  // register for data access
418  tok_tb_ = consumes<HcalTBTriggerData>(iConfig.getParameter<edm::InputTag>("hcalTBTriggerDataTag"));
419  tok_raw_ = consumes<FEDRawDataCollection>(iConfig.getUntrackedParameter<edm::InputTag>("RawDataLabel",edm::InputTag("source")));
420  tok_calib_ = consumes<HcalCalibDigiCollection>(iConfig.getUntrackedParameter<edm::InputTag>("calibDigiLabel",edm::InputTag("hcalDigis")));
421  tok_hbhe_ = consumes<HBHEDigiCollection>(inputLabelDigi_);
422  tok_ho_ = consumes<HODigiCollection>(inputLabelDigi_);
423  tok_hf_ = consumes<HFDigiCollection>(inputLabelDigi_);
424 
425 }
428  c.get<HcalChannelQualityRcd>().get(p);
429  HcalChannelQuality* chanquality= new HcalChannelQuality(*p.product());
430  std::vector<DetId> mydetids = chanquality->getAllChannels();
431  KnownBadCells_.clear();
432 
433  for (std::vector<DetId>::const_iterator i = mydetids.begin();i!=mydetids.end();++i){
434  if (i->det()!=DetId::Hcal) continue; // not an hcal cell
435  HcalDetId id=HcalDetId(*i);
436  int status=(chanquality->getValues(id))->getValue();
438  KnownBadCells_[id.rawId()]=status;
439  }
440  }
441 
442  edm::ESHandle<HcalDbService> conditions_;
443  c.get<HcalDbRecord>().get(conditions_);
444  emap=conditions_->getHcalMapping();
445 
447  if (!dbe_) return;
449 
451  meEVT_ = dbe_->bookInt("HcalDetDiagLaserMonitor Event Number");
452  meRUN_ = dbe_->bookInt("HcalDetDiagLaserMonitor Run Number");
453 
454  ReferenceRun="UNKNOWN";
455  LoadReference();
456  LoadDataset();
457  if(DatasetName.size()>0 && createHTMLonly){
458  char str[200]; sprintf(str,"%sHcalDetDiagLaserData_run%i_%i/",htmlOutputPath.c_str(),run_number,dataset_seq_number);
459  htmlFolder=dbe_->bookString("HcalDetDiagLaserMonitor HTML folder",str);
460  MonitorElement *me;
461  dbe_->setCurrentFolder(prefixME_+"HcalInfo");
462  me=dbe_->bookInt("HBpresent");
463  if(nHB>0) me->Fill(1);
464  me=dbe_->bookInt("HEpresent");
465  if(nHE>0) me->Fill(1);
466  me=dbe_->bookInt("HOpresent");
467  if(nHO>0) me->Fill(1);
468  me=dbe_->bookInt("HFpresent");
469  if(nHF>0) me->Fill(1);
470  }
472  ProblemCellsByDepth_timing->setup(dbe_," Problem Bad Laser Timing");
473  for(unsigned int i=0;i<ProblemCellsByDepth_timing->depth.size();i++)
474  problemnames_.push_back(ProblemCellsByDepth_timing->depth[i]->getName());
476  ProblemCellsByDepth_energy->setup(dbe_," Problem Bad Laser Energy");
477  for(unsigned int i=0;i<ProblemCellsByDepth_energy->depth.size();i++)
478  problemnames_.push_back(ProblemCellsByDepth_energy->depth[i]->getName());
479 
480  dbe_->setCurrentFolder(subdir_+"Summary Plots");
481 
482  name="HBHE Laser Energy Distribution"; hbheEnergy = dbe_->book1D(name,name,200,0,3000);
483  name="HBHE Laser Timing Distribution"; hbheTime = dbe_->book1D(name,name,200,0,10);
484  name="HBHE Laser Energy RMS_div_Energy Distribution"; hbheEnergyRMS = dbe_->book1D(name,name,200,0,0.5);
485  name="HBHE Laser Timing RMS Distribution"; hbheTimeRMS = dbe_->book1D(name,name,200,0,1);
486  name="HO Laser Energy Distribution"; hoEnergy = dbe_->book1D(name,name,200,0,3000);
487  name="HO Laser Timing Distribution"; hoTime = dbe_->book1D(name,name,200,0,10);
488  name="HO Laser Energy RMS_div_Energy Distribution"; hoEnergyRMS = dbe_->book1D(name,name,200,0,0.5);
489  name="HO Laser Timing RMS Distribution"; hoTimeRMS = dbe_->book1D(name,name,200,0,1);
490  name="HF Laser Energy Distribution"; hfEnergy = dbe_->book1D(name,name,200,0,3000);
491  name="HF Laser Timing Distribution"; hfTime = dbe_->book1D(name,name,200,0,10);
492  name="HF Laser Energy RMS_div_Energy Distribution"; hfEnergyRMS = dbe_->book1D(name,name,200,0,0.7);
493  name="HF Laser Timing RMS Distribution"; hfTimeRMS = dbe_->book1D(name,name,200,0,1);
494 
495  name="Laser Timing HBHEHF"; Time2Dhbhehf = dbe_->book2D(name,name,87,-43,43,74,0,73);
496  name="Laser Timing HO"; Time2Dho = dbe_->book2D(name,name,33,-16,16,74,0,73);
497  name="Laser Energy HBHEHF"; Energy2Dhbhehf = dbe_->book2D(name,name,87,-43,43,74,0,73);
498  name="Laser Energy HO"; Energy2Dho = dbe_->book2D(name,name,33,-16,16,74,0,73);
499  name="HBHEHF Laser (Timing-Ref)+1"; refTime2Dhbhehf = dbe_->book2D(name,name,87,-43,43,74,0,73);
500  name="HO Laser (Timing-Ref)+1"; refTime2Dho = dbe_->book2D(name,name,33,-16,16,74,0,73);
501  name="HBHEHF Laser Energy_div_Ref"; refEnergy2Dhbhehf = dbe_->book2D(name,name,87,-43,43,74,0,73);
502  name="HO Laser Energy_div_Ref"; refEnergy2Dho = dbe_->book2D(name,name,33,-16,16,74,0,73);
503 
504  name="HB RBX average Time-Ref"; hb_time_rbx = dbe_->book1D(name,name,36,0.5,36.5);
505  name="HE RBX average Time-Ref"; he_time_rbx = dbe_->book1D(name,name,36,0.5,36.5);
506  name="HO RBX average Time-Ref"; ho_time_rbx = dbe_->book1D(name,name,36,0.5,36.5);
507  name="HF RoBox average Time-Ref"; hf_time_rbx = dbe_->book1D(name,name,24,0.5,24.5);
508 
509  char str[200];
510  for(int i=1;i<=18;i++){ sprintf(str,"HBM%02i",i); hb_time_rbx->setBinLabel(i,str); }
511  for(int i=1;i<=18;i++){ sprintf(str,"HBP%02i",i); hb_time_rbx->setBinLabel(i+18,str); }
512  for(int i=1;i<=18;i++){ sprintf(str,"HEM%02i",i); he_time_rbx->setBinLabel(i,str); }
513  for(int i=1;i<=18;i++){ sprintf(str,"HEP%02i",i); he_time_rbx->setBinLabel(i+18,str); }
514  for(int i=1;i<=12;i++){ sprintf(str,"HFM%02i",i); hf_time_rbx->setBinLabel(i,str); }
515  for(int i=1;i<=12;i++){ sprintf(str,"HFP%02i",i); hf_time_rbx->setBinLabel(i+12,str); }
516  for(int i=1;i<=6;i++){ sprintf(str,"HO2M%02i",i*2); ho_time_rbx->setBinLabel(i,str); }
517  for(int i=1;i<=6;i++){ sprintf(str,"HO1M%02i",i*2); ho_time_rbx->setBinLabel(i+6,str); }
518  for(int i=1;i<=12;i++){ sprintf(str,"HO0%02i",i); ho_time_rbx->setBinLabel(i+12,str); }
519  for(int i=1;i<=6;i++){ sprintf(str,"HO1P%02i",i*2); ho_time_rbx->setBinLabel(i+24,str); }
520  for(int i=1;i<=6;i++){ sprintf(str,"HO2P%02i",i*2); ho_time_rbx->setBinLabel(i+30,str); }
521 
522  Time2Dhbhehf->setAxisTitle("i#eta",1);
523  Time2Dhbhehf->setAxisTitle("i#phi",2);
524  Time2Dho->setAxisTitle("i#eta",1);
525  Time2Dho->setAxisTitle("i#phi",2);
526  Energy2Dhbhehf->setAxisTitle("i#eta",1);
527  Energy2Dhbhehf->setAxisTitle("i#phi",2);
528  Energy2Dho->setAxisTitle("i#eta",1);
529  Energy2Dho->setAxisTitle("i#phi",2);
530  refTime2Dhbhehf->setAxisTitle("i#eta",1);
531  refTime2Dhbhehf->setAxisTitle("i#phi",2);
532  refTime2Dho->setAxisTitle("i#eta",1);
533  refTime2Dho->setAxisTitle("i#phi",2);
534  refEnergy2Dhbhehf->setAxisTitle("i#eta",1);
535  refEnergy2Dhbhehf->setAxisTitle("i#phi",2);
536  refEnergy2Dho->setAxisTitle("i#eta",1);
537  refEnergy2Dho->setAxisTitle("i#phi",2);
538 
540  refTime2Dho->setAxisRange(0,2,3);
541  refEnergy2Dhbhehf->setAxisRange(0.5,1.5,3);
542  refEnergy2Dho->setAxisRange(0.5,1.5,3);
543 
545  RefRun_= dbe_->bookString("HcalDetDiagLaserMonitor Reference Run",ReferenceRun);
546 
547  dbe_->setCurrentFolder(subdir_+"Raddam Plots");
548  for(int i=0;i<56;i++){
549  sprintf(str,"RADDAM (%i %i)",RADDAM_CH[i].eta,RADDAM_CH[i].phi);
550  Raddam[i] = dbe_->book1D(str,str,10,-0.5,9.5);
551  }
552 
553  dbe_->setCurrentFolder(subdir_+"Plots for client");
555  ProblemCellsByDepth_timing_val->setup(dbe_," Laser Timing difference");
557  ProblemCellsByDepth_energy_val->setup(dbe_," Laser Energy difference");
558 }
559 
560 
562 
563 }
564 
565 // ------------ method called to for each event ------------
567  if(createHTMLonly) return;
568  HcalBaseDQMonitor::analyze(iEvent,iSetup); // base class increments ievt_, etc. counters
569 
570 int eta,phi,depth,nTS;
571 static bool HBHEseq,HOseq,HFseq;
572 static int lastHBHEorbit,lastHOorbit,lastHForbit,nChecksHBHE,nChecksHO,nChecksHF,ievt_hbhe,ievt_ho,ievt_hf;
573  if(ievt_==-1){
574  ievt_=0;HBHEseq=HOseq=HFseq=false; lastHBHEorbit=lastHOorbit=lastHForbit=-1;nChecksHBHE=nChecksHO=nChecksHF=0;
575  ievt_hbhe=0,ievt_ho=0,ievt_hf=0;
576  }
577 
578  if(!dbe_) return;
579  bool LaserEvent=false;
580  bool LaserRaddam=false;
581  int orbit=iEvent.orbitNumber();
582  meRUN_->Fill(iEvent.id().run());
583  // for local runs
584  edm::Handle<HcalTBTriggerData> trigger_data;
585  iEvent.getByToken(tok_tb_, trigger_data);
586  if(trigger_data.isValid()){
587  if(trigger_data->wasLaserTrigger()) LaserEvent=true;
588  LocalRun=true;
589  }
590  if(!LocalRun && Online_){
591  if(HBHEseq && (orbit-lastHBHEorbit)>(11223*10) && ievt_hbhe>40){
592  HBHEseq=false;
596  nChecksHBHE++;
597  ievt_hbhe=0;
598  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hb_data[i][j][k].reset();
599  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) he_data[i][j][k].reset();
600  }
601  if(HOseq && (orbit-lastHOorbit)>(11223*10) && ievt_ho>40){
602  HOseq=false;
605  nChecksHO++;
606  ievt_ho=0;
607  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) ho_data[i][j][k].reset();
608  }
609  if(HFseq && (orbit-lastHForbit)>(11223*10) && ievt_hf>40){
610  HFseq=false;
613  nChecksHF++;
614  ievt_hf=0;
615  if(nChecksHF==1 || (nChecksHF>1 && ((nChecksHF-1)%12)==0)){
616  SaveReference();
617  }
618  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hf_data[i][j][k].reset();
619  }
620  }
621 
622  // Abort Gap laser
623  if(LocalRun==false || LaserEvent==false){
625  iEvent.getByToken(tok_raw_ ,rawdata);
626  // edm::Handle<FEDRawDataCollection> rawdata;
627  // iEvent.getByType(rawdata);
628  //checking FEDs for calibration information
630  const FEDRawData& fedData = rawdata->FEDData(i) ;
631  if ( fedData.size() < 24 ) continue ;
632  int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType() ;
633  if(value==hc_HBHEHPD){ HBHEseq=true; HOseq=HFseq=false; lastHBHEorbit=orbit; ievt_hbhe++; }
634  if(value==hc_HOHPD){ HOseq=true; HBHEseq=HFseq=false; lastHOorbit=orbit; ievt_ho++; }
635  if(value==hc_HFPMT){ HFseq=true; HBHEseq=HOseq=false; lastHForbit=orbit; ievt_hf++; }
636 
637  if(value==hc_HBHEHPD || value==hc_HOHPD || value==hc_HFPMT){ LaserEvent=true; break;}
638  if(value==hc_RADDAM){ LaserEvent=true; LaserRaddam=true; break;}
639  }
640  }
641  if(!LaserEvent) return;
643  iEvent.getByToken(tok_hbhe_,hbhe);
645  iEvent.getByToken(tok_ho_,ho);
647  iEvent.getByToken(tok_hf_,hf);
649  iEvent.getByToken(tok_calib_, calib);
650 
651  if(LocalRun && LaserEvent){
652  int N=0;
653  if(hf.isValid()){
654  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
655  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth();
656  float e=0;
657  for(int i=0;i<digi->size();i++) e+=adc2fC[digi->sample(i).adc()&0xff]-2.5;
658  if(e>40){ N++;}
659  }
660  }
661  if(N>50 && N<57){ RaddamRun=true; /*LaserRaddam=true;*/}
662  }
663  if(RaddamRun){
664  if(hf.isValid()){
665  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
666  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
667  int N;
668  for(N=0;N<56;N++)if(eta==RADDAM_CH[N].eta && phi==RADDAM_CH[N].phi && depth==RADDAM_CH[N].depth) break;
669  if(N==56) continue;
670  float max1=0,max2=0;
671  int nmax1=0,nmax2=0;
672  for(int i=0;i<nTS;i++){
673  if(max1<adc2fC[digi->sample(i).adc()&0xff]){ nmax1=i; max1=adc2fC[digi->sample(i).adc()&0xff]; }
674  }
675  Raddam_data[N].TOTEVNT++;
676  for(int i=0;i<nTS;i++){
677  if(i==nmax1) continue;
678  if(max2<adc2fC[digi->sample(i).adc()&0xff]){ nmax2=i; max2=adc2fC[digi->sample(i).adc()&0xff]; }
679  }
680  if(nmax1>nmax2){
681  int tmp1=nmax2;
682  nmax2=nmax1;nmax1=tmp1;
683  }
684  if(nmax1==0 || nmax2==(nTS-1)) continue;
685  if(nmax2!=(nmax1+1)) continue;
686 
687  if(max1<RaddamThreshold1 || max2<RaddamThreshold1) continue;
688  Raddam_data[N].CUT1EVNT++;
689  max1-=2.5; max2-=2.5;
690  float S2=max1+max2;
691  float S4=S2+adc2fC[digi->sample(nmax1-1).adc()&0xff]+adc2fC[digi->sample(nmax2+1).adc()&0xff]-5.0;
692  if((S2/S4)<RaddamThreshold2) continue;
693  Raddam_data[N].CUT2EVNT++;
694  Raddam_data[N].s1_adc[digi->sample(nmax1).adc()&0xff]++;
695  Raddam_data[N].s2_adc[digi->sample(nmax2).adc()&0xff]++;
696  }
697  }
698  }
699 
700  meEVT_->Fill(++ievt_);
701  run_number=iEvent.id().run();
702  double data[20];
703  if(!LaserRaddam){
704  if(hbhe.isValid()){
705  for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){
706  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
707  double ped=(adc2fC[digi->sample(0).adc()&0xff]+adc2fC[digi->sample(1).adc()&0xff])/2.0;
708  if(digi->id().subdet()==HcalBarrel){
709  for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-ped;
710  hb_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
711  }
712  if(digi->id().subdet()==HcalEndcap){
713  for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-ped;
714  he_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
715  }
716  }
717  }
718  if(ho.isValid()){
719  for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){
720  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
721  double ped=(adc2fC[digi->sample(0).adc()&0xff]+adc2fC[digi->sample(1).adc()&0xff])/2.0;
722  if((eta>=11 && eta<=15 && phi>=59 && phi<=70) || (eta>=5 && eta<=10 && phi>=47 && phi<=58)){
723  for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-ped;
724  }else{
725  for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-ped;
726  }
727  ho_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
728  }
729  }
730  if(hf.isValid()){
731  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
732  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
733  double ped=adc2fC[digi->sample(0).adc()&0xff];
734  for(int i=0;i<nTS;i++) data[i]=adc2fC[digi->sample(i).adc()&0xff]-ped;
735  hf_data[eta+42][phi-1][depth-1].add_statistics(data,nTS);
736  }
737  }
738  if(calib.isValid())for(HcalCalibDigiCollection::const_iterator digi=calib->begin();digi!=calib->end();digi++){
739  if(digi->id().cboxChannel()!=0 || digi->id().hcalSubdet()==0) continue;
740  nTS=digi->size();
741  float e=0;
742  for(int i=0;i<nTS;i++){ data[i]=adc2fC[digi->sample(i).adc()&0xff]; e+=data[i];}
743  if(e<15000) calib_data[digi->id().hcalSubdet()][digi->id().ieta()+2][digi->id().iphi()-1].add_statistics(data,nTS);
744  }
745  }else{ //Raddam
746  if(hf.isValid()){
747  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
748  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
749  int N;
750  for(N=0;N<56;N++)if(eta==RADDAM_CH[N].eta && phi==RADDAM_CH[N].phi && depth==RADDAM_CH[N].depth) break;
751  if(N==56) continue;
752  for(int i=0;i<nTS;i++) Raddam[N]->Fill(i,adc2fC[digi->sample(i).adc()&0xff]-2.5);
753 
754  }
755  }
756  }
757 }
758 bool HcalDetDiagLaserMonitor::get_ave_subdet(int sd,float *ave_t,float *ave_e,float *ave_t_r,float *ave_e_r){
759 double T=0,nT=0,E=0,nE=0,Tr=0,nTr=0,Er=0,nEr=0;
760  if(sd==HcalBarrel) for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++){
761  for(int depth=1;depth<=2;depth++){
762  if(hb_data[eta+42][phi-1][depth-1].get_statistics()>10){
763  double ave=0,rms=0,time=0,time_rms=0;
764  hb_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
765  hb_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
766  T+=time; nT++; E+=ave; nE++;
767  if(hb_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
768  Tr+=time; nTr++; Er+=ave; nEr++;}
769  }
770  }
771  }
772  // HE histograms
773  if(sd==HcalEndcap) for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++){
774  for(int depth=1;depth<=3;depth++){
775  if(he_data[eta+42][phi-1][depth-1].get_statistics()>10){
776  double ave=0; double rms=0; double time=0; double time_rms=0;
777  he_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
778  he_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
779  T+=time; nT++; E+=ave; nE++;
780  if(he_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
781  Tr+=time; nTr++; Er+=ave; nEr++;}
782  }
783  }
784  }
785  // HF histograms
786  if(sd==HcalForward) for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++){
787  for(int depth=1;depth<=2;depth++){
788  if(hf_data[eta+42][phi-1][depth-1].get_statistics()>10){
789  double ave=0; double rms=0; double time=0; double time_rms=0;
790  hf_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
791  hf_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
792  T+=time; nT++; E+=ave; nE++;
793  if(hf_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
794  Tr+=time; nTr++; Er+=ave; nEr++;}
795  }
796  }
797  }
798  // HO histograms
799  if(sd==HcalOuter) for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++){
800  for(int depth=4;depth<=4;depth++){
801  if(ho_data[eta+42][phi-1][depth-1].get_statistics()>10){
802  double ave=0; double rms=0; double time=0; double time_rms=0;
803  ho_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
804  ho_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
805  T+=time; nT++; E+=ave; nE++;
806  if(ho_data[eta+42][phi-1][depth-1].get_reference(&ave,&rms,&time,&time_rms)){
807  Tr+=time; nTr++; Er+=ave; nEr++;}
808  }
809  }
810  }
811  if(nT<200 || nE<200 || nTr<200 || nEr<200) return false;
812  *ave_t=T/nT;
813  *ave_e=E/nE;
814  *ave_t_r=Tr/nTr;
815  *ave_e_r=Er/nEr;
816  return true;
817 }
818 
820 float ave_t,ave_e,ave_t_r,ave_e_r;
821  if(!get_ave_subdet(sd,&ave_t,&ave_e,&ave_t_r,&ave_e_r)) return;
822 
823  for(int i=0;i<4;i++){
826  }
827 
828  std::vector <HcalElectronicsId> AllElIds = emap->allElectronicsIdPrecision();
829  for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
830  DetId detid=emap->lookup(*eid);
831  if (detid.det()!=DetId::Hcal) continue;
832  HcalGenericDetId gid(emap->lookup(*eid));
833  if(!(!(gid.null()) &&
834  (gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
835  gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
836  gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
837  gid.genericSubdet()==HcalGenericDetId::HcalGenOuter))) continue;
838  int eta=0,phi=0,depth=0;
839  HcalDetId hid(detid);
840  if(KnownBadCells_.find(hid.rawId())==KnownBadCells_.end()) continue;
841  eta=hid.ieta();
842  phi=hid.iphi();
843  depth=hid.depth();
844 
845  int e=CalcEtaBin(sd,eta,depth)+1;
846  if(detid.subdetId()==HcalBarrel && sd==HcalBarrel){
847  double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
848  if(!hb_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
849  if(!hb_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
850  if(!hb_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
851  hb_data[eta+42][phi-1][depth-1].nChecks++;
852  float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
853  if(diff_t>LaserTimingThreshold){
854  hb_data[eta+42][phi-1][depth-1].nBadTime++;
855  ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
856  }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0);
857  if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
858  float diff_e=((VAL/ave_e))/(val/ave_e_r);
859  if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
860  hb_data[eta+42][phi-1][depth-1].nBadEnergy++;
861  ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
862  }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
863  }
864  }
865  if(detid.subdetId()==HcalEndcap && sd==HcalEndcap){
866  double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
867  if(!he_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
868  if(!he_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
869  if(!he_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
870  he_data[eta+42][phi-1][depth-1].nChecks++;
871  float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
872  if(diff_t>LaserTimingThreshold){
873  he_data[eta+42][phi-1][depth-1].nBadTime++;
874  ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
875  }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0);
876  if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
877  float diff_e=((VAL/ave_e))/(val/ave_e_r);
878  if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
879  he_data[eta+42][phi-1][depth-1].nBadEnergy++;
880  ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
881  }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
882  }
883  }
884  if(detid.subdetId()==HcalOuter && sd==HcalOuter){
885  double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
886  if(!ho_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
887  if(!ho_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
888  if(!ho_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
889  ho_data[eta+42][phi-1][depth-1].nChecks++;
890  float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
891  if(diff_t>LaserTimingThreshold){
892  ho_data[eta+42][phi-1][depth-1].nBadTime++;
893  ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
894  }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0);
895  if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
896  float diff_e=((VAL/ave_e))/(val/ave_e_r);
897  if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
898  ho_data[eta+42][phi-1][depth-1].nBadEnergy++;
899  ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
900  }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
901  }
902  }
903  if(detid.subdetId()==HcalForward && sd==HcalForward){
904  double val=0,rms=0,time=0,time_rms=0,VAL=0,RMS=0,TIME=0,TIME_RMS=0;
905  if(!hf_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
906  if(!hf_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
907  if(!hf_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
908  hf_data[eta+42][phi-1][depth-1].nChecks++;
909  float diff_t=(TIME-ave_t)-(time-ave_t_r); if(diff_t<0) diff_t=-diff_t;
910  if(diff_t>LaserTimingThreshold){
911  hf_data[eta+42][phi-1][depth-1].nBadTime++;
912  ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,(TIME-ave_t)-(time-ave_t_r));
913  }else ProblemCellsByDepth_timing_val->depth[depth-1]->setBinContent(e,phi,0);
914  if(VAL!=0 && val!=0 && ave_e!=0 && ave_e_r!=0){
915  float diff_e=((VAL/ave_e))/(val/ave_e_r);
916  if(diff_e>(1+LaserEnergyThreshold) ||diff_e<(1-LaserEnergyThreshold) ){
917  hf_data[eta+42][phi-1][depth-1].nBadEnergy++;
918  ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,((VAL/ave_e))/(val/ave_e_r));
919  }else ProblemCellsByDepth_energy_val->depth[depth-1]->setBinContent(e,phi,0);
920  }
921  }
922  }
923  for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
924  DetId detid=emap->lookup(*eid);
925  if (detid.det()!=DetId::Hcal) continue;
926  HcalGenericDetId gid(emap->lookup(*eid));
927  if(!(!(gid.null()) &&
928  (gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
929  gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
930  gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
931  gid.genericSubdet()==HcalGenericDetId::HcalGenOuter))) continue;
932  int eta=0,phi=0,depth=0;
933  HcalDetId hid(detid);
934  eta=hid.ieta();
935  phi=hid.iphi();
936  depth=hid.depth();
937 
938  if(detid.subdetId()==HcalBarrel){
939  if(hb_data[eta+42][phi-1][depth-1].nBadTime>0){
940  int e=CalcEtaBin(HcalBarrel,eta,depth)+1;
941  double val=hb_data[eta+42][phi-1][depth-1].nBadTime/hb_data[eta+42][phi-1][depth-1].nChecks;
942  ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
943  }
944  if(hb_data[eta+42][phi-1][depth-1].nBadEnergy>0){
945  int e=CalcEtaBin(HcalBarrel,eta,depth)+1;
946  double val=hb_data[eta+42][phi-1][depth-1].nBadEnergy/hb_data[eta+42][phi-1][depth-1].nChecks;
947  ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val);
948  }
949  }
950  if(detid.subdetId()==HcalEndcap){
951  if(he_data[eta+42][phi-1][depth-1].nBadTime>0){
952  int e=CalcEtaBin(HcalEndcap,eta,depth)+1;
953  double val=he_data[eta+42][phi-1][depth-1].nBadTime/he_data[eta+42][phi-1][depth-1].nChecks;
954  ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
955  }
956  if(he_data[eta+42][phi-1][depth-1].nBadEnergy>0){
957  int e=CalcEtaBin(HcalEndcap,eta,depth)+1;
958  double val=he_data[eta+42][phi-1][depth-1].nBadEnergy/he_data[eta+42][phi-1][depth-1].nChecks;
959  ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val);
960  }
961  }
962  if(detid.subdetId()==HcalOuter){
963  if(ho_data[eta+42][phi-1][depth-1].nBadTime>0){
964  int e=CalcEtaBin(HcalOuter,eta,depth)+1;
965  double val=ho_data[eta+42][phi-1][depth-1].nBadTime/ho_data[eta+42][phi-1][depth-1].nChecks;
966  ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
967  }
968  if(ho_data[eta+42][phi-1][depth-1].nBadEnergy>0){
969  int e=CalcEtaBin(HcalOuter,eta,depth)+1;
970  double val=ho_data[eta+42][phi-1][depth-1].nBadEnergy/ho_data[eta+42][phi-1][depth-1].nChecks;
971  ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val);
972  }
973  }
974  if(detid.subdetId()==HcalForward){
975  if(hf_data[eta+42][phi-1][depth-1].nBadTime>0){
976  int e=CalcEtaBin(HcalForward,eta,depth)+1;
977  double val=hf_data[eta+42][phi-1][depth-1].nBadTime/hf_data[eta+42][phi-1][depth-1].nChecks;
978  ProblemCellsByDepth_timing->depth[depth-1]->setBinContent(e,phi,val);
979  }
980  if(hf_data[eta+42][phi-1][depth-1].nBadEnergy>0){
981  int e=CalcEtaBin(HcalForward,eta,depth)+1;
982  double val=hf_data[eta+42][phi-1][depth-1].nBadEnergy/hf_data[eta+42][phi-1][depth-1].nChecks;
983  ProblemCellsByDepth_energy->depth[depth-1]->setBinContent(e,phi,val);
984  }
985  }
986  }
987 }
988 
989 bool HcalDetDiagLaserMonitor::get_ave_rbx(int sd,int side,int rbx,float *ave,float *rms){
990  double xt=0,xxt=0;
991  int eta_min=0,eta_max=0,n=0;
992  if(sd==HcalBarrel){
993  if(side>0){eta_min=1; eta_max=29;}
994  if(side<0){eta_min=-29; eta_max=-1;}
995  if(rbx==1){
996  for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++)for(int k=1;k<=3;k++){
997  double val,rms,time,time_rms;
998  double TIME,TIME_RMS;
999  if(!hb_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1000  if(!hb_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
1001  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1002  }
1003  for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=2;j++)for(int k=1;k<=3;k++){
1004  double val,rms,time,time_rms;
1005  double TIME,TIME_RMS;
1006  if(!hb_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1007  if(!hb_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
1008  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1009  }
1010 
1011  }else{
1012  for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*4-1);j<=((rbx-1)*4+2);j++)for(int k=1;k<=3;k++){
1013  double val,rms,time,time_rms;
1014  double TIME,TIME_RMS;
1015  if(!hb_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1016  if(!hb_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
1017  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1018  }
1019  }
1020  }
1021  if(sd==HcalEndcap){
1022  if(side>0){eta_min=1; eta_max=29;}
1023  if(side<0){eta_min=-29; eta_max=-1;}
1024  if(rbx==1){
1025  for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++)for(int k=1;k<=3;k++){
1026  double val,rms,time,time_rms;
1027  double TIME,TIME_RMS;
1028  if(!he_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1029  if(!he_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
1030  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1031  }
1032  for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=2;j++)for(int k=1;k<=3;k++){
1033  double val,rms,time,time_rms;
1034  double TIME,TIME_RMS;
1035  if(!he_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1036  if(!he_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
1037  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1038  }
1039 
1040  }else{
1041  for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*4-1);j<=((rbx-1)*4+2);j++)for(int k=1;k<=3;k++){
1042  double val,rms,time,time_rms;
1043  double TIME,TIME_RMS;
1044  if(!he_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1045  if(!he_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
1046  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1047  }
1048  }
1049  }
1050  if(sd==HcalForward){
1051  if(side>0){eta_min=29; eta_max=40;}
1052  if(side<0){eta_min=-40; eta_max=-29;}
1053  for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*6+1);j<=((rbx-1)*6+6);j++)for(int k=1;k<=2;k++){
1054  double val,rms,time,time_rms;
1055  double TIME,TIME_RMS;
1056  if(!hf_data[i+42][j-1][k-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1057  if(!hf_data[i+42][j-1][k-1].get_average_time(&TIME,&TIME_RMS)) continue;
1058  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1059  }
1060  }
1061  if(sd==HcalOuter){
1062  if(side==0){
1063  eta_min=-4,eta_max=4;
1064  if(rbx==1){
1065  for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++){
1066  double val,rms,time,time_rms;
1067  double TIME,TIME_RMS;
1068  if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1069  if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
1070  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1071  }
1072  for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=4;j++){
1073  double val,rms,time,time_rms;
1074  double TIME,TIME_RMS;
1075  if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1076  if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
1077  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1078  }
1079 
1080  }else{
1081  for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*6-1);j<=((rbx-1)*6+4);j++){
1082  double val,rms,time,time_rms;
1083  double TIME,TIME_RMS;
1084  if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1085  if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
1086  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1087  }
1088  }
1089  }
1090  if(side==-1){ eta_min=-10,eta_max=-5;}
1091  if(side==-2){ eta_min=-15,eta_max=-11;}
1092  if(side==1) { eta_min=5, eta_max=10;}
1093  if(side==2) { eta_min=11, eta_max=15;}
1094  if(side!=0){
1095  if(rbx==1){
1096  for(int i=eta_min;i<=eta_max;i++) for(int j=71;j<=72;j++){
1097  double val,rms,time,time_rms;
1098  double TIME,TIME_RMS;
1099  if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1100  if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
1101  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1102  }
1103  for(int i=eta_min;i<=eta_max;i++) for(int j=1;j<=10;j++){
1104  double val,rms,time,time_rms;
1105  double TIME,TIME_RMS;
1106  if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1107  if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
1108  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1109  }
1110 
1111  }else{
1112  for(int i=eta_min;i<=eta_max;i++) for(int j=((rbx-1)*12-1);j<=((rbx-1)*12+10);j++){
1113  double val,rms,time,time_rms;
1114  double TIME,TIME_RMS;
1115  if(!ho_data[i+42][j-1][4-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1116  if(!ho_data[i+42][j-1][4-1].get_average_time(&TIME,&TIME_RMS)) continue;
1117  xt+=TIME-time; xxt+=(TIME-time)*(TIME-time); n++;
1118  }
1119  }
1120  }
1121  }
1122  if(n<10) return false;
1123  *ave=xt/n;
1124  *rms=sqrt(xxt/n-(xt*xt)/(n*n));
1125  return true;
1126 }
1127 
1128 
1130  if(sd==HcalBarrel || sd==HcalEndcap){
1131  hbheEnergy->Reset();
1132  hbheTime->Reset();
1133  hbheEnergyRMS->Reset();
1134  hbheTimeRMS->Reset();
1135  hb_time_rbx->Reset();
1136  he_time_rbx->Reset();
1137  }
1138  if(sd==HcalOuter){
1139  hoEnergy->Reset();
1140  hoTime->Reset();
1141  hoEnergyRMS->Reset();
1142  hoTimeRMS->Reset();
1143  Time2Dho->Reset();
1144  Energy2Dho->Reset();
1145  refTime2Dho->Reset();
1146  refEnergy2Dho->Reset();
1147  ho_time_rbx->Reset();
1148  }
1149  if(sd==HcalForward){
1150  hfEnergy->Reset();
1151  hfTime->Reset();
1152  hfEnergyRMS->Reset();
1153  hfTimeRMS->Reset();
1154  hf_time_rbx->Reset();
1155  }
1156  if(sd==HcalBarrel || sd==HcalEndcap){
1157  // HB histograms
1158  for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++){
1159  double T=0,nT=0,E=0,nE=0;
1160  for(int depth=1;depth<=2;depth++){
1161  if(hb_data[eta+42][phi-1][depth-1].get_statistics()>10){
1162  double ave=0;
1163  double rms=0;
1164  double time=0;
1165  double time_rms=0;
1166  hb_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
1167  hb_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
1168  hbheEnergy->Fill(ave);
1169  if(ave>0)hbheEnergyRMS->Fill(rms/ave);
1170  hbheTime->Fill(time);
1171  hbheTimeRMS->Fill(time_rms);
1172  T+=time; nT++; E+=ave; nE++;
1173  }
1174  }
1175  if(nT>0){Time2Dhbhehf->setBinContent(eta+44,phi+1,T/nT);Energy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE); }
1176  }
1177  // HE histograms
1178  for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++){
1179  double T=0,nT=0,E=0,nE=0;
1180  for(int depth=1;depth<=3;depth++){
1181  if(he_data[eta+42][phi-1][depth-1].get_statistics()>10){
1182  double ave=0; double rms=0; double time=0; double time_rms=0;
1183  he_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
1184  he_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
1185  hbheEnergy->Fill(ave);
1186  if(ave>0)hbheEnergyRMS->Fill(rms/ave);
1187  hbheTime->Fill(time);
1188  hbheTimeRMS->Fill(time_rms);
1189  T+=time; nT++; E+=ave; nE++;
1190  }
1191  }
1192  if(nT>0 && abs(eta)>16 ){Time2Dhbhehf->setBinContent(eta+44,phi+1,T/nT); Energy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE); }
1193  if(nT>0 && abs(eta)>20 ){Time2Dhbhehf->setBinContent(eta+44,phi+2,T/nT); Energy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);}
1194  }
1195  }
1196  if(sd==HcalForward){
1197  // HF histograms
1198  for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++){
1199  double T=0,nT=0,E=0,nE=0;
1200  for(int depth=1;depth<=2;depth++){
1201  if(hf_data[eta+42][phi-1][depth-1].get_statistics()>10){
1202  double ave=0; double rms=0; double time=0; double time_rms=0;
1203  hf_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
1204  hf_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
1205  hfEnergy->Fill(ave);
1206  if(ave>0)hfEnergyRMS->Fill(rms/ave);
1207  hfTime->Fill(time);
1208  T+=time; nT++; E+=ave; nE++;
1209  hfTimeRMS->Fill(time_rms);
1210  }
1211  }
1212  if(nT>0 && abs(eta)>29 ){ Time2Dhbhehf->setBinContent(eta+44,phi+1,T/nT); Time2Dhbhehf->setBinContent(eta+44,phi+2,T/nT);}
1213  if(nT>0 && abs(eta)>29 ){ Energy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE); Energy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);}
1214  }
1215  }
1216  if(sd==HcalOuter){
1217  // HO histograms
1218  for(int eta=-10;eta<=15;eta++) for(int phi=1;phi<=72;phi++){
1219  if(eta>10 && !isSiPM(eta,phi,4)) continue;
1220  double T=0,nT=0,E=0,nE=0;
1221  for(int depth=4;depth<=4;depth++){
1222  if(ho_data[eta+42][phi-1][depth-1].get_statistics()>10){
1223  double ave=0; double rms=0; double time=0; double time_rms=0;
1224  ho_data[eta+42][phi-1][depth-1].get_average_amp(&ave,&rms);
1225  ho_data[eta+42][phi-1][depth-1].get_average_time(&time,&time_rms);
1226  hoEnergy->Fill(ave);
1227  if(ave>0)hoEnergyRMS->Fill(rms/ave);
1228  hoTime->Fill(time);
1229  T+=time; nT++; E+=ave; nE++;
1230  hoTimeRMS->Fill(time_rms);
1231  }
1232  }
1233  if(nT>0){ Time2Dho->Fill(eta,phi,T/nT); Energy2Dho->Fill(eta,phi+1,E/nE) ;}
1234  }
1235  }
1236 
1237  // compare with reference...
1238  if(sd==HcalBarrel || sd==HcalEndcap){
1239  for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++){
1240  double T=0,nT=0,E=0,nE=0;
1241  for(int depth=1;depth<=2;depth++){
1242  if(hb_data[eta+42][phi-1][depth-1].get_statistics()>10){
1243  double val=0,rms=0,time=0,time_rms=0;
1244  double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
1245  if(!hb_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1246  if(!hb_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
1247  if(!hb_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
1248  E+=VAL/val; nE++;
1249  T+=TIME-time; nT++;
1250  }
1251  }
1252  if(nE>0) refEnergy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE);
1253  if(nT>0){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dhbhehf->setBinContent(eta+44,phi+1,TTT); }
1254  }
1255  for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++){
1256  double T=0,nT=0,E=0,nE=0;
1257  for(int depth=1;depth<=3;depth++){
1258  if(he_data[eta+42][phi-1][depth-1].get_statistics()>10){
1259  double val=0,rms=0,time=0,time_rms=0;
1260  double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
1261  if(!he_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1262  if(!he_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
1263  if(!he_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
1264  E+=VAL/val; nE++;
1265  T+=TIME-time; nT++;
1266  }
1267  }
1268  if(nE>0 && abs(eta)>16) refEnergy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE);
1269  if(nT>0 && abs(eta)>16){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dhbhehf->setBinContent(eta+44,phi+1,TTT); }
1270  if(nE>0 && abs(eta)>20) refEnergy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);
1271  if(nT>0 && abs(eta)>20){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dhbhehf->setBinContent(eta+44,phi+2,TTT); }
1272  }
1273  }
1274  if(sd==HcalForward){
1275  for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++){
1276  double T=0,nT=0,E=0,nE=0;
1277  for(int depth=1;depth<=2;depth++){
1278  if(hf_data[eta+42][phi-1][depth-1].get_statistics()>10){
1279  double val=0,rms=0,time=0,time_rms=0;
1280  double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
1281  if(!hf_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1282  if(!hf_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
1283  if(!hf_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
1284  E+=VAL/val; nE++;
1285  T+=TIME-time; nT++;
1286  }
1287  }
1288  if(nE>0 && abs(eta)>29) refEnergy2Dhbhehf->setBinContent(eta+44,phi+1,E/nE);
1289  if(nT>0 && abs(eta)>29){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dhbhehf->setBinContent(eta+44,phi+1,TTT); }
1290  if(nE>0 && abs(eta)>29) refEnergy2Dhbhehf->setBinContent(eta+44,phi+2,E/nE);
1291  if(nT>0 && abs(eta)>29){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dhbhehf->setBinContent(eta+44,phi+2,TTT); }
1292  }
1293  }
1294  if(sd==HcalOuter){
1295  for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++){
1296  if(eta>10 && !isSiPM(eta,phi,4)) continue;
1297  double T=0,nT=0,E=0,nE=0;
1298  for(int depth=4;depth<=4;depth++){
1299  if(ho_data[eta+42][phi-1][depth-1].get_statistics()>10){
1300  double val=0,rms=0,time=0,time_rms=0;
1301  double VAL=0,RMS=0,TIME=0,TIME_RMS=0;
1302  if(!ho_data[eta+42][phi-1][depth-1].get_reference(&val,&rms,&time,&time_rms)) continue;
1303  if(!ho_data[eta+42][phi-1][depth-1].get_average_amp(&VAL,&RMS)) continue;
1304  if(!ho_data[eta+42][phi-1][depth-1].get_average_time(&TIME,&TIME_RMS)) continue;
1305  E+=VAL/val; nE++;
1306  T+=TIME-time; nT++;
1307  }
1308  }
1309  if(nE>0) refEnergy2Dho->Fill(eta,phi,E/nE);
1310  if(nT>0){ double TTT=T/nT+1; if(TTT<0.01) TTT=0.01; refTime2Dho->Fill(eta,phi,TTT);}
1311  }
1312  }
1314  float min,max;
1315  if(sd==HcalBarrel || sd==HcalEndcap){
1316  min=100;max=-100;
1317  for(int i=1;i<=18;i++){
1318  float ave=-10,rms=-10;
1319  if(get_ave_rbx(HcalBarrel,-1,i,&ave,&rms)){
1320  hb_time_rbx->setBinContent(i,ave);
1322  if(ave<min) min=ave;
1323  if(ave>max) max=ave;
1324  }
1325  }
1326  for(int i=1;i<=18;i++){
1327  float ave=-10,rms=-10;
1328  if(get_ave_rbx(HcalBarrel,1,i,&ave,&rms)){
1329  hb_time_rbx->setBinContent(i+18,ave);
1331  if(ave<min) min=ave;
1332  if(ave>max) max=ave;
1333  }
1334  }
1335  if(max>-100)hb_time_rbx->setAxisRange(min-1,max+1,2);
1336  min=100;max=-100;
1337  for(int i=1;i<=18;i++){
1338  float ave=-10,rms=-10;
1339  if(get_ave_rbx(HcalEndcap,-1,i,&ave,&rms)){
1340  he_time_rbx->setBinContent(i,ave);
1342  if(ave<min) min=ave;
1343  if(ave>max) max=ave;
1344  }
1345  }
1346  for(int i=1;i<=18;i++){
1347  float ave=-10,rms=-10;
1348  if(get_ave_rbx(HcalEndcap,1,i,&ave,&rms)){
1349  he_time_rbx->setBinContent(i+18,ave);
1351  if(ave<min) min=ave;
1352  if(ave>max) max=ave;
1353  }
1354  }
1355  if(max>-100)he_time_rbx->setAxisRange(min-1,max+1,2);
1356  }
1358  if(sd==HcalOuter){
1359  min=100;max=-100;
1360  for(int i=1;i<=6;i++){
1361  float ave=-10,rms=-10;
1362  if(get_ave_rbx(HcalOuter,-2,i,&ave,&rms)){
1363  ho_time_rbx->setBinContent(i,ave);
1365  if(ave<min) min=ave;
1366  if(ave>max) max=ave;
1367  }
1368  }
1369  for(int i=1;i<=6;i++){
1370  float ave=-10,rms=-10;
1371  if(get_ave_rbx(HcalOuter,-1,i,&ave,&rms)){
1372  ho_time_rbx->setBinContent(i+6,ave);
1374  if(ave<min) min=ave;
1375  if(ave>max) max=ave;
1376  }
1377  }
1378  for(int i=1;i<=12;i++){
1379  float ave=-10,rms=-10;
1380  if(get_ave_rbx(HcalOuter,0,i,&ave,&rms)){
1381  ho_time_rbx->setBinContent(i+12,ave);
1383  if(ave<min) min=ave;
1384  if(ave>max) max=ave;
1385  }
1386  }
1387  for(int i=1;i<=6;i++){
1388  float ave=-10,rms=-10;
1389  if(get_ave_rbx(HcalOuter,1,i,&ave,&rms)){
1390  ho_time_rbx->setBinContent(i+24,ave);
1392  if(ave<min) min=ave;
1393  if(ave>max) max=ave;
1394  }
1395  }
1396  for(int i=1;i<=6;i++){
1397  float ave=-10,rms=-10;
1398  if(get_ave_rbx(HcalOuter,2,i,&ave,&rms)){
1399  ho_time_rbx->setBinContent(i+30,ave);
1401  if(ave<min) min=ave;
1402  if(ave>max) max=ave;
1403  }
1404  }
1405  if(max>-100)ho_time_rbx->setAxisRange(min-1,max+1,2);
1406  }
1408  if(sd==HcalForward){
1409  min=100;max=-100;
1410  for(int i=1;i<=12;i++){
1411  float ave=-10,rms=-10;
1412  if(get_ave_rbx(HcalForward,-1,i,&ave,&rms)){
1413  hf_time_rbx->setBinContent(i,ave);
1415  if(ave<min) min=ave;
1416  if(ave>max) max=ave;
1417  }
1418  }
1419  for(int i=1;i<=12;i++){
1420  float ave=-10,rms=-10;
1421  if(get_ave_rbx(HcalForward,1,i,&ave,&rms)){
1422  hf_time_rbx->setBinContent(i+12,ave);
1424  if(ave<min) min=ave;
1425  if(ave>max) max=ave;
1426  }
1427  }
1428  if(max>-100)hf_time_rbx->setAxisRange(min-1,max+1,2);
1429  }
1430 }
1431 
1433 double amp,rms,Time,time_rms;
1434 int Eta,Phi,Depth,Statistic,Status=0;
1435 char Subdet[10],str[500];
1436  if(OutputFilePath.size()>0){
1437  if(!Overwrite){
1438  sprintf(str,"%sHcalDetDiagLaserData_run%06i_%i.root",OutputFilePath.c_str(),run_number,dataset_seq_number);
1439  }else{
1440  sprintf(str,"%sHcalDetDiagLaserData.root",OutputFilePath.c_str());
1441  }
1442  TFile *theFile = new TFile(str, "RECREATE");
1443  if(!theFile->IsOpen()) return;
1444  theFile->cd();
1445  sprintf(str,"%d",run_number); TObjString run(str); run.Write("run number");
1446  sprintf(str,"%d",ievt_); TObjString events(str); events.Write("Total events processed");
1447  sprintf(str,"%d",dataset_seq_number); TObjString dsnum(str); dsnum.Write("Dataset number");
1448  Long_t t; t=time(0); strftime(str,30,"%F %T",localtime(&t)); TObjString tm(str); tm.Write("Dataset creation time");
1449 
1450  TTree *tree =new TTree("HCAL Laser data","HCAL Laser data");
1451  if(tree==0) return;
1452  tree->Branch("Subdet", &Subdet, "Subdet/C");
1453  tree->Branch("eta", &Eta, "Eta/I");
1454  tree->Branch("phi", &Phi, "Phi/I");
1455  tree->Branch("depth", &Depth, "Depth/I");
1456  tree->Branch("statistic",&Statistic, "Statistic/I");
1457  tree->Branch("status", &Status, "Status/I");
1458  tree->Branch("amp", &amp, "amp/D");
1459  tree->Branch("rms", &rms, "rms/D");
1460  tree->Branch("time", &Time, "time/D");
1461  tree->Branch("time_rms", &time_rms, "time_rms/D");
1462  sprintf(Subdet,"HB");
1463  for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
1464  if((Statistic=hb_data[eta+42][phi-1][depth-1].get_statistics1())>10){
1465  Eta=eta; Phi=phi; Depth=depth;
1466  Status=hb_data[eta+42][phi-1][depth-1].get_status();
1467  hb_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
1468  hb_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
1469  tree->Fill();
1470  }
1471  }
1472  sprintf(Subdet,"HE");
1473  for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=3;depth++){
1474  if((Statistic=he_data[eta+42][phi-1][depth-1].get_statistics1())>10){
1475  Eta=eta; Phi=phi; Depth=depth;
1476  Status=he_data[eta+42][phi-1][depth-1].get_status();
1477  he_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
1478  he_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
1479  tree->Fill();
1480  }
1481  }
1482  sprintf(Subdet,"HO");
1483  for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++) for(int depth=4;depth<=4;depth++){
1484  if((Statistic=ho_data[eta+42][phi-1][depth-1].get_statistics1())>10){
1485  Eta=eta; Phi=phi; Depth=depth;
1486  Status=ho_data[eta+42][phi-1][depth-1].get_status();
1487  ho_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
1488  ho_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
1489  tree->Fill();
1490  }
1491  }
1492  sprintf(Subdet,"HF");
1493  for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
1494  if((Statistic=hf_data[eta+42][phi-1][depth-1].get_statistics1())>10){
1495  Eta=eta; Phi=phi; Depth=depth;
1496  Status=hf_data[eta+42][phi-1][depth-1].get_status();
1497  hf_data[eta+42][phi-1][depth-1].get_average_amp1(&amp,&rms);
1498  hf_data[eta+42][phi-1][depth-1].get_average_time1(&Time,&time_rms);
1499  tree->Fill();
1500  }
1501  }
1502  sprintf(Subdet,"CALIB_HB");
1503  for(int eta=-1;eta<=1;eta++) for(int phi=1;phi<=72;phi++){
1504  if((Statistic=calib_data[1][eta+2][phi-1].get_statistics1())>10){
1505  Eta=eta; Phi=phi; Depth=0;
1506  Status=calib_data[1][eta+2][phi-1].get_status();
1507  calib_data[1][eta+2][phi-1].get_average_amp1(&amp,&rms);
1508  calib_data[1][eta+2][phi-1].get_average_time1(&Time,&time_rms);
1509  tree->Fill();
1510  }
1511  }
1512  sprintf(Subdet,"CALIB_HE");
1513  for(int eta=-1;eta<=1;eta++) for(int phi=1;phi<=72;phi++){
1514  if((Statistic=calib_data[2][eta+2][phi-1].get_statistics1())>10){
1515  Eta=eta; Phi=phi; Depth=0;
1516  Status=calib_data[2][eta+2][phi-1].get_status();
1517  calib_data[2][eta+2][phi-1].get_average_amp1(&amp,&rms);
1518  calib_data[2][eta+2][phi-1].get_average_time1(&Time,&time_rms);
1519  tree->Fill();
1520  }
1521  }
1522  sprintf(Subdet,"CALIB_HO");
1523  for(int eta=-2;eta<=2;eta++) for(int phi=1;phi<=72;phi++){
1524  if((Statistic=calib_data[3][eta+2][phi-1].get_statistics1())>10){
1525  Eta=eta; Phi=phi; Depth=0;
1526  Status=calib_data[3][eta+2][phi-1].get_status();
1527  calib_data[3][eta+2][phi-1].get_average_amp1(&amp,&rms);
1528  calib_data[3][eta+2][phi-1].get_average_time1(&Time,&time_rms);
1529  tree->Fill();
1530  }
1531  }
1532  sprintf(Subdet,"CALIB_HF");
1533  for(int eta=-2;eta<=2;eta++) for(int phi=1;phi<=72;phi++){
1534  if((Statistic=calib_data[4][eta+2][phi-1].get_statistics1())>10){
1535  Eta=eta; Phi=phi; Depth=0;
1536  Status=calib_data[4][eta+2][phi-1].get_status();
1537  calib_data[4][eta+2][phi-1].get_average_amp1(&amp,&rms);
1538  calib_data[4][eta+2][phi-1].get_average_time1(&Time,&time_rms);
1539  tree->Fill();
1540  }
1541  }
1542  theFile->Write();
1543  theFile->Close();
1544  }
1545  if(XmlFilePath.size()>0){
1546  char TIME[40];
1547  Long_t t; t=time(0); strftime(TIME,30,"%F %T",localtime(&t));
1548  //create XML file
1549  if(!Overwrite){
1550  sprintf(str,"HcalDetDiagLaser_%i_%i.xml",run_number,dataset_seq_number);
1551  }else{
1552  sprintf(str,"HcalDetDiagLaser.xml");
1553  }
1554  std::string xmlName=str;
1555  std::ofstream xmlFile;
1556  xmlFile.open(xmlName.c_str());
1557 
1558  xmlFile<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
1559  xmlFile<<"<ROOT>\n";
1560  xmlFile<<" <HEADER>\n";
1561  xmlFile<<" <HINTS mode='only-det-root'/>\n";
1562  xmlFile<<" <TYPE>\n";
1563  xmlFile<<" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
1564  xmlFile<<" <NAME>HCAL Laser HBHE HPD [abort gap global]</NAME>\n";
1565  xmlFile<<" </TYPE>\n";
1566  xmlFile<<" <!-- run details -->\n";
1567  xmlFile<<" <RUN>\n";
1568  xmlFile<<" <RUN_TYPE>GLOBAL-RUN</RUN_TYPE>\n";
1569  xmlFile<<" <RUN_NUMBER>"<<run_number<<"</RUN_NUMBER>\n";
1570  xmlFile<<" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
1571  xmlFile<<" <COMMENT_DESCRIPTION>hcal laser data</COMMENT_DESCRIPTION>\n";
1572  xmlFile<<" <LOCATION>P5</LOCATION>\n";
1573  xmlFile<<" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
1574  xmlFile<<" </RUN>\n";
1575  xmlFile<<" </HEADER>\n";
1576  xmlFile<<" <DATA_SET>\n";
1577  xmlFile<<" <!-- optional dataset metadata -->\n\n";
1578  xmlFile<<" <SET_NUMBER>"<<dataset_seq_number<<"</SET_NUMBER>\n";
1579  xmlFile<<" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
1580  xmlFile<<" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
1581  xmlFile<<" <NUMBER_OF_EVENTS_IN_SET>"<<ievt_<<"</NUMBER_OF_EVENTS_IN_SET>\n";
1582  xmlFile<<" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
1583  xmlFile<<" <DATA_FILE_NAME>"<< xmlName <<"</DATA_FILE_NAME>\n";
1584  xmlFile<<" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
1585  xmlFile<<" <!-- who and when created this dataset-->\n\n";
1586  xmlFile<<" <CREATE_TIMESTAMP>"<<TIME<<"</CREATE_TIMESTAMP>\n";
1587  xmlFile<<" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
1588  xmlFile<<" <!-- version (string) and subversion (number) -->\n";
1589  xmlFile<<" <!-- fields are used to read data back from the database -->\n\n";
1590  xmlFile<<" <VERSION>"<<run_number<<dataset_seq_number<<"</VERSION>\n";
1591  xmlFile<<" <SUBVERSION>1</SUBVERSION>\n";
1592  xmlFile<<" <!-- Assign predefined dataset attributes -->\n\n";
1593  xmlFile<<" <PREDEFINED_ATTRIBUTES>\n";
1594  xmlFile<<" <ATTRIBUTE>\n";
1595  xmlFile<<" <NAME>HCAL Dataset Status</NAME>\n";
1596  xmlFile<<" <VALUE>VALID</VALUE>\n";
1597  xmlFile<<" </ATTRIBUTE>\n";
1598  xmlFile<<" </PREDEFINED_ATTRIBUTES>\n";
1599  xmlFile<<" <!-- multiple data block records -->\n\n";
1600 
1601  std::vector <HcalElectronicsId> AllElIds = emap->allElectronicsIdPrecision();
1602  for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
1603  DetId detid=emap->lookup(*eid);
1604  if (detid.det()!=DetId::Hcal) continue;
1605  HcalGenericDetId gid(emap->lookup(*eid));
1606  if(!(!(gid.null()) &&
1607  (gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
1608  gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
1609  gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
1610  gid.genericSubdet()==HcalGenericDetId::HcalGenOuter))) continue;
1611  int eta,phi,depth;
1612  std::string subdet="";
1613  HcalDetId hid(detid);
1614  eta=hid.ieta();
1615  phi=hid.iphi();
1616  depth=hid.depth();
1617 
1618  double e=0,e_rms=0,t=0,t_rms=0;
1619  if(detid.subdetId()==HcalBarrel){
1620  subdet="HB";
1621  Statistic=hb_data[eta+42][phi-1][depth-1].get_statistics1();
1622  Status =hb_data[eta+42][phi-1][depth-1].get_status();
1623  hb_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
1624  hb_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
1625  }else if(detid.subdetId()==HcalEndcap){
1626  subdet="HE";
1627  Statistic=he_data[eta+42][phi-1][depth-1].get_statistics1();
1628  Status =he_data[eta+42][phi-1][depth-1].get_status();
1629  he_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
1630  he_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
1631  }else if(detid.subdetId()==HcalForward){
1632  subdet="HF";
1633  Statistic=hf_data[eta+42][phi-1][depth-1].get_statistics1();
1634  Status =hf_data[eta+42][phi-1][depth-1].get_status();
1635  hf_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
1636  hf_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
1637  }else if(detid.subdetId()==HcalOuter){
1638  subdet="HO";
1639  Statistic=ho_data[eta+42][phi-1][depth-1].get_statistics1();
1640  Status =ho_data[eta+42][phi-1][depth-1].get_status();
1641  ho_data[eta+42][phi-1][depth-1].get_average_amp1(&e,&e_rms);
1642  ho_data[eta+42][phi-1][depth-1].get_average_time1(&t,&t_rms);
1643  }else continue;
1644  xmlFile<<" <DATA>\n";
1645  xmlFile<<" <NUMBER_OF_EVENTS_USED>"<<Statistic<<"</NUMBER_OF_EVENTS_USED>\n";
1646  xmlFile<<" <SIGNAL_MEAN>"<<e<<"</SIGNAL_MEAN>\n";
1647  xmlFile<<" <SIGNAL_RMS>"<<e_rms<<"</SIGNAL_RMS>\n";
1648  xmlFile<<" <TIME_MEAN>"<<t<<"</TIME_MEAN>\n";
1649  xmlFile<<" <TIME_RMS>"<<t_rms<<"</TIME_RMS>\n";
1650  xmlFile<<" <CHANNEL_STATUS_WORD>"<<Status<<"</CHANNEL_STATUS_WORD>\n";
1651  xmlFile<<" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
1652  xmlFile<<" <SUBDET>"<<subdet<<"</SUBDET>\n";
1653  xmlFile<<" <IETA>"<<eta<<"</IETA>\n";
1654  xmlFile<<" <IPHI>"<<phi<<"</IPHI>\n";
1655  xmlFile<<" <DEPTH>"<<depth<<"</DEPTH>\n";
1656  xmlFile<<" <TYPE>0</TYPE>\n";
1657  xmlFile<<" </DATA>\n";
1658  }
1660  xmlFile<<" </DATA_SET>\n";
1661  xmlFile<<"</ROOT>\n";
1662  xmlFile.close();
1663 
1664 
1665  //create CALIB XML file
1666  sprintf(str,"HcalDetDiagLaserCalib_%i_%i.xml",run_number,dataset_seq_number);
1667  std::string xmlNameCalib=str;
1668  std::ofstream xmlFileCalib;
1669  xmlFileCalib.open(xmlNameCalib.c_str());
1670 
1671  xmlFileCalib<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
1672  xmlFileCalib<<"<ROOT>\n";
1673  xmlFileCalib<<" <HEADER>\n";
1674  xmlFileCalib<<" <HINTS mode='only-det-root'/>\n";
1675  xmlFileCalib<<" <TYPE>\n";
1676  xmlFileCalib<<" <EXTENSION_TABLE_NAME>HCAL_DETMON_LED_LASER_V1</EXTENSION_TABLE_NAME>\n";
1677  xmlFileCalib<<" <NAME>HCAL Laser CALIB [abort gap global]</NAME>\n";
1678  xmlFileCalib<<" </TYPE>\n";
1679  xmlFileCalib<<" <!-- run details -->\n";
1680  xmlFileCalib<<" <RUN>\n";
1681  xmlFileCalib<<" <RUN_TYPE>Global-RUN</RUN_TYPE>\n";
1682  xmlFileCalib<<" <RUN_NUMBER>"<<run_number<<"</RUN_NUMBER>\n";
1683  xmlFileCalib<<" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
1684  xmlFileCalib<<" <COMMENT_DESCRIPTION>hcal Laser CALIB data</COMMENT_DESCRIPTION>\n";
1685  xmlFileCalib<<" <LOCATION>P5</LOCATION>\n";
1686  xmlFileCalib<<" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
1687  xmlFileCalib<<" </RUN>\n";
1688  xmlFileCalib<<" </HEADER>\n";
1689  xmlFileCalib<<" <DATA_SET>\n";
1690  xmlFileCalib<<" <!-- optional dataset metadata -->\n\n";
1691  xmlFileCalib<<" <SET_NUMBER>"<<dataset_seq_number<<"</SET_NUMBER>\n";
1692  xmlFileCalib<<" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
1693  xmlFileCalib<<" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
1694  xmlFileCalib<<" <NUMBER_OF_EVENTS_IN_SET>"<<ievt_<<"</NUMBER_OF_EVENTS_IN_SET>\n";
1695  xmlFileCalib<<" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
1696  xmlFileCalib<<" <DATA_FILE_NAME>"<< xmlNameCalib <<"</DATA_FILE_NAME>\n";
1697  xmlFileCalib<<" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
1698  xmlFileCalib<<" <!-- who and when created this dataset-->\n\n";
1699  xmlFileCalib<<" <CREATE_TIMESTAMP>"<<TIME<<"</CREATE_TIMESTAMP>\n";
1700  xmlFileCalib<<" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
1701  xmlFileCalib<<" <!-- version (string) and subversion (number) -->\n";
1702  xmlFileCalib<<" <!-- fields are used to read data back from the database -->\n\n";
1703  xmlFileCalib<<" <VERSION>"<<run_number<<dataset_seq_number<<"</VERSION>\n";
1704  xmlFileCalib<<" <SUBVERSION>1</SUBVERSION>\n";
1705  xmlFileCalib<<" <!-- Assign predefined dataset attributes -->\n\n";
1706  xmlFileCalib<<" <PREDEFINED_ATTRIBUTES>\n";
1707  xmlFileCalib<<" <ATTRIBUTE>\n";
1708  xmlFileCalib<<" <NAME>HCAL Dataset Status</NAME>\n";
1709  xmlFileCalib<<" <VALUE>VALID</VALUE>\n";
1710  xmlFileCalib<<" </ATTRIBUTE>\n";
1711  xmlFileCalib<<" </PREDEFINED_ATTRIBUTES>\n";
1712  xmlFileCalib<<" <!-- multiple data block records -->\n\n";
1713 
1714  for(int sd=1;sd<=4;sd++) for(int eta=-2;eta<=2;eta++) for(int phi=1;phi<=72;phi++){
1715  std::string subdet="";
1716  if(sd==1) subdet="HB";
1717  if(sd==2) subdet="HE";
1718  if(sd==3) subdet="HO";
1719  if(sd==4) subdet="HF";
1720  if((calib_data[sd][eta+2][phi-1].get_statistics())>100){
1721  double e=0,e_rms=0,t=0,t_rms=0;
1722  Status=calib_data[sd][eta+2][phi-1].get_status();
1723  Statistic=calib_data[sd][eta+2][phi-1].get_statistics1();
1724  calib_data[sd][eta+2][phi-1].get_average_amp1(&e,&e_rms);
1725  calib_data[sd][eta+2][phi-1].get_average_time1(&t,&t_rms);
1726  xmlFileCalib<<" <DATA>\n";
1727  xmlFileCalib<<" <NUMBER_OF_EVENTS_USED>"<<Statistic<<"</NUMBER_OF_EVENTS_USED>\n";
1728  xmlFileCalib<<" <SIGNAL_MEAN>"<<e<<"</SIGNAL_MEAN>\n";
1729  xmlFileCalib<<" <SIGNAL_RMS>"<<e_rms<<"</SIGNAL_RMS>\n";
1730  xmlFileCalib<<" <TIME_MEAN>"<<t<<"</TIME_MEAN>\n";
1731  xmlFileCalib<<" <TIME_RMS>"<<t_rms<<"</TIME_RMS>\n";
1732  xmlFileCalib<<" <CHANNEL_STATUS_WORD>"<<Status<<"</CHANNEL_STATUS_WORD>\n";
1733  xmlFileCalib<<" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
1734  xmlFileCalib<<" <SUBDET>"<<subdet<<"</SUBDET>\n";
1735  xmlFileCalib<<" <IETA>"<<eta<<"</IETA>\n";
1736  xmlFileCalib<<" <IPHI>"<<phi<<"</IPHI>\n";
1737  xmlFileCalib<<" <DEPTH>"<<0<<"</DEPTH>\n";
1738  xmlFileCalib<<" <TYPE>0</TYPE>\n";
1739  xmlFileCalib<<" </DATA>\n";
1740  }
1741  }
1743  xmlFileCalib<<" </DATA_SET>\n";
1744  xmlFileCalib<<"</ROOT>\n";
1745  xmlFileCalib.close();
1746 
1747  sprintf(str,"zip %s.zip %s %s",xmlName.c_str(),xmlName.c_str(),xmlNameCalib.c_str());
1748  system(str);
1749  sprintf(str,"rm -f %s %s",xmlName.c_str(),xmlNameCalib.c_str());
1750  system(str);
1751  sprintf(str,"mv -f %s.zip %s",xmlName.c_str(),XmlFilePath.c_str());
1752  system(str);
1753 
1754  }
1755  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hb_data[i][j][k].reset1();
1756  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) he_data[i][j][k].reset1();
1757  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) ho_data[i][j][k].reset1();
1758  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++) hf_data[i][j][k].reset1();
1759  for(int i=0;i<5;i++)for(int j=0;j<5;j++)for(int k=0;k<72;k++)calib_data[i][j][k].reset1();
1760  ievt_=0;
1762 }
1764 double amp,rms,time,time_rms;
1765 int Eta,Phi,Depth;
1766 char subdet[10];
1767 TFile *f;
1768  if(gSystem->AccessPathName(ReferenceData.c_str())) return;
1769  f = new TFile(ReferenceData.c_str(),"READ");
1770 
1771  if(!f->IsOpen()) return ;
1772  TObjString *STR=(TObjString *)f->Get("run number");
1773 
1774  if(STR){ std::string Ref(STR->String()); ReferenceRun=Ref;}
1775 
1776  TTree* t=(TTree*)f->Get("HCAL Laser data");
1777  if(!t) return;
1778  t->SetBranchAddress("Subdet", subdet);
1779  t->SetBranchAddress("eta", &Eta);
1780  t->SetBranchAddress("phi", &Phi);
1781  t->SetBranchAddress("depth", &Depth);
1782  t->SetBranchAddress("amp", &amp);
1783  t->SetBranchAddress("rms", &rms);
1784  t->SetBranchAddress("time", &time);
1785  t->SetBranchAddress("time_rms", &time_rms);
1786  for(int ievt=0;ievt<t->GetEntries();ievt++){
1787  t->GetEntry(ievt);
1788  if(strcmp(subdet,"HB")==0) hb_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
1789  if(strcmp(subdet,"HE")==0) he_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
1790  if(strcmp(subdet,"HO")==0) ho_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
1791  if(strcmp(subdet,"HF")==0) hf_data[Eta+42][Phi-1][Depth-1].set_reference(amp,rms,time,time_rms);
1792  if(strcmp(subdet,"CALIB_HB")==0) calib_data[1][Eta+2][Phi-1].set_reference(amp,rms,time,time_rms);
1793  if(strcmp(subdet,"CALIB_HE")==0) calib_data[2][Eta+2][Phi-1].set_reference(amp,rms,time,time_rms);
1794  if(strcmp(subdet,"CALIB_HO")==0) calib_data[3][Eta+2][Phi-1].set_reference(amp,rms,time,time_rms);
1795  if(strcmp(subdet,"CALIB_HF")==0) calib_data[4][Eta+2][Phi-1].set_reference(amp,rms,time,time_rms);
1796  }
1797  f->Close();
1798  IsReference=true;
1799 }
1801 double amp,rms,time,time_rms;
1802 int Eta,Phi,Depth,Statistic;
1803 char subdet[10];
1804 TFile *f;
1805  if(DatasetName.size()==0) return;
1806  createHTMLonly=true;
1807  if(gSystem->AccessPathName(DatasetName.c_str())) return;
1808  f = new TFile(DatasetName.c_str(),"READ");
1809 
1810  if(!f->IsOpen()) return ;
1811 
1812  TTree* t=0;
1813  t=(TTree*)f->Get("HCAL Laser data");
1814  if(!t) return;
1815  t->SetBranchAddress("Subdet", subdet);
1816  t->SetBranchAddress("eta", &Eta);
1817  t->SetBranchAddress("phi", &Phi);
1818  t->SetBranchAddress("depth", &Depth);
1819  t->SetBranchAddress("amp", &amp);
1820  t->SetBranchAddress("rms", &rms);
1821  t->SetBranchAddress("time", &time);
1822  t->SetBranchAddress("time_rms", &time_rms);
1823  t->SetBranchAddress("statistic",&Statistic);
1824  for(int ievt=0;ievt<t->GetEntries();ievt++){
1825  t->GetEntry(ievt);
1826  if(strcmp(subdet,"HB")==0){ nHB++;
1827  hb_data[Eta+42][Phi-1][Depth-1].set_data(amp,rms,time,time_rms);
1828  hb_data[Eta+42][Phi-1][Depth-1].set_statistics(Statistic);
1829  hb_data[Eta+42][Phi-1][Depth-1].set_statistics1(Statistic);
1830  }
1831  if(strcmp(subdet,"HE")==0){ nHE++;
1832  he_data[Eta+42][Phi-1][Depth-1].set_data(amp,rms,time,time_rms);
1833  he_data[Eta+42][Phi-1][Depth-1].set_statistics(Statistic);
1834  he_data[Eta+42][Phi-1][Depth-1].set_statistics1(Statistic);
1835  }
1836  if(strcmp(subdet,"HO")==0){ nHO++;
1837  ho_data[Eta+42][Phi-1][Depth-1].set_data(amp,rms,time,time_rms);
1838  ho_data[Eta+42][Phi-1][Depth-1].set_statistics(Statistic);
1839  ho_data[Eta+42][Phi-1][Depth-1].set_statistics1(Statistic);
1840  }
1841  if(strcmp(subdet,"HF")==0){ nHF++;
1842  hf_data[Eta+42][Phi-1][Depth-1].set_data(amp,rms,time,time_rms);
1843  hf_data[Eta+42][Phi-1][Depth-1].set_statistics(Statistic);
1844  hf_data[Eta+42][Phi-1][Depth-1].set_statistics1(Statistic);
1845  }
1846  if(strcmp(subdet,"CALIB_HB")==0){
1847  calib_data[1][Eta+2][Phi-1].set_data(amp,rms,time,time_rms);
1848  calib_data[1][Eta+2][Phi-1].set_statistics(Statistic);
1849  calib_data[1][Eta+2][Phi-1].set_statistics1(Statistic);
1850  }
1851  if(strcmp(subdet,"CALIB_HE")==0){
1852  calib_data[2][Eta+2][Phi-1].set_data(amp,rms,time,time_rms);
1853  calib_data[2][Eta+2][Phi-1].set_statistics(Statistic);
1854  calib_data[2][Eta+2][Phi-1].set_statistics1(Statistic);
1855  }
1856  if(strcmp(subdet,"CALIB_HO")==0){
1857  calib_data[3][Eta+2][Phi-1].set_data(amp,rms,time,time_rms);
1858  calib_data[3][Eta+2][Phi-1].set_statistics(Statistic);
1859  calib_data[3][Eta+2][Phi-1].set_statistics1(Statistic);
1860  }
1861  if(strcmp(subdet,"CALIB_HF")==0){
1862  calib_data[4][Eta+2][Phi-1].set_data(amp,rms,time,time_rms);
1863  calib_data[4][Eta+2][Phi-1].set_statistics(Statistic);
1864  calib_data[4][Eta+2][Phi-1].set_statistics1(Statistic);
1865  }
1866  }
1867  TObjString *STR1=(TObjString *)f->Get("run number");
1868  if(STR1){ int run; sscanf(STR1->String(),"%i",&run); meRUN_->Fill(run); run_number=run;}
1869 
1870  TObjString *STR2=(TObjString *)f->Get("Total events processed");
1871  if(STR2){ int events; sscanf(STR2->String(),"%i",&events); meEVT_->Fill(events); ievt_=events;}
1872 
1873  TObjString *STR3=(TObjString *)f->Get("Dataset number");
1874  if(STR3){ int ds; sscanf(STR3->String(),"%i",&ds); dataset_seq_number=ds;}
1875  f->Close();
1876 }
1877 
1879 float adc_range[20]={14,28,40,52,67,132,202,262,322,397,722,1072,1372,1672,2047,3672,5422,6922,8422,10297};
1880 int adc_bins[20]={1,2,3,4,5,5,10,15,20,25,25,50,75,100,125,125,250,375,500,625};
1881 char str[100];
1882  TF1 *fitFunc = new TF1("fitFunc","gaus");
1883  if(fitFunc==0) return;
1884  for(int i=0;i<56;i++){
1885  float sum1=0,sum2=0,n=0;
1886  S1[i]=S2[i]=0;
1887  for(int j=0;j<128;j++){
1888  sum1+=(adc2fC[j]-2.5)*Raddam_data[i].s1_adc[j];
1889  sum2+=(adc2fC[j]-2.5)*Raddam_data[i].s2_adc[j];
1890  n+=Raddam_data[i].s1_adc[j];
1891  }
1892  if(n<100) continue;
1893  sum1=sum1/n;
1894  sum2=sum2/n;
1895  int N=0;
1896  int Ws1=1,Ws2=1;
1897  for(N=1;N<19;N++) if(sum1>adc_range[N-1] && sum1<adc_range[N]) break;
1898  Ws1=adc_bins[N+1];
1899  for(N=1;N<19;N++) if(sum2>adc_range[N-1] && sum2<adc_range[N]) break;
1900  Ws2=adc_bins[N+1];
1901  sprintf(str,"Raddam(%i,%i,%i) S1",RADDAM_CH[i].eta,RADDAM_CH[i].phi,RADDAM_CH[i].depth);
1902  S1[i]=new TH1F(str,str,10000/Ws1,0,10000);
1903  sprintf(str,"Raddam(%i,%i,%i) S2",RADDAM_CH[i].eta,RADDAM_CH[i].phi,RADDAM_CH[i].depth);
1904  S2[i]=new TH1F(str,str,10000/Ws1,0,10000);
1905  for(int j=0;j<128;j++){
1906  S1[i]->Fill(adc2fC[j]-2.5,Raddam_data[i].s1_adc[j]);
1907  S2[i]->Fill(adc2fC[j]-2.5,Raddam_data[i].s2_adc[j]);
1908  }
1909  double parm[3];
1910  S1[i]->Fit("fitFunc");
1911  S1[i]->GetFunction("fitFunc")->GetParameters(parm);
1912  Raddam_data[i].S1MEAN=S1[i]->GetMean();
1913  Raddam_data[i].S1RMS=S1[i]->GetRMS();
1914  Raddam_data[i].S1FITMEAN=parm[1];
1915  Raddam_data[i].S1FITMEANER=S1[i]->GetFunction("fitFunc")->GetParError(1);
1916  Raddam_data[i].S1FITSIGMA=parm[2];
1917  Raddam_data[i].S1CHI2=S1[i]->GetFunction("fitFunc")->GetChisquare();
1918  Raddam_data[i].S1NDF=S1[i]->GetFunction("fitFunc")->GetNDF();
1919  Raddam_data[i].S1BINWIDTH=Ws1;
1920  S2[i]->Fit("fitFunc");
1921  S2[i]->GetFunction("fitFunc")->GetParameters(parm);
1922  Raddam_data[i].S2MEAN=S2[i]->GetMean();
1923  Raddam_data[i].S2RMS=S2[i]->GetRMS();
1924  Raddam_data[i].S2FITMEAN=parm[1];
1925  Raddam_data[i].S2FITMEANER=S2[i]->GetFunction("fitFunc")->GetParError(1);
1926  Raddam_data[i].S2FITSIGMA=parm[2];
1927  Raddam_data[i].S2CHI2=S2[i]->GetFunction("fitFunc")->GetChisquare();
1928  Raddam_data[i].S2NDF=S2[i]->GetFunction("fitFunc")->GetNDF();
1929  Raddam_data[i].S2BINWIDTH=Ws2;
1930  }
1931  if(XmlFilePath.size()>0){
1932  char TIME[40];
1933  Long_t t; t=time(0); strftime(TIME,30,"%F %T",localtime(&t));
1934  //create XML file
1935  if(!Overwrite){
1936  sprintf(str,"HcalDetDiagRaddam_%i_%i.xml",run_number,dataset_seq_number);
1937  }else{
1938  sprintf(str,"HcalDetDiagRaddam.xml");
1939  }
1940  std::string xmlName=str;
1941  std::ofstream xmlFile;
1942  xmlFile.open(xmlName.c_str());
1943  xmlFile<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n";
1944  xmlFile<<"<ROOT>\n";
1945  xmlFile<<" <HEADER>\n";
1946  xmlFile<<" <TYPE>\n";
1947  xmlFile<<" <EXTENSION_TABLE_NAME>HCAL_RADDAM</EXTENSION_TABLE_NAME>\n";
1948  xmlFile<<" <NAME>HCAL Raddam</NAME>\n";
1949  xmlFile<<" </TYPE>\n";
1950  xmlFile<<" <!-- run details -->\n";
1951  xmlFile<<" <RUN>\n";
1952  xmlFile<<" <RUN_TYPE>TEST LOCAL-RUN</RUN_TYPE>\n";
1953  xmlFile<<" <RUN_NUMBER>"<<run_number<<"</RUN_NUMBER>\n";
1954  xmlFile<<" <RUN_BEGIN_TIMESTAMP>"<<TIME<<"</RUN_BEGIN_TIMESTAMP>\n";
1955  xmlFile<<" <COMMENT_DESCRIPTION>hcal raddam data</COMMENT_DESCRIPTION>\n";
1956  xmlFile<<" <LOCATION>P5</LOCATION>\n";
1957  xmlFile<<" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
1958  xmlFile<<" </RUN>\n";
1959  xmlFile<<" </HEADER>\n";
1960  xmlFile<<" <DATA_SET>\n";
1961  xmlFile<<" <COMMENT_DESCRIPTION>Test Raddam data</COMMENT_DESCRIPTION>\n";
1962  xmlFile<<" <CREATE_TIMESTAMP>"<<TIME<<"</CREATE_TIMESTAMP>\n";
1963  xmlFile<<" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
1964  xmlFile<<" <VERSION>Test_Version_1</VERSION>\n";
1965 
1966  for(int i=0;i<56;i++){
1967  xmlFile<<" <DATA>\n";
1968  xmlFile<<" <SUBDET>HF</SUBDET>\n";
1969  xmlFile<<" <IETA>"<<RADDAM_CH[i].eta<<"</IETA>\n";
1970  xmlFile<<" <IPHI>"<<RADDAM_CH[i].phi<<"</IPHI>\n";
1971  xmlFile<<" <DEPTH>"<<RADDAM_CH[i].depth<<"</DEPTH>\n";
1972 
1973  xmlFile<<" <TOTEVNT>"<<Raddam_data[i].TOTEVNT<<"</TOTEVNT>\n";
1974  xmlFile<<" <CUT1EVNT>"<<Raddam_data[i].CUT1EVNT<<"</CUT1EVNT>\n";
1975  xmlFile<<" <CUT2EVNT>"<<Raddam_data[i].CUT2EVNT<<"</CUT2EVNT>\n";
1976 
1977  xmlFile<<" <S1MEAN>"<<Raddam_data[i].S1MEAN <<"</S1MEAN>\n";
1978  xmlFile<<" <S1RMS>"<<Raddam_data[i].S1RMS <<"</S1RMS>\n";
1979  xmlFile<<" <S1FITMEAN>"<<Raddam_data[i].S1FITMEAN <<"</S1FITMEAN>\n";
1980  xmlFile<<" <S1FITMEANER>"<<Raddam_data[i].S1FITMEANER <<"</S1FITMEANER>\n";
1981  xmlFile<<" <S1FITSIGMA>"<<Raddam_data[i].S1FITSIGMA <<"</S1FITSIGMA>\n";
1982  xmlFile<<" <S1CHI2>"<<Raddam_data[i].S1CHI2 <<"</S1CHI2>\n";
1983  xmlFile<<" <S1NDF>"<<Raddam_data[i].S1NDF <<"</S1NDF>\n";
1984  xmlFile<<" <S1BINWIDTH>"<<Raddam_data[i].S1BINWIDTH <<"</S1BINWIDTH>\n";
1985 
1986  xmlFile<<" <S2MEAN>"<<Raddam_data[i].S2MEAN <<"</S2MEAN>\n";
1987  xmlFile<<" <S2RMS>"<<Raddam_data[i].S2RMS <<"</S2RMS>\n";
1988  xmlFile<<" <S2FITMEAN>"<<Raddam_data[i].S2FITMEAN <<"</S2FITMEAN>\n";
1989  xmlFile<<" <S2FITMEANER>"<<Raddam_data[i].S2FITMEANER <<"</S2FITMEANER>\n";
1990  xmlFile<<" <S2FITSIGMA>"<<Raddam_data[i].S2FITSIGMA <<"</S2FITSIGMA>\n";
1991  xmlFile<<" <S2CHI2>"<<Raddam_data[i].S2CHI2 <<"</S2CHI2>\n";
1992  xmlFile<<" <S2NDF>"<<Raddam_data[i].S2NDF <<"</S2NDF>\n";
1993  xmlFile<<" <S2BINWIDTH>"<<Raddam_data[i].S2BINWIDTH <<"</S2BINWIDTH>\n";
1994  xmlFile<<" </DATA>\n";
1995  }
1996  xmlFile<<" </DATA_SET>\n";
1997  xmlFile<<"</ROOT>\n";
1998 
1999  xmlFile.close();
2000  sprintf(str,"zip %s.zip %s",xmlName.c_str(),xmlName.c_str());
2001  system(str);
2002  sprintf(str,"rm -f %s",xmlName.c_str());
2003  system(str);
2004  sprintf(str,"mv -f %s.zip %s",xmlName.c_str(),XmlFilePath.c_str());
2005  system(str);
2006  }
2007  if(OutputFilePath.size()>0){
2008  if(!Overwrite){
2009  sprintf(str,"%sHcalDetDiagRaddamData_run%06i_%i.root",OutputFilePath.c_str(),run_number,dataset_seq_number);
2010  }else{
2011  sprintf(str,"%sHcalDetDiagRaddamData.root",OutputFilePath.c_str());
2012  }
2013  TFile *theFile = new TFile(str, "RECREATE");
2014  if(!theFile->IsOpen()) return;
2015  theFile->cd();
2016  for(int i=0;i<56;i++){
2017  if(S1[i]!=0)S1[i]->Write();
2018  if(S2[i]!=0)S2[i]->Write();
2019  }
2020  theFile->Write();
2021  theFile->Close();
2022  }
2023 }
2024 
2026  if(RaddamRun){
2027  SaveRaddamData();
2028  }
2029  if((LocalRun || !Online_ || createHTMLonly) && ievt_>10){
2037  if(!RaddamRun)SaveReference();
2038  }
2039 }
2040 
2043 
2044 //define this as a plug-in
RunNumber_t run() const
Definition: EventID.h:42
void analyze(const edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void setBinContent(int binx, double content)
set content of bin (1-D)
void add_statistics(double *data, int nTS)
void endRun(const edm::Run &run, const edm::EventSetup &c) override
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
double GetEnergy(double *data, int n)
HcalDetDiagLaserData * GetCalib(std::string sd, int eta, int phi)
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
void set_reference(float val, float rms, float time, float time_rms)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
edm::EDGetTokenT< HcalCalibDigiCollection > tok_calib_
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
bool get_average_amp(double *ave, double *rms)
bool get_average_amp1(double *ave, double *rms)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
const HcalElectronicsMap * emap
std::vector< HFDataFrame >::const_iterator const_iterator
void setup(DQMStore *&m_dbe, std::string Name, std::string Units="")
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
const Item * getValues(DetId fId, bool throwOnFail=true) const
bool get_ave_subdet(int sd, float *ave_t, float *ave_e, float *ave_t_r, float *ave_e_r)
edm::EDGetTokenT< HFDigiCollection > tok_hf_
HcalRaddamData Raddam_data[56]
T eta() const
static const float adc2fC[128]
bool get_ave_rbx(int sd, int side, int rbx, float *ave, float *rms)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
bool get_average_time(double *ave, double *rms)
std::map< unsigned int, int > KnownBadCells_
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Raddam_ch RADDAM_CH[56]
static const float SD[]
Definition: sicif.h:67
bool isSiPM(int ieta, int iphi, int depth)
int depth() const
get the tower depth
Definition: HcalDetId.h:40
#define ETA
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
int iEvent
Definition: GenABIO.cc:230
std::vector< MonitorElement * > depth
const T & max(const T &a, const T &b)
MonitorElement * bookString(const char *name, const char *value)
Book string.
Definition: DQMStore.cc:908
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< DetId > getAllChannels() const
T sqrt(T t)
Definition: SSEVec.h:48
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
double f[11][100]
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
int orbitNumber() const
Definition: EventBase.h:63
bool isValid() const
Definition: HandleBase.h:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
edm::EDGetTokenT< HODigiCollection > tok_ho_
int k[5][pyjets_maxn]
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
Definition: DetId.h:18
HcalDetDiagLaserData hb_data[85][72][4]
HcalDetDiagLaserMonitor(const edm::ParameterSet &)
bool get_average_time1(double *ave, double *rms)
#define N
Definition: blowfish.cc:9
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
double sd
const T & get() const
Definition: EventSetup.h:55
#define PHI
T const * product() const
Definition: ESHandle.h:62
virtual void reset(void)
bool xmlFile(const std::string fParam)
int CalcEtaBin(int subdet, int ieta, int depth)
double GetTime(double *data, int n=10)
edm::EventID id() const
Definition: EventBase.h:56
HcalDetDiagLaserData hf_data[85][72][4]
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple events
Definition: patZpeak.py:19
void beginRun(const edm::Run &run, const edm::EventSetup &c) override
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
bool get_reference(double *val, double *rms, double *time, double *time_rms)
void set_data(float val, float rms, float time, float time_rms)
dictionary rawdata
Definition: lumiPlot.py:393
tuple status
Definition: ntuplemaker.py:245
HcalDetDiagLaserData he_data[85][72][4]
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:849
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:1070
virtual void setup(void)
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
long double T
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::vector< std::string > problemnames_
void Reset(void)
reset ME (ie. contents, errors, etc)
HcalDetDiagLaserData ho_data[85][72][4]
edm::EDGetTokenT< HcalTBTriggerData > tok_tb_
HcalDetDiagLaserData calib_data[5][5][72]
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
TrackTransientTrack TTT
Definition: Run.h:41
Definition: DDAxes.h:10