CMS 3D CMS Logo

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

Definition at line 19 of file IsolatedPFCandidateSelectorDefinition.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file IsolatedPFCandidateSelectorDefinition.h.

References looper::cfg, deltaBetaFactor_, deltaBetaIsolationValueMapToken_, doDeltaBetaCorrection_, isolationCut_, isolationValueMapNeutralTokens_, isRelative_, GlobalPosition_Frontier_DevDB_cff::tag, and edm::vector_transform().

21  :
22  isolationValueMapChargedTokens_(edm::vector_transform(cfg.getParameter< std::vector<edm::InputTag> >("isolationValueMapsCharged"), [&](edm::InputTag const & tag){return iC.consumes<IsoMap>(tag);}) ),
23  isolationValueMapNeutralTokens_(edm::vector_transform(cfg.getParameter< std::vector<edm::InputTag> >("isolationValueMapsNeutral"), [&](edm::InputTag const & tag){return iC.consumes<IsoMap>(tag);}) ),
24  doDeltaBetaCorrection_(cfg.getParameter<bool>("doDeltaBetaCorrection")),
25  deltaBetaIsolationValueMapToken_(iC.mayConsume<IsoMap>(cfg.getParameter< edm::InputTag >("deltaBetaIsolationValueMap") ) ),
26  deltaBetaFactor_(cfg.getParameter<double>("deltaBetaFactor")),
27  isRelative_(cfg.getParameter<bool>("isRelative")),
28  isolationCut_(cfg.getParameter<double>("isolationCut")) {}
T getParameter(std::string const &) const
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

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

Definition at line 32 of file IsolatedPFCandidateSelectorDefinition.h.

References deltaBetaFactor_, deltaBetaIsolationValueMapToken_, doDeltaBetaCorrection_, edm::Event::getByToken(), isolationCut_, isolationValueMapChargedTokens_, isolationValueMapNeutralTokens_, objects.IsoTrackAnalyzer::isoSum, isRelative_, crabWrapper::key, TriggerAnalyzer::passed, pf2pat::PFCandidateSelectorDefinition::selected_, and heppy_batch::val.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

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

Member Data Documentation

double pf2pat::IsolatedPFCandidateSelectorDefinition::deltaBetaFactor_
private
edm::EDGetTokenT<IsoMap> pf2pat::IsolatedPFCandidateSelectorDefinition::deltaBetaIsolationValueMapToken_
private
bool pf2pat::IsolatedPFCandidateSelectorDefinition::doDeltaBetaCorrection_
private
double pf2pat::IsolatedPFCandidateSelectorDefinition::isolationCut_
private
std::vector<edm::EDGetTokenT<IsoMap> > pf2pat::IsolatedPFCandidateSelectorDefinition::isolationValueMapChargedTokens_
private

Definition at line 108 of file IsolatedPFCandidateSelectorDefinition.h.

Referenced by select().

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