CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EffPurFromHistos Class Reference

#include <EffPurFromHistos.h>

Public Member Functions

void compute ()
 
FlavourHistograms< double > * discriminatorCutEfficScan () const
 
FlavourHistograms< double > * discriminatorNoCutEffic () const
 
 EffPurFromHistos (const std::string &ext, TH1F *h_d, TH1F *h_u, TH1F *h_s, TH1F *h_c, TH1F *h_b, TH1F *h_g, TH1F *h_ni, TH1F *h_dus, TH1F *h_dusg, const std::string &label, const unsigned int &mc, int nBin=100, double startO=0.005, double endO=1.005)
 
 EffPurFromHistos (const FlavourHistograms< double > *dDiscriminatorFC, const std::string &label, const unsigned int &mc, int nBin=100, double startO=0.005, double endO=1.005)
 
void epsPlot (const std::string &name)
 
TH1F * getEffFlavVsBEff_b ()
 
TH1F * getEffFlavVsBEff_c ()
 
TH1F * getEffFlavVsBEff_d ()
 
TH1F * getEffFlavVsBEff_dus ()
 
TH1F * getEffFlavVsBEff_dusg ()
 
TH1F * getEffFlavVsBEff_g ()
 
TH1F * getEffFlavVsBEff_ni ()
 
TH1F * getEffFlavVsBEff_s ()
 
TH1F * getEffFlavVsBEff_u ()
 
void plot (TPad *theCanvas=0)
 
void plot (const std::string &name, const std::string &ext)
 
void psPlot (const std::string &name)
 
 ~EffPurFromHistos ()
 

Private Member Functions

void check ()
 

Private Attributes

FlavourHistograms< double > * discrCutEfficScan
 
FlavourHistograms< double > * discrNoCutEffic
 
MonitorElementEffFlavVsBEff_b
 
MonitorElementEffFlavVsBEff_c
 
MonitorElementEffFlavVsBEff_d
 
MonitorElementEffFlavVsBEff_dus
 
MonitorElementEffFlavVsBEff_dusg
 
MonitorElementEffFlavVsBEff_g
 
MonitorElementEffFlavVsBEff_ni
 
MonitorElementEffFlavVsBEff_s
 
MonitorElementEffFlavVsBEff_u
 
TH1F * effVersusDiscr_b
 
TH1F * effVersusDiscr_c
 
TH1F * effVersusDiscr_d
 
TH1F * effVersusDiscr_dus
 
TH1F * effVersusDiscr_dusg
 
TH1F * effVersusDiscr_g
 
TH1F * effVersusDiscr_ni
 
TH1F * effVersusDiscr_s
 
TH1F * effVersusDiscr_u
 
double endOutput
 
bool fromDiscriminatorDistr
 
std::string histoExtension
 
std::string label_
 
unsigned int mcPlots_
 
int nBinOutput
 
double startOutput
 

Detailed Description

Definition at line 14 of file EffPurFromHistos.h.

Constructor & Destructor Documentation

EffPurFromHistos::EffPurFromHistos ( const std::string &  ext,
TH1F *  h_d,
TH1F *  h_u,
TH1F *  h_s,
TH1F *  h_c,
TH1F *  h_b,
TH1F *  h_g,
TH1F *  h_ni,
TH1F *  h_dus,
TH1F *  h_dusg,
const std::string &  label,
const unsigned int &  mc,
int  nBin = 100,
double  startO = 0.005,
double  endO = 1.005 
)

Definition at line 20 of file EffPurFromHistos.cc.

References check().

22  :
23  //BTagPlotPrintC(),
28  effVersusDiscr_dusg(h_dusg), nBinOutput(nBin), startOutput(startO),
29  endOutput(endO), mcPlots_(mc), label_(label)
30 {
31  // consistency check
32  check();
33 }
std::string histoExtension
unsigned int mcPlots_
EffPurFromHistos::EffPurFromHistos ( const FlavourHistograms< double > *  dDiscriminatorFC,
const std::string &  label,
const unsigned int &  mc,
int  nBin = 100,
double  startO = 0.005,
double  endO = 1.005 
)

Definition at line 36 of file EffPurFromHistos.cc.

References FlavourHistograms< T >::baseNameDescription(), FlavourHistograms< T >::baseNameTitle(), FlavourHistograms< T >::divide(), FlavourHistograms< T >::getHistoVector(), FlavourHistograms< T >::histo_b(), FlavourHistograms< T >::histo_c(), FlavourHistograms< T >::histo_d(), FlavourHistograms< T >::histo_dus(), FlavourHistograms< T >::histo_dusg(), FlavourHistograms< T >::histo_g(), FlavourHistograms< T >::histo_ni(), FlavourHistograms< T >::histo_s(), FlavourHistograms< T >::histo_u(), diffTwoXMLs::label, FlavourHistograms< T >::lowerBound(), FlavourHistograms< T >::nBins(), FlavourHistograms< T >::SetMinimum(), mathSSE::sqrt(), and FlavourHistograms< T >::upperBound().

37  :
38  fromDiscriminatorDistr(true), nBinOutput(nBin), startOutput(startO), endOutput(endO), mcPlots_(mc), label_(label){
39  histoExtension = "_"+dDiscriminatorFC->baseNameTitle();
40 
41 
43  "totalEntries" + histoExtension, "Total Entries: " + dDiscriminatorFC->baseNameDescription(),
44  dDiscriminatorFC->nBins(), dDiscriminatorFC->lowerBound(),
45  dDiscriminatorFC->upperBound(), false, true, false, "b", false, label, mcPlots_ );
46 
47  // conditional discriminator cut for efficiency histos
48 
50  "effVsDiscrCut" + histoExtension, "Eff. vs Disc. Cut: " + dDiscriminatorFC->baseNameDescription(),
51  dDiscriminatorFC->nBins(), dDiscriminatorFC->lowerBound(),
52  dDiscriminatorFC->upperBound(), false, true, false, "b", false, label , mcPlots_ );
53  discrCutEfficScan->SetMinimum(1E-4);
54  if (mcPlots_){
55 
56  if(mcPlots_>2){
57  effVersusDiscr_d = discrCutEfficScan->histo_d ();
58  effVersusDiscr_u = discrCutEfficScan->histo_u ();
59  effVersusDiscr_s = discrCutEfficScan->histo_s ();
60  effVersusDiscr_g = discrCutEfficScan->histo_g ();
61  effVersusDiscr_dus = discrCutEfficScan->histo_dus ();
62  }
63  else{
64  effVersusDiscr_d = 0;
65  effVersusDiscr_u = 0;
66  effVersusDiscr_s = 0;
67  effVersusDiscr_g = 0;
69  }
70  effVersusDiscr_c = discrCutEfficScan->histo_c ();
71  effVersusDiscr_b = discrCutEfficScan->histo_b ();
72  effVersusDiscr_ni = discrCutEfficScan->histo_ni ();
73  effVersusDiscr_dusg = discrCutEfficScan->histo_dusg();
74 
75 
76  if(mcPlots_>2){
77  effVersusDiscr_d->SetXTitle ( "Discriminant" );
78  effVersusDiscr_d->GetXaxis()->SetTitleOffset ( 0.75 );
79  effVersusDiscr_u->SetXTitle ( "Discriminant" );
80  effVersusDiscr_u->GetXaxis()->SetTitleOffset ( 0.75 );
81  effVersusDiscr_s->SetXTitle ( "Discriminant" );
82  effVersusDiscr_s->GetXaxis()->SetTitleOffset ( 0.75 );
83  effVersusDiscr_g->SetXTitle ( "Discriminant" );
84  effVersusDiscr_g->GetXaxis()->SetTitleOffset ( 0.75 );
85  effVersusDiscr_dus->SetXTitle ( "Discriminant" );
86  effVersusDiscr_dus->GetXaxis()->SetTitleOffset ( 0.75 );
87  }
88  effVersusDiscr_c->SetXTitle ( "Discriminant" );
89  effVersusDiscr_c->GetXaxis()->SetTitleOffset ( 0.75 );
90  effVersusDiscr_b->SetXTitle ( "Discriminant" );
91  effVersusDiscr_b->GetXaxis()->SetTitleOffset ( 0.75 );
92  effVersusDiscr_ni->SetXTitle ( "Discriminant" );
93  effVersusDiscr_ni->GetXaxis()->SetTitleOffset ( 0.75 );
94  effVersusDiscr_dusg->SetXTitle ( "Discriminant" );
95  effVersusDiscr_dusg->GetXaxis()->SetTitleOffset ( 0.75 );
96  }
97  else{
98  effVersusDiscr_d = 0;
99  effVersusDiscr_u = 0;
100  effVersusDiscr_s = 0;
101  effVersusDiscr_c = 0;
102  effVersusDiscr_b = 0;
103  effVersusDiscr_g = 0;
104  effVersusDiscr_ni = 0;
105  effVersusDiscr_dus = 0;
107  }
108 
109  // discr. for computation
110  vector<TH1F*> discrCfHistos = dDiscriminatorFC->getHistoVector();
111 
112  // discr no cut
113  vector<TH1F*> discrNoCutHistos = discrNoCutEffic->getHistoVector();
114 
115  // discr no cut
116  vector<TH1F*> discrCutHistos = discrCutEfficScan->getHistoVector();
117 
118  const int& dimHistos = discrCfHistos.size(); // they all have the same size
119 
120  // DISCR-CUT LOOP:
121  // fill the histos for eff-pur computations by scanning the discriminatorFC histogram
122 
123  // better to loop over bins -> discrCut no longer needed
124  const int& nBins = dDiscriminatorFC->nBins();
125 
126  // loop over flavours
127  for ( int iFlav = 0; iFlav < dimHistos; iFlav++ ) {
128  if (discrCfHistos[iFlav] == 0) continue;
129  discrNoCutHistos[iFlav]->SetXTitle ( "Discriminant" );
130  discrNoCutHistos[iFlav]->GetXaxis()->SetTitleOffset ( 0.75 );
131 
132  // In Root histos, bin counting starts at 1 to nBins.
133  // bin 0 is the underflow, and nBins+1 is the overflow.
134  const double& nJetsFlav = discrCfHistos[iFlav]->GetEntries ();
135  double sum = discrCfHistos[iFlav]->GetBinContent( nBins+1 ); //+1 to get the overflow.
136 
137  for ( int iDiscr = nBins; iDiscr > 0 ; --iDiscr ) {
138  // fill all jets into NoCut histo
139  discrNoCutHistos[iFlav]->SetBinContent ( iDiscr, nJetsFlav );
140  discrNoCutHistos[iFlav]->SetBinError ( iDiscr, sqrt(nJetsFlav) );
141  sum += discrCfHistos[iFlav]->GetBinContent( iDiscr );
142  discrCutHistos[iFlav]->SetBinContent ( iDiscr, sum );
143  discrCutHistos[iFlav]->SetBinError ( iDiscr, sqrt(sum) );
144  }
145  }
146 
147 
148  // divide to get efficiency vs. discriminator cut from absolute numbers
149  discrCutEfficScan->divide ( *discrNoCutEffic ); // does: histos including discriminator cut / flat histo
150 }
double lowerBound() const
void SetMinimum(const double &min)
TH1F * histo_c() const
FlavourHistograms< double > * discrNoCutEffic
std::string baseNameDescription() const
TH1F * histo_dus() const
std::vector< TH1F * > getHistoVector() const
TH1F * histo_b() const
TH1F * histo_g() const
T sqrt(T t)
Definition: SSEVec.h:48
std::string baseNameTitle() const
TH1F * histo_d() const
FlavourHistograms< double > * discrCutEfficScan
std::string histoExtension
TH1F * histo_s() const
unsigned int mcPlots_
TH1F * histo_ni() const
void divide(const FlavourHistograms< T > &bHD) const
TH1F * histo_u() const
double upperBound() const
TH1F * histo_dusg() const
EffPurFromHistos::~EffPurFromHistos ( )

Definition at line 153 of file EffPurFromHistos.cc.

153  {
154  /* delete EffFlavVsBEff_d ;
155  delete EffFlavVsBEff_u ;
156  delete EffFlavVsBEff_s ;
157  delete EffFlavVsBEff_c ;
158  delete EffFlavVsBEff_b ;
159  delete EffFlavVsBEff_g ;
160  delete EffFlavVsBEff_ni ;
161  delete EffFlavVsBEff_dus ;
162  delete EffFlavVsBEff_dusg;
163  if ( fromDiscriminatorDistr) {
164  delete discrNoCutEffic;
165  delete discrCutEfficScan;
166  }*/
167 }

Member Function Documentation

void EffPurFromHistos::check ( )
private

Definition at line 327 of file EffPurFromHistos.cc.

References effVersusDiscr_b, effVersusDiscr_c, effVersusDiscr_d, effVersusDiscr_dus, effVersusDiscr_dusg, effVersusDiscr_g, effVersusDiscr_ni, effVersusDiscr_s, effVersusDiscr_u, edm::hlt::Exception, and mcPlots_.

Referenced by EffPurFromHistos().

327  {
328  // number of bins
329 
330  int nBins_d = 0;
331  int nBins_u = 0;
332  int nBins_s = 0;
333  int nBins_g = 0;
334  int nBins_dus = 0;
335  if(mcPlots_>2){
336  nBins_d = effVersusDiscr_d -> GetNbinsX();
337  nBins_u = effVersusDiscr_u -> GetNbinsX();
338  nBins_s = effVersusDiscr_s -> GetNbinsX();
339  nBins_g = effVersusDiscr_g -> GetNbinsX();
340  nBins_dus = effVersusDiscr_dus -> GetNbinsX();
341  }
342  const int& nBins_c = effVersusDiscr_c -> GetNbinsX();
343  const int& nBins_b = effVersusDiscr_b -> GetNbinsX();
344  const int& nBins_ni = effVersusDiscr_ni -> GetNbinsX();
345  const int& nBins_dusg = effVersusDiscr_dusg -> GetNbinsX();
346 
347  const bool& lNBins =
348  ( (nBins_d == nBins_u &&
349  nBins_d == nBins_s &&
350  nBins_d == nBins_c &&
351  nBins_d == nBins_b &&
352  nBins_d == nBins_g &&
353  nBins_d == nBins_ni &&
354  nBins_d == nBins_dus &&
355  nBins_d == nBins_dusg)||
356  (nBins_c == nBins_b &&
357  nBins_c == nBins_dusg &&
358  nBins_c == nBins_ni) );
359 
360  if ( !lNBins ) {
361  throw cms::Exception("Configuration")
362  << "Input histograms do not all have the same number of bins!\n";
363  }
364 
365 
366  // start
367  float sBin_d = 0;
368  float sBin_u = 0;
369  float sBin_s = 0;
370  float sBin_g = 0;
371  float sBin_dus = 0;
372  if(mcPlots_>2){
373  sBin_d = effVersusDiscr_d -> GetBinCenter(1);
374  sBin_u = effVersusDiscr_u -> GetBinCenter(1);
375  sBin_s = effVersusDiscr_s -> GetBinCenter(1);
376  sBin_g = effVersusDiscr_g -> GetBinCenter(1);
377  sBin_dus = effVersusDiscr_dus -> GetBinCenter(1);
378  }
379  const float& sBin_c = effVersusDiscr_c -> GetBinCenter(1);
380  const float& sBin_b = effVersusDiscr_b -> GetBinCenter(1);
381  const float& sBin_ni = effVersusDiscr_ni -> GetBinCenter(1);
382  const float& sBin_dusg = effVersusDiscr_dusg -> GetBinCenter(1);
383 
384  const bool& lSBin =
385  ( (sBin_d == sBin_u &&
386  sBin_d == sBin_s &&
387  sBin_d == sBin_c &&
388  sBin_d == sBin_b &&
389  sBin_d == sBin_g &&
390  sBin_d == sBin_ni &&
391  sBin_d == sBin_dus &&
392  sBin_d == sBin_dusg)||
393  (sBin_c == sBin_b &&
394  sBin_c == sBin_dusg &&
395  sBin_c == sBin_ni) );
396 
397  if ( !lSBin ) {
398  throw cms::Exception("Configuration")
399  << "EffPurFromHistos::check() : Input histograms do not all have the same start bin!\n";
400  }
401 
402 
403  // end
404  float eBin_d = 0;
405  float eBin_u = 0;
406  float eBin_s = 0;
407  float eBin_g = 0;
408  float eBin_dus = 0;
409  if(mcPlots_>2){
410  eBin_d = effVersusDiscr_d -> GetBinCenter( nBins_d - 1 );
411  eBin_u = effVersusDiscr_u -> GetBinCenter( nBins_d - 1 );
412  eBin_s = effVersusDiscr_s -> GetBinCenter( nBins_d - 1 );
413  eBin_g = effVersusDiscr_g -> GetBinCenter( nBins_d - 1 );
414  eBin_dus = effVersusDiscr_dus -> GetBinCenter( nBins_d - 1 );
415  }
416  const float& eBin_c = effVersusDiscr_c -> GetBinCenter( nBins_d - 1 );
417  const float& eBin_b = effVersusDiscr_b -> GetBinCenter( nBins_d - 1 );
418  const float& eBin_ni = effVersusDiscr_ni -> GetBinCenter( nBins_d - 1 );
419  const float& eBin_dusg = effVersusDiscr_dusg -> GetBinCenter( nBins_d - 1 );
420 
421  const bool& lEBin =
422  ( (eBin_d == eBin_u &&
423  eBin_d == eBin_s &&
424  eBin_d == eBin_c &&
425  eBin_d == eBin_b &&
426  eBin_d == eBin_g &&
427  eBin_d == eBin_ni &&
428  eBin_d == eBin_dus &&
429  eBin_d == eBin_dusg)||
430  (eBin_c == eBin_b &&
431  eBin_c == eBin_dusg &&
432  eBin_c == eBin_ni) );
433 
434  if ( !lEBin ) {
435  throw cms::Exception("Configuration")
436  << "EffPurFromHistos::check() : Input histograms do not all have the same end bin!\n";
437  }
438 }
unsigned int mcPlots_
void EffPurFromHistos::compute ( )

Definition at line 441 of file EffPurFromHistos.cc.

References HistoProviderDQM::book1D(), EffFlavVsBEff_b, EffFlavVsBEff_c, EffFlavVsBEff_d, EffFlavVsBEff_dus, EffFlavVsBEff_dusg, EffFlavVsBEff_g, EffFlavVsBEff_ni, EffFlavVsBEff_s, EffFlavVsBEff_u, effVersusDiscr_b, effVersusDiscr_c, effVersusDiscr_d, effVersusDiscr_dus, effVersusDiscr_dusg, effVersusDiscr_g, effVersusDiscr_ni, effVersusDiscr_s, effVersusDiscr_u, endOutput, HcalObjRepresent::Fill(), RecoBTag::findBinClosestYValue(), MonitorElement::getTH1F(), histoExtension, label_, mcPlots_, cuy::nBinB, nBinOutput, startOutput, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by JetTagPlotter::finalize().

442 {
443  if (!mcPlots_) {
444 
445  EffFlavVsBEff_d = 0;
446  EffFlavVsBEff_u = 0;
447  EffFlavVsBEff_s = 0;
448  EffFlavVsBEff_c = 0;
449  EffFlavVsBEff_b = 0;
450  EffFlavVsBEff_g = 0;
451  EffFlavVsBEff_ni = 0;
452  EffFlavVsBEff_dus = 0;
453  EffFlavVsBEff_dusg = 0;
454 
455  return;
456 
457  }
458 
459 
460  // to have shorter names ......
461  const std::string & hE = histoExtension;
462  const std::string & hB = "FlavEffVsBEff_";
463 
464 
465  // create histograms from base name and extension as given from user
466  // BINNING MUST BE IDENTICAL FOR ALL OF THEM!!
467  HistoProviderDQM prov("Btag",label_);
468  if(mcPlots_>2){
469  EffFlavVsBEff_d = (prov.book1D ( hB + "D" + hE , hB + "D" + hE , nBinOutput , startOutput , endOutput ));
470  EffFlavVsBEff_u = (prov.book1D ( hB + "U" + hE , hB + "U" + hE , nBinOutput , startOutput , endOutput )) ;
471  EffFlavVsBEff_s = (prov.book1D ( hB + "S" + hE , hB + "S" + hE , nBinOutput , startOutput , endOutput )) ;
472  EffFlavVsBEff_g = (prov.book1D ( hB + "G" + hE , hB + "G" + hE , nBinOutput , startOutput , endOutput )) ;
473  EffFlavVsBEff_dus = (prov.book1D ( hB + "DUS" + hE , hB + "DUS" + hE , nBinOutput , startOutput , endOutput )) ;
474  }
475  else {
476  EffFlavVsBEff_d = 0;
477  EffFlavVsBEff_u = 0;
478  EffFlavVsBEff_s = 0;
479  EffFlavVsBEff_g = 0;
480  EffFlavVsBEff_dus = 0;
481  }
482  EffFlavVsBEff_c = (prov.book1D ( hB + "C" + hE , hB + "C" + hE , nBinOutput , startOutput , endOutput )) ;
483  EffFlavVsBEff_b = (prov.book1D ( hB + "B" + hE , hB + "B" + hE , nBinOutput , startOutput , endOutput )) ;
484  EffFlavVsBEff_ni = (prov.book1D ( hB + "NI" + hE , hB + "NI" + hE , nBinOutput , startOutput , endOutput )) ;
485  EffFlavVsBEff_dusg = (prov.book1D ( hB + "DUSG" + hE , hB + "DUSG" + hE , nBinOutput , startOutput , endOutput )) ;
486 
487  if(mcPlots_>2){
488  EffFlavVsBEff_d->getTH1F()->SetXTitle ( "b-jet efficiency" );
489  EffFlavVsBEff_d->getTH1F()->SetYTitle ( "non b-jet efficiency" );
490  EffFlavVsBEff_d->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
491  EffFlavVsBEff_d->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
492  EffFlavVsBEff_u->getTH1F()->SetXTitle ( "b-jet efficiency" );
493  EffFlavVsBEff_u->getTH1F()->SetYTitle ( "non b-jet efficiency" );
494  EffFlavVsBEff_u->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
495  EffFlavVsBEff_u->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
496  EffFlavVsBEff_s->getTH1F()->SetXTitle ( "b-jet efficiency" );
497  EffFlavVsBEff_s->getTH1F()->SetYTitle ( "non b-jet efficiency" );
498  EffFlavVsBEff_s->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
499  EffFlavVsBEff_s->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
500  EffFlavVsBEff_g->getTH1F()->SetXTitle ( "b-jet efficiency" );
501  EffFlavVsBEff_g->getTH1F()->SetYTitle ( "non b-jet efficiency" );
502  EffFlavVsBEff_g->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
503  EffFlavVsBEff_g->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
504  EffFlavVsBEff_dus->getTH1F()->SetXTitle ( "b-jet efficiency" );
505  EffFlavVsBEff_dus->getTH1F()->SetYTitle ( "non b-jet efficiency" );
506  EffFlavVsBEff_dus->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
507  EffFlavVsBEff_dus->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
508  }
509  EffFlavVsBEff_c->getTH1F()->SetXTitle ( "b-jet efficiency" );
510  EffFlavVsBEff_c->getTH1F()->SetYTitle ( "non b-jet efficiency" );
511  EffFlavVsBEff_c->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
512  EffFlavVsBEff_c->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
513  EffFlavVsBEff_b->getTH1F()->SetXTitle ( "b-jet efficiency" );
514  EffFlavVsBEff_b->getTH1F()->SetYTitle ( "b-jet efficiency" );
515  EffFlavVsBEff_b->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
516  EffFlavVsBEff_b->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
517  EffFlavVsBEff_ni->getTH1F()->SetXTitle ( "b-jet efficiency" );
518  EffFlavVsBEff_ni->getTH1F()->SetYTitle ( "non b-jet efficiency" );
519  EffFlavVsBEff_ni->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
520  EffFlavVsBEff_ni->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
521  EffFlavVsBEff_dusg->getTH1F()->SetXTitle ( "b-jet efficiency" );
522  EffFlavVsBEff_dusg->getTH1F()->SetYTitle ( "non b-jet efficiency" );
523  EffFlavVsBEff_dusg->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
524  EffFlavVsBEff_dusg->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
525 
526 
527  // loop over eff. vs. discriminator cut b-histo and look in which bin the closest entry is;
528  // use fact that eff decreases monotonously
529 
530  // any of the histos to be created can be taken here:
531  MonitorElement * EffFlavVsBEff = EffFlavVsBEff_b;
532 
533  const int& nBinB = EffFlavVsBEff->getTH1F()->GetNbinsX();
534 
535  for ( int iBinB = 1; iBinB <= nBinB; iBinB++ ) { // loop over the bins on the x-axis of the histograms to be filled
536 
537  const float& effBBinWidth = EffFlavVsBEff->getTH1F()->GetBinWidth ( iBinB );
538  const float& effBMid = EffFlavVsBEff->getTH1F()->GetBinCenter ( iBinB ); // middle of b-efficiency bin
539  const float& effBLeft = effBMid - 0.5*effBBinWidth; // left edge of bin
540  const float& effBRight = effBMid + 0.5*effBBinWidth; // right edge of bin
541  // find the corresponding bin in the efficiency versus discriminator cut histo: closest one in efficiency
542  const int& binClosest = findBinClosestYValue ( effVersusDiscr_b , effBMid , effBLeft , effBRight );
543  const bool& binFound = ( binClosest > 0 ) ;
544  //
545  if ( binFound ) {
546  // fill the histos
547  if(mcPlots_>2){
548  EffFlavVsBEff_d -> Fill ( effBMid , effVersusDiscr_d ->GetBinContent ( binClosest ) );
549  EffFlavVsBEff_u -> Fill ( effBMid , effVersusDiscr_u ->GetBinContent ( binClosest ) );
550  EffFlavVsBEff_s -> Fill ( effBMid , effVersusDiscr_s ->GetBinContent ( binClosest ) );
551  EffFlavVsBEff_g -> Fill ( effBMid , effVersusDiscr_g ->GetBinContent ( binClosest ) );
552  EffFlavVsBEff_dus -> Fill ( effBMid , effVersusDiscr_dus ->GetBinContent ( binClosest ) );
553  }
554  EffFlavVsBEff_c -> Fill ( effBMid , effVersusDiscr_c ->GetBinContent ( binClosest ) );
555  EffFlavVsBEff_b -> Fill ( effBMid , effVersusDiscr_b ->GetBinContent ( binClosest ) );
556  EffFlavVsBEff_ni -> Fill ( effBMid , effVersusDiscr_ni ->GetBinContent ( binClosest ) );
557  EffFlavVsBEff_dusg -> Fill ( effBMid , effVersusDiscr_dusg->GetBinContent ( binClosest ) );
558 
559  if(mcPlots_>2){
560  EffFlavVsBEff_d ->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_d ->GetBinError ( binClosest ) );
561  EffFlavVsBEff_u ->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_u ->GetBinError ( binClosest ) );
562  EffFlavVsBEff_s ->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_s ->GetBinError ( binClosest ) );
563  EffFlavVsBEff_g ->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_g ->GetBinError ( binClosest ) );
564  EffFlavVsBEff_dus->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_dus ->GetBinError ( binClosest ) );
565  }
566  EffFlavVsBEff_c ->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_c ->GetBinError ( binClosest ) );
567  EffFlavVsBEff_b ->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_b ->GetBinError ( binClosest ) );
568  EffFlavVsBEff_ni ->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_ni ->GetBinError ( binClosest ) );
569  EffFlavVsBEff_dusg->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_dusg->GetBinError ( binClosest ) );
570  }
571  else {
572  //cout << "Did not find right bin for b-efficiency : " << effBMid << endl;
573  }
574 
575  }
576 
577 }
MonitorElement * EffFlavVsBEff_g
MonitorElement * EffFlavVsBEff_dusg
MonitorElement * EffFlavVsBEff_u
int findBinClosestYValue(const TH1F *, const float &yVal, const float &yLow, const float &yHigh)
Definition: Tools.cc:233
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * EffFlavVsBEff_c
MonitorElement * EffFlavVsBEff_s
std::string histoExtension
TH1F * getTH1F(void) const
MonitorElement * EffFlavVsBEff_d
unsigned int mcPlots_
MonitorElement * EffFlavVsBEff_b
MonitorElement * EffFlavVsBEff_ni
int nBinB
Definition: cuy.py:871
MonitorElement * EffFlavVsBEff_dus
FlavourHistograms<double>* EffPurFromHistos::discriminatorCutEfficScan ( ) const
inline
FlavourHistograms<double>* EffPurFromHistos::discriminatorNoCutEffic ( ) const
inline
void EffPurFromHistos::epsPlot ( const std::string &  name)

Definition at line 172 of file EffPurFromHistos.cc.

References discrCutEfficScan, discrNoCutEffic, FlavourHistograms< T >::epsPlot(), fromDiscriminatorDistr, and plot().

Referenced by JetTagPlotter::epsPlot().

173 {
174  if ( fromDiscriminatorDistr) {
177  }
178  plot(name, ".eps");
179 }
FlavourHistograms< double > * discrNoCutEffic
void epsPlot(const std::string &name)
void plot(TPad *theCanvas=0)
FlavourHistograms< double > * discrCutEfficScan
TH1F* EffPurFromHistos::getEffFlavVsBEff_b ( )
inline

Definition at line 40 of file EffPurFromHistos.h.

References EffFlavVsBEff_b, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

40 { return EffFlavVsBEff_b ->getTH1F() ; };
TH1F * getTH1F(void) const
MonitorElement * EffFlavVsBEff_b
TH1F* EffPurFromHistos::getEffFlavVsBEff_c ( )
inline

Definition at line 39 of file EffPurFromHistos.h.

References EffFlavVsBEff_c, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

39 { return EffFlavVsBEff_c ->getTH1F() ; };
MonitorElement * EffFlavVsBEff_c
TH1F * getTH1F(void) const
TH1F* EffPurFromHistos::getEffFlavVsBEff_d ( )
inline

Definition at line 35 of file EffPurFromHistos.h.

References EffFlavVsBEff_d, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

35  {
36  return EffFlavVsBEff_d->getTH1F() ; };
TH1F * getTH1F(void) const
MonitorElement * EffFlavVsBEff_d
TH1F* EffPurFromHistos::getEffFlavVsBEff_dus ( )
inline

Definition at line 43 of file EffPurFromHistos.h.

References EffFlavVsBEff_dus, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

43 { return EffFlavVsBEff_dus ->getTH1F() ; };
TH1F * getTH1F(void) const
MonitorElement * EffFlavVsBEff_dus
TH1F* EffPurFromHistos::getEffFlavVsBEff_dusg ( )
inline

Definition at line 44 of file EffPurFromHistos.h.

References EffFlavVsBEff_dusg, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

44 { return EffFlavVsBEff_dusg ->getTH1F(); };
MonitorElement * EffFlavVsBEff_dusg
TH1F * getTH1F(void) const
TH1F* EffPurFromHistos::getEffFlavVsBEff_g ( )
inline

Definition at line 41 of file EffPurFromHistos.h.

References EffFlavVsBEff_g, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

41 { return EffFlavVsBEff_g ->getTH1F() ; };
MonitorElement * EffFlavVsBEff_g
TH1F * getTH1F(void) const
TH1F* EffPurFromHistos::getEffFlavVsBEff_ni ( )
inline

Definition at line 42 of file EffPurFromHistos.h.

References EffFlavVsBEff_ni, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

42 { return EffFlavVsBEff_ni ->getTH1F() ; };
TH1F * getTH1F(void) const
MonitorElement * EffFlavVsBEff_ni
TH1F* EffPurFromHistos::getEffFlavVsBEff_s ( )
inline

Definition at line 38 of file EffPurFromHistos.h.

References EffFlavVsBEff_s, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

38 { return EffFlavVsBEff_s ->getTH1F() ; };
MonitorElement * EffFlavVsBEff_s
TH1F * getTH1F(void) const
TH1F* EffPurFromHistos::getEffFlavVsBEff_u ( )
inline

Definition at line 37 of file EffPurFromHistos.h.

References EffFlavVsBEff_u, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

37 { return EffFlavVsBEff_u->getTH1F() ; };
MonitorElement * EffFlavVsBEff_u
TH1F * getTH1F(void) const
void EffPurFromHistos::plot ( TPad *  theCanvas = 0)

Definition at line 194 of file EffPurFromHistos.cc.

References alignCSCRings::e, EffFlavVsBEff_b, EffFlavVsBEff_c, EffFlavVsBEff_d, EffFlavVsBEff_dus, EffFlavVsBEff_dusg, EffFlavVsBEff_g, EffFlavVsBEff_ni, EffFlavVsBEff_s, EffFlavVsBEff_u, MonitorElement::getTH1F(), mcPlots_, and plotscripts::setTDRStyle().

Referenced by cuy.FindIssue::__init__(), epsPlot(), plot(), TrackCountingTagPlotter::psPlot(), TrackIPTagPlotter::psPlot(), TrackProbabilityTagPlotter::psPlot(), JetTagPlotter::psPlot(), and psPlot().

194  {
195 
196 //fixme:
197  bool btppNI = false;
198  bool btppColour = true;
199 
200 // if ( !btppTitle ) gStyle->SetOptTitle ( 0 );
201  setTDRStyle()->cd();
202 
203  if (plotCanvas)
204  plotCanvas->cd();
205 
206  gPad->UseCurrentStyle();
207  gPad->SetFillColor ( 0 );
208  gPad->SetLogy ( 1 );
209  gPad->SetGridx ( 1 );
210  gPad->SetGridy ( 1 );
211 
212  int col_c ;
213  int col_g ;
214  int col_dus;
215  int col_ni ;
216 
217  int mStyle_c ;
218  int mStyle_g ;
219  int mStyle_dus;
220  int mStyle_ni ;
221 
222  // marker size (same for all)
223  float mSize = gPad->GetWh() * gPad->GetHNDC() / 500.; //1.2;
224 
225  if ( btppColour ) {
226  col_c = 6;
227  col_g = 3; // g in green
228  col_dus = 4; // uds in blue
229  col_ni = 5; // ni in ??
230  mStyle_c = 20;
231  mStyle_g = 20;
232  mStyle_dus = 20;
233  mStyle_ni = 20;
234  }
235  else {
236  col_c = 1;
237  col_g = 1;
238  col_dus = 1;
239  col_ni = 1;
240  mStyle_c = 22;
241  mStyle_g = 29;
242  mStyle_dus = 20;
243  mStyle_ni = 27;
244  }
245 
246 
247  // for the moment: plot c,dus,g
248  if(mcPlots_>2){
249  EffFlavVsBEff_dus ->getTH1F()->GetXaxis()->SetTitle ( "b-jet efficiency" );
250  EffFlavVsBEff_dus ->getTH1F()->GetYaxis()->SetTitle ( "non b-jet efficiency" );
251  EffFlavVsBEff_dus ->getTH1F()->GetYaxis()->SetTitleOffset ( 0.25 );
252  EffFlavVsBEff_dus ->getTH1F()->SetMaximum ( 1.1 );
253  EffFlavVsBEff_dus ->getTH1F()->SetMinimum ( 1.e-5 );
254  EffFlavVsBEff_dus ->getTH1F()->SetMarkerColor ( col_dus );
255  EffFlavVsBEff_dus ->getTH1F()->SetLineColor ( col_dus );
256  EffFlavVsBEff_dus ->getTH1F()->SetMarkerSize ( mSize );
257  EffFlavVsBEff_dus ->getTH1F()->SetMarkerStyle ( mStyle_dus );
258  EffFlavVsBEff_dus ->getTH1F()->SetStats ( false );
259  EffFlavVsBEff_dus ->getTH1F()->Draw("pe");
260 
261  EffFlavVsBEff_g ->getTH1F()->SetMarkerColor ( col_g );
262  EffFlavVsBEff_g ->getTH1F()->SetLineColor ( col_g );
263  EffFlavVsBEff_g ->getTH1F()->SetMarkerSize ( mSize );
264  EffFlavVsBEff_g ->getTH1F()->SetMarkerStyle ( mStyle_g );
265  EffFlavVsBEff_g ->getTH1F()->SetStats ( false );
266  EffFlavVsBEff_g ->getTH1F()->Draw("peSame");
267  }
268  EffFlavVsBEff_c ->getTH1F()->SetMarkerColor ( col_c );
269  EffFlavVsBEff_c ->getTH1F()->SetLineColor ( col_c );
270  EffFlavVsBEff_c ->getTH1F()->SetMarkerSize ( mSize );
271  EffFlavVsBEff_c ->getTH1F()->SetMarkerStyle ( mStyle_c );
272  EffFlavVsBEff_c ->getTH1F()->SetStats ( false );
273  EffFlavVsBEff_c ->getTH1F()->Draw("peSame");
274 
275  if(mcPlots_>2){
276  EffFlavVsBEff_d ->getTH1F()-> SetMinimum(0.01);
277  EffFlavVsBEff_u ->getTH1F()-> SetMinimum(0.01);
278  EffFlavVsBEff_s ->getTH1F()-> SetMinimum(0.01);
279  EffFlavVsBEff_g ->getTH1F()-> SetMinimum(0.01);
280  EffFlavVsBEff_dus ->getTH1F()-> SetMinimum(0.01);
281  }
282  EffFlavVsBEff_c ->getTH1F()-> SetMinimum(0.01);
283  EffFlavVsBEff_b ->getTH1F()-> SetMinimum(0.01);
284  EffFlavVsBEff_ni ->getTH1F()-> SetMinimum(0.01);
285  EffFlavVsBEff_dusg ->getTH1F()-> SetMinimum(0.01);
286 
287  // plot separately u,d and s
288 // EffFlavVsBEff_d ->GetXaxis()->SetTitle ( "b-jet efficiency" );
289 // EffFlavVsBEff_d ->GetYaxis()->SetTitle ( "non b-jet efficiency" );
290 // EffFlavVsBEff_d ->GetYaxis()->SetTitleOffset ( 1.25 );
291 // EffFlavVsBEff_d ->SetMaximum ( 1.1 );
292 // EffFlavVsBEff_d ->SetMinimum ( 1.e-5 );
293 // EffFlavVsBEff_d ->SetMarkerColor ( col_dus );
294 // EffFlavVsBEff_d ->SetLineColor ( col_dus );
295 // EffFlavVsBEff_d ->SetMarkerSize ( mSize );
296 // EffFlavVsBEff_d ->SetMarkerStyle ( mStyle_dus );
297 // EffFlavVsBEff_d ->SetStats ( false );
298 // EffFlavVsBEff_d ->Draw("pe");
299 //
300 // EffFlavVsBEff_u ->SetMarkerColor ( col_g );
301 // EffFlavVsBEff_u ->SetLineColor ( col_g );
302 // EffFlavVsBEff_u ->SetMarkerSize ( mSize );
303 // EffFlavVsBEff_u ->SetMarkerStyle ( mStyle_g );
304 // EffFlavVsBEff_u ->SetStats ( false );
305 // EffFlavVsBEff_u ->Draw("peSame");
306 //
307 // EffFlavVsBEff_s ->SetMarkerColor ( col_c );
308 // EffFlavVsBEff_s ->SetLineColor ( col_c );
309 // EffFlavVsBEff_s ->SetMarkerSize ( mSize );
310 // EffFlavVsBEff_s ->SetMarkerStyle ( mStyle_c );
311 // EffFlavVsBEff_s ->SetStats ( false );
312 // EffFlavVsBEff_s ->Draw("peSame");
313 
314  // only if asked: NI
315  if ( btppNI ) {
316  EffFlavVsBEff_ni ->getTH1F()->SetMarkerColor ( col_ni );
317  EffFlavVsBEff_ni ->getTH1F()->SetLineColor ( col_ni );
318  EffFlavVsBEff_ni ->getTH1F()->SetMarkerSize ( mSize );
319  EffFlavVsBEff_ni ->getTH1F()->SetMarkerStyle ( mStyle_ni );
320  EffFlavVsBEff_ni ->getTH1F()->SetStats ( false );
321  EffFlavVsBEff_ni ->getTH1F()->Draw("peSame");
322  }
323 
324 }
MonitorElement * EffFlavVsBEff_g
MonitorElement * EffFlavVsBEff_dusg
def setTDRStyle
Definition: plotscripts.py:87
MonitorElement * EffFlavVsBEff_u
MonitorElement * EffFlavVsBEff_c
MonitorElement * EffFlavVsBEff_s
TH1F * getTH1F(void) const
MonitorElement * EffFlavVsBEff_d
unsigned int mcPlots_
MonitorElement * EffFlavVsBEff_b
MonitorElement * EffFlavVsBEff_ni
MonitorElement * EffFlavVsBEff_dus
void EffPurFromHistos::plot ( const std::string &  name,
const std::string &  ext 
)

Definition at line 186 of file EffPurFromHistos.cc.

References histoExtension, and plot().

Referenced by cuy.FindIssue::__init__().

187 {
188  TCanvas tc (("FlavEffVsBEff" +histoExtension).c_str() ,
189  ("Flavour misidentification vs. b-tagging efficiency " + histoExtension).c_str());
190  plot(&tc);
191  tc.Print((name + "FlavEffVsBEff" + histoExtension + ext).c_str());
192 }
void plot(TPad *theCanvas=0)
std::string histoExtension
void EffPurFromHistos::psPlot ( const std::string &  name)

Definition at line 181 of file EffPurFromHistos.cc.

References plot().

182 {
183  plot(name, ".ps");
184 }
void plot(TPad *theCanvas=0)

Member Data Documentation

FlavourHistograms<double> * EffPurFromHistos::discrCutEfficScan
private

Definition at line 72 of file EffPurFromHistos.h.

Referenced by discriminatorCutEfficScan(), and epsPlot().

FlavourHistograms<double>* EffPurFromHistos::discrNoCutEffic
private

Definition at line 72 of file EffPurFromHistos.h.

Referenced by discriminatorNoCutEffic(), and epsPlot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_b
private

Definition at line 103 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_b(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_c
private

Definition at line 102 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_c(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_d
private

Definition at line 99 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_d(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_dus
private

Definition at line 106 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_dus(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_dusg
private

Definition at line 107 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_dusg(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_g
private

Definition at line 104 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_g(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_ni
private

Definition at line 105 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_ni(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_s
private

Definition at line 101 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_s(), and plot().

MonitorElement* EffPurFromHistos::EffFlavVsBEff_u
private

Definition at line 100 of file EffPurFromHistos.h.

Referenced by compute(), getEffFlavVsBEff_u(), and plot().

TH1F* EffPurFromHistos::effVersusDiscr_b
private

Definition at line 82 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_c
private

Definition at line 81 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_d
private

Definition at line 78 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_dus
private

Definition at line 85 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_dusg
private

Definition at line 86 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_g
private

Definition at line 83 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_ni
private

Definition at line 84 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_s
private

Definition at line 80 of file EffPurFromHistos.h.

Referenced by check(), and compute().

TH1F* EffPurFromHistos::effVersusDiscr_u
private

Definition at line 79 of file EffPurFromHistos.h.

Referenced by check(), and compute().

double EffPurFromHistos::endOutput
private

Definition at line 94 of file EffPurFromHistos.h.

Referenced by compute().

bool EffPurFromHistos::fromDiscriminatorDistr
private

Definition at line 66 of file EffPurFromHistos.h.

Referenced by epsPlot().

std::string EffPurFromHistos::histoExtension
private

Definition at line 70 of file EffPurFromHistos.h.

Referenced by compute(), and plot().

std::string EffPurFromHistos::label_
private
unsigned int EffPurFromHistos::mcPlots_
private

Definition at line 96 of file EffPurFromHistos.h.

Referenced by check(), compute(), and plot().

int EffPurFromHistos::nBinOutput
private

Definition at line 92 of file EffPurFromHistos.h.

Referenced by compute().

double EffPurFromHistos::startOutput
private

Definition at line 93 of file EffPurFromHistos.h.

Referenced by compute().