CMS 3D CMS Logo

FlavourHistorgrams.h
Go to the documentation of this file.
1 
2 #ifndef FlavourHistograms_H
3 #define FlavourHistograms_H
4 
7 
8 // #include "BTagPlotPrintC.h"
9 
10 #include "TH1F.h"
11 #include "TCanvas.h"
12 #include "TROOT.h"
13 #include "TSystem.h"
14 #include "TStyle.h"
15 #include "TEfficiency.h"
16 
19 #include <iostream>
20 #include <string>
21 
22 //
23 // class to describe Histo
24 //
25 template <class T>
27 public:
30 
31  FlavourHistograms(const std::string& baseNameTitle_,
32  const std::string& baseNameDescription_,
33  const int& nBins_,
34  const double& lowerBound_,
35  const double& upperBound_,
36  const std::string& plotFirst_,
37  const std::string& folder,
38  const unsigned int& mc,
39  DQMStore::IGetter& iget);
40 
41  FlavourHistograms(const std::string& baseNameTitle_,
42  const std::string& baseNameDescription_,
43  const int& nBins_,
44  const double& lowerBound_,
45  const double& upperBound_,
46  const bool& statistics_,
47  const bool& plotLog_,
48  const bool& plotNormalized_,
49  const std::string& plotFirst_,
50  const std::string& folder,
51  const unsigned int& mc,
52  DQMStore::IBooker& ibook);
53 
54  virtual ~FlavourHistograms();
55 
56  // fill entry
57  // For single variables and arrays (for arrays only a single index can be filled)
58  void fill(const int& flavour, const T& variable) const;
59  void fill(const int& flavour, const T& variable, const T& w) const;
60 
61  // For single variables and arrays
62  void fill(const int& flavour, const T* variable) const;
63 
64  void settitle(const char* title);
65 
66  void plot(TPad* theCanvas = nullptr);
67 
68  void epsPlot(const std::string& name);
69 
70  void divide(const FlavourHistograms<T>& bHD);
71  void setEfficiencyFlag();
72 
73  inline void SetMaximum(const double& max) { theMax = max; }
74  inline void SetMinimum(const double& min) { theMin = min; }
75 
76  // trivial access functions
77  inline std::string baseNameTitle() const { return theBaseNameTitle; }
79  inline int nBins() const { return theNBins; }
80  inline double lowerBound() const { return theLowerBound; }
81  inline double upperBound() const { return theUpperBound; }
82  inline bool statistics() const { return theStatistics; }
83  inline bool plotLog() const { return thePlotLog; }
84  inline bool plotNormalized() const { return thePlotNormalized; }
85  inline std::string plotFirst() const { return thePlotFirst; }
86  inline int* arrayDimension() const { return theArrayDimension; }
87  inline int maxDimension() const { return theMaxDimension; }
88  inline int indexToPlot() const { return theIndexToPlot; }
89 
90  // access to the histos
91  inline TH1F* histo_all() const { return theHisto_all->getTH1F(); }
92  inline TH1F* histo_d() const { return theHisto_d->getTH1F(); }
93  inline TH1F* histo_u() const { return theHisto_u->getTH1F(); }
94  inline TH1F* histo_s() const { return theHisto_s->getTH1F(); }
95  inline TH1F* histo_c() const { return theHisto_c->getTH1F(); }
96  inline TH1F* histo_b() const { return theHisto_b->getTH1F(); }
97  inline TH1F* histo_g() const { return theHisto_g->getTH1F(); }
98  inline TH1F* histo_ni() const { return theHisto_ni->getTH1F(); }
99  inline TH1F* histo_dus() const { return theHisto_dus->getTH1F(); }
100  inline TH1F* histo_dusg() const { return theHisto_dusg->getTH1F(); }
101  inline TH1F* histo_pu() const { return theHisto_pu->getTH1F(); }
102 
103  std::vector<TH1F*> getHistoVector() const;
104 
105 protected:
106  void fillVariable(const int& flavour, const T& var, const T& w) const;
107  double ClopperPearsonUnc(double num, double den);
108  void ComputeEfficiency(TH1F* num, TH1F* den, int bin);
109 
110  //
111  // the data members
112  //
113 
114  // T * theVariable ;
115 
116  // for arrays
119  int theIndexToPlot; // in case that not the complete array has to be plotted
120 
123  int theNBins;
129  std::string thePlotFirst; // one character; gives flavour to plot first: l (light) , c , b
130  double theMin, theMax;
131 
132  // the histos
144 
145  // DQMStore * dqmStore_;
146 
147  // the canvas to plot
148  TCanvas* theCanvas;
149 
150 private:
152 
153  unsigned int mcPlots_;
154 };
155 
156 template <class T>
158  const std::string& baseNameDescription_,
159  const int& nBins_,
160  const double& lowerBound_,
161  const double& upperBound_,
162  const std::string& plotFirst_,
163  const std::string& folder,
164  const unsigned int& mc,
165  DQMStore::IGetter& iget)
166  : theMaxDimension(-1),
167  theIndexToPlot(-1),
168  theBaseNameTitle(baseNameTitle_),
169  theBaseNameDescription(baseNameDescription_),
170  theNBins(nBins_),
171  theLowerBound(lowerBound_),
172  theUpperBound(upperBound_),
173  theStatistics(false),
174  thePlotLog(false),
175  thePlotNormalized(false),
176  thePlotFirst(plotFirst_),
177  theMin(-1.),
178  theMax(-1.),
179  mcPlots_(mc) {
180  // defaults for array dimensions
181  theArrayDimension = nullptr;
182 
183  // check plot order string
184  if (thePlotFirst == "l" || thePlotFirst == "c" || thePlotFirst == "b") {
185  // OK
186  } else {
187  // not correct: print warning and set default (l)
188  std::cout << "FlavourHistograms::FlavourHistograms : thePlotFirst was not correct : " << thePlotFirst << std::endl;
189  std::cout << "FlavourHistograms::FlavourHistograms : Set it to default value (l)! " << std::endl;
190  thePlotFirst = "l";
191  }
192 
193  if (mcPlots_ % 2 == 0)
194  theHisto_all = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "ALL");
195  else
196  theHisto_all = nullptr;
197  if (mcPlots_) {
198  if (mcPlots_ > 2) {
199  theHisto_d = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "D");
200  theHisto_u = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "U");
201  theHisto_s = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "S");
202  theHisto_g = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "G");
203  theHisto_dus = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "DUS");
204  } else {
205  theHisto_d = nullptr;
206  theHisto_u = nullptr;
207  theHisto_s = nullptr;
208  theHisto_g = nullptr;
209  theHisto_dus = nullptr;
210  }
211  theHisto_c = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "C");
212  theHisto_b = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "B");
213  theHisto_ni = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "NI");
214  theHisto_dusg = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "DUSG");
215  theHisto_pu = iget.get("Btag/" + folder + "/" + theBaseNameTitle + "PU");
216  } else {
217  theHisto_d = nullptr;
218  theHisto_u = nullptr;
219  theHisto_s = nullptr;
220  theHisto_c = nullptr;
221  theHisto_b = nullptr;
222  theHisto_g = nullptr;
223  theHisto_ni = nullptr;
224  theHisto_dus = nullptr;
225  theHisto_dusg = nullptr;
226  theHisto_pu = nullptr;
227  }
228  // defaults for other data members
229  theCanvas = nullptr;
230 }
231 
232 template <class T>
234  const std::string& baseNameDescription_,
235  const int& nBins_,
236  const double& lowerBound_,
237  const double& upperBound_,
238  const bool& statistics_,
239  const bool& plotLog_,
240  const bool& plotNormalized_,
241  const std::string& plotFirst_,
242  const std::string& folder,
243  const unsigned int& mc,
244  DQMStore::IBooker& ibook)
245  : theMaxDimension(-1),
246  theIndexToPlot(-1),
247  theBaseNameTitle(baseNameTitle_),
248  theBaseNameDescription(baseNameDescription_),
249  theNBins(nBins_),
250  theLowerBound(lowerBound_),
251  theUpperBound(upperBound_),
252  theStatistics(statistics_),
253  thePlotLog(plotLog_),
254  thePlotNormalized(plotNormalized_),
255  thePlotFirst(plotFirst_),
256  theMin(-1.),
257  theMax(-1.),
258  mcPlots_(mc) {
259  // defaults for array dimensions
260  theArrayDimension = nullptr;
261 
262  // check plot order string
263  if (thePlotFirst == "l" || thePlotFirst == "c" || thePlotFirst == "b") {
264  // OK
265  } else {
266  // not correct: print warning and set default (l)
267  std::cout << "FlavourHistograms::FlavourHistograms : thePlotFirst was not correct : " << thePlotFirst << std::endl;
268  std::cout << "FlavourHistograms::FlavourHistograms : Set it to default value (l)! " << std::endl;
269  thePlotFirst = "l";
270  }
271 
272  // book histos
273  HistoProviderDQM prov("Btag", folder, ibook);
274  if (mcPlots_ % 2 == 0)
275  theHisto_all = (prov.book1D(
277  else
278  theHisto_all = nullptr;
279  if (mcPlots_) {
280  if (mcPlots_ > 2) {
281  theHisto_d = (prov.book1D(
283  theHisto_u = (prov.book1D(
285  theHisto_s = (prov.book1D(
287  theHisto_g = (prov.book1D(
289  theHisto_dus = (prov.book1D(
291  } else {
292  theHisto_d = nullptr;
293  theHisto_u = nullptr;
294  theHisto_s = nullptr;
295  theHisto_g = nullptr;
296  theHisto_dus = nullptr;
297  }
298  theHisto_c = (prov.book1D(
300  theHisto_b = (prov.book1D(
302  theHisto_ni = (prov.book1D(
304  theHisto_dusg = (prov.book1D(
306  theHisto_pu = (prov.book1D(
308  } else {
309  theHisto_d = nullptr;
310  theHisto_u = nullptr;
311  theHisto_s = nullptr;
312  theHisto_c = nullptr;
313  theHisto_b = nullptr;
314  theHisto_g = nullptr;
315  theHisto_ni = nullptr;
316  theHisto_dus = nullptr;
317  theHisto_dusg = nullptr;
318  theHisto_pu = nullptr;
319  }
320 
321  // statistics if requested
322  if (theStatistics) {
323  if (theHisto_all)
325  if (mcPlots_) {
326  if (mcPlots_ > 2) {
332  }
338  }
339  }
340  // defaults for other data members
341  theCanvas = nullptr;
342 }
343 
344 template <class T>
346  // delete the canvas*/
347  delete theCanvas;
348 }
349 
350 // fill entry
351 template <class T>
352 void FlavourHistograms<T>::fill(const int& flavour, const T& variable) const {
353  // For single variables and arrays (for arrays only a single index can be filled)
354  fillVariable(flavour, variable, 1.);
355 }
356 
357 template <class T>
358 void FlavourHistograms<T>::fill(const int& flavour, const T& variable, const T& w) const {
359  // For single variables and arrays (for arrays only a single index can be filled)
360  fillVariable(flavour, variable, w);
361 }
362 
363 template <class T>
364 void FlavourHistograms<T>::fill(const int& flavour, const T* variable) const {
365  if (theArrayDimension == 0) {
366  // single variable
367  fillVariable(flavour, *variable, 1.);
368  } else {
369  // array
370  int iMax = (*theArrayDimension > theMaxDimension) ? theMaxDimension : *theArrayDimension;
371  //
372  for (int i = 0; i != iMax; ++i) {
373  // check if only one index to be plotted (<0: switched off -> plot all)
374  if ((theIndexToPlot < 0) || (i == theIndexToPlot)) {
375  fillVariable(flavour, *(variable + i), 1.);
376  }
377  }
378 
379  // if single index to be filled but not enough entries: fill 0.0 (convention!)
380  if (theIndexToPlot >= iMax) {
381  // cout << "==>> The index to be filled is too big -> fill 0.0 : " << theBaseNameTitle << " : " << theIndexToPlot << " >= " << iMax << endl ;
382  const T& theZero = static_cast<T>(0.0);
383  fillVariable(flavour, theZero, 1.);
384  }
385  }
386 }
387 
388 template <class T>
390  if (theHisto_all)
391  theHisto_all->setAxisTitle(title);
392  if (mcPlots_) {
393  if (mcPlots_ > 2) {
394  theHisto_d->setAxisTitle(title);
395  theHisto_u->setAxisTitle(title);
396  theHisto_s->setAxisTitle(title);
397  theHisto_g->setAxisTitle(title);
398  theHisto_dus->setAxisTitle(title);
399  }
400  theHisto_c->setAxisTitle(title);
401  theHisto_b->setAxisTitle(title);
402  theHisto_ni->setAxisTitle(title);
403  theHisto_dusg->setAxisTitle(title);
404  theHisto_pu->setAxisTitle(title);
405  }
406 }
407 
408 template <class T>
409 void FlavourHistograms<T>::plot(TPad* theCanvas /* = 0 */) {
410  //fixme:
411  bool btppNI = false;
412  bool btppColour = true;
413 
414  if (theCanvas)
415  theCanvas->cd();
416 
417  RecoBTag::setTDRStyle()->cd();
418  gPad->UseCurrentStyle();
419  // if ( !btppTitle ) gStyle->SetOptTitle ( 0 ) ;
420  //
421  // // here: plot histograms in a canvas
422  // theCanvas = new TCanvas ( "C" + theBaseNameTitle , "C" + theBaseNameDescription ,
423  // btppXCanvas , btppYCanvas ) ;
424  // theCanvas->SetFillColor ( 0 ) ;
425  // theCanvas->cd ( 1 ) ;
426  gPad->SetLogy(0);
427  if (thePlotLog)
428  gPad->SetLogy(1);
429  gPad->SetGridx(0);
430  gPad->SetGridy(0);
431  gPad->SetTitle(nullptr);
432 
433  MonitorElement* histo[4];
434  int col[4], lineStyle[4], markerStyle[4];
435  int lineWidth = 1;
436 
437  const double markerSize = gPad->GetWh() * gPad->GetHNDC() / 500.;
438 
439  // default (l)
440  histo[0] = theHisto_dusg;
441  //CW histo_1 = theHisto_dus ;
442  histo[1] = theHisto_b;
443  histo[2] = theHisto_c;
444  histo[3] = nullptr;
445 
446  double max = theMax;
447  if (theMax <= 0.) {
448  max = theHisto_dusg->getTH1F()->GetMaximum();
449  if (theHisto_b->getTH1F()->GetMaximum() > max)
450  max = theHisto_b->getTH1F()->GetMaximum();
451  if (theHisto_c->getTH1F()->GetMaximum() > max)
452  max = theHisto_c->getTH1F()->GetMaximum();
453  }
454 
455  if (btppNI) {
456  histo[3] = theHisto_ni;
457  if (theHisto_ni->getTH1F()->GetMaximum() > max)
458  max = theHisto_ni->getTH1F()->GetMaximum();
459  }
460 
461  if (btppColour) { // print colours
462  col[0] = 4;
463  col[1] = 2;
464  col[2] = 6;
465  col[3] = 3;
466  lineStyle[0] = 1;
467  lineStyle[1] = 1;
468  lineStyle[2] = 1;
469  lineStyle[3] = 1;
470  markerStyle[0] = 20;
471  markerStyle[1] = 21;
472  markerStyle[2] = 22;
473  markerStyle[3] = 23;
474  lineWidth = 1;
475  } else { // different marker/line styles
476  col[1] = 1;
477  col[2] = 1;
478  col[3] = 1;
479  col[0] = 1;
480  lineStyle[0] = 2;
481  lineStyle[1] = 1;
482  lineStyle[2] = 3;
483  lineStyle[3] = 4;
484  markerStyle[0] = 20;
485  markerStyle[1] = 21;
486  markerStyle[2] = 22;
487  markerStyle[3] = 23;
488  }
489 
490  // if changing order (NI stays always last)
491 
492  // c to plot first
493  if (thePlotFirst == "c") {
494  histo[0] = theHisto_c;
495  if (btppColour)
496  col[0] = 6;
497  if (!btppColour)
498  lineStyle[0] = 3;
499  histo[2] = theHisto_dusg;
500  if (btppColour)
501  col[2] = 4;
502  if (!btppColour)
503  lineStyle[2] = 2;
504  }
505 
506  // b to plot first
507  if (thePlotFirst == "b") {
508  histo[0] = theHisto_b;
509  if (btppColour)
510  col[0] = 2;
511  if (!btppColour)
512  lineStyle[0] = 1;
513  histo[1] = theHisto_dusg;
514  if (btppColour)
515  col[1] = 4;
516  if (!btppColour)
517  lineStyle[1] = 2;
518  }
519 
520  histo[0]->setAxisTitle(theBaseNameDescription);
521  histo[0]->getTH1F()->GetYaxis()->SetTitle("Arbitrary Units");
522  histo[0]->getTH1F()->GetYaxis()->SetTitleOffset(1.25);
523 
524  for (int i = 0; i != 4; ++i) {
525  if (histo[i] == nullptr)
526  continue;
527  histo[i]->getTH1F()->SetStats(false);
528  histo[i]->getTH1F()->SetLineStyle(lineStyle[i]);
529  histo[i]->getTH1F()->SetLineWidth(lineWidth);
530  histo[i]->getTH1F()->SetLineColor(col[i]);
531  histo[i]->getTH1F()->SetMarkerStyle(markerStyle[i]);
532  histo[i]->getTH1F()->SetMarkerColor(col[i]);
533  histo[i]->getTH1F()->SetMarkerSize(markerSize);
534  }
535 
536  if (thePlotNormalized) {
537  if (histo[0]->getTH1F()->GetEntries() != 0) {
538  histo[0]->getTH1F()->DrawNormalized();
539  } else {
540  histo[0]->getTH1F()->SetMaximum(1.0);
541  histo[0]->getTH1F()->Draw();
542  }
543  if (histo[1]->getTH1F()->GetEntries() != 0)
544  histo[1]->getTH1F()->DrawNormalized("Same");
545  if (histo[2]->getTH1F()->GetEntries() != 0)
546  histo[2]->getTH1F()->DrawNormalized("Same");
547  if ((histo[3] != nullptr) && (histo[3]->getTH1F()->GetEntries() != 0))
548  histo[3]->getTH1F()->DrawNormalized("Same");
549  } else {
550  histo[0]->getTH1F()->SetMaximum(max * 1.05);
551  if (theMin != -1.)
552  histo[0]->getTH1F()->SetMinimum(theMin);
553  histo[0]->getTH1F()->Draw();
554  histo[1]->getTH1F()->Draw("Same");
555  histo[2]->getTH1F()->Draw("Same");
556  if (histo[3] != nullptr)
557  histo[3]->getTH1F()->Draw("Same");
558  }
559 }
560 
561 template <class T>
563  TCanvas tc(theBaseNameTitle.c_str(), theBaseNameDescription.c_str());
564 
565  plot(&tc);
566  tc.Print((name + theBaseNameTitle + ".eps").c_str());
567 }
568 
569 template <class T>
570 double FlavourHistograms<T>::ClopperPearsonUnc(double num, double den) {
571  double effVal = num / den;
572  double errLo = TEfficiency::ClopperPearson(static_cast<int>(den), static_cast<int>(num), 0.683, false);
573  double errUp = TEfficiency::ClopperPearson(static_cast<int>(den), static_cast<int>(num), 0.683, true);
574  return std::max(effVal - errLo, errUp - effVal);
575 }
576 
577 template <class T>
578 void FlavourHistograms<T>::ComputeEfficiency(TH1F* num, TH1F* den, int bin) {
579  double effVal = 1.;
580  double errVal = 0.;
581  double numVal = num->GetBinContent(bin);
582  double denVal = den->GetBinContent(bin);
583  if (denVal > 0 && numVal <= denVal) {
584  effVal = numVal / denVal;
585  errVal = ClopperPearsonUnc(numVal, denVal);
586  }
587  num->SetBinContent(bin, effVal);
588  num->SetBinError(bin, errVal);
589 }
590 
591 template <class T>
593  for (int bin = 0; bin < theNBins + 2; bin++) {
594  if (theHisto_all)
595  ComputeEfficiency(theHisto_all->getTH1F(), bHD.histo_all(), bin);
596  if (mcPlots_) {
597  if (mcPlots_ > 2) {
598  ComputeEfficiency(theHisto_d->getTH1F(), bHD.histo_d(), bin);
599  ComputeEfficiency(theHisto_u->getTH1F(), bHD.histo_u(), bin);
600  ComputeEfficiency(theHisto_s->getTH1F(), bHD.histo_s(), bin);
601  ComputeEfficiency(theHisto_g->getTH1F(), bHD.histo_g(), bin);
602  ComputeEfficiency(theHisto_dus->getTH1F(), bHD.histo_dus(), bin);
603  }
604  ComputeEfficiency(theHisto_c->getTH1F(), bHD.histo_c(), bin);
605  ComputeEfficiency(theHisto_b->getTH1F(), bHD.histo_b(), bin);
606  ComputeEfficiency(theHisto_ni->getTH1F(), bHD.histo_ni(), bin);
607  ComputeEfficiency(theHisto_dusg->getTH1F(), bHD.histo_dusg(), bin);
608  ComputeEfficiency(theHisto_pu->getTH1F(), bHD.histo_pu(), bin);
609  }
610  }
611 }
612 
613 template <class T>
615  if (theHisto_all)
616  theHisto_all->setEfficiencyFlag();
617  if (mcPlots_) {
618  if (mcPlots_ > 2) {
619  theHisto_d->setEfficiencyFlag();
620  theHisto_u->setEfficiencyFlag();
621  theHisto_s->setEfficiencyFlag();
622  theHisto_g->setEfficiencyFlag();
623  theHisto_dus->setEfficiencyFlag();
624  }
625  theHisto_c->setEfficiencyFlag();
626  theHisto_b->setEfficiencyFlag();
627  theHisto_ni->setEfficiencyFlag();
628  theHisto_dusg->setEfficiencyFlag();
629  theHisto_pu->setEfficiencyFlag();
630  }
631 }
632 
633 template <class T>
634 void FlavourHistograms<T>::fillVariable(const int& flavour, const T& var, const T& w) const {
635  // all, except for the Jet Multiplicity which is not filled for each jets but for each events
636  if ((theBaseNameDescription != "Jet Multiplicity" || flavour == -1) && theHisto_all)
637  theHisto_all->Fill(var, w);
638 
639  // flavour specific
640  if (!mcPlots_ || (theBaseNameDescription == "Jet Multiplicity" && flavour == -1))
641  return;
642 
643  switch (flavour) {
644  case 1:
645  if (mcPlots_ > 2) {
646  theHisto_d->Fill(var, w);
647  if (theBaseNameDescription != "Jet Multiplicity")
648  theHisto_dus->Fill(var, w);
649  }
650  if (theBaseNameDescription != "Jet Multiplicity")
651  theHisto_dusg->Fill(var, w);
652  return;
653  case 2:
654  if (mcPlots_ > 2) {
655  theHisto_u->Fill(var, w);
656  if (theBaseNameDescription != "Jet Multiplicity")
657  theHisto_dus->Fill(var, w);
658  }
659  if (theBaseNameDescription != "Jet Multiplicity")
660  theHisto_dusg->Fill(var, w);
661  return;
662  case 3:
663  if (mcPlots_ > 2) {
664  theHisto_s->Fill(var, w);
665  if (theBaseNameDescription != "Jet Multiplicity")
666  theHisto_dus->Fill(var, w);
667  }
668  if (theBaseNameDescription != "Jet Multiplicity")
669  theHisto_dusg->Fill(var, w);
670  return;
671  case 4:
672  theHisto_c->Fill(var, w);
673  return;
674  case 5:
675  theHisto_b->Fill(var, w);
676  return;
677  case 21:
678  if (mcPlots_ > 2)
679  theHisto_g->Fill(var, w);
680  if (theBaseNameDescription != "Jet Multiplicity")
681  theHisto_dusg->Fill(var, w);
682  return;
683  case 123:
684  if (mcPlots_ > 2 && theBaseNameDescription == "Jet Multiplicity")
685  theHisto_dus->Fill(var, w);
686  return;
687  case 12321:
688  if (theBaseNameDescription == "Jet Multiplicity")
689  theHisto_dusg->Fill(var, w);
690  return;
691  case 20:
692  theHisto_pu->Fill(var, w);
693  return;
694  default:
695  theHisto_ni->Fill(var, w);
696  return;
697  }
698 }
699 
700 template <class T>
701 std::vector<TH1F*> FlavourHistograms<T>::getHistoVector() const {
702  std::vector<TH1F*> histoVector;
703  if (theHisto_all)
704  histoVector.push_back(theHisto_all->getTH1F());
705  if (mcPlots_) {
706  if (mcPlots_ > 2) {
707  histoVector.push_back(theHisto_d->getTH1F());
708  histoVector.push_back(theHisto_u->getTH1F());
709  histoVector.push_back(theHisto_s->getTH1F());
710  histoVector.push_back(theHisto_g->getTH1F());
711  histoVector.push_back(theHisto_dus->getTH1F());
712  }
713  histoVector.push_back(theHisto_c->getTH1F());
714  histoVector.push_back(theHisto_b->getTH1F());
715  histoVector.push_back(theHisto_ni->getTH1F());
716  histoVector.push_back(theHisto_dusg->getTH1F());
717  histoVector.push_back(theHisto_pu->getTH1F());
718  }
719  return histoVector;
720 }
721 #endif
FlavourHistograms::SetMinimum
void SetMinimum(const double &min)
Definition: FlavourHistorgrams.h:74
FlavourHistograms::baseNameDescription
std::string baseNameDescription() const
Definition: FlavourHistorgrams.h:78
RecoBTag::setTDRStyle
TStyle * setTDRStyle()
Definition: Tools.cc:343
GenHFHadronMatcher_cff.flavour
flavour
Definition: GenHFHadronMatcher_cff.py:8
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
FlavourHistograms::theHisto_s
MonitorElement * theHisto_s
Definition: FlavourHistorgrams.h:136
funct::false
false
Definition: Factorize.h:29
FlavourHistograms::plotFirst
std::string plotFirst() const
Definition: FlavourHistorgrams.h:85
FlavourHistograms::theHisto_c
MonitorElement * theHisto_c
Definition: FlavourHistorgrams.h:137
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
FlavourHistograms::theHisto_u
MonitorElement * theHisto_u
Definition: FlavourHistorgrams.h:135
FlavourHistograms::histo_ni
TH1F * histo_ni() const
Definition: FlavourHistorgrams.h:98
min
T min(T a, T b)
Definition: MathUtil.h:58
printsummarytable.folder
folder
Definition: printsummarytable.py:7
FlavourHistograms::theArrayDimension
int * theArrayDimension
Definition: FlavourHistorgrams.h:117
FlavourHistograms::ComputeEfficiency
void ComputeEfficiency(TH1F *num, TH1F *den, int bin)
Definition: FlavourHistorgrams.h:578
cuy.col
col
Definition: cuy.py:1010
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FlavourHistograms::theCanvas
TCanvas * theCanvas
Definition: FlavourHistorgrams.h:148
FlavourHistograms::thePlotLog
bool thePlotLog
Definition: FlavourHistorgrams.h:127
FlavourHistograms::theHisto_all
MonitorElement * theHisto_all
Definition: FlavourHistorgrams.h:133
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
FlavourHistograms::histo_g
TH1F * histo_g() const
Definition: FlavourHistorgrams.h:97
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
FlavourHistograms::epsPlot
void epsPlot(const std::string &name)
Definition: FlavourHistorgrams.h:562
FlavourHistograms::histo_pu
TH1F * histo_pu() const
Definition: FlavourHistorgrams.h:101
FlavourHistograms::histo_u
TH1F * histo_u() const
Definition: FlavourHistorgrams.h:93
FlavourHistograms::histo_c
TH1F * histo_c() const
Definition: FlavourHistorgrams.h:95
FlavourHistograms::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: FlavourHistorgrams.h:29
FlavourHistograms::upperBound
double upperBound() const
Definition: FlavourHistorgrams.h:81
plotFactory.plot
plot
Definition: plotFactory.py:109
FlavourHistograms::FlavourHistograms
FlavourHistograms()
Definition: FlavourHistorgrams.h:151
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:478
FlavourHistograms::getHistoVector
std::vector< TH1F * > getHistoVector() const
Definition: FlavourHistorgrams.h:701
FlavourHistograms::baseNameTitle
std::string baseNameTitle() const
Definition: FlavourHistorgrams.h:77
FlavourHistograms::theStatistics
bool theStatistics
Definition: FlavourHistorgrams.h:126
FlavourHistograms::histo_dusg
TH1F * histo_dusg() const
Definition: FlavourHistorgrams.h:100
FlavourHistograms::theMaxDimension
int theMaxDimension
Definition: FlavourHistorgrams.h:118
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
RecoTauValidation_cfi.markerStyle
markerStyle
Definition: RecoTauValidation_cfi.py:302
FlavourHistograms::plotNormalized
bool plotNormalized() const
Definition: FlavourHistorgrams.h:84
FlavourHistograms::theHisto_pu
MonitorElement * theHisto_pu
Definition: FlavourHistorgrams.h:143
FlavourHistograms::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: FlavourHistorgrams.h:28
FlavourHistograms::lowerBound
double lowerBound() const
Definition: FlavourHistorgrams.h:80
dqm::legacy::DQMStore
Definition: DQMStore.h:727
FlavourHistograms::fill
void fill(const int &flavour, const T &variable) const
Definition: FlavourHistorgrams.h:352
FlavourHistograms
Definition: FlavourHistorgrams.h:26
Service.h
w
const double w
Definition: UKUtility.cc:23
RecoTauValidation_cfi.lineStyle
lineStyle
Definition: RecoTauValidation_cfi.py:304
FlavourHistograms::maxDimension
int maxDimension() const
Definition: FlavourHistorgrams.h:87
FlavourHistograms::theMax
double theMax
Definition: FlavourHistorgrams.h:130
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HistoProviderDQM.h
FlavourHistograms::nBins
int nBins() const
Definition: FlavourHistorgrams.h:79
FlavourHistograms::SetMaximum
void SetMaximum(const double &max)
Definition: FlavourHistorgrams.h:73
FlavourHistograms::ClopperPearsonUnc
double ClopperPearsonUnc(double num, double den)
Definition: FlavourHistorgrams.h:570
FlavourHistograms::statistics
bool statistics() const
Definition: FlavourHistorgrams.h:82
FlavourHistograms::histo_dus
TH1F * histo_dus() const
Definition: FlavourHistorgrams.h:99
FlavourHistograms::theBaseNameDescription
std::string theBaseNameDescription
Definition: FlavourHistorgrams.h:122
HistoProviderDQM::book1D
virtual MonitorElement * book1D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX)
Definition: HistoProviderDQM.cc:15
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
FlavourHistograms::settitle
void settitle(const char *title)
Definition: FlavourHistorgrams.h:389
FlavourHistograms::indexToPlot
int indexToPlot() const
Definition: FlavourHistorgrams.h:88
FlavourHistograms::theHisto_dusg
MonitorElement * theHisto_dusg
Definition: FlavourHistorgrams.h:142
FlavourHistograms::theHisto_d
MonitorElement * theHisto_d
Definition: FlavourHistorgrams.h:134
FlavourHistograms::theBaseNameTitle
std::string theBaseNameTitle
Definition: FlavourHistorgrams.h:121
FlavourHistograms::mcPlots_
unsigned int mcPlots_
Definition: FlavourHistorgrams.h:153
RecoTauValidation_cfi.markerSize
markerSize
Definition: RecoTauValidation_cfi.py:301
FlavourHistograms::~FlavourHistograms
virtual ~FlavourHistograms()
Definition: FlavourHistorgrams.h:345
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
FlavourHistograms::theHisto_b
MonitorElement * theHisto_b
Definition: FlavourHistorgrams.h:138
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
FlavourHistograms::histo_s
TH1F * histo_s() const
Definition: FlavourHistorgrams.h:94
RecoTauValidation_cfi.lineWidth
lineWidth
Definition: RecoTauValidation_cfi.py:305
FlavourHistograms::histo_b
TH1F * histo_b() const
Definition: FlavourHistorgrams.h:96
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:33
FlavourHistograms::divide
void divide(const FlavourHistograms< T > &bHD)
Definition: FlavourHistorgrams.h:592
FlavourHistograms::plotLog
bool plotLog() const
Definition: FlavourHistorgrams.h:83
T
long double T
Definition: Basic3DVectorLD.h:48
dqm::implementation::IGetter
Definition: DQMStore.h:484
FlavourHistograms::thePlotFirst
std::string thePlotFirst
Definition: FlavourHistorgrams.h:129
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FlavourHistograms::theHisto_ni
MonitorElement * theHisto_ni
Definition: FlavourHistorgrams.h:140
FlavourHistograms::setEfficiencyFlag
void setEfficiencyFlag()
Definition: FlavourHistorgrams.h:614
dqm::implementation::IBooker
Definition: DQMStore.h:43
FlavourHistograms::theUpperBound
double theUpperBound
Definition: FlavourHistorgrams.h:125
FlavourHistograms::arrayDimension
int * arrayDimension() const
Definition: FlavourHistorgrams.h:86
FlavourHistograms::theHisto_g
MonitorElement * theHisto_g
Definition: FlavourHistorgrams.h:139
HistoProviderDQM
Definition: HistoProviderDQM.h:8
Tools.h
dqm::impl::MonitorElement::enableSumw2
virtual void enableSumw2()
Definition: MonitorElement.cc:872
FlavourHistograms::theMin
double theMin
Definition: FlavourHistorgrams.h:130
FlavourHistograms::histo_d
TH1F * histo_d() const
Definition: FlavourHistorgrams.h:92
FlavourHistograms::theLowerBound
double theLowerBound
Definition: FlavourHistorgrams.h:124
FlavourHistograms::theHisto_dus
MonitorElement * theHisto_dus
Definition: FlavourHistorgrams.h:141
FlavourHistograms::theIndexToPlot
int theIndexToPlot
Definition: FlavourHistorgrams.h:119
FlavourHistograms::fillVariable
void fillVariable(const int &flavour, const T &var, const T &w) const
Definition: FlavourHistorgrams.h:634
FlavourHistograms::plot
void plot(TPad *theCanvas=nullptr)
Definition: FlavourHistorgrams.h:409
FlavourHistograms::theNBins
int theNBins
Definition: FlavourHistorgrams.h:123
FlavourHistograms::thePlotNormalized
bool thePlotNormalized
Definition: FlavourHistorgrams.h:128
FlavourHistograms::histo_all
TH1F * histo_all() const
Definition: FlavourHistorgrams.h:91