test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFIsoDepositAlgo.cc
Go to the documentation of this file.
2 
4 
6 
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 
24 
25 
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 
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  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 
97  const Particle& particle2 ) const {
98 
99  double smallNumber = 1e-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 }
int i
Definition: DBlmapReader.cc:9
virtual double energy() const final
energy
std::vector< Particle > ParticleCollection
virtual double phi() const final
momentum azimuthal angle
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
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;
const IsoDeposits & produce(const ParticleCollection &toBeIsolated, const ParticleCollection &forIsolation)
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:39
tuple cout
Definition: gather_cfg.py:145
std::vector< reco::IsoDeposit > IsoDeposits
virtual double eta() const final
momentum pseudorapidity
volatile std::atomic< bool > shutdown_flag false
virtual ParticleType particleId() const
Definition: PFCandidate.h:373
virtual const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99