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),
48 startOutputX(startOX),
61 : fromDiscriminatorDistr(
true),
66 startOutputX(startOX),
71 std::make_unique<FlavourHistograms2D<double, double>>(
"totalEntries" +
histoExtension,
164 const int& dimHistos = discrCfHistos.size();
170 const int& nBinsX = dDiscriminatorFC.
nBinsX();
171 const int& nBinsY = dDiscriminatorFC.
nBinsY();
174 for (
int iFlav = 0; iFlav < dimHistos; iFlav++) {
175 if (discrCfHistos[iFlav] ==
nullptr)
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);
184 const double& nJetsFlav = discrCfHistos[iFlav]->GetEntries();
186 for (
int iDiscrX = nBinsX; iDiscrX > 0; --iDiscrX) {
187 for (
int iDiscrY = nBinsY; iDiscrY > 0; --iDiscrY) {
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));
219 hX =
"FlavEffVsBEff";
222 hX =
"FlavEffVsCEff";
226 (
"Flavour misidentification vs. " + Title +
"-tagging efficiency " +
histoExtension).c_str());
237 gPad->UseCurrentStyle();
238 gPad->SetFillColor(0);
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));
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));
289 if (!lNBinsX || !lNBinsY) {
290 throw cms::Exception(
"Configuration") <<
"Input histograms do not all have the same number of bins!\n";
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));
318 <<
"EffPurFromHistos::check() : Input histograms do not all have the same start bin!\n";
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));
347 <<
"EffPurFromHistos::check() : Input histograms do not all have the same end bin!\n";
352 if (!
mcPlots_ || fixedEff.empty()) {
360 hX =
"DUSG_vs_C_eff_at_fixedBeff_";
365 for (
unsigned int ieff = 0; ieff < fixedEff.size(); ieff++) {
367 fixedEfficiency.replace(1, 1,
"_");
385 const int&
nBinX = EffFlavVsXEff->
getTH1F()->GetNbinsX();
387 for (
int iBinX = 1; iBinX <=
nBinX; iBinX++) {
388 const float& effBinWidthX = EffFlavVsXEff->
getTH1F()->GetBinWidth(iBinX);
389 const float& effMidX = EffFlavVsXEff->
getTH1F()->GetBinCenter(iBinX);
390 const float& effLeftX = effMidX - 0.5 * effBinWidthX;
391 const float& effRightX = effMidX + 0.5 * effBinWidthX;
393 vector<int> binClosest;
401 for (
unsigned int ieff = 0; ieff < binClosest.size(); ieff++) {
402 const bool& binFound = (binClosest[ieff] > 0);
void plot(TPad *theCanvas=nullptr)
TH2F * effVersusDiscr_dus
double upperBoundY() const
std::string to_string(const V &value)
double lowerBoundY() const
std::string histoExtension
std::unique_ptr< FlavourHistograms2D< double, double > > discrCutEfficScan
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)
std::vector< MonitorElement * > X_vs_Y_eff_at_fixedZeff
std::vector< TH2F * > getHistoVector() const
void epsPlot(const std::string &name)
double upperBoundX() const
bool fromDiscriminatorDistr
double lowerBoundX() const
virtual TH1F * getTH1F() const
std::unique_ptr< FlavourHistograms2D< double, double > > discrNoCutEffic
void psPlot(const std::string &name)
std::string baseNameDescription() const
virtual MonitorElement * book1D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX)
std::vector< int > findBinClosestYValueAtFixedZ(const TH2F *, const float &yVal, const float &yLow, const float &yHigh, const TH2F *, const std::vector< double > &zVal)
TH2F * effVersusDiscr_dusg
void compute(DQMStore::IBooker &ibook, std::vector< double > fixedEff)
std::string baseNameTitle() const