CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDetDiagPedestalMonitor.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalDetDiagPedestalMonitor
4 // Class: HcalDetDiagPedestalMonitor
5 //
13 //
14 // Original Author: Dmitry Vishnevskiy,591 R-013,+41227674265,
15 // Created: Tue Mar 9 12:59:18 CET 2010
16 //
17 //
18 // user include files
24 
29 
32 
33 #include <math.h>
34 // this is to retrieve HCAL digi's
36 // to retrive trigger information (local runs only)
38 
41 
45 
46 #include "TFile.h"
47 #include "TTree.h"
48 #include "TSystem.h"
49 
55 
56 #include <iostream>
57 #include <fstream>
58 
60 public:
62  reset();
63  IsReference=false;
64  status=n=0;
65  ds_ped=ds_rms=-100;
67  }
68  void reset(){
69  for(int i=0;i<128;i++) adc[i]=0;
70  overflow=0;
71  }
72  void add_statistics(unsigned int val){
73  if(val<128){ adc[val&0x7F]++; n++;}else overflow++;
74  }
75  void set_reference(float val,float rms){
76  ref_ped=val; ref_rms=rms;
77  IsReference=true;
78  }
79  void set_data(float val,float rms){
80  ds_ped=val; ds_rms=rms;
81  }
82  void change_status(int val){
83  status|=val;
84  }
85  int get_status(){
86  return status;
87  }
88  bool get_reference(double *val,double *rms){
89  *val=ref_ped; *rms=ref_rms;
90  return IsReference;
91  }
92  bool get_average(double *ave,double *rms){
93  if(ds_ped>-100){ *ave=ds_ped; *rms=ds_rms; return true;}
94  double Sum=0,nSum=0;
95  int from,to,max=adc[0],maxi=0;
96  for(int i=1;i<128;i++) if(adc[i]>max){ max=adc[i]; maxi=i;}
97  from=0; to=maxi+6; if(to>127) to=127;
98  for(int i=from;i<=to;i++){
99  Sum+=i*adc[i];
100  nSum+=adc[i];
101  }
102  if(nSum>0) *ave=Sum/nSum; else return false;
103  Sum=0;
104  for(int i=from;i<=to;i++) Sum+=adc[i]*(i-*ave)*(i-*ave);
105  *rms=sqrt(Sum/nSum);
106  return true;
107  }
109  return n;
110  }
111  void set_statistics(int stat){
112  n=stat;
113  }
115  return overflow;
116  }
117  float nChecks;
118  float nMissing;
119  float nUnstable;
120  float nBadPed;
121  float nBadRms;
122 private:
123  int adc[128];
124  int overflow;
126  float ref_ped;
127  float ref_rms;
128  float ds_ped;
129  float ds_rms;
130  int n;
131  int status;
132 };
133 
134 
136  public:
139 
140 
141  private:
142  void SaveReference();
143  void LoadReference();
144  void LoadDataset();
145 
146  void CheckStatus();
147  void fillHistos();
148 
151 
157 
158  void bookHistograms(DQMStore::IBooker &ib, const edm::Run& run, const edm::EventSetup& c) override;
159  void endRun(const edm::Run& run, const edm::EventSetup& c) override;
160  void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& c) override ;
161  void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,const edm::EventSetup& c) override;
162  void analyze(const edm::Event&, const edm::EventSetup&) override;
163 
164  int ievt_;
168  bool LocalRun;
169  int nHB,nHE,nHO,nHF;
170 
179 
184 
185  // to create html from processed dataset
189 
191  bool Online_;
192  bool Overwrite;
193 
202 
212 
217 
224 
229 
234  std::vector<std::string> problemnames_;
235 
240 
241  std::map<unsigned int, int> KnownBadCells_;
242 
243  // previously: statics in analyze
244  bool PEDseq_;
246 };
247 
249 
250  ievt_=-1;
251  emap=0;
253  run_number=-1;
254  IsReference=false;
255  LocalRun=false;
256  nHB=nHE=nHO=nHF=0;
257  createHTMLonly=false;
259  inputLabelDigi_ = iConfig.getUntrackedParameter<edm::InputTag>("digiLabel");
260  ReferenceData = iConfig.getUntrackedParameter<std::string>("PedestalReferenceData" ,"");
261  OutputFilePath = iConfig.getUntrackedParameter<std::string>("OutputFilePath", "");
262  DatasetName = iConfig.getUntrackedParameter<std::string>("PedestalDatasetName", "");
263  htmlOutputPath = iConfig.getUntrackedParameter<std::string>("htmlOutputPath", "");
264  XmlFilePath = iConfig.getUntrackedParameter<std::string>("XmlFilePath", "");
265  Online_ = iConfig.getUntrackedParameter<bool> ("online",false);
266  Overwrite = iConfig.getUntrackedParameter<bool> ("Overwrite",true);
267 
268  prefixME_ = iConfig.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
269  if (prefixME_.size()>0 && prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
270  prefixME_.append("/");
271  subdir_ = iConfig.getUntrackedParameter<std::string>("TaskFolder","DetDiagPedestalMonitor_Hcal/");
272  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
273  subdir_.append("/");
274  subdir_=prefixME_+subdir_;
275 
276  HBMeanTreshold = iConfig.getUntrackedParameter<double>("HBMeanPedestalTreshold" , 0.2);
277  HBRmsTreshold = iConfig.getUntrackedParameter<double>("HBRmsPedestalTreshold" , 0.3);
278  HEMeanTreshold = iConfig.getUntrackedParameter<double>("HEMeanPedestalTreshold" , 0.2);
279  HERmsTreshold = iConfig.getUntrackedParameter<double>("HERmsPedestalTreshold" , 0.3);
280  HOMeanTreshold = iConfig.getUntrackedParameter<double>("HOMeanPedestalTreshold" , 0.2);
281  HORmsTreshold = iConfig.getUntrackedParameter<double>("HORmsPedestalTreshold" , 0.3);
282  HFMeanTreshold = iConfig.getUntrackedParameter<double>("HFMeanPedestalTreshold" , 0.2);
283  HFRmsTreshold = iConfig.getUntrackedParameter<double>("HFRmsPedestalTreshold" , 0.3);
284 
285  // register for data access
286  tok_hbhe_ = consumes<HBHEDigiCollection>(inputLabelDigi_);
287  tok_ho_ = consumes<HODigiCollection>(inputLabelDigi_);
288  tok_hf_ = consumes<HFDigiCollection>(inputLabelDigi_);
289  tok_raw_ = consumes<FEDRawDataCollection>(iConfig.getUntrackedParameter<edm::InputTag>("rawDataLabel"));
290  tok_tb_ = consumes<HcalTBTriggerData>(iConfig.getParameter<edm::InputTag>("hcalTBTriggerDataTag"));
291 
292 
297 
302 
303 }
304 
306 {
307 
316 
317 }
318 
320  edm::ESHandle<HcalDbService> conditions_;
321  c.get<HcalDbRecord>().get(conditions_);
322  emap=conditions_->getHcalMapping();
323 
325  c.get<HcalChannelQualityRcd>().get("withTopo",p);
326  const HcalChannelQuality* chanquality= p.product();
327  std::vector<DetId> mydetids = chanquality->getAllChannels();
328  KnownBadCells_.clear();
329 
330  for (std::vector<DetId>::const_iterator i = mydetids.begin();i!=mydetids.end();++i){
331  if (i->det()!=DetId::Hcal) continue; // not an hcal cell
332  HcalDetId id=HcalDetId(*i);
333  int status=(chanquality->getValues(id))->getValue();
335  KnownBadCells_[id.rawId()]=status;
336  }
337  }
338 
339 
342 
344  meEVT_ = ib.bookInt("HcalDetDiagPedestalMonitor Event Number");
345  meRUN_ = ib.bookInt("HcalDetDiagPedestalMonitor Run Number");
346 
347  ReferenceRun="UNKNOWN";
348  LoadReference();
349  LoadDataset();
351  RefRun_= ib.bookString("HcalDetDiagPedestalMonitor Reference Run",ReferenceRun);
352  if(DatasetName.size()>0 && createHTMLonly){
353  char str[200]; sprintf(str,"%sHcalDetDiagPedestalData_run%i_%i/",htmlOutputPath.c_str(),run_number,dataset_seq_number);
354  htmlFolder=ib.bookString("HcalDetDiagPedestalMonitor HTML folder",str);
355  MonitorElement *me;
356  ib.setCurrentFolder(prefixME_+"HcalInfo");
357  me=ib.bookInt("HBpresent");
358  if(nHB>0) me->Fill(1);
359  me=ib.bookInt("HEpresent");
360  if(nHE>0) me->Fill(1);
361  me=ib.bookInt("HOpresent");
362  if(nHO>0) me->Fill(1);
363  me=ib.bookInt("HFpresent");
364  if(nHF>0) me->Fill(1);
365  }
366 
368  ProblemCellsByDepth_missing->setup(ib," Problem Missing Channels");
369  for(unsigned int i=0;i<ProblemCellsByDepth_missing->depth.size();i++)
370  problemnames_.push_back(ProblemCellsByDepth_missing->depth[i]->getName());
372  ProblemCellsByDepth_unstable->setup(ib," Problem Unstable Channels");
373  for(unsigned int i=0;i<ProblemCellsByDepth_unstable->depth.size();i++)
374  problemnames_.push_back(ProblemCellsByDepth_unstable->depth[i]->getName());
376  ProblemCellsByDepth_badped->setup(ib," Problem Bad Pedestal Value");
377  for(unsigned int i=0;i<ProblemCellsByDepth_badped->depth.size();i++)
378  problemnames_.push_back(ProblemCellsByDepth_badped->depth[i]->getName());
380  ProblemCellsByDepth_badrms->setup(ib," Problem Bad Rms Value");
381  for(unsigned int i=0;i<ProblemCellsByDepth_badrms->depth.size();i++)
382  problemnames_.push_back(ProblemCellsByDepth_badrms->depth[i]->getName());
383 
384  ib.setCurrentFolder(subdir_+"Summary Plots");
385  name="HB Pedestal Distribution (average over 4 caps)"; PedestalsAve4HB = ib.book1D(name,name,200,0,6);
386  name="HE Pedestal Distribution (average over 4 caps)"; PedestalsAve4HE = ib.book1D(name,name,200,0,6);
387  name="HO Pedestal Distribution (average over 4 caps)"; PedestalsAve4HO = ib.book1D(name,name,200,0,6);
388  name="HF Pedestal Distribution (average over 4 caps)"; PedestalsAve4HF = ib.book1D(name,name,200,0,6);
389  name="SIPM Pedestal Distribution (average over 4 caps)"; PedestalsAve4Simp = ib.book1D(name,name,200,5,15);
390 
391  name="HB Pedestal-Reference Distribution (average over 4 caps)"; PedestalsAve4HBref= ib.book1D(name,name,1500,-3,3);
392  name="HE Pedestal-Reference Distribution (average over 4 caps)"; PedestalsAve4HEref= ib.book1D(name,name,1500,-3,3);
393  name="HO Pedestal-Reference Distribution (average over 4 caps)"; PedestalsAve4HOref= ib.book1D(name,name,1500,-3,3);
394  name="HF Pedestal-Reference Distribution (average over 4 caps)"; PedestalsAve4HFref= ib.book1D(name,name,1500,-3,3);
395 
396  name="HB Pedestal RMS Distribution (individual cap)"; PedestalsRmsHB = ib.book1D(name,name,200,0,2);
397  name="HE Pedestal RMS Distribution (individual cap)"; PedestalsRmsHE = ib.book1D(name,name,200,0,2);
398  name="HO Pedestal RMS Distribution (individual cap)"; PedestalsRmsHO = ib.book1D(name,name,200,0,2);
399  name="HF Pedestal RMS Distribution (individual cap)"; PedestalsRmsHF = ib.book1D(name,name,200,0,2);
400  name="SIPM Pedestal RMS Distribution (individual cap)"; PedestalsRmsSimp = ib.book1D(name,name,200,0,4);
401 
402  name="HB Pedestal_rms-Reference_rms Distribution"; PedestalsRmsHBref = ib.book1D(name,name,1500,-3,3);
403  name="HE Pedestal_rms-Reference_rms Distribution"; PedestalsRmsHEref = ib.book1D(name,name,1500,-3,3);
404  name="HO Pedestal_rms-Reference_rms Distribution"; PedestalsRmsHOref = ib.book1D(name,name,1500,-3,3);
405  name="HF Pedestal_rms-Reference_rms Distribution"; PedestalsRmsHFref = ib.book1D(name,name,1500,-3,3);
406 
407  name="HBHEHF pedestal mean map"; Pedestals2DHBHEHF = ib.book2D(name,name,87,-43,43,74,0,73);
408  name="HO pedestal mean map"; Pedestals2DHO = ib.book2D(name,name,33,-16,16,74,0,73);
409  name="HBHEHF pedestal rms map"; Pedestals2DRmsHBHEHF = ib.book2D(name,name,87,-43,43,74,0,73);
410  name="HO pedestal rms map"; Pedestals2DRmsHO = ib.book2D(name,name,33,-16,16,74,0,73);
411  name="HBHEHF pedestal problems map"; Pedestals2DErrorHBHEHF = ib.book2D(name,name,87,-43,43,74,0,73);
412  name="HO pedestal problems map"; Pedestals2DErrorHO = ib.book2D(name,name,33,-16,16,74,0,73);
413 
415  Pedestals2DHO->setAxisRange(1,5,3);
418 
419  Pedestals2DHBHEHF->setAxisTitle("i#eta",1);
420  Pedestals2DHBHEHF->setAxisTitle("i#phi",2);
421  Pedestals2DHO->setAxisTitle("i#eta",1);
422  Pedestals2DHO->setAxisTitle("i#phi",2);
425  Pedestals2DRmsHO->setAxisTitle("i#eta",1);
426  Pedestals2DRmsHO->setAxisTitle("i#phi",2);
429  Pedestals2DErrorHO->setAxisTitle("i#eta",1);
430  Pedestals2DErrorHO->setAxisTitle("i#phi",2);
431  PedestalsAve4HB->setAxisTitle("ADC counts",1);
432  PedestalsAve4HE->setAxisTitle("ADC counts",1);
433  PedestalsAve4HO->setAxisTitle("ADC counts",1);
434  PedestalsAve4HF->setAxisTitle("ADC counts",1);
435  PedestalsAve4Simp->setAxisTitle("ADC counts",1);
436  PedestalsAve4HBref->setAxisTitle("ADC counts",1);
437  PedestalsAve4HEref->setAxisTitle("ADC counts",1);
438  PedestalsAve4HOref->setAxisTitle("ADC counts",1);
439  PedestalsAve4HFref->setAxisTitle("ADC counts",1);
440  PedestalsRmsHB->setAxisTitle("ADC counts",1);
441  PedestalsRmsHE->setAxisTitle("ADC counts",1);
442  PedestalsRmsHO->setAxisTitle("ADC counts",1);
443  PedestalsRmsHF->setAxisTitle("ADC counts",1);
444  PedestalsRmsSimp->setAxisTitle("ADC counts",1);
445  PedestalsRmsHBref->setAxisTitle("ADC counts",1);
446  PedestalsRmsHEref->setAxisTitle("ADC counts",1);
447  PedestalsRmsHOref->setAxisTitle("ADC counts",1);
448  PedestalsRmsHFref->setAxisTitle("ADC counts",1);
449 
450  ib.setCurrentFolder(subdir_+"Plots for client");
452  ProblemCellsByDepth_missing_val->setup(ib," Missing channels");
454  ProblemCellsByDepth_unstable_val->setup(ib," Channel instability value");
456  ProblemCellsByDepth_badped_val->setup(ib," Bad Pedestal-Ref Value");
458  ProblemCellsByDepth_badrms_val->setup(ib," Bad Rms-ref Value");
459 }
460 
461 
462 
464  if(createHTMLonly) return;
465  HcalBaseDQMonitor::analyze(iEvent, iSetup); // increments counters
466 int eta,phi,depth,nTS;
467  if(ievt_==-1){ ievt_=0; PEDseq_=false; lastPEDorbit_=-1;nChecksPED_=0; }
468  int orbit=iEvent.orbitNumber();
469  meRUN_->Fill(iEvent.id().run());
470 
471  bool PedestalEvent=false;
472 
473  // for local runs
474  edm::Handle<HcalTBTriggerData> trigger_data;
475  iEvent.getByToken(tok_tb_, trigger_data);
476  if(trigger_data.isValid()){
477  if((trigger_data->triggerWord())==5) PedestalEvent=true;
478  LocalRun=true;
479  }
480 
481  if(LocalRun && !PedestalEvent) return;
482 
483  if(!LocalRun && Online_){
484  if(PEDseq_ && (orbit-lastPEDorbit_)>(11223*10) && ievt_>500){
485  PEDseq_=false;
486  fillHistos();
487  CheckStatus();
488  nChecksPED_++;
489  if(nChecksPED_==1 || (nChecksPED_>1 && ((nChecksPED_-1)%12)==0)){
490  SaveReference();
491  }
492  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++)for(int l=0;l<4;l++) hb_data[i][j][k][l].reset();
493  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++)for(int l=0;l<4;l++) he_data[i][j][k][l].reset();
494  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++)for(int l=0;l<4;l++) ho_data[i][j][k][l].reset();
495  for(int i=0;i<85;i++)for(int j=0;j<72;j++)for(int k=0;k<4;k++)for(int l=0;l<4;l++) hf_data[i][j][k][l].reset();
496  ievt_=0;
497  }
498  }
499 
500 
501  // Abort Gap pedestals
502  int calibType = -1 ;
503  if(LocalRun==false){
505  iEvent.getByToken(tok_raw_,rawdata);
506  //checking FEDs for calibration information
508  const FEDRawData& fedData = rawdata->FEDData(i) ;
509  if ( fedData.size() < 24 ) continue ;
510  int value = ((const HcalDCCHeader*)(fedData.data()))->getCalibType() ;
511  if ( calibType < 0 ) calibType = value ;
512  if(value==hc_Pedestal){ PEDseq_=true; lastPEDorbit_=orbit; break;}
513  }
514  }
515  if(!LocalRun && calibType!=hc_Pedestal) return;
516 
517  ievt_++;
518  meEVT_->Fill(ievt_);
519  run_number=iEvent.id().run();
520 
522  iEvent.getByToken(tok_hbhe_,hbhe);
523  if(hbhe.isValid()){
524  if(hbhe->size()<30 && calibType==hc_Pedestal){
525  ievt_--;
526  meEVT_->Fill(ievt_);
527  return;
528  }
529  for(HBHEDigiCollection::const_iterator digi=hbhe->begin();digi!=hbhe->end();digi++){
530  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
531  if(nTS>8) nTS=8;
532  if(nTS<8 && nTS>=4) nTS=4;
533  nTS_HBHE=nTS;
534  if(digi->id().subdet()==HcalBarrel){
535  for(int i=0;i<nTS;i++) hb_data[eta+42][phi-1][depth-1][digi->sample(i).capid()].add_statistics(digi->sample(i).adc());
536  }
537  if(digi->id().subdet()==HcalEndcap){
538  for(int i=0;i<nTS;i++) he_data[eta+42][phi-1][depth-1][digi->sample(i).capid()].add_statistics(digi->sample(i).adc());
539  }
540  }
541  }
543  iEvent.getByToken(tok_ho_,ho);
544  if(ho.isValid()){
545  for(HODigiCollection::const_iterator digi=ho->begin();digi!=ho->end();digi++){
546  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
547  if(nTS>8) nTS=8;
548  if(nTS<8 && nTS>=4) nTS=4;
549  nTS_HO=nTS;
550  for(int i=0;i<nTS;i++) ho_data[eta+42][phi-1][depth-1][digi->sample(i).capid()].add_statistics(digi->sample(i).adc());
551  }
552  }
554  iEvent.getByToken(tok_hf_,hf);
555  if(hf.isValid()){
556  for(HFDigiCollection::const_iterator digi=hf->begin();digi!=hf->end();digi++){
557  eta=digi->id().ieta(); phi=digi->id().iphi(); depth=digi->id().depth(); nTS=digi->size();
558  if(nTS>8) nTS=8;
559  if(nTS<8 && nTS>=4) nTS=4;
560  nTS_HF=nTS;
561  for(int i=0;i<nTS;i++) hf_data[eta+42][phi-1][depth-1][digi->sample(i).capid()].add_statistics(digi->sample(i).adc());
562  }
563  }
564 }
565 
580  Pedestals2DHO->Reset();
581  // HBHEHF summary map
582  for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++){
583  double PED=0,RMS=0,nped=0,nrms=0,ave=0,rms=0;
584  for(int depth=1;depth<=3;depth++){
585  if(hb_data[eta+42][phi-1][depth-1][0].get_statistics()>100){
586  hb_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
587  hb_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
588  hb_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
589  hb_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
590  }
591  if(he_data[eta+42][phi-1][depth-1][0].get_statistics()>100){
592  he_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
593  he_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
594  he_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
595  he_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
596  }
597  if(hf_data[eta+42][phi-1][depth-1][0].get_statistics()>100){
598  hf_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
599  hf_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
600  hf_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
601  hf_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
602  }
603  }
604  if(nped>0) Pedestals2DHBHEHF->Fill(eta,phi,PED/nped);
605  if(nrms>0) Pedestals2DRmsHBHEHF->Fill(eta,phi,RMS/nrms);
606  if(nped>0 && abs(eta)>20) Pedestals2DHBHEHF->Fill(eta,phi+1,PED/nped);
607  if(nrms>0 && abs(eta)>20) Pedestals2DRmsHBHEHF->Fill(eta,phi+1,RMS/nrms);
608  }
609  // HO summary map
610  for(int eta=-10;eta<=15;eta++) for(int phi=1;phi<=72;phi++){
611  if(eta>10 && !isSiPM(eta,phi,4)) continue;
612  double PED=0,RMS=0,nped=0,nrms=0,ave=0,rms=0;
613  if(ho_data[eta+42][phi-1][4-1][0].get_statistics()>100){
614  ho_data[eta+42][phi-1][4-1][0].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
615  ho_data[eta+42][phi-1][4-1][1].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
616  ho_data[eta+42][phi-1][4-1][2].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
617  ho_data[eta+42][phi-1][4-1][3].get_average(&ave,&rms); PED+=ave; nped++; RMS+=rms; nrms++;
618  }
619  if(nped>0) Pedestals2DHO->Fill(eta,phi,PED/nped);
620  if(nrms>0) Pedestals2DRmsHO->Fill(eta,phi,RMS/nrms);
621  }
622  // HB histograms
623  for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
624  if(hb_data[eta+42][phi-1][depth-1][0].get_statistics()>100){
625  double ave=0,rms=0,sum=0;
626  hb_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); sum+=ave; PedestalsRmsHB->Fill(rms);
627  hb_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); sum+=ave; PedestalsRmsHB->Fill(rms);
628  hb_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); sum+=ave; PedestalsRmsHB->Fill(rms);
629  hb_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); sum+=ave; PedestalsRmsHB->Fill(rms);
630  PedestalsAve4HB->Fill(sum/4.0);
631  }
632  }
633  // HE histograms
634  for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=3;depth++){
635  if(he_data[eta+42][phi-1][depth-1][0].get_statistics()>100){
636  double ave=0,rms=0,sum=0;
637  he_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); sum+=ave; PedestalsRmsHE->Fill(rms);
638  he_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); sum+=ave; PedestalsRmsHE->Fill(rms);
639  he_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); sum+=ave; PedestalsRmsHE->Fill(rms);
640  he_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); sum+=ave; PedestalsRmsHE->Fill(rms);
641  PedestalsAve4HE->Fill(sum/4.0);
642  }
643  }
644  // HO histograms
645  for(int eta=-10;eta<=15;eta++) for(int phi=1;phi<=72;phi++) for(int depth=4;depth<=4;depth++){
646  if(eta>10 && !isSiPM(eta,phi,4)) continue;
647  if(ho_data[eta+42][phi-1][depth-1][0].get_statistics()>100){
648  double ave=0,rms=0,sum=0;
649  if((eta>=11 && eta<=15 && phi>=59 && phi<=70) || (eta>=5 && eta<=10 && phi>=47 && phi<=58)){
650  ho_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); sum+=ave; PedestalsRmsSimp->Fill(rms);
651  ho_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); sum+=ave; PedestalsRmsSimp->Fill(rms);
652  ho_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); sum+=ave; PedestalsRmsSimp->Fill(rms);
653  ho_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); sum+=ave; PedestalsRmsSimp->Fill(rms);
654  PedestalsAve4Simp->Fill(sum/4.0);
655  }else{
656  ho_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); sum+=ave; PedestalsRmsHO->Fill(rms);
657  ho_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); sum+=ave; PedestalsRmsHO->Fill(rms);
658  ho_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); sum+=ave; PedestalsRmsHO->Fill(rms);
659  ho_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); sum+=ave; PedestalsRmsHO->Fill(rms);
660  PedestalsAve4HO->Fill(sum/4.0);
661  }
662  }
663  }
664  // HF histograms
665  for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
666  if(hf_data[eta+42][phi-1][depth-1][0].get_statistics()>100){
667  double ave=0,rms=0,sum=0;
668  hf_data[eta+42][phi-1][depth-1][0].get_average(&ave,&rms); sum+=ave; PedestalsRmsHF->Fill(rms);
669  hf_data[eta+42][phi-1][depth-1][1].get_average(&ave,&rms); sum+=ave; PedestalsRmsHF->Fill(rms);
670  hf_data[eta+42][phi-1][depth-1][2].get_average(&ave,&rms); sum+=ave; PedestalsRmsHF->Fill(rms);
671  hf_data[eta+42][phi-1][depth-1][3].get_average(&ave,&rms); sum+=ave; PedestalsRmsHF->Fill(rms);
672  PedestalsAve4HF->Fill(sum/4.0);
673  }
674  }
675 }
677  for(int i=0;i<4;i++){
682  }
691 
694 
695  if(emap==0) return;
696 
697  std::vector <HcalElectronicsId> AllElIds = emap->allElectronicsIdPrecision();
698  for (std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++) {
699  DetId detid=emap->lookup(*eid);
700  if (detid.det()!=DetId::Hcal) continue;
701  HcalGenericDetId gid(emap->lookup(*eid));
702  if(!(!(gid.null()) &&
703  (gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
704  gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
705  gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
706  gid.genericSubdet()==HcalGenericDetId::HcalGenOuter))) continue;
707  int eta=0,phi=0,depth=0;
708 
709  HcalDetId hid(detid);
710  if(KnownBadCells_.find(hid.rawId())==KnownBadCells_.end()) continue;
711 
712  eta=hid.ieta();
713  phi=hid.iphi();
714  depth=hid.depth();
715  int sd=detid.subdetId();
716 
717  if(sd==HcalBarrel){
718  int ovf=hb_data[eta+42][phi-1][depth-1][0].get_overflow();
719  int stat=hb_data[eta+42][phi-1][depth-1][0].get_statistics()+ovf;
720  double status=0;
721  double ped[4],rms[4],ped_ref[4],rms_ref[4];
722  hb_data[eta+42][phi-1][depth-1][0].nChecks++;
723  if(stat==0){
724  status=1;
725  int e=CalcEtaBin(sd,eta,depth)+1;
726  hb_data[eta+42][phi-1][depth-1][0].nMissing++;
727  double val=hb_data[eta+42][phi-1][depth-1][0].nMissing/hb_data[eta+42][phi-1][depth-1][0].nChecks;
728  ProblemCellsByDepth_missing->depth[depth-1]->setBinContent(e,phi,val);
729  ProblemCellsByDepth_missing_val->depth[depth-1]->setBinContent(e,phi,1);
730  }
731  if(status) hb_data[eta+42][phi-1][depth-1][0].change_status(1);
732  if(stat>0 && stat!=(ievt_*2)){ if(nTS_HBHE==8) status=(double)stat/(double)(ievt_*2); else status=(double)stat/(double)(ievt_);
733  if(status<0.995){
734  int e=CalcEtaBin(sd,eta,depth)+1;
735  hb_data[eta+42][phi-1][depth-1][0].nUnstable++;
736  double val=hb_data[eta+42][phi-1][depth-1][0].nUnstable/hb_data[eta+42][phi-1][depth-1][0].nChecks;
737  ProblemCellsByDepth_unstable->depth[depth-1]->setBinContent(e,phi,val);
738  ProblemCellsByDepth_unstable_val->depth[depth-1]->setBinContent(e,phi,status);
739  hb_data[eta+42][phi-1][depth-1][0].change_status(2);
740  }
741  }
742  if(hb_data[eta+42][phi-1][depth-1][0].get_reference(&ped_ref[0],&rms_ref[0])
743  && hb_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0])){
744  hb_data[eta+42][phi-1][depth-1][1].get_reference(&ped_ref[1],&rms_ref[1]);
745  hb_data[eta+42][phi-1][depth-1][2].get_reference(&ped_ref[2],&rms_ref[2]);
746  hb_data[eta+42][phi-1][depth-1][3].get_reference(&ped_ref[3],&rms_ref[3]);
747  hb_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
748  hb_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
749  hb_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
750  double ave=(ped[0]+ped[1]+ped[2]+ped[3])/4.0;
751  double ave_ref=(ped_ref[0]+ped_ref[1]+ped_ref[2]+ped_ref[3])/4.0;
752  double deltaPed=ave-ave_ref; PedestalsAve4HBref->Fill(deltaPed); if(deltaPed<0) deltaPed=-deltaPed;
753  double deltaRms=rms[0]-rms_ref[0]; PedestalsRmsHBref->Fill(deltaRms); if(deltaRms<0) deltaRms=-deltaRms;
754  for(int i=1;i<4;i++){
755  double tmp=rms[i]-rms_ref[i]; PedestalsRmsHBref->Fill(tmp);
756  if(fabs(tmp)>fabs(deltaRms)) deltaRms=tmp;
757  }
758  if(deltaPed>HBMeanTreshold){
759  int e=CalcEtaBin(sd,eta,depth)+1;
760  hb_data[eta+42][phi-1][depth-1][0].nBadPed++;
761  double val=hb_data[eta+42][phi-1][depth-1][0].nBadPed/hb_data[eta+42][phi-1][depth-1][0].nChecks;
762  ProblemCellsByDepth_badped_val->depth[depth-1]->setBinContent(e,phi,ave-ave_ref);
763  ProblemCellsByDepth_badped->depth[depth-1]->setBinContent(e,phi,val);
765  }
766  if(deltaRms>HBRmsTreshold){
767  int e=CalcEtaBin(sd,eta,depth)+1;
768  hb_data[eta+42][phi-1][depth-1][0].nBadRms++;
769  double val=hb_data[eta+42][phi-1][depth-1][0].nBadRms/hb_data[eta+42][phi-1][depth-1][0].nChecks;
770  ProblemCellsByDepth_badrms->depth[depth-1]->setBinContent(e,phi,val);
771  ProblemCellsByDepth_badrms_val->depth[depth-1]->setBinContent(e,phi,deltaRms);
773  }
774  }
775  }
776  if(sd==HcalEndcap){
777  int ovf=he_data[eta+42][phi-1][depth-1][0].get_overflow();
778  int stat=he_data[eta+42][phi-1][depth-1][0].get_statistics()+ovf;
779  double status=0;
780  double ped[4],rms[4],ped_ref[4],rms_ref[4];
781  he_data[eta+42][phi-1][depth-1][0].nChecks++;
782  if(stat==0){
783  status=1;
784  int e=CalcEtaBin(sd,eta,depth)+1;
785  he_data[eta+42][phi-1][depth-1][0].nMissing++;
786  double val=he_data[eta+42][phi-1][depth-1][0].nMissing/he_data[eta+42][phi-1][depth-1][0].nChecks;
787  ProblemCellsByDepth_missing->depth[depth-1]->setBinContent(e,phi,val);
788  ProblemCellsByDepth_missing_val->depth[depth-1]->setBinContent(e,phi,1);
789  }
790  if(status) he_data[eta+42][phi-1][depth-1][0].change_status(1);
791  if(stat>0 && stat!=(ievt_*2)){ if(nTS_HBHE==8) status=(double)stat/(double)(ievt_*2); else status=(double)stat/(double)(ievt_);
792  if(status<0.995){
793  int e=CalcEtaBin(sd,eta,depth)+1;
794  he_data[eta+42][phi-1][depth-1][0].nUnstable++;
795  double val=he_data[eta+42][phi-1][depth-1][0].nUnstable/he_data[eta+42][phi-1][depth-1][0].nChecks;
796  ProblemCellsByDepth_unstable->depth[depth-1]->setBinContent(e,phi,val);
797  ProblemCellsByDepth_unstable_val->depth[depth-1]->setBinContent(e,phi,status);
798  he_data[eta+42][phi-1][depth-1][0].change_status(2);
799  }
800  }
801  if(he_data[eta+42][phi-1][depth-1][0].get_reference(&ped_ref[0],&rms_ref[0])
802  && he_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0])){
803  he_data[eta+42][phi-1][depth-1][1].get_reference(&ped_ref[1],&rms_ref[1]);
804  he_data[eta+42][phi-1][depth-1][2].get_reference(&ped_ref[2],&rms_ref[2]);
805  he_data[eta+42][phi-1][depth-1][3].get_reference(&ped_ref[3],&rms_ref[3]);
806  he_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
807  he_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
808  he_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
809  double ave=(ped[0]+ped[1]+ped[2]+ped[3])/4.0;
810  double ave_ref=(ped_ref[0]+ped_ref[1]+ped_ref[2]+ped_ref[3])/4.0;
811  double deltaPed=ave-ave_ref; PedestalsAve4HEref->Fill(deltaPed); if(deltaPed<0) deltaPed=-deltaPed;
812  double deltaRms=rms[0]-rms_ref[0]; PedestalsRmsHEref->Fill(deltaRms); if(deltaRms<0) deltaRms=-deltaRms;
813  for(int i=1;i<4;i++){
814  double tmp=rms[i]-rms_ref[i]; PedestalsRmsHEref->Fill(tmp);
815  if(fabs(tmp)>fabs(deltaRms)) deltaRms=tmp;
816  }
817  if(deltaPed>HEMeanTreshold){
818  int e=CalcEtaBin(sd,eta,depth)+1;
819  he_data[eta+42][phi-1][depth-1][0].nBadPed++;
820  double val=he_data[eta+42][phi-1][depth-1][0].nBadPed/he_data[eta+42][phi-1][depth-1][0].nChecks;
821  ProblemCellsByDepth_badped->depth[depth-1]->setBinContent(e,phi,val);
822  ProblemCellsByDepth_badped_val->depth[depth-1]->setBinContent(e,phi,ave-ave_ref);
824  }
825  if(deltaRms>HERmsTreshold){
826  int e=CalcEtaBin(sd,eta,depth)+1;
827  he_data[eta+42][phi-1][depth-1][0].nBadRms++;
828  double val=he_data[eta+42][phi-1][depth-1][0].nBadRms/he_data[eta+42][phi-1][depth-1][0].nChecks;
829  ProblemCellsByDepth_badrms->depth[depth-1]->setBinContent(e,phi,val);
830  ProblemCellsByDepth_badrms_val->depth[depth-1]->setBinContent(e,phi,deltaRms);
832  }
833  }
834  }
835  if(sd==HcalOuter){
836  int ovf=ho_data[eta+42][phi-1][depth-1][0].get_overflow();
837  int stat=ho_data[eta+42][phi-1][depth-1][0].get_statistics()+ovf;
838  double status=0;
839  double ped[4],rms[4],ped_ref[4],rms_ref[4];
840  ho_data[eta+42][phi-1][depth-1][0].nChecks++;
841  if(stat==0){
842  status=1;
843  int e=CalcEtaBin(sd,eta,depth)+1;
844  ho_data[eta+42][phi-1][depth-1][0].nMissing++;
845  double val=ho_data[eta+42][phi-1][depth-1][0].nMissing/ho_data[eta+42][phi-1][depth-1][0].nChecks;
846  ProblemCellsByDepth_missing->depth[depth-1]->setBinContent(e,phi,val);
847  ProblemCellsByDepth_missing_val->depth[depth-1]->setBinContent(e,phi,1);
848  }
849  if(status) ho_data[eta+42][phi-1][depth-1][0].change_status(1);
850  if(stat>0 && stat!=(ievt_*2)){ if(nTS_HO==8) status=(double)stat/(double)(ievt_*2); else status=(double)stat/(double)(ievt_);
851  if(status<0.995){
852  int e=CalcEtaBin(sd,eta,depth)+1;
853  ho_data[eta+42][phi-1][depth-1][0].nUnstable++;
854  double val=ho_data[eta+42][phi-1][depth-1][0].nUnstable/ho_data[eta+42][phi-1][depth-1][0].nChecks;
855  ProblemCellsByDepth_unstable->depth[depth-1]->setBinContent(e,phi,val);
856  ProblemCellsByDepth_unstable_val->depth[depth-1]->setBinContent(e,phi,status);
857  ho_data[eta+42][phi-1][depth-1][0].change_status(2);
858  }
859  }
860  if(ho_data[eta+42][phi-1][depth-1][0].get_reference(&ped_ref[0],&rms_ref[0])
861  && ho_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0])){
862  ho_data[eta+42][phi-1][depth-1][1].get_reference(&ped_ref[1],&rms_ref[1]);
863  ho_data[eta+42][phi-1][depth-1][2].get_reference(&ped_ref[2],&rms_ref[2]);
864  ho_data[eta+42][phi-1][depth-1][3].get_reference(&ped_ref[3],&rms_ref[3]);
865  ho_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
866  ho_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
867  ho_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
868 
869  double THRESTHOLD=HORmsTreshold;
870  if((eta>=11 && eta<=15 && phi>=59 && phi<=70) || (eta>=5 && eta<=10 && phi>=47 && phi<=58))THRESTHOLD*=2;
871  double ave=(ped[0]+ped[1]+ped[2]+ped[3])/4.0;
872  double ave_ref=(ped_ref[0]+ped_ref[1]+ped_ref[2]+ped_ref[3])/4.0;
873  double deltaPed=ave-ave_ref; PedestalsAve4HOref->Fill(deltaPed);if(deltaPed<0) deltaPed=-deltaPed;
874  double deltaRms=rms[0]-rms_ref[0]; PedestalsRmsHOref->Fill(deltaRms); if(deltaRms<0) deltaRms=-deltaRms;
875  for(int i=1;i<4;i++){
876  double tmp=rms[i]-rms_ref[i]; PedestalsRmsHOref->Fill(tmp);
877  if(fabs(tmp)>fabs(deltaRms)) deltaRms=tmp;
878  }
879  if(deltaPed>HOMeanTreshold){
880  int e=CalcEtaBin(sd,eta,depth)+1;
881  ho_data[eta+42][phi-1][depth-1][0].nBadPed++;
882  double val=ho_data[eta+42][phi-1][depth-1][0].nBadPed/ho_data[eta+42][phi-1][depth-1][0].nChecks;
883  ProblemCellsByDepth_badped->depth[depth-1]->setBinContent(e,phi,val);
884  ProblemCellsByDepth_badped_val->depth[depth-1]->setBinContent(e,phi,ave-ave_ref);
885  Pedestals2DErrorHO->Fill(eta,phi,1);
886  }
887  if(deltaRms>THRESTHOLD){
888  int e=CalcEtaBin(sd,eta,depth)+1;
889  ho_data[eta+42][phi-1][depth-1][0].nBadRms++;
890  double val=ho_data[eta+42][phi-1][depth-1][0].nBadRms/ho_data[eta+42][phi-1][depth-1][0].nChecks;
891  ProblemCellsByDepth_badrms->depth[depth-1]->setBinContent(e,phi,val);
892  ProblemCellsByDepth_badrms_val->depth[depth-1]->setBinContent(e,phi,deltaRms);
893  Pedestals2DErrorHO->Fill(eta,phi,1);
894  }
895  }
896  }
897  if(sd==HcalForward){
898  int ovf=hf_data[eta+42][phi-1][depth-1][0].get_overflow();
899  int stat=hf_data[eta+42][phi-1][depth-1][0].get_statistics()+ovf;
900  double status=0;
901  double ped[4],rms[4],ped_ref[4],rms_ref[4];
902  hf_data[eta+42][phi-1][depth-1][0].nChecks++;
903  if(stat==0){
904  status=1;
905  int e=CalcEtaBin(sd,eta,depth)+1;
906  hf_data[eta+42][phi-1][depth-1][0].nMissing++;
907  double val=hf_data[eta+42][phi-1][depth-1][0].nMissing/hf_data[eta+42][phi-1][depth-1][0].nChecks;
908  ProblemCellsByDepth_missing->depth[depth-1]->setBinContent(e,phi,val);
909  ProblemCellsByDepth_missing_val->depth[depth-1]->setBinContent(e,phi,1);
910  }
911  if(status) hf_data[eta+42][phi-1][depth-1][0].change_status(1);
912  if(stat>0 && stat!=(ievt_*2)){ if(nTS_HF==8) status=(double)stat/(double)(ievt_*2); else status=(double)stat/(double)(ievt_);
913  if(status<0.995){
914  int e=CalcEtaBin(sd,eta,depth)+1;
915  hf_data[eta+42][phi-1][depth-1][0].nUnstable++;
916  double val=hf_data[eta+42][phi-1][depth-1][0].nUnstable/hf_data[eta+42][phi-1][depth-1][0].nChecks;
917  ProblemCellsByDepth_unstable->depth[depth-1]->setBinContent(e,phi,val);
918  ProblemCellsByDepth_unstable_val->depth[depth-1]->setBinContent(e,phi,status);
919  hf_data[eta+42][phi-1][depth-1][0].change_status(2);
920  }
921  }
922  if(hf_data[eta+42][phi-1][depth-1][0].get_reference(&ped_ref[0],&rms_ref[0])
923  && hf_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0])){
924  hf_data[eta+42][phi-1][depth-1][1].get_reference(&ped_ref[1],&rms_ref[1]);
925  hf_data[eta+42][phi-1][depth-1][2].get_reference(&ped_ref[2],&rms_ref[2]);
926  hf_data[eta+42][phi-1][depth-1][3].get_reference(&ped_ref[3],&rms_ref[3]);
927  hf_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
928  hf_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
929  hf_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
930  double ave=(ped[0]+ped[1]+ped[2]+ped[3])/4.0;
931  double ave_ref=(ped_ref[0]+ped_ref[1]+ped_ref[2]+ped_ref[3])/4.0;
932  double deltaPed=ave-ave_ref; PedestalsAve4HFref->Fill(deltaPed); if(deltaPed<0) deltaPed=-deltaPed;
933  double deltaRms=rms[0]-rms_ref[0]; PedestalsRmsHFref->Fill(deltaRms); if(deltaRms<0) deltaRms=-deltaRms;
934  for(int i=1;i<4;i++){
935  double tmp=rms[i]-rms_ref[i]; PedestalsRmsHFref->Fill(tmp);
936  if(fabs(tmp)>fabs(deltaRms)) deltaRms=tmp;
937  }
938  if(deltaPed>HFMeanTreshold){
939  int e=CalcEtaBin(sd,eta,depth)+1;
940  hf_data[eta+42][phi-1][depth-1][0].nBadPed++;
941  double val=hf_data[eta+42][phi-1][depth-1][0].nBadPed/hf_data[eta+42][phi-1][depth-1][0].nChecks;
942  ProblemCellsByDepth_badped->depth[depth-1]->setBinContent(e,phi,val);
943  ProblemCellsByDepth_badped_val->depth[depth-1]->setBinContent(e,phi,ave-ave_ref);
945  }
946  if(deltaRms>HFRmsTreshold){
947  int e=CalcEtaBin(sd,eta,depth)+1;
948  hf_data[eta+42][phi-1][depth-1][0].nBadRms++;
949  double val=hf_data[eta+42][phi-1][depth-1][0].nBadRms/hf_data[eta+42][phi-1][depth-1][0].nChecks;
950  ProblemCellsByDepth_badrms->depth[depth-1]->setBinContent(e,phi,val);
951  ProblemCellsByDepth_badrms_val->depth[depth-1]->setBinContent(e,phi,deltaRms);
953  }
954  }
955  }
956  }
957 }
958 
960 
961  if((LocalRun || !Online_ || createHTMLonly) && ievt_>=100){
962  fillHistos();
963  CheckStatus();
964  SaveReference();
965  }
966 }
967 
969 double ped[4],rms[4];
970 int Eta,Phi,Depth,Statistic,Status=0;
971 char Subdet[10],str[500];
972  if(OutputFilePath.size()>0){
973  if(!Overwrite){
974  sprintf(str,"%sHcalDetDiagPedestalData_run%06i_%i.root",OutputFilePath.c_str(),run_number,dataset_seq_number);
975  }else{
976  sprintf(str,"%sHcalDetDiagPedestalData.root",OutputFilePath.c_str());
977  }
978  TFile *theFile = new TFile(str, "RECREATE");
979  if(!theFile->IsOpen()) return;
980  theFile->cd();
981  sprintf(str,"%d",run_number); TObjString run(str); run.Write("run number");
982  sprintf(str,"%d",ievt_); TObjString events(str); events.Write("Total events processed");
983  sprintf(str,"%d",dataset_seq_number); TObjString dsnum(str); dsnum.Write("Dataset number");
984  Long_t t; t=time(0); strftime(str,30,"%F %T",localtime(&t)); TObjString tm(str); tm.Write("Dataset creation time");
985 
986  TTree *tree =new TTree("HCAL Pedestal data","HCAL Pedestal data");
987  if(tree==0) return;
988  tree->Branch("Subdet", &Subdet, "Subdet/C");
989  tree->Branch("eta", &Eta, "Eta/I");
990  tree->Branch("phi", &Phi, "Phi/I");
991  tree->Branch("depth", &Depth, "Depth/I");
992  tree->Branch("statistic",&Statistic, "Statistic/I");
993  tree->Branch("status", &Status, "Status/I");
994  tree->Branch("cap0_ped", &ped[0], "cap0_ped/D");
995  tree->Branch("cap0_rms", &rms[0], "cap0_rms/D");
996  tree->Branch("cap1_ped", &ped[1], "cap1_ped/D");
997  tree->Branch("cap1_rms", &rms[1], "cap1_rms/D");
998  tree->Branch("cap2_ped", &ped[2], "cap2_ped/D");
999  tree->Branch("cap2_rms", &rms[2], "cap2_rms/D");
1000  tree->Branch("cap3_ped", &ped[3], "cap3_ped/D");
1001  tree->Branch("cap3_rms", &rms[3], "cap3_rms/D");
1002  sprintf(Subdet,"HB");
1003  for(int eta=-16;eta<=16;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
1004  if((Statistic=hb_data[eta+42][phi-1][depth-1][0].get_statistics())>100){
1005  Eta=eta; Phi=phi; Depth=depth;
1006  Status=hb_data[eta+42][phi-1][depth-1][0].get_status();
1007  hb_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1008  hb_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1009  hb_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1010  hb_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1011  tree->Fill();
1012  }
1013  }
1014  sprintf(Subdet,"HE");
1015  for(int eta=-29;eta<=29;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=3;depth++){
1016  if((Statistic=he_data[eta+42][phi-1][depth-1][0].get_statistics())>100){
1017  Eta=eta; Phi=phi; Depth=depth;
1018  Status=he_data[eta+42][phi-1][depth-1][0].get_status();
1019  he_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1020  he_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1021  he_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1022  he_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1023  tree->Fill();
1024  }
1025  }
1026  sprintf(Subdet,"HO");
1027  for(int eta=-15;eta<=15;eta++) for(int phi=1;phi<=72;phi++) for(int depth=4;depth<=4;depth++){
1028  if((Statistic=ho_data[eta+42][phi-1][depth-1][0].get_statistics())>100){
1029  Eta=eta; Phi=phi; Depth=depth;
1030  Status=ho_data[eta+42][phi-1][depth-1][0].get_status();
1031  ho_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1032  ho_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1033  ho_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1034  ho_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1035  tree->Fill();
1036  }
1037  }
1038  sprintf(Subdet,"HF");
1039  for(int eta=-42;eta<=42;eta++) for(int phi=1;phi<=72;phi++) for(int depth=1;depth<=2;depth++){
1040  if((Statistic=hf_data[eta+42][phi-1][depth-1][0].get_statistics())>100){
1041  Eta=eta; Phi=phi; Depth=depth;
1042  Status=hf_data[eta+42][phi-1][depth-1][0].get_status();
1043  hf_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1044  hf_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1045  hf_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1046  hf_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1047  tree->Fill();
1048  }
1049  }
1050  theFile->Write();
1051  theFile->Close();
1052  theFile->Delete();
1053  }
1054 
1055  if(XmlFilePath.size()>0){
1056  //create XML file
1057  if(!Overwrite){
1058  sprintf(str,"HcalDetDiagPedestals_%i_%i.xml",run_number,dataset_seq_number);
1059  }else{
1060  sprintf(str,"HcalDetDiagPedestals.xml");
1061  }
1062  printf("%s\n",str);
1063  std::string xmlName=str;
1064  std::ofstream xmlFile;
1065  xmlFile.open(xmlName.c_str());
1066 
1067  xmlFile<<"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n";
1068  xmlFile<<"<ROOT>\n";
1069  xmlFile<<" <HEADER>\n";
1070  xmlFile<<" <HINTS mode='only-det-root'/>\n";
1071  xmlFile<<" <TYPE>\n";
1072  xmlFile<<" <EXTENSION_TABLE_NAME>HCAL_DETMON_PEDESTALS_V1</EXTENSION_TABLE_NAME>\n";
1073  xmlFile<<" <NAME>HCAL Pedestals [abort gap global]</NAME>\n";
1074  xmlFile<<" </TYPE>\n";
1075  xmlFile<<" <!-- run details -->\n";
1076  xmlFile<<" <RUN>\n";
1077  xmlFile<<" <RUN_TYPE>GLOBAL-RUN</RUN_TYPE>\n";
1078  xmlFile<<" <RUN_NUMBER>"<<run_number<<"</RUN_NUMBER>\n";
1079  xmlFile<<" <RUN_BEGIN_TIMESTAMP>2009-01-01 00:00:00</RUN_BEGIN_TIMESTAMP>\n";
1080  xmlFile<<" <COMMENT_DESCRIPTION>hcal ped data</COMMENT_DESCRIPTION>\n";
1081  xmlFile<<" <LOCATION>P5</LOCATION>\n";
1082  xmlFile<<" <INITIATED_BY_USER>dma</INITIATED_BY_USER>\n";
1083  xmlFile<<" </RUN>\n";
1084  xmlFile<<" </HEADER>\n";
1085  xmlFile<<" <DATA_SET>\n";
1086  xmlFile<<" <!-- optional dataset metadata -->\n\n";
1087  xmlFile<<" <SET_NUMBER>"<<dataset_seq_number<<"</SET_NUMBER>\n";
1088  xmlFile<<" <SET_BEGIN_TIMESTAMP>2009-01-01 00:00:00</SET_BEGIN_TIMESTAMP>\n";
1089  xmlFile<<" <SET_END_TIMESTAMP>2009-01-01 00:00:00</SET_END_TIMESTAMP>\n";
1090  xmlFile<<" <NUMBER_OF_EVENTS_IN_SET>"<<ievt_<<"</NUMBER_OF_EVENTS_IN_SET>\n";
1091  xmlFile<<" <COMMENT_DESCRIPTION>Automatic DQM output</COMMENT_DESCRIPTION>\n";
1092  xmlFile<<" <DATA_FILE_NAME>"<< xmlName <<"</DATA_FILE_NAME>\n";
1093  xmlFile<<" <IMAGE_FILE_NAME>data plot url or file path</IMAGE_FILE_NAME>\n";
1094  xmlFile<<" <!-- who and when created this dataset-->\n\n";
1095  Long_t t; t=time(0); strftime(str,30,"%F %T",localtime(&t));
1096  xmlFile<<" <CREATE_TIMESTAMP>"<<str<<"</CREATE_TIMESTAMP>\n";
1097  xmlFile<<" <CREATED_BY_USER>dma</CREATED_BY_USER>\n";
1098  xmlFile<<" <!-- version (string) and subversion (number) -->\n";
1099  xmlFile<<" <!-- fields are used to read data back from the database -->\n\n";
1100  xmlFile<<" <VERSION>"<<run_number<<dataset_seq_number<<"</VERSION>\n";
1101  xmlFile<<" <SUBVERSION>1</SUBVERSION>\n";
1102  xmlFile<<" <!-- Assign predefined dataset attributes -->\n\n";
1103  xmlFile<<" <PREDEFINED_ATTRIBUTES>\n";
1104  xmlFile<<" <ATTRIBUTE>\n";
1105  xmlFile<<" <NAME>HCAL Dataset Status</NAME>\n";
1106  xmlFile<<" <VALUE>VALID</VALUE>\n";
1107  xmlFile<<" </ATTRIBUTE>\n";
1108  xmlFile<<" </PREDEFINED_ATTRIBUTES>\n";
1109  xmlFile<<" <!-- multiple data block records -->\n\n";
1110 
1111  std::vector <HcalElectronicsId> AllElIds = emap->allElectronicsIdPrecision();
1112  for(std::vector <HcalElectronicsId>::iterator eid = AllElIds.begin(); eid != AllElIds.end(); eid++){
1113  DetId detid=emap->lookup(*eid);
1114  if (detid.det()!=DetId::Hcal) continue;
1115  HcalGenericDetId gid(emap->lookup(*eid));
1116  if(!(!(gid.null()) &&
1117  (gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
1118  gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
1119  gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
1120  gid.genericSubdet()==HcalGenericDetId::HcalGenOuter))) continue;
1121  int eta,phi,depth;
1122  std::string subdet="";
1123  HcalDetId hid(detid);
1124  eta=hid.ieta();
1125  phi=hid.iphi();
1126  depth=hid.depth();
1127 
1128  double ped[4]={0,0,0,0},rms[4]={0,0,0,0};
1129  if(detid.subdetId()==HcalBarrel){
1130  subdet="HB";
1131  Statistic=hb_data[eta+42][phi-1][depth-1][0].get_statistics();
1132  Status =hb_data[eta+42][phi-1][depth-1][0].get_status();
1133  hb_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1134  hb_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1135  hb_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1136  hb_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1137  }else if(detid.subdetId()==HcalEndcap){
1138  subdet="HE";
1139  he_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1140  he_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1141  he_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1142  he_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1143  Statistic=he_data[eta+42][phi-1][depth-1][0].get_statistics();
1144  Status =he_data[eta+42][phi-1][depth-1][0].get_status();
1145  }else if(detid.subdetId()==HcalForward){
1146  subdet="HF";
1147  hf_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1148  hf_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1149  hf_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1150  hf_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1151  Statistic=hf_data[eta+42][phi-1][depth-1][0].get_statistics();
1152  Status =hf_data[eta+42][phi-1][depth-1][0].get_status();
1153  }else if(detid.subdetId()==HcalOuter){
1154  subdet="HO";
1155  ho_data[eta+42][phi-1][depth-1][0].get_average(&ped[0],&rms[0]);
1156  ho_data[eta+42][phi-1][depth-1][1].get_average(&ped[1],&rms[1]);
1157  ho_data[eta+42][phi-1][depth-1][2].get_average(&ped[2],&rms[2]);
1158  ho_data[eta+42][phi-1][depth-1][3].get_average(&ped[3],&rms[3]);
1159  Statistic=ho_data[eta+42][phi-1][depth-1][0].get_statistics();
1160  Status =ho_data[eta+42][phi-1][depth-1][0].get_status();
1161  }else continue;
1162  xmlFile<<" <DATA>\n";
1163  xmlFile<<" <NUMBER_OF_EVENTS_USED>"<<Statistic<<"</NUMBER_OF_EVENTS_USED>\n";
1164  xmlFile<<" <MEAN0>"<<ped[0]<<"</MEAN0>\n";
1165  xmlFile<<" <MEAN1>"<<ped[1]<<"</MEAN1>\n";
1166  xmlFile<<" <MEAN2>"<<ped[2]<<"</MEAN2>\n";
1167  xmlFile<<" <MEAN3>"<<ped[3]<<"</MEAN3>\n";
1168  xmlFile<<" <RMS0>"<<rms[0]<<"</RMS0>\n";
1169  xmlFile<<" <RMS1>"<<rms[1]<<"</RMS1>\n";
1170  xmlFile<<" <RMS2>"<<rms[2]<<"</RMS2>\n";
1171  xmlFile<<" <RMS3>"<<rms[3]<<"</RMS3>\n";
1172  xmlFile<<" <CHANNEL_STATUS_WORD>"<<Status<<"</CHANNEL_STATUS_WORD>\n";
1173  xmlFile<<" <CHANNEL_OBJECTNAME>HcalDetId</CHANNEL_OBJECTNAME>\n";
1174  xmlFile<<" <SUBDET>"<<subdet<<"</SUBDET>\n";
1175  xmlFile<<" <IETA>"<<eta<<"</IETA>\n";
1176  xmlFile<<" <IPHI>"<<phi<<"</IPHI>\n";
1177  xmlFile<<" <DEPTH>"<<depth<<"</DEPTH>\n";
1178  xmlFile<<" <TYPE>0</TYPE>\n";
1179  xmlFile<<" </DATA>\n";
1180  }
1182  xmlFile<<" </DATA_SET>\n";
1183  xmlFile<<"</ROOT>\n";
1184  xmlFile.close();
1185  sprintf(str,"zip %s.zip %s",xmlName.c_str(),xmlName.c_str());
1186  system(str);
1187  sprintf(str,"rm -f %s",xmlName.c_str());
1188  system(str);
1189  sprintf(str,"mv -f %s.zip %s",xmlName.c_str(),XmlFilePath.c_str());
1190  system(str);
1191  }
1193 }
1194 
1196  double ped[4],rms[4];
1197  int Eta,Phi,Depth;
1198  char subdet[10];
1199  TFile *f;
1200  if(gSystem->AccessPathName(ReferenceData.c_str())) return;
1201  f = new TFile(ReferenceData.c_str(),"READ");
1202  if(!f->IsOpen()) return ;
1203  TObjString *STR=(TObjString *)f->Get("run number");
1204 
1205  if(STR){ std::string Ref(STR->String()); ReferenceRun=Ref;}
1206 
1207  TTree* t=(TTree*)f->Get("HCAL Pedestal data");
1208  if(!t) return;
1209  t->SetBranchAddress("Subdet", subdet);
1210  t->SetBranchAddress("eta", &Eta);
1211  t->SetBranchAddress("phi", &Phi);
1212  t->SetBranchAddress("depth", &Depth);
1213  t->SetBranchAddress("cap0_ped", &ped[0]);
1214  t->SetBranchAddress("cap0_rms", &rms[0]);
1215  t->SetBranchAddress("cap1_ped", &ped[1]);
1216  t->SetBranchAddress("cap1_rms", &rms[1]);
1217  t->SetBranchAddress("cap2_ped", &ped[2]);
1218  t->SetBranchAddress("cap2_rms", &rms[2]);
1219  t->SetBranchAddress("cap3_ped", &ped[3]);
1220  t->SetBranchAddress("cap3_rms", &rms[3]);
1221  for(int ievt=0;ievt<t->GetEntries();ievt++){
1222  t->GetEntry(ievt);
1223  if(strcmp(subdet,"HB")==0){
1224  hb_data[Eta+42][Phi-1][Depth-1][0].set_reference(ped[0],rms[0]);
1225  hb_data[Eta+42][Phi-1][Depth-1][1].set_reference(ped[1],rms[1]);
1226  hb_data[Eta+42][Phi-1][Depth-1][2].set_reference(ped[2],rms[2]);
1227  hb_data[Eta+42][Phi-1][Depth-1][3].set_reference(ped[3],rms[3]);
1228  }
1229  if(strcmp(subdet,"HE")==0){
1230  he_data[Eta+42][Phi-1][Depth-1][0].set_reference(ped[0],rms[0]);
1231  he_data[Eta+42][Phi-1][Depth-1][1].set_reference(ped[1],rms[1]);
1232  he_data[Eta+42][Phi-1][Depth-1][2].set_reference(ped[2],rms[2]);
1233  he_data[Eta+42][Phi-1][Depth-1][3].set_reference(ped[3],rms[3]);
1234  }
1235  if(strcmp(subdet,"HO")==0){
1236  ho_data[Eta+42][Phi-1][Depth-1][0].set_reference(ped[0],rms[0]);
1237  ho_data[Eta+42][Phi-1][Depth-1][1].set_reference(ped[1],rms[1]);
1238  ho_data[Eta+42][Phi-1][Depth-1][2].set_reference(ped[2],rms[2]);
1239  ho_data[Eta+42][Phi-1][Depth-1][3].set_reference(ped[3],rms[3]);
1240  }
1241  if(strcmp(subdet,"HF")==0){
1242  hf_data[Eta+42][Phi-1][Depth-1][0].set_reference(ped[0],rms[0]);
1243  hf_data[Eta+42][Phi-1][Depth-1][1].set_reference(ped[1],rms[1]);
1244  hf_data[Eta+42][Phi-1][Depth-1][2].set_reference(ped[2],rms[2]);
1245  hf_data[Eta+42][Phi-1][Depth-1][3].set_reference(ped[3],rms[3]);
1246  }
1247  }
1248  f->Close();
1249  f->Delete();
1250  IsReference=true;
1251 }
1252 
1254  double ped[4],rms[4];
1255  int Eta,Phi,Depth,Statistic;
1256  char subdet[10];
1257  TFile *f;
1258  if(DatasetName.size()==0) return;
1259  createHTMLonly=true;
1260  if(gSystem->AccessPathName(DatasetName.c_str())) return;
1261  f = new TFile(DatasetName.c_str(),"READ");
1262  if(!f->IsOpen()) return ;
1263 
1264  TTree* t=0;
1265  t=(TTree*)f->Get("HCAL Pedestal data");
1266  if(!t) return;
1267  t->SetBranchAddress("Subdet", subdet);
1268  t->SetBranchAddress("eta", &Eta);
1269  t->SetBranchAddress("phi", &Phi);
1270  t->SetBranchAddress("depth", &Depth);
1271  t->SetBranchAddress("cap0_ped", &ped[0]);
1272  t->SetBranchAddress("cap0_rms", &rms[0]);
1273  t->SetBranchAddress("cap1_ped", &ped[1]);
1274  t->SetBranchAddress("cap1_rms", &rms[1]);
1275  t->SetBranchAddress("cap2_ped", &ped[2]);
1276  t->SetBranchAddress("cap2_rms", &rms[2]);
1277  t->SetBranchAddress("cap3_ped", &ped[3]);
1278  t->SetBranchAddress("cap3_rms", &rms[3]);
1279  t->SetBranchAddress("statistic",&Statistic);
1280 
1281  for(int ievt=0;ievt<t->GetEntries();ievt++){
1282  t->GetEntry(ievt);
1283  if(strcmp(subdet,"HB")==0){ nHB++;
1284  hb_data[Eta+42][Phi-1][Depth-1][0].set_data(ped[0],rms[0]);
1285  hb_data[Eta+42][Phi-1][Depth-1][1].set_data(ped[1],rms[1]);
1286  hb_data[Eta+42][Phi-1][Depth-1][2].set_data(ped[2],rms[2]);
1287  hb_data[Eta+42][Phi-1][Depth-1][3].set_data(ped[3],rms[3]);
1288  hb_data[Eta+42][Phi-1][Depth-1][0].set_statistics(Statistic);
1289  hb_data[Eta+42][Phi-1][Depth-1][1].set_statistics(Statistic);
1290  hb_data[Eta+42][Phi-1][Depth-1][2].set_statistics(Statistic);
1291  hb_data[Eta+42][Phi-1][Depth-1][3].set_statistics(Statistic);
1292  }
1293  if(strcmp(subdet,"HE")==0){ nHE++;
1294  he_data[Eta+42][Phi-1][Depth-1][0].set_data(ped[0],rms[0]);
1295  he_data[Eta+42][Phi-1][Depth-1][1].set_data(ped[1],rms[1]);
1296  he_data[Eta+42][Phi-1][Depth-1][2].set_data(ped[2],rms[2]);
1297  he_data[Eta+42][Phi-1][Depth-1][3].set_data(ped[3],rms[3]);
1298  he_data[Eta+42][Phi-1][Depth-1][0].set_statistics(Statistic);
1299  he_data[Eta+42][Phi-1][Depth-1][1].set_statistics(Statistic);
1300  he_data[Eta+42][Phi-1][Depth-1][2].set_statistics(Statistic);
1301  he_data[Eta+42][Phi-1][Depth-1][3].set_statistics(Statistic);
1302  }
1303  if(strcmp(subdet,"HO")==0){ nHO++;
1304  ho_data[Eta+42][Phi-1][Depth-1][0].set_data(ped[0],rms[0]);
1305  ho_data[Eta+42][Phi-1][Depth-1][1].set_data(ped[1],rms[1]);
1306  ho_data[Eta+42][Phi-1][Depth-1][2].set_data(ped[2],rms[2]);
1307  ho_data[Eta+42][Phi-1][Depth-1][3].set_data(ped[3],rms[3]);
1308  ho_data[Eta+42][Phi-1][Depth-1][0].set_statistics(Statistic);
1309  ho_data[Eta+42][Phi-1][Depth-1][1].set_statistics(Statistic);
1310  ho_data[Eta+42][Phi-1][Depth-1][2].set_statistics(Statistic);
1311  ho_data[Eta+42][Phi-1][Depth-1][3].set_statistics(Statistic);
1312  }
1313  if(strcmp(subdet,"HF")==0){ nHF++;
1314  hf_data[Eta+42][Phi-1][Depth-1][0].set_data(ped[0],rms[0]);
1315  hf_data[Eta+42][Phi-1][Depth-1][1].set_data(ped[1],rms[1]);
1316  hf_data[Eta+42][Phi-1][Depth-1][2].set_data(ped[2],rms[2]);
1317  hf_data[Eta+42][Phi-1][Depth-1][3].set_data(ped[3],rms[3]);
1318  hf_data[Eta+42][Phi-1][Depth-1][0].set_statistics(Statistic);
1319  hf_data[Eta+42][Phi-1][Depth-1][1].set_statistics(Statistic);
1320  hf_data[Eta+42][Phi-1][Depth-1][2].set_statistics(Statistic);
1321  hf_data[Eta+42][Phi-1][Depth-1][3].set_statistics(Statistic);
1322  }
1323  }
1324  TObjString *STR1=(TObjString *)f->Get("run number");
1325  if(STR1){ int run; sscanf(STR1->String(),"%i",&run); meRUN_->Fill(run); run_number=run;}
1326 
1327  TObjString *STR2=(TObjString *)f->Get("Total events processed");
1328  if(STR2){ int events; sscanf(STR2->String(),"%i",&events); meEVT_->Fill(events); ievt_=events;}
1329 
1330  TObjString *STR3=(TObjString *)f->Get("Dataset number");
1331  if(STR3){ int ds; sscanf(STR3->String(),"%i",&ds); dataset_seq_number=ds;}
1332 
1333  f->Close();
1334  f->Delete();
1335 }
1338 
1339 //define this as a plug-in
RunNumber_t run() const
Definition: EventID.h:39
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int ib
Definition: cuy.py:660
std::vector< HcalElectronicsId > allElectronicsIdPrecision() const
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
std::vector< std::string > problemnames_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
edm::EDGetTokenT< HcalTBTriggerData > tok_tb_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
HcalDetDiagPedestalData ho_data[85][72][4][4]
void bookHistograms(DQMStore::IBooker &ib, const edm::Run &run, const edm::EventSetup &c) override
tuple calibType
Definition: diJetCalib.py:20
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:103
std::vector< HBHEDataFrame >::const_iterator const_iterator
MonitorElement * bookString(Args &&...args)
Definition: DQMStore.h:97
HcalDetDiagPedestalData he_data[85][72][4][4]
bool get_average(double *ave, double *rms)
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::map< unsigned int, int > KnownBadCells_
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
void endRun(const edm::Run &run, const edm::EventSetup &c) override
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
bool get_reference(double *val, double *rms)
bool isSiPM(int ieta, int iphi, int depth)
int depth() const
get the tower depth
Definition: HcalDetId.cc:106
int iEvent
Definition: GenABIO.cc:230
std::vector< MonitorElement * > depth
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
std::vector< DetId > getAllChannels() const
T sqrt(T t)
Definition: SSEVec.h:18
HcalDetDiagPedestalData hb_data[85][72][4][4]
HcalDetDiagPedestalMonitor(const edm::ParameterSet &)
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
double f[11][100]
void setup(DQMStore::IBooker &m_dbe, std::string Name, std::string Units="")
int orbitNumber() const
Definition: EventBase.h:66
void add_statistics(unsigned int val)
bool isValid() const
Definition: HandleBase.h:75
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 iphi() const
get the cell iphi
Definition: HcalDetId.cc:101
Definition: DetId.h:18
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
double sd
const T & get() const
Definition: EventSetup.h:56
Statistic
T const * product() const
Definition: ESHandle.h:86
virtual void reset(void)
bool xmlFile(const std::string fParam)
int CalcEtaBin(int subdet, int ieta, int depth)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
edm::EventID id() const
Definition: EventBase.h:59
void set_reference(float val, float rms)
tuple events
Definition: patZpeak.py:19
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
const JetExtendedData & getValue(const Container &, const reco::JetBaseRef &)
get value for the association. Throw exception if no association found
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
dictionary rawdata
Definition: lumiPlot.py:393
edm::EDGetTokenT< HFDigiCollection > tok_hf_
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
void set_data(float val, float rms)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
virtual void setup(DQMStore::IBooker &)
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
Definition: Run.h:43
tuple status
Definition: mps_update.py:57
HcalDetDiagPedestalData hf_data[85][72][4][4]