Skip to content

Commit

Permalink
Add setEfficiencyFlag for efficiency histos.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien committed Jun 24, 2015
1 parent 0672666 commit f8a758d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
26 changes: 22 additions & 4 deletions DQMOffline/RecoB/interface/FlavourHistorgrams.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ class FlavourHistograms {

void epsPlot(const std::string& name);

// needed for efficiency computations -> this / b
// (void : alternative would be not to overwrite the histos but to return a cloned HistoDescription)
//void divide ( const FlavourHistograms<T> & bHD ) const ;
void divide ( const FlavourHistograms<T> & bHD ) ;
void setEfficiencyFlag();

inline void SetMaximum(const double& max) { theMax = max;}
inline void SetMinimum(const double& min) { theMin = min;}
Expand Down Expand Up @@ -528,7 +526,7 @@ void FlavourHistograms<T>::ComputeEfficiency(TH1F* num, TH1F* den, int bin){
double errVal = 0.;
if (den->GetBinContent(bin)>0) {
effVal = num->GetBinContent(bin)/den->GetBinContent(bin);
errVal = ClopperPearsonUnc(a, b, bin);
errVal = ClopperPearsonUnc(num, den, bin);
}
num->SetBinContent(bin, effVal);
num->SetBinError(bin, errVal);
Expand All @@ -555,6 +553,26 @@ void FlavourHistograms<T>::divide ( const FlavourHistograms<T> & bHD ) {
}
}

template <class T>
void FlavourHistograms<T>::setEfficiencyFlag(){
if(theHisto_all) theHisto_all ->setEfficiencyFlag();
if (mcPlots_) {
if (mcPlots_>2 ) {
theHisto_d ->setEfficiencyFlag();
theHisto_u ->setEfficiencyFlag();
theHisto_s ->setEfficiencyFlag();
theHisto_g ->setEfficiencyFlag();
theHisto_dus ->setEfficiencyFlag();
}
theHisto_c ->setEfficiencyFlag();
theHisto_b ->setEfficiencyFlag();
theHisto_ni ->setEfficiencyFlag();
theHisto_dusg ->setEfficiencyFlag();
theHisto_pu ->setEfficiencyFlag();
}

}

template <class T>
void FlavourHistograms<T>::fillVariable ( const int & flavour , const T & var , const T & w) const {

Expand Down
11 changes: 11 additions & 0 deletions DQMOffline/RecoB/src/EffPurFromHistos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ EffPurFromHistos::EffPurFromHistos (const FlavourHistograms<double> * dDiscrimin

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


Expand Down Expand Up @@ -478,10 +479,15 @@ void EffPurFromHistos::compute (DQMStore::IBooker & ibook)
HistoProviderDQM prov("Btag",label_,ibook);
if(mcPlots_>2){
EffFlavVsBEff_d = (prov.book1D ( hB + "D" + hE , hB + "D" + hE , nBinOutput , startOutput , endOutput ));
EffFlavVsBEff_d->setEfficiencyFlag();
EffFlavVsBEff_u = (prov.book1D ( hB + "U" + hE , hB + "U" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_u->setEfficiencyFlag();
EffFlavVsBEff_s = (prov.book1D ( hB + "S" + hE , hB + "S" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_s->setEfficiencyFlag();
EffFlavVsBEff_g = (prov.book1D ( hB + "G" + hE , hB + "G" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_g->setEfficiencyFlag();
EffFlavVsBEff_dus = (prov.book1D ( hB + "DUS" + hE , hB + "DUS" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_dus->setEfficiencyFlag();
}
else {
EffFlavVsBEff_d = 0;
Expand All @@ -491,10 +497,15 @@ void EffPurFromHistos::compute (DQMStore::IBooker & ibook)
EffFlavVsBEff_dus = 0;
}
EffFlavVsBEff_c = (prov.book1D ( hB + "C" + hE , hB + "C" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_c->setEfficiencyFlag();
EffFlavVsBEff_b = (prov.book1D ( hB + "B" + hE , hB + "B" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_b->setEfficiencyFlag();
EffFlavVsBEff_ni = (prov.book1D ( hB + "NI" + hE , hB + "NI" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_ni->setEfficiencyFlag();
EffFlavVsBEff_dusg = (prov.book1D ( hB + "DUSG" + hE , hB + "DUSG" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_dusg->setEfficiencyFlag();
EffFlavVsBEff_pu = (prov.book1D ( hB + "PU" + hE , hB + "PU" + hE , nBinOutput , startOutput , endOutput )) ;
EffFlavVsBEff_pu->setEfficiencyFlag();

if(mcPlots_>2){
EffFlavVsBEff_d->getTH1F()->SetXTitle ( "b-jet efficiency" );
Expand Down

0 comments on commit f8a758d

Please sign in to comment.