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