CMS 3D CMS Logo

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