CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Types | Public Member Functions | Private Attributes
pf2pat::IsolatedPFCandidateSelectorDefinition Class Reference

#include <IsolatedPFCandidateSelectorDefinition.h>

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

Public Types

typedef edm::ValueMap< double > IsoMap
 
- Public Types inherited from pf2pat::PFCandidateSelectorDefinition
typedef reco::PFCandidateCollection collection
 
typedef boost::transform_iterator< Pointer, container::const_iterator > const_iterator
 
typedef std::vector< reco::PFCandidatecontainer
 
typedef edm::Handle< collectionHandleToCollection
 

Public Member Functions

 IsolatedPFCandidateSelectorDefinition (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
void select (const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
 
- Public Member Functions inherited from pf2pat::PFCandidateSelectorDefinition
const_iterator begin () const
 
const_iterator end () const
 
 PFCandidateSelectorDefinition ()
 
const containerselected () const
 
size_t size () const
 

Private Attributes

double deltaBetaFactor_
 
edm::EDGetTokenT< IsoMapdeltaBetaIsolationValueMapToken_
 
bool doDeltaBetaCorrection_
 
double isolationCut_
 
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapChargedTokens_
 
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapNeutralTokens_
 
bool isRelative_
 

Additional Inherited Members

- Protected Attributes inherited from pf2pat::PFCandidateSelectorDefinition
container selected_
 

Detailed Description

Definition at line 16 of file IsolatedPFCandidateSelectorDefinition.h.

Member Typedef Documentation

◆ IsoMap

Definition at line 18 of file IsolatedPFCandidateSelectorDefinition.h.

Constructor & Destructor Documentation

◆ IsolatedPFCandidateSelectorDefinition()

pf2pat::IsolatedPFCandidateSelectorDefinition::IsolatedPFCandidateSelectorDefinition ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 20 of file IsolatedPFCandidateSelectorDefinition.h.

References makeGlobalPositionRcd_cfg::tag.

22  edm::vector_transform(cfg.getParameter<std::vector<edm::InputTag> >("isolationValueMapsCharged"),
23  [&](edm::InputTag const& tag) { return iC.consumes<IsoMap>(tag); })),
25  edm::vector_transform(cfg.getParameter<std::vector<edm::InputTag> >("isolationValueMapsNeutral"),
26  [&](edm::InputTag const& tag) { return iC.consumes<IsoMap>(tag); })),
27  doDeltaBetaCorrection_(cfg.getParameter<bool>("doDeltaBetaCorrection")),
29  iC.mayConsume<IsoMap>(cfg.getParameter<edm::InputTag>("deltaBetaIsolationValueMap"))),
30  deltaBetaFactor_(cfg.getParameter<double>("deltaBetaFactor")),
31  isRelative_(cfg.getParameter<bool>("isRelative")),
32  isolationCut_(cfg.getParameter<double>("isolationCut")) {}
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapChargedTokens_
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapNeutralTokens_

Member Function Documentation

◆ select()

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

Definition at line 34 of file IsolatedPFCandidateSelectorDefinition.h.

References deltaBetaFactor_, deltaBetaIsolationValueMapToken_, doDeltaBetaCorrection_, MillePedeFileConverter_cfg::e, isolationCut_, isolationValueMapChargedTokens_, isolationValueMapNeutralTokens_, objects.IsoTrackAnalyzer::isoSum, isRelative_, submitPVResolutionJobs::key, TriggerAnalyzer::passed, pf2pat::PFCandidateSelectorDefinition::selected_, and heppy_batch::val.

34  {
35  selected_.clear();
36 
37  // read all charged isolation value maps
38  std::vector<edm::Handle<IsoMap> > isoMapsCharged(isolationValueMapChargedTokens_.size());
39  for (unsigned iMap = 0; iMap < isolationValueMapChargedTokens_.size(); ++iMap) {
40  e.getByToken(isolationValueMapChargedTokens_[iMap], isoMapsCharged[iMap]);
41  }
42 
43  // read all neutral isolation value maps
44  std::vector<edm::Handle<IsoMap> > isoMapsNeutral(isolationValueMapNeutralTokens_.size());
45  for (unsigned iMap = 0; iMap < isolationValueMapNeutralTokens_.size(); ++iMap) {
46  e.getByToken(isolationValueMapNeutralTokens_[iMap], isoMapsNeutral[iMap]);
47  }
48 
49  edm::Handle<IsoMap> dBetaH;
51  e.getByToken(deltaBetaIsolationValueMapToken_, dBetaH);
52  }
53 
54  unsigned key = 0;
55  for (collection::const_iterator pfc = hc->begin(); pfc != hc->end(); ++pfc, ++key) {
56  reco::PFCandidateRef candidate(hc, key);
57 
58  bool passed = true;
59  double isoSumCharged = 0.0;
60  double isoSumNeutral = 0.0;
61 
62  for (unsigned iMap = 0; iMap < isoMapsCharged.size(); ++iMap) {
63  const IsoMap& isoMap = *(isoMapsCharged[iMap]);
64  double val = isoMap[candidate];
65  isoSumCharged += val;
66  }
67 
68  for (unsigned iMap = 0; iMap < isoMapsNeutral.size(); ++iMap) {
69  const IsoMap& isoMap = *(isoMapsNeutral[iMap]);
70  double val = isoMap[candidate];
71  isoSumNeutral += val;
72  }
73 
75  const IsoMap& isoMap = *dBetaH;
76  double dBetaVal = isoMap[candidate];
77  double dBetaCorIsoSumNeutral = isoSumNeutral + deltaBetaFactor_ * dBetaVal;
78  isoSumNeutral = dBetaCorIsoSumNeutral > 0 ? dBetaCorIsoSumNeutral : 0; //follow muon POG definition in 2012
79  }
80 
81  double isoSum = isoSumCharged + isoSumNeutral;
82 
83  if (isRelative_) {
84  isoSum /= candidate->pt();
85  }
86 
87  if (isoSum > isolationCut_) {
88  passed = false;
89  }
90 
91  if (passed) {
92  // passed all cuts, selected
93  selected_.push_back(reco::PFCandidate(*pfc));
94  reco::PFCandidatePtr ptrToMother(hc, key);
95  selected_.back().setSourceCandidatePtr(ptrToMother);
96  }
97  }
98  }
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapChargedTokens_
key
prepare the HTCondor submission files and eventually submit them
std::vector< edm::EDGetTokenT< IsoMap > > isolationValueMapNeutralTokens_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
isoSum
===> compute the isolation and find the most isolated track

Member Data Documentation

◆ deltaBetaFactor_

double pf2pat::IsolatedPFCandidateSelectorDefinition::deltaBetaFactor_
private

Definition at line 105 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

◆ deltaBetaIsolationValueMapToken_

edm::EDGetTokenT<IsoMap> pf2pat::IsolatedPFCandidateSelectorDefinition::deltaBetaIsolationValueMapToken_
private

Definition at line 104 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

◆ doDeltaBetaCorrection_

bool pf2pat::IsolatedPFCandidateSelectorDefinition::doDeltaBetaCorrection_
private

Definition at line 103 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

◆ isolationCut_

double pf2pat::IsolatedPFCandidateSelectorDefinition::isolationCut_
private

Definition at line 107 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

◆ isolationValueMapChargedTokens_

std::vector<edm::EDGetTokenT<IsoMap> > pf2pat::IsolatedPFCandidateSelectorDefinition::isolationValueMapChargedTokens_
private

Definition at line 101 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

◆ isolationValueMapNeutralTokens_

std::vector<edm::EDGetTokenT<IsoMap> > pf2pat::IsolatedPFCandidateSelectorDefinition::isolationValueMapNeutralTokens_
private

Definition at line 102 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

◆ isRelative_

bool pf2pat::IsolatedPFCandidateSelectorDefinition::isRelative_
private

Definition at line 106 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().