CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

pf2pat::IsolatedPFCandidateSelectorDefinition Class Reference

#include <IsolatedPFCandidateSelectorDefinition.h>

Inheritance diagram for pf2pat::IsolatedPFCandidateSelectorDefinition:
pf2pat::PFCandidateSelectorDefinition

List of all members.

Public Types

typedef edm::ValueMap< double > IsoMap

Public Member Functions

 IsolatedPFCandidateSelectorDefinition (const edm::ParameterSet &cfg)
void select (const HandleToCollection &hc, const edm::EventBase &e, const edm::EventSetup &s)

Private Attributes

double deltaBetaFactor_
edm::InputTag deltaBetaIsolationValueMap_
bool doDeltaBetaCorrection_
double isolationCut_
std::vector< edm::InputTagisolationValueMapChargedLabels_
std::vector< edm::InputTagisolationValueMapNeutralLabels_
bool isRelative_

Detailed Description

Definition at line 12 of file IsolatedPFCandidateSelectorDefinition.h.


Member Typedef Documentation

Definition at line 15 of file IsolatedPFCandidateSelectorDefinition.h.


Constructor & Destructor Documentation

pf2pat::IsolatedPFCandidateSelectorDefinition::IsolatedPFCandidateSelectorDefinition ( const edm::ParameterSet cfg) [inline]

Definition at line 17 of file IsolatedPFCandidateSelectorDefinition.h.

                                                                          :
      isolationValueMapChargedLabels_(cfg.getParameter< std::vector<edm::InputTag> >("isolationValueMapsCharged") ),
      isolationValueMapNeutralLabels_(cfg.getParameter< std::vector<edm::InputTag> >("isolationValueMapsNeutral") ),
      doDeltaBetaCorrection_(cfg.getParameter<bool>("doDeltaBetaCorrection")),
      deltaBetaIsolationValueMap_(cfg.getParameter< edm::InputTag >("deltaBetaIsolationValueMap") ),
      deltaBetaFactor_(cfg.getParameter<double>("deltaBetaFactor")),
      isRelative_(cfg.getParameter<bool>("isRelative")),
      isolationCut_(cfg.getParameter<double>("isolationCut")) {}

Member Function Documentation

void pf2pat::IsolatedPFCandidateSelectorDefinition::select ( const HandleToCollection hc,
const edm::EventBase e,
const edm::EventSetup s 
) [inline]

Definition at line 28 of file IsolatedPFCandidateSelectorDefinition.h.

References deltaBetaFactor_, deltaBetaIsolationValueMap_, doDeltaBetaCorrection_, edm::EventBase::getByLabel(), isolationCut_, isolationValueMapChargedLabels_, isolationValueMapNeutralLabels_, isRelative_, combine::key, and pf2pat::PFCandidateSelectorDefinition::selected_.

                                         {
      selected_.clear();
    

      // read all charged isolation value maps
      std::vector< edm::Handle<IsoMap> > 
        isoMapsCharged(isolationValueMapChargedLabels_.size());
      for(unsigned iMap = 0; iMap<isolationValueMapChargedLabels_.size(); ++iMap) {
        e.getByLabel(isolationValueMapChargedLabels_[iMap], isoMapsCharged[iMap]);
      }


      // read all neutral isolation value maps
      std::vector< edm::Handle<IsoMap> > 
        isoMapsNeutral(isolationValueMapNeutralLabels_.size());
      for(unsigned iMap = 0; iMap<isolationValueMapNeutralLabels_.size(); ++iMap) {
        e.getByLabel(isolationValueMapNeutralLabels_[iMap], isoMapsNeutral[iMap]);
      }

      edm::Handle<IsoMap> dBetaH;
      if(doDeltaBetaCorrection_) {
        e.getByLabel(deltaBetaIsolationValueMap_, dBetaH);
      }

      unsigned key=0;
      for( collection::const_iterator pfc = hc->begin(); 
           pfc != hc->end(); ++pfc, ++key) {
        reco::PFCandidateRef candidate(hc,key);

        bool passed = true;
        double isoSumCharged=0.0;
        double isoSumNeutral=0.0;

        for(unsigned iMap = 0; iMap<isoMapsCharged.size(); ++iMap) {
          const IsoMap & isoMap = *(isoMapsCharged[iMap]);
          double val = isoMap[candidate];
          isoSumCharged+=val;
        }

        for(unsigned iMap = 0; iMap<isoMapsNeutral.size(); ++iMap) {
          const IsoMap & isoMap = *(isoMapsNeutral[iMap]);
          double val = isoMap[candidate];
          isoSumNeutral+=val;
        }
        

        if ( doDeltaBetaCorrection_ ) {
          const IsoMap& isoMap = *dBetaH;
          double dBetaVal = isoMap[candidate];
          double dBetaCorIsoSumNeutral = isoSumNeutral + deltaBetaFactor_*dBetaVal; 
          isoSumNeutral = dBetaCorIsoSumNeutral>0 ? dBetaCorIsoSumNeutral : 0; //follow muon POG definition in 2012
        }

        double isoSum=isoSumCharged+isoSumNeutral;

        if( isRelative_ ) {
          isoSum /= candidate->pt();
        }

        if ( isoSum>isolationCut_ ) {
          passed = false;
        }

        if(passed) {
          // passed all cuts, selected
          selected_.push_back( reco::PFCandidate(*pfc) );
          reco::PFCandidatePtr ptrToMother( hc, key );
          selected_.back().setSourceCandidatePtr( ptrToMother );
        }
      }
    }

Member Data Documentation

Definition at line 108 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

Definition at line 107 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

Definition at line 106 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

Definition at line 110 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

Definition at line 104 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

Definition at line 105 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

Definition at line 109 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().