Modified absorber correction. Added function FieldCorrection() to account
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackParam.cxx
CommitLineData
a9e2aefa 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$Log$
b45fd22b 18Revision 1.11 2002/03/08 17:25:36 cussonno
19Update absorber energy loss and Branson corrections : simplified functions
20BransonCorrection and TotalMomentumEnergyLoss.
21
43af2cb6 22Revision 1.10 2001/04/25 14:50:42 gosset
23Corrections to violations of coding conventions
24
3831f268 25Revision 1.9 2000/10/16 15:30:40 gosset
26TotalMomentumEnergyLoss:
27correction for change in the absorber composition (JP Cussonneau)
28
6372a28d 29Revision 1.8 2000/10/02 21:28:09 fca
30Removal of useless dependecies via forward declarations
31
94de3818 32Revision 1.7 2000/10/02 16:58:29 egangler
33Cleaning of the code :
34-> coding conventions
35-> void Streamers
36-> some useless includes removed or replaced by "class" statement
37
ecfa008b 38Revision 1.6 2000/09/19 09:49:50 gosset
39AliMUONEventReconstructor package
40* track extrapolation independent from reco_muon.F, use of AliMagF...
41* possibility to use new magnetic field (automatic from generated root file)
42
a6f03ddb 43Revision 1.5 2000/07/18 16:04:06 gosset
44AliMUONEventReconstructor package:
45* a few minor modifications and more comments
46* a few corrections
47 * right sign for Z of raw clusters
48 * right loop over chambers inside station
49 * symmetrized covariance matrix for measurements (TrackChi2MCS)
50 * right sign of charge in extrapolation (ExtrapToZ)
51 * right zEndAbsorber for Branson correction below 3 degrees
52* use of TVirtualFitter instead of TMinuit for AliMUONTrack::Fit
53* no parameter for AliMUONTrack::Fit() but more fit parameters in Track object
54
956019b6 55Revision 1.4 2000/07/03 07:53:31 morsch
56Double declaration problem on HP solved.
57
88962f0c 58Revision 1.3 2000/06/30 10:15:48 gosset
59Changes to EventReconstructor...:
60precision fit with multiple Coulomb scattering;
61extrapolation to vertex with Branson correction in absorber (JPC)
62
04b5ea16 63Revision 1.2 2000/06/15 07:58:49 morsch
64Code from MUON-dev joined
65
a9e2aefa 66Revision 1.1.2.3 2000/06/09 21:03:09 morsch
67Make includes consistent with new file structure.
68
69Revision 1.1.2.2 2000/06/09 12:58:05 gosset
70Removed comment beginnings in Log sections of .cxx files
71Suppressed most violations of coding rules
72
73Revision 1.1.2.1 2000/06/07 14:44:53 gosset
74Addition of files for track reconstruction in C++
75*/
76
3831f268 77///////////////////////////////////////////////////
78//
79// Track parameters
80// in
81// ALICE
82// dimuon
83// spectrometer
a9e2aefa 84//
3831f268 85///////////////////////////////////////////////////
a9e2aefa 86
87#include <iostream.h>
88
89#include "AliCallf77.h"
3831f268 90#include "AliMUON.h"
a9e2aefa 91#include "AliMUONTrackParam.h"
3831f268 92#include "AliMUONChamber.h"
a9e2aefa 93#include "AliRun.h"
94de3818 94#include "AliMagF.h"
a9e2aefa 95
96ClassImp(AliMUONTrackParam) // Class implementation in ROOT context
97
a6f03ddb 98 // A few calls in Fortran or from Fortran (extrap.F).
99 // Needed, instead of calls to Geant subroutines,
100 // because double precision is necessary for track fit converging with Minuit.
101 // The "extrap" functions should be translated into C++ ????
a9e2aefa 102#ifndef WIN32
a6f03ddb 103# define extrap_onestep_helix extrap_onestep_helix_
104# define extrap_onestep_helix3 extrap_onestep_helix3_
105# define extrap_onestep_rungekutta extrap_onestep_rungekutta_
106# define gufld_double gufld_double_
a9e2aefa 107#else
a6f03ddb 108# define extrap_onestep_helix EXTRAP_ONESTEP_HELIX
109# define extrap_onestep_helix3 EXTRAP_ONESTEP_HELIX3
110# define extrap_onestep_rungekutta EXTRAP_ONESTEP_RUNGEKUTTA
111# define gufld_double GUFLD_DOUBLE
a9e2aefa 112#endif
113
a6f03ddb 114extern "C" {
115 void type_of_call extrap_onestep_helix
116 (Double_t &Charge, Double_t &StepLength, Double_t *VGeant3, Double_t *VGeant3New);
117
118 void type_of_call extrap_onestep_helix3
119 (Double_t &Field, Double_t &StepLength, Double_t *VGeant3, Double_t *VGeant3New);
120
121 void type_of_call extrap_onestep_rungekutta
122 (Double_t &Charge, Double_t &StepLength, Double_t *VGeant3, Double_t *VGeant3New);
123
124 void type_of_call gufld_double(Double_t *Position, Double_t *Field) {
125 // interface to "gAlice->Field()->Field" for arguments in double precision
126 Float_t x[3], b[3];
127 x[0] = Position[0]; x[1] = Position[1]; x[2] = Position[2];
128 gAlice->Field()->Field(x, b);
129 Field[0] = b[0]; Field[1] = b[1]; Field[2] = b[2];
130 }
a9e2aefa 131}
132
a9e2aefa 133 //__________________________________________________________________________
134void AliMUONTrackParam::ExtrapToZ(Double_t Z)
135{
136 // Track parameter extrapolation to the plane at "Z".
137 // On return, the track parameters resulting from the extrapolation
138 // replace the current track parameters.
a9e2aefa 139 if (this->fZ == Z) return; // nothing to be done if same Z
140 Double_t forwardBackward; // +1 if forward, -1 if backward
141 if (Z > this->fZ) forwardBackward = 1.0;
142 else forwardBackward = -1.0;
a6f03ddb 143 Double_t vGeant3[7], vGeant3New[7]; // 7 in parameter ????
a9e2aefa 144 Int_t iGeant3, stepNumber;
145 Int_t maxStepNumber = 5000; // in parameter ????
146 // For safety: return kTRUE or kFALSE ????
a6f03ddb 147 // Parameter vector for calling EXTRAP_ONESTEP
a9e2aefa 148 SetGeant3Parameters(vGeant3, forwardBackward);
956019b6 149 // sign of charge (sign of fInverseBendingMomentum if forward motion)
a6f03ddb 150 // must be changed if backward extrapolation
956019b6 151 Double_t chargeExtrap = forwardBackward *
152 TMath::Sign(Double_t(1.0), this->fInverseBendingMomentum);
a9e2aefa 153 Double_t stepLength = 6.0; // in parameter ????
154 // Extrapolation loop
155 stepNumber = 0;
156 while (((forwardBackward * (vGeant3[2] - Z)) <= 0.0) &&
157 (stepNumber < maxStepNumber)) {
158 stepNumber++;
a6f03ddb 159 // Option for switching between helix and Runge-Kutta ????
160 // extrap_onestep_rungekutta(chargeExtrap, stepLength, vGeant3, vGeant3New);
161 extrap_onestep_helix(chargeExtrap, stepLength, vGeant3, vGeant3New);
a9e2aefa 162 if ((forwardBackward * (vGeant3New[2] - Z)) > 0.0) break; // one is beyond Z
163 // better use TArray ????
164 for (iGeant3 = 0; iGeant3 < 7; iGeant3++)
165 {vGeant3[iGeant3] = vGeant3New[iGeant3];}
166 }
167 // check maxStepNumber ????
a9e2aefa 168 // Interpolation back to exact Z (2nd order)
169 // should be in function ???? using TArray ????
170 Double_t dZ12 = vGeant3New[2] - vGeant3[2]; // 1->2
171 Double_t dZ1i = Z - vGeant3[2]; // 1-i
172 Double_t dZi2 = vGeant3New[2] - Z; // i->2
173 Double_t xPrime = (vGeant3New[0] - vGeant3[0]) / dZ12;
174 Double_t xSecond =
175 ((vGeant3New[3] / vGeant3New[5]) - (vGeant3[3] / vGeant3[5])) / dZ12;
176 Double_t yPrime = (vGeant3New[1] - vGeant3[1]) / dZ12;
177 Double_t ySecond =
178 ((vGeant3New[4] / vGeant3New[5]) - (vGeant3[4] / vGeant3[5])) / dZ12;
179 vGeant3[0] = vGeant3[0] + xPrime * dZ1i - 0.5 * xSecond * dZ1i * dZi2; // X
180 vGeant3[1] = vGeant3[1] + yPrime * dZ1i - 0.5 * ySecond * dZ1i * dZi2; // Y
181 vGeant3[2] = Z; // Z
182 Double_t xPrimeI = xPrime - 0.5 * xSecond * (dZi2 - dZ1i);
183 Double_t yPrimeI = yPrime - 0.5 * ySecond * (dZi2 - dZ1i);
956019b6 184 // (PX, PY, PZ)/PTOT assuming forward motion
a9e2aefa 185 vGeant3[5] =
186 1.0 / TMath::Sqrt(1.0 + xPrimeI * xPrimeI + yPrimeI * yPrimeI); // PZ/PTOT
187 vGeant3[3] = xPrimeI * vGeant3[5]; // PX/PTOT
188 vGeant3[4] = yPrimeI * vGeant3[5]; // PY/PTOT
956019b6 189 // Track parameters from Geant3 parameters,
190 // with charge back for forward motion
191 GetFromGeant3Parameters(vGeant3, chargeExtrap * forwardBackward);
a9e2aefa 192}
193
194 //__________________________________________________________________________
195void AliMUONTrackParam::SetGeant3Parameters(Double_t *VGeant3, Double_t ForwardBackward)
196{
197 // Set vector of Geant3 parameters pointed to by "VGeant3"
198 // from track parameters in current AliMUONTrackParam.
199 // Since AliMUONTrackParam is only geometry, one uses "ForwardBackward"
200 // to know whether the particle is going forward (+1) or backward (-1).
201 VGeant3[0] = this->fNonBendingCoor; // X
202 VGeant3[1] = this->fBendingCoor; // Y
203 VGeant3[2] = this->fZ; // Z
204 Double_t pYZ = TMath::Abs(1.0 / this->fInverseBendingMomentum);
205 Double_t pZ =
206 pYZ / TMath::Sqrt(1.0 + this->fBendingSlope * this->fBendingSlope);
207 VGeant3[6] =
208 TMath::Sqrt(pYZ * pYZ +
209 pZ * pZ * this->fNonBendingSlope * this->fNonBendingSlope); // PTOT
210 VGeant3[5] = ForwardBackward * pZ / VGeant3[6]; // PZ/PTOT
211 VGeant3[3] = this->fNonBendingSlope * VGeant3[5]; // PX/PTOT
212 VGeant3[4] = this->fBendingSlope * VGeant3[5]; // PY/PTOT
213}
214
215 //__________________________________________________________________________
216void AliMUONTrackParam::GetFromGeant3Parameters(Double_t *VGeant3, Double_t Charge)
217{
218 // Get track parameters in current AliMUONTrackParam
956019b6 219 // from Geant3 parameters pointed to by "VGeant3",
220 // assumed to be calculated for forward motion in Z.
a9e2aefa 221 // "InverseBendingMomentum" is signed with "Charge".
222 this->fNonBendingCoor = VGeant3[0]; // X
223 this->fBendingCoor = VGeant3[1]; // Y
224 this->fZ = VGeant3[2]; // Z
225 Double_t pYZ = VGeant3[6] * TMath::Sqrt(1.0 - VGeant3[3] * VGeant3[3]);
226 this->fInverseBendingMomentum = Charge / pYZ;
227 this->fBendingSlope = VGeant3[4] / VGeant3[5];
228 this->fNonBendingSlope = VGeant3[3] / VGeant3[5];
229}
230
231 //__________________________________________________________________________
232void AliMUONTrackParam::ExtrapToStation(Int_t Station, AliMUONTrackParam *TrackParam)
233{
234 // Track parameters extrapolated from current track parameters ("this")
235 // to both chambers of the station(0..) "Station"
236 // are returned in the array (dimension 2) of track parameters
237 // pointed to by "TrackParam" (index 0 and 1 for first and second chambers).
238 Double_t extZ[2], z1, z2;
ecfa008b 239 Int_t i1 = -1, i2 = -1; // = -1 to avoid compilation warnings
a9e2aefa 240 AliMUON *pMUON = (AliMUON*) gAlice->GetModule("MUON"); // necessary ????
241 // range of Station to be checked ????
242 z1 = (&(pMUON->Chamber(2 * Station)))->Z(); // Z of first chamber
243 z2 = (&(pMUON->Chamber(2 * Station + 1)))->Z(); // Z of second chamber
244 // First and second Z to extrapolate at
245 if ((z1 > this->fZ) && (z2 > this->fZ)) {i1 = 0; i2 = 1;}
246 else if ((z1 < this->fZ) && (z2 < this->fZ)) {i1 = 1; i2 = 0;}
247 else {
248 cout << "ERROR in AliMUONTrackParam::CreateExtrapSegmentInStation" << endl;
249 cout << "Starting Z (" << this->fZ << ") in between z1 (" << z1 <<
250 ") and z2 (" << z2 << ") of station(0..) " << Station << endl;
251 }
252 extZ[i1] = z1;
253 extZ[i2] = z2;
254 // copy of track parameters
255 TrackParam[i1] = *this;
256 // first extrapolation
257 (&(TrackParam[i1]))->ExtrapToZ(extZ[0]);
258 TrackParam[i2] = TrackParam[i1];
259 // second extrapolation
260 (&(TrackParam[i2]))->ExtrapToZ(extZ[1]);
261 return;
262}
263
04b5ea16 264 //__________________________________________________________________________
265void AliMUONTrackParam::ExtrapToVertex()
266{
267 // Extrapolation to the vertex.
268 // Returns the track parameters resulting from the extrapolation,
269 // in the current TrackParam.
956019b6 270 // Changes parameters according to Branson correction through the absorber
04b5ea16 271
272 Double_t zAbsorber = 503.0; // to be coherent with the Geant absorber geometry !!!!
273 // Extrapolates track parameters upstream to the "Z" end of the front absorber
b45fd22b 274 ExtrapToZ(zAbsorber); // !!!
04b5ea16 275 // Makes Branson correction (multiple scattering + energy loss)
276 BransonCorrection();
b45fd22b 277 // Makes a simple magnetic field correction through the absorber
278 FieldCorrection(zAbsorber);
04b5ea16 279}
280
43af2cb6 281
282// Keep this version for future developments
04b5ea16 283 //__________________________________________________________________________
43af2cb6 284// void AliMUONTrackParam::BransonCorrection()
285// {
286// // Branson correction of track parameters
287// // the entry parameters have to be calculated at the end of the absorber
288// Double_t zEndAbsorber, zBP, xBP, yBP;
289// Double_t pYZ, pX, pY, pZ, pTotal, xEndAbsorber, yEndAbsorber, radiusEndAbsorber2, pT, theta;
290// Int_t sign;
291// // Would it be possible to calculate all that from Geant configuration ????
292// // and to get the Branson parameters from a function in ABSO module ????
293// // with an eventual contribution from other detectors like START ????
294// // Radiation lengths outer part theta > 3 degres
295// static Double_t x01[9] = { 18.8, // C (cm)
296// 10.397, // Concrete (cm)
297// 0.56, // Plomb (cm)
298// 47.26, // Polyethylene (cm)
299// 0.56, // Plomb (cm)
300// 47.26, // Polyethylene (cm)
301// 0.56, // Plomb (cm)
302// 47.26, // Polyethylene (cm)
303// 0.56 }; // Plomb (cm)
304// // inner part theta < 3 degres
305// static Double_t x02[3] = { 18.8, // C (cm)
306// 10.397, // Concrete (cm)
307// 0.35 }; // W (cm)
308// // z positions of the materials inside the absober outer part theta > 3 degres
309// static Double_t z1[10] = { 90, 315, 467, 472, 477, 482, 487, 492, 497, 502 };
310// // inner part theta < 3 degres
311// static Double_t z2[4] = { 90, 315, 467, 503 };
312// static Bool_t first = kTRUE;
313// static Double_t zBP1, zBP2, rLimit;
314// // Calculates z positions of the Branson's planes: zBP1 for outer part and zBP2 for inner part (only at the first call)
315// if (first) {
316// first = kFALSE;
317// Double_t aNBP = 0.0;
318// Double_t aDBP = 0.0;
319// Int_t iBound;
320
321// for (iBound = 0; iBound < 9; iBound++) {
322// aNBP = aNBP +
323// (z1[iBound+1] * z1[iBound+1] * z1[iBound+1] -
324// z1[iBound] * z1[iBound] * z1[iBound] ) / x01[iBound];
325// aDBP = aDBP +
326// (z1[iBound+1] * z1[iBound+1] - z1[iBound] * z1[iBound] ) / x01[iBound];
327// }
328// zBP1 = (2.0 * aNBP) / (3.0 * aDBP);
329// aNBP = 0.0;
330// aDBP = 0.0;
331// for (iBound = 0; iBound < 3; iBound++) {
332// aNBP = aNBP +
333// (z2[iBound+1] * z2[iBound+1] * z2[iBound+1] -
334// z2[iBound] * z2[iBound ] * z2[iBound] ) / x02[iBound];
335// aDBP = aDBP +
336// (z2[iBound+1] * z2[iBound+1] - z2[iBound] * z2[iBound]) / x02[iBound];
337// }
338// zBP2 = (2.0 * aNBP) / (3.0 * aDBP);
339// rLimit = z2[3] * TMath::Tan(3.0 * (TMath::Pi()) / 180.);
340// }
341
342// pYZ = TMath::Abs(1.0 / fInverseBendingMomentum);
343// sign = 1;
344// if (fInverseBendingMomentum < 0) sign = -1;
345// pZ = pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope));
346// pX = pZ * fNonBendingSlope;
347// pY = pZ * fBendingSlope;
348// pTotal = TMath::Sqrt(pYZ *pYZ + pX * pX);
349// xEndAbsorber = fNonBendingCoor;
350// yEndAbsorber = fBendingCoor;
351// radiusEndAbsorber2 = xEndAbsorber * xEndAbsorber + yEndAbsorber * yEndAbsorber;
352
353// if (radiusEndAbsorber2 > rLimit*rLimit) {
354// zEndAbsorber = z1[9];
355// zBP = zBP1;
356// } else {
357// zEndAbsorber = z2[3];
358// zBP = zBP2;
359// }
360
361// xBP = xEndAbsorber - (pX / pZ) * (zEndAbsorber - zBP);
362// yBP = yEndAbsorber - (pY / pZ) * (zEndAbsorber - zBP);
363
364// // new parameters after Branson and energy loss corrections
365// pZ = pTotal * zBP / TMath::Sqrt(xBP * xBP + yBP * yBP + zBP * zBP);
366// pX = pZ * xBP / zBP;
367// pY = pZ * yBP / zBP;
368// fBendingSlope = pY / pZ;
369// fNonBendingSlope = pX / pZ;
370
371// pT = TMath::Sqrt(pX * pX + pY * pY);
372// theta = TMath::ATan2(pT, pZ);
373// pTotal =
374// TotalMomentumEnergyLoss(rLimit, pTotal, theta, xEndAbsorber, yEndAbsorber);
375
376// fInverseBendingMomentum = (sign / pTotal) *
377// TMath::Sqrt(1.0 +
378// fBendingSlope * fBendingSlope +
379// fNonBendingSlope * fNonBendingSlope) /
380// TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope);
381
382// // vertex position at (0,0,0)
383// // should be taken from vertex measurement ???
384// fBendingCoor = 0.0;
385// fNonBendingCoor = 0;
386// fZ= 0;
387// }
388
04b5ea16 389void AliMUONTrackParam::BransonCorrection()
390{
391 // Branson correction of track parameters
392 // the entry parameters have to be calculated at the end of the absorber
43af2cb6 393 // simplified version: the z positions of Branson's planes are no longer calculated
394 // but are given as inputs. One can use the macros MUONTestAbso.C and DrawTestAbso.C
395 // to test this correction.
04b5ea16 396 // Would it be possible to calculate all that from Geant configuration ????
956019b6 397 // and to get the Branson parameters from a function in ABSO module ????
398 // with an eventual contribution from other detectors like START ????
43af2cb6 399 Double_t zBP, xBP, yBP;
400 Double_t pYZ, pX, pY, pZ, pTotal, xEndAbsorber, yEndAbsorber, radiusEndAbsorber2, pT, theta;
401 Int_t sign;
04b5ea16 402 static Bool_t first = kTRUE;
b45fd22b 403 static Double_t zBP1, zBP2, rLimit, thetaLimit, zEndAbsorber;
43af2cb6 404 // zBP1 for outer part and zBP2 for inner part (only at the first call)
04b5ea16 405 if (first) {
406 first = kFALSE;
43af2cb6 407
408 zEndAbsorber = 503;
b45fd22b 409 thetaLimit = 3.0 * (TMath::Pi()) / 180.;
410 rLimit = zEndAbsorber * TMath::Tan(thetaLimit);
411 zBP1 = 450; // values close to those calculated with EvalAbso.C
43af2cb6 412 zBP2 = 480;
04b5ea16 413 }
414
415 pYZ = TMath::Abs(1.0 / fInverseBendingMomentum);
416 sign = 1;
417 if (fInverseBendingMomentum < 0) sign = -1;
418 pZ = pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope));
419 pX = pZ * fNonBendingSlope;
420 pY = pZ * fBendingSlope;
421 pTotal = TMath::Sqrt(pYZ *pYZ + pX * pX);
422 xEndAbsorber = fNonBendingCoor;
423 yEndAbsorber = fBendingCoor;
424 radiusEndAbsorber2 = xEndAbsorber * xEndAbsorber + yEndAbsorber * yEndAbsorber;
425
426 if (radiusEndAbsorber2 > rLimit*rLimit) {
04b5ea16 427 zBP = zBP1;
428 } else {
04b5ea16 429 zBP = zBP2;
430 }
431
432 xBP = xEndAbsorber - (pX / pZ) * (zEndAbsorber - zBP);
433 yBP = yEndAbsorber - (pY / pZ) * (zEndAbsorber - zBP);
434
435 // new parameters after Branson and energy loss corrections
b45fd22b 436// Float_t zSmear = zBP - gRandom->Gaus(0.,2.); // !!! possible smearing of Z vertex position
437 Float_t zSmear = zBP;
438
439 pZ = pTotal * zSmear / TMath::Sqrt(xBP * xBP + yBP * yBP + zSmear * zSmear);
440 pX = pZ * xBP / zSmear;
441 pY = pZ * yBP / zSmear;
04b5ea16 442 fBendingSlope = pY / pZ;
443 fNonBendingSlope = pX / pZ;
444
445 pT = TMath::Sqrt(pX * pX + pY * pY);
446 theta = TMath::ATan2(pT, pZ);
b45fd22b 447 pTotal = TotalMomentumEnergyLoss(thetaLimit, pTotal, theta);
04b5ea16 448
449 fInverseBendingMomentum = (sign / pTotal) *
450 TMath::Sqrt(1.0 +
451 fBendingSlope * fBendingSlope +
452 fNonBendingSlope * fNonBendingSlope) /
453 TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope);
454
455 // vertex position at (0,0,0)
456 // should be taken from vertex measurement ???
457 fBendingCoor = 0.0;
458 fNonBendingCoor = 0;
459 fZ= 0;
460}
b45fd22b 461
04b5ea16 462 //__________________________________________________________________________
b45fd22b 463Double_t AliMUONTrackParam::TotalMomentumEnergyLoss(Double_t thetaLimit, Double_t pTotal, Double_t theta)
04b5ea16 464{
465 // Returns the total momentum corrected from energy loss in the front absorber
43af2cb6 466 // One can use the macros MUONTestAbso.C and DrawTestAbso.C
467 // to test this correction.
b45fd22b 468 // Momentum energy loss behaviour evaluated with the simulation of single muons (april 2002)
04b5ea16 469 Double_t deltaP, pTotalCorrected;
470
b45fd22b 471 // Parametrization to be redone according to change of absorber material ????
956019b6 472 // See remark in function BransonCorrection !!!!
04b5ea16 473 // The name is not so good, and there are many arguments !!!!
b45fd22b 474 if (theta < thetaLimit ) {
475 if (pTotal < 20) {
476 deltaP = 2.5938 + 0.0570 * pTotal - 0.001151 * pTotal * pTotal;
04b5ea16 477 } else {
b45fd22b 478 deltaP = 3.0714 + 0.011767 *pTotal;
04b5ea16 479 }
480 } else {
b45fd22b 481 if (pTotal < 20) {
482 deltaP = 2.1207 + 0.05478 * pTotal - 0.00145079 * pTotal * pTotal;
04b5ea16 483 } else {
b45fd22b 484 deltaP = 2.6069 + 0.0051705 * pTotal;
04b5ea16 485 }
486 }
487 pTotalCorrected = pTotal + deltaP / TMath::Cos(theta);
488 return pTotalCorrected;
489}
490
b45fd22b 491 //__________________________________________________________________________
492void AliMUONTrackParam::FieldCorrection(Double_t Z)
493{
494 //
495 // Correction of the effect of the magnetic field in the absorber
496 // Assume a constant field along Z axis.
497
498 Float_t b[3],x[3];
499 Double_t bZ;
500 Double_t pYZ,pX,pY,pZ,pT;
501 Double_t pXNew,pYNew;
502 Double_t c;
503
504 pYZ = TMath::Abs(1.0 / fInverseBendingMomentum);
505 c = TMath::Sign(1.0,fInverseBendingMomentum); // particle charge
506
507 pZ = pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope));
508 pX = pZ * fNonBendingSlope;
509 pY = pZ * fBendingSlope;
510 pT = TMath::Sqrt(pX*pX+pY*pY);
511
512 if (pZ <= 0) return;
513 x[2] = Z/2;
514 x[0] = x[2]*fNonBendingSlope;
515 x[1] = x[2]*fBendingSlope;
516
517 // Take magn. field value at position x.
518 gAlice->Field()->Field(x, b);
519 bZ = b[2];
520
521 // Transverse momentum rotation
522 // Parameterized with the study of DeltaPhi = phiReco - phiGen as a function of pZ.
523 Double_t phiShift = c*0.436*0.0003*bZ*Z/pZ;
524
525 // Rotate momentum around Z axis.
526 pXNew = pX*TMath::Cos(phiShift) - pY*TMath::Sin(phiShift);
527 pYNew = pX*TMath::Sin(phiShift) + pY*TMath::Cos(phiShift);
528
529 fBendingSlope = pYNew / pZ;
530 fNonBendingSlope = pXNew / pZ;
531
532 fInverseBendingMomentum = c / TMath::Sqrt(pYNew*pYNew+pZ*pZ);
533
534}