#include <IsolatedPFCandidateSelectorDefinition.h>
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 | combinedIsolationCut_ |
bool | isCombined_ |
std::vector< double > | isolationCuts_ |
std::vector< edm::InputTag > | isolationValueMapLabels_ |
bool | isRelative_ |
Definition at line 12 of file IsolatedPFCandidateSelectorDefinition.h.
typedef edm::ValueMap<double> pf2pat::IsolatedPFCandidateSelectorDefinition::IsoMap |
Definition at line 15 of file IsolatedPFCandidateSelectorDefinition.h.
pf2pat::IsolatedPFCandidateSelectorDefinition::IsolatedPFCandidateSelectorDefinition | ( | const edm::ParameterSet & | cfg | ) | [inline] |
Definition at line 17 of file IsolatedPFCandidateSelectorDefinition.h.
References isolationCuts_, and isolationValueMapLabels_.
: isolationValueMapLabels_(cfg.getParameter< std::vector<edm::InputTag> >("isolationValueMaps") ), isRelative_(cfg.getParameter<bool>("isRelative")), isCombined_(cfg.getParameter<bool>("isCombined")), isolationCuts_(cfg.getParameter< std::vector<double> >("isolationCuts")), combinedIsolationCut_(cfg.getParameter<double>("combinedIsolationCut")) { if( isolationCuts_.size() != isolationValueMapLabels_.size() ) throw cms::Exception("BadConfiguration")<<"the vector of isolation ValueMaps and the vector of the corresponding cuts must have the same size."<<std::endl; }
void pf2pat::IsolatedPFCandidateSelectorDefinition::select | ( | const HandleToCollection & | hc, |
const edm::EventBase & | e, | ||
const edm::EventSetup & | s | ||
) | [inline] |
Definition at line 29 of file IsolatedPFCandidateSelectorDefinition.h.
References combinedIsolationCut_, align_tpl::cut, edm::EventBase::getByLabel(), isCombined_, isolationCuts_, isolationValueMapLabels_, isRelative_, combine::key, and pf2pat::PFCandidateSelectorDefinition::selected_.
{ selected_.clear(); /* assert( hc.isValid() ); */ // read all isolation value maps std::vector< edm::Handle<IsoMap> > isoMaps(isolationValueMapLabels_.size()); for(unsigned iMap = 0; iMap<isolationValueMapLabels_.size(); ++iMap) { e.getByLabel(isolationValueMapLabels_[iMap], isoMaps[iMap]); } unsigned key=0; // for( unsigned i=0; i<collection->size(); i++ ) { for( collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) { reco::PFCandidateRef candidate(hc,key); bool passed = true; double isoSum=0.0; for(unsigned iMap = 0; iMap<isoMaps.size(); ++iMap) { const IsoMap & isoMap = *(isoMaps[iMap]); double val = isoMap[candidate]; double cut = isolationCuts_[iMap]; if(isRelative_ && candidate->pt()>0.0) val/=candidate->pt(); isoSum+=val; //std::cout << "val " << iMap << " = " << val << std::endl; if ( !isCombined_ && val>cut ) { passed = false; break; } } if ( isCombined_ && isoSum>combinedIsolationCut_ ) { passed = false; } if(passed) { // passed all cuts, selected selected_.push_back( reco::PFCandidate(*pfc) ); reco::PFCandidatePtr ptrToMother( hc, key ); selected_.back().setSourceCandidatePtr( ptrToMother ); } } }
double pf2pat::IsolatedPFCandidateSelectorDefinition::combinedIsolationCut_ [private] |
Definition at line 85 of file IsolatedPFCandidateSelectorDefinition.h.
Referenced by select().
bool pf2pat::IsolatedPFCandidateSelectorDefinition::isCombined_ [private] |
Definition at line 83 of file IsolatedPFCandidateSelectorDefinition.h.
Referenced by select().
std::vector<double> pf2pat::IsolatedPFCandidateSelectorDefinition::isolationCuts_ [private] |
Definition at line 84 of file IsolatedPFCandidateSelectorDefinition.h.
Referenced by IsolatedPFCandidateSelectorDefinition(), and select().
std::vector<edm::InputTag> pf2pat::IsolatedPFCandidateSelectorDefinition::isolationValueMapLabels_ [private] |
Definition at line 82 of file IsolatedPFCandidateSelectorDefinition.h.
Referenced by IsolatedPFCandidateSelectorDefinition(), and select().
bool pf2pat::IsolatedPFCandidateSelectorDefinition::isRelative_ [private] |
Definition at line 83 of file IsolatedPFCandidateSelectorDefinition.h.
Referenced by select().