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 **************************************************************************/
20 #include "AliTracker.h"
21 #include "AliESDtrack.h"
23 #include "AliTRDgeometry.h"
24 #include "AliTRDcluster.h"
25 #include "AliTRDtrack.h"
26 #include "AliTRDcalibDB.h"
27 #include "Cal/AliTRDCalPID.h"
31 ///////////////////////////////////////////////////////////////////////////////
33 // Represents a reconstructed TRD track //
34 // Local TRD Kalman track //
36 ///////////////////////////////////////////////////////////////////////////////
38 //_____________________________________________________________________________
39 AliTRDtrack::AliTRDtrack()
44 ,fClusterOwner(kFALSE)
59 // AliTRDtrack default constructor
62 for (Int_t i = 0; i < kNplane; i++) {
63 for (Int_t j = 0; j < kNslice; j++) {
64 fdEdxPlane[i][j] = 0.0;
72 for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
79 for (Int_t i = 0; i < 3; i++) {
85 //_____________________________________________________________________________
86 AliTRDtrack::AliTRDtrack(AliTRDcluster *c, Int_t index
87 , const Double_t p[5], const Double_t cov[15]
88 , Double_t x, Double_t alpha)
93 ,fClusterOwner(kFALSE)
108 // The main AliTRDtrack constructor.
111 Double_t cnv = 1.0 / (GetBz() * kB2C);
113 Double_t pp[5] = { p[0]
119 Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5];
120 Double_t c32 = x*cov[13] - cov[ 8];
121 Double_t c20 = x*cov[10] - cov[ 3];
122 Double_t c21 = x*cov[11] - cov[ 4];
123 Double_t c42 = x*cov[14] - cov[12];
125 Double_t cc[15] = { cov[ 0]
128 , cov[ 6], cov[ 7], c32, cov[ 9]
129 , cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv };
132 SetNumberOfClusters(1);
136 for (Int_t i = 0; i < kNplane; i++) {
137 for (Int_t j = 0; j < kNslice; j++) {
138 fdEdxPlane[i][j] = 0.0;
140 fTimBinPlane[i] = -1;
146 Double_t q = TMath::Abs(c->GetQ());
147 Double_t s = GetSnp();
148 Double_t t = GetTgl();
150 q *= TMath::Sqrt((1-s*s)/(1+t*t));
154 for (UInt_t i = 1; i < kMAXCLUSTERSPERTRACK; i++) {
161 for (Int_t i = 0; i < 3;i++) {
167 //_____________________________________________________________________________
168 AliTRDtrack::AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner*/)
170 ,fSeedLab(t.GetSeedLabel())
173 ,fClusterOwner(kTRUE)
174 ,fPIDmethod(t.fPIDmethod)
175 ,fStopped(t.fStopped)
178 ,fNRotate(t.fNRotate)
180 ,fNExpected(t.fNExpected)
182 ,fNExpectedLast(t.fNExpectedLast)
184 ,fChi2Last(t.fChi2Last)
191 for (Int_t i = 0; i < kNplane; i++) {
192 for (Int_t j = 0; j < kNslice; j++) {
193 fdEdxPlane[i][j] = t.fdEdxPlane[i][j];
195 fTimBinPlane[i] = t.fTimBinPlane[i];
196 fTracklets[i] = t.fTracklets[i];
202 Int_t n = t.GetNumberOfClusters();
203 SetNumberOfClusters(n);
205 for (Int_t i = 0; i < n; i++) {
206 fIndex[i] = t.fIndex[i];
207 fIndexBackup[i] = t.fIndex[i];
208 fdQdl[i] = t.fdQdl[i];
209 if (fClusterOwner && t.fClusters[i]) {
210 fClusters[i] = new AliTRDcluster(*(t.fClusters[i]));
213 fClusters[i] = t.fClusters[i];
217 for (UInt_t i = n; i < kMAXCLUSTERSPERTRACK; i++) {
224 for (Int_t i = 0; i < 3;i++) {
225 fBudget[i] = t.fBudget[i];
230 //_____________________________________________________________________________
231 AliTRDtrack::AliTRDtrack(const AliKalmanTrack &t, Double_t /*alpha*/)
234 ,fdEdx(t.GetPIDsignal())
236 ,fClusterOwner(kFALSE)
251 // Constructor from AliTPCtrack or AliITStrack
254 SetLabel(t.GetLabel());
256 SetMass(t.GetMass());
257 SetNumberOfClusters(0);
259 for (Int_t i = 0; i < kNplane; i++) {
260 for (Int_t j = 0; j < kNslice; j++) {
261 fdEdxPlane[i][j] = 0.0;
263 fTimBinPlane[i] = -1;
269 for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
276 for (Int_t i = 0; i < 3; i++) {
282 //_____________________________________________________________________________
283 AliTRDtrack::AliTRDtrack(const AliESDtrack &t)
286 ,fdEdx(t.GetTRDsignal())
288 ,fClusterOwner(kFALSE)
303 // Constructor from AliESDtrack
306 SetLabel(t.GetLabel());
308 SetMass(t.GetMass());
309 SetNumberOfClusters(t.GetTRDclusters(fIndex));
311 Int_t ncl = t.GetTRDclusters(fIndexBackup);
312 for (UInt_t i = ncl; i < kMAXCLUSTERSPERTRACK; i++) {
317 for (Int_t i = 0; i < kNplane; i++) {
318 for (Int_t j = 0; j < kNslice; j++) {
319 fdEdxPlane[i][j] = t.GetTRDsignals(i,j);
321 fTimBinPlane[i] = t.GetTRDTimBin(i);
327 const AliExternalTrackParam *par = &t;
328 if (t.GetStatus() & AliESDtrack::kTRDbackup) {
329 par = t.GetOuterParam();
331 AliError("No backup info!");
338 ,par->GetCovariance());
340 for (UInt_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
345 for (Int_t i = 0; i < 3; i++) {
349 if ((t.GetStatus() & AliESDtrack::kTIME) == 0) {
355 t.GetIntegratedTimes(times);
356 SetIntegratedTimes(times);
357 SetIntegratedLength(t.GetIntegratedLength());
361 //____________________________________________________________________________
362 AliTRDtrack::~AliTRDtrack()
375 while ((icluster < kMAXCLUSTERSPERTRACK) && fClusters[icluster]) {
376 delete fClusters[icluster];
377 fClusters[icluster] = 0x0;
384 //____________________________________________________________________________
385 Float_t AliTRDtrack::StatusForTOF()
388 // Defines the status of the TOF extrapolation
391 // Definition of res ????
392 Float_t res = (0.2 + 0.8 * (fN / (fNExpected + 5.0)))
393 * (0.4 + 0.6 * fTracklets[5].GetN() / 20.0);
394 res *= (0.25 + 0.8 * 40.0 / (40.0 + fBudget[2]));
399 //_____________________________________________________________________________
400 Int_t AliTRDtrack::Compare(const TObject *o) const
403 // Compares tracks according to their Y2 or curvature
406 AliTRDtrack *t = (AliTRDtrack *) o;
408 Double_t co = TMath::Abs(t->GetC());
409 Double_t c = TMath::Abs(GetC());
422 //_____________________________________________________________________________
423 void AliTRDtrack::CookdEdx(Double_t low, Double_t up)
426 // Calculates the truncated dE/dx within the "low" and "up" cuts.
429 // Array to sort the dEdx values according to amplitude
430 Float_t sorted[kMAXCLUSTERSPERTRACK];
433 // Require at least 10 clusters for a dedx measurement
438 // Can fdQdl be negative ????
439 for (Int_t i = 0; i < fNdedx; i++) {
440 sorted[i] = TMath::Abs(fdQdl[i]);
442 // Sort the dedx values by amplitude
443 Int_t *index = new Int_t[fNdedx];
444 TMath::Sort(fNdedx, sorted, index, kFALSE);
446 // Sum up the truncated charge between lower and upper bounds
447 Int_t nl = Int_t(low * fNdedx);
448 Int_t nu = Int_t( up * fNdedx);
449 for (Int_t i = nl; i <= nu; i++) {
450 fdEdx += sorted[index[i]];
452 fdEdx /= (nu - nl + 1.0);
458 //_____________________________________________________________________________
459 void AliTRDtrack::CookdEdxTimBin(const Int_t/* tid*/)
462 // Set fdEdxPlane and fTimBinPlane and also get the
463 // Time bin for Max. Cluster
466 // Prashant Shukla (shukla@physi.uni-heidelberg.de)
467 // Alexandru Bercuci (A.Bercuci@gsi.de)
470 // Max charge in chamber
471 Double_t maxcharge[AliESDtrack::kNPlane];
472 // Number of clusters attached to track per chamber and slice
473 Int_t nCluster[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
474 // Number of time bins in chamber
475 Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
476 Int_t plane; // Plane of current cluster
477 Int_t tb; // Time bin of current cluster
478 Int_t slice; // Current slice
479 AliTRDcluster *cluster = 0x0; // Pointer to current cluster
481 // Reset class and local counters/variables
482 for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
483 fTimBinPlane[iPlane] = -1;
484 maxcharge[iPlane] = 0.0;
485 for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
486 fdEdxPlane[iPlane][iSlice] = 0.0;
487 nCluster[iPlane][iSlice] = 0;
491 // Start looping over clusters attached to this track
492 for (Int_t iClus = 0; iClus < GetNumberOfClusters(); iClus++) {
494 cluster = fClusters[iClus]; //(AliTRDcluster*)tracker->GetCluster(fIndex[iClus]);
495 if (!cluster) continue;
497 // Read info from current cluster
498 plane = AliTRDgeometry::GetPlane(cluster->GetDetector());
499 if (plane < 0 || plane >= AliESDtrack::kNPlane) {
500 AliError(Form("Wrong plane %d", plane));
504 tb = cluster->GetLocalTimeBin();
505 if ((tb < 0) || (tb >= ntb)) {
506 AliWarning(Form("time bin < 0 or > %d in cluster %d", ntb, iClus));
507 AliInfo(Form("dQ/dl %f", fdQdl[iClus]));
511 slice = tb * AliESDtrack::kNSlice / ntb;
513 fdEdxPlane[plane][slice] += fdQdl[iClus];
514 if (fdQdl[iClus] > maxcharge[plane]) {
515 maxcharge[plane] = fdQdl[iClus];
516 fTimBinPlane[plane] = tb;
519 nCluster[plane][slice]++;
521 } // End of loop over cluster
523 // Normalize fdEdxPlane to number of clusters and set track segments
524 for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
525 for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
526 if (nCluster[iPlane][iSlice]) {
527 fdEdxPlane[iPlane][iSlice] /= nCluster[iPlane][iSlice];
534 //_____________________________________________________________________________
535 void AliTRDtrack::CookdEdxNN(Float_t *dedx)
538 // This function calcuates the input for the neural networks
539 // which are used for the PID.
542 //number of time bins in chamber
543 Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
545 Int_t plane; // plane of current cluster
546 Int_t tb; // time bin of current cluster
547 Int_t slice; // curent slice
548 AliTRDcluster *cluster = 0x0; // pointer to current cluster
549 const Int_t kMLPscale = 16000; // scaling of the MLP input to be smaller than 1
551 // Reset class and local contors/variables
552 for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++){
553 for (Int_t iSlice = 0; iSlice < kNMLPslice; iSlice++) {
554 *(dedx + (kNMLPslice * iPlane) + iSlice) = 0.0;
558 // Start looping over clusters attached to this track
559 for (Int_t iClus = 0; iClus < GetNumberOfClusters(); iClus++) {
561 cluster = fClusters[iClus]; //(AliTRDcluster*)tracker->GetCluster(fIndex[iClus]);
566 // Read info from current cluster
567 plane = AliTRDgeometry::GetPlane(cluster->GetDetector());
568 if (plane < 0 || plane >= AliESDtrack::kNPlane) {
569 AliError(Form("Wrong plane %d",plane));
573 tb = cluster->GetLocalTimeBin();
574 if (tb == 0 || tb >= ntb) {
575 AliWarning(Form("time bin 0 or > %d in cluster %d",ntb,iClus));
576 AliInfo(Form("dQ/dl %f",fdQdl[iClus]));
580 slice = tb * kNMLPslice / ntb;
582 *(dedx+(kNMLPslice * plane) + slice) += fdQdl[iClus]/kMLPscale;
584 } // End of loop over cluster
588 //_____________________________________________________________________________
589 void AliTRDtrack::SetTrackSegmentDirMom(const Int_t plane)
592 // Set the momenta for a track segment in a given plane
597 AliError(Form("Trying to access out of range plane (%d)", plane));
601 fSnp[plane] = GetSnp();
602 fTgl[plane] = GetTgl();
605 fMom[plane] = TMath::Sqrt(p[0]*p[0] + p[1]*p[1] + p[2]*p[2]);
609 //_____________________________________________________________________________
610 Float_t AliTRDtrack::GetTrackLengthPlane(Int_t plane) const
613 // Calculate the track length of a track segment in a given plane
617 (plane >= kNplane)) {
621 return (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick())
622 / TMath::Sqrt((1.0 - fSnp[plane]*fSnp[plane])
623 / (1.0 + fTgl[plane]*fTgl[plane]));
627 //_____________________________________________________________________________
628 Bool_t AliTRDtrack::CookPID(Int_t &pidQuality)
631 // This function calculates the PID probabilities based on TRD signals
633 // The method produces probabilities based on the charge
634 // and the position of the maximum time bin in each layer.
635 // The dE/dx information can be used as global charge or 2 to 3
636 // slices. Check AliTRDCalPID and AliTRDCalPIDRefMaker for the actual
640 // Alex Bercuci (A.Bercuci@gsi.de) 2nd May 2007
643 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
645 AliError("No access to calibration data");
649 // Retrieve the CDB container class with the probability distributions
650 const AliTRDCalPID *pd = calibration->GetPIDObject(fPIDmethod == kNN ? 0 : 1);
652 AliError("No access to AliTRDCalPID");
656 // Calculate the input for the NN if fPIDmethod is kNN
657 Float_t ldEdxNN[AliTRDCalPID::kNPlane * kNMLPslice], *dedx = 0x0;
658 if(fPIDmethod == kNN) {
659 CookdEdxNN(&ldEdxNN[0]);
662 // Sets the a priori probabilities
663 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
664 fPID[ispec] = 1.0 / AliPID::kSPECIES;
667 if(AliPID::kSPECIES != 5){
668 AliError("Probabilities array defined only for 5 values. Please modify !!");
673 Float_t length; // track segment length in chamber
675 // Skip tracks which have no TRD signal at all
676 if (fdEdx == 0.) return kFALSE;
678 for (Int_t iPlane = 0; iPlane < AliTRDgeometry::kNplan; iPlane++) {
680 length = (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick())
681 / TMath::Sqrt((1.0 - fSnp[iPlane]*fSnp[iPlane])
682 / (1.0 + fTgl[iPlane]*fTgl[iPlane]));
685 if((fdEdxPlane[iPlane][0] + fdEdxPlane[iPlane][1] + fdEdxPlane[iPlane][2]) <= 0.
686 || fTimBinPlane[iPlane] == -1.) continue;
688 // this track segment has fulfilled all requierments
691 // Get the probabilities for the different particle species
692 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
695 dedx = fdEdxPlane[iPlane];
698 dedx = &ldEdxNN[iPlane*kNMLPslice];
701 fPID[iSpecies] *= pd->GetProbability(iSpecies, fMom[iPlane], dedx, length, iPlane);
706 if (pidQuality == 0) {
710 // normalize probabilities
711 Double_t probTotal = 0.0;
712 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
713 probTotal += fPID[iSpecies];
716 if (probTotal <= 0.0) {
717 AliWarning("The total probability over all species <= 0.");
718 AliWarning("This may be caused by some error in the reference histograms.");
722 for (Int_t iSpecies = 0; iSpecies < AliPID::kSPECIES; iSpecies++) {
723 fPID[iSpecies] /= probTotal;
730 //_____________________________________________________________________________
731 Bool_t AliTRDtrack::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho)
734 // Propagates this track to a reference plane defined by "xk" [cm]
735 // correcting for the mean crossed material.
737 // "xx0" - thickness/rad.length [units of the radiation length]
738 // "xrho" - thickness*density [g/cm^2]
745 Double_t oldX = GetX();
746 Double_t oldY = GetY();
747 Double_t oldZ = GetZ();
749 Double_t bz = GetBz();
751 if (!AliExternalTrackParam::PropagateTo(xk,bz)) {
761 if (IsStartedTimeIntegral()) {
762 Double_t l2 = TMath::Sqrt((x-oldX)*(x-oldX)
764 + (z-oldZ)*(z-oldZ));
765 Double_t crv = GetC();
766 if (TMath::Abs(l2*crv) > 0.0001) {
767 // Make correction for curvature if neccesary
768 l2 = 0.5 * TMath::Sqrt((x-oldX)*(x-oldX)
769 + (y-oldY)*(y-oldY));
770 l2 = 2.0 * TMath::ASin(l2 * crv) / crv;
771 l2 = TMath::Sqrt(l2*l2 + (z-oldZ)*(z-oldZ));
777 if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0,xrho,GetMass())) {
784 Double_t p2 = (1.0 + GetTgl()*GetTgl()) / (GetSigned1Pt()*GetSigned1Pt());
785 Double_t beta2 = p2 / (p2 + GetMass()*GetMass());
786 if ((beta2 < 1.0e-10) ||
787 ((5940.0 * beta2/(1.0 - beta2 + 1.0e-10) - beta2) < 0.0)) {
791 Double_t dE = 0.153e-3 / beta2
792 * (TMath::Log(5940.0 * beta2/(1.0 - beta2 + 1.0e-10)) - beta2)
797 // Suspicious part - think about it ?
798 Double_t kinE = TMath::Sqrt(p2);
799 if (dE > 0.8*kinE) dE = 0.8 * kinE; //
800 if (dE < 0) dE = 0.0; // Not valid region for Bethe bloch
807 Double_t sigmade = 0.07 * TMath::Sqrt(TMath::Abs(dE)); // Energy loss fluctuation
808 Double_t sigmac2 = sigmade*sigmade*fC*fC*(p2+GetMass()*GetMass())/(p2*p2);
810 fCee += fX*fX * sigmac2;
819 //_____________________________________________________________________________
820 Bool_t AliTRDtrack::Update(const AliTRDcluster *c, Double_t chisq
821 , Int_t index, Double_t h01)
824 // Assignes the found cluster <c> to the track and updates
825 // track information.
826 // <chisq> : predicted chi2
828 // <h01> : Tilting factor
831 Double_t p[2] = { c->GetY()
833 Double_t sy2 = c->GetSigmaY2() * 4.0;
834 Double_t sz2 = c->GetSigmaZ2() * 4.0;
835 Double_t cov[3] = { sy2 + h01*h01*sz2
837 , sz2 + h01*h01*sy2 };
839 if (!AliExternalTrackParam::Update(p,cov)) {
843 Int_t n = GetNumberOfClusters();
845 SetNumberOfClusters(n+1);
847 SetChi2(GetChi2()+chisq);
853 //_____________________________________________________________________________
854 Int_t AliTRDtrack::UpdateMI(AliTRDcluster *c, Double_t chisq, Int_t index
855 , Double_t h01, Int_t /*plane*/, Int_t /*tid*/)
858 // Assignes the found cluster <c> to the track and
859 // updates track information
860 // <chisq> : predicted chi2
862 // <h01> : Tilting factor
864 // Difference to Update(AliTRDcluster *c): cluster is added to fClusters
867 Double_t p[2] = { c->GetY()
869 Double_t sy2 = c->GetSigmaY2() * 4.0;
870 Double_t sz2 = c->GetSigmaZ2() * 4.0;
871 Double_t cov[3] = { sy2 + h01*h01*sz2
873 , sz2 + h01*h01*sy2 };
875 if (!AliExternalTrackParam::Update(p,cov)) {
879 // Register cluster to track
880 Int_t n = GetNumberOfClusters();
883 SetNumberOfClusters(n+1);
884 SetChi2(GetChi2() + chisq);
890 //_____________________________________________________________________________
891 Bool_t AliTRDtrack::Update(const AliTRDtracklet &t, Double_t chisq, Int_t index)
894 // Assignes the found tracklet <t> to the track
895 // and updates track information
896 // <chisq> : predicted chi2
900 Double_t h01 = t.GetTilt(); // Is this correct????
901 Double_t p[2] = { t.GetY(), t.GetZ() };
902 Double_t sy2 = t.GetTrackletSigma2(); // Error pad-column
903 Double_t sz2 = 100000.0; // Error pad-row (????)
904 Double_t cov[3] = { sy2 + h01*h01*sz2 // Does this have any sense????
906 , sz2 + h01*h01*sy2 };
907 if (!AliExternalTrackParam::Update(p,cov)) {
911 Int_t n = GetNumberOfClusters();
913 SetNumberOfClusters(n+1);
914 SetChi2(GetChi2()+chisq);
920 //_____________________________________________________________________________
921 Bool_t AliTRDtrack::Rotate(Double_t alpha, Bool_t absolute)
924 // Rotates track parameters in R*phi plane
925 // if absolute rotation alpha is in global system
926 // otherwise alpha rotation is relative to the current rotation angle
936 return AliExternalTrackParam::Rotate(GetAlpha()+alpha);
940 //_____________________________________________________________________________
941 Double_t AliTRDtrack::GetPredictedChi2(const AliTRDcluster *c, Double_t h01) const
944 // Returns the track chi2
947 Double_t p[2] = { c->GetY()
949 Double_t sy2 = c->GetSigmaY2() * 4.0;
950 Double_t sz2 = c->GetSigmaZ2() * 4.0;
951 Double_t cov[3] = { sy2 + h01*h01*sz2
953 , sz2 + h01*h01*sy2 };
955 return AliExternalTrackParam::GetPredictedChi2(p,cov);
959 //_____________________________________________________________________________
960 void AliTRDtrack::MakeBackupTrack()
963 // Creates a backup track
969 fBackupTrack = new AliTRDtrack(*this);
973 //_____________________________________________________________________________
974 Int_t AliTRDtrack::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
977 // Find a prolongation at given x
978 // Return 0 if it does not exist
981 Double_t bz = GetBz();
983 if (!AliExternalTrackParam::GetYAt(xk,bz,y)) {
986 if (!AliExternalTrackParam::GetZAt(xk,bz,z)) {
994 //_____________________________________________________________________________
995 Int_t AliTRDtrack::PropagateToX(Double_t xr, Double_t step)
998 // Propagate track to given x position
999 // Works inside of the 20 degree segmentation
1000 // (local cooordinate frame for TRD , TPC, TOF)
1002 // Material budget from geo manager
1010 const Double_t kAlphac = TMath::Pi()/9.0;
1011 const Double_t kTalphac = TMath::Tan(kAlphac*0.5);
1013 // Critical alpha - cross sector indication
1014 Double_t dir = (GetX() > xr) ? -1.0 : 1.0;
1017 for (Double_t x = GetX()+dir*step; dir*x < dir*xr; x += dir*step) {
1020 GetProlongation(x,y,z);
1021 xyz1[0] = x * TMath::Cos(GetAlpha()) + y * TMath::Sin(GetAlpha());
1022 xyz1[1] = x * TMath::Sin(GetAlpha()) - y * TMath::Cos(GetAlpha());
1025 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
1027 if ((param[0] > 0) &&
1029 PropagateTo(x,param[1],param[0]*param[4]);
1032 if (GetY() > GetX()*kTalphac) {
1035 if (GetY() < -GetX()*kTalphac) {
1047 //_____________________________________________________________________________
1048 Int_t AliTRDtrack::PropagateToR(Double_t r,Double_t step)
1051 // Propagate track to the radial position
1052 // Rotation always connected to the last track position
1060 Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY());
1062 Double_t dir = (radius > r) ? -1.0 : 1.0;
1064 for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) {
1067 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
1068 Rotate(alpha,kTRUE);
1070 GetProlongation(x,y,z);
1071 xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha);
1072 xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha);
1075 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
1076 if (param[1] <= 0) {
1077 param[1] = 100000000;
1079 PropagateTo(x,param[1],param[0]*param[4]);
1084 Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
1085 Rotate(alpha,kTRUE);
1087 GetProlongation(r,y,z);
1088 xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha);
1089 xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha);
1092 AliTracker::MeanMaterialBudget(xyz0,xyz1,param);
1094 if (param[1] <= 0) {
1095 param[1] = 100000000;
1097 PropagateTo(r,param[1],param[0]*param[4]);
1103 //_____________________________________________________________________________
1104 Int_t AliTRDtrack::GetSector() const
1107 // Return the current sector
1110 return Int_t(TVector2::Phi_0_2pi(GetAlpha()) / AliTRDgeometry::GetAlpha())
1111 % AliTRDgeometry::kNsect;
1115 //_____________________________________________________________________________
1116 void AliTRDtrack::SetSampledEdx(Float_t q, Int_t i)
1119 // The sampled energy loss
1122 Double_t s = GetSnp();
1123 Double_t t = GetTgl();
1124 q *= TMath::Sqrt((1.0 - s*s) / (1.0 + t*t));
1129 //_____________________________________________________________________________
1130 void AliTRDtrack::SetSampledEdx(Float_t q)
1133 // The sampled energy loss
1136 Double_t s = GetSnp();
1137 Double_t t = GetTgl();
1138 q *= TMath::Sqrt((1.0 - s*s) / (1.0 + t*t));
1144 //_____________________________________________________________________________
1145 Double_t AliTRDtrack::GetBz() const
1148 // Returns Bz component of the magnetic field (kG)
1151 if (AliTracker::UniformField()) {
1152 return AliTracker::GetBz();
1157 return AliTracker::GetBz(r);