ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Track.h
Revision: 1.15
Committed: Thu Jul 31 13:28:42 2008 UTC (16 years, 9 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: MITHEP_2_0_x
Changes since 1.14: +188 -57 lines
Log Message:
Nearly complete rewrite of track class, new helix parameterization (now matches CMSSW) and tracker hit information

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: Track.h,v 1.14 2008/07/25 11:32:45 bendavid Exp $
3 //
4 // Track
5 //
6 // We store the CMSSW track parameterization
7 // Parameters associated to the 5D curvilinear covariance matrix:
8 // (qoverp, lambda, phi, dxy, dsz)
9 // defined as:
10 // qoverp = q / abs(p) = signed inverse of momentum [1/GeV]
11 // lambda = pi/2 - polar angle at the given point
12 // phi = azimuth angle at the given point
13 // dxy = -vx*sin(phi) + vy*cos(phi) [cm]
14 // dsz = vz*cos(lambda) - (vx*cos(phi)+vy*sin(phi))*sin(lambda) [cm]
15
16 //
17 //
18 // Format for fHits: (We do not use anything resembling reco::HitPattern from CMSSW because that
19 // data format requires 800 bits per track!)
20 // There is a one to one mapping between bits and tracker layers, where layers are enumerated
21 // seperately in the PXB, PXF, TIB, TID, TOB, TEC and r-phi and stereo modules are treated as
22 // seperate layers in those detectors which have them
23 // (TIB L1,L2, TID L1,L2, TOB L1,L2, TEC L1,L2,L5)
24 //
25 // A bit value of 1 indicates a hit in the corresponding layer, and 0 indicates no hit.
26 //
27 // Note that currently this only stores information about hits in the Tracker,
28 // but muon chamber information will likely be added as well
29 //
30 // Bit-Layer assignments (starting from bit 0):
31 // Bit 0: PXB L1
32 // Bit 1: PXB L2
33 // Bit 2: PXB L3
34 // Bit 3: PXF L1
35 // Bit 4: PXF L2
36 // Bit 5: TIB L1 r-phi
37 // Bit 6: TIB L1 stereo
38 // Bit 7: TIB L2 r-phi
39 // Bit 8: TIB L2 stereo
40 // Bit 9: TIB L3 r-phi
41 // Bit 10: TIB L4 r-phi
42 // Bit 11: TID L1 phi
43 // Bit 12: TID L1 stereo
44 // Bit 13: TID L2 phi
45 // Bit 14: TID L2 stereo
46 // Bit 15: TID L3 phi
47 // Bit 16: TOB L1 r-phi
48 // Bit 17: TOB L1 stereo
49 // Bit 18: TOB L2 r-phi
50 // Bit 19: TOB L2 stereo
51 // Bit 20: TOB L3 r-phi
52 // Bit 21: TOB L4 r-phi
53 // Bit 22: TOB L5 r-phi
54 // Bit 23: TOB L6 r-phi
55 // Bit 24: TEC L1 phi
56 // Bit 25: TEC L1 stereo
57 // Bit 26: TEC L2 phi
58 // Bit 27: TEC L2 stereo
59 // Bit 28: TEC L3 phi
60 // Bit 29: TEC L4 phi
61 // Bit 30: TEC L5 phi
62 // Bit 31: TEC L5 stereo
63 // Bit 32: TEC L6 phi
64 // Bit 33: TEC L7 phi
65 // Bit 34: TEC L8 phi
66 // Bit 35: TEC L9 phi
67 //
68 // Authors: C.Loizides, J.Bendavid, C.Paus
69 //--------------------------------------------------------------------------------------------------
70
71 #ifndef DATATREE_TRACK_H
72 #define DATATREE_TRACK_H
73
74 #include "MitAna/DataTree/interface/DataObject.h"
75 #include "MitAna/DataTree/interface/MCParticle.h"
76 #include "MitAna/DataTree/interface/BitMask32.h"
77 #include "MitAna/DataTree/interface/BitMask64.h"
78 #include "MitAna/DataTree/interface/Types.h"
79
80 namespace mithep
81 {
82 class Track : public DataObject
83 {
84 public:
85 enum HitLayer { PXB1,
86 PXB2,
87 PXB3,
88 PXF1,
89 PXF2,
90 TIB1,
91 TIB1S,
92 TIB2,
93 TIB2S,
94 TIB3,
95 TIB4,
96 TID1,
97 TID1S,
98 TID2,
99 TID2S,
100 TID3,
101 TOB1,
102 TOB1S,
103 TOB2,
104 TOB2S,
105 TOB3,
106 TOB4,
107 TOB5,
108 TOB6,
109 TEC1,
110 TEC1S,
111 TEC2,
112 TEC2S,
113 TEC3,
114 TEC4,
115 TEC5,
116 TEC5S,
117 TEC6,
118 TEC7,
119 TEC8,
120 TEC9 };
121
122 Track() : fQOverP(0), fQOverPErr(0), fLambda(0), fLambdaErr(0),
123 fPhi0(0), fPhi0Err(0), fDxy(0), fDxyErr(0), fDsz(0), fDszErr(0),
124 fChi2(0), fNdof(0) {}
125 Track(Double_t qOverP, Double_t lambda, Double_t phi0, Double_t dxy, Double_t dsz) :
126 fQOverP(qOverP), fQOverPErr(0), fLambda(lambda), fLambdaErr(0),
127 fPhi0(phi0), fPhi0Err(0), fDxy(dxy), fDxyErr(0), fDsz(dsz), fDszErr(0),
128 fChi2(0), fNdof(0) {}
129 ~Track() {}
130
131 Double_t QOverP() const { return fQOverP; }
132 Double_t QOverPErr() const { return fQOverPErr; }
133 Double_t Lambda() const { return fLambda; }
134 Double_t LambdaErr() const { return fLambdaErr; }
135 Double_t Phi0() const { return fPhi0; }
136 Double_t Phi0Err() const { return fPhi0Err; }
137 Double_t Dxy() const { return fDxy; }
138 Double_t DxyErr() const { return fDxyErr; }
139 Double_t Dsz() const { return fDsz; }
140 Double_t DszErr() const { return fDszErr; }
141
142
143
144 Int_t Charge() const { return (fQOverP>0) ? 1 : -1; }
145 Double_t Chi2() const { return fChi2; }
146 void ClearHit(HitLayer l) { fHits.ClearBit(l); }
147 Double_t D0() const { return -fDxy; }
148 Double_t D0Err() const { return fDxyErr; }
149 Bool_t Hit(HitLayer l) const { return fHits.TestBit(l); }
150 BitMask64 &Hits() { return fHits; }
151 const BitMask64 &Hits() const { return fHits; }
152 ULong64_t HitMask() const { return fHits.Bits(); }
153 ThreeVector Mom() const { return ThreeVector(Px(),Py(),Pz()); }
154 UInt_t Ndof() const { return fNdof; }
155 Double_t P2() const { return P()*P(); }
156 Double_t P() const { return TMath::Abs(1./fQOverP); }
157 Double_t Px() const { return Pt()*TMath::Cos(fPhi0); }
158 Double_t Py() const { return Pt()*TMath::Sin(fPhi0); }
159 Double_t Pz() const { return P()*TMath::Sin(fLambda); }
160 Double_t Phi() const { return fPhi0; }
161 Double_t Pt() const { return TMath::Abs(TMath::Cos(fLambda)/fQOverP); }
162 //Double_t PtErr() const { return fPtErr; }
163 void SetChi2(Double_t chi2) { fChi2 = chi2; }
164 void SetHit(HitLayer l) { fHits.SetBit(l); }
165 void SetHits(BitMask64 hits) { fHits = hits; }
166 void SetHits(ULong64_t hitMask) { fHits.SetBits(hitMask); }
167 void SetNdof(UInt_t dof) { fNdof = dof; }
168 void SetStat(BitMask32 stat) { fStat = stat; }
169 void SetStat(UInt_t statBits) { fStat.SetBits(statBits); }
170 BitMask32 &Stat() { return fStat; }
171 const BitMask32 &Stat() const { return fStat; }
172 UInt_t StatBits() const { return fStat.Bits(); }
173 Double_t Theta() const { return (TMath::PiOver2() - fLambda); }
174 Double_t Z0() const { return fDsz/TMath::Cos(fLambda); }
175 //Double_t Z0Err() const { return fZ0Err; }
176
177 FourVector Mom4(Double_t m) const { return FourVector(Px(),Py(),Pz(),E(m)); }
178 Double_t E2(Double_t m) const { return P2()+m*m; }
179 Double_t E(Double_t m) const { return TMath::Sqrt(E2(m)); }
180 UInt_t NHits() const { return fHits.NBitsSet(); }
181
182 void SetHelix (Double_t qOverP, Double_t lambda, Double_t phi0,
183 Double_t dXy, Double_t dSz);
184 void SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
185 Double_t dXyErr, Double_t dSzErr);
186
187 const MCParticle *MCPart() const;
188 void SetMCPart(MCParticle *p) { fMCParticleRef = p; }
189
190 protected:
191 // Constant which is store in the file
192 BitMask64 fHits; // Mostly Hit informations
193 BitMask32 fStat; // Storage for various interesting things
194 Double_t fQOverP, fQOverPErr;
195 Double_t fLambda, fLambdaErr;
196 Double_t fPhi0,fPhi0Err; // Follow track parameters/uncertainties
197 Double_t fDxy, fDxyErr;
198 Double_t fDsz, fDszErr;
199
200 Double_t fChi2; //chi squared of track fit
201 UInt_t fNdof; //number of dof of track fit
202
203 TRef fMCParticleRef; //reference to sim particle (for monte carlo)
204
205 ClassDef(Track, 1) // Track class
206 };
207 }
208
209 //--------------------------------------------------------------------------------------------------
210 inline
211 void mithep::Track::SetHelix(Double_t qOverP, Double_t lambda, Double_t phi0,
212 Double_t dxy, Double_t dsz)
213 {
214 // Set helix parameters.
215
216 fQOverP = qOverP;
217 fLambda = lambda;
218 fPhi0 = phi0;
219 fDxy = dxy;
220 fDsz = dsz;
221 }
222
223 //--------------------------------------------------------------------------------------------------
224 inline
225 void mithep::Track::SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
226 Double_t dxyErr, Double_t dszErr)
227 {
228 // Set helix errors.
229
230 fQOverPErr = qOverPErr;
231 fLambdaErr = lambdaErr;
232 fPhi0Err = phi0Err;
233 fDxyErr = dxyErr;
234 fDszErr = dszErr;
235 }
236
237 //--------------------------------------------------------------------------------------------------
238 inline
239 const mithep::MCParticle *mithep::Track::MCPart() const
240 {
241 // Get reference to simulated particle.
242
243 return static_cast<const MCParticle*>(fMCParticleRef.GetObject());
244 }
245 #endif