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