![]() |
![]() |
#include <PhysicsTools/PatUtils/ElectronSelector.h>
Public Member Functions | |
ElectronSelector (const ElectronSelection &cfg) | |
const ParticleStatus | filter (const unsigned int &index, const edm::View< Electron > &electrons, const ElectronIDmap &electronIDs, const reco::ClusterShape *clusterShape) const |
Returns 0 if electron matches criteria, a flag otherwise. | |
~ElectronSelector () | |
Private Types | |
typedef reco::GsfElectron | Electron |
typedef reco::ElectronIDAssociationCollection | ElectronIDmap |
Private Member Functions | |
const ParticleStatus | customSelection_ (const unsigned int &index, const edm::View< Electron > &electrons, const reco::ClusterShape *clusterShape) const |
Full-fledged selection based on SusyAnalyser. | |
const reco::ElectronIDRef & | electronID_ (const unsigned int &index, const edm::View< Electron > &electrons, const ElectronIDmap &electronIDs) const |
Returns the electron ID object based on the given electron. | |
Private Attributes | |
ElectronSelection | config_ |
The electron selector returns a flag (see pat::ParticleStatus) based on one of the possible selections: either eId-based (cut, likelihood, neural net) or custom (user-defined set of cuts). This is driven by the configuration parameters (see the PATElectronCleaner documentation for configuration details).
The parameters are passed to the selector through an ElectronSelection struct. (An adapter exists for use in CMSSW: reco::modules::ParameterAdapter< pat::ElectronSelector >.)
Definition at line 52 of file ElectronSelector.h.
typedef reco::GsfElectron pat::ElectronSelector::Electron [private] |
Definition at line 54 of file ElectronSelector.h.
typedef reco::ElectronIDAssociationCollection pat::ElectronSelector::ElectronIDmap [private] |
Definition at line 55 of file ElectronSelector.h.
pat::ElectronSelector::ElectronSelector | ( | const ElectronSelection & | cfg | ) | [inline] |
pat::ElectronSelector::~ElectronSelector | ( | ) | [inline] |
const pat::ParticleStatus ElectronSelector::customSelection_ | ( | const unsigned int & | index, | |
const edm::View< Electron > & | electrons, | |||
const reco::ClusterShape * | clusterShape | |||
) | const [private] |
Full-fledged selection based on SusyAnalyser.
Definition at line 69 of file ElectronSelector.cc.
References pat::BAD, reco::GsfElectron::caloEnergy(), config_, reco::ClusterShape::covEtaEta(), reco::ClusterShape::covPhiPhi(), pat::ElectronSelection::DeltaEtaInBarmax, pat::ElectronSelection::DeltaEtaInEndmax, reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), pat::ElectronSelection::DeltaPhiInBarmax, pat::ElectronSelection::DeltaPhiInEndmax, pat::ElectronSelection::DeltaPhiOutBarmax, pat::ElectronSelection::DeltaPhiOutEndmax, reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), pat::ElectronSelection::doBremEoverPcomp, reco::ClusterShape::e3x3(), reco::ClusterShape::e5x5(), pat::ElectronSelection::E9overE25Barmin, pat::ElectronSelection::E9overE25Endmin, metsig::electron, pat::ElectronSelection::EoverPInBarmin, pat::ElectronSelection::EoverPInEndmin, reco::GsfElectron::eSuperClusterOverP(), eta, pat::GOOD, reco::GsfElectron::hadronicOverEm(), pat::HOVERE, pat::ElectronSelection::HoverEBarmax, pat::ElectronSelection::HoverEEndmax, pat::ElectronSelection::InvEMinusInvPBarmax, pat::ElectronSelection::InvEMinusInvPEndmax, pat::MATCHING, reco::Particle::p4(), pat::SHOWER, pat::ElectronSelection::SigmaEtaEtaBarmax, pat::ElectronSelection::SigmaEtaEtaEndmax, pat::ElectronSelection::SigmaPhiPhiBarmax, pat::ElectronSelection::SigmaPhiPhiEndmax, funct::sqrt(), reco::GsfElectron::trackMomentumAtVtx(), and reco::GsfElectron::trackMomentumOut().
Referenced by filter().
00073 { 00074 00075 // Note: this is all taken from SusyAnalyzer 00076 00077 const reco::GsfElectron& electron = electrons[index]; 00078 00079 // Retrieve information 00080 float eta = fabs(electron.p4().Eta()); 00081 float eOverPin = electron.eSuperClusterOverP(); 00082 float pin = electron.trackMomentumAtVtx().R(); 00083 float pout = electron.trackMomentumOut().R(); 00084 float fBrem = (pin-pout)/pin; 00085 float hOverE = electron.hadronicOverEm(); 00086 float deltaPhiIn = electron.deltaPhiSuperClusterTrackAtVtx(); 00087 float deltaEtaIn = electron.deltaEtaSuperClusterTrackAtVtx(); 00088 float deltaPhiOut = electron.deltaPhiSeedClusterTrackAtCalo(); 00089 float invEOverInvP = (1./electron.caloEnergy())-(1./electron.trackMomentumAtVtx().R()); 00090 float sigmaee = sqrt(clusterShape->covEtaEta()); 00091 float sigmapp = sqrt(clusterShape->covPhiPhi()); 00092 float E9overE25 = clusterShape->e3x3()/clusterShape->e5x5(); 00093 00094 bool inEndCap = false; // Switch between barrel (0) and endcap (2) 00095 if (eta > 1.479) { // See EgammaAnalysis/ElectronIDAlgos/src/CutBasedElectronID.cc 00096 inEndCap = true; 00097 sigmaee = sigmaee - 0.02*(fabs(eta) - 2.3); // Correct sigmaetaeta dependence on eta in endcap 00098 } 00099 00100 // Now do the selection 00101 // These ones come straight from E/gamma algo 00102 if ( (eOverPin < 0.8) && (fBrem < 0.2) ) return BAD; 00103 if ( config_.doBremEoverPcomp && (eOverPin < 0.9*(1-fBrem)) ) return BAD; 00104 00105 if ( (hOverE > config_.HoverEBarmax && !inEndCap ) 00106 || (hOverE > config_.HoverEEndmax && inEndCap ) ) 00107 return HOVERE; 00108 00109 if ( (E9overE25 < config_.E9overE25Barmin && !inEndCap ) 00110 || (E9overE25 < config_.E9overE25Endmin && inEndCap ) ) 00111 return SHOWER; 00112 00113 if ( (sigmaee > config_.SigmaEtaEtaBarmax && !inEndCap ) 00114 || (sigmaee > config_.SigmaEtaEtaEndmax && inEndCap ) ) 00115 return SHOWER; 00116 00117 if ( (sigmapp > config_.SigmaPhiPhiBarmax && !inEndCap ) 00118 || (sigmapp > config_.SigmaPhiPhiEndmax && inEndCap ) ) 00119 return SHOWER; 00120 00121 if ( (eOverPin < config_.EoverPInBarmin && !inEndCap ) 00122 || (eOverPin < config_.EoverPInEndmin && inEndCap ) ) 00123 return MATCHING; 00124 00125 if ( (fabs(deltaEtaIn) > config_.DeltaEtaInBarmax && !inEndCap ) 00126 || (fabs(deltaEtaIn) > config_.DeltaEtaInEndmax && inEndCap ) ) 00127 return MATCHING; 00128 00129 if ( (fabs(deltaPhiIn) < config_.DeltaPhiInBarmax && !inEndCap ) 00130 || (fabs(deltaPhiIn) < config_.DeltaPhiInEndmax && inEndCap ) ) 00131 return MATCHING; 00132 00133 if ( (fabs(deltaPhiOut) < config_.DeltaPhiOutBarmax && !inEndCap ) 00134 || (fabs(deltaPhiOut) < config_.DeltaPhiOutEndmax && inEndCap ) ) 00135 return MATCHING; 00136 00137 if ( (invEOverInvP > config_.InvEMinusInvPBarmax && !inEndCap ) 00138 || (invEOverInvP > config_.InvEMinusInvPEndmax && inEndCap ) ) 00139 return MATCHING; 00140 00141 return GOOD; 00142 00143 }
const reco::ElectronIDRef & ElectronSelector::electronID_ | ( | const unsigned int & | index, | |
const edm::View< Electron > & | electrons, | |||
const ElectronIDmap & | electronIDs | |||
) | const [private] |
Returns the electron ID object based on the given electron.
The latter is defined by an index in the vector of electrons. The ID is found in the association map.
Definition at line 53 of file ElectronSelector.cc.
References edm::AssociationMap< Tag >::find(), and edm::View< T >::refAt().
Referenced by filter().
00057 { 00058 // Find electron ID for electron with index index 00059 edm::Ref<std::vector<Electron> > elecsRef = electrons.refAt(index).castTo<edm::Ref<std::vector<Electron> > >(); 00060 ElectronIDmap::const_iterator electronID = electronIDs.find( elecsRef ); 00061 00062 // Return corresponding elecID 00063 return electronID->val; 00064 }
const pat::ParticleStatus ElectronSelector::filter | ( | const unsigned int & | index, | |
const edm::View< Electron > & | electrons, | |||
const ElectronIDmap & | electronIDs, | |||
const reco::ClusterShape * | clusterShape | |||
) | const |
Returns 0 if electron matches criteria, a flag otherwise.
Criteria depend on the selector's configuration. Electron IDs are only used if the selection is based on it (cut, neural net or likelihood). Cluster shapes are for custom selection only.
Definition at line 11 of file ElectronSelector.cc.
References pat::BAD, config_, edm::errors::Configuration, customSelection_(), electronID_(), pat::GOOD, pat::ElectronSelection::selectionType, and pat::ElectronSelection::value.
00016 { 00017 00018 // List of possible selections 00019 if ( config_.selectionType == "none" ) 00020 { 00021 return GOOD; 00022 } 00023 else if ( config_.selectionType == "cut" ) 00024 { 00025 if ( electronID_(index,electrons,electronIDs)->cutBasedDecision() ) return GOOD; 00026 return BAD; 00027 } 00028 else if ( config_.selectionType == "likelihood" ) 00029 { 00030 if ( electronID_(index,electrons,electronIDs)->likelihood() > config_.value ) return GOOD; 00031 return BAD; 00032 } 00033 else if ( config_.selectionType == "neuralnet" ) // FIXME: Check sign of comparison! 00034 { 00035 if ( electronID_(index,electrons,electronIDs)->neuralNetOutput() > config_.value ) return GOOD; 00036 return BAD; 00037 } 00038 else if ( config_.selectionType == "custom" ) 00039 { 00040 return customSelection_( index, electrons, clusterShape ); 00041 } 00042 00043 00044 // Throw! unknown configuration 00045 throw edm::Exception(edm::errors::Configuration) 00046 << "Unknown electron ID selection " << config_.selectionType; 00047 00048 }