]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
fafff680 | 2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel & Bogdan Vulpescu: 2006, 2007 |
e19f3684 | 3 | |
d810d0de | 4 | /************************************************************************** |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
16718cdc | 9 | |
d810d0de | 10 | #include "AliEveMUONTrack.h" |
11 | ||
707b281a | 12 | #include <EveBase/AliEveEventManager.h> |
eadce74d | 13 | |
e19f3684 | 14 | #include <AliMagF.h> |
eadce74d | 15 | #include <AliMagFMaps.h> |
e19f3684 | 16 | #include <AliLog.h> |
eadce74d | 17 | #include <AliESDMuonTrack.h> |
18 | #include <AliTrackReference.h> | |
af885e0f | 19 | #include <AliESDEvent.h> |
82e1eece | 20 | #include <AliESDVertex.h> |
eadce74d | 21 | #include <AliRunLoader.h> |
22 | #include <AliRun.h> | |
e19f3684 | 23 | |
24 | #include <AliMUONTrack.h> | |
eadce74d | 25 | #include <AliMUONTriggerTrack.h> |
e19f3684 | 26 | #include <AliMUONTrackParam.h> |
27 | #include <AliMUONConstants.h> | |
28 | ||
29 | #include <TClonesArray.h> | |
30 | #include <TMath.h> | |
31 | #include <TMatrixD.h> | |
32 | #include <TStyle.h> | |
f7e76528 | 33 | #include <TROOT.h> |
eadce74d | 34 | #include <TParticle.h> |
35 | #include <TParticlePDG.h> | |
36 | ||
37 | #include <Riostream.h> | |
d810d0de | 38 | |
e19f3684 | 39 | |
57ffa5fb | 40 | //______________________________________________________________________________ |
d810d0de | 41 | // AliEveMUONTrack |
84aff7a4 | 42 | // Produce TEveUtil:TEveTrack from AliMUONTrack with dipole field model |
e19f3684 | 43 | |
d810d0de | 44 | ClassImp(AliEveMUONTrack) |
e19f3684 | 45 | |
d810d0de | 46 | AliMagF* AliEveMUONTrack::fFieldMap = 0; |
eadce74d | 47 | |
57ffa5fb | 48 | //______________________________________________________________________________ |
d810d0de | 49 | AliEveMUONTrack::AliEveMUONTrack(TEveRecTrack* t, TEveTrackPropagator* rs) : |
84aff7a4 | 50 | TEveTrack(t,rs), |
e19f3684 | 51 | fTrack(0), |
eadce74d | 52 | fPart(0), |
53 | fCount(0), | |
54 | fIsMUONTrack(kFALSE), | |
55 | fIsMUONTriggerTrack(kFALSE), | |
56 | fIsESDTrack(kFALSE), | |
57 | fIsMCTrack(kFALSE), | |
58 | fIsRefTrack(kFALSE) | |
e19f3684 | 59 | { |
60 | // | |
61 | // constructor | |
62 | // | |
63 | ||
d810d0de | 64 | fFieldMap = AliEveEventManager::AssertMagField(); |
eadce74d | 65 | |
e19f3684 | 66 | } |
67 | ||
57ffa5fb | 68 | //______________________________________________________________________________ |
d810d0de | 69 | AliEveMUONTrack::~AliEveMUONTrack() |
e19f3684 | 70 | { |
71 | // | |
72 | // destructor | |
73 | // | |
74 | ||
eadce74d | 75 | if (fIsRefTrack || fIsESDTrack) delete fTrack; |
76 | if (fIsMCTrack) delete fPart; | |
77 | ||
78 | } | |
79 | ||
57ffa5fb | 80 | //______________________________________________________________________________ |
d810d0de | 81 | void AliEveMUONTrack::PrintMCTrackInfo() |
eadce74d | 82 | { |
83 | // | |
84 | // information about the MC particle | |
85 | // | |
86 | ||
87 | Float_t pt, p; | |
88 | ||
89 | if (!fPart) { | |
90 | cout << " ! no particle ..." << endl; | |
91 | return; | |
92 | } | |
93 | ||
94 | cout << endl; | |
95 | cout << " MC track parameters at vertex" << endl; | |
96 | cout << " -------------------------------------------------------------------------------------" << endl; | |
97 | cout << " PDG code Vx Vy Vz Px Py Pz " << endl; | |
51346b82 | 98 | |
eadce74d | 99 | cout << " " << |
51346b82 | 100 | setw(8) << setprecision(0) << |
101 | fPart->GetPdgCode() << " " << | |
102 | setw(8) << setprecision(3) << | |
103 | fPart->Vx() << " " << | |
104 | setw(8) << setprecision(3) << | |
105 | fPart->Vy() << " " << | |
106 | setw(8) << setprecision(3) << | |
107 | fPart->Vz() << " " << | |
108 | setw(8) << setprecision(3) << | |
109 | fPart->Px() << " " << | |
110 | setw(8) << setprecision(3) << | |
111 | fPart->Py() << " " << | |
112 | setw(8) << setprecision(4) << | |
113 | fPart->Pz() << " " << | |
114 | ||
eadce74d | 115 | endl; |
51346b82 | 116 | |
eadce74d | 117 | pt = TMath::Sqrt(fPart->Px()*fPart->Px()+fPart->Py()*fPart->Py()); |
118 | p = TMath::Sqrt(fPart->Px()*fPart->Px()+fPart->Py()*fPart->Py()+fPart->Pz()*fPart->Pz()); | |
51346b82 | 119 | |
eadce74d | 120 | cout << endl; |
51346b82 | 121 | cout << " Pt = " << |
eadce74d | 122 | setw(8) << setprecision(3) << |
123 | pt << " GeV/c" << endl; | |
51346b82 | 124 | |
125 | cout << " P = " << | |
eadce74d | 126 | setw(8) << setprecision(4) << |
127 | p << " GeV/c" << endl; | |
51346b82 | 128 | |
eadce74d | 129 | } |
130 | ||
57ffa5fb | 131 | //______________________________________________________________________________ |
d810d0de | 132 | void AliEveMUONTrack::PrintMUONTrackInfo() |
eadce74d | 133 | { |
134 | // | |
135 | // information about the reconstructed/reference track; at hits and at vertex | |
136 | // | |
137 | ||
138 | Double_t RADDEG = 180.0/TMath::Pi(); | |
139 | ||
140 | Int_t nparam; | |
141 | Float_t pt, bc, nbc, zc; | |
142 | AliMUONTrackParam *mtp; | |
db9c5465 | 143 | TClonesArray *trackParamAtCluster; |
eadce74d | 144 | |
145 | if (!fTrack) { | |
146 | cout << " ! no reconstructed track ..." << endl; | |
147 | return; | |
148 | } | |
149 | ||
150 | if (fIsMUONTrack) { | |
151 | cout << endl; | |
84aff7a4 | 152 | cout << " TEveTrack number " << fLabel << endl; |
eadce74d | 153 | cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl; |
154 | cout << endl; | |
db9c5465 | 155 | cout << " Number of clusters " << fTrack->GetNClusters() << endl; |
eadce74d | 156 | cout << " Match to trigger " << fTrack->GetMatchTrigger() << endl; |
157 | if (fTrack->GetMatchTrigger()) { | |
158 | cout << " Chi2 tracking-trigger " << fTrack->GetChi2MatchTrigger() << endl; | |
159 | cout << " Local trigger number " << fTrack->GetLoTrgNum() << endl; | |
160 | } | |
161 | } | |
162 | ||
163 | if (fIsRefTrack) { | |
164 | cout << endl; | |
84aff7a4 | 165 | cout << " TEveTrack reference number " << fLabel << endl; |
eadce74d | 166 | cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl; |
167 | cout << endl; | |
db9c5465 | 168 | cout << " Number of clusters " << fTrack->GetNClusters() << endl; |
eadce74d | 169 | } |
51346b82 | 170 | |
db9c5465 | 171 | trackParamAtCluster = fTrack->GetTrackParamAtCluster(); |
172 | nparam = trackParamAtCluster->GetEntries(); | |
eadce74d | 173 | |
174 | cout << endl; | |
db9c5465 | 175 | cout << " trackParamAtCluster entries " << nparam << "" << endl; |
eadce74d | 176 | cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl; |
177 | cout << " Number InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz P" << endl; | |
178 | ||
179 | for (Int_t i = 0; i < nparam; i++) { | |
180 | ||
db9c5465 | 181 | mtp = (AliMUONTrackParam*)trackParamAtCluster->At(i); |
eadce74d | 182 | |
51346b82 | 183 | cout << |
184 | setw(9)<< setprecision(3) << | |
185 | i << " " << | |
eadce74d | 186 | |
51346b82 | 187 | setw(8) << setprecision(3) << |
188 | mtp->GetInverseBendingMomentum() << " " << | |
eadce74d | 189 | |
190 | setw(8) << setprecision(3) << | |
51346b82 | 191 | mtp->GetBendingSlope()*RADDEG << " " << |
eadce74d | 192 | |
193 | setw(8) << setprecision(3) << | |
51346b82 | 194 | mtp->GetNonBendingSlope()*RADDEG << " " << |
eadce74d | 195 | |
196 | setw(8) << setprecision(4) << | |
51346b82 | 197 | mtp->GetBendingCoor() << " " << |
eadce74d | 198 | |
199 | setw(8) << setprecision(4) << | |
51346b82 | 200 | mtp->GetNonBendingCoor() << " " << |
eadce74d | 201 | |
202 | setw(10) << setprecision(6) << | |
51346b82 | 203 | mtp->GetZ() << " " << |
eadce74d | 204 | |
205 | setw(8) << setprecision(4) << | |
51346b82 | 206 | mtp->Px() << " " << |
eadce74d | 207 | |
208 | setw(8) << setprecision(4) << | |
51346b82 | 209 | mtp->Py() << " " << |
eadce74d | 210 | |
211 | setw(8) << setprecision(4) << | |
51346b82 | 212 | mtp->Pz() << " " << |
eadce74d | 213 | |
214 | setw(8) << setprecision(4) << | |
51346b82 | 215 | mtp->P() << " " << |
eadce74d | 216 | |
217 | endl; | |
218 | ||
219 | } | |
220 | ||
221 | cout << endl; | |
84aff7a4 | 222 | cout << " TEveTrack parameters at vertex" << endl; |
eadce74d | 223 | cout << " --------------------------------------------------------------------------------------------------------------------" << endl; |
224 | cout << " InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz P" << endl; | |
225 | ||
226 | mtp = (AliMUONTrackParam*)fTrack->GetTrackParamAtVertex(); | |
227 | ||
228 | bc = mtp->GetBendingCoor(); | |
229 | nbc = mtp->GetNonBendingCoor(); | |
230 | zc = mtp->GetZ(); | |
231 | if (bc < 0.001) bc = 0.0; | |
232 | if (nbc < 0.001) nbc = 0.0; | |
233 | if (zc < 0.001) zc = 0.0; | |
234 | ||
235 | cout << " " << | |
eadce74d | 236 | setw(8) << setprecision(3) << |
51346b82 | 237 | mtp->GetInverseBendingMomentum() << " " << |
238 | ||
239 | setw(8) << setprecision(3) << | |
240 | mtp->GetBendingSlope()*RADDEG << " " << | |
241 | ||
eadce74d | 242 | setw(8) << setprecision(3) << |
51346b82 | 243 | mtp->GetNonBendingSlope()*RADDEG << " " << |
244 | ||
eadce74d | 245 | setw(8) << setprecision(4) << |
51346b82 | 246 | bc << " " << |
247 | ||
eadce74d | 248 | setw(8) << setprecision(4) << |
51346b82 | 249 | nbc << " " << |
250 | ||
eadce74d | 251 | setw(10) << setprecision(6) << |
51346b82 | 252 | zc << " " << |
253 | ||
eadce74d | 254 | setw(8) << setprecision(4) << |
51346b82 | 255 | mtp->Px() << " " << |
256 | ||
eadce74d | 257 | setw(8) << setprecision(4) << |
51346b82 | 258 | mtp->Py() << " " << |
259 | ||
eadce74d | 260 | setw(8) << setprecision(4) << |
51346b82 | 261 | mtp->Pz() << " " << |
262 | ||
eadce74d | 263 | setw(8) << setprecision(4) << |
51346b82 | 264 | mtp->P() << " " << |
265 | ||
eadce74d | 266 | endl; |
51346b82 | 267 | |
eadce74d | 268 | pt = TMath::Sqrt(mtp->Px()*mtp->Px()+mtp->Py()*mtp->Py()); |
269 | ||
270 | cout << endl; | |
51346b82 | 271 | cout << " Pt = " << |
eadce74d | 272 | setw(8) << setprecision(3) << |
273 | pt << " GeV/c" << endl; | |
274 | ||
275 | } | |
276 | ||
57ffa5fb | 277 | //______________________________________________________________________________ |
d810d0de | 278 | void AliEveMUONTrack::PrintMUONTriggerTrackInfo() |
eadce74d | 279 | { |
280 | // | |
281 | // information about the trigger track | |
282 | // | |
283 | ||
284 | // Double_t RADDEG = 180.0/TMath::Pi(); | |
285 | ||
286 | } | |
287 | ||
57ffa5fb | 288 | //______________________________________________________________________________ |
d810d0de | 289 | void AliEveMUONTrack::PrintESDTrackInfo() |
eadce74d | 290 | { |
291 | // | |
292 | // information about the reconstructed ESD track at vertex | |
293 | // | |
294 | ||
295 | Double_t RADDEG = 180.0/TMath::Pi(); | |
296 | Float_t pt; | |
297 | ||
298 | AliMUONTrackParam *mtp = (AliMUONTrackParam*)fTrack->GetTrackParamAtVertex(); | |
299 | ||
300 | cout << endl; | |
301 | cout << " ESD muon track " << endl; | |
302 | cout << " -----------------------------------------------------------------------------------------------------------" << endl; | |
303 | cout << " InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz" << endl; | |
51346b82 | 304 | |
305 | cout << " " << | |
306 | ||
307 | setw(8) << setprecision(4) << | |
308 | mtp->GetInverseBendingMomentum() << " " << | |
309 | ||
eadce74d | 310 | setw(8) << setprecision(3) << |
51346b82 | 311 | mtp->GetBendingSlope()*RADDEG << " " << |
312 | ||
eadce74d | 313 | setw(8) << setprecision(3) << |
51346b82 | 314 | mtp->GetNonBendingSlope()*RADDEG << " " << |
315 | ||
eadce74d | 316 | setw(8) << setprecision(4) << |
51346b82 | 317 | mtp->GetBendingCoor() << " " << |
318 | ||
eadce74d | 319 | setw(8) << setprecision(4) << |
51346b82 | 320 | mtp->GetNonBendingCoor() << " " << |
321 | ||
eadce74d | 322 | setw(10) << setprecision(6) << |
51346b82 | 323 | mtp->GetZ() << " " << |
324 | ||
eadce74d | 325 | setw(8) << setprecision(3) << |
51346b82 | 326 | mtp->Px() << " " << |
327 | ||
eadce74d | 328 | setw(8) << setprecision(3) << |
51346b82 | 329 | mtp->Py() << " " << |
330 | ||
eadce74d | 331 | setw(8) << setprecision(3) << |
51346b82 | 332 | mtp->Pz() << " " << |
333 | ||
eadce74d | 334 | endl; |
51346b82 | 335 | |
eadce74d | 336 | pt = TMath::Sqrt(mtp->Px()*mtp->Px()+mtp->Py()*mtp->Py()); |
51346b82 | 337 | |
eadce74d | 338 | cout << endl; |
51346b82 | 339 | cout << " Pt = " << |
eadce74d | 340 | setw(8) << setprecision(3) << |
341 | pt << " GeV/c" << endl; | |
51346b82 | 342 | |
343 | cout << " P = " << | |
eadce74d | 344 | setw(8) << setprecision(4) << |
345 | mtp->P() << " GeV/c" << endl; | |
51346b82 | 346 | |
d810d0de | 347 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
51346b82 | 348 | |
eadce74d | 349 | Double_t spdVertexX = 0; |
350 | Double_t spdVertexY = 0; | |
351 | Double_t spdVertexZ = 0; | |
352 | Double_t esdVertexX = 0; | |
353 | Double_t esdVertexY = 0; | |
354 | Double_t esdVertexZ = 0; | |
355 | ||
356 | AliESDVertex* spdVertex = (AliESDVertex*) esd->GetVertex(); | |
357 | if (spdVertex->GetNContributors()) { | |
358 | spdVertexZ = spdVertex->GetZv(); | |
359 | spdVertexY = spdVertex->GetYv(); | |
360 | spdVertexX = spdVertex->GetXv(); | |
361 | } | |
51346b82 | 362 | |
eadce74d | 363 | AliESDVertex* esdVertex = (AliESDVertex*) esd->GetPrimaryVertex(); |
364 | if (esdVertex->GetNContributors()) { | |
365 | esdVertexZ = esdVertex->GetZv(); | |
366 | esdVertexY = esdVertex->GetYv(); | |
367 | esdVertexX = esdVertex->GetXv(); | |
368 | } | |
51346b82 | 369 | |
eadce74d | 370 | Float_t t0v = esd->GetT0zVertex(); |
51346b82 | 371 | |
eadce74d | 372 | cout << endl; |
373 | cout << endl; | |
51346b82 | 374 | cout << "External vertex SPD: " << |
eadce74d | 375 | setw(3) << |
376 | spdVertex->GetNContributors() << " " << | |
377 | setw(8) << setprecision(3) << | |
378 | spdVertexX << " " << | |
379 | spdVertexY << " " << | |
380 | spdVertexZ << " " << endl; | |
51346b82 | 381 | cout << "External vertex ESD: " << |
eadce74d | 382 | setw(3) << |
383 | esdVertex->GetNContributors() << " " << | |
384 | setw(8) << setprecision(3) << | |
385 | esdVertexX << " " << | |
386 | esdVertexY << " " << | |
387 | esdVertexZ << " " << endl; | |
51346b82 | 388 | cout << "External vertex T0: " << |
eadce74d | 389 | setw(8) << setprecision(3) << |
390 | t0v << " " << endl; | |
51346b82 | 391 | |
e19f3684 | 392 | } |
393 | ||
57ffa5fb | 394 | //______________________________________________________________________________ |
d810d0de | 395 | void AliEveMUONTrack::MUONTrackInfo() |
e19f3684 | 396 | { |
397 | // | |
398 | // MENU function | |
399 | // | |
400 | ||
eadce74d | 401 | if (fIsMCTrack) { |
402 | PrintMCTrackInfo(); | |
403 | } | |
51346b82 | 404 | |
eadce74d | 405 | if (fIsMUONTrack || fIsRefTrack) { |
406 | PrintMUONTrackInfo(); | |
407 | } | |
51346b82 | 408 | |
eadce74d | 409 | if (fIsESDTrack) { |
410 | PrintESDTrackInfo(); | |
411 | } | |
412 | ||
413 | if (fIsMUONTriggerTrack) { | |
414 | PrintMUONTriggerTrackInfo(); | |
415 | } | |
51346b82 | 416 | |
eadce74d | 417 | cout << endl; |
418 | cout << endl; | |
419 | cout << endl; | |
420 | cout << " (slopes [deg], coord [cm], p [GeV/c])" << endl; | |
e19f3684 | 421 | |
422 | } | |
423 | ||
57ffa5fb | 424 | //______________________________________________________________________________ |
d810d0de | 425 | void AliEveMUONTrack::MUONTriggerInfo() |
e19f3684 | 426 | { |
427 | // | |
428 | // MENU function | |
429 | // | |
430 | ||
eadce74d | 431 | if (fIsMUONTrack) { |
d810d0de | 432 | TEveUtil::TEveUtil::LoadMacro("MUON_trigger_info.C"); |
eadce74d | 433 | gROOT->ProcessLine(Form("MUON_trigger_info(%d);", fLabel)); |
434 | } | |
435 | if (fIsRefTrack) { | |
436 | cout << "This is a reference track!" << endl; | |
437 | } | |
438 | if (fIsMCTrack) { | |
439 | cout << "This is a Monte-Carlo track!" << endl; | |
440 | } | |
441 | if (fIsESDTrack) { | |
442 | ||
d810d0de | 443 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
eadce74d | 444 | ULong64_t triggerMask = esd->GetTriggerMask(); |
445 | ||
446 | cout << endl; | |
447 | cout << ">>>>>#########################################################################################################################" << endl; | |
448 | cout << endl; | |
449 | ||
450 | cout << " ESD track trigger info" << endl; | |
451 | cout << " -----------------------------------------------------" << endl; | |
452 | cout << endl; | |
453 | ||
454 | cout << " Match to trigger " << fTrack->GetMatchTrigger() << endl; | |
455 | cout << endl; | |
456 | cout << " ESD trigger mask = " << triggerMask << endl; | |
457 | ||
458 | cout << endl; | |
459 | cout << "#########################################################################################################################<<<<<" << endl; | |
460 | cout << endl; | |
51346b82 | 461 | |
eadce74d | 462 | } |
e19f3684 | 463 | |
464 | } | |
465 | ||
57ffa5fb | 466 | //______________________________________________________________________________ |
d810d0de | 467 | void AliEveMUONTrack::MakeMUONTrack(AliMUONTrack *mtrack) |
e19f3684 | 468 | { |
469 | // | |
470 | // builds the track with dipole field | |
471 | // | |
472 | ||
eadce74d | 473 | if (!fIsRefTrack) { |
474 | fIsMUONTrack = kTRUE; | |
475 | fTrack = mtrack; | |
476 | } | |
477 | ||
478 | if (fIsRefTrack) { | |
479 | fTrack = new AliMUONTrack(*mtrack); | |
480 | } | |
e19f3684 | 481 | |
482 | Double_t xv, yv; | |
483 | Float_t ax, bx, ay, by; | |
eadce74d | 484 | Float_t xr[28], yr[28], zr[28]; |
485 | Float_t xrc[28], yrc[28], zrc[28]; | |
e19f3684 | 486 | char form[1000]; |
51346b82 | 487 | |
e19f3684 | 488 | TMatrixD smatrix(2,2); |
489 | TMatrixD sums(2,1); | |
490 | TMatrixD res(2,1); | |
491 | ||
492 | Float_t xRec, xRec0; | |
493 | Float_t yRec, yRec0; | |
494 | Float_t zRec, zRec0; | |
51346b82 | 495 | |
e19f3684 | 496 | // middle z between the two detector planes of the trigger chambers |
497 | Float_t zg[4] = { -1603.5, -1620.5, -1703.5, -1720.5 }; | |
498 | ||
cef26510 | 499 | Float_t pt = 0.0; |
500 | Float_t pv[3] = { 0.0 }; | |
eadce74d | 501 | |
502 | if (fIsMUONTrack) { | |
eadce74d | 503 | if (mtrack->GetMatchTrigger()) { |
d810d0de | 504 | sprintf(form,"AliEveMUONTrack %2d (MT)", fLabel); |
eadce74d | 505 | } else { |
d810d0de | 506 | sprintf(form,"AliEveMUONTrack %2d ", fLabel); |
eadce74d | 507 | } |
cef26510 | 508 | SetName(form); |
509 | SetLineStyle(1); | |
e19f3684 | 510 | } |
51346b82 | 511 | |
512 | AliMUONTrackParam *trackParam = mtrack->GetTrackParamAtVertex(); | |
e19f3684 | 513 | xRec0 = trackParam->GetNonBendingCoor(); |
514 | yRec0 = trackParam->GetBendingCoor(); | |
515 | zRec0 = trackParam->GetZ(); | |
51346b82 | 516 | |
eadce74d | 517 | if (fIsMUONTrack) { |
518 | SetPoint(fCount,xRec0,yRec0,zRec0); | |
519 | fCount++; | |
520 | } | |
e19f3684 | 521 | |
eadce74d | 522 | for (Int_t i = 0; i < 28; i++) xr[i]=yr[i]=zr[i]=0.0; |
51346b82 | 523 | |
db9c5465 | 524 | Int_t nTrackHits = mtrack->GetNClusters(); |
51346b82 | 525 | |
eadce74d | 526 | Bool_t hitChamber[14] = {kFALSE}; |
527 | Int_t iCha; | |
db9c5465 | 528 | TClonesArray* trackParamAtCluster = mtrack->GetTrackParamAtCluster(); |
e19f3684 | 529 | |
530 | for (Int_t iHit = 0; iHit < nTrackHits; iHit++){ | |
cef26510 | 531 | |
51346b82 | 532 | trackParam = (AliMUONTrackParam*) trackParamAtCluster->At(iHit); |
533 | ||
cef26510 | 534 | if (iHit == 0) { |
535 | if (IsMUONTrack()) { | |
536 | pt = TMath::Sqrt(trackParam->Px()*trackParam->Px()+trackParam->Py()*trackParam->Py()); | |
537 | SetLineColor(ColorIndex(pt)); | |
538 | } | |
539 | pv[0] = trackParam->Px(); | |
540 | pv[1] = trackParam->Py(); | |
541 | pv[2] = trackParam->Pz(); | |
542 | fP.Set(pv); | |
543 | } | |
544 | ||
e19f3684 | 545 | xRec = trackParam->GetNonBendingCoor(); |
546 | yRec = trackParam->GetBendingCoor(); | |
547 | zRec = trackParam->GetZ(); | |
51346b82 | 548 | |
eadce74d | 549 | iCha = AliMUONConstants::ChamberNumber(zRec); |
51346b82 | 550 | |
e19f3684 | 551 | xr[iHit] = xRec; |
552 | yr[iHit] = yRec; | |
553 | zr[iHit] = zRec; | |
eadce74d | 554 | |
555 | hitChamber[iCha] = kTRUE; | |
e19f3684 | 556 | |
557 | } | |
558 | ||
559 | Int_t crntCha, lastHitSt12, firstHitSt3, lastHitSt3, firstHitSt45; | |
560 | ||
eadce74d | 561 | if (fIsMUONTrack) nTrackHits = 10; |
562 | ||
e19f3684 | 563 | lastHitSt12 = -1; |
564 | firstHitSt3 = -1; | |
565 | lastHitSt3 = -1; | |
566 | firstHitSt45 = -1; | |
567 | for (Int_t iHit = 0; iHit < nTrackHits; iHit++) { | |
568 | crntCha = AliMUONConstants::ChamberNumber(zr[iHit]); | |
569 | if (hitChamber[crntCha] && crntCha >= 0 && crntCha <= 3) { | |
570 | lastHitSt12 = iHit; | |
571 | } | |
572 | if (hitChamber[crntCha] && crntCha >= 4 && crntCha <= 5) { | |
573 | if (firstHitSt3 == -1) firstHitSt3 = iHit; | |
574 | lastHitSt3 = iHit; | |
575 | } | |
576 | if (hitChamber[crntCha] && crntCha >= 6 && crntCha <= 9) { | |
577 | if (firstHitSt45 == -1) firstHitSt45 = iHit; | |
578 | } | |
579 | } | |
580 | ||
581 | if (lastHitSt12 >= 0) { | |
582 | for (Int_t iHit = 0; iHit <= lastHitSt12; iHit++) { | |
583 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
584 | fCount++; | |
585 | } | |
586 | if (firstHitSt3 >= 0) { | |
587 | Propagate(xr,yr,zr,lastHitSt12,firstHitSt3); | |
588 | SetPoint(fCount,xr[firstHitSt3],yr[firstHitSt3],zr[firstHitSt3]); | |
589 | fCount++; | |
590 | if (lastHitSt3 >= 0) { | |
591 | SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]); | |
592 | fCount++; | |
593 | if (firstHitSt45 >= 0) { | |
594 | Propagate(xr,yr,zr,lastHitSt3,firstHitSt45); | |
595 | for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) { | |
596 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
597 | fCount++; | |
598 | } | |
599 | } else { | |
600 | Propagate(xr,yr,zr,lastHitSt3,9999); | |
601 | } | |
602 | } else if (firstHitSt45 >= 0) { | |
603 | Propagate(xr,yr,zr,firstHitSt3,firstHitSt45); | |
604 | for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) { | |
605 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
606 | fCount++; | |
607 | } | |
608 | } else { | |
609 | Propagate(xr,yr,zr,firstHitSt3,9999); | |
610 | } | |
611 | } else if (lastHitSt3 >= 0) { | |
612 | Propagate(xr,yr,zr,lastHitSt12,lastHitSt3); | |
613 | SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]); | |
614 | fCount++; | |
615 | if (firstHitSt45 >= 0) { | |
616 | Propagate(xr,yr,zr,lastHitSt3,firstHitSt45); | |
617 | for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) { | |
618 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
619 | fCount++; | |
620 | } | |
621 | } else { | |
622 | Propagate(xr,yr,zr,lastHitSt3,9999); | |
623 | } | |
624 | } else if (firstHitSt45 >= 0){ | |
625 | Propagate(xr,yr,zr,lastHitSt12,firstHitSt45); | |
626 | for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) { | |
627 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
628 | fCount++; | |
629 | } | |
630 | } else { | |
631 | Propagate(xr,yr,zr,lastHitSt12,9999); | |
632 | } | |
633 | } else if (firstHitSt3 >= 0) { | |
634 | SetPoint(fCount,xr[firstHitSt3],yr[firstHitSt3],zr[firstHitSt3]); | |
635 | fCount++; | |
636 | if (lastHitSt3 >= 0) { | |
637 | SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]); | |
638 | fCount++; | |
639 | if (firstHitSt45) { | |
640 | Propagate(xr,yr,zr,lastHitSt3,firstHitSt45); | |
641 | for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) { | |
642 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
643 | fCount++; | |
644 | } | |
645 | } else { | |
646 | Propagate(xr,yr,zr,lastHitSt3,9999); | |
647 | } | |
648 | } else if (firstHitSt45 >= 0) { | |
649 | Propagate(xr,yr,zr,firstHitSt3,firstHitSt45); | |
650 | for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) { | |
651 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
652 | fCount++; | |
653 | } | |
654 | } else { | |
655 | Propagate(xr,yr,zr,firstHitSt3,9999); | |
656 | } | |
657 | } else if (lastHitSt3 >= 0) { | |
658 | SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]); | |
659 | fCount++; | |
660 | if (firstHitSt45 >= 0) { | |
661 | Propagate(xr,yr,zr,lastHitSt3,firstHitSt45); | |
662 | for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) { | |
663 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
664 | fCount++; | |
665 | } | |
666 | } else { | |
667 | Propagate(xr,yr,zr,lastHitSt3,9999); | |
668 | } | |
669 | } else { | |
670 | for (Int_t iHit = 0; iHit < nTrackHits; iHit++) { | |
671 | SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]); | |
672 | fCount++; | |
673 | } | |
674 | } | |
51346b82 | 675 | |
eadce74d | 676 | if (!fIsMUONTrack) return; |
e19f3684 | 677 | |
678 | Int_t nrc = 0; | |
679 | if (mtrack->GetMatchTrigger() && 1) { | |
51346b82 | 680 | |
e19f3684 | 681 | for (Int_t i = 0; i < nTrackHits; i++) { |
682 | if (TMath::Abs(zr[i]) > 1000.0) { | |
84aff7a4 | 683 | //printf("TEveHit %d x %f y %f z %f \n",iHit,xr[i],yr[i],zr[i]); |
e19f3684 | 684 | xrc[nrc] = xr[i]; |
685 | yrc[nrc] = yr[i]; | |
686 | zrc[nrc] = zr[i]; | |
687 | nrc++; | |
688 | } | |
689 | } | |
51346b82 | 690 | |
e19f3684 | 691 | if (nrc < 2) return; |
51346b82 | 692 | |
e19f3684 | 693 | // fit x-z |
694 | smatrix.Zero(); | |
695 | sums.Zero(); | |
696 | for (Int_t i = 0; i < nrc; i++) { | |
697 | xv = (Double_t)zrc[i]; | |
698 | yv = (Double_t)xrc[i]; | |
699 | //printf("x-z: xv %f yv %f \n",xv,yv); | |
700 | smatrix(0,0) += 1.0; | |
701 | smatrix(1,1) += xv*xv; | |
702 | smatrix(0,1) += xv; | |
703 | smatrix(1,0) += xv; | |
704 | sums(0,0) += yv; | |
705 | sums(1,0) += xv*yv; | |
706 | } | |
707 | res = smatrix.Invert() * sums; | |
708 | ax = res(0,0); | |
709 | bx = res(1,0); | |
51346b82 | 710 | |
e19f3684 | 711 | // fit y-z |
712 | smatrix.Zero(); | |
713 | sums.Zero(); | |
714 | for (Int_t i = 0; i < nrc; i++) { | |
715 | xv = (Double_t)zrc[i]; | |
716 | yv = (Double_t)yrc[i]; | |
717 | //printf("y-z: xv %f yv %f \n",xv,yv); | |
718 | smatrix(0,0) += 1.0; | |
719 | smatrix(1,1) += xv*xv; | |
720 | smatrix(0,1) += xv; | |
721 | smatrix(1,0) += xv; | |
722 | sums(0,0) += yv; | |
723 | sums(1,0) += xv*yv; | |
724 | } | |
725 | res = smatrix.Invert() * sums; | |
726 | ay = res(0,0); | |
727 | by = res(1,0); | |
51346b82 | 728 | |
e19f3684 | 729 | Float_t xtc, ytc, ztc; |
730 | for (Int_t ii = 0; ii < 4; ii++) { | |
51346b82 | 731 | |
e19f3684 | 732 | ztc = zg[ii]; |
733 | ytc = ay+by*zg[ii]; | |
734 | xtc = ax+bx*zg[ii]; | |
51346b82 | 735 | |
e19f3684 | 736 | //printf("tc: x %f y %f z %f \n",xtc,ytc,ztc); |
51346b82 | 737 | |
e19f3684 | 738 | SetPoint(fCount,xtc,ytc,ztc); |
739 | fCount++; | |
51346b82 | 740 | |
e19f3684 | 741 | } |
51346b82 | 742 | |
e19f3684 | 743 | } // end match trigger |
744 | ||
745 | } | |
746 | ||
57ffa5fb | 747 | //______________________________________________________________________________ |
d810d0de | 748 | void AliEveMUONTrack::MakeMUONTriggerTrack(AliMUONTriggerTrack *mtrack) |
eadce74d | 749 | { |
750 | // | |
751 | // builds the trigger track from one point and direction | |
752 | // | |
753 | ||
754 | Float_t x1 = mtrack->GetX11(); | |
755 | Float_t y1 = mtrack->GetY11(); | |
756 | Float_t thex = mtrack->GetThetax(); | |
757 | Float_t they = mtrack->GetThetay(); | |
758 | ||
759 | Float_t z11 = -1600.0; | |
760 | Float_t z22 = -1724.0; | |
761 | Float_t dz = z22-z11; | |
762 | ||
763 | Float_t x2 = x1 + dz*TMath::Tan(thex); | |
764 | Float_t y2 = y1 + dz*TMath::Tan(they); | |
765 | ||
766 | SetPoint(fCount,x1,y1,z11); fCount++; | |
767 | SetPoint(fCount,x2,y2,z22); fCount++; | |
768 | ||
769 | char form[1000]; | |
770 | ||
771 | sprintf(form,"MUONTriggerTrack %2d",mtrack->GetLoTrgNum()); | |
772 | SetName(form); | |
773 | SetLineStyle(1); | |
774 | ||
775 | } | |
776 | ||
57ffa5fb | 777 | //______________________________________________________________________________ |
d810d0de | 778 | void AliEveMUONTrack::MakeESDTrack(AliESDMuonTrack *mtrack) |
eadce74d | 779 | { |
780 | // | |
781 | // builds the track with dipole field starting from the TParticle | |
782 | // | |
783 | ||
784 | fIsESDTrack = kTRUE; | |
785 | ||
786 | fTrack = new AliMUONTrack(); | |
787 | AliMUONTrackParam trackParam; | |
788 | trackParam.GetParamFrom(*mtrack); | |
789 | fTrack->SetTrackParamAtVertex(&trackParam); | |
790 | fTrack->SetMatchTrigger(mtrack->GetMatchTrigger()); | |
791 | ||
792 | char form[1000]; | |
793 | sprintf(form,"ESDTrack %2d ", fLabel); | |
794 | SetName(form); | |
795 | SetLineStyle(3); | |
796 | SetLineColor(0); | |
797 | ||
798 | Double_t vect[7], vout[7]; | |
799 | Double_t step = 1.0; | |
800 | ||
801 | Int_t charge = (Int_t)TMath::Sign(1.0,trackParam.GetInverseBendingMomentum()); | |
802 | Float_t pv[3]; | |
803 | pv[0] = trackParam.Px(); | |
804 | pv[1] = trackParam.Py(); | |
805 | pv[2] = trackParam.Pz(); | |
806 | fP.Set(pv); | |
51346b82 | 807 | |
eadce74d | 808 | vect[0] = trackParam.GetNonBendingCoor(); |
809 | vect[1] = trackParam.GetBendingCoor(); | |
810 | vect[2] = trackParam.GetZ(); | |
811 | vect[3] = trackParam.Px()/trackParam.P(); | |
812 | vect[4] = trackParam.Py()/trackParam.P(); | |
813 | vect[5] = trackParam.Pz()/trackParam.P(); | |
814 | vect[6] = trackParam.P(); | |
815 | ||
816 | //cout << "vertex " << vect[0] << " " << vect[1] << " " << vect[2] << " " << endl; | |
817 | ||
818 | Double_t zMax = -1750.0; | |
819 | Double_t rMax = 350.0; | |
820 | Double_t r = 0.0; | |
821 | ||
822 | Int_t nSteps = 0; | |
823 | while ((vect[2] > zMax) && (nSteps < 10000) && (r < rMax)) { | |
824 | nSteps++; | |
825 | OneStepRungekutta(charge, step, vect, vout); | |
826 | SetPoint(fCount,vout[0],vout[1],vout[2]); | |
827 | fCount++; | |
828 | for (Int_t i = 0; i < 7; i++) { | |
829 | vect[i] = vout[i]; | |
830 | } | |
831 | r = TMath::Sqrt(vect[0]*vect[0]+vect[1]*vect[1]); | |
832 | } | |
833 | ||
834 | } | |
835 | ||
57ffa5fb | 836 | //______________________________________________________________________________ |
d810d0de | 837 | void AliEveMUONTrack::MakeMCTrack(TParticle *part) |
eadce74d | 838 | { |
839 | // | |
840 | // builds the track with dipole field starting from the TParticle | |
841 | // | |
842 | ||
843 | fIsMCTrack = kTRUE; | |
844 | ||
845 | fPart = new TParticle(*part); | |
846 | ||
847 | char form[1000]; | |
84aff7a4 | 848 | sprintf(form,"TEveMCTrack %2d ", fLabel); |
eadce74d | 849 | SetName(form); |
850 | SetLineStyle(2); | |
851 | SetLineColor(8); | |
852 | ||
853 | Double_t vect[7], vout[7]; | |
854 | Double_t step = 1.0; | |
855 | ||
856 | Float_t pv[3]; | |
857 | pv[0] = fPart->Px(); | |
858 | pv[1] = fPart->Py(); | |
859 | pv[2] = fPart->Pz(); | |
860 | fP.Set(pv); | |
861 | ||
862 | vect[0] = fPart->Vx(); | |
863 | vect[1] = fPart->Vy(); | |
864 | vect[2] = fPart->Vz(); | |
865 | vect[3] = fPart->Px()/fPart->P(); | |
866 | vect[4] = fPart->Py()/fPart->P(); | |
867 | vect[5] = fPart->Pz()/fPart->P(); | |
868 | vect[6] = fPart->P(); | |
869 | ||
870 | TParticlePDG *ppdg = fPart->GetPDG(1); | |
871 | Int_t charge = (Int_t)(ppdg->Charge()/3.0); | |
51346b82 | 872 | |
eadce74d | 873 | Double_t zMax = -1750.0; |
874 | Double_t rMax = 350.0; | |
875 | Double_t r = 0.0; | |
876 | ||
877 | Int_t nSteps = 0; | |
878 | while ((vect[2] > zMax) && (nSteps < 10000) && (r < rMax)) { | |
879 | nSteps++; | |
880 | OneStepRungekutta(charge, step, vect, vout); | |
881 | SetPoint(fCount,vout[0],vout[1],vout[2]); | |
882 | fCount++; | |
883 | for (Int_t i = 0; i < 7; i++) { | |
884 | vect[i] = vout[i]; | |
885 | } | |
886 | r = TMath::Sqrt(vect[0]*vect[0]+vect[1]*vect[1]); | |
887 | } | |
888 | ||
889 | } | |
890 | ||
57ffa5fb | 891 | //______________________________________________________________________________ |
d810d0de | 892 | void AliEveMUONTrack::MakeRefTrack(AliMUONTrack *mtrack) |
eadce74d | 893 | { |
894 | // | |
895 | // builds the track with dipole field starting from the TParticle | |
896 | // | |
897 | ||
898 | fIsRefTrack = kTRUE; | |
899 | ||
900 | char form[1000]; | |
901 | sprintf(form,"RefTrack %2d ", fLabel); | |
902 | SetName(form); | |
903 | SetLineStyle(2); | |
904 | SetLineColor(0); | |
905 | ||
906 | MakeMUONTrack(mtrack); | |
907 | ||
908 | } | |
909 | ||
57ffa5fb | 910 | //______________________________________________________________________________ |
d810d0de | 911 | void AliEveMUONTrack::Propagate(Float_t *xr, Float_t *yr, Float_t *zr, Int_t i1, Int_t i2) |
e19f3684 | 912 | { |
913 | // | |
914 | // propagate in magnetic field between hits of indices i1 and i2 | |
915 | // | |
916 | ||
917 | Double_t vect[7], vout[7]; | |
918 | Double_t step = 1.0; | |
cef26510 | 919 | Double_t zMax = 0.0; |
920 | Int_t charge = 0; | |
921 | AliMUONTrackParam *trackParam = 0; | |
db9c5465 | 922 | TClonesArray *trackParamAtCluster = 0; |
e19f3684 | 923 | |
924 | if (i2 == 9999) { | |
eadce74d | 925 | zMax = zr[i1]+1.5*step; |
e19f3684 | 926 | } else { |
eadce74d | 927 | zMax = zr[i2]+1.5*step; |
e19f3684 | 928 | } |
929 | ||
db9c5465 | 930 | trackParamAtCluster = fTrack->GetTrackParamAtCluster(); |
e19f3684 | 931 | |
cef26510 | 932 | if (IsMUONTrack()) { |
51346b82 | 933 | trackParam = (AliMUONTrackParam*)trackParamAtCluster->At(i1); |
cef26510 | 934 | charge = (Int_t)TMath::Sign(1.0,trackParam->GetInverseBendingMomentum()); |
935 | } | |
936 | if (IsRefTrack()) { | |
937 | trackParam = fTrack->GetTrackParamAtVertex(); | |
938 | charge = (Int_t)TMath::Sign(1.0,trackParam->GetInverseBendingMomentum()); | |
51346b82 | 939 | trackParam = (AliMUONTrackParam*)trackParamAtCluster->At(i1); |
cef26510 | 940 | } |
51346b82 | 941 | |
e19f3684 | 942 | vect[0] = xr[i1]; |
943 | vect[1] = yr[i1]; | |
944 | vect[2] = zr[i1]; | |
945 | vect[3] = trackParam->Px()/trackParam->P(); | |
946 | vect[4] = trackParam->Py()/trackParam->P(); | |
947 | vect[5] = trackParam->Pz()/trackParam->P(); | |
948 | vect[6] = trackParam->P(); | |
949 | ||
950 | Int_t nSteps = 0; | |
951 | while ((vect[2] > zMax) && (nSteps < 10000)) { | |
952 | nSteps++; | |
953 | OneStepRungekutta(charge, step, vect, vout); | |
e19f3684 | 954 | SetPoint(fCount,vout[0],vout[1],vout[2]); |
955 | fCount++; | |
956 | for (Int_t i = 0; i < 7; i++) { | |
957 | vect[i] = vout[i]; | |
958 | } | |
959 | } | |
51346b82 | 960 | |
e19f3684 | 961 | } |
962 | ||
57ffa5fb | 963 | //______________________________________________________________________________ |
d810d0de | 964 | void AliEveMUONTrack::GetField(Double_t *position, Double_t *field) |
e19f3684 | 965 | { |
51346b82 | 966 | // |
e19f3684 | 967 | // returns field components at position, for a give field map |
968 | // | |
969 | ||
970 | /// interface for arguments in double precision (Why ? ChF) | |
971 | Float_t x[3], b[3]; | |
972 | ||
973 | x[0] = position[0]; x[1] = position[1]; x[2] = position[2]; | |
974 | ||
eadce74d | 975 | if (fFieldMap) { |
976 | fFieldMap->Field(x,b); | |
977 | } | |
e19f3684 | 978 | else { |
eadce74d | 979 | AliWarning("No field map"); |
e19f3684 | 980 | field[0] = field[1] = field[2] = 0.0; |
981 | return; | |
982 | } | |
51346b82 | 983 | |
e19f3684 | 984 | // force components |
985 | //b[1] = 0.0; | |
986 | //b[2] = 0.0; | |
987 | ||
988 | field[0] = b[0]; field[1] = b[1]; field[2] = b[2]; | |
989 | ||
990 | return; | |
991 | ||
992 | } | |
993 | ||
57ffa5fb | 994 | //______________________________________________________________________________ |
51346b82 | 995 | void AliEveMUONTrack::OneStepRungekutta(Double_t charge, Double_t step, |
e19f3684 | 996 | Double_t* vect, Double_t* vout) |
997 | { | |
998 | /// ****************************************************************** | |
999 | /// * * | |
1000 | /// * Runge-Kutta method for tracking a particle through a magnetic * | |
1001 | /// * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of * | |
1002 | /// * Standards, procedure 25.5.20) * | |
1003 | /// * * | |
1004 | /// * Input parameters * | |
1005 | /// * CHARGE Particle charge * | |
1006 | /// * STEP Step size * | |
1007 | /// * VECT Initial co-ords,direction cosines,momentum * | |
1008 | /// * Output parameters * | |
1009 | /// * VOUT Output co-ords,direction cosines,momentum * | |
1010 | /// * User routine called * | |
1011 | /// * CALL GUFLD(X,F) * | |
1012 | /// * * | |
1013 | /// * ==>Called by : <USER>, GUSWIM * | |
1014 | /// * Authors R.Brun, M.Hansroul ********* * | |
1015 | /// * V.Perevoztchikov (CUT STEP implementation) * | |
1016 | /// * * | |
1017 | /// * * | |
1018 | /// ****************************************************************** | |
1019 | ||
1020 | Double_t h2, h4, f[4]; | |
1021 | Double_t xyzt[3], a, b, c, ph,ph2; | |
1022 | Double_t secxs[4],secys[4],seczs[4],hxp[3]; | |
1023 | Double_t g1, g2, g3, g4, g5, g6, ang2, dxt, dyt, dzt; | |
1024 | Double_t est, at, bt, ct, cba; | |
1025 | Double_t f1, f2, f3, f4, rho, tet, hnorm, hp, rho1, sint, cost; | |
51346b82 | 1026 | |
e19f3684 | 1027 | Double_t x; |
1028 | Double_t y; | |
1029 | Double_t z; | |
51346b82 | 1030 | |
e19f3684 | 1031 | Double_t xt; |
1032 | Double_t yt; | |
1033 | Double_t zt; | |
1034 | ||
1035 | Double_t maxit = 1992; | |
1036 | Double_t maxcut = 11; | |
1037 | ||
1038 | const Double_t kdlt = 1e-4; | |
1039 | const Double_t kdlt32 = kdlt/32.; | |
1040 | const Double_t kthird = 1./3.; | |
1041 | const Double_t khalf = 0.5; | |
1042 | const Double_t kec = 2.9979251e-4; | |
1043 | ||
1044 | const Double_t kpisqua = 9.86960440109; | |
1045 | const Int_t kix = 0; | |
1046 | const Int_t kiy = 1; | |
1047 | const Int_t kiz = 2; | |
1048 | const Int_t kipx = 3; | |
1049 | const Int_t kipy = 4; | |
1050 | const Int_t kipz = 5; | |
51346b82 | 1051 | |
e19f3684 | 1052 | // *. |
1053 | // *. ------------------------------------------------------------------ | |
1054 | // *. | |
1055 | // * this constant is for units cm,gev/c and kgauss | |
1056 | // * | |
1057 | Int_t iter = 0; | |
1058 | Int_t ncut = 0; | |
1059 | for(Int_t j = 0; j < 7; j++) | |
1060 | vout[j] = vect[j]; | |
1061 | ||
1062 | Double_t pinv = kec * charge / vect[6]; | |
1063 | Double_t tl = 0.; | |
1064 | Double_t h = step; | |
1065 | Double_t rest; | |
1066 | ||
51346b82 | 1067 | |
e19f3684 | 1068 | do { |
1069 | rest = step - tl; | |
1070 | if (TMath::Abs(h) > TMath::Abs(rest)) h = rest; | |
1071 | //cmodif: call gufld(vout,f) changed into: | |
1072 | ||
1073 | GetField(vout,f); | |
1074 | ||
1075 | // * | |
1076 | // * start of integration | |
1077 | // * | |
1078 | x = vout[0]; | |
1079 | y = vout[1]; | |
1080 | z = vout[2]; | |
1081 | a = vout[3]; | |
1082 | b = vout[4]; | |
1083 | c = vout[5]; | |
1084 | ||
1085 | h2 = khalf * h; | |
1086 | h4 = khalf * h2; | |
1087 | ph = pinv * h; | |
1088 | ph2 = khalf * ph; | |
1089 | secxs[0] = (b * f[2] - c * f[1]) * ph2; | |
1090 | secys[0] = (c * f[0] - a * f[2]) * ph2; | |
1091 | seczs[0] = (a * f[1] - b * f[0]) * ph2; | |
1092 | ang2 = (secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0]); | |
1093 | if (ang2 > kpisqua) break; | |
1094 | ||
1095 | dxt = h2 * a + h4 * secxs[0]; | |
1096 | dyt = h2 * b + h4 * secys[0]; | |
1097 | dzt = h2 * c + h4 * seczs[0]; | |
1098 | xt = x + dxt; | |
1099 | yt = y + dyt; | |
1100 | zt = z + dzt; | |
1101 | // * | |
1102 | // * second intermediate point | |
1103 | // * | |
1104 | ||
1105 | est = TMath::Abs(dxt) + TMath::Abs(dyt) + TMath::Abs(dzt); | |
1106 | if (est > h) { | |
1107 | if (ncut++ > maxcut) break; | |
1108 | h *= khalf; | |
1109 | continue; | |
1110 | } | |
51346b82 | 1111 | |
e19f3684 | 1112 | xyzt[0] = xt; |
1113 | xyzt[1] = yt; | |
1114 | xyzt[2] = zt; | |
1115 | ||
1116 | //cmodif: call gufld(xyzt,f) changed into: | |
1117 | GetField(xyzt,f); | |
1118 | ||
1119 | at = a + secxs[0]; | |
1120 | bt = b + secys[0]; | |
1121 | ct = c + seczs[0]; | |
1122 | ||
1123 | secxs[1] = (bt * f[2] - ct * f[1]) * ph2; | |
1124 | secys[1] = (ct * f[0] - at * f[2]) * ph2; | |
1125 | seczs[1] = (at * f[1] - bt * f[0]) * ph2; | |
1126 | at = a + secxs[1]; | |
1127 | bt = b + secys[1]; | |
1128 | ct = c + seczs[1]; | |
1129 | secxs[2] = (bt * f[2] - ct * f[1]) * ph2; | |
1130 | secys[2] = (ct * f[0] - at * f[2]) * ph2; | |
1131 | seczs[2] = (at * f[1] - bt * f[0]) * ph2; | |
1132 | dxt = h * (a + secxs[2]); | |
1133 | dyt = h * (b + secys[2]); | |
1134 | dzt = h * (c + seczs[2]); | |
1135 | xt = x + dxt; | |
1136 | yt = y + dyt; | |
1137 | zt = z + dzt; | |
1138 | at = a + 2.*secxs[2]; | |
1139 | bt = b + 2.*secys[2]; | |
1140 | ct = c + 2.*seczs[2]; | |
1141 | ||
1142 | est = TMath::Abs(dxt)+TMath::Abs(dyt)+TMath::Abs(dzt); | |
1143 | if (est > 2.*TMath::Abs(h)) { | |
1144 | if (ncut++ > maxcut) break; | |
1145 | h *= khalf; | |
1146 | continue; | |
1147 | } | |
51346b82 | 1148 | |
e19f3684 | 1149 | xyzt[0] = xt; |
1150 | xyzt[1] = yt; | |
1151 | xyzt[2] = zt; | |
1152 | ||
1153 | //cmodif: call gufld(xyzt,f) changed into: | |
1154 | GetField(xyzt,f); | |
1155 | ||
1156 | z = z + (c + (seczs[0] + seczs[1] + seczs[2]) * kthird) * h; | |
1157 | y = y + (b + (secys[0] + secys[1] + secys[2]) * kthird) * h; | |
1158 | x = x + (a + (secxs[0] + secxs[1] + secxs[2]) * kthird) * h; | |
1159 | ||
1160 | secxs[3] = (bt*f[2] - ct*f[1])* ph2; | |
1161 | secys[3] = (ct*f[0] - at*f[2])* ph2; | |
1162 | seczs[3] = (at*f[1] - bt*f[0])* ph2; | |
1163 | a = a+(secxs[0]+secxs[3]+2. * (secxs[1]+secxs[2])) * kthird; | |
1164 | b = b+(secys[0]+secys[3]+2. * (secys[1]+secys[2])) * kthird; | |
1165 | c = c+(seczs[0]+seczs[3]+2. * (seczs[1]+seczs[2])) * kthird; | |
1166 | ||
1167 | est = TMath::Abs(secxs[0]+secxs[3] - (secxs[1]+secxs[2])) | |
1168 | + TMath::Abs(secys[0]+secys[3] - (secys[1]+secys[2])) | |
1169 | + TMath::Abs(seczs[0]+seczs[3] - (seczs[1]+seczs[2])); | |
1170 | ||
1171 | if (est > kdlt && TMath::Abs(h) > 1.e-4) { | |
1172 | if (ncut++ > maxcut) break; | |
1173 | h *= khalf; | |
1174 | continue; | |
1175 | } | |
1176 | ||
1177 | ncut = 0; | |
1178 | // * if too many iterations, go to helix | |
1179 | if (iter++ > maxit) break; | |
1180 | ||
1181 | tl += h; | |
51346b82 | 1182 | if (est < kdlt32) |
e19f3684 | 1183 | h *= 2.; |
1184 | cba = 1./ TMath::Sqrt(a*a + b*b + c*c); | |
1185 | vout[0] = x; | |
1186 | vout[1] = y; | |
1187 | vout[2] = z; | |
1188 | vout[3] = cba*a; | |
1189 | vout[4] = cba*b; | |
1190 | vout[5] = cba*c; | |
1191 | rest = step - tl; | |
1192 | if (step < 0.) rest = -rest; | |
1193 | if (rest < 1.e-5*TMath::Abs(step)) return; | |
1194 | ||
1195 | } while(1); | |
1196 | ||
1197 | // angle too big, use helix | |
1198 | ||
1199 | f1 = f[0]; | |
1200 | f2 = f[1]; | |
1201 | f3 = f[2]; | |
1202 | f4 = TMath::Sqrt(f1*f1+f2*f2+f3*f3); | |
1203 | rho = -f4*pinv; | |
1204 | tet = rho * step; | |
51346b82 | 1205 | |
e19f3684 | 1206 | hnorm = 1./f4; |
1207 | f1 = f1*hnorm; | |
1208 | f2 = f2*hnorm; | |
1209 | f3 = f3*hnorm; | |
1210 | ||
1211 | hxp[0] = f2*vect[kipz] - f3*vect[kipy]; | |
1212 | hxp[1] = f3*vect[kipx] - f1*vect[kipz]; | |
1213 | hxp[2] = f1*vect[kipy] - f2*vect[kipx]; | |
51346b82 | 1214 | |
e19f3684 | 1215 | hp = f1*vect[kipx] + f2*vect[kipy] + f3*vect[kipz]; |
1216 | ||
1217 | rho1 = 1./rho; | |
1218 | sint = TMath::Sin(tet); | |
1219 | cost = 2.*TMath::Sin(khalf*tet)*TMath::Sin(khalf*tet); | |
1220 | ||
1221 | g1 = sint*rho1; | |
1222 | g2 = cost*rho1; | |
1223 | g3 = (tet-sint) * hp*rho1; | |
1224 | g4 = -cost; | |
1225 | g5 = sint; | |
1226 | g6 = cost * hp; | |
51346b82 | 1227 | |
e19f3684 | 1228 | vout[kix] = vect[kix] + g1*vect[kipx] + g2*hxp[0] + g3*f1; |
1229 | vout[kiy] = vect[kiy] + g1*vect[kipy] + g2*hxp[1] + g3*f2; | |
1230 | vout[kiz] = vect[kiz] + g1*vect[kipz] + g2*hxp[2] + g3*f3; | |
51346b82 | 1231 | |
e19f3684 | 1232 | vout[kipx] = vect[kipx] + g4*vect[kipx] + g5*hxp[0] + g6*f1; |
1233 | vout[kipy] = vect[kipy] + g4*vect[kipy] + g5*hxp[1] + g6*f2; | |
1234 | vout[kipz] = vect[kipz] + g4*vect[kipz] + g5*hxp[2] + g6*f3; | |
1235 | ||
1236 | return; | |
1237 | } | |
1238 | ||
57ffa5fb | 1239 | //______________________________________________________________________________ |
d810d0de | 1240 | Int_t AliEveMUONTrack::ColorIndex(Float_t val) |
e19f3684 | 1241 | { |
1242 | // | |
1243 | // returns color index in the palette for a give value | |
1244 | // | |
1245 | ||
1246 | Float_t threshold = 0.0; | |
1247 | Float_t maxVal = 2.0; | |
1248 | ||
1249 | Float_t div = TMath::Max(1, (Int_t)(maxVal - threshold)); | |
1250 | Int_t nCol = gStyle->GetNumberOfColors(); | |
1251 | Int_t cBin = (Int_t) TMath::Nint(nCol*(val - threshold)/div); | |
1252 | ||
1253 | return gStyle->GetColorPalette(TMath::Min(nCol - 1, cBin)); | |
1254 | ||
1255 | } |