15 using namespace RecoBTag;
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) :
38 fromDiscriminatorDistr(
true),
39 mcPlots_(mc), doCTagPlots_(
false), label_(label),
40 nBinOutputX(nBinX), startOutputX(startOX), endOutputX(endOX)
124 const int& dimHistos = discrCfHistos.size();
130 const int& nBinsX = dDiscriminatorFC->
nBinsX();
131 const int& nBinsY = dDiscriminatorFC->
nBinsY();
134 for (
int iFlav = 0; iFlav < dimHistos; iFlav++ ) {
135 if (discrCfHistos[iFlav] == 0)
continue;
136 discrNoCutHistos[iFlav]->SetXTitle (
"Discriminant A" );
137 discrNoCutHistos[iFlav]->GetXaxis()->SetTitleOffset ( 0.75 );
138 discrNoCutHistos[iFlav]->SetYTitle (
"Discriminant B" );
139 discrNoCutHistos[iFlav]->GetYaxis()->SetTitleOffset ( 0.75 );
143 const double& nJetsFlav = discrCfHistos[iFlav]->GetEntries ();
145 for (
int iDiscrX = nBinsX; iDiscrX > 0 ; --iDiscrX ) {
146 for (
int iDiscrY = nBinsY; iDiscrY > 0 ; --iDiscrY ) {
148 discrNoCutHistos[iFlav]->SetBinContent ( iDiscrX, iDiscrY, nJetsFlav );
149 discrNoCutHistos[iFlav]->SetBinError ( iDiscrX, iDiscrY,
sqrt(nJetsFlav) );
150 const double& sum = nJetsFlav - discrCfHistos[iFlav]->Integral( 0, iDiscrX-1, 0, iDiscrY-1 );
151 discrCutHistos[iFlav]->SetBinContent ( iDiscrX, iDiscrY, sum );
152 discrCutHistos[iFlav]->SetBinError ( iDiscrX, iDiscrY,
sqrt(sum) );
183 hX =
"FlavEffVsBEff";
187 hX =
"FlavEffVsCEff";
191 (
"Flavour misidentification vs. " + Title +
"-tagging efficiency " +
histoExtension).c_str());
203 gPad->UseCurrentStyle();
204 gPad->SetFillColor ( 0 );
206 gPad->SetGridx ( 1 );
207 gPad->SetGridy ( 1 );
246 const bool& lNBinsX =
247 ( (nBinsX_d == nBinsX_u &&
248 nBinsX_d == nBinsX_s &&
249 nBinsX_d == nBinsX_c &&
250 nBinsX_d == nBinsX_b &&
251 nBinsX_d == nBinsX_g &&
252 nBinsX_d == nBinsX_ni &&
253 nBinsX_d == nBinsX_dus &&
254 nBinsX_d == nBinsX_dusg)||
255 (nBinsX_c == nBinsX_b &&
256 nBinsX_c == nBinsX_dusg &&
257 nBinsX_c == nBinsX_ni &&
258 nBinsX_c == nBinsX_pu) );
260 const bool& lNBinsY =
261 ( (nBinsY_d == nBinsY_u &&
262 nBinsY_d == nBinsY_s &&
263 nBinsY_d == nBinsY_c &&
264 nBinsY_d == nBinsY_b &&
265 nBinsY_d == nBinsY_g &&
266 nBinsY_d == nBinsY_ni &&
267 nBinsY_d == nBinsY_dus &&
268 nBinsY_d == nBinsY_dusg)||
269 (nBinsY_c == nBinsY_b &&
270 nBinsY_c == nBinsY_dusg &&
271 nBinsY_c == nBinsY_ni &&
272 nBinsY_c == nBinsY_pu) );
274 if ( !lNBinsX || !lNBinsY ) {
276 <<
"Input histograms do not all have the same number of bins!\n";
299 ( (sBin_d == sBin_u &&
305 sBin_d == sBin_dus &&
306 sBin_d == sBin_dusg)||
308 sBin_c == sBin_dusg &&
310 sBin_c == sBin_pu) );
314 <<
"EffPurFromHistos::check() : Input histograms do not all have the same start bin!\n";
338 ( (eBin_d == eBin_u &&
344 eBin_d == eBin_dus &&
345 eBin_d == eBin_dusg)||
347 eBin_c == eBin_dusg &&
349 eBin_c == eBin_pu) );
353 <<
"EffPurFromHistos::check() : Input histograms do not all have the same end bin!\n";
360 if (!
mcPlots_ || fixedEff.size()<1) {
372 for (
unsigned int ieff=0; ieff<fixedEff.size(); ieff++){
373 std::string fixedEfficiency = std::to_string(fixedEff[ieff]);
374 fixedEfficiency.replace(1,1,
"_");
390 const int& nBinX = EffFlavVsXEff->
getTH1F()->GetNbinsX();
392 for (
int iBinX = 1; iBinX <= nBinX; iBinX++ ) {
393 const float& effBinWidthX = EffFlavVsXEff->
getTH1F()->GetBinWidth ( iBinX );
394 const float& effMidX = EffFlavVsXEff->
getTH1F()->GetBinCenter ( iBinX );
395 const float& effLeftX = effMidX - 0.5*effBinWidthX;
396 const float& effRightX = effMidX + 0.5*effBinWidthX;
398 vector<int> binClosest;
402 for (
unsigned int ieff = 0; ieff < binClosest.size(); ieff++){
403 const bool& binFound = ( binClosest[ieff] > 0 ) ;
double lowerBoundX() const
double lowerBoundY() const
TH2F * effVersusDiscr_dus
std::string baseNameTitle() const
std::string histoExtension
virtual MonitorElement * book1D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX)
std::unique_ptr< FlavourHistograms2D< double, double > > discrCutEfficScan
std::vector< MonitorElement * > X_vs_Y_eff_at_fixedZeff
double upperBoundX() const
void epsPlot(const std::string &name)
std::vector< TH2F * > getHistoVector() const
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, const unsigned int &mc, int nBinX=100, double startOX=0.05, double endOX=1.05)
bool fromDiscriminatorDistr
std::string baseNameDescription() const
TH1F * getTH1F(void) const
std::unique_ptr< FlavourHistograms2D< double, double > > discrNoCutEffic
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)
volatile std::atomic< bool > shutdown_flag false
TH2F * effVersusDiscr_dusg
void plot(TPad *theCanvas=0)
double upperBoundY() const
void compute(DQMStore::IBooker &ibook, std::vector< double > fixedEff)