CMS 3D CMS Logo

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

#include <PFCandidateStripMerger.h>

Inheritance diagram for PFCandidateStripMerger:
PFCandidateMergerBase

Public Member Functions

std::vector
< reco::PFCandidateRefVector
mergeCandidates (const reco::PFCandidateRefVector &)
 
 PFCandidateStripMerger ()
 
 PFCandidateStripMerger (const edm::ParameterSet &)
 
 ~PFCandidateStripMerger ()
 
- Public Member Functions inherited from PFCandidateMergerBase
 PFCandidateMergerBase (const edm::ParameterSet &)
 
 PFCandidateMergerBase ()
 
virtual ~PFCandidateMergerBase ()=0
 

Private Member Functions

bool candidateMatches (const reco::PFCandidateRef &)
 

Private Attributes

double etaAssociationDistance_
 
std::vector< int > inputPdgIds_
 
double phiAssociationDistance_
 

Detailed Description

PFCandidateStripMerger

Class that creates strips from Particle Flow Candidates And outputs a Collection of Candidate Lists

Michail Bachtis

University of Wisconsin bacht.nosp@m.is@c.nosp@m.ern.c.nosp@m.h

Definition at line 15 of file PFCandidateStripMerger.h.

Constructor & Destructor Documentation

PFCandidateStripMerger::PFCandidateStripMerger ( )

Definition at line 6 of file PFCandidateStripMerger.cc.

PFCandidateStripMerger::PFCandidateStripMerger ( const edm::ParameterSet config)

Definition at line 10 of file PFCandidateStripMerger.cc.

References etaAssociationDistance_, edm::ParameterSet::getParameter(), inputPdgIds_, and phiAssociationDistance_.

10  :
11  PFCandidateMergerBase(config)
12 {
13  inputPdgIds_ = config.getParameter<std::vector<int> >("stripCandidatesPdgIds");
14  etaAssociationDistance_ = config.getParameter<double>("stripEtaAssociationDistance");
15  phiAssociationDistance_ = config.getParameter<double>("stripPhiAssociationDistance");
16 
17 }
T getParameter(std::string const &) const
std::vector< int > inputPdgIds_
PFCandidateStripMerger::~PFCandidateStripMerger ( )

Definition at line 20 of file PFCandidateStripMerger.cc.

21 {}

Member Function Documentation

bool PFCandidateStripMerger::candidateMatches ( const reco::PFCandidateRef cand)
private

Definition at line 25 of file PFCandidateStripMerger.cc.

References abs, i, and inputPdgIds_.

Referenced by mergeCandidates().

26 {
27  bool matches = false;
28  for(unsigned int i=0; i < inputPdgIds_.size(); ++i) {
29  if(std::abs(cand->pdgId()) == inputPdgIds_.at(i)) {
30  matches = true;
31  continue;
32  }
33  }
34 
35  return matches;
36 }
int i
Definition: DBlmapReader.cc:9
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< int > inputPdgIds_
vector< PFCandidateRefVector > PFCandidateStripMerger::mergeCandidates ( const reco::PFCandidateRefVector candidates)
virtual

Implements PFCandidateMergerBase.

Definition at line 43 of file PFCandidateStripMerger.cc.

References edm::RefVector< C, T, F >::at(), candidateMatches(), edm::RefVector< C, T, F >::clear(), etaAssociationDistance_, i, phiAssociationDistance_, edm::RefVector< C, T, F >::push_back(), edm::RefVector< C, T, F >::size(), TauTagTools::sortRefVectorByPt(), strip(), RecoTauPiZeroBuilderPlugins_cfi::strips, and edm::RefVector< C, T, F >::swap().

44 {
45 
46  //Copy the input getting the relevant candidates and sort by pt
48  for(unsigned int i=0;i<candidates.size();++i)
49  if(candidateMatches(candidates.at(i)))
50  cands.push_back(candidates.at(i));
51 
52  if(cands.size()>1)
54 
55  std::vector<PFCandidateRefVector> strips;
56 
57 
58  //Repeat while there are still unclusterized gammas
59  while(cands.size()>0) {
60 
61  //save the non associated candidates to a different collection
62  PFCandidateRefVector notAssociated;
63 
64  //Create a cluster from the Seed Photon
66  math::XYZTLorentzVector stripVector;
67  strip.push_back(cands.at(0));
68  stripVector=cands.at(0)->p4();
69 
70  //Loop and associate
71  for(unsigned int i=1;i<cands.size();++i) {
72  if(fabs(cands.at(i)->eta()-stripVector.eta())<etaAssociationDistance_ &&
73  fabs(ROOT::Math::VectorUtil::DeltaPhi(cands.at(i)->p4(),stripVector))<phiAssociationDistance_) {
74  strip.push_back(cands.at(i));
75  stripVector+=cands.at(i)->p4();
76  }
77  else {
78  notAssociated.push_back(cands.at(i));
79  }
80  }
81  //Save the strip
82  strips.push_back(strip);
83 
84  //Swap the candidate vector with the non associated vector
85  cands.swap(notAssociated);
86  //Clear
87  notAssociated.clear();
88  }
89 
90  return strips;
91 }
int i
Definition: DBlmapReader.cc:9
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
void sortRefVectorByPt(reco::PFCandidateRefVector &)
Definition: TauTagTools.cc:242
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
void swap(RefVector< C, T, F > &other)
Swap two vectors.
Definition: RefVector.h:162
bool candidateMatches(const reco::PFCandidateRef &)
void clear()
Clear the vector.
Definition: RefVector.h:133
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
Definition: RefVector.h:76
void push_back(value_type const &ref)
Add a Ref&lt;C, T&gt; to the RefVector.
Definition: RefVector.h:64
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89

Member Data Documentation

double PFCandidateStripMerger::etaAssociationDistance_
private

Definition at line 27 of file PFCandidateStripMerger.h.

Referenced by mergeCandidates(), and PFCandidateStripMerger().

std::vector<int> PFCandidateStripMerger::inputPdgIds_
private

Definition at line 26 of file PFCandidateStripMerger.h.

Referenced by candidateMatches(), and PFCandidateStripMerger().

double PFCandidateStripMerger::phiAssociationDistance_
private

Definition at line 28 of file PFCandidateStripMerger.h.

Referenced by mergeCandidates(), and PFCandidateStripMerger().