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 Attributes
PfBlockBasedIsolation Class Reference

#include <PfBlockBasedIsolation.h>

Public Member Functions

std::vector< reco::PFCandidateRefcalculate (math::XYZTLorentzVectorD p4, const reco::PFCandidateRef pfEGCand, const edm::Handle< reco::PFCandidateCollection > pfCandidateHandle)
 
 PfBlockBasedIsolation ()
 
void setup (const edm::ParameterSet &conf)
 
 ~PfBlockBasedIsolation ()
 

Private Attributes

double coneSize_
 

Detailed Description

Definition at line 34 of file PfBlockBasedIsolation.h.

Constructor & Destructor Documentation

PfBlockBasedIsolation::PfBlockBasedIsolation ( )

Definition at line 22 of file PfBlockBasedIsolation.cc.

22  {
23  // Default Constructor.
24 }
PfBlockBasedIsolation::~PfBlockBasedIsolation ( )

Definition at line 30 of file PfBlockBasedIsolation.cc.

31 {
32 
33 }

Member Function Documentation

std::vector< reco::PFCandidateRef > PfBlockBasedIsolation::calculate ( math::XYZTLorentzVectorD  p4,
const reco::PFCandidateRef  pfEGCand,
const edm::Handle< reco::PFCandidateCollection pfCandidateHandle 
)

Definition at line 43 of file PfBlockBasedIsolation.cc.

References coneSize_, deltaR(), and PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR.

Referenced by ParticleBasedIsoProducer::produce().

43  {
44 
45  std::vector<reco::PFCandidateRef> myVec;
46 
47  math::XYZVector candidateMomentum(p4.px(),p4.py(),p4.pz());
48  math::XYZVector candidateDirection=candidateMomentum.Unit();
49 
50  const reco::PFCandidate::ElementsInBlocks& theElementsInpfEGcand = (*pfEGCand).elementsInBlocks();
51  reco::PFCandidate::ElementsInBlocks::const_iterator ieg = theElementsInpfEGcand.begin();
52  const reco::PFBlockRef egblock = ieg->first;
53 
54 
55  unsigned nObj = pfCandidateHandle->size();
56  for(unsigned int lCand=0; lCand < nObj; lCand++) {
57 
58  reco::PFCandidateRef pfCandRef(reco::PFCandidateRef(pfCandidateHandle,lCand));
59 
60  float dR = 0.0;
61  if( coneSize_ < 10.0 ) {
62  dR = deltaR(candidateDirection.Eta(), candidateDirection.Phi(), pfCandRef->eta(), pfCandRef->phi());
63  if ( dR> coneSize_ ) continue;
64  }
65 
66  const reco::PFCandidate::ElementsInBlocks& theElementsInPFcand = pfCandRef->elementsInBlocks();
67 
68  bool elementFound=false;
69  for (reco::PFCandidate::ElementsInBlocks::const_iterator ipf = theElementsInPFcand.begin(); ipf<theElementsInPFcand.end(); ++ipf) {
70 
71  if ( ipf->first == egblock && !elementFound ) {
72 
73  for (ieg = theElementsInpfEGcand.begin(); ieg<theElementsInpfEGcand.end(); ++ieg) {
74  if ( ipf->second == ieg->second && !elementFound ) {
75  elementFound=true;
76  myVec.push_back(pfCandRef);
77 
78  }
79  }
80 
81 
82 
83  }
84  }
85 
86 
87 
88  }
89 
90 
91 
92  return myVec;
93 
94 
95 
96  }
std::vector< ElementInBlock > ElementsInBlocks
Definition: PFCandidate.h:368
double p4[4]
Definition: TauolaWrapper.h:92
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
void PfBlockBasedIsolation::setup ( const edm::ParameterSet conf)

Definition at line 36 of file PfBlockBasedIsolation.cc.

References coneSize_, and edm::ParameterSet::getParameter().

Referenced by ParticleBasedIsoProducer::beginRun().

36  {
37 
38  coneSize_ = conf.getParameter<double>("coneSize");
39 
40 }
T getParameter(std::string const &) const

Member Data Documentation

double PfBlockBasedIsolation::coneSize_
private

Definition at line 59 of file PfBlockBasedIsolation.h.

Referenced by calculate(), and setup().