3 #include <Alieve/EventAlieve.h>
6 #include <AliMagFMaps.h>
8 #include <AliESDMuonTrack.h>
9 #include <AliTrackReference.h>
10 #include <AliESDEvent.h>
11 #include <AliESDVertex.h>
12 #include <AliRunLoader.h>
15 #include <AliMUONTrack.h>
16 #include <AliMUONTriggerTrack.h>
17 #include <AliMUONTrackParam.h>
18 #include <AliMUONConstants.h>
20 #include <TClonesArray.h>
25 #include <TParticle.h>
26 #include <TParticlePDG.h>
28 #include <Riostream.h>
29 using namespace Alieve;
31 //______________________________________________________________________
33 // Produce TEveUtil:TEveTrack from AliMUONTrack with dipole field model
37 AliMagF* MUONTrack::fFieldMap = 0;
39 //______________________________________________________________________
40 MUONTrack::MUONTrack(TEveRecTrack* t, TEveTrackPropagator* rs) :
46 fIsMUONTriggerTrack(kFALSE),
55 fFieldMap = Alieve::Event::AssertMagField();
59 //______________________________________________________________________
60 MUONTrack::~MUONTrack()
66 if (fIsRefTrack || fIsESDTrack) delete fTrack;
67 if (fIsMCTrack) delete fPart;
71 //______________________________________________________________________
72 void MUONTrack::PrintMCTrackInfo()
75 // information about the MC particle
81 cout << " ! no particle ..." << endl;
86 cout << " MC track parameters at vertex" << endl;
87 cout << " -------------------------------------------------------------------------------------" << endl;
88 cout << " PDG code Vx Vy Vz Px Py Pz " << endl;
91 setw(8) << setprecision(0) <<
92 fPart->GetPdgCode() << " " <<
93 setw(8) << setprecision(3) <<
95 setw(8) << setprecision(3) <<
97 setw(8) << setprecision(3) <<
99 setw(8) << setprecision(3) <<
100 fPart->Px() << " " <<
101 setw(8) << setprecision(3) <<
102 fPart->Py() << " " <<
103 setw(8) << setprecision(4) <<
104 fPart->Pz() << " " <<
108 pt = TMath::Sqrt(fPart->Px()*fPart->Px()+fPart->Py()*fPart->Py());
109 p = TMath::Sqrt(fPart->Px()*fPart->Px()+fPart->Py()*fPart->Py()+fPart->Pz()*fPart->Pz());
113 setw(8) << setprecision(3) <<
114 pt << " GeV/c" << endl;
117 setw(8) << setprecision(4) <<
118 p << " GeV/c" << endl;
122 //______________________________________________________________________
123 void MUONTrack::PrintMUONTrackInfo()
126 // information about the reconstructed/reference track; at hits and at vertex
129 Double_t RADDEG = 180.0/TMath::Pi();
132 Float_t pt, bc, nbc, zc;
133 AliMUONTrackParam *mtp;
134 TClonesArray *trackParamAtCluster;
137 cout << " ! no reconstructed track ..." << endl;
143 cout << " TEveTrack number " << fLabel << endl;
144 cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl;
146 cout << " Number of clusters " << fTrack->GetNClusters() << endl;
147 cout << " Match to trigger " << fTrack->GetMatchTrigger() << endl;
148 if (fTrack->GetMatchTrigger()) {
149 cout << " Chi2 tracking-trigger " << fTrack->GetChi2MatchTrigger() << endl;
150 cout << " Local trigger number " << fTrack->GetLoTrgNum() << endl;
156 cout << " TEveTrack reference number " << fLabel << endl;
157 cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl;
159 cout << " Number of clusters " << fTrack->GetNClusters() << endl;
162 trackParamAtCluster = fTrack->GetTrackParamAtCluster();
163 nparam = trackParamAtCluster->GetEntries();
166 cout << " trackParamAtCluster entries " << nparam << "" << endl;
167 cout << " ---------------------------------------------------------------------------------------------------------------------------------" << endl;
168 cout << " Number InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz P" << endl;
170 for (Int_t i = 0; i < nparam; i++) {
172 mtp = (AliMUONTrackParam*)trackParamAtCluster->At(i);
175 setw(9)<< setprecision(3) <<
178 setw(8) << setprecision(3) <<
179 mtp->GetInverseBendingMomentum() << " " <<
181 setw(8) << setprecision(3) <<
182 mtp->GetBendingSlope()*RADDEG << " " <<
184 setw(8) << setprecision(3) <<
185 mtp->GetNonBendingSlope()*RADDEG << " " <<
187 setw(8) << setprecision(4) <<
188 mtp->GetBendingCoor() << " " <<
190 setw(8) << setprecision(4) <<
191 mtp->GetNonBendingCoor() << " " <<
193 setw(10) << setprecision(6) <<
194 mtp->GetZ() << " " <<
196 setw(8) << setprecision(4) <<
199 setw(8) << setprecision(4) <<
202 setw(8) << setprecision(4) <<
205 setw(8) << setprecision(4) <<
213 cout << " TEveTrack parameters at vertex" << endl;
214 cout << " --------------------------------------------------------------------------------------------------------------------" << endl;
215 cout << " InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz P" << endl;
217 mtp = (AliMUONTrackParam*)fTrack->GetTrackParamAtVertex();
219 bc = mtp->GetBendingCoor();
220 nbc = mtp->GetNonBendingCoor();
222 if (bc < 0.001) bc = 0.0;
223 if (nbc < 0.001) nbc = 0.0;
224 if (zc < 0.001) zc = 0.0;
227 setw(8) << setprecision(3) <<
228 mtp->GetInverseBendingMomentum() << " " <<
230 setw(8) << setprecision(3) <<
231 mtp->GetBendingSlope()*RADDEG << " " <<
233 setw(8) << setprecision(3) <<
234 mtp->GetNonBendingSlope()*RADDEG << " " <<
236 setw(8) << setprecision(4) <<
239 setw(8) << setprecision(4) <<
242 setw(10) << setprecision(6) <<
245 setw(8) << setprecision(4) <<
248 setw(8) << setprecision(4) <<
251 setw(8) << setprecision(4) <<
254 setw(8) << setprecision(4) <<
259 pt = TMath::Sqrt(mtp->Px()*mtp->Px()+mtp->Py()*mtp->Py());
263 setw(8) << setprecision(3) <<
264 pt << " GeV/c" << endl;
268 //______________________________________________________________________
269 void MUONTrack::PrintMUONTriggerTrackInfo()
272 // information about the trigger track
275 // Double_t RADDEG = 180.0/TMath::Pi();
279 //______________________________________________________________________
280 void MUONTrack::PrintESDTrackInfo()
283 // information about the reconstructed ESD track at vertex
286 Double_t RADDEG = 180.0/TMath::Pi();
289 AliMUONTrackParam *mtp = (AliMUONTrackParam*)fTrack->GetTrackParamAtVertex();
292 cout << " ESD muon track " << endl;
293 cout << " -----------------------------------------------------------------------------------------------------------" << endl;
294 cout << " InvBendMom BendSlope NonBendSlope BendCoord NonBendCoord Z Px Py Pz" << endl;
298 setw(8) << setprecision(4) <<
299 mtp->GetInverseBendingMomentum() << " " <<
301 setw(8) << setprecision(3) <<
302 mtp->GetBendingSlope()*RADDEG << " " <<
304 setw(8) << setprecision(3) <<
305 mtp->GetNonBendingSlope()*RADDEG << " " <<
307 setw(8) << setprecision(4) <<
308 mtp->GetBendingCoor() << " " <<
310 setw(8) << setprecision(4) <<
311 mtp->GetNonBendingCoor() << " " <<
313 setw(10) << setprecision(6) <<
314 mtp->GetZ() << " " <<
316 setw(8) << setprecision(3) <<
319 setw(8) << setprecision(3) <<
322 setw(8) << setprecision(3) <<
327 pt = TMath::Sqrt(mtp->Px()*mtp->Px()+mtp->Py()*mtp->Py());
331 setw(8) << setprecision(3) <<
332 pt << " GeV/c" << endl;
335 setw(8) << setprecision(4) <<
336 mtp->P() << " GeV/c" << endl;
338 AliESDEvent* esd = Alieve::Event::AssertESD();
340 Double_t spdVertexX = 0;
341 Double_t spdVertexY = 0;
342 Double_t spdVertexZ = 0;
343 Double_t esdVertexX = 0;
344 Double_t esdVertexY = 0;
345 Double_t esdVertexZ = 0;
347 AliESDVertex* spdVertex = (AliESDVertex*) esd->GetVertex();
348 if (spdVertex->GetNContributors()) {
349 spdVertexZ = spdVertex->GetZv();
350 spdVertexY = spdVertex->GetYv();
351 spdVertexX = spdVertex->GetXv();
354 AliESDVertex* esdVertex = (AliESDVertex*) esd->GetPrimaryVertex();
355 if (esdVertex->GetNContributors()) {
356 esdVertexZ = esdVertex->GetZv();
357 esdVertexY = esdVertex->GetYv();
358 esdVertexX = esdVertex->GetXv();
361 Float_t t0v = esd->GetT0zVertex();
365 cout << "External vertex SPD: " <<
367 spdVertex->GetNContributors() << " " <<
368 setw(8) << setprecision(3) <<
371 spdVertexZ << " " << endl;
372 cout << "External vertex ESD: " <<
374 esdVertex->GetNContributors() << " " <<
375 setw(8) << setprecision(3) <<
378 esdVertexZ << " " << endl;
379 cout << "External vertex T0: " <<
380 setw(8) << setprecision(3) <<
385 //______________________________________________________________________
386 void MUONTrack::MUONTrackInfo()
396 if (fIsMUONTrack || fIsRefTrack) {
397 PrintMUONTrackInfo();
404 if (fIsMUONTriggerTrack) {
405 PrintMUONTriggerTrackInfo();
411 cout << " (slopes [deg], coord [cm], p [GeV/c])" << endl;
415 //______________________________________________________________________
416 void MUONTrack::MUONTriggerInfo()
423 TEveUtil::LoadMacro("MUON_trigger_info.C");
424 gROOT->ProcessLine(Form("MUON_trigger_info(%d);", fLabel));
427 cout << "This is a reference track!" << endl;
430 cout << "This is a Monte-Carlo track!" << endl;
434 AliESDEvent* esd = Alieve::Event::AssertESD();
435 ULong64_t triggerMask = esd->GetTriggerMask();
438 cout << ">>>>>#########################################################################################################################" << endl;
441 cout << " ESD track trigger info" << endl;
442 cout << " -----------------------------------------------------" << endl;
445 cout << " Match to trigger " << fTrack->GetMatchTrigger() << endl;
447 cout << " ESD trigger mask = " << triggerMask << endl;
450 cout << "#########################################################################################################################<<<<<" << endl;
457 //______________________________________________________________________
458 void MUONTrack::MakeMUONTrack(AliMUONTrack *mtrack)
461 // builds the track with dipole field
465 fIsMUONTrack = kTRUE;
470 fTrack = new AliMUONTrack(*mtrack);
474 Float_t ax, bx, ay, by;
475 Float_t xr[28], yr[28], zr[28];
476 Float_t xrc[28], yrc[28], zrc[28];
479 TMatrixD smatrix(2,2);
487 // middle z between the two detector planes of the trigger chambers
488 Float_t zg[4] = { -1603.5, -1620.5, -1703.5, -1720.5 };
491 Float_t pv[3] = { 0.0 };
494 if (mtrack->GetMatchTrigger()) {
495 sprintf(form,"MUONTrack %2d (MT)", fLabel);
497 sprintf(form,"MUONTrack %2d ", fLabel);
503 AliMUONTrackParam *trackParam = mtrack->GetTrackParamAtVertex();
504 xRec0 = trackParam->GetNonBendingCoor();
505 yRec0 = trackParam->GetBendingCoor();
506 zRec0 = trackParam->GetZ();
509 SetPoint(fCount,xRec0,yRec0,zRec0);
513 for (Int_t i = 0; i < 28; i++) xr[i]=yr[i]=zr[i]=0.0;
515 Int_t nTrackHits = mtrack->GetNClusters();
517 Bool_t hitChamber[14] = {kFALSE};
519 TClonesArray* trackParamAtCluster = mtrack->GetTrackParamAtCluster();
521 for (Int_t iHit = 0; iHit < nTrackHits; iHit++){
523 trackParam = (AliMUONTrackParam*) trackParamAtCluster->At(iHit);
527 pt = TMath::Sqrt(trackParam->Px()*trackParam->Px()+trackParam->Py()*trackParam->Py());
528 SetLineColor(ColorIndex(pt));
530 pv[0] = trackParam->Px();
531 pv[1] = trackParam->Py();
532 pv[2] = trackParam->Pz();
536 xRec = trackParam->GetNonBendingCoor();
537 yRec = trackParam->GetBendingCoor();
538 zRec = trackParam->GetZ();
540 iCha = AliMUONConstants::ChamberNumber(zRec);
546 hitChamber[iCha] = kTRUE;
550 Int_t crntCha, lastHitSt12, firstHitSt3, lastHitSt3, firstHitSt45;
552 if (fIsMUONTrack) nTrackHits = 10;
558 for (Int_t iHit = 0; iHit < nTrackHits; iHit++) {
559 crntCha = AliMUONConstants::ChamberNumber(zr[iHit]);
560 if (hitChamber[crntCha] && crntCha >= 0 && crntCha <= 3) {
563 if (hitChamber[crntCha] && crntCha >= 4 && crntCha <= 5) {
564 if (firstHitSt3 == -1) firstHitSt3 = iHit;
567 if (hitChamber[crntCha] && crntCha >= 6 && crntCha <= 9) {
568 if (firstHitSt45 == -1) firstHitSt45 = iHit;
572 if (lastHitSt12 >= 0) {
573 for (Int_t iHit = 0; iHit <= lastHitSt12; iHit++) {
574 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
577 if (firstHitSt3 >= 0) {
578 Propagate(xr,yr,zr,lastHitSt12,firstHitSt3);
579 SetPoint(fCount,xr[firstHitSt3],yr[firstHitSt3],zr[firstHitSt3]);
581 if (lastHitSt3 >= 0) {
582 SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]);
584 if (firstHitSt45 >= 0) {
585 Propagate(xr,yr,zr,lastHitSt3,firstHitSt45);
586 for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) {
587 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
591 Propagate(xr,yr,zr,lastHitSt3,9999);
593 } else if (firstHitSt45 >= 0) {
594 Propagate(xr,yr,zr,firstHitSt3,firstHitSt45);
595 for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) {
596 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
600 Propagate(xr,yr,zr,firstHitSt3,9999);
602 } else if (lastHitSt3 >= 0) {
603 Propagate(xr,yr,zr,lastHitSt12,lastHitSt3);
604 SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]);
606 if (firstHitSt45 >= 0) {
607 Propagate(xr,yr,zr,lastHitSt3,firstHitSt45);
608 for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) {
609 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
613 Propagate(xr,yr,zr,lastHitSt3,9999);
615 } else if (firstHitSt45 >= 0){
616 Propagate(xr,yr,zr,lastHitSt12,firstHitSt45);
617 for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) {
618 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
622 Propagate(xr,yr,zr,lastHitSt12,9999);
624 } else if (firstHitSt3 >= 0) {
625 SetPoint(fCount,xr[firstHitSt3],yr[firstHitSt3],zr[firstHitSt3]);
627 if (lastHitSt3 >= 0) {
628 SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]);
631 Propagate(xr,yr,zr,lastHitSt3,firstHitSt45);
632 for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) {
633 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
637 Propagate(xr,yr,zr,lastHitSt3,9999);
639 } else if (firstHitSt45 >= 0) {
640 Propagate(xr,yr,zr,firstHitSt3,firstHitSt45);
641 for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) {
642 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
646 Propagate(xr,yr,zr,firstHitSt3,9999);
648 } else if (lastHitSt3 >= 0) {
649 SetPoint(fCount,xr[lastHitSt3],yr[lastHitSt3],zr[lastHitSt3]);
651 if (firstHitSt45 >= 0) {
652 Propagate(xr,yr,zr,lastHitSt3,firstHitSt45);
653 for (Int_t iHit = firstHitSt45; iHit < nTrackHits; iHit++) {
654 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
658 Propagate(xr,yr,zr,lastHitSt3,9999);
661 for (Int_t iHit = 0; iHit < nTrackHits; iHit++) {
662 SetPoint(fCount,xr[iHit],yr[iHit],zr[iHit]);
667 if (!fIsMUONTrack) return;
670 if (mtrack->GetMatchTrigger() && 1) {
672 for (Int_t i = 0; i < nTrackHits; i++) {
673 if (TMath::Abs(zr[i]) > 1000.0) {
674 //printf("TEveHit %d x %f y %f z %f \n",iHit,xr[i],yr[i],zr[i]);
687 for (Int_t i = 0; i < nrc; i++) {
688 xv = (Double_t)zrc[i];
689 yv = (Double_t)xrc[i];
690 //printf("x-z: xv %f yv %f \n",xv,yv);
692 smatrix(1,1) += xv*xv;
698 res = smatrix.Invert() * sums;
705 for (Int_t i = 0; i < nrc; i++) {
706 xv = (Double_t)zrc[i];
707 yv = (Double_t)yrc[i];
708 //printf("y-z: xv %f yv %f \n",xv,yv);
710 smatrix(1,1) += xv*xv;
716 res = smatrix.Invert() * sums;
720 Float_t xtc, ytc, ztc;
721 for (Int_t ii = 0; ii < 4; ii++) {
727 //printf("tc: x %f y %f z %f \n",xtc,ytc,ztc);
729 SetPoint(fCount,xtc,ytc,ztc);
734 } // end match trigger
738 //______________________________________________________________________
739 void MUONTrack::MakeMUONTriggerTrack(AliMUONTriggerTrack *mtrack)
742 // builds the trigger track from one point and direction
745 Float_t x1 = mtrack->GetX11();
746 Float_t y1 = mtrack->GetY11();
747 Float_t thex = mtrack->GetThetax();
748 Float_t they = mtrack->GetThetay();
750 Float_t z11 = -1600.0;
751 Float_t z22 = -1724.0;
752 Float_t dz = z22-z11;
754 Float_t x2 = x1 + dz*TMath::Tan(thex);
755 Float_t y2 = y1 + dz*TMath::Tan(they);
757 SetPoint(fCount,x1,y1,z11); fCount++;
758 SetPoint(fCount,x2,y2,z22); fCount++;
762 sprintf(form,"MUONTriggerTrack %2d",mtrack->GetLoTrgNum());
768 //______________________________________________________________________
769 void MUONTrack::MakeESDTrack(AliESDMuonTrack *mtrack)
772 // builds the track with dipole field starting from the TParticle
777 fTrack = new AliMUONTrack();
778 AliMUONTrackParam trackParam;
779 trackParam.GetParamFrom(*mtrack);
780 fTrack->SetTrackParamAtVertex(&trackParam);
781 fTrack->SetMatchTrigger(mtrack->GetMatchTrigger());
784 sprintf(form,"ESDTrack %2d ", fLabel);
789 Double_t vect[7], vout[7];
792 Int_t charge = (Int_t)TMath::Sign(1.0,trackParam.GetInverseBendingMomentum());
794 pv[0] = trackParam.Px();
795 pv[1] = trackParam.Py();
796 pv[2] = trackParam.Pz();
799 vect[0] = trackParam.GetNonBendingCoor();
800 vect[1] = trackParam.GetBendingCoor();
801 vect[2] = trackParam.GetZ();
802 vect[3] = trackParam.Px()/trackParam.P();
803 vect[4] = trackParam.Py()/trackParam.P();
804 vect[5] = trackParam.Pz()/trackParam.P();
805 vect[6] = trackParam.P();
807 //cout << "vertex " << vect[0] << " " << vect[1] << " " << vect[2] << " " << endl;
809 Double_t zMax = -1750.0;
810 Double_t rMax = 350.0;
814 while ((vect[2] > zMax) && (nSteps < 10000) && (r < rMax)) {
816 OneStepRungekutta(charge, step, vect, vout);
817 SetPoint(fCount,vout[0],vout[1],vout[2]);
819 for (Int_t i = 0; i < 7; i++) {
822 r = TMath::Sqrt(vect[0]*vect[0]+vect[1]*vect[1]);
827 //______________________________________________________________________
828 void MUONTrack::MakeMCTrack(TParticle *part)
831 // builds the track with dipole field starting from the TParticle
836 fPart = new TParticle(*part);
839 sprintf(form,"TEveMCTrack %2d ", fLabel);
844 Double_t vect[7], vout[7];
853 vect[0] = fPart->Vx();
854 vect[1] = fPart->Vy();
855 vect[2] = fPart->Vz();
856 vect[3] = fPart->Px()/fPart->P();
857 vect[4] = fPart->Py()/fPart->P();
858 vect[5] = fPart->Pz()/fPart->P();
859 vect[6] = fPart->P();
861 TParticlePDG *ppdg = fPart->GetPDG(1);
862 Int_t charge = (Int_t)(ppdg->Charge()/3.0);
864 Double_t zMax = -1750.0;
865 Double_t rMax = 350.0;
869 while ((vect[2] > zMax) && (nSteps < 10000) && (r < rMax)) {
871 OneStepRungekutta(charge, step, vect, vout);
872 SetPoint(fCount,vout[0],vout[1],vout[2]);
874 for (Int_t i = 0; i < 7; i++) {
877 r = TMath::Sqrt(vect[0]*vect[0]+vect[1]*vect[1]);
882 //______________________________________________________________________
883 void MUONTrack::MakeRefTrack(AliMUONTrack *mtrack)
886 // builds the track with dipole field starting from the TParticle
892 sprintf(form,"RefTrack %2d ", fLabel);
897 MakeMUONTrack(mtrack);
901 //______________________________________________________________________
902 void MUONTrack::Propagate(Float_t *xr, Float_t *yr, Float_t *zr, Int_t i1, Int_t i2)
905 // propagate in magnetic field between hits of indices i1 and i2
908 Double_t vect[7], vout[7];
912 AliMUONTrackParam *trackParam = 0;
913 TClonesArray *trackParamAtCluster = 0;
916 zMax = zr[i1]+1.5*step;
918 zMax = zr[i2]+1.5*step;
921 trackParamAtCluster = fTrack->GetTrackParamAtCluster();
924 trackParam = (AliMUONTrackParam*)trackParamAtCluster->At(i1);
925 charge = (Int_t)TMath::Sign(1.0,trackParam->GetInverseBendingMomentum());
928 trackParam = fTrack->GetTrackParamAtVertex();
929 charge = (Int_t)TMath::Sign(1.0,trackParam->GetInverseBendingMomentum());
930 trackParam = (AliMUONTrackParam*)trackParamAtCluster->At(i1);
936 vect[3] = trackParam->Px()/trackParam->P();
937 vect[4] = trackParam->Py()/trackParam->P();
938 vect[5] = trackParam->Pz()/trackParam->P();
939 vect[6] = trackParam->P();
942 while ((vect[2] > zMax) && (nSteps < 10000)) {
944 OneStepRungekutta(charge, step, vect, vout);
945 SetPoint(fCount,vout[0],vout[1],vout[2]);
947 for (Int_t i = 0; i < 7; i++) {
954 //______________________________________________________________________
955 void MUONTrack::GetField(Double_t *position, Double_t *field)
958 // returns field components at position, for a give field map
961 /// interface for arguments in double precision (Why ? ChF)
964 x[0] = position[0]; x[1] = position[1]; x[2] = position[2];
967 fFieldMap->Field(x,b);
970 AliWarning("No field map");
971 field[0] = field[1] = field[2] = 0.0;
979 field[0] = b[0]; field[1] = b[1]; field[2] = b[2];
985 //______________________________________________________________________
986 void MUONTrack::OneStepRungekutta(Double_t charge, Double_t step,
987 Double_t* vect, Double_t* vout)
989 /// ******************************************************************
991 /// * Runge-Kutta method for tracking a particle through a magnetic *
992 /// * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of *
993 /// * Standards, procedure 25.5.20) *
995 /// * Input parameters *
996 /// * CHARGE Particle charge *
997 /// * STEP Step size *
998 /// * VECT Initial co-ords,direction cosines,momentum *
999 /// * Output parameters *
1000 /// * VOUT Output co-ords,direction cosines,momentum *
1001 /// * User routine called *
1002 /// * CALL GUFLD(X,F) *
1004 /// * ==>Called by : <USER>, GUSWIM *
1005 /// * Authors R.Brun, M.Hansroul ********* *
1006 /// * V.Perevoztchikov (CUT STEP implementation) *
1009 /// ******************************************************************
1011 Double_t h2, h4, f[4];
1012 Double_t xyzt[3], a, b, c, ph,ph2;
1013 Double_t secxs[4],secys[4],seczs[4],hxp[3];
1014 Double_t g1, g2, g3, g4, g5, g6, ang2, dxt, dyt, dzt;
1015 Double_t est, at, bt, ct, cba;
1016 Double_t f1, f2, f3, f4, rho, tet, hnorm, hp, rho1, sint, cost;
1026 Double_t maxit = 1992;
1027 Double_t maxcut = 11;
1029 const Double_t kdlt = 1e-4;
1030 const Double_t kdlt32 = kdlt/32.;
1031 const Double_t kthird = 1./3.;
1032 const Double_t khalf = 0.5;
1033 const Double_t kec = 2.9979251e-4;
1035 const Double_t kpisqua = 9.86960440109;
1036 const Int_t kix = 0;
1037 const Int_t kiy = 1;
1038 const Int_t kiz = 2;
1039 const Int_t kipx = 3;
1040 const Int_t kipy = 4;
1041 const Int_t kipz = 5;
1044 // *. ------------------------------------------------------------------
1046 // * this constant is for units cm,gev/c and kgauss
1050 for(Int_t j = 0; j < 7; j++)
1053 Double_t pinv = kec * charge / vect[6];
1061 if (TMath::Abs(h) > TMath::Abs(rest)) h = rest;
1062 //cmodif: call gufld(vout,f) changed into:
1067 // * start of integration
1080 secxs[0] = (b * f[2] - c * f[1]) * ph2;
1081 secys[0] = (c * f[0] - a * f[2]) * ph2;
1082 seczs[0] = (a * f[1] - b * f[0]) * ph2;
1083 ang2 = (secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0]);
1084 if (ang2 > kpisqua) break;
1086 dxt = h2 * a + h4 * secxs[0];
1087 dyt = h2 * b + h4 * secys[0];
1088 dzt = h2 * c + h4 * seczs[0];
1093 // * second intermediate point
1096 est = TMath::Abs(dxt) + TMath::Abs(dyt) + TMath::Abs(dzt);
1098 if (ncut++ > maxcut) break;
1107 //cmodif: call gufld(xyzt,f) changed into:
1114 secxs[1] = (bt * f[2] - ct * f[1]) * ph2;
1115 secys[1] = (ct * f[0] - at * f[2]) * ph2;
1116 seczs[1] = (at * f[1] - bt * f[0]) * ph2;
1120 secxs[2] = (bt * f[2] - ct * f[1]) * ph2;
1121 secys[2] = (ct * f[0] - at * f[2]) * ph2;
1122 seczs[2] = (at * f[1] - bt * f[0]) * ph2;
1123 dxt = h * (a + secxs[2]);
1124 dyt = h * (b + secys[2]);
1125 dzt = h * (c + seczs[2]);
1129 at = a + 2.*secxs[2];
1130 bt = b + 2.*secys[2];
1131 ct = c + 2.*seczs[2];
1133 est = TMath::Abs(dxt)+TMath::Abs(dyt)+TMath::Abs(dzt);
1134 if (est > 2.*TMath::Abs(h)) {
1135 if (ncut++ > maxcut) break;
1144 //cmodif: call gufld(xyzt,f) changed into:
1147 z = z + (c + (seczs[0] + seczs[1] + seczs[2]) * kthird) * h;
1148 y = y + (b + (secys[0] + secys[1] + secys[2]) * kthird) * h;
1149 x = x + (a + (secxs[0] + secxs[1] + secxs[2]) * kthird) * h;
1151 secxs[3] = (bt*f[2] - ct*f[1])* ph2;
1152 secys[3] = (ct*f[0] - at*f[2])* ph2;
1153 seczs[3] = (at*f[1] - bt*f[0])* ph2;
1154 a = a+(secxs[0]+secxs[3]+2. * (secxs[1]+secxs[2])) * kthird;
1155 b = b+(secys[0]+secys[3]+2. * (secys[1]+secys[2])) * kthird;
1156 c = c+(seczs[0]+seczs[3]+2. * (seczs[1]+seczs[2])) * kthird;
1158 est = TMath::Abs(secxs[0]+secxs[3] - (secxs[1]+secxs[2]))
1159 + TMath::Abs(secys[0]+secys[3] - (secys[1]+secys[2]))
1160 + TMath::Abs(seczs[0]+seczs[3] - (seczs[1]+seczs[2]));
1162 if (est > kdlt && TMath::Abs(h) > 1.e-4) {
1163 if (ncut++ > maxcut) break;
1169 // * if too many iterations, go to helix
1170 if (iter++ > maxit) break;
1175 cba = 1./ TMath::Sqrt(a*a + b*b + c*c);
1183 if (step < 0.) rest = -rest;
1184 if (rest < 1.e-5*TMath::Abs(step)) return;
1188 // angle too big, use helix
1193 f4 = TMath::Sqrt(f1*f1+f2*f2+f3*f3);
1202 hxp[0] = f2*vect[kipz] - f3*vect[kipy];
1203 hxp[1] = f3*vect[kipx] - f1*vect[kipz];
1204 hxp[2] = f1*vect[kipy] - f2*vect[kipx];
1206 hp = f1*vect[kipx] + f2*vect[kipy] + f3*vect[kipz];
1209 sint = TMath::Sin(tet);
1210 cost = 2.*TMath::Sin(khalf*tet)*TMath::Sin(khalf*tet);
1214 g3 = (tet-sint) * hp*rho1;
1219 vout[kix] = vect[kix] + g1*vect[kipx] + g2*hxp[0] + g3*f1;
1220 vout[kiy] = vect[kiy] + g1*vect[kipy] + g2*hxp[1] + g3*f2;
1221 vout[kiz] = vect[kiz] + g1*vect[kipz] + g2*hxp[2] + g3*f3;
1223 vout[kipx] = vect[kipx] + g4*vect[kipx] + g5*hxp[0] + g6*f1;
1224 vout[kipy] = vect[kipy] + g4*vect[kipy] + g5*hxp[1] + g6*f2;
1225 vout[kipz] = vect[kipz] + g4*vect[kipz] + g5*hxp[2] + g6*f3;
1230 //______________________________________________________________________
1231 Int_t MUONTrack::ColorIndex(Float_t val)
1234 // returns color index in the palette for a give value
1237 Float_t threshold = 0.0;
1238 Float_t maxVal = 2.0;
1240 Float_t div = TMath::Max(1, (Int_t)(maxVal - threshold));
1241 Int_t nCol = gStyle->GetNumberOfColors();
1242 Int_t cBin = (Int_t) TMath::Nint(nCol*(val - threshold)/div);
1244 return gStyle->GetColorPalette(TMath::Min(nCol - 1, cBin));