Updated version: methods to get momentum (Philippe)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Mar 2007 08:28:13 +0000 (08:28 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 14 Mar 2007 08:28:13 +0000 (08:28 +0000)
STEER/AliESDMuonTrack.cxx
STEER/AliESDMuonTrack.h

index d4ec2d6..9393f43 100644 (file)
 //
 ///////////////////////////////////////////////////////////////////////////////
 
-
 #include "AliESDMuonTrack.h"
 
+#include <TLorentzVector.h>
+#include <TMath.h>
+
 ClassImp(AliESDMuonTrack)
 
 //_____________________________________________________________________________
@@ -39,6 +41,12 @@ AliESDMuonTrack::AliESDMuonTrack ():
   fZ(0),
   fBendingCoor(0),
   fNonBendingCoor(0),
+  fInverseBendingMomentumUncorrected(0),
+  fThetaXUncorrected(0),
+  fThetaYUncorrected(0),
+  fZUncorrected(0),
+  fBendingCoorUncorrected(0),
+  fNonBendingCoorUncorrected(0),
   fChi2(0),
   fNHit(0),
   fMatchTrigger(0),
@@ -57,6 +65,12 @@ AliESDMuonTrack::AliESDMuonTrack (const AliESDMuonTrack& MUONTrack):
   fZ(MUONTrack.fZ),
   fBendingCoor(MUONTrack.fBendingCoor),
   fNonBendingCoor(MUONTrack.fNonBendingCoor),
+  fInverseBendingMomentumUncorrected(MUONTrack.fInverseBendingMomentumUncorrected),
+  fThetaXUncorrected(MUONTrack.fThetaXUncorrected),
+  fThetaYUncorrected(MUONTrack.fThetaYUncorrected),
+  fZUncorrected(MUONTrack.fZUncorrected),
+  fBendingCoorUncorrected(MUONTrack.fBendingCoorUncorrected),
+  fNonBendingCoorUncorrected(MUONTrack.fNonBendingCoorUncorrected),
   fChi2(MUONTrack.fChi2),
   fNHit(MUONTrack.fNHit),
   fMatchTrigger(MUONTrack.fMatchTrigger),
@@ -79,12 +93,20 @@ AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& MUONTrack)
 
   fInverseBendingMomentum = MUONTrack.fInverseBendingMomentum; 
   fThetaX                 = MUONTrack.fThetaX;           
-  fThetaY                 = MUONTrack.fThetaY ;           
+  fThetaY                 = MUONTrack.fThetaY;           
   fZ                      = MUONTrack.fZ;                
   fBendingCoor            = MUONTrack.fBendingCoor;      
   fNonBendingCoor         = MUONTrack.fNonBendingCoor;   
+  
+  fInverseBendingMomentumUncorrected = MUONTrack.fInverseBendingMomentumUncorrected; 
+  fThetaXUncorrected                 = MUONTrack.fThetaXUncorrected;           
+  fThetaYUncorrected                 = MUONTrack.fThetaYUncorrected;           
+  fZUncorrected                      = MUONTrack.fZUncorrected;                
+  fBendingCoorUncorrected            = MUONTrack.fBendingCoorUncorrected;      
+  fNonBendingCoorUncorrected         = MUONTrack.fNonBendingCoorUncorrected;   
+  
   fChi2                   = MUONTrack.fChi2;             
-  fNHit                   = MUONTrack.fNHit ; 
+  fNHit                   = MUONTrack.fNHit; 
 
   fMatchTrigger           = MUONTrack.fMatchTrigger;  
   fChi2MatchTrigger       = MUONTrack.fChi2MatchTrigger; 
@@ -92,4 +114,115 @@ AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& MUONTrack)
   return *this;
 }
 
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::Px() const
+{
+  // return p_x from track parameters
+  Double_t nonBendingSlope = TMath::Tan(fThetaX);
+  Double_t bendingSlope    = TMath::Tan(fThetaY);
+  Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  return pZ * nonBendingSlope;
+}
+
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::Py() const
+{
+  // return p_y from track parameters
+  Double_t bendingSlope = TMath::Tan(fThetaY);
+  Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  return pZ * bendingSlope;
+}
+
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::Pz() const
+{
+  // return p_z from track parameters
+  Double_t bendingSlope = TMath::Tan(fThetaY);
+  Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
+  return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+}
+
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::P() const
+{
+  // return p from track parameters
+  Double_t nonBendingSlope = TMath::Tan(fThetaX);
+  Double_t bendingSlope    = TMath::Tan(fThetaY);
+  Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
+}
+
+//_____________________________________________________________________________
+void AliESDMuonTrack::LorentzP(TLorentzVector& vP) const
+{
+  // return Lorentz momentum vector from track parameters
+  Double_t muonMass = 0.105658369;
+  Double_t nonBendingSlope = TMath::Tan(fThetaX);
+  Double_t bendingSlope    = TMath::Tan(fThetaY);
+  Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  Double_t pX  = pZ * nonBendingSlope;
+  Double_t pY  = pZ * bendingSlope;
+  Double_t e   = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
+  vP.SetPxPyPzE(pX, pY, pZ, e);
+}
+
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::PxUncorrected() const
+{
+  // return p_x from track parameters
+  Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
+  Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
+  Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  return pZ * nonBendingSlope;
+}
+
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::PyUncorrected() const
+{
+  // return p_y from track parameters
+  Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
+  Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  return pZ * bendingSlope;
+}
+
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::PzUncorrected() const
+{
+  // return p_z from track parameters
+  Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
+  Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
+  return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+}
+
+//_____________________________________________________________________________
+Double_t AliESDMuonTrack::PUncorrected() const
+{
+  // return p from track parameters
+  Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
+  Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
+  Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
+}
+
+//_____________________________________________________________________________
+void AliESDMuonTrack::LorentzPUncorrected(TLorentzVector& vP) const
+{
+  // return Lorentz momentum vector from track parameters
+  Double_t muonMass = 0.105658369;
+  Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
+  Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
+  Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
+  Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
+  Double_t pX  = pZ * nonBendingSlope;
+  Double_t pY  = pZ * bendingSlope;
+  Double_t e   = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
+  vP.SetPxPyPzE(pX, pY, pZ, e);
+}
 
index f57956b..15668a4 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "TObject.h"
 
+class TLorentzVector;
+
 class AliESDMuonTrack : public TObject {
 public:
   AliESDMuonTrack(); //Constructor
@@ -21,47 +23,88 @@ public:
   AliESDMuonTrack& operator=(const AliESDMuonTrack& esdm);
 
 
- // Get and Set methods for data
+ // Get and Set methods for data at vertex
   Double_t GetInverseBendingMomentum(void) const {return fInverseBendingMomentum;}
-  void SetInverseBendingMomentum(Double_t InverseBendingMomentum) 
-    {fInverseBendingMomentum = InverseBendingMomentum;}
+  void     SetInverseBendingMomentum(Double_t InverseBendingMomentum) 
+               {fInverseBendingMomentum = InverseBendingMomentum;}
   Double_t GetThetaX(void) const {return fThetaX;}
-  void SetThetaX(Double_t ThetaX) {fThetaX = ThetaX;}
+  void     SetThetaX(Double_t ThetaX) {fThetaX = ThetaX;}
   Double_t GetThetaY(void) const {return fThetaY;}
-  void SetThetaY(Double_t ThetaY) {fThetaY = ThetaY;}
+  void     SetThetaY(Double_t ThetaY) {fThetaY = ThetaY;}
   Double_t GetZ(void) const {return fZ;}
-  void SetZ(Double_t Z) {fZ = Z;}
+  void     SetZ(Double_t Z) {fZ = Z;}
   Double_t GetBendingCoor(void) const {return fBendingCoor;}
-  void SetBendingCoor(Double_t BendingCoor) {fBendingCoor = BendingCoor;}
+  void     SetBendingCoor(Double_t BendingCoor) {fBendingCoor = BendingCoor;}
   Double_t GetNonBendingCoor(void) const {return fNonBendingCoor;}
-  void SetNonBendingCoor(Double_t NonBendingCoor) {fNonBendingCoor = NonBendingCoor;}
+  void     SetNonBendingCoor(Double_t NonBendingCoor) {fNonBendingCoor = NonBendingCoor;}
+  
+ // Get and Set methods for data at first station
+  Double_t GetInverseBendingMomentumUncorrected(void) const {return fInverseBendingMomentumUncorrected;}
+  void     SetInverseBendingMomentumUncorrected(Double_t InverseBendingMomentum) 
+               {fInverseBendingMomentumUncorrected = InverseBendingMomentum;}
+  Double_t GetThetaXUncorrected(void) const {return fThetaXUncorrected;}
+  void     SetThetaXUncorrected(Double_t ThetaX) {fThetaXUncorrected = ThetaX;}
+  Double_t GetThetaYUncorrected(void) const {return fThetaYUncorrected;}
+  void     SetThetaYUncorrected(Double_t ThetaY) {fThetaYUncorrected = ThetaY;}
+  Double_t GetZUncorrected(void) const {return fZUncorrected;}
+  void     SetZUncorrected(Double_t Z) {fZUncorrected = Z;}
+  Double_t GetBendingCoorUncorrected(void) const {return fBendingCoorUncorrected;}
+  void     SetBendingCoorUncorrected(Double_t BendingCoor) {fBendingCoorUncorrected = BendingCoor;}
+  Double_t GetNonBendingCoorUncorrected(void) const {return fNonBendingCoorUncorrected;}
+  void     SetNonBendingCoorUncorrected(Double_t NonBendingCoor) {fNonBendingCoorUncorrected = NonBendingCoor;}
+  
+ // Get and Set methods for global tracking info
   Double_t GetChi2(void) const {return fChi2;}
-  void SetChi2(Double_t Chi2) {fChi2 = Chi2;}
-  UInt_t GetNHit(void) const {return fNHit;}
-  void SetNHit(UInt_t NHit) {fNHit = NHit;}
+  void     SetChi2(Double_t Chi2) {fChi2 = Chi2;}
+  UInt_t   GetNHit(void) const {return fNHit;}
+  void     SetNHit(UInt_t NHit) {fNHit = NHit;}
 
-  Bool_t GetMatchTrigger() const {return fMatchTrigger;}
-  void SetMatchTrigger(Bool_t MatchTrigger) {fMatchTrigger = MatchTrigger;}
+ // Get and Set methods for trigger matching
+  Bool_t   GetMatchTrigger() const {return fMatchTrigger;}
+  void     SetMatchTrigger(Bool_t MatchTrigger) {fMatchTrigger = MatchTrigger;}
   Double_t GetChi2MatchTrigger() const {return fChi2MatchTrigger;}
-  void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger;}
-
+  void     SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger;}
+  
+ // Methods to compute track momentum
+  Double_t Px() const;
+  Double_t Py() const;
+  Double_t Pz() const;
+  Double_t P() const;
+  void     LorentzP(TLorentzVector& vP) const;
+  Double_t PxUncorrected() const;
+  Double_t PyUncorrected() const;
+  Double_t PzUncorrected() const;
+  Double_t PUncorrected() const;
+  void     LorentzPUncorrected(TLorentzVector& vP) const;
+  
+  
 protected:
-  // tracking chamber
+ // parameters at vertex
   Double_t fInverseBendingMomentum; // Inverse bending momentum (GeV/c ** -1) times the charge 
-  Double_t fThetaX;           // Angle of track at vertex in X direction (rad)
-  Double_t fThetaY;           // Angle of track at vertex in Y direction (rad)
-  Double_t fZ;                // Z coordinate (cm)
-  Double_t fBendingCoor;      // bending coordinate (cm)
-  Double_t fNonBendingCoor;   // non bending coordinate (cm)
-  Double_t fChi2;             // chi2 in the MUON track fit
-  UInt_t   fNHit;              // number of hit in the track
+  Double_t fThetaX;                // Angle of track at vertex in X direction (rad)
+  Double_t fThetaY;                // Angle of track at vertex in Y direction (rad)
+  Double_t fZ;                     // Z coordinate (cm)
+  Double_t fBendingCoor;           // bending coordinate (cm)
+  Double_t fNonBendingCoor;        // non bending coordinate (cm)
+  
+ // parameters at first tracking station
+  Double_t fInverseBendingMomentumUncorrected; // Inverse bending momentum (GeV/c ** -1) times the charge 
+  Double_t fThetaXUncorrected;                // Angle of track at vertex in X direction (rad)
+  Double_t fThetaYUncorrected;                // Angle of track at vertex in Y direction (rad)
+  Double_t fZUncorrected;                     // Z coordinate (cm)
+  Double_t fBendingCoorUncorrected;           // bending coordinate (cm)
+  Double_t fNonBendingCoorUncorrected;        // non bending coordinate (cm)
+  
+ // global tracking info
+  Double_t fChi2; // chi2 in the MUON track fit
+  UInt_t   fNHit; // number of hit in the track
 
-  // trigger matching
-  Bool_t   fMatchTrigger; // 1 if track matches with trigger track, 0 if not
+ // trigger matching
+  Bool_t   fMatchTrigger;     // 1 if track matches with trigger track, 0 if not
   Double_t fChi2MatchTrigger; // chi2 of trigger/track matching 
 
 
-  ClassDef(AliESDMuonTrack,2)  //MUON ESD track class 
+  ClassDef(AliESDMuonTrack,3)  //MUON ESD track class 
 };
 
 #endif