ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Track.h
Revision: 1.22
Committed: Mon Oct 13 10:34:00 2008 UTC (16 years, 6 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.21: +3 -1 lines
Log Message:
Added bitmask accessor to track

File Contents

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