ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/NtupleWriter/Objects/Particle.h
Revision: 1.4
Committed: Wed May 30 13:30:52 2012 UTC (12 years, 11 months ago) by peiffer
Content type: text/plain
Branch: MAIN
Changes since 1.3: +2 -2 lines
Log Message:
some const added

File Contents

# Content
1 #ifndef Particle_H
2 #define Particle_H
3
4 #include <vector>
5 #include "Math/LorentzVector.h"
6 #include "Math/PtEtaPhiE4D.h"
7 #include "TObject.h"
8
9
10 #ifndef PI
11 #define PI 3.14159265358979323846264338328
12 #endif
13
14 typedef ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiE4D< Double32_t > > LorentzVector;
15
16 class Particle{
17 public:
18 Particle(){
19 m_charge=0;
20 m_pt=0;
21 m_eta=0;
22 m_phi=0;
23 m_energy=0;
24 };
25
26 ~Particle(){
27 };
28
29 LorentzVector v4() const{
30 LorentzVector v4;
31 v4.SetPt(m_pt);
32 v4.SetEta(m_eta);
33 v4.SetPhi(m_phi);
34 v4.SetE(m_energy);
35 return v4;
36 };
37
38 float charge() const{return m_charge;}
39 float pt() const {return m_pt;}
40 float eta() const{return m_eta;}
41 float phi() const{return m_phi;}
42 float energy() const{return m_energy;}
43
44 void set_charge(float charge){m_charge=charge;}
45 void set_pt(float pt){m_pt=pt;}
46 void set_eta(float eta){m_eta=eta;}
47 void set_phi(float phi){m_phi=phi;}
48 void set_energy(float energy){m_energy=energy;}
49
50 void set_v4(LorentzVector v4){
51 set_pt(v4.Pt());
52 set_eta(v4.Eta());
53 set_phi(v4.Phi());
54 set_energy(v4.E());
55 }
56
57 double deltaPhi(const Particle p2) const{
58 double deltaphi = fabs(this->phi() - p2.phi());
59 if(deltaphi > PI) deltaphi = 2* PI - deltaphi;
60 return deltaphi;
61 }
62 double deltaR(const Particle p2) const{
63 double deltaeta = this->eta() - p2.eta();
64 return sqrt(deltaeta*deltaeta+deltaPhi(p2)*deltaPhi(p2));
65 }
66
67 private:
68
69 float m_charge;
70 float m_pt;
71 float m_eta;
72 float m_phi;
73 float m_energy;
74
75 };
76
77 #endif