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