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