CMS 3D CMS Logo

Public Types | Public Member Functions | Public Attributes | Private Attributes

PFElectronSelector Class Reference

#include <PFElectronSelector.h>

Inheritance diagram for PFElectronSelector:
Selector< pat::Electron > binary_function

List of all members.

Public Types

enum  Version_t { SPRING11, N_VERSIONS }

Public Member Functions

void initialize (Version_t version, double mva=0.4, double d0=0.02, int nMissingHits=1, std::string eidUsed="eidTightMC", bool convRej=true, double pfiso=0.15)
bool operator() (const pat::Electron &electron, pat::strbitset &ret)
 This provides the interface for base classes to select objects.
 PFElectronSelector (edm::ParameterSet const &parameters)
 PFElectronSelector ()
bool spring11Cuts (const pat::Electron &electron, pat::strbitset &ret)

Public Attributes

bool verbose_

Private Attributes

std::string electronIDvalue_
index_type indexConvRej_
index_type indexD0_
index_type indexElectronId_
index_type indexID
index_type indexMaxMissingHits_
index_type indexMVA_
index_type indexPFIso_
Version_t version_

Detailed Description

Definition at line 13 of file PFElectronSelector.h.


Member Enumeration Documentation

Enumerator:
SPRING11 
N_VERSIONS 

Definition at line 19 of file PFElectronSelector.h.


Constructor & Destructor Documentation

PFElectronSelector::PFElectronSelector ( ) [inline]

Definition at line 21 of file PFElectronSelector.h.

{}
PFElectronSelector::PFElectronSelector ( edm::ParameterSet const &  parameters) [inline]

Definition at line 23 of file PFElectronSelector.h.

References Exception, edm::ParameterSet::exists(), Selector< pat::Electron >::getBitTemplate(), edm::ParameterSet::getParameter(), initialize(), N_VERSIONS, Selector< pat::Electron >::retInternal_, Selector< pat::Electron >::setIgnoredCuts(), SPRING11, verbose_, and BeamSplash_cfg::version.

                                                           {
    
    verbose_ = false;
    
    std::string versionStr = parameters.getParameter<std::string>("version");
    
    Version_t version = N_VERSIONS;
    
    if ( versionStr == "SPRING11" ) {
      version = SPRING11;
    }
    else {
      throw cms::Exception("InvalidInput") << "Expect version to be one of SPRING11" << std::endl;
    }


    initialize( version, 
                parameters.getParameter<double>("MVA"),
                parameters.getParameter<double>("D0")  ,
                parameters.getParameter<int>   ("MaxMissingHits"),
                parameters.getParameter<std::string> ("electronIDused"),
                parameters.getParameter<bool>  ("ConversionRejection"),
                parameters.getParameter<double>("PFIso")
                );
    if ( parameters.exists("cutsToIgnore") )
      setIgnoredCuts( parameters.getParameter<std::vector<std::string> >("cutsToIgnore") );
    
    retInternal_ = getBitTemplate();

  }

Member Function Documentation

void PFElectronSelector::initialize ( Version_t  version,
double  mva = 0.4,
double  d0 = 0.02,
int  nMissingHits = 1,
std::string  eidUsed = "eidTightMC",
bool  convRej = true,
double  pfiso = 0.15 
) [inline]

Definition at line 54 of file PFElectronSelector.h.

References Selector< pat::Electron >::bits_, electronIDvalue_, indexConvRej_, indexD0_, indexElectronId_, indexMaxMissingHits_, indexMVA_, indexPFIso_, Selector< pat::Electron >::push_back(), BeamSplash_cfg::version, and version_.

Referenced by PFElectronSelector().

  {
    version_ = version; 
    
    //    size_t found;
    //    found = eidUsed.find("NONE");
    //  if ( found != string::npos)
    electronIDvalue_ = eidUsed;

    push_back("D0",        d0     );
    push_back("MaxMissingHits", nMissingHits  );
    push_back("electronID");
    push_back("ConversionRejection" );
    push_back("PFIso",    pfiso );
    push_back("MVA",       mva   );

    set("D0");
    set("MaxMissingHits");
    set("electronID");
    set("ConversionRejection", convRej);
    set("PFIso");   
    set("MVA");

    indexD0_             = index_type(&bits_, "D0"           );
    indexMaxMissingHits_ = index_type(&bits_, "MaxMissingHits" );
    indexElectronId_     = index_type(&bits_, "electronID" );
    indexConvRej_        = index_type(&bits_, "ConversionRejection" );
    indexPFIso_          = index_type(&bits_, "PFIso"       );
    indexMVA_            = index_type(&bits_, "MVA"         );
  }
bool PFElectronSelector::operator() ( const pat::Electron t,
pat::strbitset ret 
) [inline, virtual]

This provides the interface for base classes to select objects.

Implements Selector< pat::Electron >.

Definition at line 92 of file PFElectronSelector.h.

References SPRING11, spring11Cuts(), and version_.

  { 
    if (version_ == SPRING11 ) return spring11Cuts(electron, ret);
    else {
      return false;
    }
  }
bool PFElectronSelector::spring11Cuts ( const pat::Electron electron,
pat::strbitset ret 
) [inline]

Definition at line 103 of file PFElectronSelector.h.

References reco::GsfElectron::convDcot(), reco::GsfElectron::convDist(), Selector< pat::Electron >::cut(), pat::Electron::dB(), pat::Electron::electronID(), electronIDvalue_, reco::LeafCandidate::et(), pat::Electron::gsfTrack(), Selector< pat::Electron >::ignoreCut(), indexConvRej_, indexD0_, indexElectronId_, indexMaxMissingHits_, indexMVA_, indexPFIso_, reco::GsfElectron::mva(), Selector< pat::Electron >::passCut(), pat::PfChargedHadronIso, pat::PfGammaIso, pat::PfNeutralHadronIso, run_regression::ret, pat::strbitset::set(), Selector< pat::Electron >::setIgnored(), and pat::Lepton< LeptonType >::userIsolation().

Referenced by operator()().

  {

    ret.set(false);

    double mva = electron.mva();
    double missingHits = electron.gsfTrack()->trackerExpectedHitsInner().numberOfHits() ;
    double corr_d0 = electron.dB();

    // in >= 39x conversion rejection variables are accessible from Gsf electron
    Double_t dist = electron.convDist(); // default value is -9999 if conversion partner not found
    Double_t dcot = electron.convDcot(); // default value is -9999 if conversion partner not found
    bool isConv = fabs(dist) < 0.02 && fabs(dcot) < 0.02;

    int bitWiseResults =  (int) electron.electronID( electronIDvalue_ );  
    bool electronIDboolean = ((bitWiseResults & 1) == 1 );

    double chIso = electron.userIsolation(pat::PfChargedHadronIso);
    double nhIso = electron.userIsolation(pat::PfNeutralHadronIso);
    double gIso  = electron.userIsolation(pat::PfGammaIso);
    double et    = electron.et() ;

    double pfIso = (chIso + nhIso + gIso) / et;

    if ( missingHits   <= cut(indexMaxMissingHits_,  double()) || ignoreCut(indexMaxMissingHits_)   ) passCut(ret, indexMaxMissingHits_  );
    if ( fabs(corr_d0) <  cut(indexD0_,              double()) || ignoreCut(indexD0_)               ) passCut(ret, indexD0_     );
    if ( isConv                                                || ignoreCut(indexConvRej_)          ) passCut(ret, indexConvRej_     );
    if ( pfIso         <  cut(indexPFIso_,           double()) || ignoreCut(indexPFIso_)            ) passCut(ret, indexPFIso_ );
    if ( mva           >  cut(indexMVA_,             double()) || ignoreCut(indexMVA_)              ) passCut(ret, indexMVA_ );
    if ( electronIDboolean                                     || ignoreCut(indexElectronId_)       ) passCut(ret, indexElectronId_);
    setIgnored(ret);
    return (bool)ret;
  }

Member Data Documentation

std::string PFElectronSelector::electronIDvalue_ [private]

Definition at line 149 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

Definition at line 144 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

Definition at line 143 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

Definition at line 147 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

Definition at line 141 of file PFElectronSelector.h.

Definition at line 142 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

Definition at line 146 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

Definition at line 145 of file PFElectronSelector.h.

Referenced by initialize(), and spring11Cuts().

Definition at line 17 of file PFElectronSelector.h.

Referenced by PFElectronSelector().

Definition at line 139 of file PFElectronSelector.h.

Referenced by initialize(), and operator()().