CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::IsoDeposit
IsoDeposits
 
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

Definition at line 33 of file PFIsoDepositAlgo.h.

Definition at line 29 of file PFIsoDepositAlgo.h.

Definition at line 30 of file PFIsoDepositAlgo.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file PFIsoDepositAlgo.cc.

16  : verbose_(iConfig.getUntrackedParameter<bool>("verbose", false))
17 
18 {}
T getUntrackedParameter(std::string const &, T const &) const
PFIsoDepositAlgo::~PFIsoDepositAlgo ( )

Definition at line 20 of file PFIsoDepositAlgo.cc.

20 {}

Member Function Documentation

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

build the IsoDeposit for "particle"

Definition at line 43 of file PFIsoDepositAlgo.cc.

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

Referenced by produce().

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 }
const LorentzVector & p4() const final
four-momentum Lorentz vector
double phi() const
momentum azimuthal angle
Definition: Particle.h:122
bool sameParticle(const Particle &particle1, const Particle &particle2) const
checks if the 2 particles are in fact the same
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
tuple cout
Definition: gather_cfg.py:144
double phi() const final
momentum azimuthal angle
double eta() const
momentum pseudorapidity
Definition: Particle.h:126
double deltaR(const Direction &dir2) const
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
double eta() const final
momentum pseudorapidity
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.

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

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 }
IsoDeposits isoDeposits_
IsoDeposits computed in the produce function.
reco::IsoDeposit buildIsoDeposit(const Particle &particle, const ParticleCollection &forIsolation) const
build the IsoDeposit for &quot;particle&quot;
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
tuple cout
Definition: gather_cfg.py:144
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.

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

Referenced by buildIsoDeposit().

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 }
double energy() const
energy
Definition: Particle.h:99
double eta() const
momentum pseudorapidity
Definition: Particle.h:126

Member Data Documentation

IsoDeposits pf2pat::PFIsoDepositAlgo::isoDeposits_
private

IsoDeposits computed in the produce function.

Definition at line 53 of file PFIsoDepositAlgo.h.

Referenced by produce().

bool pf2pat::PFIsoDepositAlgo::verbose_
private

Definition at line 55 of file PFIsoDepositAlgo.h.

Referenced by buildIsoDeposit(), and produce().