CMS 3D CMS Logo

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

#include <EffPurFromHistos2D.h>

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

Public Member Functions

void compute (DQMStore::IBooker &ibook, std::vector< double > fixedEff)
 
FlavourHistograms2D< double, double > & discriminatorCutEfficScan () const
 
FlavourHistograms2D< double, double > & discriminatorNoCutEffic () const
 
bool doCTagPlots (bool Ctag)
 
 EffPurFromHistos2D (const std::string &ext, TH2F *h_d, TH2F *h_u, TH2F *h_s, TH2F *h_c, TH2F *h_b, TH2F *h_g, TH2F *h_ni, TH2F *h_dus, TH2F *h_dusg, TH2F *h_pu, const std::string &label, unsigned int mc, int nBinX=100, double startOX=0.05, double endOX=1.05)
 
 EffPurFromHistos2D (const FlavourHistograms2D< double, double > &dDiscriminatorFC, const std::string &label, unsigned int mc, DQMStore::IBooker &ibook, int nBinX=100, double startOX=0.05, double endOX=1.05)
 
void epsPlot (const std::string &name)
 
void plot (TPad *theCanvas=nullptr)
 
void plot (const std::string &name, const std::string &ext)
 
void psPlot (const std::string &name)
 
 ~EffPurFromHistos2D ()
 

Private Member Functions

void check ()
 

Private Attributes

std::unique_ptr< FlavourHistograms2D< double, double > > discrCutEfficScan
 
std::unique_ptr< FlavourHistograms2D< double, double > > discrNoCutEffic
 
bool doCTagPlots_
 
TH2F * effVersusDiscr_b
 
TH2F * effVersusDiscr_c
 
TH2F * effVersusDiscr_d
 
TH2F * effVersusDiscr_dus
 
TH2F * effVersusDiscr_dusg
 
TH2F * effVersusDiscr_g
 
TH2F * effVersusDiscr_ni
 
TH2F * effVersusDiscr_pu
 
TH2F * effVersusDiscr_s
 
TH2F * effVersusDiscr_u
 
double endOutputX
 
double endOutputY
 
bool fromDiscriminatorDistr
 
std::string histoExtension
 
std::string label_
 
unsigned int mcPlots_
 
int nBinOutputX
 
int nBinOutputY
 
double startOutputX
 
double startOutputY
 
std::vector< MonitorElement * > X_vs_Y_eff_at_fixedZeff
 

Detailed Description

Definition at line 13 of file EffPurFromHistos2D.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 15 of file EffPurFromHistos2D.h.

◆ MonitorElement

Definition at line 16 of file EffPurFromHistos2D.h.

Constructor & Destructor Documentation

◆ EffPurFromHistos2D() [1/2]

EffPurFromHistos2D::EffPurFromHistos2D ( const std::string &  ext,
TH2F *  h_d,
TH2F *  h_u,
TH2F *  h_s,
TH2F *  h_c,
TH2F *  h_b,
TH2F *  h_g,
TH2F *  h_ni,
TH2F *  h_dus,
TH2F *  h_dusg,
TH2F *  h_pu,
const std::string &  label,
unsigned int  mc,
int  nBinX = 100,
double  startOX = 0.05,
double  endOX = 1.05 
)

Definition at line 16 of file EffPurFromHistos2D.cc.

References check().

32  : fromDiscriminatorDistr(false),
33  mcPlots_(mc),
34  doCTagPlots_(false),
35  label_(label),
37  effVersusDiscr_d(h_d),
38  effVersusDiscr_u(h_u),
39  effVersusDiscr_s(h_s),
40  effVersusDiscr_c(h_c),
41  effVersusDiscr_b(h_b),
42  effVersusDiscr_g(h_g),
43  effVersusDiscr_ni(h_ni),
44  effVersusDiscr_dus(h_dus),
45  effVersusDiscr_dusg(h_dusg),
46  effVersusDiscr_pu(h_pu),
48  startOutputX(startOX),
49  endOutputX(endOX) {
50  // consistency check
51  check();
52 }
std::string histoExtension
char const * label
Definition: memstream.h:15

◆ EffPurFromHistos2D() [2/2]

EffPurFromHistos2D::EffPurFromHistos2D ( const FlavourHistograms2D< double, double > &  dDiscriminatorFC,
const std::string &  label,
unsigned int  mc,
DQMStore::IBooker ibook,
int  nBinX = 100,
double  startOX = 0.05,
double  endOX = 1.05 
)

Definition at line 54 of file EffPurFromHistos2D.cc.

References FlavourHistograms2D< T, G >::baseNameDescription(), FlavourHistograms2D< T, G >::baseNameTitle(), discrCutEfficScan, discrNoCutEffic, effVersusDiscr_b, effVersusDiscr_c, effVersusDiscr_d, effVersusDiscr_dus, effVersusDiscr_dusg, effVersusDiscr_g, effVersusDiscr_ni, effVersusDiscr_pu, effVersusDiscr_s, effVersusDiscr_u, FlavourHistograms2D< T, G >::getHistoVector(), histoExtension, label, FlavourHistograms2D< T, G >::lowerBoundX(), FlavourHistograms2D< T, G >::lowerBoundY(), mcPlots_, FlavourHistograms2D< T, G >::nBinsX(), FlavourHistograms2D< T, G >::nBinsY(), mathSSE::sqrt(), FlavourHistograms2D< T, G >::upperBoundX(), and FlavourHistograms2D< T, G >::upperBoundY().

61  : fromDiscriminatorDistr(true),
62  mcPlots_(mc),
63  doCTagPlots_(false),
64  label_(label),
66  startOutputX(startOX),
67  endOutputX(endOX) {
68  histoExtension = "_" + dDiscriminatorFC.baseNameTitle();
69 
71  std::make_unique<FlavourHistograms2D<double, double>>("totalEntries" + histoExtension,
72  "Total Entries: " + dDiscriminatorFC.baseNameDescription(),
73  dDiscriminatorFC.nBinsX(),
74  dDiscriminatorFC.lowerBoundX(),
75  dDiscriminatorFC.upperBoundX(),
76  dDiscriminatorFC.nBinsY(),
77  dDiscriminatorFC.lowerBoundY(),
78  dDiscriminatorFC.upperBoundY(),
79  false,
80  label,
81  mcPlots_,
82  false,
83  ibook);
84 
85  // conditional discriminator cut for efficiency histos
86  discrCutEfficScan = std::make_unique<FlavourHistograms2D<double, double>>(
87  "effVsDiscrCut" + histoExtension,
88  "Eff. vs Disc. Cut: " + dDiscriminatorFC.baseNameDescription(),
89  dDiscriminatorFC.nBinsX(),
90  dDiscriminatorFC.lowerBoundX(),
91  dDiscriminatorFC.upperBoundX(),
92  dDiscriminatorFC.nBinsY(),
93  dDiscriminatorFC.lowerBoundY(),
94  dDiscriminatorFC.upperBoundY(),
95  false,
96  label,
97  mcPlots_,
98  false,
99  ibook);
100  discrCutEfficScan->SetMinimum(1E-4);
101 
102  if (mcPlots_) {
103  if (mcPlots_ > 2) {
104  effVersusDiscr_d = discrCutEfficScan->histo_d();
105  effVersusDiscr_u = discrCutEfficScan->histo_u();
106  effVersusDiscr_s = discrCutEfficScan->histo_s();
107  effVersusDiscr_g = discrCutEfficScan->histo_g();
108  effVersusDiscr_dus = discrCutEfficScan->histo_dus();
109  } else {
110  effVersusDiscr_d = nullptr;
111  effVersusDiscr_u = nullptr;
112  effVersusDiscr_s = nullptr;
113  effVersusDiscr_g = nullptr;
114  effVersusDiscr_dus = nullptr;
115  }
116  effVersusDiscr_c = discrCutEfficScan->histo_c();
117  effVersusDiscr_b = discrCutEfficScan->histo_b();
118  effVersusDiscr_ni = discrCutEfficScan->histo_ni();
119  effVersusDiscr_dusg = discrCutEfficScan->histo_dusg();
120  effVersusDiscr_pu = discrCutEfficScan->histo_pu();
121 
122  if (mcPlots_ > 2) {
123  effVersusDiscr_d->SetXTitle("Discriminant");
124  effVersusDiscr_d->GetXaxis()->SetTitleOffset(0.75);
125  effVersusDiscr_u->SetXTitle("Discriminant");
126  effVersusDiscr_u->GetXaxis()->SetTitleOffset(0.75);
127  effVersusDiscr_s->SetXTitle("Discriminant");
128  effVersusDiscr_s->GetXaxis()->SetTitleOffset(0.75);
129  effVersusDiscr_g->SetXTitle("Discriminant");
130  effVersusDiscr_g->GetXaxis()->SetTitleOffset(0.75);
131  effVersusDiscr_dus->SetXTitle("Discriminant");
132  effVersusDiscr_dus->GetXaxis()->SetTitleOffset(0.75);
133  }
134  effVersusDiscr_c->SetXTitle("Discriminant");
135  effVersusDiscr_c->GetXaxis()->SetTitleOffset(0.75);
136  effVersusDiscr_b->SetXTitle("Discriminant");
137  effVersusDiscr_b->GetXaxis()->SetTitleOffset(0.75);
138  effVersusDiscr_ni->SetXTitle("Discriminant");
139  effVersusDiscr_ni->GetXaxis()->SetTitleOffset(0.75);
140  effVersusDiscr_dusg->SetXTitle("Discriminant");
141  effVersusDiscr_dusg->GetXaxis()->SetTitleOffset(0.75);
142  effVersusDiscr_pu->SetXTitle("Discriminant");
143  effVersusDiscr_pu->GetXaxis()->SetTitleOffset(0.75);
144  } else {
145  effVersusDiscr_d = nullptr;
146  effVersusDiscr_u = nullptr;
147  effVersusDiscr_s = nullptr;
148  effVersusDiscr_c = nullptr;
149  effVersusDiscr_b = nullptr;
150  effVersusDiscr_g = nullptr;
151  effVersusDiscr_ni = nullptr;
152  effVersusDiscr_dus = nullptr;
153  effVersusDiscr_dusg = nullptr;
154  effVersusDiscr_pu = nullptr;
155  }
156 
157  // discr. for computation
158  vector<TH2F*> discrCfHistos = dDiscriminatorFC.getHistoVector();
159  // discr no cut
160  vector<TH2F*> discrNoCutHistos = discrNoCutEffic->getHistoVector();
161  // discr no cut
162  vector<TH2F*> discrCutHistos = discrCutEfficScan->getHistoVector();
163 
164  const int& dimHistos = discrCfHistos.size(); // they all have the same size
165 
166  // DISCR-CUT LOOP:
167  // fill the histos for eff-pur computations by scanning the discriminatorFC histogram
168 
169  // better to loop over bins -> discrCut no longer needed
170  const int& nBinsX = dDiscriminatorFC.nBinsX();
171  const int& nBinsY = dDiscriminatorFC.nBinsY();
172 
173  // loop over flavours
174  for (int iFlav = 0; iFlav < dimHistos; iFlav++) {
175  if (discrCfHistos[iFlav] == nullptr)
176  continue;
177  discrNoCutHistos[iFlav]->SetXTitle("Discriminant A");
178  discrNoCutHistos[iFlav]->GetXaxis()->SetTitleOffset(0.75);
179  discrNoCutHistos[iFlav]->SetYTitle("Discriminant B");
180  discrNoCutHistos[iFlav]->GetYaxis()->SetTitleOffset(0.75);
181 
182  // In Root histos, bin counting starts at 1 to nBins.
183  // bin 0 is the underflow, and nBins+1 is the overflow.
184  const double& nJetsFlav = discrCfHistos[iFlav]->GetEntries();
185 
186  for (int iDiscrX = nBinsX; iDiscrX > 0; --iDiscrX) {
187  for (int iDiscrY = nBinsY; iDiscrY > 0; --iDiscrY) {
188  // fill all jets into NoCut histo
189  discrNoCutHistos[iFlav]->SetBinContent(iDiscrX, iDiscrY, nJetsFlav);
190  discrNoCutHistos[iFlav]->SetBinError(iDiscrX, iDiscrY, sqrt(nJetsFlav));
191  const double& sum = nJetsFlav - discrCfHistos[iFlav]->Integral(0, iDiscrX - 1, 0, iDiscrY - 1);
192  discrCutHistos[iFlav]->SetBinContent(iDiscrX, iDiscrY, sum);
193  discrCutHistos[iFlav]->SetBinError(iDiscrX, iDiscrY, sqrt(sum));
194  }
195  }
196  }
197 
198  // divide to get efficiency vs. discriminator cut from absolute numbers
199  discrCutEfficScan->divide(*discrNoCutEffic); // does: histos including discriminator cut / flat histo
200  discrCutEfficScan->setEfficiencyFlag();
201 }
double upperBoundY() const
double lowerBoundY() const
std::string histoExtension
char const * label
std::unique_ptr< FlavourHistograms2D< double, double > > discrCutEfficScan
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< TH2F * > getHistoVector() const
double upperBoundX() const
double lowerBoundX() const
std::unique_ptr< FlavourHistograms2D< double, double > > discrNoCutEffic
std::string baseNameDescription() const
std::string baseNameTitle() const

◆ ~EffPurFromHistos2D()

EffPurFromHistos2D::~EffPurFromHistos2D ( )

Definition at line 203 of file EffPurFromHistos2D.cc.

203 {}

Member Function Documentation

◆ check()

void EffPurFromHistos2D::check ( )
private

Definition at line 244 of file EffPurFromHistos2D.cc.

References effVersusDiscr_b, effVersusDiscr_c, effVersusDiscr_d, effVersusDiscr_dus, effVersusDiscr_dusg, effVersusDiscr_g, effVersusDiscr_ni, effVersusDiscr_pu, effVersusDiscr_s, effVersusDiscr_u, Exception, and mcPlots_.

Referenced by EffPurFromHistos2D().

244  {
245  // number of bins
246  int nBinsX_d = 0;
247  int nBinsX_u = 0;
248  int nBinsX_s = 0;
249  int nBinsX_g = 0;
250  int nBinsX_dus = 0;
251  int nBinsY_d = 0;
252  int nBinsY_u = 0;
253  int nBinsY_s = 0;
254  int nBinsY_g = 0;
255  int nBinsY_dus = 0;
256  if (mcPlots_ > 2) {
257  nBinsX_d = effVersusDiscr_d->GetNbinsX();
258  nBinsX_u = effVersusDiscr_u->GetNbinsX();
259  nBinsX_s = effVersusDiscr_s->GetNbinsX();
260  nBinsX_g = effVersusDiscr_g->GetNbinsX();
261  nBinsX_dus = effVersusDiscr_dus->GetNbinsX();
262  nBinsY_d = effVersusDiscr_d->GetNbinsY();
263  nBinsY_u = effVersusDiscr_u->GetNbinsY();
264  nBinsY_s = effVersusDiscr_s->GetNbinsY();
265  nBinsY_g = effVersusDiscr_g->GetNbinsY();
266  nBinsY_dus = effVersusDiscr_dus->GetNbinsY();
267  }
268  const int& nBinsX_c = effVersusDiscr_c->GetNbinsX();
269  const int& nBinsX_b = effVersusDiscr_b->GetNbinsX();
270  const int& nBinsX_ni = effVersusDiscr_ni->GetNbinsX();
271  const int& nBinsX_dusg = effVersusDiscr_dusg->GetNbinsX();
272  const int& nBinsX_pu = effVersusDiscr_pu->GetNbinsX();
273  const int& nBinsY_c = effVersusDiscr_c->GetNbinsY();
274  const int& nBinsY_b = effVersusDiscr_b->GetNbinsY();
275  const int& nBinsY_ni = effVersusDiscr_ni->GetNbinsY();
276  const int& nBinsY_dusg = effVersusDiscr_dusg->GetNbinsY();
277  const int& nBinsY_pu = effVersusDiscr_pu->GetNbinsY();
278 
279  const bool& lNBinsX =
280  ((nBinsX_d == nBinsX_u && nBinsX_d == nBinsX_s && nBinsX_d == nBinsX_c && nBinsX_d == nBinsX_b &&
281  nBinsX_d == nBinsX_g && nBinsX_d == nBinsX_ni && nBinsX_d == nBinsX_dus && nBinsX_d == nBinsX_dusg) ||
282  (nBinsX_c == nBinsX_b && nBinsX_c == nBinsX_dusg && nBinsX_c == nBinsX_ni && nBinsX_c == nBinsX_pu));
283 
284  const bool& lNBinsY =
285  ((nBinsY_d == nBinsY_u && nBinsY_d == nBinsY_s && nBinsY_d == nBinsY_c && nBinsY_d == nBinsY_b &&
286  nBinsY_d == nBinsY_g && nBinsY_d == nBinsY_ni && nBinsY_d == nBinsY_dus && nBinsY_d == nBinsY_dusg) ||
287  (nBinsY_c == nBinsY_b && nBinsY_c == nBinsY_dusg && nBinsY_c == nBinsY_ni && nBinsY_c == nBinsY_pu));
288 
289  if (!lNBinsX || !lNBinsY) {
290  throw cms::Exception("Configuration") << "Input histograms do not all have the same number of bins!\n";
291  }
292 
293  // start
294  float sBin_d = 0;
295  float sBin_u = 0;
296  float sBin_s = 0;
297  float sBin_g = 0;
298  float sBin_dus = 0;
299  if (mcPlots_ > 2) {
300  sBin_d = effVersusDiscr_d->GetBinCenter(1);
301  sBin_u = effVersusDiscr_u->GetBinCenter(1);
302  sBin_s = effVersusDiscr_s->GetBinCenter(1);
303  sBin_g = effVersusDiscr_g->GetBinCenter(1);
304  sBin_dus = effVersusDiscr_dus->GetBinCenter(1);
305  }
306  const float& sBin_c = effVersusDiscr_c->GetBinCenter(1);
307  const float& sBin_b = effVersusDiscr_b->GetBinCenter(1);
308  const float& sBin_ni = effVersusDiscr_ni->GetBinCenter(1);
309  const float& sBin_dusg = effVersusDiscr_dusg->GetBinCenter(1);
310  const float& sBin_pu = effVersusDiscr_pu->GetBinCenter(1);
311 
312  const bool& lSBin = ((sBin_d == sBin_u && sBin_d == sBin_s && sBin_d == sBin_c && sBin_d == sBin_b &&
313  sBin_d == sBin_g && sBin_d == sBin_ni && sBin_d == sBin_dus && sBin_d == sBin_dusg) ||
314  (sBin_c == sBin_b && sBin_c == sBin_dusg && sBin_c == sBin_ni && sBin_c == sBin_pu));
315 
316  if (!lSBin) {
317  throw cms::Exception("Configuration")
318  << "EffPurFromHistos::check() : Input histograms do not all have the same start bin!\n";
319  }
320 
321  // end
322  float eBin_d = 0;
323  float eBin_u = 0;
324  float eBin_s = 0;
325  float eBin_g = 0;
326  float eBin_dus = 0;
327  const int& binEnd = effVersusDiscr_b->GetBin(nBinsX_b - 1, nBinsY_b - 1);
328  if (mcPlots_ > 2) {
329  eBin_d = effVersusDiscr_d->GetBinCenter(binEnd);
330  eBin_u = effVersusDiscr_u->GetBinCenter(binEnd);
331  eBin_s = effVersusDiscr_s->GetBinCenter(binEnd);
332  eBin_g = effVersusDiscr_g->GetBinCenter(binEnd);
333  eBin_dus = effVersusDiscr_dus->GetBinCenter(binEnd);
334  }
335  const float& eBin_c = effVersusDiscr_c->GetBinCenter(binEnd);
336  const float& eBin_b = effVersusDiscr_b->GetBinCenter(binEnd);
337  const float& eBin_ni = effVersusDiscr_ni->GetBinCenter(binEnd);
338  const float& eBin_dusg = effVersusDiscr_dusg->GetBinCenter(binEnd);
339  const float& eBin_pu = effVersusDiscr_pu->GetBinCenter(binEnd);
340 
341  const bool& lEBin = ((eBin_d == eBin_u && eBin_d == eBin_s && eBin_d == eBin_c && eBin_d == eBin_b &&
342  eBin_d == eBin_g && eBin_d == eBin_ni && eBin_d == eBin_dus && eBin_d == eBin_dusg) ||
343  (eBin_c == eBin_b && eBin_c == eBin_dusg && eBin_c == eBin_ni && eBin_c == eBin_pu));
344 
345  if (!lEBin) {
346  throw cms::Exception("Configuration")
347  << "EffPurFromHistos::check() : Input histograms do not all have the same end bin!\n";
348  }
349 }

◆ compute()

void EffPurFromHistos2D::compute ( DQMStore::IBooker ibook,
std::vector< double >  fixedEff 
)

Definition at line 351 of file EffPurFromHistos2D.cc.

References HistoProviderDQM::book1D(), doCTagPlots_, effVersusDiscr_b, effVersusDiscr_c, effVersusDiscr_dusg, endOutputX, RecoBTag::findBinClosestYValueAtFixedZ(), dqm::legacy::MonitorElement::getTH1F(), histoExtension, label_, mcPlots_, nBinOutputX, anotherprimaryvertexanalyzer_cfi::nBinX, startOutputX, AlCaHLTBitMon_QueryRunRegistry::string, to_string(), and X_vs_Y_eff_at_fixedZeff.

351  {
352  if (!mcPlots_ || fixedEff.empty()) {
353  return;
354  }
355 
356  // to have shorter names ......
357  const std::string& hE = histoExtension;
358  std::string hX = "DUSG_vs_B_eff_at_fixedCeff_";
359  if (!doCTagPlots_)
360  hX = "DUSG_vs_C_eff_at_fixedBeff_";
361 
362  // create histograms from base name and extension as given from user
363  HistoProviderDQM prov("Btag", label_, ibook);
364 
365  for (unsigned int ieff = 0; ieff < fixedEff.size(); ieff++) {
366  std::string fixedEfficiency = std::to_string(fixedEff[ieff]);
367  fixedEfficiency.replace(1, 1, "_");
368  X_vs_Y_eff_at_fixedZeff.push_back(
369  (prov.book1D(hX + fixedEfficiency + hE, hX + fixedEfficiency + hE, nBinOutputX, startOutputX, endOutputX)));
370  X_vs_Y_eff_at_fixedZeff[ieff]->setEfficiencyFlag();
371 
372  X_vs_Y_eff_at_fixedZeff[ieff]->setAxisTitle("Light mistag");
373  X_vs_Y_eff_at_fixedZeff[ieff]->getTH1F()->SetYTitle("B mistag");
374  if (!doCTagPlots_)
375  X_vs_Y_eff_at_fixedZeff[ieff]->getTH1F()->SetYTitle("C mistag");
376  X_vs_Y_eff_at_fixedZeff[ieff]->getTH1F()->GetXaxis()->SetTitleOffset(0.75);
377  X_vs_Y_eff_at_fixedZeff[ieff]->getTH1F()->GetYaxis()->SetTitleOffset(0.75);
378  }
379  // loop over eff. vs. discriminator cut b-histo and look in which bin the closest entry is;
380  // use fact that eff decreases monotonously
381 
382  // any of the histos to be created can be taken here:
383  MonitorElement* EffFlavVsXEff = X_vs_Y_eff_at_fixedZeff[0];
384 
385  const int& nBinX = EffFlavVsXEff->getTH1F()->GetNbinsX();
386 
387  for (int iBinX = 1; iBinX <= nBinX; iBinX++) { // loop over the bins on the x-axis of the histograms to be filled
388  const float& effBinWidthX = EffFlavVsXEff->getTH1F()->GetBinWidth(iBinX);
389  const float& effMidX = EffFlavVsXEff->getTH1F()->GetBinCenter(iBinX); // middle of efficiency bin
390  const float& effLeftX = effMidX - 0.5 * effBinWidthX; // left edge of bin
391  const float& effRightX = effMidX + 0.5 * effBinWidthX; // right edge of bin
392 
393  vector<int> binClosest;
394  if (doCTagPlots_)
395  binClosest =
396  findBinClosestYValueAtFixedZ(effVersusDiscr_dusg, effMidX, effLeftX, effRightX, effVersusDiscr_c, fixedEff);
397  else
398  binClosest =
399  findBinClosestYValueAtFixedZ(effVersusDiscr_dusg, effMidX, effLeftX, effRightX, effVersusDiscr_b, fixedEff);
400 
401  for (unsigned int ieff = 0; ieff < binClosest.size(); ieff++) {
402  const bool& binFound = (binClosest[ieff] > 0);
403  //
404  if (binFound) {
405  // fill the histos
406  if (doCTagPlots_) {
407  X_vs_Y_eff_at_fixedZeff[ieff]->Fill(effMidX, effVersusDiscr_b->GetBinContent(binClosest[ieff]));
408  X_vs_Y_eff_at_fixedZeff[ieff]->getTH1F()->SetBinError(iBinX, effVersusDiscr_b->GetBinError(binClosest[ieff]));
409  } else {
410  X_vs_Y_eff_at_fixedZeff[ieff]->Fill(effMidX, effVersusDiscr_c->GetBinContent(binClosest[ieff]));
411  X_vs_Y_eff_at_fixedZeff[ieff]->getTH1F()->SetBinError(iBinX, effVersusDiscr_c->GetBinError(binClosest[ieff]));
412  }
413  }
414  }
415  }
416 }
static std::string to_string(const XMLCh *ch)
std::string histoExtension
std::vector< MonitorElement * > X_vs_Y_eff_at_fixedZeff
virtual TH1F * getTH1F() const
std::vector< int > findBinClosestYValueAtFixedZ(const TH2F *, const float &yVal, const float &yLow, const float &yHigh, const TH2F *, const std::vector< double > &zVal)
Definition: Tools.cc:278

◆ discriminatorCutEfficScan()

FlavourHistograms2D<double, double>& EffPurFromHistos2D::discriminatorCutEfficScan ( ) const
inline

Definition at line 55 of file EffPurFromHistos2D.h.

References discrCutEfficScan.

55 { return *discrCutEfficScan; }
std::unique_ptr< FlavourHistograms2D< double, double > > discrCutEfficScan

◆ discriminatorNoCutEffic()

FlavourHistograms2D<double, double>& EffPurFromHistos2D::discriminatorNoCutEffic ( ) const
inline

Definition at line 54 of file EffPurFromHistos2D.h.

References discrNoCutEffic.

54 { return *discrNoCutEffic; }
std::unique_ptr< FlavourHistograms2D< double, double > > discrNoCutEffic

◆ doCTagPlots()

bool EffPurFromHistos2D::doCTagPlots ( bool  Ctag)
inline

Definition at line 57 of file EffPurFromHistos2D.h.

References doCTagPlots_.

57  {
58  doCTagPlots_ = Ctag;
59  return doCTagPlots_;
60  }

◆ epsPlot()

void EffPurFromHistos2D::epsPlot ( const std::string &  name)

Definition at line 205 of file EffPurFromHistos2D.cc.

References discrCutEfficScan, discrNoCutEffic, fromDiscriminatorDistr, Skims_PA_cff::name, and plot().

205  {
207  discrNoCutEffic->epsPlot(name);
208  discrCutEfficScan->epsPlot(name);
209  }
210  plot(name, ".eps");
211 }
void plot(TPad *theCanvas=nullptr)
std::unique_ptr< FlavourHistograms2D< double, double > > discrCutEfficScan
std::unique_ptr< FlavourHistograms2D< double, double > > discrNoCutEffic

◆ plot() [1/2]

void EffPurFromHistos2D::plot ( TPad *  theCanvas = nullptr)

Definition at line 231 of file EffPurFromHistos2D.cc.

References plotscripts::setTDRStyle().

Referenced by epsPlot(), plot(), and psPlot().

231  {
232  setTDRStyle()->cd();
233 
234  if (plotCanvas)
235  plotCanvas->cd();
236 
237  gPad->UseCurrentStyle();
238  gPad->SetFillColor(0);
239  gPad->SetLogy(1);
240  gPad->SetGridx(1);
241  gPad->SetGridy(1);
242 }
def setTDRStyle()
Definition: plotscripts.py:89

◆ plot() [2/2]

void EffPurFromHistos2D::plot ( const std::string &  name,
const std::string &  ext 
)

Definition at line 215 of file EffPurFromHistos2D.cc.

References doCTagPlots_, histoExtension, Skims_PA_cff::name, plot(), and AlCaHLTBitMon_QueryRunRegistry::string.

215  {
216  std::string hX = "";
217  std::string Title = "";
218  if (!doCTagPlots_) {
219  hX = "FlavEffVsBEff";
220  Title = "b";
221  } else {
222  hX = "FlavEffVsCEff";
223  Title = "c";
224  }
225  TCanvas tc((hX + histoExtension).c_str(),
226  ("Flavour misidentification vs. " + Title + "-tagging efficiency " + histoExtension).c_str());
227  plot(&tc);
228  tc.Print((name + hX + histoExtension + ext).c_str());
229 }
void plot(TPad *theCanvas=nullptr)
std::string histoExtension
Definition: memstream.h:15

◆ psPlot()

void EffPurFromHistos2D::psPlot ( const std::string &  name)

Definition at line 213 of file EffPurFromHistos2D.cc.

References Skims_PA_cff::name, and plot().

213 { plot(name, ".ps"); }
void plot(TPad *theCanvas=nullptr)

Member Data Documentation

◆ discrCutEfficScan

std::unique_ptr<FlavourHistograms2D<double, double> > EffPurFromHistos2D::discrCutEfficScan
private

Definition at line 73 of file EffPurFromHistos2D.h.

Referenced by discriminatorCutEfficScan(), EffPurFromHistos2D(), and epsPlot().

◆ discrNoCutEffic

std::unique_ptr<FlavourHistograms2D<double, double> > EffPurFromHistos2D::discrNoCutEffic
private

Definition at line 73 of file EffPurFromHistos2D.h.

Referenced by discriminatorNoCutEffic(), EffPurFromHistos2D(), and epsPlot().

◆ doCTagPlots_

bool EffPurFromHistos2D::doCTagPlots_
private

Definition at line 68 of file EffPurFromHistos2D.h.

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

◆ effVersusDiscr_b

TH2F* EffPurFromHistos2D::effVersusDiscr_b
private

Definition at line 83 of file EffPurFromHistos2D.h.

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

◆ effVersusDiscr_c

TH2F* EffPurFromHistos2D::effVersusDiscr_c
private

Definition at line 82 of file EffPurFromHistos2D.h.

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

◆ effVersusDiscr_d

TH2F* EffPurFromHistos2D::effVersusDiscr_d
private

Definition at line 79 of file EffPurFromHistos2D.h.

Referenced by check(), and EffPurFromHistos2D().

◆ effVersusDiscr_dus

TH2F* EffPurFromHistos2D::effVersusDiscr_dus
private

Definition at line 86 of file EffPurFromHistos2D.h.

Referenced by check(), and EffPurFromHistos2D().

◆ effVersusDiscr_dusg

TH2F* EffPurFromHistos2D::effVersusDiscr_dusg
private

Definition at line 87 of file EffPurFromHistos2D.h.

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

◆ effVersusDiscr_g

TH2F* EffPurFromHistos2D::effVersusDiscr_g
private

Definition at line 84 of file EffPurFromHistos2D.h.

Referenced by check(), and EffPurFromHistos2D().

◆ effVersusDiscr_ni

TH2F* EffPurFromHistos2D::effVersusDiscr_ni
private

Definition at line 85 of file EffPurFromHistos2D.h.

Referenced by check(), and EffPurFromHistos2D().

◆ effVersusDiscr_pu

TH2F* EffPurFromHistos2D::effVersusDiscr_pu
private

Definition at line 88 of file EffPurFromHistos2D.h.

Referenced by check(), and EffPurFromHistos2D().

◆ effVersusDiscr_s

TH2F* EffPurFromHistos2D::effVersusDiscr_s
private

Definition at line 81 of file EffPurFromHistos2D.h.

Referenced by check(), and EffPurFromHistos2D().

◆ effVersusDiscr_u

TH2F* EffPurFromHistos2D::effVersusDiscr_u
private

Definition at line 80 of file EffPurFromHistos2D.h.

Referenced by check(), and EffPurFromHistos2D().

◆ endOutputX

double EffPurFromHistos2D::endOutputX
private

Definition at line 95 of file EffPurFromHistos2D.h.

Referenced by compute().

◆ endOutputY

double EffPurFromHistos2D::endOutputY
private

Definition at line 98 of file EffPurFromHistos2D.h.

◆ fromDiscriminatorDistr

bool EffPurFromHistos2D::fromDiscriminatorDistr
private

Definition at line 65 of file EffPurFromHistos2D.h.

Referenced by epsPlot().

◆ histoExtension

std::string EffPurFromHistos2D::histoExtension
private

Definition at line 71 of file EffPurFromHistos2D.h.

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

◆ label_

std::string EffPurFromHistos2D::label_
private

◆ mcPlots_

unsigned int EffPurFromHistos2D::mcPlots_
private

Definition at line 67 of file EffPurFromHistos2D.h.

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

◆ nBinOutputX

int EffPurFromHistos2D::nBinOutputX
private

Definition at line 93 of file EffPurFromHistos2D.h.

Referenced by compute().

◆ nBinOutputY

int EffPurFromHistos2D::nBinOutputY
private

Definition at line 96 of file EffPurFromHistos2D.h.

◆ startOutputX

double EffPurFromHistos2D::startOutputX
private

Definition at line 94 of file EffPurFromHistos2D.h.

Referenced by compute().

◆ startOutputY

double EffPurFromHistos2D::startOutputY
private

Definition at line 97 of file EffPurFromHistos2D.h.

◆ X_vs_Y_eff_at_fixedZeff

std::vector<MonitorElement*> EffPurFromHistos2D::X_vs_Y_eff_at_fixedZeff
private

Definition at line 100 of file EffPurFromHistos2D.h.

Referenced by compute().