CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
pf2pat::PFIsoDepositAlgo Class Reference

#include <PFIsoDepositAlgo.h>

Public Types

typedef std::vector< reco::IsoDepositIsoDeposits
 
typedef reco::PFCandidate Particle
 
typedef std::vector< ParticleParticleCollection
 

Public Member Functions

 PFIsoDepositAlgo (const edm::ParameterSet &)
 
const IsoDepositsproduce (const ParticleCollection &toBeIsolated, const ParticleCollection &forIsolation)
 
 ~PFIsoDepositAlgo ()
 

Private Member Functions

reco::IsoDeposit buildIsoDeposit (const Particle &particle, const ParticleCollection &forIsolation) const
 build the IsoDeposit for "particle" More...
 
bool sameParticle (const Particle &particle1, const Particle &particle2) const
 checks if the 2 particles are in fact the same More...
 

Private Attributes

IsoDeposits isoDeposits_
 IsoDeposits computed in the produce function. More...
 
bool verbose_
 

Detailed Description

Definition at line 26 of file PFIsoDepositAlgo.h.

Member Typedef Documentation

◆ IsoDeposits

Definition at line 33 of file PFIsoDepositAlgo.h.

◆ Particle

Definition at line 29 of file PFIsoDepositAlgo.h.

◆ ParticleCollection

Definition at line 30 of file PFIsoDepositAlgo.h.

Constructor & Destructor Documentation

◆ PFIsoDepositAlgo()

PFIsoDepositAlgo::PFIsoDepositAlgo ( const edm::ParameterSet iConfig)
explicit

Definition at line 15 of file PFIsoDepositAlgo.cc.

16  : verbose_(iConfig.getUntrackedParameter<bool>("verbose", false))
17 
18 {}

◆ ~PFIsoDepositAlgo()

PFIsoDepositAlgo::~PFIsoDepositAlgo ( )

Definition at line 20 of file PFIsoDepositAlgo.cc.

20 {}

Member Function Documentation

◆ buildIsoDeposit()

IsoDeposit PFIsoDepositAlgo::buildIsoDeposit ( const Particle particle,
const ParticleCollection forIsolation 
) const
private

build the IsoDeposit for "particle"

Definition at line 43 of file PFIsoDepositAlgo.cc.

43  {
44  reco::isodeposit::Direction pfDir(particle.eta(), particle.phi());
45  // reco::IsoDeposit::Veto veto;
46  // veto.vetoDir = pfDir;
47  // veto.dR = 0.05;
48 
49  IsoDeposit isoDep(pfDir);
50 
51  for (unsigned i = 0; i < forIsolation.size(); i++) {
52  const reco::PFCandidate& pfc = forIsolation[i];
53 
54  // need to remove "particle"!
55 
56  if (sameParticle(particle, pfc))
57  continue;
58 
59  const XYZTLorentzVector& pvi(pfc.p4());
60  reco::isodeposit::Direction dirPfc(pfc.eta(), pfc.phi());
61  double dR = pfDir.deltaR(dirPfc);
62 
63  //COLIN make a parameter
64  double maxDeltaRForIsoDep_ = 1;
65  if (dR > maxDeltaRForIsoDep_) {
66  // if( verbose_ ) cout<<"OUT OF CONE"<<endl;
67  continue;
68  }
69  // else if(verbose_) cout<<endl;
70 
71  if (verbose_)
72  cout << "\t" << pfc << endl;
73 
74  double pt = pvi.Pt();
75  isoDep.addDeposit(dirPfc, pt);
76  }
77 
78  return isoDep;
79 }

References gather_cfg::cout, HGC3DClusterGenMatchSelector_cfi::dR, reco::LeafCandidate::eta(), mps_fire::i, reco::LeafCandidate::p4(), reco::LeafCandidate::phi(), DiDispStaMuonMonitor_cfi::pt, sameParticle(), and verbose_.

Referenced by produce().

◆ produce()

const PFIsoDepositAlgo::IsoDeposits & PFIsoDepositAlgo::produce ( const ParticleCollection toBeIsolated,
const ParticleCollection forIsolation 
)

all the filtering is done before could gain in performance by having a single loop, and by producing all isodeposits at the same time? however, would not gain in ease of maintenance, and in flexibility.

Definition at line 22 of file PFIsoDepositAlgo.cc.

23  {
24  isoDeposits_.clear();
25  isoDeposits_.reserve(toBeIsolated.size());
26 
27  for (unsigned i = 0; i < toBeIsolated.size(); i++) {
28  const reco::PFCandidate& toBeIso = toBeIsolated[i];
29 
30  if (verbose_)
31  cout << "to be isolated: " << toBeIso << endl;
32 
33  isoDeposits_.push_back(buildIsoDeposit(toBeIso, forIsolation));
34  }
35 
36  if (verbose_) {
37  cout << "PFIsoDepositAlgo " << endl;
38  }
39 
40  return isoDeposits_;
41 }

References buildIsoDeposit(), gather_cfg::cout, mps_fire::i, isoDeposits_, and verbose_.

◆ sameParticle()

bool PFIsoDepositAlgo::sameParticle ( const Particle particle1,
const Particle particle2 
) const
private

checks if the 2 particles are in fact the same

Definition at line 81 of file PFIsoDepositAlgo.cc.

81  {
82  double smallNumber = 1e-15;
83 
84  if (particle1.particleId() != particle2.particleId())
85  return false;
86  else if (fabs(particle1.energy() - particle2.energy()) > smallNumber)
87  return false;
88  else if (fabs(particle1.eta() - particle2.eta()) > smallNumber)
89  return false;
90  else if (fabs(particle1.eta() - particle2.eta()) > smallNumber)
91  return false;
92  else
93  return true;
94 }

References MillePedeFileConverter_cfg::e, reco::LeafCandidate::energy(), reco::LeafCandidate::eta(), and reco::PFCandidate::particleId().

Referenced by buildIsoDeposit().

Member Data Documentation

◆ isoDeposits_

IsoDeposits pf2pat::PFIsoDepositAlgo::isoDeposits_
private

IsoDeposits computed in the produce function.

Definition at line 53 of file PFIsoDepositAlgo.h.

Referenced by produce().

◆ verbose_

bool pf2pat::PFIsoDepositAlgo::verbose_
private

Definition at line 55 of file PFIsoDepositAlgo.h.

Referenced by buildIsoDeposit(), and produce().

pf2pat::PFIsoDepositAlgo::buildIsoDeposit
reco::IsoDeposit buildIsoDeposit(const Particle &particle, const ParticleCollection &forIsolation) const
build the IsoDeposit for "particle"
Definition: PFIsoDepositAlgo.cc:43
mps_fire.i
i
Definition: mps_fire.py:355
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
gather_cfg.cout
cout
Definition: gather_cfg.py:144
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
reco::Particle::eta
double eta() const
momentum pseudorapidity
Definition: Particle.h:126
pf2pat::PFIsoDepositAlgo::isoDeposits_
IsoDeposits isoDeposits_
IsoDeposits computed in the produce function.
Definition: PFIsoDepositAlgo.h:53
pf2pat::PFIsoDepositAlgo::verbose_
bool verbose_
Definition: PFIsoDepositAlgo.h:55
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
reco::Particle::energy
double energy() const
energy
Definition: Particle.h:99
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
reco::Particle::phi
double phi() const
momentum azimuthal angle
Definition: Particle.h:122
pf2pat::PFIsoDepositAlgo::sameParticle
bool sameParticle(const Particle &particle1, const Particle &particle2) const
checks if the 2 particles are in fact the same
Definition: PFIsoDepositAlgo.cc:81
reco::IsoDeposit
Definition: IsoDeposit.h:49
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37