ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Track.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/Track.h (file contents):
Revision 1.7 by loizides, Wed Jun 18 19:08:14 2008 UTC vs.
Revision 1.25 by bendavid, Wed Oct 29 17:04:59 2008 UTC

# Line 3 | Line 3
3   //
4   // Track
5   //
6 < // This will be re-written :-)
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 > // (See http://cmslxr.fnal.gov/lxr/source/DataFormats/TrackReco/interface/TrackBase.h)
16 > //
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 > // (TIB L1,L2, TID L1,L2,L3, TOB L1,L2, TEC L1,L2,L3,L4,L5,L6,L7,L8,L9).
23 > //
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 > // but muon chamber information will likely be added as well.
28 > //
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 > // Bit 11: TID L1 r-phi
42 > // Bit 12: TID L1 stereo
43 > // Bit 13: TID L2 r-phi
44 > // Bit 14: TID L2 stereo
45 > // Bit 15: TID L3 r-phi
46 > // 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   //
74   // Authors: C.Loizides, J.Bendavid, C.Paus
75   //--------------------------------------------------------------------------------------------------
76  
77 < #ifndef DATATREE_TRACK_H
78 < #define DATATREE_TRACK_H
77 > #ifndef MITANA_DATATREE_TRACK_H
78 > #define MITANA_DATATREE_TRACK_H
79  
80   #include "MitAna/DataTree/interface/DataObject.h"
81 + #include "MitAna/DataTree/interface/MCParticle.h"
82 + #include "MitAna/DataTree/interface/BitMask.h"
83 + #include "MitAna/DataTree/interface/Types.h"
84  
85   namespace mithep
86   {
87    class Track : public DataObject
88    {
89      public:
90 <      Track() {}
91 <      Track(Double_t phi, Double_t d0, Double_t pt, Double_t dz, Double_t theta) :
92 <        fPhi(phi), fD0(d0), fPt(pt), fDz(dz), fTheta(theta) {}
90 >      enum EHitLayer {
91 >        PXB1,
92 >        PXB2,
93 >        PXB3,
94 >        PXF1,
95 >        PXF2,
96 >        TIB1,
97 >        TIB1S,
98 >        TIB2,
99 >        TIB2S,
100 >        TIB3,
101 >        TIB4,
102 >        TID1,
103 >        TID1S,
104 >        TID2,
105 >        TID2S,
106 >        TID3,
107 >        TID3S,
108 >        TOB1,
109 >        TOB1S,
110 >        TOB2,
111 >        TOB2S,
112 >        TOB3,
113 >        TOB4,
114 >        TOB5,
115 >        TOB6,
116 >        TEC1,
117 >        TEC1S,
118 >        TEC2,
119 >        TEC2S,
120 >        TEC3,
121 >        TEC3S,
122 >        TEC4,
123 >        TEC4S,
124 >        TEC5,
125 >        TEC5S,
126 >        TEC6,
127 >        TEC6S,
128 >        TEC7,
129 >        TEC7S,
130 >        TEC8,
131 >        TEC8S,
132 >        TEC9,
133 >        TEC9S
134 >      };
135 >
136 >      Track() : fQOverP(0), fQOverPErr(0), fLambda(0), fLambdaErr(0),
137 >                fPhi0(0), fPhi0Err(0), fDxy(0), fDxyErr(0), fDsz(0), fDszErr(0),
138 >                fChi2(0), fNdof(0) {}
139 >      Track(Double_t qOverP, Double_t lambda, Double_t phi0, Double_t dxy, Double_t dsz) :
140 >                fQOverP(qOverP), fQOverPErr(0), fLambda(lambda), fLambdaErr(0),
141 >                fPhi0(phi0), fPhi0Err(0), fDxy(dxy), fDxyErr(0), fDsz(dsz), fDszErr(0),
142 >                fChi2(0), fNdof(0) {}
143        ~Track() {}
144  
145 <      void      SetHelix (Double_t phi, Double_t d0, Double_t pt, Double_t dz, Double_t theta);
146 <      void      SetErrors(Double_t phiErr, Double_t d0Err, Double_t ptErr, Double_t dzErr,
147 <                          Double_t thetaErr);
148 <      
149 <      Double_t  Phi()      const { return fPhi; }
150 <      Double_t  D0()       const { return fD0; }
151 <      Double_t  Pt()       const { return fPt; }
152 <      Double_t  Dz()       const { return fDz; }
153 <      Double_t  Theta()    const { return fTheta; }
154 <      
155 <      Double_t  PhiErr()   const { return fPhiErr; }
156 <      Double_t  D0Err()    const { return fD0Err; }
157 <      Double_t  PtErr()    const { return fPtErr; }
158 <      Double_t  DzErr()    const { return fDzErr; }
159 <      Double_t  ThetaErr() const { return fThetaErr; }
160 <      
161 <      Int_t     Charge()   const { return fCharge; }
162 <      
163 <      void      SetCharge(Int_t charge) { fCharge = charge; }
164 <      
145 >      Int_t              Charge()         const { return (fQOverP>0) ? 1 : -1; }
146 >      Double_t           Chi2()           const { return fChi2; }
147 >      Double_t           RChi2()          const { return fChi2/(Double_t)fNdof; }
148 >      void               ClearHit(EHitLayer l)  { fHits.ClearBit(l); }
149 >      Double_t           D0()             const { return -fDxy; }
150 >      Double_t           D0Err()          const { return fDxyErr; }
151 >      Double_t           Dsz()            const { return fDsz; }
152 >      Double_t           DszErr()         const { return fDszErr; }
153 >      Double_t           Dxy()            const { return fDxy; }
154 >      Double_t           DxyErr()         const { return fDxyErr; }
155 >      Double_t           E(Double_t m)    const { return TMath::Sqrt(E2(m)); }
156 >      Double_t           E2(Double_t m)   const { return P2()+m*m; }
157 >      Double_t           Eta()            const { return Mom().Eta(); }
158 >      Bool_t             Hit(EHitLayer l) const { return fHits.TestBit(l); }
159 >      const BitMask64   &Hits()           const { return fHits; }
160 >      Double_t           Lambda()         const { return fLambda; }
161 >      Double_t           LambdaErr()      const { return fLambdaErr; }
162 >      const MCParticle  *MCPart()         const;
163 >      ThreeVector        Mom()            const { return ThreeVector(Px(),Py(),Pz()); }
164 >      FourVector         Mom4(Double_t m) const { return FourVector(Px(),Py(),Pz(),E(m)); }
165 >      UInt_t             Ndof()           const { return fNdof; }
166 >      UInt_t             NHits()          const { return fHits.NBitsSet(); }
167 >      UInt_t             NStereoHits()    const { return StereoHits().NBitsSet(); }
168 >      Double_t           P2()             const { return P()*P(); }
169 >      Double_t           P()              const { return TMath::Abs(1./fQOverP); }
170 >      Double_t           Phi()            const { return fPhi0; }
171 >      Double_t           Phi0()           const { return fPhi0; }
172 >      Double_t           Phi0Err()        const { return fPhi0Err; }
173 >      Double_t           Prob()           const { return TMath::Prob(fChi2,fNdof); }
174 >      Double_t           Pt()             const { return TMath::Abs(TMath::Cos(fLambda)/fQOverP); }
175 >      Double_t           Px()             const { return Pt()*TMath::Cos(fPhi0); }      
176 >      Double_t           Py()             const { return Pt()*TMath::Sin(fPhi0); }
177 >      Double_t           Pz()             const { return P()*TMath::Sin(fLambda); }
178 >      Double_t           QOverP()         const { return fQOverP; }
179 >      Double_t           QOverPErr()      const { return fQOverPErr; }
180 >      Double_t           Theta()          const { return (TMath::PiOver2() - fLambda); }
181 >      Double_t           Z0()             const { return fDsz/TMath::Cos(fLambda); }
182 >      void               SetChi2(Double_t chi2) { fChi2 = chi2; }
183 >      void               SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
184 >                                   Double_t dXyErr, Double_t dSzErr);
185 >      void               SetHelix (Double_t qOverP, Double_t lambda, Double_t phi0,
186 >                                   Double_t dXy, Double_t dSz);
187 >      void               SetHit(EHitLayer l)      { fHits.SetBit(l); }
188 >      void               SetHits(const BitMask64 &hits) { fHits = hits; }
189 >      void               SetNdof(UInt_t dof)      { fNdof = dof; }
190 >      void               SetMCPart(MCParticle *p) { fMCParticleRef = p; }
191 >      const BitMask64    StereoHits()     const { return (fHits & StereoLayers()); }
192 >      static BitMask64   StereoLayers() { return BitMask64(Long64_t(0x55554155140LL)); }
193 >
194      protected:
195 <      Double_t fPhi;      // azimuthal angle
196 <      Double_t fD0;       // raw impact parameter
197 <      Double_t fPt;       // transverse momentum
198 <      Double_t fDz;       // z-displacement
199 <      Double_t fTheta;    // polar angle
200 <      Double_t fPhiErr;   // uncertainy on phi
201 <      Double_t fD0Err;    // uncertainty on D0
202 <      Double_t fPtErr;    // uncertainty on pt
203 <      Double_t fDzErr;    // uncertainty on dz
204 <      Double_t fThetaErr; // uncertainty on theta
205 <      Int_t    fCharge;   // electric charge of reconstructed track
195 >      BitMask64          fHits;                //storage for mostly hit information
196 >      Double_t           fQOverP;              //signed inverse of momentum [1/GeV]
197 >      Double_t           fQOverPErr;           //error of q/p
198 >      Double_t           fLambda;              //pi/2 - polar angle at the reference point
199 >      Double_t           fLambdaErr;           //error of lambda
200 >      Double_t           fPhi0;                //azimuth angle at the given point
201 >      Double_t           fPhi0Err;             //error of azimuthal angle
202 >      Double_t           fDxy;                 //transverse distance to reference point [cm]
203 >      Double_t           fDxyErr;              //error of transverse distance
204 >      Double_t           fDsz;                 //longitudinal distance to reference point [cm]
205 >      Double_t           fDszErr;              //error of longitudinal distance
206 >      Double_t           fChi2;                //chi squared of track fit
207 >      UInt_t             fNdof;                //degree-of-freedom of track fit
208 >      TRef               fMCParticleRef;       //reference to sim particle (for monte carlo)
209                
210 <      ClassDef(Track, 1) // Track class
210 >    ClassDef(Track, 1) // Track class
211    };
212   }
213  
214   //--------------------------------------------------------------------------------------------------
215   inline
216 < void mithep::Track::SetHelix(Double_t phi, Double_t d0, Double_t pt, Double_t dz, Double_t theta)
216 > void mithep::Track::SetHelix(Double_t qOverP, Double_t lambda, Double_t phi0,
217 >                                   Double_t dxy, Double_t dsz)
218   {
219 <  fPhi   = phi;
220 <  fD0    = d0;
221 <  fPt    = pt;
222 <  fDz    = dz;
223 <  fTheta = theta;
219 >  // Set helix parameters.
220 >
221 >  fQOverP = qOverP;
222 >  fLambda = lambda;
223 >  fPhi0   = phi0;
224 >  fDxy    = dxy;
225 >  fDsz    = dsz;
226   }
227  
228   //--------------------------------------------------------------------------------------------------
229   inline
230 < void mithep::Track::SetErrors(Double_t phiErr, Double_t d0Err, Double_t ptErr, Double_t dzErr,
231 <                              Double_t thetaErr)
230 > void mithep::Track::SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
231 >                                   Double_t dxyErr, Double_t dszErr)
232   {
233 <  fPhiErr   = phiErr;
234 <  fD0Err    = d0Err;
235 <  fPtErr    = ptErr;
236 <  fDzErr    = dzErr;
237 <  fThetaErr = thetaErr;
233 >  // Set helix errors.
234 >
235 >  fQOverPErr = qOverPErr;
236 >  fLambdaErr = lambdaErr;
237 >  fPhi0Err   = phi0Err;
238 >  fDxyErr    = dxyErr;
239 >  fDszErr    = dszErr;
240 > }
241 >
242 > //--------------------------------------------------------------------------------------------------
243 > inline
244 > const mithep::MCParticle *mithep::Track::MCPart() const
245 > {
246 >  // Get reference to simulated particle.
247 >
248 >  return static_cast<const MCParticle*>(fMCParticleRef.GetObject());
249   }
250   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines