14 using namespace RecoBTag;
32 : fromDiscriminatorDistr(
false),
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),
61 : fromDiscriminatorDistr(
true),
71 std::make_unique<FlavourHistograms<double>>(
"totalEntries" +
histoExtension,
73 dDiscriminatorFC.
nBins(),
87 std::make_unique<FlavourHistograms<double>>(
"effVsDiscrCut" +
histoExtension,
89 dDiscriminatorFC.
nBins(),
99 discrCutEfficScan->SetMinimum(1E-4);
162 vector<TH1F*> discrCutHistos = discrCutEfficScan->getHistoVector();
164 const int& dimHistos = discrCfHistos.size();
170 const int& nBins = dDiscriminatorFC.
nBins();
173 for (
int iFlav = 0; iFlav < dimHistos; iFlav++) {
174 if (discrCfHistos[iFlav] ==
nullptr)
176 discrNoCutHistos[iFlav]->SetXTitle(
"Discriminant");
177 discrNoCutHistos[iFlav]->GetXaxis()->SetTitleOffset(0.75);
181 const double& nJetsFlav = discrCfHistos[iFlav]->GetEntries();
182 double sum = discrCfHistos[iFlav]->GetBinContent(nBins + 1);
184 for (
int iDiscr = nBins; iDiscr > 0; --iDiscr) {
186 discrNoCutHistos[iFlav]->SetBinContent(iDiscr, nJetsFlav);
187 discrNoCutHistos[iFlav]->SetBinError(iDiscr,
sqrt(nJetsFlav));
188 sum += discrCfHistos[iFlav]->GetBinContent(iDiscr);
189 discrCutHistos[iFlav]->SetBinContent(iDiscr, sum);
190 discrCutHistos[iFlav]->SetBinError(iDiscr,
sqrt(sum));
196 discrCutEfficScan->setEfficiencyFlag();
215 hX =
"FlavEffVsBEff";
218 hX =
"FlavEffVsCEff";
222 (
"Flavour misidentification vs. " + Title +
"-tagging efficiency " +
histoExtension).c_str());
230 bool btppColour =
true;
238 gPad->UseCurrentStyle();
239 gPad->SetFillColor(0);
255 float mSize = gPad->GetWh() * gPad->GetHNDC() / 500.;
384 const bool& lNBins = ((nBins_d == nBins_u && nBins_d == nBins_s && nBins_d == nBins_c && nBins_d == nBins_b &&
385 nBins_d == nBins_g && nBins_d == nBins_ni && nBins_d == nBins_dus && nBins_d == nBins_dusg) ||
386 (nBins_c == nBins_b && nBins_c == nBins_dusg && nBins_c == nBins_ni && nBins_c == nBins_pu));
389 throw cms::Exception(
"Configuration") <<
"Input histograms do not all have the same number of bins!\n";
411 const bool& lSBin = ((sBin_d == sBin_u && sBin_d == sBin_s && sBin_d == sBin_c && sBin_d == sBin_b &&
412 sBin_d == sBin_g && sBin_d == sBin_ni && sBin_d == sBin_dus && sBin_d == sBin_dusg) ||
413 (sBin_c == sBin_b && sBin_c == sBin_dusg && sBin_c == sBin_ni && sBin_c == sBin_pu));
417 <<
"EffPurFromHistos::check() : Input histograms do not all have the same start bin!\n";
439 const bool& lEBin = ((eBin_d == eBin_u && eBin_d == eBin_s && eBin_d == eBin_c && eBin_d == eBin_b &&
440 eBin_d == eBin_g && eBin_d == eBin_ni && eBin_d == eBin_dus && eBin_d == eBin_dusg) ||
441 (eBin_c == eBin_b && eBin_c == eBin_dusg && eBin_c == eBin_ni && eBin_c == eBin_pu));
445 <<
"EffPurFromHistos::check() : Input histograms do not all have the same end bin!\n";
469 hX =
"FlavEffVsBEff_";
472 hX =
"FlavEffVsCEff_";
557 const int& nBinX = EffFlavVsXEff->
getTH1F()->GetNbinsX();
559 for (
int iBinX = 1; iBinX <= nBinX; iBinX++) {
561 const float& effXBinWidth = EffFlavVsXEff->
getTH1F()->GetBinWidth(iBinX);
562 const float& effXMid = EffFlavVsXEff->
getTH1F()->GetBinCenter(iBinX);
563 const float& effXLeft = effXMid - 0.5 * effXBinWidth;
564 const float& effXRight = effXMid + 0.5 * effXBinWidth;
574 const bool& binFound = (binClosest > 0);
double lowerBound() const
std::unique_ptr< FlavourHistograms< double > > discrNoCutEffic
void epsPlot(const std::string &name)
void plot(TPad *theCanvas=nullptr)
MonitorElement * EffFlavVsXEff_s
void compute(DQMStore::IBooker &ibook)
MonitorElement * EffFlavVsXEff_u
virtual TH1F * getTH1F() const
MonitorElement * EffFlavVsXEff_g
int findBinClosestYValue(const TH1F *, const float &yVal, const float &yLow, const float &yHigh)
MonitorElement * EffFlavVsXEff_d
std::string baseNameDescription() const
MonitorElement * EffFlavVsXEff_ni
std::vector< TH1F * > getHistoVector() const
MonitorElement * EffFlavVsXEff_c
std::unique_ptr< FlavourHistograms< double > > discrCutEfficScan
MonitorElement * EffFlavVsXEff_pu
std::string baseNameTitle() const
TH1F * effVersusDiscr_dusg
std::string histoExtension
MonitorElement * EffFlavVsXEff_dusg
virtual MonitorElement * book1D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX)
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, TH1F *h_pu, const std::string &label, unsigned int mc, int nBin=100, double startO=0.005, double endO=1.005)
MonitorElement * EffFlavVsXEff_dus
double upperBound() const
bool fromDiscriminatorDistr
void psPlot(const std::string &name)
MonitorElement * EffFlavVsXEff_b
TH1F * effVersusDiscr_dus