Main Page
Namespaces
Classes
Package Documentation
CommonTools
ParticleFlow
src
PFIsoDepositAlgo.cc
Go to the documentation of this file.
1
#include "
CommonTools/ParticleFlow/interface/PFIsoDepositAlgo.h
"
2
3
#include "
DataFormats/ParticleFlowCandidate/interface/PFCandidate.h
"
4
5
#include "
DataFormats/Math/interface/LorentzVector.h
"
6
7
#include "
FWCore/Framework/interface/EventSetup.h
"
8
9
10
using namespace
std
;
11
using namespace
edm
;
12
using namespace
reco
;
13
using namespace
math
;
14
using namespace
pf2pat
;
15
16
PFIsoDepositAlgo::PFIsoDepositAlgo(
const
edm::ParameterSet
& iConfig):
17
verbose_ ( iConfig.getUntrackedParameter<
bool
>(
"verbose"
,
false
) )
18
19
{}
20
21
22
23
PFIsoDepositAlgo::~PFIsoDepositAlgo
() { }
24
25
26
const
PFIsoDepositAlgo::IsoDeposits
&
27
PFIsoDepositAlgo::produce
(
const
ParticleCollection
& toBeIsolated,
28
const
ParticleCollection
& forIsolation) {
29
30
31
isoDeposits_
.clear();
32
isoDeposits_
.reserve( toBeIsolated.size() );
33
34
for
(
unsigned
i
=0;
i
<toBeIsolated.size();
i
++ ) {
35
const
reco::PFCandidate
& toBeIso = toBeIsolated[
i
];
36
37
if
(
verbose_
)
38
cout
<<
"to be isolated: "
<<toBeIso<<endl;
39
40
isoDeposits_
.push_back(
buildIsoDeposit
( toBeIso, forIsolation ) );
41
}
42
43
44
if
(
verbose_
) {
45
cout
<<
"PFIsoDepositAlgo "
<<endl;
46
}
47
48
return
isoDeposits_
;
49
}
50
51
52
IsoDeposit
PFIsoDepositAlgo::buildIsoDeposit
(
const
Particle
& particle,
53
const
ParticleCollection
& forIsolation )
const
{
54
55
56
reco::isodeposit::Direction
pfDir(particle.
eta
(),
57
particle.
phi
());
58
// reco::IsoDeposit::Veto veto;
59
// veto.vetoDir = pfDir;
60
// veto.dR = 0.05;
61
62
IsoDeposit
isoDep( pfDir );
63
64
for
(
unsigned
i
=0;
i
<forIsolation.size();
i
++ ) {
65
66
const
reco::PFCandidate
& pfc = forIsolation[
i
];
67
68
// need to remove "particle"!
69
70
if
(
sameParticle
( particle, pfc ) )
continue
;
71
72
73
const
XYZTLorentzVector
& pvi(pfc.
p4
());
74
reco::isodeposit::Direction
dirPfc(pfc.
eta
(), pfc.
phi
());
75
double
dR
= pfDir.deltaR(dirPfc);
76
77
//COLIN make a parameter
78
double
maxDeltaRForIsoDep_ = 1;
79
if
(dR > maxDeltaRForIsoDep_) {
80
// if( verbose_ ) cout<<"OUT OF CONE"<<endl;
81
continue
;
82
}
83
// else if(verbose_) cout<<endl;
84
85
if
(
verbose_
)
86
cout
<<
"\t"
<<pfc<<endl;
87
88
double
pt
= pvi.Pt();
89
isoDep.addDeposit(dirPfc, pt);
90
}
91
92
return
isoDep;
93
}
94
95
96
bool
PFIsoDepositAlgo::sameParticle
(
const
Particle
& particle1,
97
const
Particle
& particle2 )
const
{
98
99
double
smallNumber = 1
e
-15;
100
101
if
( particle1.
particleId
() != particle2.
particleId
() )
return
false
;
102
else
if
( fabs( particle1.
energy
() - particle2.
energy
() ) > smallNumber )
return
false
;
103
else
if
( fabs( particle1.
eta
() - particle2.
eta
() ) > smallNumber )
return
false
;
104
else
if
( fabs( particle1.
eta
() - particle2.
eta
() ) > smallNumber )
return
false
;
105
else
return
true
;
106
107
}
pf2pat::PFIsoDepositAlgo::~PFIsoDepositAlgo
~PFIsoDepositAlgo()
Definition:
PFIsoDepositAlgo.cc:23
mps_fire.i
i
Definition:
mps_fire.py:330
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition:
LeafCandidate.h:137
reco::IsoDeposit
Definition:
IsoDeposit.h:46
funct::false
false
Definition:
Factorize.h:36
pf2pat::PFIsoDepositAlgo::ParticleCollection
std::vector< Particle > ParticleCollection
Definition:
PFIsoDepositAlgo.h:31
Particle
Definition:
Particle.py:1
EventSetup.h
std
Definition:
JetResolutionObject.h:80
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
EnergyCorrector.pt
pt
Definition:
EnergyCorrector.py:46
pf2pat::PFIsoDepositAlgo::isoDeposits_
IsoDeposits isoDeposits_
IsoDeposits computed in the produce function.
Definition:
PFIsoDepositAlgo.h:59
PFCandidate.h
pf2pat::PFIsoDepositAlgo::buildIsoDeposit
reco::IsoDeposit buildIsoDeposit(const Particle &particle, const ParticleCollection &forIsolation) const
build the IsoDeposit for "particle"
Definition:
PFIsoDepositAlgo.cc:52
reco::isodeposit::Direction
Definition:
IsoDepositDirection.h:19
reco::LeafCandidate::energy
double energy() const final
energy
Definition:
LeafCandidate.h:110
reco::LeafCandidate::p4
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition:
LeafCandidate.h:99
LorentzVector.h
math
Definition:
Error.h:16
electrons_cff.bool
bool
Definition:
electrons_cff.py:313
PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi.dR
dR
Definition:
PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi.py:19
pf2pat
Definition:
ElectronIDPFCandidateSelectorDefinition.h:22
pf2pat::PFIsoDepositAlgo::produce
const IsoDeposits & produce(const ParticleCollection &toBeIsolated, const ParticleCollection &forIsolation)
Definition:
PFIsoDepositAlgo.cc:27
PFIsoDepositAlgo.h
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:96
reco::PFCandidate
Particle reconstructed by the particle flow algorithm.
Definition:
PFCandidate.h:40
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:44
edm
HLT enums.
Definition:
AlignableModifier.h:17
edm::ParameterSet
Definition:
ParameterSet.h:36
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
pf2pat::PFIsoDepositAlgo::IsoDeposits
std::vector< reco::IsoDeposit > IsoDeposits
Definition:
PFIsoDepositAlgo.h:34
reco::PFCandidate::particleId
virtual ParticleType particleId() const
Definition:
PFCandidate.h:374
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition:
LeafCandidate.h:133
pf2pat::PFIsoDepositAlgo::verbose_
bool verbose_
Definition:
PFIsoDepositAlgo.h:61
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition:
RawParticle.h:27
Generated for CMSSW Reference Manual by
1.8.11