ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Track.h
Revision: 1.14
Committed: Fri Jul 25 11:32:45 2008 UTC (16 years, 9 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.13: +7 -7 lines
Log Message:
Merged gen and sim particles into new MCParticle class

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.14 // $Id: Track.h,v 1.13 2008/07/14 20:55:19 loizides Exp $
3 loizides 1.1 //
4     // Track
5     //
6 loizides 1.10 // This will/must be re-written :-)
7 loizides 1.1 //
8 loizides 1.5 // Authors: C.Loizides, J.Bendavid, C.Paus
9 loizides 1.1 //--------------------------------------------------------------------------------------------------
10 loizides 1.7
11 paus 1.6 #ifndef DATATREE_TRACK_H
12     #define DATATREE_TRACK_H
13    
14     #include "MitAna/DataTree/interface/DataObject.h"
15 bendavid 1.14 #include "MitAna/DataTree/interface/MCParticle.h"
16 loizides 1.9 #include "MitAna/DataTree/interface/Types.h"
17 loizides 1.1
18     namespace mithep
19     {
20     class Track : public DataObject
21     {
22     public:
23 loizides 1.12 Track() : fPhi(0), fD0(0), fPt(0), fDz(0), fTheta(0), fPhiErr(0), fD0Err(0), fPtErr(0),
24     fDzErr(0), fThetaErr(0), fCharge(0) {}
25 paus 1.4 Track(Double_t phi, Double_t d0, Double_t pt, Double_t dz, Double_t theta) :
26 loizides 1.12 fPhi(phi), fD0(d0), fPt(pt), fDz(dz), fTheta(theta), fPhiErr(0), fD0Err(0), fPtErr(0),
27     fDzErr(0), fThetaErr(0), fCharge(0) {}
28 loizides 1.1 ~Track() {}
29    
30 loizides 1.13 Int_t Charge() const { return fCharge; }
31     Double_t D0() const { return fD0; }
32     Double_t D0Err() const { return fD0Err; }
33     Double_t Dz() const { return fDz; }
34     Double_t DzErr() const { return fDzErr; }
35     ThreeVector Mom() const { return ThreeVector(Px(),Py(),Pz()); }
36     Double_t P2() const { return Px()*Px()+Py()*Py()+Pz()*Pz(); }
37     Double_t P() const { return TMath::Sqrt(P2()); }
38     Double_t Px() const { return TMath::Cos(fPhi)*fabs(fPt); }
39     Double_t Py() const { return TMath::Sin(fPhi)*fabs(fPt); }
40     Double_t Pz() const { return TMath::Abs(fPt)/TMath::Tan(fTheta); }
41     Double_t Phi() const { return fPhi; }
42     Double_t PhiErr() const { return fPhiErr; }
43     Double_t Pt() const { return fPt; }
44     Double_t PtErr() const { return fPtErr; }
45     Double_t Theta() const { return fTheta; }
46     Double_t ThetaErr() const { return fThetaErr; }
47 loizides 1.10
48 loizides 1.13 FourVector Mom4(double m) const { return FourVector(Px(),Py(),Pz(),E(m)); }
49     Double_t E2(double m) const { return P2()+m*m; }
50     Double_t E(double m) const { return TMath::Sqrt(E2(m)); }
51    
52     void SetCharge(Int_t charge) { fCharge = charge; }
53     void SetHelix (Double_t phi, Double_t d0, Double_t pt,
54     Double_t dz, Double_t theta);
55     void SetErrors(Double_t phiErr, Double_t d0Err, Double_t ptErr,
56     Double_t dzErr, Double_t thetaErr);
57 loizides 1.9
58 bendavid 1.14 const MCParticle *MCPart() const;
59     void SetMCPart(MCParticle *p) { fMCParticleRef = p; }
60 loizides 1.9
61 paus 1.4 protected:
62 loizides 1.13 Double_t fPhi; //azimuthal angle
63     Double_t fD0; //raw impact parameter
64     Double_t fPt; //transverse momentum
65     Double_t fDz; //z-displacement
66     Double_t fTheta; //polar angle
67     Double_t fPhiErr; //uncertainy on phi
68     Double_t fD0Err; //uncertainty on D0
69     Double_t fPtErr; //uncertainty on pt
70     Double_t fDzErr; //uncertainty on dz
71     Double_t fThetaErr; //uncertainty on theta
72     Int_t fCharge; //electric charge of reconstructed track
73 bendavid 1.14 TRef fMCParticleRef; //reference to sim particle (for monte carlo)
74 loizides 1.5
75 loizides 1.8 ClassDef(Track, 1) // Track class
76 loizides 1.1 };
77 loizides 1.5 }
78 loizides 1.1
79 loizides 1.5 //--------------------------------------------------------------------------------------------------
80 paus 1.4 inline
81 loizides 1.5 void mithep::Track::SetHelix(Double_t phi, Double_t d0, Double_t pt, Double_t dz, Double_t theta)
82     {
83 loizides 1.13 // Set helix parameters.
84    
85 paus 1.4 fPhi = phi;
86     fD0 = d0;
87     fPt = pt;
88     fDz = dz;
89     fTheta = theta;
90     }
91    
92 loizides 1.5 //--------------------------------------------------------------------------------------------------
93 paus 1.4 inline
94     void mithep::Track::SetErrors(Double_t phiErr, Double_t d0Err, Double_t ptErr, Double_t dzErr,
95 loizides 1.5 Double_t thetaErr)
96     {
97 loizides 1.13 // Set helix errors.
98    
99 paus 1.4 fPhiErr = phiErr;
100     fD0Err = d0Err;
101     fPtErr = ptErr;
102     fDzErr = dzErr;
103     fThetaErr = thetaErr;
104     }
105 loizides 1.13
106     //--------------------------------------------------------------------------------------------------
107     inline
108 bendavid 1.14 const mithep::MCParticle *mithep::Track::MCPart() const
109 loizides 1.13 {
110     // Get reference to simulated particle.
111    
112 bendavid 1.14 return static_cast<const MCParticle*>(fMCParticleRef.GetObject());
113 loizides 1.13 }
114 loizides 1.5 #endif