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.14 by bendavid, Fri Jul 25 11:32:45 2008 UTC vs.
Revision 1.15 by bendavid, Thu Jul 31 13:28:42 2008 UTC

# Line 3 | Line 3
3   //
4   // Track
5   //
6 < // This will/must 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 >
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   //--------------------------------------------------------------------------------------------------
# Line 13 | Line 73
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
# Line 20 | Line 82 | namespace mithep
82    class Track : public DataObject
83    {
84      public:
85 <      Track() : fPhi(0), fD0(0), fPt(0), fDz(0), fTheta(0), fPhiErr(0), fD0Err(0), fPtErr(0),
86 <                fDzErr(0), fThetaErr(0), fCharge(0) {}
87 <      Track(Double_t phi, Double_t d0, Double_t pt, Double_t dz, Double_t theta) :
88 <        fPhi(phi), fD0(d0), fPt(pt), fDz(dz), fTheta(theta), fPhiErr(0), fD0Err(0), fPtErr(0),
89 <        fDzErr(0), fThetaErr(0), fCharge(0) {}
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 <      Int_t              Charge()       const { return fCharge; }      
132 <      Double_t           D0()           const { return fD0; }
133 <      Double_t           D0Err()        const { return fD0Err; }
134 <      Double_t           Dz()           const { return fDz; }
135 <      Double_t           DzErr()        const { return fDzErr; }
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 <      Double_t           P2()           const { return Px()*Px()+Py()*Py()+Pz()*Pz(); }
155 <      Double_t           P()            const { return TMath::Sqrt(P2()); }
156 <      Double_t           Px()           const { return TMath::Cos(fPhi)*fabs(fPt); }      
157 <      Double_t           Py()           const { return TMath::Sin(fPhi)*fabs(fPt); }
158 <      Double_t           Pz()           const { return TMath::Abs(fPt)/TMath::Tan(fTheta); }
159 <      Double_t           Phi()          const { return fPhi; }
160 <      Double_t           PhiErr()       const { return fPhiErr; }
161 <      Double_t           Pt()           const { return fPt; }
162 <      Double_t           PtErr()        const { return fPtErr; }
163 <      Double_t           Theta()        const { return fTheta; }
164 <      Double_t           ThetaErr()     const { return fThetaErr; }
165 <      
166 <      FourVector         Mom4(double m) const { return FourVector(Px(),Py(),Pz(),E(m)); }
167 <      Double_t           E2(double m)   const { return P2()+m*m; }
168 <      Double_t           E(double m)    const { return TMath::Sqrt(E2(m)); }
169 <
170 <      void               SetCharge(Int_t charge) { fCharge = charge; }
171 <      void               SetHelix (Double_t phi, Double_t d0, Double_t pt,
172 <                                   Double_t dz, Double_t theta);
173 <      void               SetErrors(Double_t phiErr, Double_t d0Err, Double_t ptErr,
174 <                                   Double_t dzErr, Double_t thetaErr);
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 <      Double_t           fPhi;            //azimuthal angle
192 <      Double_t           fD0;             //raw impact parameter
193 <      Double_t           fPt;             //transverse momentum
194 <      Double_t           fDz;             //z-displacement
195 <      Double_t           fTheta;          //polar angle
196 <      Double_t           fPhiErr;         //uncertainy on phi
197 <      Double_t           fD0Err;          //uncertainty on D0
198 <      Double_t           fPtErr;          //uncertainty on pt
199 <      Double_t           fDzErr;          //uncertainty on dz
200 <      Double_t           fThetaErr;       //uncertainty on theta
201 <      Int_t              fCharge;         //electric charge of reconstructed track
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
# Line 78 | Line 208 | namespace mithep
208  
209   //--------------------------------------------------------------------------------------------------
210   inline
211 < void mithep::Track::SetHelix(Double_t phi, Double_t d0, Double_t pt, Double_t dz, Double_t theta)
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 <  fPhi   = phi;
217 <  fD0    = d0;
218 <  fPt    = pt;
219 <  fDz    = dz;
220 <  fTheta = theta;
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 phiErr, Double_t d0Err, Double_t ptErr, Double_t dzErr,
226 <                              Double_t thetaErr)
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 <  fPhiErr   = phiErr;
231 <  fD0Err    = d0Err;
232 <  fPtErr    = ptErr;
233 <  fDzErr    = dzErr;
234 <  fThetaErr = thetaErr;
230 >  fQOverPErr = qOverPErr;
231 >  fLambdaErr = lambdaErr;
232 >  fPhi0Err   = phi0Err;
233 >  fDxyErr    = dxyErr;
234 >  fDszErr    = dszErr;
235   }
236  
237   //--------------------------------------------------------------------------------------------------

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines