--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+
+///////////////////////////////////////////////////
+//
+// Interface
+// for
+// MUON
+// track
+// extrapolation
+//
+///////////////////////////////////////////////////
+
+#include "AliPWG3TrackExtrapInterface.h"
+#include "AliMUONTrackExtrap.h"
+#include "AliESDMuonTrack.h"
+#include "AliMUONTrackParam.h"
+#include "AliMagF.h"
+
+#include <Riostream.h>
+#include <TGeoManager.h>
+
+/// \cond CLASSIMP
+ClassImp(AliPWG3TrackExtrapInterface) // Class implementation in ROOT context
+/// \endcond
+
+ //__________________________________________________________________________
+void AliPWG3TrackExtrapInterface::SetMagField(const AliMagF* magField)
+{
+ /// Set the magnetic field (required for track extrapolation)
+
+ AliMUONTrackExtrap::SetField(magField);
+
+}
+
+ //__________________________________________________________________________
+Bool_t AliPWG3TrackExtrapInterface::SetGeometry(const char* fileName)
+{
+ /// Set the geometry (required for absorber correction)
+
+ if (!gGeoManager) {
+ TGeoManager::Import(fileName);
+ if (!gGeoManager) {
+ cout<<"E-AliPWG3TrackExtrapInterface::ImportGeo: getting geometry from file "<<fileName<<" failed"<<endl;
+ return kFALSE;
+ }
+ }
+ return kTRUE;
+
+}
+
+ //__________________________________________________________________________
+void AliPWG3TrackExtrapInterface::ExtrapToVertexUncorrected(AliESDMuonTrack* muonTrack, Double_t zVtx)
+{
+ /// Extrapolation to the vertex (at the z position "zVtx") without Branson and energy loss corrections.
+ /// Returns the extrapolated track parameters in the current ESDMuonTrack.
+
+ AliMUONTrackParam trackParam;
+ trackParam.GetParamFromUncorrected(*muonTrack);
+ // dummy vertex transverse position (not used anyway)
+ Double_t xVtx = 0.;
+ Double_t yVtx = 0.;
+ AliMUONTrackExtrap::ExtrapToVertex(&trackParam, xVtx, yVtx, zVtx, kFALSE, kFALSE);
+ trackParam.SetParamFor(*muonTrack);
+
+}
+
+ //__________________________________________________________________________
+void AliPWG3TrackExtrapInterface::ExtrapToVertexWithELoss(AliESDMuonTrack* muonTrack, Double_t zVtx)
+{
+ /// Extrapolation to the vertex (at the z position "zVtx") with energy loss correction only.
+ /// Returns the extrapolated track parameters in the current ESDMuonTrack.
+
+ AliMUONTrackParam trackParam;
+ trackParam.GetParamFromUncorrected(*muonTrack);
+ // compute energy loss correction assuming linear propagation
+ Double_t xVtx = trackParam.GetNonBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetNonBendingSlope();
+ Double_t yVtx = trackParam.GetBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetBendingSlope();
+ AliMUONTrackExtrap::ExtrapToVertex(&trackParam, xVtx, yVtx, zVtx, kFALSE, kTRUE);
+ trackParam.SetParamFor(*muonTrack);
+
+}
+
+ //__________________________________________________________________________
+void AliPWG3TrackExtrapInterface::ExtrapToVertexWithBranson(AliESDMuonTrack* muonTrack, Double_t vtx[3])
+{
+ /// Extrapolation to the vertex (at the z position "zVtx") with Branson correction only.
+ /// Returns the extrapolated track parameters in the current ESDMuonTrack.
+
+ AliMUONTrackParam trackParam;
+ trackParam.GetParamFromUncorrected(*muonTrack);
+ AliMUONTrackExtrap::ExtrapToVertex(&trackParam, vtx[0], vtx[1], vtx[2], kTRUE, kFALSE);
+ trackParam.SetParamFor(*muonTrack);
+
+}
+
+ //__________________________________________________________________________
+void AliPWG3TrackExtrapInterface::ExtrapToVertex(AliESDMuonTrack* muonTrack, Double_t vtx[3])
+{
+ /// Extrapolation to the vertex (at the z position "zVtx") with Branson and energy loss corrections.
+ /// Returns the extrapolated track parameters in the current ESDMuonTrack.
+
+ AliMUONTrackParam trackParam;
+ trackParam.GetParamFromUncorrected(*muonTrack);
+ AliMUONTrackExtrap::ExtrapToVertex(&trackParam, vtx[0], vtx[1], vtx[2], kTRUE, kTRUE);
+ trackParam.SetParamFor(*muonTrack);
+
+}
+
+ //__________________________________________________________________________
+Double_t AliPWG3TrackExtrapInterface::TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t zVtx)
+{
+ /// Calculate the total momentum energy loss in-between the track position and the vertex assuming a linear propagation
+ AliMUONTrackParam trackParam;
+ trackParam.GetParamFromUncorrected(*muonTrack);
+ Double_t xVtx = trackParam.GetNonBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetNonBendingSlope();
+ Double_t yVtx = trackParam.GetBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetBendingSlope();
+ return AliMUONTrackExtrap::TotalMomentumEnergyLoss(&trackParam, xVtx, yVtx, zVtx);
+}
+
+ //__________________________________________________________________________
+Double_t AliPWG3TrackExtrapInterface::TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t vtx[3])
+{
+ /// Calculate the total momentum energy loss in-between the track position and the vertex assuming a linear propagation
+ AliMUONTrackParam trackParam;
+ trackParam.GetParamFromUncorrected(*muonTrack);
+ return AliMUONTrackExtrap::TotalMomentumEnergyLoss(&trackParam, vtx[0], vtx[1], vtx[2]);
+}
+
--- /dev/null
+#ifndef AliPWG3TRACKEXTRAPINTERFACE_H
+#define AliPWG3TRACKEXTRAPINTERFACE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/// \ingroup rec
+/// \class AliPWG3TrackExtrapInterface
+/// \brief Interface to MUON classes
+///
+//////////////////////////////////////////
+/// Interface for MUON track extrapolation
+//////////////////////////////////////////
+
+#include <TObject.h>
+
+class AliMagF;
+class AliESDMuonTrack;
+
+class AliPWG3TrackExtrapInterface : public TObject
+{
+ public:
+ /// Constructor
+ AliPWG3TrackExtrapInterface() : TObject(){};
+ /// Destructor
+ virtual ~AliPWG3TrackExtrapInterface(){};
+
+ static void SetMagField(const AliMagF* magField);
+ static Bool_t SetGeometry(const char* fileName = "geometry.root");
+
+ // extrapolation without any absorber correction
+ static void ExtrapToVertexUncorrected(AliESDMuonTrack* muonTrack, Double_t zVtx);
+ // extrapolation corrected for energy loss in absorber only
+ static void ExtrapToVertexWithELoss(AliESDMuonTrack* muonTrack, Double_t zVtx);
+ // extrapolation corrected for multiple scattering in absorber only
+ static void ExtrapToVertexWithBranson(AliESDMuonTrack* muonTrack, Double_t vtx[3]);
+ // extrapolation corrected for all absorber effect (multiple scattering and energy loss)
+ static void ExtrapToVertex(AliESDMuonTrack* muonTrack, Double_t vtx[3]);
+
+ static Double_t TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t zVtx);
+ static Double_t TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t vtx[3]);
+
+ private:
+ // Functions
+ AliPWG3TrackExtrapInterface(const AliPWG3TrackExtrapInterface& muonInterface);
+ AliPWG3TrackExtrapInterface& operator=(const AliPWG3TrackExtrapInterface& muonInterface);
+
+
+ ClassDef(AliPWG3TrackExtrapInterface, 0) // Tools for track extrapolation in ALICE dimuon spectrometer
+};
+
+#endif