CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

EffPurFromHistos Class Reference

#include <EffPurFromHistos.h>

List of all members.

Public Member Functions

void compute ()
FlavourHistograms< double > * discriminatorCutEfficScan () const
FlavourHistograms< double > * discriminatorNoCutEffic () const
 EffPurFromHistos (const FlavourHistograms< double > *dDiscriminatorFC, const std::string &label, const unsigned int &mc, int nBin=100, double startO=0.005, double endO=1.005)
 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, const std::string &label, const unsigned int &mc, int nBin=100, double startO=0.005, double endO=1.005)
void epsPlot (const std::string &name)
TH1F * getEffFlavVsBEff_b ()
TH1F * getEffFlavVsBEff_c ()
TH1F * getEffFlavVsBEff_d ()
TH1F * getEffFlavVsBEff_dus ()
TH1F * getEffFlavVsBEff_dusg ()
TH1F * getEffFlavVsBEff_g ()
TH1F * getEffFlavVsBEff_ni ()
TH1F * getEffFlavVsBEff_s ()
TH1F * getEffFlavVsBEff_u ()
void plot (const std::string &name, const std::string &ext)
void plot (TPad *theCanvas=0)
void psPlot (const std::string &name)
 ~EffPurFromHistos ()

Private Member Functions

void check ()

Private Attributes

FlavourHistograms< double > * discrCutEfficScan
FlavourHistograms< double > * discrNoCutEffic
MonitorElementEffFlavVsBEff_b
MonitorElementEffFlavVsBEff_c
MonitorElementEffFlavVsBEff_d
MonitorElementEffFlavVsBEff_dus
MonitorElementEffFlavVsBEff_dusg
MonitorElementEffFlavVsBEff_g
MonitorElementEffFlavVsBEff_ni
MonitorElementEffFlavVsBEff_s
MonitorElementEffFlavVsBEff_u
TH1F * effVersusDiscr_b
TH1F * effVersusDiscr_c
TH1F * effVersusDiscr_d
TH1F * effVersusDiscr_dus
TH1F * effVersusDiscr_dusg
TH1F * effVersusDiscr_g
TH1F * effVersusDiscr_ni
TH1F * effVersusDiscr_s
TH1F * effVersusDiscr_u
double endOutput
bool fromDiscriminatorDistr
std::string histoExtension
std::string label_
unsigned int mcPlots_
int nBinOutput
double startOutput

Detailed Description

Definition at line 14 of file EffPurFromHistos.h.


Constructor & Destructor Documentation

EffPurFromHistos::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,
const std::string &  label,
const unsigned int &  mc,
int  nBin = 100,
double  startO = 0.005,
double  endO = 1.005 
)

Definition at line 20 of file EffPurFromHistos.cc.

References check().

                                                                                                                           :
        //BTagPlotPrintC(),
        fromDiscriminatorDistr(false),
        histoExtension(ext), effVersusDiscr_d(h_d), effVersusDiscr_u(h_u),
        effVersusDiscr_s(h_s), effVersusDiscr_c(h_c), effVersusDiscr_b(h_b),
        effVersusDiscr_g(h_g), effVersusDiscr_ni(h_ni), effVersusDiscr_dus(h_dus),
        effVersusDiscr_dusg(h_dusg), nBinOutput(nBin), startOutput(startO),
        endOutput(endO),  mcPlots_(mc), label_(label)
{
  // consistency check
  check();
}
EffPurFromHistos::EffPurFromHistos ( const FlavourHistograms< double > *  dDiscriminatorFC,
const std::string &  label,
const unsigned int &  mc,
int  nBin = 100,
double  startO = 0.005,
double  endO = 1.005 
)

Definition at line 36 of file EffPurFromHistos.cc.

References FlavourHistograms< T >::baseNameDescription(), FlavourHistograms< T >::baseNameTitle(), FlavourHistograms< T >::divide(), FlavourHistograms< T >::getHistoVector(), FlavourHistograms< T >::histo_b(), FlavourHistograms< T >::histo_c(), FlavourHistograms< T >::histo_d(), FlavourHistograms< T >::histo_dus(), FlavourHistograms< T >::histo_dusg(), FlavourHistograms< T >::histo_g(), FlavourHistograms< T >::histo_ni(), FlavourHistograms< T >::histo_s(), FlavourHistograms< T >::histo_u(), diffTwoXMLs::label, FlavourHistograms< T >::lowerBound(), FlavourHistograms< T >::nBins(), FlavourHistograms< T >::SetMinimum(), mathSSE::sqrt(), and FlavourHistograms< T >::upperBound().

                                    :
          fromDiscriminatorDistr(true), nBinOutput(nBin), startOutput(startO), endOutput(endO),  mcPlots_(mc), label_(label){
  histoExtension = "_"+dDiscriminatorFC->baseNameTitle();


  discrNoCutEffic = new FlavourHistograms<double> (
        "totalEntries" + histoExtension, "Total Entries: " + dDiscriminatorFC->baseNameDescription(),
        dDiscriminatorFC->nBins(), dDiscriminatorFC->lowerBound(),
        dDiscriminatorFC->upperBound(), false, true, false, "b", false, label, mcPlots_ );

  // conditional discriminator cut for efficiency histos

  discrCutEfficScan = new FlavourHistograms<double> (
        "effVsDiscrCut" + histoExtension, "Eff. vs Disc. Cut: " + dDiscriminatorFC->baseNameDescription(),
        dDiscriminatorFC->nBins(), dDiscriminatorFC->lowerBound(),
        dDiscriminatorFC->upperBound(), false, true, false, "b", false, label , mcPlots_ );
  discrCutEfficScan->SetMinimum(1E-4);
  if (mcPlots_){ 

    if(mcPlots_>2){
      effVersusDiscr_d =    discrCutEfficScan->histo_d   ();
      effVersusDiscr_u =    discrCutEfficScan->histo_u   ();
      effVersusDiscr_s =    discrCutEfficScan->histo_s   ();
      effVersusDiscr_g =    discrCutEfficScan->histo_g   ();
      effVersusDiscr_dus =  discrCutEfficScan->histo_dus ();
    }
    else{
      effVersusDiscr_d   =  0;
      effVersusDiscr_u   =  0; 
      effVersusDiscr_s   =  0;
      effVersusDiscr_g   =  0;
      effVersusDiscr_dus =  0;
    }
    effVersusDiscr_c =    discrCutEfficScan->histo_c   ();
    effVersusDiscr_b =    discrCutEfficScan->histo_b   ();
    effVersusDiscr_ni =   discrCutEfficScan->histo_ni  ();
    effVersusDiscr_dusg = discrCutEfficScan->histo_dusg();

  
    if(mcPlots_>2){
      effVersusDiscr_d->SetXTitle ( "Discriminant" );
      effVersusDiscr_d->GetXaxis()->SetTitleOffset ( 0.75 );
      effVersusDiscr_u->SetXTitle ( "Discriminant" );
      effVersusDiscr_u->GetXaxis()->SetTitleOffset ( 0.75 );
      effVersusDiscr_s->SetXTitle ( "Discriminant" );
      effVersusDiscr_s->GetXaxis()->SetTitleOffset ( 0.75 );
      effVersusDiscr_g->SetXTitle ( "Discriminant" );
      effVersusDiscr_g->GetXaxis()->SetTitleOffset ( 0.75 );
      effVersusDiscr_dus->SetXTitle ( "Discriminant" );
      effVersusDiscr_dus->GetXaxis()->SetTitleOffset ( 0.75 );
    }
    effVersusDiscr_c->SetXTitle ( "Discriminant" );
    effVersusDiscr_c->GetXaxis()->SetTitleOffset ( 0.75 );
    effVersusDiscr_b->SetXTitle ( "Discriminant" );
    effVersusDiscr_b->GetXaxis()->SetTitleOffset ( 0.75 );
    effVersusDiscr_ni->SetXTitle ( "Discriminant" );
    effVersusDiscr_ni->GetXaxis()->SetTitleOffset ( 0.75 );
    effVersusDiscr_dusg->SetXTitle ( "Discriminant" );
    effVersusDiscr_dusg->GetXaxis()->SetTitleOffset ( 0.75 );
  }
  else{
    effVersusDiscr_d =    0;
    effVersusDiscr_u =    0; 
    effVersusDiscr_s =    0;
    effVersusDiscr_c =    0; 
    effVersusDiscr_b =    0;
    effVersusDiscr_g =    0;
    effVersusDiscr_ni =   0;
    effVersusDiscr_dus =  0;
    effVersusDiscr_dusg = 0;
  }

  // discr. for computation
  vector<TH1F*> discrCfHistos = dDiscriminatorFC->getHistoVector();

  // discr no cut
  vector<TH1F*> discrNoCutHistos = discrNoCutEffic->getHistoVector();

  // discr no cut
  vector<TH1F*> discrCutHistos = discrCutEfficScan->getHistoVector();

  const int& dimHistos = discrCfHistos.size(); // they all have the same size

  // DISCR-CUT LOOP:
  // fill the histos for eff-pur computations by scanning the discriminatorFC histogram

  // better to loop over bins -> discrCut no longer needed
  const int& nBins = dDiscriminatorFC->nBins();

  // loop over flavours
  for ( int iFlav = 0; iFlav < dimHistos; iFlav++ ) {
    if (discrCfHistos[iFlav] == 0) continue;
    discrNoCutHistos[iFlav]->SetXTitle ( "Discriminant" );
    discrNoCutHistos[iFlav]->GetXaxis()->SetTitleOffset ( 0.75 );

    // In Root histos, bin counting starts at 1 to nBins.
    // bin 0 is the underflow, and nBins+1 is the overflow.
    const double& nJetsFlav = discrCfHistos[iFlav]->GetEntries ();
    double sum = discrCfHistos[iFlav]->GetBinContent( nBins+1 ); //+1 to get the overflow.
    
    for ( int iDiscr = nBins; iDiscr > 0 ; --iDiscr ) {
      // fill all jets into NoCut histo
      discrNoCutHistos[iFlav]->SetBinContent ( iDiscr, nJetsFlav );
      discrNoCutHistos[iFlav]->SetBinError   ( iDiscr, sqrt(nJetsFlav) );
      sum += discrCfHistos[iFlav]->GetBinContent( iDiscr );
      discrCutHistos[iFlav]->SetBinContent ( iDiscr, sum );
      discrCutHistos[iFlav]->SetBinError   ( iDiscr, sqrt(sum) );
    }
  }


  // divide to get efficiency vs. discriminator cut from absolute numbers
  discrCutEfficScan->divide ( *discrNoCutEffic );  // does: histos including discriminator cut / flat histo
}
EffPurFromHistos::~EffPurFromHistos ( )

Definition at line 153 of file EffPurFromHistos.cc.

                                     {
  /*  delete EffFlavVsBEff_d   ;
  delete EffFlavVsBEff_u   ;
  delete EffFlavVsBEff_s   ;
  delete EffFlavVsBEff_c   ;
  delete EffFlavVsBEff_b   ;
  delete EffFlavVsBEff_g   ;
  delete EffFlavVsBEff_ni  ;
  delete EffFlavVsBEff_dus ;
  delete EffFlavVsBEff_dusg;
  if ( fromDiscriminatorDistr) {
    delete discrNoCutEffic;
    delete discrCutEfficScan;
    }*/
}

Member Function Documentation

void EffPurFromHistos::check ( ) [private]

Definition at line 327 of file EffPurFromHistos.cc.

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

Referenced by EffPurFromHistos().

                              {
  // number of bins

  int nBins_d    = 0;
  int nBins_u    = 0;
  int nBins_s    = 0;
  int nBins_g    = 0;
  int nBins_dus  = 0;
  if(mcPlots_>2){
    nBins_d    = effVersusDiscr_d    -> GetNbinsX();
    nBins_u    = effVersusDiscr_u    -> GetNbinsX();
    nBins_s    = effVersusDiscr_s    -> GetNbinsX();
    nBins_g    = effVersusDiscr_g    -> GetNbinsX();
    nBins_dus  = effVersusDiscr_dus  -> GetNbinsX();
  }
  const int& nBins_c    = effVersusDiscr_c    -> GetNbinsX();
  const int& nBins_b    = effVersusDiscr_b    -> GetNbinsX();
  const int& nBins_ni   = effVersusDiscr_ni   -> GetNbinsX();
  const int& nBins_dusg = effVersusDiscr_dusg -> GetNbinsX();

  const bool& lNBins =
    ( (nBins_d == nBins_u    &&
       nBins_d == nBins_s    &&
       nBins_d == nBins_c    &&
       nBins_d == nBins_b    &&
       nBins_d == nBins_g    &&
       nBins_d == nBins_ni   &&
       nBins_d == nBins_dus  &&
       nBins_d == nBins_dusg)||
      (nBins_c == nBins_b    &&
       nBins_c == nBins_dusg &&
       nBins_c == nBins_ni)    );

  if ( !lNBins ) {
    throw cms::Exception("Configuration")
      << "Input histograms do not all have the same number of bins!\n";
  }


  // start
  float sBin_d    = 0;
  float sBin_u    = 0;
  float sBin_s    = 0;
  float sBin_g    = 0;
  float sBin_dus  = 0;
  if(mcPlots_>2){
    sBin_d    = effVersusDiscr_d    -> GetBinCenter(1);
    sBin_u    = effVersusDiscr_u    -> GetBinCenter(1);
    sBin_s    = effVersusDiscr_s    -> GetBinCenter(1);
    sBin_g    = effVersusDiscr_g    -> GetBinCenter(1);
    sBin_dus  = effVersusDiscr_dus  -> GetBinCenter(1);
  }
  const float& sBin_c    = effVersusDiscr_c    -> GetBinCenter(1);
  const float& sBin_b    = effVersusDiscr_b    -> GetBinCenter(1);
  const float& sBin_ni   = effVersusDiscr_ni   -> GetBinCenter(1);
  const float& sBin_dusg = effVersusDiscr_dusg -> GetBinCenter(1);

  const bool& lSBin =
    ( (sBin_d == sBin_u    &&
       sBin_d == sBin_s    &&
       sBin_d == sBin_c    &&
       sBin_d == sBin_b    &&
       sBin_d == sBin_g    &&
       sBin_d == sBin_ni   &&
       sBin_d == sBin_dus  &&
       sBin_d == sBin_dusg)||
      (sBin_c == sBin_b    &&
       sBin_c == sBin_dusg &&
       sBin_c == sBin_ni)    );

  if ( !lSBin ) {
    throw cms::Exception("Configuration")
      << "EffPurFromHistos::check() : Input histograms do not all have the same start bin!\n";
  }


  // end
  float eBin_d    = 0;
  float eBin_u    = 0;
  float eBin_s    = 0;
  float eBin_g    = 0;
  float eBin_dus  = 0;
  if(mcPlots_>2){
    eBin_d    = effVersusDiscr_d    -> GetBinCenter( nBins_d - 1 );
    eBin_u    = effVersusDiscr_u    -> GetBinCenter( nBins_d - 1 );
    eBin_s    = effVersusDiscr_s    -> GetBinCenter( nBins_d - 1 );
    eBin_g    = effVersusDiscr_g    -> GetBinCenter( nBins_d - 1 );
    eBin_dus  = effVersusDiscr_dus  -> GetBinCenter( nBins_d - 1 );
  }
  const float& eBin_c    = effVersusDiscr_c    -> GetBinCenter( nBins_d - 1 );
  const float& eBin_b    = effVersusDiscr_b    -> GetBinCenter( nBins_d - 1 );
  const float& eBin_ni   = effVersusDiscr_ni   -> GetBinCenter( nBins_d - 1 );
  const float& eBin_dusg = effVersusDiscr_dusg -> GetBinCenter( nBins_d - 1 );

  const bool& lEBin =
    ( (eBin_d == eBin_u    &&
       eBin_d == eBin_s    &&
       eBin_d == eBin_c    &&
       eBin_d == eBin_b    &&
       eBin_d == eBin_g    &&
       eBin_d == eBin_ni   &&
       eBin_d == eBin_dus  &&
       eBin_d == eBin_dusg)||
      (eBin_c == eBin_b    &&
       eBin_c == eBin_dusg &&
       eBin_c == eBin_ni)     );

  if ( !lEBin ) {
    throw cms::Exception("Configuration")
      << "EffPurFromHistos::check() : Input histograms do not all have the same end bin!\n";
  }
}
void EffPurFromHistos::compute ( )

Definition at line 441 of file EffPurFromHistos.cc.

References HistoProviderDQM::book1D(), EffFlavVsBEff_b, EffFlavVsBEff_c, EffFlavVsBEff_d, EffFlavVsBEff_dus, EffFlavVsBEff_dusg, EffFlavVsBEff_g, EffFlavVsBEff_ni, EffFlavVsBEff_s, EffFlavVsBEff_u, effVersusDiscr_b, effVersusDiscr_c, effVersusDiscr_d, effVersusDiscr_dus, effVersusDiscr_dusg, effVersusDiscr_g, effVersusDiscr_ni, effVersusDiscr_s, effVersusDiscr_u, endOutput, HcalObjRepresent::Fill(), RecoBTag::findBinClosestYValue(), MonitorElement::getTH1F(), histoExtension, label_, mcPlots_, cuy::nBinB, nBinOutput, startOutput, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by JetTagPlotter::finalize().

{
  if (!mcPlots_) {

    EffFlavVsBEff_d = 0;
    EffFlavVsBEff_u = 0; 
    EffFlavVsBEff_s = 0; 
    EffFlavVsBEff_c = 0; 
    EffFlavVsBEff_b = 0; 
    EffFlavVsBEff_g = 0; 
    EffFlavVsBEff_ni = 0; 
    EffFlavVsBEff_dus = 0; 
    EffFlavVsBEff_dusg = 0; 
    
    return; 
 
  }
 

  // to have shorter names ......
  const std::string & hE = histoExtension;
  const std::string & hB = "FlavEffVsBEff_";


  // create histograms from base name and extension as given from user
  // BINNING MUST BE IDENTICAL FOR ALL OF THEM!!
  HistoProviderDQM prov("Btag",label_);
  if(mcPlots_>2){
    EffFlavVsBEff_d    = (prov.book1D ( hB + "D"    + hE , hB + "D"    + hE , nBinOutput , startOutput , endOutput ));
    EffFlavVsBEff_u    = (prov.book1D ( hB + "U"    + hE , hB + "U"    + hE , nBinOutput , startOutput , endOutput )) ;
    EffFlavVsBEff_s    = (prov.book1D ( hB + "S"    + hE , hB + "S"    + hE , nBinOutput , startOutput , endOutput )) ;
    EffFlavVsBEff_g    = (prov.book1D ( hB + "G"    + hE , hB + "G"    + hE , nBinOutput , startOutput , endOutput )) ;
    EffFlavVsBEff_dus  = (prov.book1D ( hB + "DUS"  + hE , hB + "DUS"  + hE , nBinOutput , startOutput , endOutput )) ;
  }
  else {
    EffFlavVsBEff_d = 0;
    EffFlavVsBEff_u = 0;
    EffFlavVsBEff_s = 0;
    EffFlavVsBEff_g = 0;
    EffFlavVsBEff_dus = 0;
  }
  EffFlavVsBEff_c    = (prov.book1D ( hB + "C"    + hE , hB + "C"    + hE , nBinOutput , startOutput , endOutput )) ;
  EffFlavVsBEff_b    = (prov.book1D ( hB + "B"    + hE , hB + "B"    + hE , nBinOutput , startOutput , endOutput )) ;
  EffFlavVsBEff_ni   = (prov.book1D ( hB + "NI"   + hE , hB + "NI"   + hE , nBinOutput , startOutput , endOutput )) ;
  EffFlavVsBEff_dusg = (prov.book1D ( hB + "DUSG" + hE , hB + "DUSG" + hE , nBinOutput , startOutput , endOutput )) ;

  if(mcPlots_>2){
    EffFlavVsBEff_d->getTH1F()->SetXTitle ( "b-jet efficiency" );
    EffFlavVsBEff_d->getTH1F()->SetYTitle ( "non b-jet efficiency" );
    EffFlavVsBEff_d->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_d->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_u->getTH1F()->SetXTitle ( "b-jet efficiency" );
    EffFlavVsBEff_u->getTH1F()->SetYTitle ( "non b-jet efficiency" );
    EffFlavVsBEff_u->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_u->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_s->getTH1F()->SetXTitle ( "b-jet efficiency" );
    EffFlavVsBEff_s->getTH1F()->SetYTitle ( "non b-jet efficiency" );
    EffFlavVsBEff_s->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_s->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_g->getTH1F()->SetXTitle ( "b-jet efficiency" );
    EffFlavVsBEff_g->getTH1F()->SetYTitle ( "non b-jet efficiency" );
    EffFlavVsBEff_g->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_g->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_dus->getTH1F()->SetXTitle ( "b-jet efficiency" );
    EffFlavVsBEff_dus->getTH1F()->SetYTitle ( "non b-jet efficiency" );
    EffFlavVsBEff_dus->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
    EffFlavVsBEff_dus->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
  }
  EffFlavVsBEff_c->getTH1F()->SetXTitle ( "b-jet efficiency" );
  EffFlavVsBEff_c->getTH1F()->SetYTitle ( "non b-jet efficiency" );
  EffFlavVsBEff_c->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
  EffFlavVsBEff_c->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
  EffFlavVsBEff_b->getTH1F()->SetXTitle ( "b-jet efficiency" );
  EffFlavVsBEff_b->getTH1F()->SetYTitle ( "b-jet efficiency" );
  EffFlavVsBEff_b->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
  EffFlavVsBEff_b->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
  EffFlavVsBEff_ni->getTH1F()->SetXTitle ( "b-jet efficiency" );
  EffFlavVsBEff_ni->getTH1F()->SetYTitle ( "non b-jet efficiency" );
  EffFlavVsBEff_ni->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
  EffFlavVsBEff_ni->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );
  EffFlavVsBEff_dusg->getTH1F()->SetXTitle ( "b-jet efficiency" );
  EffFlavVsBEff_dusg->getTH1F()->SetYTitle ( "non b-jet efficiency" );
  EffFlavVsBEff_dusg->getTH1F()->GetXaxis()->SetTitleOffset ( 0.75 );
  EffFlavVsBEff_dusg->getTH1F()->GetYaxis()->SetTitleOffset ( 0.75 );


  // loop over eff. vs. discriminator cut b-histo and look in which bin the closest entry is;
  // use fact that eff decreases monotonously

  // any of the histos to be created can be taken here:
  MonitorElement * EffFlavVsBEff = EffFlavVsBEff_b;

  const int& nBinB = EffFlavVsBEff->getTH1F()->GetNbinsX();

  for ( int iBinB = 1; iBinB <= nBinB; iBinB++ ) {  // loop over the bins on the x-axis of the histograms to be filled

    const float& effBBinWidth = EffFlavVsBEff->getTH1F()->GetBinWidth  ( iBinB );
    const float& effBMid      = EffFlavVsBEff->getTH1F()->GetBinCenter ( iBinB ); // middle of b-efficiency bin
    const float& effBLeft     = effBMid - 0.5*effBBinWidth;              // left edge of bin
    const float& effBRight    = effBMid + 0.5*effBBinWidth;              // right edge of bin
    // find the corresponding bin in the efficiency versus discriminator cut histo: closest one in efficiency
    const int&   binClosest = findBinClosestYValue ( effVersusDiscr_b , effBMid , effBLeft , effBRight );
    const bool&  binFound   = ( binClosest > 0 ) ;
    //
    if ( binFound ) {
      // fill the histos
      if(mcPlots_>2){
        EffFlavVsBEff_d    -> Fill ( effBMid , effVersusDiscr_d   ->GetBinContent ( binClosest ) );
        EffFlavVsBEff_u    -> Fill ( effBMid , effVersusDiscr_u   ->GetBinContent ( binClosest ) );
        EffFlavVsBEff_s    -> Fill ( effBMid , effVersusDiscr_s   ->GetBinContent ( binClosest ) );
        EffFlavVsBEff_g    -> Fill ( effBMid , effVersusDiscr_g   ->GetBinContent ( binClosest ) );
        EffFlavVsBEff_dus  -> Fill ( effBMid , effVersusDiscr_dus ->GetBinContent ( binClosest ) );
      }
      EffFlavVsBEff_c    -> Fill ( effBMid , effVersusDiscr_c   ->GetBinContent ( binClosest ) );
      EffFlavVsBEff_b    -> Fill ( effBMid , effVersusDiscr_b   ->GetBinContent ( binClosest ) );
      EffFlavVsBEff_ni   -> Fill ( effBMid , effVersusDiscr_ni  ->GetBinContent ( binClosest ) );
      EffFlavVsBEff_dusg -> Fill ( effBMid , effVersusDiscr_dusg->GetBinContent ( binClosest ) );

      if(mcPlots_>2){
        EffFlavVsBEff_d  ->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_d   ->GetBinError ( binClosest ) );
        EffFlavVsBEff_u  ->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_u   ->GetBinError ( binClosest ) );
        EffFlavVsBEff_s  ->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_s   ->GetBinError ( binClosest ) );
        EffFlavVsBEff_g  ->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_g   ->GetBinError ( binClosest ) );
        EffFlavVsBEff_dus->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_dus ->GetBinError ( binClosest ) );
      }
      EffFlavVsBEff_c  ->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_c   ->GetBinError ( binClosest ) );
      EffFlavVsBEff_b  ->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_b   ->GetBinError ( binClosest ) );
      EffFlavVsBEff_ni ->getTH1F()  -> SetBinError ( iBinB , effVersusDiscr_ni  ->GetBinError ( binClosest ) );
      EffFlavVsBEff_dusg->getTH1F() -> SetBinError ( iBinB , effVersusDiscr_dusg->GetBinError ( binClosest ) );
    }
    else {
      //cout << "Did not find right bin for b-efficiency : " << effBMid << endl;
    }
    
  }
  
}
FlavourHistograms<double>* EffPurFromHistos::discriminatorCutEfficScan ( ) const [inline]
FlavourHistograms<double>* EffPurFromHistos::discriminatorNoCutEffic ( ) const [inline]
void EffPurFromHistos::epsPlot ( const std::string &  name)
TH1F* EffPurFromHistos::getEffFlavVsBEff_b ( ) [inline]

Definition at line 40 of file EffPurFromHistos.h.

References EffFlavVsBEff_b, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_b ->getTH1F()   ; };
TH1F* EffPurFromHistos::getEffFlavVsBEff_c ( ) [inline]

Definition at line 39 of file EffPurFromHistos.h.

References EffFlavVsBEff_c, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_c ->getTH1F()   ; };
TH1F* EffPurFromHistos::getEffFlavVsBEff_d ( ) [inline]

Definition at line 35 of file EffPurFromHistos.h.

References EffFlavVsBEff_d, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

                                  { 
    return EffFlavVsBEff_d->getTH1F()    ; };
TH1F* EffPurFromHistos::getEffFlavVsBEff_dus ( ) [inline]

Definition at line 43 of file EffPurFromHistos.h.

References EffFlavVsBEff_dus, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_dus ->getTH1F() ; };
TH1F* EffPurFromHistos::getEffFlavVsBEff_dusg ( ) [inline]

Definition at line 44 of file EffPurFromHistos.h.

References EffFlavVsBEff_dusg, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_dusg ->getTH1F(); };
TH1F* EffPurFromHistos::getEffFlavVsBEff_g ( ) [inline]

Definition at line 41 of file EffPurFromHistos.h.

References EffFlavVsBEff_g, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_g ->getTH1F()   ; };
TH1F* EffPurFromHistos::getEffFlavVsBEff_ni ( ) [inline]

Definition at line 42 of file EffPurFromHistos.h.

References EffFlavVsBEff_ni, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_ni ->getTH1F()  ; };
TH1F* EffPurFromHistos::getEffFlavVsBEff_s ( ) [inline]

Definition at line 38 of file EffPurFromHistos.h.

References EffFlavVsBEff_s, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_s ->getTH1F()   ; };
TH1F* EffPurFromHistos::getEffFlavVsBEff_u ( ) [inline]

Definition at line 37 of file EffPurFromHistos.h.

References EffFlavVsBEff_u, and MonitorElement::getTH1F().

Referenced by BTagDifferentialPlot::fillHisto().

{ return EffFlavVsBEff_u->getTH1F()    ; };
void EffPurFromHistos::plot ( TPad *  theCanvas = 0)

Definition at line 194 of file EffPurFromHistos.cc.

References alignCSCRings::e, EffFlavVsBEff_b, EffFlavVsBEff_c, EffFlavVsBEff_d, EffFlavVsBEff_dus, EffFlavVsBEff_dusg, EffFlavVsBEff_g, EffFlavVsBEff_ni, EffFlavVsBEff_s, EffFlavVsBEff_u, MonitorElement::getTH1F(), mcPlots_, and plotscripts::setTDRStyle().

Referenced by epsPlot(), plot(), JetTagPlotter::psPlot(), TrackCountingTagPlotter::psPlot(), TrackIPTagPlotter::psPlot(), TrackProbabilityTagPlotter::psPlot(), and psPlot().

                                                {

//fixme:
  bool btppNI = false;
  bool btppColour = true;

//   if ( !btppTitle ) gStyle->SetOptTitle ( 0 );
  setTDRStyle()->cd();

  if (plotCanvas)
    plotCanvas->cd();
  
  gPad->UseCurrentStyle();
  gPad->SetFillColor ( 0 );
  gPad->SetLogy  ( 1 );
  gPad->SetGridx ( 1 );
  gPad->SetGridy ( 1 );

  int col_c  ;
  int col_g  ;
  int col_dus;
  int col_ni ;

  int mStyle_c  ;
  int mStyle_g  ;
  int mStyle_dus;
  int mStyle_ni ;

  // marker size (same for all)
  float mSize = gPad->GetWh() * gPad->GetHNDC() / 500.; //1.2;

  if ( btppColour ) {
    col_c    = 6;
    col_g    = 3; // g in green
    col_dus  = 4; // uds in blue
    col_ni   = 5; // ni in ??
    mStyle_c   = 20;
    mStyle_g   = 20;
    mStyle_dus = 20;
    mStyle_ni  = 20;
  }
  else {
    col_c    = 1;
    col_g    = 1;
    col_dus  = 1;
    col_ni   = 1;
    mStyle_c   = 22;
    mStyle_g   = 29;
    mStyle_dus = 20;
    mStyle_ni  = 27;
  }


  // for the moment: plot c,dus,g
  if(mcPlots_>2){
    EffFlavVsBEff_dus ->getTH1F()->GetXaxis()->SetTitle ( "b-jet efficiency" );
    EffFlavVsBEff_dus ->getTH1F()->GetYaxis()->SetTitle ( "non b-jet efficiency" );
    EffFlavVsBEff_dus ->getTH1F()->GetYaxis()->SetTitleOffset ( 0.25 );
    EffFlavVsBEff_dus ->getTH1F()->SetMaximum     ( 1.1 );
    EffFlavVsBEff_dus ->getTH1F()->SetMinimum     ( 1.e-5 );
    EffFlavVsBEff_dus ->getTH1F()->SetMarkerColor ( col_dus );
    EffFlavVsBEff_dus ->getTH1F()->SetLineColor   ( col_dus );
    EffFlavVsBEff_dus ->getTH1F()->SetMarkerSize  ( mSize );
    EffFlavVsBEff_dus ->getTH1F()->SetMarkerStyle ( mStyle_dus );
    EffFlavVsBEff_dus ->getTH1F()->SetStats     ( false );
    EffFlavVsBEff_dus ->getTH1F()->Draw("pe");

    EffFlavVsBEff_g   ->getTH1F()->SetMarkerColor ( col_g );
    EffFlavVsBEff_g   ->getTH1F()->SetLineColor   ( col_g );
    EffFlavVsBEff_g   ->getTH1F()->SetMarkerSize  ( mSize );
    EffFlavVsBEff_g   ->getTH1F()->SetMarkerStyle ( mStyle_g );
    EffFlavVsBEff_g   ->getTH1F()->SetStats     ( false );
    EffFlavVsBEff_g   ->getTH1F()->Draw("peSame");
  }
  EffFlavVsBEff_c   ->getTH1F()->SetMarkerColor ( col_c );
  EffFlavVsBEff_c   ->getTH1F()->SetLineColor   ( col_c );
  EffFlavVsBEff_c   ->getTH1F()->SetMarkerSize  ( mSize );
  EffFlavVsBEff_c   ->getTH1F()->SetMarkerStyle ( mStyle_c );
  EffFlavVsBEff_c   ->getTH1F()->SetStats     ( false );
  EffFlavVsBEff_c   ->getTH1F()->Draw("peSame");

  if(mcPlots_>2){
    EffFlavVsBEff_d ->getTH1F()-> SetMinimum(0.01);
    EffFlavVsBEff_u ->getTH1F()-> SetMinimum(0.01);
    EffFlavVsBEff_s ->getTH1F()-> SetMinimum(0.01);
    EffFlavVsBEff_g ->getTH1F()-> SetMinimum(0.01);
    EffFlavVsBEff_dus ->getTH1F()-> SetMinimum(0.01);
  }
  EffFlavVsBEff_c ->getTH1F()-> SetMinimum(0.01);
  EffFlavVsBEff_b ->getTH1F()-> SetMinimum(0.01);
  EffFlavVsBEff_ni ->getTH1F()-> SetMinimum(0.01);
  EffFlavVsBEff_dusg ->getTH1F()-> SetMinimum(0.01);

  // plot separately u,d and s
//  EffFlavVsBEff_d ->GetXaxis()->SetTitle ( "b-jet efficiency" );
//  EffFlavVsBEff_d ->GetYaxis()->SetTitle ( "non b-jet efficiency" );
//  EffFlavVsBEff_d ->GetYaxis()->SetTitleOffset ( 1.25 );
//  EffFlavVsBEff_d ->SetMaximum     ( 1.1 );
//  EffFlavVsBEff_d ->SetMinimum     ( 1.e-5 );
//  EffFlavVsBEff_d ->SetMarkerColor ( col_dus );
//  EffFlavVsBEff_d ->SetLineColor   ( col_dus );
//  EffFlavVsBEff_d ->SetMarkerSize  ( mSize );
//  EffFlavVsBEff_d ->SetMarkerStyle ( mStyle_dus );
//  EffFlavVsBEff_d ->SetStats     ( false );
//  EffFlavVsBEff_d ->Draw("pe");
//
//  EffFlavVsBEff_u   ->SetMarkerColor ( col_g );
//  EffFlavVsBEff_u   ->SetLineColor   ( col_g );
//  EffFlavVsBEff_u   ->SetMarkerSize  ( mSize );
//  EffFlavVsBEff_u   ->SetMarkerStyle ( mStyle_g );
//  EffFlavVsBEff_u   ->SetStats     ( false );
//  EffFlavVsBEff_u   ->Draw("peSame");
//
//  EffFlavVsBEff_s   ->SetMarkerColor ( col_c );
//  EffFlavVsBEff_s   ->SetLineColor   ( col_c );
//  EffFlavVsBEff_s   ->SetMarkerSize  ( mSize );
//  EffFlavVsBEff_s   ->SetMarkerStyle ( mStyle_c );
//  EffFlavVsBEff_s   ->SetStats     ( false );
//  EffFlavVsBEff_s   ->Draw("peSame");

  // only if asked: NI
  if ( btppNI ) {
    EffFlavVsBEff_ni   ->getTH1F()->SetMarkerColor ( col_ni );
    EffFlavVsBEff_ni   ->getTH1F()->SetLineColor   ( col_ni );
    EffFlavVsBEff_ni   ->getTH1F()->SetMarkerSize  ( mSize );
    EffFlavVsBEff_ni   ->getTH1F()->SetMarkerStyle ( mStyle_ni );
    EffFlavVsBEff_ni   ->getTH1F()->SetStats     ( false );
    EffFlavVsBEff_ni   ->getTH1F()->Draw("peSame");
  }

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

Definition at line 186 of file EffPurFromHistos.cc.

References histoExtension, and plot().

{
   TCanvas tc (("FlavEffVsBEff" +histoExtension).c_str() ,
        ("Flavour misidentification vs. b-tagging efficiency " + histoExtension).c_str());
   plot(&tc);
   tc.Print((name + "FlavEffVsBEff" + histoExtension + ext).c_str());
}
void EffPurFromHistos::psPlot ( const std::string &  name)

Definition at line 181 of file EffPurFromHistos.cc.

References plot().

{
  plot(name, ".ps");
}

Member Data Documentation

Definition at line 72 of file EffPurFromHistos.h.

Referenced by discriminatorCutEfficScan(), and epsPlot().

Definition at line 72 of file EffPurFromHistos.h.

Referenced by discriminatorNoCutEffic(), and epsPlot().

Definition at line 103 of file EffPurFromHistos.h.

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

Definition at line 102 of file EffPurFromHistos.h.

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

Definition at line 99 of file EffPurFromHistos.h.

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

Definition at line 106 of file EffPurFromHistos.h.

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

Definition at line 107 of file EffPurFromHistos.h.

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

Definition at line 104 of file EffPurFromHistos.h.

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

Definition at line 105 of file EffPurFromHistos.h.

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

Definition at line 101 of file EffPurFromHistos.h.

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

Definition at line 100 of file EffPurFromHistos.h.

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

Definition at line 82 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 81 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 78 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 85 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 86 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 83 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 84 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 80 of file EffPurFromHistos.h.

Referenced by check(), and compute().

Definition at line 79 of file EffPurFromHistos.h.

Referenced by check(), and compute().

double EffPurFromHistos::endOutput [private]

Definition at line 94 of file EffPurFromHistos.h.

Referenced by compute().

Definition at line 66 of file EffPurFromHistos.h.

Referenced by epsPlot().

std::string EffPurFromHistos::histoExtension [private]

Definition at line 70 of file EffPurFromHistos.h.

Referenced by compute(), and plot().

std::string EffPurFromHistos::label_ [private]

Definition at line 110 of file EffPurFromHistos.h.

Referenced by compute().

unsigned int EffPurFromHistos::mcPlots_ [private]

Definition at line 96 of file EffPurFromHistos.h.

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

Definition at line 92 of file EffPurFromHistos.h.

Referenced by compute().

Definition at line 93 of file EffPurFromHistos.h.

Referenced by compute().