18 TH2F * h_s, TH2F * h_c, TH2F * h_b, TH2F * h_g, TH2F * h_ni,
19 TH2F * h_dus, TH2F * h_dusg, TH2F * h_pu,
21 int nBinX,
double startOX,
double endOX) :
22 fromDiscriminatorDistr(
false),
23 mcPlots_(mc), doCTagPlots_(
false), label_(label),
24 histoExtension(ext), effVersusDiscr_d(h_d), effVersusDiscr_u(h_u),
25 effVersusDiscr_s(h_s), effVersusDiscr_c(h_c), effVersusDiscr_b(h_b),
26 effVersusDiscr_g(h_g), effVersusDiscr_ni(h_ni), effVersusDiscr_dus(h_dus),
27 effVersusDiscr_dusg(h_dusg), effVersusDiscr_pu(h_pu),
28 nBinOutputX(nBinX), startOutputX(startOX), endOutputX(endOX)
37 int nBinX,
double startOX,
double endOX):
44 discrNoCutEffic = std::make_unique<FlavourHistograms2D<double, double>>(
56 discrCutEfficScan->SetMinimum(1E-4);
120 vector<TH2F*> discrCutHistos = discrCutEfficScan->getHistoVector();
122 const int& dimHistos = discrCfHistos.size();
128 const int& nBinsX = dDiscriminatorFC.
nBinsX();
129 const int& nBinsY = dDiscriminatorFC.
nBinsY();
132 for (
int iFlav = 0; iFlav < dimHistos; iFlav++) {
133 if (discrCfHistos[iFlav] ==
nullptr)
continue;
134 discrNoCutHistos[iFlav]->SetXTitle(
"Discriminant A");
135 discrNoCutHistos[iFlav]->GetXaxis()->SetTitleOffset(0.75);
136 discrNoCutHistos[iFlav]->SetYTitle(
"Discriminant B");
137 discrNoCutHistos[iFlav]->GetYaxis()->SetTitleOffset(0.75);
141 const double& nJetsFlav = discrCfHistos[iFlav]->GetEntries();
143 for (
int iDiscrX = nBinsX; iDiscrX > 0; --iDiscrX) {
144 for (
int iDiscrY = nBinsY; iDiscrY > 0; --iDiscrY) {
146 discrNoCutHistos[iFlav]->SetBinContent(iDiscrX, iDiscrY, nJetsFlav);
147 discrNoCutHistos[iFlav]->SetBinError(iDiscrX, iDiscrY,
sqrt(nJetsFlav));
148 const double& sum = nJetsFlav - discrCfHistos[iFlav]->Integral( 0, iDiscrX-1, 0, iDiscrY-1);
149 discrCutHistos[iFlav]->SetBinContent(iDiscrX, iDiscrY, sum);
150 discrCutHistos[iFlav]->SetBinError(iDiscrX, iDiscrY,
sqrt(sum));
157 discrCutEfficScan->setEfficiencyFlag();
181 hX =
"FlavEffVsBEff";
184 hX =
"FlavEffVsCEff";
199 gPad->UseCurrentStyle();
200 gPad->SetFillColor( 0 );
242 const bool& lNBinsX =
243 ((nBinsX_d == nBinsX_u &&
244 nBinsX_d == nBinsX_s &&
245 nBinsX_d == nBinsX_c &&
246 nBinsX_d == nBinsX_b &&
247 nBinsX_d == nBinsX_g &&
248 nBinsX_d == nBinsX_ni &&
249 nBinsX_d == nBinsX_dus &&
250 nBinsX_d == nBinsX_dusg)||
251 (nBinsX_c == nBinsX_b &&
252 nBinsX_c == nBinsX_dusg &&
253 nBinsX_c == nBinsX_ni &&
254 nBinsX_c == nBinsX_pu) );
256 const bool& lNBinsY =
257 ((nBinsY_d == nBinsY_u &&
258 nBinsY_d == nBinsY_s &&
259 nBinsY_d == nBinsY_c &&
260 nBinsY_d == nBinsY_b &&
261 nBinsY_d == nBinsY_g &&
262 nBinsY_d == nBinsY_ni &&
263 nBinsY_d == nBinsY_dus &&
264 nBinsY_d == nBinsY_dusg)||
265 (nBinsY_c == nBinsY_b &&
266 nBinsY_c == nBinsY_dusg &&
267 nBinsY_c == nBinsY_ni &&
268 nBinsY_c == nBinsY_pu) );
270 if ( !lNBinsX || !lNBinsY ) {
272 <<
"Input histograms do not all have the same number of bins!\n";
295 ((sBin_d == sBin_u &&
301 sBin_d == sBin_dus &&
302 sBin_d == sBin_dusg)||
304 sBin_c == sBin_dusg &&
306 sBin_c == sBin_pu) );
310 <<
"EffPurFromHistos::check() : Input histograms do not all have the same start bin!\n";
334 ((eBin_d == eBin_u &&
340 eBin_d == eBin_dus &&
341 eBin_d == eBin_dusg)||
343 eBin_c == eBin_dusg &&
345 eBin_c == eBin_pu) );
349 <<
"EffPurFromHistos::check() : Input histograms do not all have the same end bin!\n";
356 if (!
mcPlots_ || fixedEff.empty()) {
368 for (
unsigned int ieff = 0; ieff < fixedEff.size(); ieff++){
369 std::string fixedEfficiency = std::to_string(fixedEff[ieff]);
370 fixedEfficiency.replace(1, 1,
"_");
386 const int&
nBinX = EffFlavVsXEff->
getTH1F()->GetNbinsX();
388 for (
int iBinX = 1; iBinX <=
nBinX; iBinX++) {
389 const float& effBinWidthX = EffFlavVsXEff->
getTH1F()->GetBinWidth (iBinX);
390 const float& effMidX = EffFlavVsXEff->
getTH1F()->GetBinCenter(iBinX);
391 const float& effLeftX = effMidX - 0.5*effBinWidthX;
392 const float& effRightX = effMidX + 0.5*effBinWidthX;
394 vector<int> binClosest;
400 for (
unsigned int ieff = 0; ieff < binClosest.size(); ieff++) {
401 const bool& binFound =( binClosest[ieff] > 0 );
double lowerBoundX() const
double lowerBoundY() const
TH2F * effVersusDiscr_dus
std::unique_ptr< FlavourHistograms2D< double, double > > discrNoCutEffic
std::string baseNameTitle() const
std::unique_ptr< FlavourHistograms2D< double, double > > discrCutEfficScan
std::string histoExtension
virtual MonitorElement * book1D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX)
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
double upperBoundX() const
void epsPlot(const std::string &name)
std::vector< TH2F * > getHistoVector() const
bool fromDiscriminatorDistr
std::string baseNameDescription() const
TH1F * getTH1F(void) const
void psPlot(const std::string &name)
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 plot(TPad *theCanvas=0)
double upperBoundY() const
void compute(DQMStore::IBooker &ibook, std::vector< double > fixedEff)