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.15 by bendavid, Thu Jul 31 13:28:42 2008 UTC vs.
Revision 1.31 by loizides, Tue Dec 9 17:47:00 2008 UTC

# Line 12 | Line 12
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 < //
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, TOB L1,L2, TEC L1,L2,L5)
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
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
# Line 39 | Line 38
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 phi
41 > // Bit 11: TID L1 r-phi
42   // Bit 12: TID L1 stereo
43 < // Bit 13: TID L2 phi
43 > // Bit 13: TID L2 r-phi
44   // Bit 14: TID L2 stereo
45 < // Bit 15: TID L3 phi
46 < // 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 < // Bit 24: TEC L1 phi
55 < // Bit 25: TEC L1 stereo
56 < // Bit 26: TEC L2 phi
57 < // Bit 27: TEC L2 stereo
58 < // Bit 28: TEC L3 phi
59 < // Bit 29: TEC L4 phi
60 < // Bit 30: TEC L5 phi
61 < // Bit 31: TEC L5 stereo
62 < // Bit 32: TEC L6 phi
63 < // Bit 33: TEC L7 phi
64 < // Bit 34: TEC L8 phi
65 < // Bit 35: TEC L9 phi
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/SuperCluster.h"
82   #include "MitAna/DataTree/interface/MCParticle.h"
83 < #include "MitAna/DataTree/interface/BitMask32.h"
84 < #include "MitAna/DataTree/interface/BitMask64.h"
83 > #include "MitAna/DataTree/interface/BitMask.h"
84 > #include "MitAna/DataTree/interface/BaseVertex.h"
85   #include "MitAna/DataTree/interface/Types.h"
86  
87   namespace mithep
# Line 82 | Line 89 | namespace mithep
89    class Track : public DataObject
90    {
91      public:
92 <      enum HitLayer { 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 <                      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 <                      TEC4,
122 <                      TEC5,
123 <                      TEC5S,
124 <                      TEC6,
125 <                      TEC7,
126 <                      TEC8,
127 <                      TEC9 };
128 <    
92 >      enum EHitLayer {
93 >        PXB1,
94 >        PXB2,
95 >        PXB3,
96 >        PXF1,
97 >        PXF2,
98 >        TIB1,
99 >        TIB1S,
100 >        TIB2,
101 >        TIB2S,
102 >        TIB3,
103 >        TIB4,
104 >        TID1,
105 >        TID1S,
106 >        TID2,
107 >        TID2S,
108 >        TID3,
109 >        TID3S,
110 >        TOB1,
111 >        TOB1S,
112 >        TOB2,
113 >        TOB2S,
114 >        TOB3,
115 >        TOB4,
116 >        TOB5,
117 >        TOB6,
118 >        TEC1,
119 >        TEC1S,
120 >        TEC2,
121 >        TEC2S,
122 >        TEC3,
123 >        TEC3S,
124 >        TEC4,
125 >        TEC4S,
126 >        TEC5,
127 >        TEC5S,
128 >        TEC6,
129 >        TEC6S,
130 >        TEC7,
131 >        TEC7S,
132 >        TEC8,
133 >        TEC8S,
134 >        TEC9,
135 >        TEC9S
136 >      };
137 >
138        Track() : fQOverP(0), fQOverPErr(0), fLambda(0), fLambdaErr(0),
139                  fPhi0(0), fPhi0Err(0), fDxy(0), fDxyErr(0), fDsz(0), fDszErr(0),
140 <                fChi2(0), fNdof(0) {}
140 >                fChi2(0), fNdof(0), fEtaEcal(0), fPhiEcal(0) {}
141        Track(Double_t qOverP, Double_t lambda, Double_t phi0, Double_t dxy, Double_t dsz) :
142                  fQOverP(qOverP), fQOverPErr(0), fLambda(lambda), fLambdaErr(0),
143                  fPhi0(phi0), fPhi0Err(0), fDxy(dxy), fDxyErr(0), fDsz(dsz), fDszErr(0),
144 <                fChi2(0), fNdof(0) {}
144 >                fChi2(0), fNdof(0), fEtaEcal(0), fPhiEcal(0) {}
145        ~Track() {}
146  
147 <      Double_t           QOverP()       const { return fQOverP; }
148 <      Double_t           QOverPErr()    const { return fQOverPErr; }
149 <      Double_t           Lambda()       const { return fLambda; }
150 <      Double_t           LambdaErr()    const { return fLambdaErr; }
151 <      Double_t           Phi0()         const { return fPhi0; }
152 <      Double_t           Phi0Err()      const { return fPhi0Err; }
153 <      Double_t           Dxy()          const { return fDxy; }
154 <      Double_t           DxyErr()       const { return fDxyErr; }
155 <      Double_t           Dsz()          const { return fDsz; }
156 <      Double_t           DszErr()       const { return fDszErr; }
157 <      
158 <
159 <
160 <      Int_t              Charge()       const { return (fQOverP>0) ? 1 : -1; }
161 <      Double_t           Chi2()         const { return fChi2; }
162 <      void               ClearHit(HitLayer l) { fHits.ClearBit(l); }
163 <      Double_t           D0()           const { return -fDxy; }
164 <      Double_t           D0Err()        const { return fDxyErr; }
165 <      Bool_t             Hit(HitLayer l) const { return fHits.TestBit(l); }
166 <      BitMask64         &Hits()               { return fHits; }
167 <      const BitMask64   &Hits()         const { return fHits; }
168 <      ULong64_t          HitMask()      const { return fHits.Bits(); }
169 <      ThreeVector        Mom()          const { return ThreeVector(Px(),Py(),Pz()); }
170 <      UInt_t             Ndof()         const { return fNdof; }
171 <      Double_t           P2()           const { return P()*P(); }
172 <      Double_t           P()            const { return TMath::Abs(1./fQOverP); }
173 <      Double_t           Px()           const { return Pt()*TMath::Cos(fPhi0); }      
174 <      Double_t           Py()           const { return Pt()*TMath::Sin(fPhi0); }
175 <      Double_t           Pz()           const { return P()*TMath::Sin(fLambda); }
176 <      Double_t           Phi()          const { return fPhi0; }
177 <      Double_t           Pt()           const { return TMath::Abs(TMath::Cos(fLambda)/fQOverP); }
178 <      //Double_t           PtErr()        const { return fPtErr; }
179 <      void               SetChi2(Double_t chi2) { fChi2 = chi2; }
180 <      void               SetHit(HitLayer l)     { fHits.SetBit(l); }
181 <      void               SetHits(BitMask64 hits)  { fHits = hits; }
182 <      void               SetHits(ULong64_t hitMask)  { fHits.SetBits(hitMask); }
183 <      void               SetNdof(UInt_t dof)      { fNdof = dof; }
184 <      void               SetStat(BitMask32 stat)  { fStat = stat; }
185 <      void               SetStat(UInt_t statBits) { fStat.SetBits(statBits); }
186 <      BitMask32         &Stat()               { return fStat; }
187 <      const BitMask32   &Stat()         const { return fStat; }
188 <      UInt_t             StatBits()     const { return fStat.Bits(); }
189 <      Double_t           Theta()        const { return (TMath::PiOver2() - fLambda); }
190 <      Double_t           Z0()           const { return fDsz/TMath::Cos(fLambda); }
191 <      //Double_t           Z0Err()        const { return fZ0Err; }
192 <      
193 <      FourVector         Mom4(Double_t m) const { return FourVector(Px(),Py(),Pz(),E(m)); }
194 <      Double_t           E2(Double_t m)   const { return P2()+m*m; }
195 <      Double_t           E(Double_t m)    const { return TMath::Sqrt(E2(m)); }
196 <      UInt_t             NHits()          const { return fHits.NBitsSet(); }
197 <
198 <      void               SetHelix (Double_t qOverP, Double_t lambda, Double_t phi0,
199 <                                   Double_t dXy, Double_t dSz);
200 <      void               SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
201 <                                   Double_t dXyErr, Double_t dSzErr);
202 <      
203 <      const MCParticle  *MCPart()      const;
204 <      void               SetMCPart(MCParticle *p) { fMCParticleRef = p; }
205 <      
147 >      Int_t               Charge()          const { return (fQOverP>0) ? 1 : -1; }
148 >      Double_t            Chi2()            const { return fChi2; }
149 >      Double_t            RChi2()           const { return fChi2/(Double_t)fNdof; }
150 >      void                ClearHit(EHitLayer l)  { fHits.ClearBit(l); }
151 >      Double_t            D0()              const { return -fDxy; }
152 >      Double_t            D0Corrected(const BaseVertex *iVertex) const;
153 >      Double_t            D0Err()           const { return fDxyErr; }
154 >      Double_t            Dsz()             const { return fDsz; }
155 >      Double_t            DszErr()          const { return fDszErr; }
156 >      Double_t            Dxy()             const { return fDxy; }
157 >      Double_t            DxyErr()          const { return fDxyErr; }
158 >      Double_t            E(Double_t m)     const { return TMath::Sqrt(E2(m)); }
159 >      Double_t            E2(Double_t m)    const { return P2()+m*m; }
160 >      Double_t            Eta()             const { return Mom().Eta(); }
161 >      Double_t            EtaEcal()         const { return fEtaEcal; }
162 >      Bool_t              Hit(EHitLayer l)  const { return fHits.TestBit(l); }
163 >      const BitMask48    &Hits()            const { return fHits; }
164 >      Double_t            Lambda()          const { return fLambda; }
165 >      Double_t            LambdaErr()       const { return fLambdaErr; }
166 >      const MCParticle   *MCPart()          const;
167 >      ThreeVector         Mom()             const { return ThreeVector(Px(),Py(),Pz()); }
168 >      FourVector          Mom4(Double_t m)  const { return FourVector(Px(),Py(),Pz(),E(m)); }
169 >      UInt_t              Ndof()            const { return fNdof; }
170 >      UInt_t              NHits()           const { return fHits.NBitsSet(); }
171 >      UInt_t              NStereoHits()     const { return StereoHits().NBitsSet(); }
172 >      EObjType            ObjType()         const { return kTrack; }      
173 >      Double_t            P2()              const { return P()*P(); }
174 >      Double_t            P()               const { return TMath::Abs(1./fQOverP); }
175 >      Double_t            Phi()             const { return fPhi0; }
176 >      Double_t            Phi0()            const { return fPhi0; }
177 >      Double_t            Phi0Err()         const { return fPhi0Err; }
178 >      Double_t            PhiEcal()         const { return fPhiEcal; }
179 >      Double_t            Prob()            const { return TMath::Prob(fChi2,fNdof); }
180 >      Double_t            Pt()              const { return TMath::Abs(TMath::Cos(fLambda)/fQOverP); }
181 >      Double_t            Px()              const { return Pt()*TMath::Cos(fPhi0); }      
182 >      Double_t            Py()              const { return Pt()*TMath::Sin(fPhi0); }
183 >      Double_t            Pz()              const { return P()*TMath::Sin(fLambda); }
184 >      Double_t            QOverP()          const { return fQOverP; }
185 >      Double_t            QOverPErr()       const { return fQOverPErr; }
186 >      Double_t            Theta()           const { return (TMath::PiOver2() - fLambda); }
187 >      Double_t            Z0()              const { return fDsz/TMath::Cos(fLambda); }
188 >      const SuperCluster *SCluster()        const;
189 >      const BitMask48     StereoHits()      const { return (fHits & StereoLayers()); }
190 >      void                SetChi2(Double_t chi2)   { fChi2 = chi2; }
191 >      void                SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
192 >                                    Double_t dXyErr, Double_t dSzErr);
193 >      void                SetEtaEcal(Double_t eta) { fEtaEcal = eta; }
194 >      void                SetHelix (Double_t qOverP, Double_t lambda, Double_t phi0,
195 >                                    Double_t dXy, Double_t dSz);
196 >      void                SetHit(EHitLayer l)      { fHits.SetBit(l); }
197 >      void                SetHits(const BitMask48 &hits) { fHits = hits; }
198 >      void                SetNdof(UInt_t dof)      { fNdof = dof; }
199 >      void                SetMCPart(const MCParticle *p)
200 >                            { fMCParticleRef = const_cast<MCParticle*>(p); }
201 >      void                SetPhiEcal(Double_t phi) { fPhiEcal = phi; }
202 >      void                SetSCluster(const SuperCluster* sc)
203 >                            { fSuperClusterRef = const_cast<SuperCluster*>(sc); }
204 >
205 >      static
206 >      const BitMask48    StereoLayers();
207 >
208      protected:
209 <          // Constant which is store in the file
210 <      BitMask64          fHits;                // Mostly Hit informations
211 <      BitMask32          fStat;                // Storage for various interesting things
212 <      Double_t           fQOverP, fQOverPErr;
213 <      Double_t           fLambda, fLambdaErr;
214 <      Double_t           fPhi0,fPhi0Err;       // Follow track parameters/uncertainties
215 <      Double_t           fDxy,  fDxyErr;
216 <      Double_t           fDsz,  fDszErr;
217 <      
218 <      Double_t           fChi2; //chi squared of track fit
219 <      UInt_t             fNdof; //number of dof of track fit
220 <      
221 <      TRef               fMCParticleRef; //reference to sim particle (for monte carlo)
209 >      BitMask48           fHits;                //storage for mostly hit information
210 >      Double_t            fQOverP;              //signed inverse of momentum [1/GeV]
211 >      Double_t            fQOverPErr;           //error of q/p
212 >      Double_t            fLambda;              //pi/2 - polar angle at the reference point
213 >      Double_t            fLambdaErr;           //error of lambda
214 >      Double_t            fPhi0;                //azimuth angle at the given point
215 >      Double_t            fPhi0Err;             //error of azimuthal angle
216 >      Double_t            fDxy;                 //transverse distance to reference point [cm]
217 >      Double_t            fDxyErr;              //error of transverse distance
218 >      Double_t            fDsz;                 //longitudinal distance to reference point [cm]
219 >      Double_t            fDszErr;              //error of longitudinal distance
220 >      Double_t            fChi2;                //chi squared of track fit
221 >      UInt_t              fNdof;                //degree-of-freedom of track fit
222 >      Double32_t          fEtaEcal;             //eta of track at Ecal front face
223 >      Double32_t          fPhiEcal;             //phi of track at Ecal front face
224 >      TRef                fSuperClusterRef;     //superCluster crossed by track
225 >      TRef                fMCParticleRef;       //reference to sim particle (for monte carlo)
226                
227 <    ClassDef(Track, 1) // Track class
227 >    ClassDef(Track, 2) // Track class
228    };
229   }
230  
231   //--------------------------------------------------------------------------------------------------
232 + inline Double_t mithep::Track::D0Corrected(const BaseVertex *iVertex) const
233 + {
234 +  // Return corrected d0 with respect to primary vertex or beamspot.
235 +
236 +  Double_t lXM =  -TMath::Sin(Phi()) * D0();
237 +  Double_t lYM =   TMath::Cos(Phi()) * D0();
238 +  Double_t lDX = (lXM + iVertex->X());
239 +  Double_t lDY = (lYM + iVertex->Y());
240 +  Double_t d0Corr = (Px()*lDY - Py()*lDX)/Pt();
241 +  
242 +  return d0Corr;
243 + }
244 +
245 + //--------------------------------------------------------------------------------------------------
246   inline
247   void mithep::Track::SetHelix(Double_t qOverP, Double_t lambda, Double_t phi0,
248                                     Double_t dxy, Double_t dsz)
# Line 242 | Line 278 | const mithep::MCParticle *mithep::Track:
278  
279    return static_cast<const MCParticle*>(fMCParticleRef.GetObject());
280   }
281 +
282 + //--------------------------------------------------------------------------------------------------
283 + inline const mithep::SuperCluster *mithep::Track::SCluster() const
284 + {
285 +  // Return Super cluster
286 +
287 +  return static_cast<const SuperCluster*>(fSuperClusterRef.GetObject());
288 + }
289 +
290 + //--------------------------------------------------------------------------------------------------
291 + inline
292 + const mithep::BitMask48 mithep::Track::StereoLayers()
293 + {
294 +  // Build and return BitMask of stereo layers
295 +
296 +  mithep::BitMask48 stereoLayers;
297 +  stereoLayers.SetBit(mithep::Track::TIB1S);
298 +  stereoLayers.SetBit(mithep::Track::TIB2S);
299 +  stereoLayers.SetBit(mithep::Track::TID1S);
300 +  stereoLayers.SetBit(mithep::Track::TID2S);
301 +  stereoLayers.SetBit(mithep::Track::TID3S);
302 +  stereoLayers.SetBit(mithep::Track::TOB1S);
303 +  stereoLayers.SetBit(mithep::Track::TOB2S);
304 +  stereoLayers.SetBit(mithep::Track::TEC1S);
305 +  stereoLayers.SetBit(mithep::Track::TEC2S);
306 +  stereoLayers.SetBit(mithep::Track::TEC3S);
307 +  stereoLayers.SetBit(mithep::Track::TEC4S);
308 +  stereoLayers.SetBit(mithep::Track::TEC5S);
309 +  stereoLayers.SetBit(mithep::Track::TEC6S);
310 +  stereoLayers.SetBit(mithep::Track::TEC7S);
311 +  stereoLayers.SetBit(mithep::Track::TEC8S);
312 +  stereoLayers.SetBit(mithep::Track::TEC9S);
313 +  return stereoLayers;
314 + }
315   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines