]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/muon/AliPWG3TrackExtrapInterface.cxx
bugfix #38673 (Kenneth): last pad per row was always ignored; corrected cleanup og...
[u/mrichter/AliRoot.git] / PWG3 / 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
17 ///////////////////////////////////////////////////
18 //
19 // Interface
20 // for
21 // MUON
22 // track
23 // extrapolation
24 //
25 ///////////////////////////////////////////////////
26
27 #include "AliPWG3TrackExtrapInterface.h"
28 #include "AliMUONTrackExtrap.h"
29 #include "AliESDMuonTrack.h"
30 #include "AliMUONTrackParam.h"
31 #include "AliMagF.h" 
32
33 #include <Riostream.h>
34 #include <TGeoManager.h>
35
36 /// \cond CLASSIMP
37 ClassImp(AliPWG3TrackExtrapInterface) // Class implementation in ROOT context
38 /// \endcond
39
40   //__________________________________________________________________________
41 void AliPWG3TrackExtrapInterface::SetMagField(const AliMagF* magField)
42 {
43   /// Set the magnetic field (required for track extrapolation)
44   
45   AliMUONTrackExtrap::SetField(magField);
46   
47 }
48
49   //__________________________________________________________________________
50 Bool_t AliPWG3TrackExtrapInterface::SetGeometry(const char* fileName)
51 {
52   /// Set the geometry (required for absorber correction)
53   
54   if (!gGeoManager) {
55     TGeoManager::Import(fileName);
56     if (!gGeoManager) {
57       cout<<"E-AliPWG3TrackExtrapInterface::ImportGeo: getting geometry from file "<<fileName<<" failed"<<endl;
58       return kFALSE;
59     }
60   }
61   return kTRUE;
62   
63 }
64
65   //__________________________________________________________________________
66 void AliPWG3TrackExtrapInterface::ExtrapToVertexUncorrected(AliESDMuonTrack* muonTrack, Double_t zVtx)
67 {
68   /// Extrapolation to the vertex (at the z position "zVtx") without Branson and energy loss corrections.
69   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
70   
71   AliMUONTrackParam trackParam;
72   trackParam.GetParamFromUncorrected(*muonTrack);
73   // dummy vertex transverse position (not used anyway)
74   Double_t xVtx = 0.;
75   Double_t yVtx = 0.;
76   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, xVtx, yVtx, zVtx, kFALSE, kFALSE);
77   trackParam.SetParamFor(*muonTrack);
78   
79 }
80
81   //__________________________________________________________________________
82 void AliPWG3TrackExtrapInterface::ExtrapToVertexWithELoss(AliESDMuonTrack* muonTrack, Double_t zVtx)
83 {
84   /// Extrapolation to the vertex (at the z position "zVtx") with energy loss correction only.
85   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
86   
87   AliMUONTrackParam trackParam;
88   trackParam.GetParamFromUncorrected(*muonTrack);
89   // compute energy loss correction assuming linear propagation
90   Double_t xVtx = trackParam.GetNonBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetNonBendingSlope();
91   Double_t yVtx = trackParam.GetBendingCoor()    + (zVtx - trackParam.GetZ()) * trackParam.GetBendingSlope();
92   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, xVtx, yVtx, zVtx, kFALSE, kTRUE);
93   trackParam.SetParamFor(*muonTrack);
94   
95 }
96
97   //__________________________________________________________________________
98 void AliPWG3TrackExtrapInterface::ExtrapToVertexWithBranson(AliESDMuonTrack* muonTrack, Double_t vtx[3])
99 {
100   /// Extrapolation to the vertex (at the z position "zVtx") with Branson correction only.
101   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
102   
103   AliMUONTrackParam trackParam;
104   trackParam.GetParamFromUncorrected(*muonTrack);
105   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, vtx[0], vtx[1], vtx[2], kTRUE, kFALSE);
106   trackParam.SetParamFor(*muonTrack);
107   
108 }
109
110   //__________________________________________________________________________
111 void AliPWG3TrackExtrapInterface::ExtrapToVertex(AliESDMuonTrack* muonTrack, Double_t vtx[3])
112 {
113   /// Extrapolation to the vertex (at the z position "zVtx") with Branson and energy loss corrections.
114   /// Returns the extrapolated track parameters in the current ESDMuonTrack.
115   
116   AliMUONTrackParam trackParam;
117   trackParam.GetParamFromUncorrected(*muonTrack);
118   AliMUONTrackExtrap::ExtrapToVertex(&trackParam, vtx[0], vtx[1], vtx[2], kTRUE, kTRUE);
119   trackParam.SetParamFor(*muonTrack);
120   
121 }
122
123   //__________________________________________________________________________
124 Double_t AliPWG3TrackExtrapInterface::TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t zVtx)
125 {
126   /// Calculate the total momentum energy loss in-between the track position and the vertex assuming a linear propagation
127   AliMUONTrackParam trackParam;
128   trackParam.GetParamFromUncorrected(*muonTrack);
129   Double_t xVtx = trackParam.GetNonBendingCoor() + (zVtx - trackParam.GetZ()) * trackParam.GetNonBendingSlope();
130   Double_t yVtx = trackParam.GetBendingCoor()    + (zVtx - trackParam.GetZ()) * trackParam.GetBendingSlope();
131   return AliMUONTrackExtrap::TotalMomentumEnergyLoss(&trackParam, xVtx, yVtx, zVtx);
132 }
133
134   //__________________________________________________________________________
135 Double_t AliPWG3TrackExtrapInterface::TotalMomentumEnergyLoss(AliESDMuonTrack* muonTrack, Double_t vtx[3])
136 {
137   /// Calculate the total momentum energy loss in-between the track position and the vertex assuming a linear propagation
138   AliMUONTrackParam trackParam;
139   trackParam.GetParamFromUncorrected(*muonTrack);
140   return AliMUONTrackExtrap::TotalMomentumEnergyLoss(&trackParam, vtx[0], vtx[1], vtx[2]);
141 }
142