CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ElectronLikelihood Class Reference

#include <ElectronLikelihood.h>

List of all members.

Public Member Functions

 ElectronLikelihood ()
 ctor, not used for this algo (need initialization from ES)
 ElectronLikelihood (const ElectronLikelihoodCalibration *calibration, LikelihoodSwitches eleIDSwitches, std::string signalWeightSplitting, std::string backgroundWeightSplitting, bool splitSignalPdfs, bool splitBackgroundPdfs)
 ctor
float result (const reco::GsfElectron &electron, EcalClusterLazyTools) const
 get the result of the algorithm
void setup (const edm::ParameterSet &conf)
 not used for this algo
virtual ~ElectronLikelihood ()
 dtor

Private Member Functions

void getInputVar (const reco::GsfElectron &electron, std::vector< float > &measuremnts, EcalClusterLazyTools) const
 get the input variables from the electron and the e-Setup
void Setup (const ElectronLikelihoodCalibration *calibration, std::string signalWeightSplitting, std::string backgroundWeightSplitting, bool splitSignalPdfs, bool splitBackgroundPdfs)

Private Attributes

LikelihoodPdfProduct_EBgt15lh
 likelihood above 15GeV/c
LikelihoodPdfProduct_EBlt15lh
 likelihood below 15GeV/c
LikelihoodPdfProduct_EEgt15lh
LikelihoodPdfProduct_EElt15lh
std::string m_backgroundWeightSplitting
LikelihoodSwitches m_eleIDSwitches
 general parameters of all the ele id algorithms
std::string m_signalWeightSplitting
 splitting rule for PDF's
bool m_splitBackgroundPdfs
bool m_splitSignalPdfs

Detailed Description

Definition at line 17 of file ElectronLikelihood.h.


Constructor & Destructor Documentation

ElectronLikelihood::ElectronLikelihood ( ) [inline]

ctor, not used for this algo (need initialization from ES)

Definition at line 22 of file ElectronLikelihood.h.

{} ;
ElectronLikelihood::ElectronLikelihood ( const ElectronLikelihoodCalibration calibration,
LikelihoodSwitches  eleIDSwitches,
std::string  signalWeightSplitting,
std::string  backgroundWeightSplitting,
bool  splitSignalPdfs,
bool  splitBackgroundPdfs 
)

ctor

Definition at line 8 of file ElectronLikelihood.cc.

References Setup().

                                                                  :
  _EBlt15lh (new LikelihoodPdfProduct ("electronID_EB_ptLt15_likelihood",0,0)) ,
  _EElt15lh (new LikelihoodPdfProduct ("electronID_EE_ptLt15_likelihood",1,0)) ,
  _EBgt15lh (new LikelihoodPdfProduct ("electronID_EB_ptGt15_likelihood",0,1)) ,
  _EEgt15lh (new LikelihoodPdfProduct ("electronID_EE_ptGt15_likelihood",1,1)) ,
  m_eleIDSwitches (eleIDSwitches) ,
  m_signalWeightSplitting (signalWeightSplitting), 
  m_backgroundWeightSplitting (backgroundWeightSplitting),
  m_splitSignalPdfs (splitSignalPdfs), 
  m_splitBackgroundPdfs (splitBackgroundPdfs)  
{
  Setup (calibration,
         signalWeightSplitting, backgroundWeightSplitting,
         splitSignalPdfs, splitBackgroundPdfs) ;
}
ElectronLikelihood::~ElectronLikelihood ( ) [virtual]

dtor

Definition at line 35 of file ElectronLikelihood.cc.

References _EBgt15lh, _EBlt15lh, _EEgt15lh, and _EElt15lh.

                                         {
  delete _EBlt15lh ;
  delete _EElt15lh ;
  delete _EBgt15lh ;
  delete _EEgt15lh ;
}

Member Function Documentation

void ElectronLikelihood::getInputVar ( const reco::GsfElectron electron,
std::vector< float > &  measuremnts,
EcalClusterLazyTools  myEcalCluster 
) const [private]

get the input variables from the electron and the e-Setup

Definition at line 224 of file ElectronLikelihood.cc.

References EcalClusterLazyTools::covariances(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::eSuperClusterOverP(), reco::GsfElectron::fbrem(), reco::GsfElectron::hadronicOverEm(), m_eleIDSwitches, LikelihoodSwitches::m_useDeltaEta, LikelihoodSwitches::m_useDeltaPhi, LikelihoodSwitches::m_useEoverP, LikelihoodSwitches::m_useFBrem, LikelihoodSwitches::m_useHoverE, LikelihoodSwitches::m_useSigmaEtaEta, LikelihoodSwitches::m_useSigmaPhiPhi, mathSSE::sqrt(), and reco::GsfElectron::superCluster().

Referenced by result().

{

  // the variables entering the likelihood
  if (m_eleIDSwitches.m_useDeltaPhi) measurements.push_back ( electron.deltaPhiSuperClusterTrackAtVtx () ) ;
  if (m_eleIDSwitches.m_useDeltaEta) measurements.push_back ( electron.deltaEtaSuperClusterTrackAtVtx () ) ;
  if (m_eleIDSwitches.m_useEoverP) measurements.push_back ( electron.eSuperClusterOverP () ) ;
  if (m_eleIDSwitches.m_useHoverE) measurements.push_back ( electron.hadronicOverEm () ) ;
  std::vector<float> vCov = myEcalCluster.covariances(*(electron.superCluster()->seed())) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta) measurements.push_back ( sqrt (vCov[0]) );
  if (m_eleIDSwitches.m_useSigmaPhiPhi) measurements.push_back ( sqrt (vCov[2]) );
  if(m_eleIDSwitches.m_useFBrem) measurements.push_back( electron.fbrem() );

}
float ElectronLikelihood::result ( const reco::GsfElectron electron,
EcalClusterLazyTools  myEcalCluster 
) const

get the result of the algorithm

Definition at line 248 of file ElectronLikelihood.cc.

References _EBgt15lh, _EBlt15lh, _EEgt15lh, _EElt15lh, className(), EcalBarrel, EcalEndcap, Exception, getInputVar(), LikelihoodPdfProduct::getRatio(), m_signalWeightSplitting, reco::GsfElectron::numberOfBrems(), reco::LeafCandidate::pt(), and reco::GsfElectron::superCluster().

{

  //=======================================================
  // used classification:
  // nbrem clusters = 0         =>  0
  // nbrem clusters >= 1        =>  1
  //=======================================================

  std::vector<float> measurements ;
  getInputVar (electron, measurements, myEcalCluster) ;

  // Split using only the number of brem clusters
  int bitVal=(electron.numberOfBrems()==0) ? 0 : 1 ;
  
  char className[20] ;
  if(m_signalWeightSplitting.compare("class")==0) {
    sprintf (className,"class%d",bitVal);
  } else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  reco::SuperClusterRef sclusRef = electron.superCluster() ;
  EcalSubdetector subdet = EcalSubdetector (sclusRef->hitsAndFractions()[0].first.subdetId ()) ;
  float thisPt =  electron.pt();

  if (subdet==EcalBarrel && thisPt<15.)
    return _EBlt15lh->getRatio ("electrons",measurements,std::string (className)) ;
  else if (subdet==EcalBarrel && thisPt>=15.)
    return _EBgt15lh->getRatio ("electrons",measurements,std::string (className)) ;
  else if (subdet==EcalEndcap && thisPt<15.)
    return _EElt15lh->getRatio ("electrons",measurements,std::string (className)) ;
  else if (subdet==EcalEndcap && thisPt>=15.)
    return _EEgt15lh->getRatio ("electrons",measurements,std::string (className)) ;
  else return -999. ;
}
void ElectronLikelihood::Setup ( const ElectronLikelihoodCalibration calibration,
std::string  signalWeightSplitting,
std::string  backgroundWeightSplitting,
bool  splitSignalPdfs,
bool  splitBackgroundPdfs 
) [private]

build the likelihood model from histograms in Barrel file and Endcap file

Definition at line 48 of file ElectronLikelihood.cc.

References _EBgt15lh, _EBlt15lh, _EEgt15lh, _EElt15lh, LikelihoodPdfProduct::addPdf(), LikelihoodPdfProduct::addSpecies(), Exception, LikelihoodPdfProduct::initFromDB(), m_eleIDSwitches, LikelihoodSwitches::m_useDeltaEta, LikelihoodSwitches::m_useDeltaPhi, LikelihoodSwitches::m_useEoverP, LikelihoodSwitches::m_useFBrem, LikelihoodSwitches::m_useHoverE, LikelihoodSwitches::m_useSigmaEtaEta, LikelihoodSwitches::m_useSigmaPhiPhi, and LikelihoodPdfProduct::setSplitFrac().

Referenced by ElectronLikelihood().

{

  // ECAL BARREL LIKELIHOOD - Pt < 15 GeV region
  _EBlt15lh->initFromDB (calibration) ;

  _EBlt15lh->addSpecies ("electrons") ;
  _EBlt15lh->addSpecies ("hadrons") ;

  if(signalWeightSplitting.compare("class")==0) {
    _EBlt15lh->setSplitFrac ("electrons", "class0") ;
    _EBlt15lh->setSplitFrac ("electrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (non-showering / showering)"
                                      << " and fullclass (golden / bigbrem / narrow / showering)" 
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EBlt15lh->addPdf ("electrons", "dPhi",          splitSignalPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EBlt15lh->addPdf ("electrons", "dEta",          splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EBlt15lh->addPdf ("electrons", "EoP",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EBlt15lh->addPdf ("electrons", "HoE",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EBlt15lh->addPdf ("electrons", "sigmaIEtaIEta", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EBlt15lh->addPdf ("electrons", "sigmaIPhiIPhi", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EBlt15lh->addPdf ("electrons", "fBrem",         splitSignalPdfs) ;

  if(backgroundWeightSplitting.compare("class")==0) {
    _EBlt15lh->setSplitFrac ("hadrons", "class0") ;
    _EBlt15lh->setSplitFrac ("hadrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EBlt15lh->addPdf ("hadrons", "dPhi",          splitBackgroundPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EBlt15lh->addPdf ("hadrons", "dEta",          splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EBlt15lh->addPdf ("hadrons", "EoP",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EBlt15lh->addPdf ("hadrons", "HoE",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EBlt15lh->addPdf ("hadrons", "sigmaIEtaIEta", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EBlt15lh->addPdf ("hadrons", "sigmaIPhiIPhi", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EBlt15lh->addPdf ("hadrons", "fBrem",         splitBackgroundPdfs) ;

  // ECAL BARREL LIKELIHOOD - Pt >= 15 GeV region
  _EBgt15lh->initFromDB (calibration) ;

  _EBgt15lh->addSpecies ("electrons") ;  
  _EBgt15lh->addSpecies ("hadrons") ;

  if(signalWeightSplitting.compare("class")==0) {
    _EBgt15lh->setSplitFrac ("electrons", "class0") ;
    _EBgt15lh->setSplitFrac ("electrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EBgt15lh->addPdf ("electrons", "dPhi",          splitSignalPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EBgt15lh->addPdf ("electrons", "dEta",          splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EBgt15lh->addPdf ("electrons", "EoP",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EBgt15lh->addPdf ("electrons", "HoE",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EBgt15lh->addPdf ("electrons", "sigmaIEtaIEta", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EBgt15lh->addPdf ("electrons", "sigmaIPhiIPhi", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EBgt15lh->addPdf ("electrons", "fBrem",         splitSignalPdfs) ;

  if(backgroundWeightSplitting.compare("class")==0) {
    _EBgt15lh->setSplitFrac ("hadrons", "class0") ;
    _EBgt15lh->setSplitFrac ("hadrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EBgt15lh->addPdf ("hadrons", "dPhi",          splitBackgroundPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EBgt15lh->addPdf ("hadrons", "dEta",          splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EBgt15lh->addPdf ("hadrons", "EoP",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EBgt15lh->addPdf ("hadrons", "HoE",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EBgt15lh->addPdf ("hadrons", "sigmaIEtaIEta", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EBgt15lh->addPdf ("hadrons", "sigmaIPhiIPhi", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EBgt15lh->addPdf ("hadrons", "fBrem",         splitBackgroundPdfs) ;

  // ECAL ENDCAP LIKELIHOOD - Pt < 15 GeV
  _EElt15lh->initFromDB (calibration) ;

  _EElt15lh->addSpecies ("electrons") ;
  _EElt15lh->addSpecies ("hadrons") ;

  if(signalWeightSplitting.compare("class")==0) {
    _EElt15lh->setSplitFrac ("electrons", "class0") ;
    _EElt15lh->setSplitFrac ("electrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EElt15lh->addPdf ("electrons", "dPhi",          splitSignalPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EElt15lh->addPdf ("electrons", "dEta",          splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EElt15lh->addPdf ("electrons", "EoP",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EElt15lh->addPdf ("electrons", "HoE",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EElt15lh->addPdf ("electrons", "sigmaIEtaIEta", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EElt15lh->addPdf ("electrons", "sigmaIPhiIPhi", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EElt15lh->addPdf ("electrons", "fBrem",         splitSignalPdfs) ;

  if(backgroundWeightSplitting.compare("class")==0) {
    _EElt15lh->setSplitFrac ("hadrons", "class0") ;
    _EElt15lh->setSplitFrac ("hadrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EElt15lh->addPdf ("hadrons", "dPhi",          splitBackgroundPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EElt15lh->addPdf ("hadrons", "dEta",          splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EElt15lh->addPdf ("hadrons", "EoP",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EElt15lh->addPdf ("hadrons", "HoE",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EElt15lh->addPdf ("hadrons", "sigmaIEtaIEta", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EElt15lh->addPdf ("hadrons", "sigmaIPhiIPhi", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EElt15lh->addPdf ("hadrons", "fBrem",         splitBackgroundPdfs) ;

  // ECAL ENDCAP LIKELIHOOD - Pt >= 15 GeV
  _EEgt15lh->initFromDB (calibration) ;

  _EEgt15lh->addSpecies ("electrons") ;
  _EEgt15lh->addSpecies ("hadrons") ;

  if(signalWeightSplitting.compare("class")==0) {
    _EEgt15lh->setSplitFrac ("electrons", "class0") ;
    _EEgt15lh->setSplitFrac ("electrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EEgt15lh->addPdf ("electrons", "dPhi",          splitSignalPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EEgt15lh->addPdf ("electrons", "dEta",          splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EEgt15lh->addPdf ("electrons", "EoP",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EEgt15lh->addPdf ("electrons", "HoE",           splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EEgt15lh->addPdf ("electrons", "sigmaIEtaIEta", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EEgt15lh->addPdf ("electrons", "sigmaIPhiIPhi", splitSignalPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EEgt15lh->addPdf ("electrons", "fBrem",         splitSignalPdfs) ;

  if(backgroundWeightSplitting.compare("class")==0) {
    _EEgt15lh->setSplitFrac ("hadrons", "class0") ;
    _EEgt15lh->setSplitFrac ("hadrons", "class1") ;
  }
  else {
    throw cms::Exception("BadConfig") << "Only class (0 brem clusters / >=1 brem clusters)"
                                      << " splitting is implemented right now";
  }

  if (m_eleIDSwitches.m_useDeltaPhi)     _EEgt15lh->addPdf ("hadrons", "dPhi",          splitBackgroundPdfs) ;   
  if (m_eleIDSwitches.m_useDeltaEta)     _EEgt15lh->addPdf ("hadrons", "dEta",          splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useEoverP)       _EEgt15lh->addPdf ("hadrons", "EoP",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useHoverE)       _EEgt15lh->addPdf ("hadrons", "HoE",           splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaEtaEta)  _EEgt15lh->addPdf ("hadrons", "sigmaIEtaIEta", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useSigmaPhiPhi)  _EEgt15lh->addPdf ("hadrons", "sigmaIPhiIPhi", splitBackgroundPdfs) ;
  if (m_eleIDSwitches.m_useFBrem)        _EEgt15lh->addPdf ("hadrons", "fBrem",         splitBackgroundPdfs) ;
}
void ElectronLikelihood::setup ( const edm::ParameterSet conf) [inline]

not used for this algo

Definition at line 36 of file ElectronLikelihood.h.

{} ;

Member Data Documentation

likelihood above 15GeV/c

Definition at line 61 of file ElectronLikelihood.h.

Referenced by result(), Setup(), and ~ElectronLikelihood().

likelihood below 15GeV/c

Definition at line 59 of file ElectronLikelihood.h.

Referenced by result(), Setup(), and ~ElectronLikelihood().

Definition at line 61 of file ElectronLikelihood.h.

Referenced by result(), Setup(), and ~ElectronLikelihood().

Definition at line 59 of file ElectronLikelihood.h.

Referenced by result(), Setup(), and ~ElectronLikelihood().

Definition at line 68 of file ElectronLikelihood.h.

general parameters of all the ele id algorithms

Definition at line 64 of file ElectronLikelihood.h.

Referenced by getInputVar(), and Setup().

splitting rule for PDF's

Definition at line 67 of file ElectronLikelihood.h.

Referenced by result().

Definition at line 70 of file ElectronLikelihood.h.

Definition at line 69 of file ElectronLikelihood.h.