CMS 3D CMS Logo

PFIsoDepositAlgo.cc
Go to the documentation of this file.
2 
4 
6 
8 
9 using namespace std;
10 using namespace edm;
11 using namespace reco;
12 using namespace math;
13 using namespace pf2pat;
14 
15 PFIsoDepositAlgo::PFIsoDepositAlgo(const edm::ParameterSet& iConfig)
16  : verbose_(iConfig.getUntrackedParameter<bool>("verbose", false))
17 
18 {}
19 
21 
23  const ParticleCollection& forIsolation) {
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 }
42 
43 IsoDeposit PFIsoDepositAlgo::buildIsoDeposit(const Particle& particle, const ParticleCollection& forIsolation) const {
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 }
80 
81 bool PFIsoDepositAlgo::sameParticle(const Particle& particle1, const Particle& particle2) const {
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 }
pf2pat::PFIsoDepositAlgo::buildIsoDeposit
reco::IsoDeposit buildIsoDeposit(const Particle &particle, const ParticleCollection &forIsolation) const
build the IsoDeposit for "particle"
Definition: PFIsoDepositAlgo.cc:43
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
funct::false
false
Definition: Factorize.h:34
pf2pat::PFIsoDepositAlgo::~PFIsoDepositAlgo
~PFIsoDepositAlgo()
Definition: PFIsoDepositAlgo.cc:20
PFCandidate.h
pf2pat
Definition: ElectronIDPFCandidateSelectorDefinition.h:22
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
edm
HLT enums.
Definition: AlignableModifier.h:19
pf2pat::PFIsoDepositAlgo::ParticleCollection
std::vector< Particle > ParticleCollection
Definition: PFIsoDepositAlgo.h:30
gather_cfg.cout
cout
Definition: gather_cfg.py:144
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
pf2pat::PFIsoDepositAlgo::isoDeposits_
IsoDeposits isoDeposits_
IsoDeposits computed in the produce function.
Definition: PFIsoDepositAlgo.h:53
pf2pat::PFIsoDepositAlgo::verbose_
bool verbose_
Definition: PFIsoDepositAlgo.h:55
pf2pat::PFIsoDepositAlgo::produce
const IsoDeposits & produce(const ParticleCollection &toBeIsolated, const ParticleCollection &forIsolation)
Definition: PFIsoDepositAlgo.cc:22
PFIsoDepositAlgo.h
edm::ParameterSet
Definition: ParameterSet.h:36
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
reco::PFCandidate::particleId
virtual ParticleType particleId() const
Definition: PFCandidate.h:366
LorentzVector.h
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:114
std
Definition: JetResolutionObject.h:76
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
math
Definition: choleskyInversion.h:19
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
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
pf2pat::PFIsoDepositAlgo::IsoDeposits
std::vector< reco::IsoDeposit > IsoDeposits
Definition: PFIsoDepositAlgo.h:33
EventSetup.h
Particle
Definition: Particle.py:1
reco::IsoDeposit
Definition: IsoDeposit.h:49
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
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