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