]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muon/AliPWG3TrackExtrapInterface.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWG / muon / AliPWG3TrackExtrapInterface.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 ///////////////////////////////////////////////////
19 //
20 // Interface
21 // for
22 // MUON
23 // track
24 // extrapolation
25 //
26 ///////////////////////////////////////////////////
27
28 #include "AliPWG3TrackExtrapInterface.h"
29 #include "AliMUONTrackExtrap.h"
30 #include "AliESDMuonTrack.h"
31 #include "AliMUONTrackParam.h"
32 #include "AliMagF.h" 
33
34 #include <Riostream.h>
35 #include <TGeoManager.h>
36
37 /// \cond CLASSIMP
38 ClassImp(AliPWG3TrackExtrapInterface) // Class implementation in ROOT context
39 /// \endcond
40
41   //__________________________________________________________________________
42 void AliPWG3TrackExtrapInterface::SetMagField(const AliMagF* magField)
43 {
44   /// Set the magnetic field (required for track extrapolation)
45   
46   AliMUONTrackExtrap::SetField(magField);
47   
48 }
49
50   //__________________________________________________________________________
51 Bool_t AliPWG3TrackExtrapInterface::SetGeometry(const char* fileName)
52 {
53   /// Set the geometry (required for absorber correction)
54   
55   if (!gGeoManager) {
56     TGeoManager::Import(fileName);
57     if (!gGeoManager) {
58       cout<<"E-AliPWG3TrackExtrapInterface::ImportGeo: getting geometry from file "<<fileName<<" failed"<<endl;
59       return kFALSE;
60     }
61   }
62   return kTRUE;
63   
64 }
65
66   //__________________________________________________________________________
67 void AliPWG3TrackExtrapInterface::ExtrapToVertexUncorrected(AliESDMuonTrack* muonTrack, Double_t zVtx)
68 {
69   /// Extrapolation to the vertex (at the z position "zVtx") without Branson and energy loss corrections.
70   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
71   
72   AliMUONTrackParam trackParam;
73   trackParam.GetParamFromUncorrected(*muonTrack);
74   // dummy vertex transverse position (not used anyway)
75   Double_t xVtx = 0.;
76   Double_t yVtx = 0.;
77   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, xVtx, yVtx, zVtx, kFALSE, kFALSE);
78   trackParam.SetParamFor(*muonTrack);
79   
80 }
81
82   //__________________________________________________________________________
83 void AliPWG3TrackExtrapInterface::ExtrapToVertexWithELoss(AliESDMuonTrack* muonTrack, Double_t zVtx)
84 {
85   /// Extrapolation to the vertex (at the z position "zVtx") with energy loss correction only.
86   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
87   
88   AliMUONTrackParam trackParam;
89   trackParam.GetParamFromUncorrected(*muonTrack);
90   // compute energy loss correction assuming linear propagation
91   Double_t xVtx = trackParam.GetNonBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetNonBendingSlope();
92   Double_t yVtx = trackParam.GetBendingCoor()    + (zVtx - trackParam.GetZ()) * trackParam.GetBendingSlope();
93   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, xVtx, yVtx, zVtx, kFALSE, kTRUE);
94   trackParam.SetParamFor(*muonTrack);
95   
96 }
97
98   //__________________________________________________________________________
99 void AliPWG3TrackExtrapInterface::ExtrapToVertexWithBranson(AliESDMuonTrack* muonTrack, Double_t vtx[3])
100 {
101   /// Extrapolation to the vertex (at the z position "zVtx") with Branson correction only.
102   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
103   
104   AliMUONTrackParam trackParam;
105   trackParam.GetParamFromUncorrected(*muonTrack);
106   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, vtx[0], vtx[1], vtx[2], kTRUE, kFALSE);
107   trackParam.SetParamFor(*muonTrack);
108   
109 }
110
111   //__________________________________________________________________________
112 void AliPWG3TrackExtrapInterface::ExtrapToVertex(AliESDMuonTrack* muonTrack, Double_t vtx[3])
113 {
114   /// Extrapolation to the vertex (at the z position "zVtx") with Branson and energy loss corrections.
115   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
116   
117   AliMUONTrackParam trackParam;
118   trackParam.GetParamFromUncorrected(*muonTrack);
119   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, vtx[0], vtx[1], vtx[2], kTRUE, kTRUE);
120   trackParam.SetParamFor(*muonTrack);
121   
122 }
123
124   //__________________________________________________________________________
125 Double_t AliPWG3TrackExtrapInterface::TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t zVtx)
126 {
127   /// Calculate the total momentum energy loss in-between the track position and the vertex assuming a linear propagation
128   AliMUONTrackParam trackParam;
129   trackParam.GetParamFromUncorrected(*muonTrack);
130   Double_t xVtx = trackParam.GetNonBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetNonBendingSlope();
131   Double_t yVtx = trackParam.GetBendingCoor()    + (zVtx - trackParam.GetZ()) * trackParam.GetBendingSlope();
132   return AliMUONTrackExtrap::TotalMomentumEnergyLoss(&trackParam, xVtx, yVtx, zVtx);
133 }
134
135   //__________________________________________________________________________
136 Double_t AliPWG3TrackExtrapInterface::TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t vtx[3])
137 {
138   /// Calculate the total momentum energy loss in-between the track position and the vertex assuming a linear propagation
139   AliMUONTrackParam trackParam;
140   trackParam.GetParamFromUncorrected(*muonTrack);
141   return AliMUONTrackExtrap::TotalMomentumEnergyLoss(&trackParam, vtx[0], vtx[1], vtx[2]);
142 }
143