When ITS vertex is absent, extrapolation is done to 0 and an extrapolation becomes...
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jun 2006 14:27:30 +0000 (14:27 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Jun 2006 14:27:30 +0000 (14:27 +0000)
MUON/AliMUONReconstructor.cxx
MUON/AliMUONTrackParam.cxx
MUON/AliMUONTrackParam.h
MUON/MUONmassPlot_ESD.C

index 8c1625c..560e415 100644 (file)
@@ -482,11 +482,13 @@ void AliMUONReconstructor::FillESD(AliRunLoader* runLoader, AliESD* esd) const
     recTrack = (AliMUONTrack*) recTracksArray->At(iRecTracks);
 
     trackParam = (AliMUONTrackParam*) (recTrack->GetTrackParamAtHit())->First();
-    trackParam->ExtrapToVertex(vertex[0],vertex[1],vertex[2]);
+   
+    if (esdVert)
+      trackParam->ExtrapToVertex(vertex[0],vertex[1],vertex[2]);
 
     bendingSlope            = trackParam->GetBendingSlope();
     nonBendingSlope         = trackParam->GetNonBendingSlope();
-    inverseBendingMomentum = trackParam->GetInverseBendingMomentum();
+    inverseBendingMomentum  = trackParam->GetInverseBendingMomentum();
     xRec  = trackParam->GetNonBendingCoor();
     yRec  = trackParam->GetBendingCoor();
     zRec  = trackParam->GetZ();
index 01beb2e..a84cfa7 100644 (file)
@@ -29,6 +29,7 @@
 #include "AliMUON.h"
 #include "AliMUONTrackParam.h" 
 #include "AliMUONConstants.h"
+#include "AliESDMuonTrack.h"
 #include "AliRun.h" 
 #include "AliMagF.h" 
 #include "AliLog.h" 
@@ -82,6 +83,30 @@ AliMUONTrackParam::AliMUONTrackParam(const AliMUONTrackParam& theMUONTrackParam)
   fNonBendingCoor         =  theMUONTrackParam.fNonBendingCoor;
 }
 
+  //_________________________________________________________________________
+void AliMUONTrackParam::GetParamFrom(const AliESDMuonTrack& esdMuonTrack)
+{
+  // assigned value form ESD track.
+  fInverseBendingMomentum =  esdMuonTrack.GetInverseBendingMomentum();
+  fBendingSlope           =  TMath::Tan(esdMuonTrack.GetThetaY());
+  fNonBendingSlope        =  TMath::Tan(esdMuonTrack.GetThetaX());
+  fZ                      =  esdMuonTrack.GetZ(); 
+  fBendingCoor            =  esdMuonTrack.GetBendingCoor(); 
+  fNonBendingCoor         =  esdMuonTrack.GetNonBendingCoor();
+}
+
+  //_________________________________________________________________________
+void AliMUONTrackParam::SetParamFor(AliESDMuonTrack& esdMuonTrack)
+{
+  // assigned value form ESD track.
+  esdMuonTrack.SetInverseBendingMomentum(fInverseBendingMomentum);
+  esdMuonTrack.SetThetaX(TMath::ATan(fNonBendingSlope));
+  esdMuonTrack.SetThetaY(TMath::ATan(fBendingSlope));
+  esdMuonTrack.SetZ(fZ); 
+  esdMuonTrack.SetBendingCoor(fBendingCoor); 
+  esdMuonTrack.SetNonBendingCoor(fNonBendingCoor);
+}
+
   //__________________________________________________________________________
 void AliMUONTrackParam::ExtrapToZ(Double_t Z)
 {
index 878c49c..251deb9 100644 (file)
@@ -16,6 +16,8 @@
 
 #include <TObject.h>
 
+class AliESDMuonTrack;
+
 class AliMUONTrackParam : public TObject 
 {
  public:
@@ -24,6 +26,11 @@ class AliMUONTrackParam : public TObject
   
   AliMUONTrackParam(const AliMUONTrackParam& rhs);// copy constructor (should be added per default !)
   AliMUONTrackParam& operator=(const  AliMUONTrackParam& rhs);// (should be added per default !)
+
+  void GetParamFrom(const AliESDMuonTrack& esdMuonTrack);
+  void SetParamFor(AliESDMuonTrack& esdMuonTrack);
+
+
   // Get and Set methods for data
   Double_t GetInverseBendingMomentum(void) const {return fInverseBendingMomentum;}
   void     SetInverseBendingMomentum(Double_t InverseBendingMomentum) {fInverseBendingMomentum = InverseBendingMomentum;}
index 65bf9d6..636c6c1 100644 (file)
@@ -21,6 +21,7 @@
 #include "AliESD.h"
 
 // MUON includes
+#include "AliMUONTrackParam.h"
 #include "AliESDMuonTrack.h"
 #endif
 //
@@ -117,7 +118,8 @@ Bool_t MUONmassPlot(char* filename = "galice.root", Int_t FirstEvent = 0, Int_t
   Int_t ntrackhits, nevents;
   Double_t fitfmin;
   Double_t fZVertex=0;
-
+  Double_t fYVertex=0;
+  Double_t fXVertex=0;
  
   TLorentzVector fV1, fV2, fVtot;
 
@@ -157,7 +159,9 @@ Bool_t MUONmassPlot(char* filename = "galice.root", Int_t FirstEvent = 0, Int_t
 
   runLoader->LoadHeader();
   nevents = runLoader->GetNumberOfEvents();
-        
+  
+  AliMUONTrackParam trackParam;
+   
   // Loop over events
   for (Int_t iEvent = FirstEvent; iEvent <= TMath::Min(LastEvent, nevents - 1); iEvent++) {
 
@@ -173,7 +177,13 @@ Bool_t MUONmassPlot(char* filename = "galice.root", Int_t FirstEvent = 0, Int_t
 
     // get the SPD reconstructed vertex (vertexer) and fill the histogram
     AliESDVertex* Vertex = (AliESDVertex*) esd->AliESD::GetVertex();
-    if (Vertex) fZVertex = Vertex->GetZv();
+
+    if (Vertex) {
+      fZVertex = Vertex->GetZv();
+      fYVertex = Vertex->GetYv();
+      fXVertex = Vertex->GetXv();
+
+    }
     hPrimaryVertex->Fill(fZVertex);
 
     Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks() ; 
@@ -186,6 +196,12 @@ Bool_t MUONmassPlot(char* filename = "galice.root", Int_t FirstEvent = 0, Int_t
 
       AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack);
 
+      if (!Vertex) {
+       //re-extrapolate to vertex, if not kown before.
+       trackParam.GetParamFrom(*muonTrack);
+       trackParam.ExtrapToVertex(fXVertex, fYVertex, fZVertex);
+       trackParam.SetParamFor(*muonTrack);
+      }
       thetaX = muonTrack->GetThetaX();
       thetaY = muonTrack->GetThetaY();
 
@@ -236,10 +252,16 @@ Bool_t MUONmassPlot(char* filename = "galice.root", Int_t FirstEvent = 0, Int_t
          
          AliESDMuonTrack* muonTrack = esd->GetMuonTrack(iTrack2);
 
+         if (!Vertex) {
+           trackParam.GetParamFrom(*muonTrack);
+           trackParam.ExtrapToVertex(fXVertex, fYVertex, fZVertex);
+           trackParam.SetParamFor(*muonTrack);
+         }
+
          thetaX = muonTrack->GetThetaX();
          thetaY = muonTrack->GetThetaY();
 
-         pYZ     =  1./TMath::Abs(muonTrack->GetInverseBendingMomentum());
+         pYZ      =  1./TMath::Abs(muonTrack->GetInverseBendingMomentum());
          fPzRec2  = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaY));
          fPxRec2  = fPzRec2 * TMath::Tan(thetaX);
          fPyRec2  = fPzRec2 * TMath::Tan(thetaY);