1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //#include <Riostream.h>
23 #include "AliTracker.h"
24 #include "AliESDtrack.h"
26 #include "AliTRDgeometry.h"
27 #include "AliTRDcluster.h"
28 #include "AliTRDtrack.h"
29 //#include "AliTRDtracklet.h"
30 #include "AliTRDcalibDB.h"
31 #include "Cal/AliTRDCalPID.h"
35 ///////////////////////////////////////////////////////////////////////////////
37 // Represents a reconstructed TRD track //
38 // Local TRD Kalman track //
40 ///////////////////////////////////////////////////////////////////////////////
42 //_____________________________________________________________________________
43 AliTRDtrack::AliTRDtrack()
48 ,fClusterOwner(kFALSE)
63 // AliTRDtrack default constructor
66 for (Int_t i = 0; i < kNplane; i++) {
67 for (Int_t j = 0; j < kNslice; j++) {
68 fdEdxPlane[i][j] = 0.0;
76 for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
83 for (Int_t i = 0; i < 3; i++) {
89 //_____________________________________________________________________________
90 AliTRDtrack::AliTRDtrack(AliTRDcluster *c, Int_t index
91 , const Double_t p[5], const Double_t cov[15]
92 , Double_t x, Double_t alpha)
97 ,fClusterOwner(kFALSE)
112 // The main AliTRDtrack constructor.
115 Double_t cnv = 1.0 / (GetBz() * kB2C);
117 Double_t pp[5] = { p[0]
123 Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5];
124 Double_t c32 = x*cov[13] - cov[ 8];
125 Double_t c20 = x*cov[10] - cov[ 3];
126 Double_t c21 = x*cov[11] - cov[ 4];
127 Double_t c42 = x*cov[14] - cov[12];
129 Double_t cc[15] = { cov[ 0]
132 , cov[ 6], cov[ 7], c32, cov[ 9]
133 , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv };
136 SetNumberOfClusters(1);
140 for (Int_t i = 0; i < kNplane; i++) {
141 for (Int_t j = 0; j < kNslice; j++) {
142 fdEdxPlane[i][j] = 0.0;
144 fTimBinPlane[i] = -1;
150 Double_t q = TMath::Abs(c->GetQ());
151 Double_t s = GetSnp();
152 Double_t t = GetTgl();
154 q *= TMath::Sqrt((1-s*s)/(1+t*t));
158 for (UInt_t i = 1; i < kMAXCLUSTERSPERTRACK; i++) {
165 for (Int_t i = 0; i < 3;i++) {
171 //_____________________________________________________________________________
172 AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
174 ,fSeedLab(t.GetSeedLabel())
177 ,fClusterOwner(kTRUE)
178 ,fPIDmethod(t.fPIDmethod)
179 ,fStopped(t.fStopped)
182 ,fNRotate(t.fNRotate)
184 ,fNExpected(t.fNExpected)
186 ,fNExpectedLast(t.fNExpectedLast)
188 ,fChi2Last(t.fChi2Last)
195 for (Int_t i = 0; i < kNplane; i++) {
196 for (Int_t j = 0; j < kNslice; j++) {
197 fdEdxPlane[i][j] = t.fdEdxPlane[i][j];
199 fTimBinPlane[i] = t.fTimBinPlane[i];
200 fTracklets[i] = t.fTracklets[i];
206 Int_t n = t.GetNumberOfClusters();
207 SetNumberOfClusters(n);
209 for (Int_t i = 0; i < n; i++) {
210 fIndex[i] = t.fIndex[i];
211 fIndexBackup[i] = t.fIndex[i];
212 fdQdl[i] = t.fdQdl[i];
213 if (fClusterOwner && t.fClusters[i]) {
214 fClusters[i] = new AliTRDcluster(*(t.fClusters[i]));
217 fClusters[i] = t.fClusters[i];
221 for (UInt_t i = n; i < kMAXCLUSTERSPERTRACK; i++) {
228 for (Int_t i = 0; i < 3;i++) {
229 fBudget[i] = t.fBudget[i];
234 //_____________________________________________________________________________
235 AliTRDtrack::AliTRDtrack(const AliKalmanTrack &t, Double_t /*alpha*/)
238 ,fdEdx(t.GetPIDsignal())
240 ,fClusterOwner(kFALSE)
255 // Constructor from AliTPCtrack or AliITStrack
258 SetLabel(t.GetLabel());
260 SetMass(t.GetMass());
261 SetNumberOfClusters(0);
263 for (Int_t i = 0; i < kNplane; i++) {
264 for (Int_t j = 0; j < kNslice; j++) {
265 fdEdxPlane[i][j] = 0.0;
267 fTimBinPlane[i] = -1;
273 for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
280 for (Int_t i = 0; i < 3; i++) {
286 //_____________________________________________________________________________
287 AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
290 ,fdEdx(t.GetTRDsignal())
292 ,fClusterOwner(kFALSE)
307 // Constructor from AliESDtrack
310 SetLabel(t.GetLabel());
312 SetMass(t.GetMass());
313 SetNumberOfClusters(t.GetTRDclusters(fIndex));
315 Int_t ncl = t.GetTRDclusters(fIndexBackup);
316 for (UInt_t i = ncl; i < kMAXCLUSTERSPERTRACK; i++) {
321 for (Int_t i = 0; i < kNplane; i++) {
322 for (Int_t j = 0; j < kNslice; j++) {
323 fdEdxPlane[i][j] = t.GetTRDsignals(i,j);
325 fTimBinPlane[i] = t.GetTRDTimBin(i);
331 const AliExternalTrackParam *par = &t;
332 if (t.GetStatus() & AliESDtrack::kTRDbackup) {
333 par = t.GetOuterParam();
335 AliError("No backup info!");
342 ,par->GetCovariance());
344 for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
349 for (Int_t i = 0; i < 3; i++) {
353 if ((t.GetStatus() & AliESDtrack::kTIME) == 0) {
359 t.GetIntegratedTimes(times);
360 SetIntegratedTimes(times);
361 SetIntegratedLength(t.GetIntegratedLength());
365 //____________________________________________________________________________
366 AliTRDtrack::~AliTRDtrack()
379 while ((icluster < kMAXCLUSTERSPERTRACK) && fClusters[icluster]) {
380 delete fClusters[icluster];
381 fClusters[icluster] = 0x0;
388 //____________________________________________________________________________
389 Float_t AliTRDtrack::StatusForTOF()
392 // Defines the status of the TOF extrapolation
395 // Definition of res ????
396 Float_t res = (0.2 + 0.8 * (fN / (fNExpected + 5.0)))
397 * (0.4 + 0.6 * fTracklets[5].GetN() / 20.0);
398 res *= (0.25 + 0.8 * 40.0 / (40.0 + fBudget[2]));
403 //_____________________________________________________________________________
404 Int_t AliTRDtrack::Compare(const TObject *o) const
407 // Compares tracks according to their Y2 or curvature
410 AliTRDtrack *t = (AliTRDtrack *) o;
412 Double_t co = TMath::Abs(t->GetC());
413 Double_t c = TMath::Abs(GetC());
426 //_____________________________________________________________________________
427 void AliTRDtrack::CookdEdx(Double_t low, Double_t up)
430 // Calculates the truncated dE/dx within the "low" and "up" cuts.
433 // Array to sort the dEdx values according to amplitude
434 Float_t sorted[kMAXCLUSTERSPERTRACK];
437 // Require at least 10 clusters for a dedx measurement
442 // Can fdQdl be negative ????
443 for (Int_t i = 0; i < fNdedx; i++) {
444 sorted[i] = TMath::Abs(fdQdl[i]);
446 // Sort the dedx values by amplitude
447 Int_t *index = new Int_t[fNdedx];
448 TMath::Sort(fNdedx, sorted, index, kFALSE);
450 // Sum up the truncated charge between lower and upper bounds
451 Int_t nl = Int_t(low * fNdedx);
452 Int_t nu = Int_t( up * fNdedx);
453 for (Int_t i = nl; i <= nu; i++) {
454 fdEdx += sorted[index[i]];
456 fdEdx /= (nu - nl + 1.0);
462 //_____________________________________________________________________________
463 void AliTRDtrack::CookdEdxTimBin(const Int_t/* tid*/)
466 // Set fdEdxPlane and fTimBinPlane and also get the
467 // Time bin for Max. Cluster
470 // Prashant Shukla (shukla@physi.uni-heidelberg.de)
471 // Alexandru Bercuci (A.Bercuci@gsi.de)
474 // Max charge in chamber
475 Double_t maxcharge[AliESDtrack::kNPlane];
476 // Number of clusters attached to track per chamber and slice
477 Int_t nCluster[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
478 // Number of time bins in chamber
479 Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
480 Int_t plane; // Plane of current cluster
481 Int_t tb; // Time bin of current cluster
482 Int_t slice; // Current slice
483 AliTRDcluster *cluster = 0x0; // Pointer to current cluster
485 // Reset class and local counters/variables
486 for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
487 fTimBinPlane[iPlane] = -1;
488 maxcharge[iPlane] = 0.0;
489 for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
490 fdEdxPlane[iPlane][iSlice] = 0.0;
491 nCluster[iPlane][iSlice] = 0;
495 // Start looping over clusters attached to this track
496 for (Int_t iClus = 0; iClus < GetNumberOfClusters(); iClus++) {
498 cluster = fClusters[iClus]; //(AliTRDcluster*)tracker->GetCluster(fIndex[iClus]);
499 if (!cluster) continue;
501 // Read info from current cluster
502 plane = AliTRDgeometry::GetPlane(cluster->GetDetector());
503 if (plane < 0 || plane >= AliESDtrack::kNPlane) {
504 AliError(Form("Wrong plane %d", plane));
508 tb = cluster->GetLocalTimeBin();
509 if ((tb == 0) || (tb >= ntb)) {
510 AliWarning(Form("time bin 0 or > %d in cluster %d", ntb, iClus));
511 AliInfo(Form("dQ/dl %f", fdQdl[iClus]));
515 slice = tb * AliESDtrack::kNSlice / ntb;
517 fdEdxPlane[plane][slice] += fdQdl[iClus];
518 if (fdQdl[iClus] > maxcharge[plane]) {
519 maxcharge[plane] = fdQdl[iClus];
520 fTimBinPlane[plane] = tb;
523 nCluster[plane][slice]++;
525 } // End of loop over cluster
527 // Normalize fdEdxPlane to number of clusters and set track segments
528 for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
529 for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
530 if (nCluster[iPlane][iSlice]) {
531 fdEdxPlane[iPlane][iSlice] /= nCluster[iPlane][iSlice];
538 //_____________________________________________________________________________
539 void AliTRDtrack::CookdEdxNN(Float_t *dedx)
542 // This function calcuates the input for the neural networks
543 // which are used for the PID.
546 //number of time bins in chamber
547 Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
549 Int_t plane; // plane of current cluster
550 Int_t tb; // time bin of current cluster
551 Int_t slice; // curent slice
552 AliTRDcluster *cluster = 0x0; // pointer to current cluster
553 const Int_t kMLPscale = 16000; // scaling of the MLP input to be smaller than 1
555 // Reset class and local contors/variables
556 for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++){
557 for (Int_t iSlice = 0; iSlice < kNMLPslice; iSlice++) {
558 *(dedx + (kNMLPslice * iPlane) + iSlice) = 0.0;
562 // Start looping over clusters attached to this track
563 for (Int_t iClus = 0; iClus < GetNumberOfClusters(); iClus++) {
565 cluster = fClusters[iClus]; //(AliTRDcluster*)tracker->GetCluster(fIndex[iClus]);
570 // Read info from current cluster
571 plane = AliTRDgeometry::GetPlane(cluster->GetDetector());
572 if (plane < 0 || plane >= AliESDtrack::kNPlane) {
573 AliError(Form("Wrong plane %d",plane));
577 tb = cluster->GetLocalTimeBin();
578 if (tb == 0 || tb >= ntb) {
579 AliWarning(Form("time bin 0 or > %d in cluster %d",ntb,iClus));
580 AliInfo(Form("dQ/dl %f",fdQdl[iClus]));
584 slice = tb * kNMLPslice / ntb;
586 *(dedx+(kNMLPslice * plane) + slice) += fdQdl[iClus]/kMLPscale;
588 } // End of loop over cluster
592 //_____________________________________________________________________________
593 void AliTRDtrack::SetTrackSegmentDirMom(const Int_t plane)
596 // Set the momenta for a track segment in a given plane
601 AliError(Form("Trying to access out of range plane (%d)", plane));
605 fSnp[plane] = GetSnp();
606 fTgl[plane] = GetTgl();
609 fMom[plane] = TMath::Sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2]);
613 //_____________________________________________________________________________
614 Float_t AliTRDtrack::GetTrackLengthPlane(Int_t plane) const
617 // Calculate the track length of a track segment in a given plane
621 (plane >= kNplane)) {
625 return (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick())
626 / TMath::Sqrt((1.0 - fSnp[plane]*fSnp[plane])
627 / (1.0 + fTgl[plane]*fTgl[plane]));
631 //_____________________________________________________________________________
632 Bool_t AliTRDtrack::CookPID(Int_t &pidQuality)
635 // This function calculates the PID probabilities based on TRD signals
637 // The method produces probabilities based on the charge
638 // and the position of the maximum time bin in each layer.
639 // The dE/dx information can be used as global charge or 2 to 3
640 // slices. Check AliTRDCalPID and AliTRDCalPIDRefMaker for the actual
644 // Alex Bercuci (A.Bercuci@gsi.de) 2nd May 2007
647 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
649 AliError("No access to calibration data");
653 // Retrieve the CDB container class with the probability distributions
654 const AliTRDCalPID *pd = calibration->GetPIDObject(fPIDmethod == kNN ? 0 : 1);
656 AliError("No access to AliTRDCalPID");
660 // Calculate the input for the NN if fPIDmethod is kNN
661 Float_t ldEdxNN[AliTRDCalPID::kNPlane * kNMLPslice], *dedx = 0x0;
662 if(fPIDmethod == kNN) {
663 CookdEdxNN(&ldEdxNN[0]);
666 // Sets the a priori probabilities
667 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
668 fPID[ispec] = 1.0 / AliPID::kSPECIES;
671 if(AliPID::kSPECIES != 5){
672 AliError("Probabilities array defined only for 5 values. Please modify !!");
677 Float_t length; // track segment length in chamber
679 // Skip tracks which have no TRD signal at all
680 if (fdEdx == 0.) return kFALSE;
682 for (Int_t iPlane = 0; iPlane < AliTRDgeometry::kNplan; iPlane++) {
684 length = (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick())
685 / TMath::Sqrt((1.0 - fSnp[iPlane]*fSnp[iPlane])
686 / (1.0 + fTgl[iPlane]*fTgl[iPlane]));
689 if((fdEdxPlane[iPlane][0] + fdEdxPlane[iPlane][1] + fdEdxPlane[iPlane][2]) <= 0.
690 || fTimBinPlane[iPlane] == -1.) continue;
692 // this track segment has fulfilled all requierments
695 // Get the probabilities for the different particle species
696 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
699 dedx = fdEdxPlane[iPlane];
702 dedx = &ldEdxNN[iPlane*kNMLPslice];
705 fPID[iSpecies] *= pd->GetProbability(iSpecies, fMom[iPlane], dedx, length, iPlane);
710 if (pidQuality == 0) {
714 // normalize probabilities
715 Double_t probTotal = 0.0;
716 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
717 probTotal += fPID[iSpecies];
720 if (probTotal <= 0.0) {
721 AliWarning("The total probability over all species <= 0.");
722 AliWarning("This may be caused by some error in the reference histograms.");
726 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
727 fPID[iSpecies] /= probTotal;
734 //_____________________________________________________________________________
735 Bool_t AliTRDtrack::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
738 // Propagates this track to a reference plane defined by "xk" [cm]
739 // correcting for the mean crossed material.
741 // "xx0" - thickness/rad.length [units of the radiation length]
742 // "xrho" - thickness*density [g/cm^2]
749 Double_t oldX = GetX();
750 Double_t oldY = GetY();
751 Double_t oldZ = GetZ();
753 Double_t bz = GetBz();
755 if (!AliExternalTrackParam::PropagateTo(xk,bz)) {
765 if (IsStartedTimeIntegral()) {
766 Double_t l2 = TMath::Sqrt((x-oldX)*(x-oldX)
768 + (z-oldZ)*(z-oldZ));
769 Double_t crv = GetC();
770 if (TMath::Abs(l2*crv) > 0.0001) {
771 // Make correction for curvature if neccesary
772 l2 = 0.5 * TMath::Sqrt((x-oldX)*(x-oldX)
773 + (y-oldY)*(y-oldY));
774 l2 = 2.0 * TMath::ASin(l2 * crv) / crv;
775 l2 = TMath::Sqrt(l2*l2 + (z-oldZ)*(z-oldZ));
781 if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0,xrho,GetMass())) {
788 Double_t p2 = (1.0 + GetTgl()*GetTgl()) / (GetSigned1Pt()*GetSigned1Pt());
789 Double_t beta2 = p2 / (p2 + GetMass()*GetMass());
790 if ((beta2 < 1.0e-10) ||
791 ((5940.0 * beta2/(1.0 - beta2 + 1.0e-10) - beta2) < 0.0)) {
795 Double_t dE = 0.153e-3 / beta2
796 * (TMath::Log(5940.0 * beta2/(1.0 - beta2 + 1.0e-10)) - beta2)
801 // Suspicious part - think about it ?
802 Double_t kinE = TMath::Sqrt(p2);
803 if (dE > 0.8*kinE) dE = 0.8 * kinE; //
804 if (dE < 0) dE = 0.0; // Not valid region for Bethe bloch
811 Double_t sigmade = 0.07 * TMath::Sqrt(TMath::Abs(dE)); // Energy loss fluctuation
812 Double_t sigmac2 = sigmade*sigmade*fC*fC*(p2+GetMass()*GetMass())/(p2*p2);
814 fCee += fX*fX * sigmac2;
823 //_____________________________________________________________________________
824 Bool_t AliTRDtrack::Update(const AliTRDcluster *c, Double_t chisq
825 , Int_t index, Double_t h01)
828 // Assignes the found cluster <c> to the track and updates
829 // track information.
830 // <chisq> : predicted chi2
832 // <h01> : Tilting factor
835 Double_t p[2] = { c->GetY()
837 Double_t sy2 = c->GetSigmaY2() * 4.0;
838 Double_t sz2 = c->GetSigmaZ2() * 4.0;
839 Double_t cov[3] = { sy2 + h01*h01*sz2
841 , sz2 + h01*h01*sy2 };
843 if (!AliExternalTrackParam::Update(p,cov)) {
847 Int_t n = GetNumberOfClusters();
849 SetNumberOfClusters(n+1);
851 SetChi2(GetChi2()+chisq);
857 //_____________________________________________________________________________
858 Int_t AliTRDtrack::UpdateMI(AliTRDcluster *c, Double_t chisq, Int_t index
859 , Double_t h01, Int_t /*plane*/, Int_t /*tid*/)
862 // Assignes the found cluster <c> to the track and
863 // updates track information
864 // <chisq> : predicted chi2
866 // <h01> : Tilting factor
868 // Difference to Update(AliTRDcluster *c): cluster is added to fClusters
871 Double_t p[2] = { c->GetY()
873 Double_t sy2 = c->GetSigmaY2() * 4.0;
874 Double_t sz2 = c->GetSigmaZ2() * 4.0;
875 Double_t cov[3] = { sy2 + h01*h01*sz2
877 , sz2 + h01*h01*sy2 };
879 if (!AliExternalTrackParam::Update(p,cov)) {
883 // Register cluster to track
884 Int_t n = GetNumberOfClusters();
887 SetNumberOfClusters(n+1);
888 SetChi2(GetChi2() + chisq);
894 //_____________________________________________________________________________
895 Bool_t AliTRDtrack::Update(const AliTRDtracklet &t, Double_t chisq, Int_t index)
898 // Assignes the found tracklet <t> to the track
899 // and updates track information
900 // <chisq> : predicted chi2
904 Double_t h01 = t.GetTilt(); // Is this correct????
905 Double_t p[2] = { t.GetY(), t.GetZ() };
906 Double_t sy2 = t.GetTrackletSigma2(); // Error pad-column
907 Double_t sz2 = 100000.0; // Error pad-row (????)
908 Double_t cov[3] = { sy2 + h01*h01*sz2 // Does this have any sense????
910 , sz2 + h01*h01*sy2 };
911 if (!AliExternalTrackParam::Update(p,cov)) {
915 Int_t n = GetNumberOfClusters();
917 SetNumberOfClusters(n+1);
918 SetChi2(GetChi2()+chisq);
924 //_____________________________________________________________________________
925 Bool_t AliTRDtrack::Rotate(Double_t alpha, Bool_t absolute)
928 // Rotates track parameters in R*phi plane
929 // if absolute rotation alpha is in global system
930 // otherwise alpha rotation is relative to the current rotation angle
940 return AliExternalTrackParam::Rotate(GetAlpha()+alpha);
944 //_____________________________________________________________________________
945 Double_t AliTRDtrack::GetPredictedChi2(const AliTRDcluster *c, Double_t h01) const
948 // Returns the track chi2
951 Double_t p[2] = { c->GetY()
953 Double_t sy2 = c->GetSigmaY2() * 4.0;
954 Double_t sz2 = c->GetSigmaZ2() * 4.0;
955 Double_t cov[3] = { sy2 + h01*h01*sz2
957 , sz2 + h01*h01*sy2 };
959 return AliExternalTrackParam::GetPredictedChi2(p,cov);
963 //_____________________________________________________________________________
964 void AliTRDtrack::MakeBackupTrack()
967 // Creates a backup track
973 fBackupTrack = new AliTRDtrack(*this);
977 //_____________________________________________________________________________
978 Int_t AliTRDtrack::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
981 // Find a prolongation at given x
982 // Return 0 if it does not exist
985 Double_t bz = GetBz();
987 if (!AliExternalTrackParam::GetYAt(xk,bz,y)) {
990 if (!AliExternalTrackParam::GetZAt(xk,bz,z)) {
998 //_____________________________________________________________________________
999 Int_t AliTRDtrack::PropagateToX(Double_t xr, Double_t step)
1002 // Propagate track to given x position
1003 // Works inside of the 20 degree segmentation
1004 // (local cooordinate frame for TRD , TPC, TOF)
1006 // Material budget from geo manager
1014 const Double_t kAlphac = TMath::Pi()/9.0;
1015 const Double_t kTalphac = TMath::Tan(kAlphac*0.5);
1017 // Critical alpha - cross sector indication
1018 Double_t dir = (GetX() > xr) ? -1.0 : 1.0;
1021 for (Double_t x = GetX()+dir*step; dir*x < dir*xr; x += dir*step) {
1024 GetProlongation(x,y,z);
1025 xyz1[0] = x * TMath::Cos(GetAlpha()) + y * TMath::Sin(GetAlpha());
1026 xyz1[1] = x * TMath::Sin(GetAlpha()) - y * TMath::Cos(GetAlpha());
1029 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
1031 if ((param[0] > 0) &&
1033 PropagateTo(x,param[1],param[0]*param[4]);
1036 if (GetY() > GetX()*kTalphac) {
1039 if (GetY() < -GetX()*kTalphac) {
1051 //_____________________________________________________________________________
1052 Int_t AliTRDtrack::PropagateToR(Double_t r,Double_t step)
1055 // Propagate track to the radial position
1056 // Rotation always connected to the last track position
1064 Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY());
1066 Double_t dir = (radius > r) ? -1.0 : 1.0;
1068 for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) {
1071 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
1072 Rotate(alpha,kTRUE);
1074 GetProlongation(x,y,z);
1075 xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha);
1076 xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha);
1079 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
1080 if (param[1] <= 0) {
1081 param[1] = 100000000;
1083 PropagateTo(x,param[1],param[0]*param[4]);
1088 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
1089 Rotate(alpha,kTRUE);
1091 GetProlongation(r,y,z);
1092 xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha);
1093 xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha);
1096 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
1098 if (param[1] <= 0) {
1099 param[1] = 100000000;
1101 PropagateTo(r,param[1],param[0]*param[4]);
1107 //_____________________________________________________________________________
1108 Int_t AliTRDtrack::GetSector() const
1111 // Return the current sector
1114 return Int_t(TVector2::Phi_0_2pi(GetAlpha()) / AliTRDgeometry::GetAlpha())
1115 % AliTRDgeometry::kNsect;
1119 //_____________________________________________________________________________
1120 void AliTRDtrack::SetSampledEdx(Float_t q, Int_t i)
1123 // The sampled energy loss
1126 Double_t s = GetSnp();
1127 Double_t t = GetTgl();
1128 q *= TMath::Sqrt((1.0 - s*s) / (1.0 + t*t));
1133 //_____________________________________________________________________________
1134 void AliTRDtrack::SetSampledEdx(Float_t q)
1137 // The sampled energy loss
1140 Double_t s = GetSnp();
1141 Double_t t = GetTgl();
1142 q *= TMath::Sqrt((1.0 - s*s) / (1.0 + t*t));
1148 //_____________________________________________________________________________
1149 Double_t AliTRDtrack::GetBz() const
1152 // Returns Bz component of the magnetic field (kG)
1155 if (AliTracker::UniformField()) {
1156 return AliTracker::GetBz();
1161 return AliTracker::GetBz(r);