ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Track.h
Revision: 1.27
Committed: Mon Nov 3 11:21:11 2008 UTC (16 years, 6 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.26: +24 -6 lines
Log Message:
Added track position at Ecal and link to supercluster

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.27 // $Id: Track.h,v 1.26 2008/10/31 17:42:08 bendavid 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 bendavid 1.25 // (TIB L1,L2, TID L1,L2,L3, TOB L1,L2, TEC L1,L2,L3,L4,L5,L6,L7,L8,L9).
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.23 // Bit 16: TID L3 stereo
47     // Bit 17: TOB L1 r-phi
48     // Bit 18: TOB L1 stereo
49     // Bit 19: TOB L2 r-phi
50     // Bit 20: TOB L2 stereo
51     // Bit 21: TOB L3 r-phi
52     // Bit 22: TOB L4 r-phi
53     // Bit 23: TOB L5 r-phi
54     // Bit 24: TOB L6 r-phi
55     // Bit 25: TEC L1 r-phi
56     // Bit 26: TEC L1 stereo
57     // Bit 27: TEC L2 r-phi
58     // Bit 28: TEC L2 stereo
59     // Bit 29: TEC L3 r-phi
60     // Bit 30: TEC L3 stereo
61     // Bit 31: TEC L4 r-phi
62     // Bit 32: TEC L4 stereo
63     // Bit 33: TEC L5 r-phi
64     // Bit 34: TEC L5 stereo
65     // Bit 35: TEC L6 r-phi
66     // Bit 36: TEC L6 stereo
67     // Bit 37: TEC L7 r-phi
68     // Bit 38: TEC L7 stereo
69     // Bit 39: TEC L8 r-phi
70     // Bit 40: TEC L8 stereo
71     // Bit 41: TEC L9 r-phi
72     // Bit 42: TEC L9 stereo
73 loizides 1.1 //
74 loizides 1.5 // Authors: C.Loizides, J.Bendavid, C.Paus
75 loizides 1.1 //--------------------------------------------------------------------------------------------------
76 loizides 1.7
77 loizides 1.17 #ifndef MITANA_DATATREE_TRACK_H
78     #define MITANA_DATATREE_TRACK_H
79 paus 1.6
80     #include "MitAna/DataTree/interface/DataObject.h"
81 bendavid 1.27 #include "MitAna/DataTree/interface/SuperCluster.h"
82 bendavid 1.14 #include "MitAna/DataTree/interface/MCParticle.h"
83 loizides 1.18 #include "MitAna/DataTree/interface/BitMask.h"
84 loizides 1.9 #include "MitAna/DataTree/interface/Types.h"
85 loizides 1.1
86     namespace mithep
87     {
88     class Track : public DataObject
89     {
90     public:
91 loizides 1.18 enum EHitLayer {
92     PXB1,
93     PXB2,
94     PXB3,
95     PXF1,
96     PXF2,
97     TIB1,
98     TIB1S,
99     TIB2,
100     TIB2S,
101     TIB3,
102     TIB4,
103     TID1,
104     TID1S,
105     TID2,
106     TID2S,
107     TID3,
108 bendavid 1.23 TID3S,
109 loizides 1.18 TOB1,
110     TOB1S,
111     TOB2,
112     TOB2S,
113     TOB3,
114     TOB4,
115     TOB5,
116     TOB6,
117     TEC1,
118     TEC1S,
119     TEC2,
120     TEC2S,
121     TEC3,
122 bendavid 1.23 TEC3S,
123 loizides 1.18 TEC4,
124 bendavid 1.23 TEC4S,
125 loizides 1.18 TEC5,
126     TEC5S,
127     TEC6,
128 bendavid 1.23 TEC6S,
129 loizides 1.18 TEC7,
130 bendavid 1.23 TEC7S,
131 loizides 1.18 TEC8,
132 bendavid 1.23 TEC8S,
133     TEC9,
134     TEC9S
135 loizides 1.18 };
136    
137 bendavid 1.15 Track() : fQOverP(0), fQOverPErr(0), fLambda(0), fLambdaErr(0),
138     fPhi0(0), fPhi0Err(0), fDxy(0), fDxyErr(0), fDsz(0), fDszErr(0),
139 bendavid 1.27 fChi2(0), fNdof(0), fEtaEcal(0), fPhiEcal(0) {}
140 bendavid 1.15 Track(Double_t qOverP, Double_t lambda, Double_t phi0, Double_t dxy, Double_t dsz) :
141     fQOverP(qOverP), fQOverPErr(0), fLambda(lambda), fLambdaErr(0),
142     fPhi0(phi0), fPhi0Err(0), fDxy(dxy), fDxyErr(0), fDsz(dsz), fDszErr(0),
143 bendavid 1.27 fChi2(0), fNdof(0), fEtaEcal(0), fPhiEcal(0) {}
144 loizides 1.1 ~Track() {}
145    
146 loizides 1.18 Int_t Charge() const { return (fQOverP>0) ? 1 : -1; }
147     Double_t Chi2() const { return fChi2; }
148 bendavid 1.20 Double_t RChi2() const { return fChi2/(Double_t)fNdof; }
149 loizides 1.18 void ClearHit(EHitLayer l) { fHits.ClearBit(l); }
150     Double_t D0() const { return -fDxy; }
151     Double_t D0Err() const { return fDxyErr; }
152     Double_t Dsz() const { return fDsz; }
153     Double_t DszErr() const { return fDszErr; }
154     Double_t Dxy() const { return fDxy; }
155     Double_t DxyErr() const { return fDxyErr; }
156     Double_t E(Double_t m) const { return TMath::Sqrt(E2(m)); }
157     Double_t E2(Double_t m) const { return P2()+m*m; }
158 sixie 1.21 Double_t Eta() const { return Mom().Eta(); }
159 bendavid 1.27 Double_t EtaEcal() const { return fEtaEcal; }
160 loizides 1.18 Bool_t Hit(EHitLayer l) const { return fHits.TestBit(l); }
161 bendavid 1.26 const BitMask48 &Hits() const { return fHits; }
162 loizides 1.18 Double_t Lambda() const { return fLambda; }
163     Double_t LambdaErr() const { return fLambdaErr; }
164     const MCParticle *MCPart() const;
165     ThreeVector Mom() const { return ThreeVector(Px(),Py(),Pz()); }
166     FourVector Mom4(Double_t m) const { return FourVector(Px(),Py(),Pz(),E(m)); }
167     UInt_t Ndof() const { return fNdof; }
168     UInt_t NHits() const { return fHits.NBitsSet(); }
169 bendavid 1.24 UInt_t NStereoHits() const { return StereoHits().NBitsSet(); }
170 loizides 1.18 Double_t P2() const { return P()*P(); }
171     Double_t P() const { return TMath::Abs(1./fQOverP); }
172     Double_t Phi() const { return fPhi0; }
173     Double_t Phi0() const { return fPhi0; }
174     Double_t Phi0Err() const { return fPhi0Err; }
175 bendavid 1.27 Double_t PhiEcal() const { return fPhiEcal; }
176 bendavid 1.19 Double_t Prob() const { return TMath::Prob(fChi2,fNdof); }
177 loizides 1.18 Double_t Pt() const { return TMath::Abs(TMath::Cos(fLambda)/fQOverP); }
178     Double_t Px() const { return Pt()*TMath::Cos(fPhi0); }
179     Double_t Py() const { return Pt()*TMath::Sin(fPhi0); }
180     Double_t Pz() const { return P()*TMath::Sin(fLambda); }
181     Double_t QOverP() const { return fQOverP; }
182     Double_t QOverPErr() const { return fQOverPErr; }
183     Double_t Theta() const { return (TMath::PiOver2() - fLambda); }
184     Double_t Z0() const { return fDsz/TMath::Cos(fLambda); }
185     void SetChi2(Double_t chi2) { fChi2 = chi2; }
186     void SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
187     Double_t dXyErr, Double_t dSzErr);
188 bendavid 1.27 void SetEtaEcal(Double_t eta) { fEtaEcal = eta; }
189 bendavid 1.15 void SetHelix (Double_t qOverP, Double_t lambda, Double_t phi0,
190     Double_t dXy, Double_t dSz);
191 loizides 1.18 void SetHit(EHitLayer l) { fHits.SetBit(l); }
192 bendavid 1.26 void SetHits(const BitMask48 &hits) { fHits = hits; }
193 loizides 1.18 void SetNdof(UInt_t dof) { fNdof = dof; }
194     void SetMCPart(MCParticle *p) { fMCParticleRef = p; }
195 bendavid 1.27 void SetPhiEcal(Double_t phi) { fPhiEcal = phi; }
196     void SetSCluster(SuperCluster* sc) { fSuperClusterRef = sc; }
197     const SuperCluster *SCluster() const;
198 bendavid 1.26 const BitMask48 StereoHits() const { return (fHits & StereoLayers()); }
199 bendavid 1.27 static const BitMask48 StereoLayers();
200 loizides 1.18
201 paus 1.4 protected:
202 bendavid 1.26 BitMask48 fHits; //storage for mostly hit information
203 loizides 1.18 Double_t fQOverP; //signed inverse of momentum [1/GeV]
204     Double_t fQOverPErr; //error of q/p
205     Double_t fLambda; //pi/2 - polar angle at the reference point
206     Double_t fLambdaErr; //error of lambda
207     Double_t fPhi0; //azimuth angle at the given point
208     Double_t fPhi0Err; //error of azimuthal angle
209     Double_t fDxy; //transverse distance to reference point [cm]
210     Double_t fDxyErr; //error of transverse distance
211     Double_t fDsz; //longitudinal distance to reference point [cm]
212     Double_t fDszErr; //error of longitudinal distance
213 loizides 1.17 Double_t fChi2; //chi squared of track fit
214 loizides 1.18 UInt_t fNdof; //degree-of-freedom of track fit
215 bendavid 1.27 Double32_t fEtaEcal; //Eta of track at Ecal front face
216     Double32_t fPhiEcal; //phi of track at Ecal front face
217     TRef fSuperClusterRef; //superCluster crossed by track
218 loizides 1.17 TRef fMCParticleRef; //reference to sim particle (for monte carlo)
219 loizides 1.5
220 bendavid 1.27 ClassDef(Track, 2) // Track class
221 loizides 1.1 };
222 loizides 1.5 }
223 loizides 1.1
224 loizides 1.5 //--------------------------------------------------------------------------------------------------
225 paus 1.4 inline
226 bendavid 1.15 void mithep::Track::SetHelix(Double_t qOverP, Double_t lambda, Double_t phi0,
227     Double_t dxy, Double_t dsz)
228 loizides 1.5 {
229 loizides 1.13 // Set helix parameters.
230    
231 bendavid 1.15 fQOverP = qOverP;
232     fLambda = lambda;
233     fPhi0 = phi0;
234     fDxy = dxy;
235     fDsz = dsz;
236 paus 1.4 }
237    
238 loizides 1.5 //--------------------------------------------------------------------------------------------------
239 paus 1.4 inline
240 bendavid 1.15 void mithep::Track::SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
241     Double_t dxyErr, Double_t dszErr)
242 loizides 1.5 {
243 loizides 1.13 // Set helix errors.
244    
245 bendavid 1.15 fQOverPErr = qOverPErr;
246     fLambdaErr = lambdaErr;
247     fPhi0Err = phi0Err;
248     fDxyErr = dxyErr;
249     fDszErr = dszErr;
250 paus 1.4 }
251 loizides 1.13
252     //--------------------------------------------------------------------------------------------------
253     inline
254 bendavid 1.14 const mithep::MCParticle *mithep::Track::MCPart() const
255 loizides 1.13 {
256     // Get reference to simulated particle.
257    
258 bendavid 1.14 return static_cast<const MCParticle*>(fMCParticleRef.GetObject());
259 loizides 1.13 }
260 bendavid 1.26
261     //--------------------------------------------------------------------------------------------------
262 bendavid 1.27 inline const mithep::SuperCluster *mithep::Track::SCluster() const
263     {
264     // Return Super cluster
265    
266     return static_cast<const SuperCluster*>(fSuperClusterRef.GetObject());
267     }
268    
269     //--------------------------------------------------------------------------------------------------
270 bendavid 1.26 inline
271 bendavid 1.27 const mithep::BitMask48 mithep::Track::StereoLayers()
272 bendavid 1.26 {
273     // Build and return BitMask of stereo layers
274    
275     mithep::BitMask48 stereoLayers;
276    
277     stereoLayers.SetBit(mithep::Track::TIB1S);
278     stereoLayers.SetBit(mithep::Track::TIB2S);
279     stereoLayers.SetBit(mithep::Track::TID1S);
280     stereoLayers.SetBit(mithep::Track::TID2S);
281     stereoLayers.SetBit(mithep::Track::TID3S);
282     stereoLayers.SetBit(mithep::Track::TOB1S);
283     stereoLayers.SetBit(mithep::Track::TOB2S);
284     stereoLayers.SetBit(mithep::Track::TEC1S);
285     stereoLayers.SetBit(mithep::Track::TEC2S);
286     stereoLayers.SetBit(mithep::Track::TEC3S);
287     stereoLayers.SetBit(mithep::Track::TEC4S);
288     stereoLayers.SetBit(mithep::Track::TEC5S);
289     stereoLayers.SetBit(mithep::Track::TEC6S);
290     stereoLayers.SetBit(mithep::Track::TEC7S);
291     stereoLayers.SetBit(mithep::Track::TEC8S);
292     stereoLayers.SetBit(mithep::Track::TEC9S);
293    
294     return stereoLayers;
295     }
296 loizides 1.5 #endif