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.27 by bendavid, Mon Nov 3 11:21:11 2008 UTC vs.
Revision 1.31 by loizides, Tue Dec 9 17:47:00 2008 UTC

# Line 81 | Line 81
81   #include "MitAna/DataTree/interface/SuperCluster.h"
82   #include "MitAna/DataTree/interface/MCParticle.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 143 | Line 144 | namespace mithep
144                  fChi2(0), fNdof(0), fEtaEcal(0), fPhiEcal(0) {}
145        ~Track() {}
146  
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           D0Err()          const { return fDxyErr; }
153 <      Double_t           Dsz()            const { return fDsz; }
154 <      Double_t           DszErr()         const { return fDszErr; }
155 <      Double_t           Dxy()            const { return fDxy; }
156 <      Double_t           DxyErr()         const { return fDxyErr; }
157 <      Double_t           E(Double_t m)    const { return TMath::Sqrt(E2(m)); }
158 <      Double_t           E2(Double_t m)   const { return P2()+m*m; }
159 <      Double_t           Eta()            const { return Mom().Eta(); }
160 <      Double_t           EtaEcal()        const { return fEtaEcal; }
161 <      Bool_t             Hit(EHitLayer l) const { return fHits.TestBit(l); }
162 <      const BitMask48   &Hits()           const { return fHits; }
163 <      Double_t           Lambda()         const { return fLambda; }
164 <      Double_t           LambdaErr()      const { return fLambdaErr; }
165 <      const MCParticle  *MCPart()         const;
166 <      ThreeVector        Mom()            const { return ThreeVector(Px(),Py(),Pz()); }
167 <      FourVector         Mom4(Double_t m) const { return FourVector(Px(),Py(),Pz(),E(m)); }
168 <      UInt_t             Ndof()           const { return fNdof; }
169 <      UInt_t             NHits()          const { return fHits.NBitsSet(); }
170 <      UInt_t             NStereoHits()    const { return StereoHits().NBitsSet(); }
171 <      Double_t           P2()             const { return P()*P(); }
172 <      Double_t           P()              const { return TMath::Abs(1./fQOverP); }
173 <      Double_t           Phi()            const { return fPhi0; }
174 <      Double_t           Phi0()           const { return fPhi0; }
175 <      Double_t           Phi0Err()        const { return fPhi0Err; }
176 <      Double_t           PhiEcal()        const { return fPhiEcal; }
177 <      Double_t           Prob()           const { return TMath::Prob(fChi2,fNdof); }
178 <      Double_t           Pt()             const { return TMath::Abs(TMath::Cos(fLambda)/fQOverP); }
179 <      Double_t           Px()             const { return Pt()*TMath::Cos(fPhi0); }      
180 <      Double_t           Py()             const { return Pt()*TMath::Sin(fPhi0); }
181 <      Double_t           Pz()             const { return P()*TMath::Sin(fLambda); }
182 <      Double_t           QOverP()         const { return fQOverP; }
183 <      Double_t           QOverPErr()      const { return fQOverPErr; }
184 <      Double_t           Theta()          const { return (TMath::PiOver2() - fLambda); }
185 <      Double_t           Z0()             const { return fDsz/TMath::Cos(fLambda); }
186 <      void               SetChi2(Double_t chi2) { fChi2 = chi2; }
187 <      void               SetErrors(Double_t qOverPErr, Double_t lambdaErr, Double_t phi0Err,
188 <                                   Double_t dXyErr, Double_t dSzErr);
189 <      void               SetEtaEcal(Double_t eta) { fEtaEcal = eta; }
190 <      void               SetHelix (Double_t qOverP, Double_t lambda, Double_t phi0,
191 <                                   Double_t dXy, Double_t dSz);
192 <      void               SetHit(EHitLayer l)      { fHits.SetBit(l); }
193 <      void               SetHits(const BitMask48 &hits) { fHits = hits; }
194 <      void               SetNdof(UInt_t dof)      { fNdof = dof; }
195 <      void               SetMCPart(MCParticle *p) { fMCParticleRef = p; }
196 <      void               SetPhiEcal(Double_t phi) { fPhiEcal = phi; }
197 <      void               SetSCluster(SuperCluster* sc) { fSuperClusterRef = sc; }
198 <      const SuperCluster *SCluster()      const;
199 <      const  BitMask48   StereoHits()     const { return (fHits & StereoLayers()); }
200 <      static const BitMask48 StereoLayers();
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 <      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)
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, 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 273 | Line 294 | const mithep::BitMask48 mithep::Track::S
294    // Build and return BitMask of stereo layers
295  
296    mithep::BitMask48 stereoLayers;
276  
297    stereoLayers.SetBit(mithep::Track::TIB1S);
298    stereoLayers.SetBit(mithep::Track::TIB2S);
299    stereoLayers.SetBit(mithep::Track::TID1S);
# Line 290 | Line 310 | const mithep::BitMask48 mithep::Track::S
310    stereoLayers.SetBit(mithep::Track::TEC7S);
311    stereoLayers.SetBit(mithep::Track::TEC8S);
312    stereoLayers.SetBit(mithep::Track::TEC9S);
293  
313    return stereoLayers;
314   }
315   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines