Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PU ID for btagging #2206

Merged
merged 3 commits into from Feb 13, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions DQMOffline/RecoB/interface/BTagDifferentialPlot.h
Expand Up @@ -49,9 +49,7 @@ class BTagDifferentialPlot {
TH1F * getDifferentialHistoB_ni () { return theDifferentialHistoB_ni->getTH1F() ; }
TH1F * getDifferentialHistoB_dus () { return theDifferentialHistoB_dus->getTH1F() ; }
TH1F * getDifferentialHistoB_dusg () { return theDifferentialHistoB_dusg->getTH1F() ; }



TH1F * getDifferentialHistoB_pu () { return theDifferentialHistoB_pu->getTH1F() ; }


private:
Expand Down Expand Up @@ -98,6 +96,7 @@ class BTagDifferentialPlot {
MonitorElement * theDifferentialHistoB_ni ;
MonitorElement * theDifferentialHistoB_dus ;
MonitorElement * theDifferentialHistoB_dusg ;
MonitorElement * theDifferentialHistoB_pu ;

// the plot Canvas
// TCanvas * thePlotCanvas ;
Expand Down
13 changes: 8 additions & 5 deletions DQMOffline/RecoB/interface/EffPurFromHistos.h
Expand Up @@ -17,9 +17,10 @@ class EffPurFromHistos {
public:

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 ) ;
TH1F * h_s, TH1F * h_c, TH1F * h_b, TH1F * h_g, TH1F * h_ni,
TH1F * h_dus, TH1F * h_dusg, TH1F * h_pu,
const std::string& label, const unsigned int& mc,
int nBin = 100 , double startO = 0.005 , double endO = 1.005 ) ;
// defaults reasonable for lifetime based tags

EffPurFromHistos (const FlavourHistograms<double> * dDiscriminatorFC, const std::string& label, const unsigned int& mc,
Expand All @@ -32,8 +33,7 @@ class EffPurFromHistos {
void compute () ;

// return the newly created histos
TH1F * getEffFlavVsBEff_d () {
return EffFlavVsBEff_d->getTH1F() ; };
TH1F * getEffFlavVsBEff_d () { return EffFlavVsBEff_d->getTH1F() ; };
TH1F * getEffFlavVsBEff_u () { return EffFlavVsBEff_u->getTH1F() ; };
TH1F * getEffFlavVsBEff_s () { return EffFlavVsBEff_s ->getTH1F() ; };
TH1F * getEffFlavVsBEff_c () { return EffFlavVsBEff_c ->getTH1F() ; };
Expand All @@ -42,6 +42,7 @@ class EffPurFromHistos {
TH1F * getEffFlavVsBEff_ni () { return EffFlavVsBEff_ni ->getTH1F() ; };
TH1F * getEffFlavVsBEff_dus () { return EffFlavVsBEff_dus ->getTH1F() ; };
TH1F * getEffFlavVsBEff_dusg () { return EffFlavVsBEff_dusg ->getTH1F(); };
TH1F * getEffFlavVsBEff_pu () { return EffFlavVsBEff_pu ->getTH1F(); };



Expand Down Expand Up @@ -84,6 +85,7 @@ class EffPurFromHistos {
TH1F * effVersusDiscr_ni ;
TH1F * effVersusDiscr_dus ;
TH1F * effVersusDiscr_dusg ;
TH1F * effVersusDiscr_pu ;


// the corresponding output histograms (flavour-eff vs. b-efficiency)
Expand All @@ -105,6 +107,7 @@ class EffPurFromHistos {
MonitorElement * EffFlavVsBEff_ni ;
MonitorElement * EffFlavVsBEff_dus ;
MonitorElement * EffFlavVsBEff_dusg ;
MonitorElement * EffFlavVsBEff_pu ;

// DQMStore * dqmStore_;
std::string label_;
Expand Down
12 changes: 12 additions & 0 deletions DQMOffline/RecoB/interface/FlavourHistorgrams.h
Expand Up @@ -88,6 +88,7 @@ class FlavourHistograms {
inline TH1F * histo_ni () const { return theHisto_ni->getTH1F() ; }
inline TH1F * histo_dus () const { return theHisto_dus->getTH1F() ; }
inline TH1F * histo_dusg () const { return theHisto_dusg->getTH1F() ; }
inline TH1F * histo_pu () const { return theHisto_pu->getTH1F() ; }

std::vector<TH1F*> getHistoVector() const;

Expand Down Expand Up @@ -129,6 +130,7 @@ class FlavourHistograms {
MonitorElement *theHisto_ni ;
MonitorElement *theHisto_dus ;
MonitorElement *theHisto_dusg ;
MonitorElement *theHisto_pu ;

// DQMStore * dqmStore_;

Expand Down Expand Up @@ -192,6 +194,7 @@ FlavourHistograms<T>::FlavourHistograms (const std::string& baseNameTitle_ , con
theHisto_b = (prov.book1D ( theBaseNameTitle + "B" , theBaseNameDescription + " b-jets" , theNBins , theLowerBound , theUpperBound )) ;
theHisto_ni = (prov.book1D ( theBaseNameTitle + "NI" , theBaseNameDescription + " ni-jets" , theNBins , theLowerBound , theUpperBound )) ;
theHisto_dusg = (prov.book1D ( theBaseNameTitle + "DUSG" , theBaseNameDescription + " dusg-jets" , theNBins , theLowerBound , theUpperBound )) ;
theHisto_pu = (prov.book1D ( theBaseNameTitle + "PU" , theBaseNameDescription + " pu-jets" , theNBins , theLowerBound , theUpperBound )) ;
}else{
theHisto_d = 0;
theHisto_u = 0;
Expand All @@ -202,6 +205,7 @@ FlavourHistograms<T>::FlavourHistograms (const std::string& baseNameTitle_ , con
theHisto_ni = 0;
theHisto_dus = 0;
theHisto_dusg = 0;
theHisto_pu = 0;
}

// statistics if requested
Expand All @@ -219,6 +223,7 @@ FlavourHistograms<T>::FlavourHistograms (const std::string& baseNameTitle_ , con
theHisto_b ->getTH1F()->Sumw2() ;
theHisto_ni ->getTH1F()->Sumw2() ;
theHisto_dusg->getTH1F()->Sumw2() ;
theHisto_pu ->getTH1F()->Sumw2() ;
}
}
} else {
Expand All @@ -236,6 +241,7 @@ FlavourHistograms<T>::FlavourHistograms (const std::string& baseNameTitle_ , con
theHisto_b = prov.access(theBaseNameTitle + "B" ) ;
theHisto_ni = prov.access(theBaseNameTitle + "NI" ) ;
theHisto_dusg = prov.access(theBaseNameTitle + "DUSG") ;
theHisto_pu = prov.access(theBaseNameTitle + "PU") ;
}
}

Expand Down Expand Up @@ -317,6 +323,7 @@ void FlavourHistograms<T>::settitle(const char* title) {
theHisto_b ->setAxisTitle(title) ;
theHisto_ni ->setAxisTitle(title) ;
theHisto_dusg->setAxisTitle(title) ;
theHisto_pu->setAxisTitle(title) ;
}
}

Expand Down Expand Up @@ -490,6 +497,7 @@ void FlavourHistograms<T>::divide ( const FlavourHistograms<T> & bHD ) const {
theHisto_b ->getTH1F()-> Divide ( theHisto_b ->getTH1F() , bHD.histo_b () , 1.0 , 1.0 , "b" ) ;
theHisto_ni ->getTH1F()-> Divide ( theHisto_ni->getTH1F() , bHD.histo_ni () , 1.0 , 1.0 , "b" ) ;
theHisto_dusg ->getTH1F()-> Divide ( theHisto_dusg->getTH1F() , bHD.histo_dusg() , 1.0 , 1.0 , "b" ) ;
theHisto_pu ->getTH1F()-> Divide ( theHisto_pu->getTH1F() , bHD.histo_pu() , 1.0 , 1.0 , "b" ) ;
}
}

Expand Down Expand Up @@ -541,6 +549,9 @@ void FlavourHistograms<T>::fillVariable ( const int & flavour , const T & var ,
case 12321:
if (theBaseNameDescription == "Jet Multiplicity") theHisto_dusg->Fill( var ,w);
return;
case 20:
theHisto_pu->Fill( var ,w);
return;
default:
theHisto_ni->Fill( var ,w);
return;
Expand All @@ -564,6 +575,7 @@ std::vector<TH1F*> FlavourHistograms<T>::getHistoVector() const
histoVector.push_back ( theHisto_b->getTH1F() );
histoVector.push_back ( theHisto_ni->getTH1F() );
histoVector.push_back ( theHisto_dusg->getTH1F());
histoVector.push_back ( theHisto_pu->getTH1F());
}
return histoVector;
}
Expand Down
23 changes: 23 additions & 0 deletions DQMOffline/RecoB/interface/FlavourHistorgrams2D.h
Expand Up @@ -85,6 +85,7 @@ class FlavourHistograms2D {
inline TH2F * histo_ni () const { return theHisto_ni->getTH2F() ; }
inline TH2F * histo_dus () const { return theHisto_dus->getTH2F() ; }
inline TH2F * histo_dusg () const { return theHisto_dusg->getTH2F() ; }
inline TH2F * histo_pu () const { return theHisto_pu->getTH2F() ; }

TProfile * profile_all () const { return theProfile_all->getTProfile() ; }
TProfile * profile_d () const { return theProfile_d ->getTProfile() ; }
Expand All @@ -96,6 +97,7 @@ class FlavourHistograms2D {
TProfile * profile_ni () const { return theProfile_ni->getTProfile() ; }
TProfile * profile_dus () const { return theProfile_dus->getTProfile() ; }
TProfile * profile_dusg () const { return theProfile_dusg->getTProfile() ; }
TProfile * profile_pu () const { return theProfile_pu->getTProfile() ; }

std::vector<TH2F*> getHistoVector() const;

Expand Down Expand Up @@ -140,6 +142,7 @@ class FlavourHistograms2D {
MonitorElement *theHisto_ni ;
MonitorElement *theHisto_dus ;
MonitorElement *theHisto_dusg ;
MonitorElement *theHisto_pu ;

// the profiles
MonitorElement *theProfile_all ;
Expand All @@ -152,6 +155,7 @@ class FlavourHistograms2D {
MonitorElement *theProfile_ni ;
MonitorElement *theProfile_dus ;
MonitorElement *theProfile_dusg ;
MonitorElement *theProfile_pu ;

// DQMStore * dqmStore_;

Expand Down Expand Up @@ -208,6 +212,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theHisto_b = (prov.book2D ( theBaseNameTitle + "B" , theBaseNameDescription + " b-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
theHisto_ni = (prov.book2D ( theBaseNameTitle + "NI" , theBaseNameDescription + " ni-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
theHisto_dusg = (prov.book2D ( theBaseNameTitle + "DUSG" , theBaseNameDescription + " dusg-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
theHisto_pu = (prov.book2D ( theBaseNameTitle + "PU" , theBaseNameDescription + " pu-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
}else{
theHisto_d = 0;
theHisto_u = 0;
Expand All @@ -218,6 +223,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theHisto_ni = 0;
theHisto_dus = 0;
theHisto_dusg = 0;
theHisto_pu = 0;
}

if (createProfile_) {
Expand All @@ -242,6 +248,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theProfile_b = (prov.bookProfile ( theBaseNameTitle + "_Profile_B" , theBaseNameDescription + " b-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
theProfile_ni = (prov.bookProfile ( theBaseNameTitle + "_Profile_NI" , theBaseNameDescription + " ni-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
theProfile_dusg = (prov.bookProfile ( theBaseNameTitle + "_Profile_DUSG" , theBaseNameDescription + " dusg-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
theProfile_pu = (prov.bookProfile ( theBaseNameTitle + "_Profile_PU" , theBaseNameDescription + " pu-jets" , theNBinsX , theLowerBoundX , theUpperBoundX , theNBinsY, theLowerBoundY, theUpperBoundY)) ;
} else{
theProfile_d = 0;
theProfile_u = 0;
Expand All @@ -252,6 +259,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theProfile_ni = 0;
theProfile_dus = 0;
theProfile_dusg = 0;
theProfile_pu = 0;
}
} else {
theProfile_all = 0;
Expand All @@ -264,6 +272,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theProfile_ni = 0;
theProfile_dus = 0;
theProfile_dusg = 0;
theProfile_pu = 0;
}
// statistics if requested
if ( theStatistics ) {
Expand All @@ -282,6 +291,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theHisto_b ->getTH2F()->Sumw2() ;
theHisto_ni ->getTH2F()->Sumw2() ;
theHisto_dusg->getTH2F()->Sumw2() ;
theHisto_pu ->getTH2F()->Sumw2() ;

if(createProfile) {
if (mcPlots_>2) {
Expand All @@ -295,6 +305,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theProfile_b ->getTProfile()->Sumw2() ;
theProfile_ni ->getTProfile()->Sumw2() ;
theProfile_dusg->getTProfile()->Sumw2() ;
theProfile_pu ->getTProfile()->Sumw2() ;
}
}
}
Expand All @@ -313,6 +324,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theHisto_b = prov.access(theBaseNameTitle + "B" ) ;
theHisto_ni = prov.access(theBaseNameTitle + "NI" ) ;
theHisto_dusg = prov.access(theBaseNameTitle + "DUSG") ;
theHisto_pu = prov.access(theBaseNameTitle + "PU" ) ;
}

if(createProfile_) {
Expand All @@ -329,6 +341,7 @@ FlavourHistograms2D<T, G>::FlavourHistograms2D (TString baseNameTitle_ , TString
theProfile_b = prov.access(theBaseNameTitle + "_Profile_B" ) ;
theProfile_ni = prov.access(theBaseNameTitle + "_Profile_NI" ) ;
theProfile_dusg = prov.access(theBaseNameTitle + "_Profile_DUSG") ;
theProfile_pu = prov.access(theBaseNameTitle + "_Profile_PU" ) ;
}
}
}
Expand Down Expand Up @@ -420,6 +433,7 @@ void FlavourHistograms2D<T, G>::settitle(const char* titleX, const char* titleY)
if(theHisto_ni) theHisto_ni ->setAxisTitle(titleY, 2) ;
if(theHisto_dus) theHisto_dus ->setAxisTitle(titleY, 2) ;
if(theHisto_dusg)theHisto_dusg->setAxisTitle(titleY, 2) ;
if(theHisto_pu) theHisto_pu ->setAxisTitle(titleY, 2) ;
}

if(createProfile_) {
Expand All @@ -445,6 +459,7 @@ void FlavourHistograms2D<T, G>::settitle(const char* titleX, const char* titleY)
if(theProfile_ni) theProfile_ni ->setAxisTitle(titleY, 2) ;
if(theProfile_dus) theProfile_dus ->setAxisTitle(titleY, 2) ;
if(theProfile_dusg)theProfile_dusg->setAxisTitle(titleY, 2) ;
if(theProfile_pu) theProfile_pu ->setAxisTitle(titleY, 2) ;
}
}
}
Expand All @@ -471,6 +486,7 @@ void FlavourHistograms2D<T, G>::divide ( const FlavourHistograms2D<T, G> & bHD )
theHisto_b ->getTH2F()-> Divide ( theHisto_b ->getTH2F() , bHD.histo_b () , 1.0 , 1.0 , "b" ) ;
theHisto_ni ->getTH2F()-> Divide ( theHisto_ni->getTH2F() , bHD.histo_ni () , 1.0 , 1.0 , "b" ) ;
theHisto_dusg ->getTH2F()-> Divide ( theHisto_dusg->getTH2F() , bHD.histo_dusg() , 1.0 , 1.0 , "b" ) ;
theHisto_pu ->getTH2F()-> Divide ( theHisto_pu->getTH2F() , bHD.histo_pu () , 1.0 , 1.0 , "b" ) ;
}
}

Expand Down Expand Up @@ -559,6 +575,11 @@ template <class T, class G>
theProfile_dusg->Fill(varX, varY);
}
return;
case 20:
theHisto_pu->Fill( varX, varY,w );
//if(createProfile_) theProfile_pu->Fill(varX, varY,w);
if(createProfile_) theProfile_pu->Fill(varX, varY);
return;
default:
theHisto_ni->Fill( varX, varY,w );
//if(createProfile_) theProfile_ni->Fill(varX, varY,w);
Expand All @@ -584,6 +605,7 @@ std::vector<TH2F*> FlavourHistograms2D<T, G>::getHistoVector() const
histoVector.push_back ( theHisto_b->getTH2F() );
histoVector.push_back ( theHisto_ni->getTH2F() );
histoVector.push_back ( theHisto_dusg->getTH2F());
histoVector.push_back ( theHisto_pu->getTH2F() );
}
return histoVector;
}
Expand All @@ -606,6 +628,7 @@ std::vector<TProfile*> FlavourHistograms2D<T, G>::getProfileVector() const
profileVector.push_back ( theProfile_b->getTProfile() );
profileVector.push_back ( theProfile_ni->getTProfile() );
profileVector.push_back ( theProfile_dusg->getTProfile());
profileVector.push_back ( theProfile_pu->getTProfile() );
}
}
return profileVector;
Expand Down
19 changes: 12 additions & 7 deletions DQMOffline/RecoB/python/bTagSequences_cff.py
@@ -1,8 +1,8 @@
import FWCore.ParameterSet.Config as cms

#define you jet ID
jetID = cms.InputTag("ak5PFJets")

jetID = cms.InputTag("ak5PFJetsCHS")
corr = 'ak5PFCHSL1FastL2L3'
#JTA for your jets
from RecoJets.JetAssociationProducers.j2tParametersVX_cfi import *
myak5JetTracksAssociatorAtVertex = cms.EDProducer("JetTracksAssociatorAtVertex",
Expand Down Expand Up @@ -44,13 +44,18 @@
JetCut=cms.string("neutralHadronEnergyFraction < 0.99 && neutralEmEnergyFraction < 0.99 && nConstituents > 1 && chargedHadronEnergyFraction > 0.0 && chargedMultiplicity > 0.0 && chargedEmEnergyFraction < 0.99")

from JetMETCorrections.Configuration.DefaultJEC_cff import *
ak5PFJetsJEC = ak5PFJetsL2L3.clone(
src = 'ak5PFJets',
correctors = ['ak5PFL2L3']
)
from JetMETCorrections.Configuration.JetCorrectionServices_cff import *
ak5PFCHSL1Fastjet.algorithm = 'AK5PFchs'
ak5PFCHSL2Relative.algorithm = 'AK5PFchs'
ak5PFCHSL3Absolute.algorithm = 'AK5PFchs'
ak5PFCHSResidual.algorithm = 'AK5PFchs'

ak5JetsJEC = ak5PFJetsL2L3.clone(
src = jetID,
correctors = [corr] )

PFJetsFilter = cms.EDFilter("PFJetSelector",
src = cms.InputTag("ak5PFJetsJEC"),
src = cms.InputTag("ak5JetsJEC"),
cut = JetCut,
filter = cms.bool(True)
)
5 changes: 4 additions & 1 deletion DQMOffline/RecoB/src/BTagDifferentialPlot.cc
Expand Up @@ -31,7 +31,8 @@ BTagDifferentialPlot::BTagDifferentialPlot (const double& bEff, const ConstVarTy
theDifferentialHistoB_g ( 0 ) ,
theDifferentialHistoB_ni ( 0 ) ,
theDifferentialHistoB_dus ( 0 ) ,
theDifferentialHistoB_dusg ( 0 ) {}
theDifferentialHistoB_dusg ( 0 ) ,
theDifferentialHistoB_pu ( 0 ) {}


BTagDifferentialPlot::~BTagDifferentialPlot () {
Expand Down Expand Up @@ -259,6 +260,7 @@ void BTagDifferentialPlot::bookHisto () {
theDifferentialHistoB_ni = (prov.book1D ( "NI_" + commonName , "NI_" + commonName , nBins , binArray )) ;
theDifferentialHistoB_dus = (prov.book1D ( "DUS_" + commonName , "DUS_" + commonName , nBins , binArray )) ;
theDifferentialHistoB_dusg = (prov.book1D ( "DUSG_" + commonName , "DUSG_" + commonName , nBins , binArray )) ;
theDifferentialHistoB_pu = (prov.book1D ( "PU_" + commonName , "PU_" + commonName , nBins , binArray )) ;
}


Expand Down Expand Up @@ -304,6 +306,7 @@ void BTagDifferentialPlot::fillHisto () {
effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_ni() , theDifferentialHistoB_ni ->getTH1F() ) ) ;
effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_dus() , theDifferentialHistoB_dus->getTH1F() ) ) ;
effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_dusg() , theDifferentialHistoB_dusg->getTH1F() ) ) ;
effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_pu() , theDifferentialHistoB_pu->getTH1F() ) ) ;

for ( vector< pair<TH1F*,TH1F*> >::const_iterator itP = effPurDifferentialPairs.begin() ;
itP != effPurDifferentialPairs.end() ; ++itP ) {
Expand Down