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 ///////////////////////////////////////////////////////////////////////////////
20 // The standard TRD tracker //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include <Riostream.h>
29 #include <TObjArray.h>
31 #include "AliTRDgeometry.h"
32 #include "AliTRDparameter.h"
33 #include "AliTRDgeometryDetail.h"
34 #include "AliTRDcluster.h"
35 #include "AliTRDtrack.h"
36 #include "AliTRDPartID.h"
37 #include "../TPC/AliTPCtrack.h"
39 #include "AliTRDtracker.h"
41 ClassImp(AliTRDtracker)
43 const Float_t AliTRDtracker::fgkSeedDepth = 0.5;
44 const Float_t AliTRDtracker::fgkSeedStep = 0.10;
45 const Float_t AliTRDtracker::fgkSeedGap = 0.25;
47 const Float_t AliTRDtracker::fgkMaxSeedDeltaZ12 = 40.;
48 const Float_t AliTRDtracker::fgkMaxSeedDeltaZ = 25.;
49 const Float_t AliTRDtracker::fgkMaxSeedC = 0.0052;
50 const Float_t AliTRDtracker::fgkMaxSeedTan = 1.2;
51 const Float_t AliTRDtracker::fgkMaxSeedVertexZ = 150.;
53 const Double_t AliTRDtracker::fgkSeedErrorSY = 0.2;
54 const Double_t AliTRDtracker::fgkSeedErrorSY3 = 2.5;
55 const Double_t AliTRDtracker::fgkSeedErrorSZ = 0.1;
57 const Float_t AliTRDtracker::fgkMinClustersInSeed = 0.7;
59 const Float_t AliTRDtracker::fgkMinClustersInTrack = 0.5;
60 const Float_t AliTRDtracker::fgkMinFractionOfFoundClusters = 0.8;
62 const Float_t AliTRDtracker::fgkSkipDepth = 0.3;
63 const Float_t AliTRDtracker::fgkLabelFraction = 0.8;
64 const Float_t AliTRDtracker::fgkWideRoad = 20.;
66 const Double_t AliTRDtracker::fgkMaxChi2 = 12.;
68 const Int_t AliTRDtracker::fgkFirstPlane = 5;
69 const Int_t AliTRDtracker::fgkLastPlane = 17;
72 //____________________________________________________________________
73 AliTRDtracker::AliTRDtracker(const TFile *geomfile):AliTracker()
81 fAddTRDseeds = kFALSE;
85 TDirectory *savedir=gDirectory;
86 TFile *in=(TFile*)geomfile;
88 printf("AliTRDtracker::AliTRDtracker(): geometry file is not open!\n");
89 printf(" DETAIL TRD geometry and DEFAULT TRD parameter will be used\n");
94 fGeom = (AliTRDgeometry*) in->Get("TRDgeometry");
95 fPar = (AliTRDparameter*) in->Get("TRDparameter");
100 // fTzero = geo->GetT0();
101 printf("Found geometry version %d on file \n", fGeom->IsVersion());
104 printf("AliTRDtracker::AliTRDtracker(): can't find TRD geometry!\n");
105 printf("The DETAIL TRD geometry will be used\n");
106 fGeom = new AliTRDgeometryDetail();
110 printf("AliTRDtracker::AliTRDtracker(): can't find TRD parameter!\n");
111 printf("The DEFAULT TRD parameter will be used\n");
112 fPar = new AliTRDparameter();
119 // fGeom->SetT0(fTzero);
122 fClusters = new TObjArray(2000);
124 fSeeds = new TObjArray(2000);
126 fTracks = new TObjArray(1000);
128 for(Int_t geomS = 0; geomS < kTrackingSectors; geomS++) {
129 Int_t trS = CookSectorIndex(geomS);
130 fTrSec[trS] = new AliTRDtrackingSector(fGeom, geomS, fPar);
133 Float_t tiltAngle = TMath::Abs(fPar->GetTiltingAngle());
134 if(tiltAngle < 0.1) {
141 if(fNoTilt && (tiltAngle > 0.1)) fSY2corr = fSY2corr + tiltAngle * 0.05;
144 // calculate max gap on track
146 Double_t dxAmp = (Double_t) fGeom->CamHght(); // Amplification region
147 Double_t dxDrift = (Double_t) fGeom->CdrHght(); // Drift region
149 Double_t dx = (Double_t) fPar->GetTimeBinSize();
150 Int_t tbAmp = fPar->GetTimeBefore();
151 Int_t maxAmp = (Int_t) ((dxAmp+0.000001)/dx);
152 if(kTRUE) maxAmp = 0; // intentional until we change the parameter class
153 Int_t tbDrift = fPar->GetTimeMax();
154 Int_t maxDrift = (Int_t) ((dxDrift+0.000001)/dx);
156 tbDrift = TMath::Min(tbDrift,maxDrift);
157 tbAmp = TMath::Min(tbAmp,maxAmp);
159 fTimeBinsPerPlane = tbAmp + tbDrift;
160 fMaxGap = (Int_t) (fTimeBinsPerPlane * fGeom->Nplan() * fgkSkipDepth);
165 // Barrel Tracks [SR, 03.04.2003]
175 //___________________________________________________________________
176 AliTRDtracker::~AliTRDtracker()
179 // Destructor of AliTRDtracker
188 for(Int_t geomS = 0; geomS < kTrackingSectors; geomS++) {
189 delete fTrSec[geomS];
193 //_____________________________________________________________________
195 void AliTRDtracker::SetBarrelTree(const char *mode) {
200 if (!IsStoringBarrel()) return;
202 TDirectory *sav = gDirectory;
203 if (!fBarrelFile) fBarrelFile = new TFile("AliBarrelTracks.root", "UPDATE");
206 sprintf(buff, "BarrelTRD_%d_%s", GetEventNumber(), mode);
209 fBarrelTree = new TTree(buff, "Barrel TPC tracks");
211 Int_t nRefs = fgkLastPlane - fgkFirstPlane + 1;
213 if (!fBarrelArray) fBarrelArray = new TClonesArray("AliBarrelTrack", nRefs);
214 for(Int_t i=0; i<nRefs; i++) new((*fBarrelArray)[i]) AliBarrelTrack();
216 fBarrelTree->Branch("tracks", &fBarrelArray);
220 //_____________________________________________________________________
222 void AliTRDtracker::StoreBarrelTrack(AliTRDtrack *ps, Int_t refPlane, Int_t isIn) {
227 if (!IsStoringBarrel()) return;
229 static Int_t nClusters;
231 static Double_t chi2;
233 static Bool_t wasLast = kTRUE;
235 Int_t newClusters, newWrong;
240 fBarrelArray->Clear();
241 nClusters = nWrong = 0;
247 fBarrelTrack = (AliBarrelTrack*)(*fBarrelArray)[index++];
248 ps->GetBarrelTrack(fBarrelTrack);
250 newClusters = ps->GetNumberOfClusters() - nClusters;
251 newWrong = ps->GetNWrong() - nWrong;
252 newChi2 = ps->GetChi2() - chi2;
254 nClusters = ps->GetNumberOfClusters();
255 nWrong = ps->GetNWrong();
256 chi2 = ps->GetChi2();
258 if (refPlane != fgkLastPlane) {
259 fBarrelTrack->SetNClusters(newClusters, newChi2);
260 fBarrelTrack->SetNWrongClusters(newWrong);
265 fBarrelTrack->SetRefPlane(refPlane, isIn);
268 //_____________________________________________________________________
270 Bool_t AliTRDtracker::AdjustSector(AliTRDtrack *track) {
272 // Rotates the track when necessary
275 Double_t alpha = AliTRDgeometry::GetAlpha();
276 Double_t y = track->GetY();
277 Double_t ymax = track->GetX()*TMath::Tan(0.5*alpha);
279 //Int_t ns = AliTRDgeometry::kNsect;
280 //Int_t s=Int_t(track->GetAlpha()/alpha)%ns;
284 if (!track->Rotate(alpha)) return kFALSE;
285 } else if (y <-ymax) {
287 if (!track->Rotate(-alpha)) return kFALSE;
293 //_____________________________________________________________________
294 inline Double_t f1trd(Double_t x1,Double_t y1,
295 Double_t x2,Double_t y2,
296 Double_t x3,Double_t y3)
299 // Initial approximation of the track curvature
301 Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1);
302 Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)-
303 (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2));
304 Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)-
305 (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1));
307 Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b);
309 return -xr*yr/sqrt(xr*xr+yr*yr);
312 //_____________________________________________________________________
313 inline Double_t f2trd(Double_t x1,Double_t y1,
314 Double_t x2,Double_t y2,
315 Double_t x3,Double_t y3)
318 // Initial approximation of the track curvature times X coordinate
319 // of the center of curvature
322 Double_t d=(x2-x1)*(y3-y2)-(x3-x2)*(y2-y1);
323 Double_t a=0.5*((y3-y2)*(y2*y2-y1*y1+x2*x2-x1*x1)-
324 (y2-y1)*(y3*y3-y2*y2+x3*x3-x2*x2));
325 Double_t b=0.5*((x2-x1)*(y3*y3-y2*y2+x3*x3-x2*x2)-
326 (x3-x2)*(y2*y2-y1*y1+x2*x2-x1*x1));
328 Double_t xr=TMath::Abs(d/(d*x1-a)), yr=d/(d*y1-b);
330 return -a/(d*y1-b)*xr/sqrt(xr*xr+yr*yr);
333 //_____________________________________________________________________
334 inline Double_t f3trd(Double_t x1,Double_t y1,
335 Double_t x2,Double_t y2,
336 Double_t z1,Double_t z2)
339 // Initial approximation of the tangent of the track dip angle
342 return (z1 - z2)/sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
345 //___________________________________________________________________
346 Int_t AliTRDtracker::Clusters2Tracks(const TFile *inp, TFile *out)
349 // Finds tracks within the TRD. File <inp> is expected to contain seeds
350 // at the outer part of the TRD. If <inp> is NULL, the seeds
351 // are found within the TRD if fAddTRDseeds is TRUE.
352 // The tracks are propagated to the innermost time bin
353 // of the TRD and stored in file <out>.
358 TDirectory *savedir=gDirectory;
362 if (!out->IsOpen()) {
363 cerr<<"AliTRDtracker::Clusters2Tracks(): output file is not open !\n";
367 sprintf(tname,"seedTRDtoTPC_%d",GetEventNumber());
368 TTree tpcTree(tname,"Tree with seeds from TRD at outer TPC pad row");
369 AliTPCtrack *iotrack=0;
370 tpcTree.Branch("tracks","AliTPCtrack",&iotrack,32000,0);
372 sprintf(tname,"TreeT%d_TRD",GetEventNumber());
373 TTree trdTree(tname,"TRD tracks at inner TRD time bin");
374 AliTRDtrack *iotrackTRD=0;
375 trdTree.Branch("tracks","AliTRDtrack",&iotrackTRD,32000,0);
377 Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins();
378 Float_t foundMin = fgkMinClustersInTrack * timeBins;
381 TFile *in=(TFile*)inp;
384 "AliTRDtracker::Clusters2Tracks(): file with seeds is not open !\n";
385 cerr<<" ... going for seeds finding inside the TRD\n";
389 sprintf(tname,"TRDb_%d",GetEventNumber());
390 TTree *seedTree=(TTree*)in->Get(tname);
392 cerr<<"AliTRDtracker::Clusters2Tracks(): ";
393 cerr<<"can't get a tree with track seeds !\n";
396 AliTRDtrack *seed=new AliTRDtrack;
397 seedTree->SetBranchAddress("tracks",&seed);
399 Int_t n=(Int_t)seedTree->GetEntries();
400 for (Int_t i=0; i<n; i++) {
401 seedTree->GetEvent(i);
402 seed->ResetCovariance();
403 AliTRDtrack *tr = new AliTRDtrack(*seed,seed->GetAlpha());
415 // find tracks from loaded seeds
417 Int_t nseed=fSeeds->GetEntriesFast();
419 Int_t innerTB = fTrSec[0]->GetInnerTimeBin();
421 for (i=0; i<nseed; i++) {
422 AliTRDtrack *pt=(AliTRDtrack*)fSeeds->UncheckedAt(i), &t=*pt;
423 FollowProlongation(t, innerTB);
424 if (t.GetNumberOfClusters() >= foundMin) {
426 CookLabel(pt, 1-fgkLabelFraction);
432 // cout<<found<<'\r';
434 if(PropagateToTPC(t)) {
435 AliTPCtrack *tpc = new AliTPCtrack(*pt,pt->GetAlpha());
440 delete fSeeds->RemoveAt(i);
444 cout<<"Number of loaded seeds: "<<nseed<<endl;
445 cout<<"Number of found tracks from loaded seeds: "<<found<<endl;
447 // after tracks from loaded seeds are found and the corresponding
448 // clusters are used, look for additional seeds from TRD
451 // Find tracks for the seeds in the TRD
452 Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins();
454 Int_t nSteps = (Int_t) (fgkSeedDepth / fgkSeedStep);
455 Int_t gap = (Int_t) (timeBins * fgkSeedGap);
456 Int_t step = (Int_t) (timeBins * fgkSeedStep);
458 // make a first turn with tight cut on initial curvature
459 for(Int_t turn = 1; turn <= 2; turn++) {
461 nSteps = (Int_t) (fgkSeedDepth / (3*fgkSeedStep));
462 step = (Int_t) (timeBins * (3*fgkSeedStep));
464 for(Int_t i=0; i<nSteps; i++) {
465 Int_t outer=timeBins-1-i*step;
466 Int_t inner=outer-gap;
468 nseed=fSeeds->GetEntriesFast();
470 MakeSeeds(inner, outer, turn);
472 nseed=fSeeds->GetEntriesFast();
473 printf("\n turn %d, step %d: number of seeds for TRD inward %d\n",
476 for (Int_t i=0; i<nseed; i++) {
477 AliTRDtrack *pt=(AliTRDtrack*)fSeeds->UncheckedAt(i), &t=*pt;
478 FollowProlongation(t,innerTB);
479 if (t.GetNumberOfClusters() >= foundMin) {
481 CookLabel(pt, 1-fgkLabelFraction);
484 // cout<<found<<'\r';
487 if(PropagateToTPC(t)) {
488 AliTPCtrack *tpc = new AliTPCtrack(*pt,pt->GetAlpha());
494 delete fSeeds->RemoveAt(i);
503 cout<<"Total number of found tracks: "<<found<<endl;
512 //___________________________________________________________________
513 Int_t AliTRDtracker::Clusters2Tracks(AliESD* event)
516 // Finds tracks within the TRD. The ESD event is expected to contain seeds
517 // at the outer part of the TRD. The seeds
518 // are found within the TRD if fAddTRDseeds is TRUE.
519 // The tracks are propagated to the innermost time bin
520 // of the TRD and the ESD event is updated
523 Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins();
524 Float_t foundMin = fgkMinClustersInTrack * timeBins;
527 Int_t innerTB = fTrSec[0]->GetInnerTimeBin();
529 Int_t n = event->GetNumberOfTracks();
530 for (Int_t i=0; i<n; i++) {
531 AliESDtrack* seed=event->GetTrack(i);
532 ULong_t status=seed->GetStatus();
533 if ( (status & AliESDtrack::kTRDout ) == 0 ) continue;
534 if ( (status & AliESDtrack::kTRDin) != 0 ) continue;
537 AliTRDtrack* seed2 = new AliTRDtrack(*seed);
538 seed2->ResetCovariance();
539 AliTRDtrack *pt = new AliTRDtrack(*seed2,seed2->GetAlpha());
541 FollowProlongation(t, innerTB);
542 if (t.GetNumberOfClusters() >= foundMin) {
544 CookLabel(pt, 1-fgkLabelFraction);
548 // cout<<found<<'\r';
550 if(PropagateToTPC(t)) {
551 seed->UpdateTrackParams(pt, AliESDtrack::kTRDin);
557 cout<<"Number of loaded seeds: "<<nseed<<endl;
558 cout<<"Number of found tracks from loaded seeds: "<<found<<endl;
560 // after tracks from loaded seeds are found and the corresponding
561 // clusters are used, look for additional seeds from TRD
564 // Find tracks for the seeds in the TRD
565 Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins();
567 Int_t nSteps = (Int_t) (fgkSeedDepth / fgkSeedStep);
568 Int_t gap = (Int_t) (timeBins * fgkSeedGap);
569 Int_t step = (Int_t) (timeBins * fgkSeedStep);
571 // make a first turn with tight cut on initial curvature
572 for(Int_t turn = 1; turn <= 2; turn++) {
574 nSteps = (Int_t) (fgkSeedDepth / (3*fgkSeedStep));
575 step = (Int_t) (timeBins * (3*fgkSeedStep));
577 for(Int_t i=0; i<nSteps; i++) {
578 Int_t outer=timeBins-1-i*step;
579 Int_t inner=outer-gap;
581 nseed=fSeeds->GetEntriesFast();
583 MakeSeeds(inner, outer, turn);
585 nseed=fSeeds->GetEntriesFast();
586 printf("\n turn %d, step %d: number of seeds for TRD inward %d\n",
589 for (Int_t i=0; i<nseed; i++) {
590 AliTRDtrack *pt=(AliTRDtrack*)fSeeds->UncheckedAt(i), &t=*pt;
591 FollowProlongation(t,innerTB);
592 if (t.GetNumberOfClusters() >= foundMin) {
594 CookLabel(pt, 1-fgkLabelFraction);
597 // cout<<found<<'\r';
598 if(PropagateToTPC(t)) {
600 track.UpdateTrackParams(pt,AliESDtrack::kTRDin);
601 event->AddTrack(&track);
604 delete fSeeds->RemoveAt(i);
611 cout<<"Total number of found tracks: "<<found<<endl;
618 //_____________________________________________________________________________
619 Int_t AliTRDtracker::PropagateBack(const TFile *inp, TFile *out) {
621 // Reads seeds from file <inp>. The seeds are AliTPCtrack's found and
622 // backpropagated by the TPC tracker. Each seed is first propagated
623 // to the TRD, and then its prolongation is searched in the TRD.
624 // If sufficiently long continuation of the track is found in the TRD
625 // the track is updated, otherwise it's stored as originaly defined
626 // by the TPC tracker.
631 TDirectory *savedir=gDirectory;
633 TFile *in=(TFile*)inp;
636 cerr<<"AliTRDtracker::PropagateBack(): ";
637 cerr<<"file with back propagated TPC tracks is not open !\n";
641 if (!out->IsOpen()) {
642 cerr<<"AliTRDtracker::PropagateBack(): ";
643 cerr<<"file for back propagated TRD tracks is not open !\n";
649 sprintf(tname,"seedsTPCtoTRD_%d",GetEventNumber());
650 TTree *seedTree=(TTree*)in->Get(tname);
652 cerr<<"AliTRDtracker::PropagateBack(): ";
653 cerr<<"can't get a tree with seeds from TPC !\n";
654 cerr<<"check if your version of TPC tracker creates tree "<<tname<<"\n";
658 AliTPCtrack *seed=new AliTPCtrack;
659 seedTree->SetBranchAddress("tracks",&seed);
661 Int_t n=(Int_t)seedTree->GetEntries();
662 for (Int_t i=0; i<n; i++) {
663 seedTree->GetEvent(i);
664 Int_t lbl = seed->GetLabel();
665 AliTRDtrack *tr = new AliTRDtrack(*seed,seed->GetAlpha());
666 tr->SetSeedLabel(lbl);
676 AliTPCtrack *otrack=0;
678 sprintf(tname,"seedsTRDtoTOF1_%d",GetEventNumber());
679 TTree tofTree1(tname,"Tracks back propagated through TPC and TRD");
680 tofTree1.Branch("tracks","AliTPCtrack",&otrack,32000,0);
682 sprintf(tname,"seedsTRDtoTOF2_%d",GetEventNumber());
683 TTree tofTree2(tname,"Tracks back propagated through TPC and TRD");
684 tofTree2.Branch("tracks","AliTPCtrack",&otrack,32000,0);
686 sprintf(tname,"seedsTRDtoPHOS_%d",GetEventNumber());
687 TTree phosTree(tname,"Tracks back propagated through TPC and TRD");
688 phosTree.Branch("tracks","AliTPCtrack",&otrack,32000,0);
690 sprintf(tname,"seedsTRDtoRICH_%d",GetEventNumber());
691 TTree richTree(tname,"Tracks back propagated through TPC and TRD");
692 richTree.Branch("tracks","AliTPCtrack",&otrack,32000,0);
694 sprintf(tname,"TRDb_%d",GetEventNumber());
695 TTree trdTree(tname,"Back propagated TRD tracks at outer TRD time bin");
696 AliTRDtrack *otrackTRD=0;
697 trdTree.Branch("tracks","AliTRDtrack",&otrackTRD,32000,0);
699 if (IsStoringBarrel()) SetBarrelTree("back");
703 Int_t nseed=fSeeds->GetEntriesFast();
705 // Float_t foundMin = fgkMinClustersInTrack * fTimeBinsPerPlane * fGeom->Nplan();
706 Float_t foundMin = 40;
708 Int_t outermostTB = fTrSec[0]->GetOuterTimeBin();
710 for (Int_t i=0; i<nseed; i++) {
712 AliTRDtrack *ps=(AliTRDtrack*)fSeeds->UncheckedAt(i), &s=*ps;
713 Int_t expectedClr = FollowBackProlongation(s);
715 if (IsStoringBarrel()) {
716 StoreBarrelTrack(ps, fgkLastPlane, kTrackBack);
720 Int_t foundClr = s.GetNumberOfClusters();
721 Int_t lastTB = fTrSec[0]->GetLayerNumber(s.GetX());
723 // printf("seed %d: found %d out of %d expected clusters, Min is %f\n",
724 // i, foundClr, expectedClr, foundMin);
726 if (foundClr >= foundMin) {
729 CookLabel(ps, 1-fgkLabelFraction);
733 // Propagate to outer reference plane [SR, GSI, 18.02.2003]
734 ps->PropagateTo(364.8);
738 // cout<<found<<'\r';
741 if(((expectedClr < 10) && (lastTB == outermostTB)) ||
742 ((expectedClr >= 10) &&
743 (((Float_t) foundClr) / ((Float_t) expectedClr) >=
744 fgkMinFractionOfFoundClusters) && (lastTB == outermostTB))) {
746 Double_t xTOF = 375.5;
748 if(PropagateToOuterPlane(s,xTOF)) {
749 AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
756 if(PropagateToOuterPlane(s,xTOF)) {
757 AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
762 Double_t xPHOS = 460.;
764 if(PropagateToOuterPlane(s,xPHOS)) {
765 AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
770 Double_t xRICH = 490+1.267;
772 if(PropagateToOuterPlane(s,xRICH)) {
773 AliTPCtrack *pt = new AliTPCtrack(*ps,ps->GetAlpha());
792 if (IsStoringBarrel()) { // [SR, 03.04.2003]
794 fBarrelTree->Write();
795 fBarrelFile->Flush();
799 cerr<<"Number of seeds: "<<nseed<<endl;
800 cerr<<"Number of back propagated TRD tracks: "<<found<<endl;
808 //_____________________________________________________________________________
809 Int_t AliTRDtracker::PropagateBack(AliESD* event) {
811 // Gets seeds from ESD event. The seeds are AliTPCtrack's found and
812 // backpropagated by the TPC tracker. Each seed is first propagated
813 // to the TRD, and then its prolongation is searched in the TRD.
814 // If sufficiently long continuation of the track is found in the TRD
815 // the track is updated, otherwise it's stored as originaly defined
816 // by the TPC tracker.
820 Float_t foundMin = 40;
822 Int_t n = event->GetNumberOfTracks();
823 for (Int_t i=0; i<n; i++) {
824 AliESDtrack* seed=event->GetTrack(i);
825 ULong_t status=seed->GetStatus();
826 if ( (status & AliESDtrack::kTPCout ) == 0 ) continue;
827 if ( (status & AliESDtrack::kTRDout) != 0 ) continue;
829 Int_t lbl = seed->GetLabel();
830 AliTRDtrack *track = new AliTRDtrack(*seed);
831 track->SetSeedLabel(lbl);
834 /*Int_t expectedClr = */FollowBackProlongation(*track);
836 Int_t foundClr = track->GetNumberOfClusters();
837 if (foundClr >= foundMin) {
840 // CookLabel(track, 1-fgkLabelFraction);
844 // Propagate to outer reference plane [SR, GSI, 18.02.2003]
845 // track->PropagateTo(364.8); why?
847 //seed->UpdateTrackParams(track, AliESDtrack::kTRDout);
851 //Propagation to the TOF (I.Belikov)
853 Double_t c2=track->GetC()*xtof - track->GetEta();
854 if (TMath::Abs(c2)>=0.9999999) continue;
856 Double_t ymax=xtof*TMath::Tan(0.5*AliTRDgeometry::GetAlpha());
857 Double_t y=track->GetYat(xtof);
859 if (!track->Rotate(AliTRDgeometry::GetAlpha())) return 1;
860 } else if (y <-ymax) {
861 if (!track->Rotate(-AliTRDgeometry::GetAlpha())) return 1;
864 if (track->PropagateTo(xtof)) {
865 seed->UpdateTrackParams(track, AliESDtrack::kTRDout);
868 //End of propagation to the TOF
872 cerr<<"Number of seeds: "<<fNseeds<<endl;
873 cerr<<"Number of back propagated TRD tracks: "<<found<<endl;
875 fSeeds->Clear(); fNseeds=0;
881 //_____________________________________________________________________________
882 Int_t AliTRDtracker::RefitInward(AliESD* event)
885 // Refits tracks within the TRD. The ESD event is expected to contain seeds
886 // at the outer part of the TRD.
887 // The tracks are propagated to the innermost time bin
888 // of the TRD and the ESD event is updated
889 // Origin: Thomas KUHR (Thomas.Kuhr@cern.ch)
892 Int_t timeBins = fTrSec[0]->GetNumberOfTimeBins();
893 Float_t foundMin = fgkMinClustersInTrack * timeBins;
896 Int_t innerTB = fTrSec[0]->GetInnerTimeBin();
898 Int_t n = event->GetNumberOfTracks();
899 for (Int_t i=0; i<n; i++) {
900 AliESDtrack* seed=event->GetTrack(i);
901 ULong_t status=seed->GetStatus();
902 if ( (status & AliESDtrack::kTRDout ) == 0 ) continue;
903 if ( (status & AliESDtrack::kTRDin) != 0 ) continue;
906 AliTRDtrack* seed2 = new AliTRDtrack(*seed);
907 seed2->ResetCovariance();
908 AliTRDtrack *pt = new AliTRDtrack(*seed2,seed2->GetAlpha());
910 FollowProlongation(t, innerTB);
911 if (t.GetNumberOfClusters() >= foundMin) {
913 CookLabel(pt, 1-fgkLabelFraction);
917 // cout<<found<<'\r';
919 if(PropagateToTPC(t)) {
920 seed->UpdateTrackParams(pt, AliESDtrack::kTRDrefit);
926 cout<<"Number of loaded seeds: "<<nseed<<endl;
927 cout<<"Number of found tracks from loaded seeds: "<<found<<endl;
934 //---------------------------------------------------------------------------
935 Int_t AliTRDtracker::FollowProlongation(AliTRDtrack& t, Int_t rf)
937 // Starting from current position on track=t this function tries
938 // to extrapolate the track up to timeBin=0 and to confirm prolongation
939 // if a close cluster is found. Returns the number of clusters
940 // expected to be found in sensitive layers
942 Float_t wIndex, wTB, wChi2;
943 Float_t wYrt, wYclosest, wYcorrect, wYwindow;
944 Float_t wZrt, wZclosest, wZcorrect, wZwindow;
945 Float_t wPx, wPy, wPz, wC;
947 Float_t wSigmaC2, wSigmaTgl2, wSigmaY2, wSigmaZ2;
949 Int_t trackIndex = t.GetLabel();
951 Int_t ns=Int_t(2*TMath::Pi()/AliTRDgeometry::GetAlpha()+0.5);
953 Int_t tryAgain=fMaxGap;
955 Double_t alpha=t.GetAlpha();
956 alpha = TVector2::Phi_0_2pi(alpha);
958 Int_t s=Int_t(alpha/AliTRDgeometry::GetAlpha())%AliTRDgeometry::kNsect;
959 Double_t radLength, rho, x, dx, y, ymax, z;
961 Int_t expectedNumberOfClusters = 0;
962 Bool_t lookForCluster;
964 alpha=AliTRDgeometry::GetAlpha(); // note: change in meaning
967 for (Int_t nr=fTrSec[0]->GetLayerNumber(t.GetX()); nr>rf; nr--) {
969 y = t.GetY(); z = t.GetZ();
971 // first propagate to the inner surface of the current time bin
972 fTrSec[s]->GetLayer(nr)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
973 x = fTrSec[s]->GetLayer(nr)->GetX()-dx/2; y = t.GetY(); z = t.GetZ();
974 if(!t.PropagateTo(x,radLength,rho)) break;
976 ymax = x*TMath::Tan(0.5*alpha);
979 if (!t.Rotate(alpha)) break;
980 if(!t.PropagateTo(x,radLength,rho)) break;
981 } else if (y <-ymax) {
983 if (!t.Rotate(-alpha)) break;
984 if(!t.PropagateTo(x,radLength,rho)) break;
987 y = t.GetY(); z = t.GetZ();
989 // now propagate to the middle plane of the next time bin
990 fTrSec[s]->GetLayer(nr-1)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
991 x = fTrSec[s]->GetLayer(nr-1)->GetX(); y = t.GetY(); z = t.GetZ();
992 if(!t.PropagateTo(x,radLength,rho)) break;
994 ymax = x*TMath::Tan(0.5*alpha);
997 if (!t.Rotate(alpha)) break;
998 if(!t.PropagateTo(x,radLength,rho)) break;
999 } else if (y <-ymax) {
1001 if (!t.Rotate(-alpha)) break;
1002 if(!t.PropagateTo(x,radLength,rho)) break;
1006 if(lookForCluster) {
1008 expectedNumberOfClusters++;
1009 wIndex = (Float_t) t.GetLabel();
1012 AliTRDpropagationLayer& timeBin=*(fTrSec[s]->GetLayer(nr-1));
1014 Double_t sy2=ExpectedSigmaY2(x,t.GetTgl(),t.GetPt());
1015 Double_t sz2=ExpectedSigmaZ2(x,t.GetTgl());
1018 if((t.GetSigmaY2() + sy2) > 0) road=10.*sqrt(t.GetSigmaY2() + sy2);
1019 else return expectedNumberOfClusters;
1023 wYwindow = (Float_t) road;
1024 t.GetPxPyPz(px,py,pz);
1028 wC = (Float_t) t.GetC();
1029 wSigmaC2 = (Float_t) t.GetSigmaC2();
1030 wSigmaTgl2 = (Float_t) t.GetSigmaTgl2();
1031 wSigmaY2 = (Float_t) t.GetSigmaY2();
1032 wSigmaZ2 = (Float_t) t.GetSigmaZ2();
1035 if (road>fgkWideRoad) {
1036 if (t.GetNumberOfClusters()>4)
1037 cerr<<t.GetNumberOfClusters()
1038 <<"FindProlongation warning: Too broad road !\n";
1042 AliTRDcluster *cl=0;
1045 Double_t maxChi2=fgkMaxChi2;
1047 wYclosest = 12345678;
1048 wYcorrect = 12345678;
1049 wZclosest = 12345678;
1050 wZcorrect = 12345678;
1051 wZwindow = TMath::Sqrt(2.25 * 12 * sz2);
1053 // Find the closest correct cluster for debugging purposes
1055 Float_t minDY = 1000000;
1056 for (Int_t i=0; i<timeBin; i++) {
1057 AliTRDcluster* c=(AliTRDcluster*)(timeBin[i]);
1058 if((c->GetLabel(0) != trackIndex) &&
1059 (c->GetLabel(1) != trackIndex) &&
1060 (c->GetLabel(2) != trackIndex)) continue;
1061 if(TMath::Abs(c->GetY() - y) > minDY) continue;
1062 minDY = TMath::Abs(c->GetY() - y);
1063 wYcorrect = c->GetY();
1064 wZcorrect = c->GetZ();
1066 Double_t h01 = GetTiltFactor(c);
1067 wChi2 = t.GetPredictedChi2(c, h01);
1071 // Now go for the real cluster search
1075 for (Int_t i=timeBin.Find(y-road); i<timeBin; i++) {
1076 AliTRDcluster* c=(AliTRDcluster*)(timeBin[i]);
1077 if (c->GetY() > y+road) break;
1078 if (c->IsUsed() > 0) continue;
1079 if((c->GetZ()-z)*(c->GetZ()-z) > 3 * sz2) continue;
1081 Double_t h01 = GetTiltFactor(c);
1082 Double_t chi2=t.GetPredictedChi2(c,h01);
1084 if (chi2 > maxChi2) continue;
1087 index=timeBin.GetIndex(i);
1092 for (Int_t i=timeBin.Find(y-road); i<timeBin; i++) {
1093 AliTRDcluster* c=(AliTRDcluster*)(timeBin[i]);
1095 if (c->GetY() > y+road) break;
1096 if (c->IsUsed() > 0) continue;
1097 if((c->GetZ()-z)*(c->GetZ()-z) > 12 * sz2) continue;
1099 Double_t h01 = GetTiltFactor(c);
1100 Double_t chi2=t.GetPredictedChi2(c, h01);
1102 if (chi2 > maxChi2) continue;
1105 index=timeBin.GetIndex(i);
1111 wYclosest = cl->GetY();
1112 wZclosest = cl->GetZ();
1113 Double_t h01 = GetTiltFactor(cl);
1115 t.SetSampledEdx(cl->GetQ()/dx,t.GetNumberOfClusters());
1116 if(!t.Update(cl,maxChi2,index,h01)) {
1117 if(!tryAgain--) return 0;
1119 else tryAgain=fMaxGap;
1122 if (tryAgain==0) break;
1127 if((((Int_t) wTB)%15 == 0) || (((Int_t) wTB)%15 == 14)) {
1129 printf(" %f", wIndex); //1
1130 printf(" %f", wTB); //2
1131 printf(" %f", wYrt); //3
1132 printf(" %f", wYclosest); //4
1133 printf(" %f", wYcorrect); //5
1134 printf(" %f", wYwindow); //6
1135 printf(" %f", wZrt); //7
1136 printf(" %f", wZclosest); //8
1137 printf(" %f", wZcorrect); //9
1138 printf(" %f", wZwindow); //10
1139 printf(" %f", wPx); //11
1140 printf(" %f", wPy); //12
1141 printf(" %f", wPz); //13
1142 printf(" %f", wSigmaC2*1000000); //14
1143 printf(" %f", wSigmaTgl2*1000); //15
1144 printf(" %f", wSigmaY2); //16
1145 // printf(" %f", wSigmaZ2); //17
1146 printf(" %f", wChi2); //17
1147 printf(" %f", wC); //18
1154 return expectedNumberOfClusters;
1159 //___________________________________________________________________
1161 Int_t AliTRDtracker::FollowBackProlongation(AliTRDtrack& t)
1163 // Starting from current radial position of track <t> this function
1164 // extrapolates the track up to outer timebin and in the sensitive
1165 // layers confirms prolongation if a close cluster is found.
1166 // Returns the number of clusters expected to be found in sensitive layers
1168 Float_t wIndex, wTB, wChi2;
1169 Float_t wYrt, wYclosest, wYcorrect, wYwindow;
1170 Float_t wZrt, wZclosest, wZcorrect, wZwindow;
1171 Float_t wPx, wPy, wPz, wC;
1172 Double_t px, py, pz;
1173 Float_t wSigmaC2, wSigmaTgl2, wSigmaY2, wSigmaZ2;
1175 Int_t trackIndex = t.GetLabel();
1176 Int_t tryAgain=fMaxGap;
1178 Double_t alpha=t.GetAlpha();
1179 TVector2::Phi_0_2pi(alpha);
1183 Int_t outerTB = fTrSec[0]->GetOuterTimeBin();
1184 Double_t radLength, rho, x, dx, y, ymax = 0, z;
1185 Bool_t lookForCluster;
1187 Int_t expectedNumberOfClusters = 0;
1190 alpha=AliTRDgeometry::GetAlpha(); // note: change in meaning
1192 Int_t nRefPlane = fgkFirstPlane;
1193 Bool_t isNewLayer = kFALSE;
1198 for (Int_t nr=fTrSec[0]->GetLayerNumber(t.GetX()); nr<outerTB+1; nr++) {
1203 // first propagate to the outer surface of the current time bin
1206 fTrSec[s]->GetLayer(nr)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1207 x = fTrSec[s]->GetLayer(nr)->GetX()+dx/2;
1211 if(!t.PropagateTo(x,radLength,rho)) break;
1212 if (!AdjustSector(&t)) break;
1214 if (!t.PropagateTo(x,radLength,rho)) break;
1219 // Barrel Tracks [SR, 04.04.2003]
1222 if (fTrSec[s]->GetLayer(nr)->IsSensitive() !=
1223 fTrSec[s]->GetLayer(nr+1)->IsSensitive() ) {
1225 // if (IsStoringBarrel()) StoreBarrelTrack(&t, nRefPlane++, kTrackBack);
1228 if (fTrSec[s]->GetLayer(nr-1)->IsSensitive() &&
1229 ! fTrSec[s]->GetLayer(nr)->IsSensitive()) {
1231 } else {isNewLayer = kFALSE;}
1236 // now propagate to the middle plane of the next time bin
1237 fTrSec[s]->GetLayer(nr+1)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1239 x = fTrSec[s]->GetLayer(nr+1)->GetX();
1240 if(!t.PropagateTo(x,radLength,rho)) break;
1241 if (!AdjustSector(&t)) break;
1243 if(!t.PropagateTo(x,radLength,rho)) break;
1248 if(fVocal) printf("nr+1=%d, x %f, z %f, y %f, ymax %f\n",nr+1,x,z,y,ymax);
1249 // printf("label %d, pl %d, lookForCluster %d \n",
1250 // trackIndex, nr+1, lookForCluster);
1252 if(lookForCluster) {
1253 expectedNumberOfClusters++;
1255 wIndex = (Float_t) t.GetLabel();
1256 wTB = fTrSec[s]->GetLayer(nr+1)->GetTimeBinIndex();
1258 AliTRDpropagationLayer& timeBin=*(fTrSec[s]->GetLayer(nr+1));
1259 Double_t sy2=ExpectedSigmaY2(t.GetX(),t.GetTgl(),t.GetPt());
1260 Double_t sz2=ExpectedSigmaZ2(t.GetX(),t.GetTgl());
1261 if((t.GetSigmaY2() + sy2) < 0) break;
1262 Double_t road = 10.*sqrt(t.GetSigmaY2() + sy2);
1263 Double_t y=t.GetY(), z=t.GetZ();
1267 wYwindow = (Float_t) road;
1268 t.GetPxPyPz(px,py,pz);
1272 wC = (Float_t) t.GetC();
1273 wSigmaC2 = (Float_t) t.GetSigmaC2();
1274 wSigmaTgl2 = (Float_t) t.GetSigmaTgl2();
1275 wSigmaY2 = (Float_t) t.GetSigmaY2();
1276 wSigmaZ2 = (Float_t) t.GetSigmaZ2();
1279 if (road>fgkWideRoad) {
1280 if (t.GetNumberOfClusters()>4)
1281 cerr<<t.GetNumberOfClusters()
1282 <<"FindProlongation warning: Too broad road !\n";
1286 AliTRDcluster *cl=0;
1289 Double_t maxChi2=fgkMaxChi2;
1294 maxChi2 = 10 * fgkMaxChi2;
1297 if (nRefPlane == fgkFirstPlane) maxChi2 = 20 * fgkMaxChi2;
1298 if (nRefPlane == fgkFirstPlane+2) maxChi2 = 15 * fgkMaxChi2;
1299 if (t.GetNRotate() > 0) maxChi2 = 3 * maxChi2;
1302 wYclosest = 12345678;
1303 wYcorrect = 12345678;
1304 wZclosest = 12345678;
1305 wZcorrect = 12345678;
1306 wZwindow = TMath::Sqrt(2.25 * 12 * sz2);
1308 // Find the closest correct cluster for debugging purposes
1311 for (Int_t i=0; i<timeBin; i++) {
1312 AliTRDcluster* c=(AliTRDcluster*)(timeBin[i]);
1313 if((c->GetLabel(0) != trackIndex) &&
1314 (c->GetLabel(1) != trackIndex) &&
1315 (c->GetLabel(2) != trackIndex)) continue;
1316 if(TMath::Abs(c->GetY() - y) > minDY) continue;
1317 //minDY = TMath::Abs(c->GetY() - y);
1318 minDY = c->GetY() - y;
1319 wYcorrect = c->GetY();
1320 wZcorrect = c->GetZ();
1322 Double_t h01 = GetTiltFactor(c);
1323 wChi2 = t.GetPredictedChi2(c, h01);
1327 // Now go for the real cluster search
1331 for (Int_t i=timeBin.Find(y-road); i<timeBin; i++) {
1332 AliTRDcluster* c=(AliTRDcluster*)(timeBin[i]);
1333 if (c->GetY() > y+road) break;
1334 if (c->IsUsed() > 0) continue;
1335 if((c->GetZ()-z)*(c->GetZ()-z) > 3 * sz2) continue;
1337 Double_t h01 = GetTiltFactor(c);
1338 chi2=t.GetPredictedChi2(c,h01);
1340 if (chi2 > maxChi2) continue;
1343 index=timeBin.GetIndex(i);
1346 if((c->GetLabel(0) != trackIndex) &&
1347 (c->GetLabel(1) != trackIndex) &&
1348 (c->GetLabel(2) != trackIndex)) t.AddNWrong();
1353 for (Int_t i=timeBin.Find(y-road); i<timeBin; i++) {
1354 AliTRDcluster* c=(AliTRDcluster*)(timeBin[i]);
1356 if (c->GetY() > y+road) break;
1357 if (c->IsUsed() > 0) continue;
1358 if((c->GetZ()-z)*(c->GetZ()-z) > 2.25 * 12 * sz2) continue;
1360 Double_t h01 = GetTiltFactor(c);
1361 chi2=t.GetPredictedChi2(c,h01);
1363 if (chi2 > maxChi2) continue;
1366 index=timeBin.GetIndex(i);
1371 wYclosest = cl->GetY();
1372 wZclosest = cl->GetZ();
1374 t.SetSampledEdx(cl->GetQ()/dx,t.GetNumberOfClusters());
1375 Double_t h01 = GetTiltFactor(cl);
1376 if(!t.Update(cl,maxChi2,index,h01)) {
1377 if(!tryAgain--) return 0;
1379 else tryAgain=fMaxGap;
1382 if (tryAgain==0) break;
1385 //if (minDY < 1000000 && isNewLayer)
1386 //cout << "\t" << nRefPlane << "\t" << "\t" << t.GetNRotate() << "\t" <<
1387 // road << "\t" << minDY << "\t" << chi2 << "\t" << wChi2 << "\t" << maxChi2 << endl;
1391 isNewLayer = kFALSE;
1394 if((((Int_t) wTB)%15 == 0) || (((Int_t) wTB)%15 == 14)) {
1396 printf(" %f", wIndex); //1
1397 printf(" %f", wTB); //2
1398 printf(" %f", wYrt); //3
1399 printf(" %f", wYclosest); //4
1400 printf(" %f", wYcorrect); //5
1401 printf(" %f", wYwindow); //6
1402 printf(" %f", wZrt); //7
1403 printf(" %f", wZclosest); //8
1404 printf(" %f", wZcorrect); //9
1405 printf(" %f", wZwindow); //10
1406 printf(" %f", wPx); //11
1407 printf(" %f", wPy); //12
1408 printf(" %f", wPz); //13
1409 printf(" %f", wSigmaC2*1000000); //14
1410 printf(" %f", wSigmaTgl2*1000); //15
1411 printf(" %f", wSigmaY2); //16
1412 // printf(" %f", wSigmaZ2); //17
1413 printf(" %f", wChi2); //17
1414 printf(" %f", wC); //18
1421 return expectedNumberOfClusters;
1426 //---------------------------------------------------------------------------
1427 Int_t AliTRDtracker::Refit(AliTRDtrack& t, Int_t rf)
1429 // Starting from current position on track=t this function tries
1430 // to extrapolate the track up to timeBin=0 and to reuse already
1431 // assigned clusters. Returns the number of clusters
1432 // expected to be found in sensitive layers
1433 // get indices of assigned clusters for each layer
1434 // Origin: Thomas KUHR (Thomas.Kuhr@cern.ch)
1437 for (Int_t i = 0; i < 90; i++) iCluster[i] = 0;
1438 for (Int_t i = 0; i < t.GetNumberOfClusters(); i++) {
1439 Int_t index = t.GetClusterIndex(i);
1440 AliTRDcluster *cl=(AliTRDcluster*) GetCluster(index);
1442 Int_t detector=cl->GetDetector();
1443 Int_t localTimeBin=cl->GetLocalTimeBin();
1444 Int_t sector=fGeom->GetSector(detector);
1445 Int_t plane=fGeom->GetPlane(detector);
1447 Int_t trackingSector = CookSectorIndex(sector);
1449 Int_t gtb = fTrSec[trackingSector]->CookTimeBinIndex(plane,localTimeBin);
1450 if(gtb < 0) continue;
1451 Int_t layer = fTrSec[trackingSector]->GetLayerNumber(gtb);
1452 iCluster[layer] = index;
1456 Int_t ns=Int_t(2*TMath::Pi()/AliTRDgeometry::GetAlpha()+0.5);
1458 Double_t alpha=t.GetAlpha();
1459 alpha = TVector2::Phi_0_2pi(alpha);
1461 Int_t s=Int_t(alpha/AliTRDgeometry::GetAlpha())%AliTRDgeometry::kNsect;
1462 Double_t radLength, rho, x, dx, y, ymax, z;
1464 Int_t expectedNumberOfClusters = 0;
1465 Bool_t lookForCluster;
1467 alpha=AliTRDgeometry::GetAlpha(); // note: change in meaning
1470 for (Int_t nr=fTrSec[0]->GetLayerNumber(t.GetX()); nr>rf; nr--) {
1472 y = t.GetY(); z = t.GetZ();
1474 // first propagate to the inner surface of the current time bin
1475 fTrSec[s]->GetLayer(nr)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1476 x = fTrSec[s]->GetLayer(nr)->GetX()-dx/2; y = t.GetY(); z = t.GetZ();
1477 if(!t.PropagateTo(x,radLength,rho)) break;
1479 ymax = x*TMath::Tan(0.5*alpha);
1482 if (!t.Rotate(alpha)) break;
1483 if(!t.PropagateTo(x,radLength,rho)) break;
1484 } else if (y <-ymax) {
1486 if (!t.Rotate(-alpha)) break;
1487 if(!t.PropagateTo(x,radLength,rho)) break;
1490 y = t.GetY(); z = t.GetZ();
1492 // now propagate to the middle plane of the next time bin
1493 fTrSec[s]->GetLayer(nr-1)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1494 x = fTrSec[s]->GetLayer(nr-1)->GetX(); y = t.GetY(); z = t.GetZ();
1495 if(!t.PropagateTo(x,radLength,rho)) break;
1497 ymax = x*TMath::Tan(0.5*alpha);
1500 if (!t.Rotate(alpha)) break;
1501 if(!t.PropagateTo(x,radLength,rho)) break;
1502 } else if (y <-ymax) {
1504 if (!t.Rotate(-alpha)) break;
1505 if(!t.PropagateTo(x,radLength,rho)) break;
1508 if(lookForCluster) expectedNumberOfClusters++;
1510 // use assigned cluster
1511 if (!iCluster[nr-1]) continue;
1512 AliTRDcluster *cl=(AliTRDcluster*)GetCluster(iCluster[nr-1]);
1513 Double_t h01 = GetTiltFactor(cl);
1514 Double_t chi2=t.GetPredictedChi2(cl, h01);
1515 t.SetSampledEdx(cl->GetQ()/dx,t.GetNumberOfClusters());
1516 t.Update(cl,chi2,iCluster[nr-1],h01);
1519 return expectedNumberOfClusters;
1522 //___________________________________________________________________
1524 Int_t AliTRDtracker::PropagateToOuterPlane(AliTRDtrack& t, Double_t xToGo)
1526 // Starting from current radial position of track <t> this function
1527 // extrapolates the track up to radial position <xToGo>.
1528 // Returns 1 if track reaches the plane, and 0 otherwise
1530 Int_t ns=Int_t(2*TMath::Pi()/AliTRDgeometry::GetAlpha()+0.5);
1532 Double_t alpha=t.GetAlpha();
1534 if (alpha > 2.*TMath::Pi()) alpha -= 2.*TMath::Pi();
1535 if (alpha < 0. ) alpha += 2.*TMath::Pi();
1537 Int_t s=Int_t(alpha/AliTRDgeometry::GetAlpha())%AliTRDgeometry::kNsect;
1539 Bool_t lookForCluster;
1540 Double_t radLength, rho, x, dx, y, ymax, z;
1544 alpha=AliTRDgeometry::GetAlpha(); // note: change in meaning
1546 Int_t plToGo = fTrSec[0]->GetLayerNumber(xToGo);
1548 for (Int_t nr=fTrSec[0]->GetLayerNumber(x); nr<plToGo; nr++) {
1550 y = t.GetY(); z = t.GetZ();
1552 // first propagate to the outer surface of the current time bin
1553 fTrSec[s]->GetLayer(nr)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1554 x = fTrSec[s]->GetLayer(nr)->GetX()+dx/2; y = t.GetY(); z = t.GetZ();
1555 if(!t.PropagateTo(x,radLength,rho)) return 0;
1557 ymax = x*TMath::Tan(0.5*alpha);
1560 if (!t.Rotate(alpha)) return 0;
1561 } else if (y <-ymax) {
1563 if (!t.Rotate(-alpha)) return 0;
1565 if(!t.PropagateTo(x,radLength,rho)) return 0;
1567 y = t.GetY(); z = t.GetZ();
1569 // now propagate to the middle plane of the next time bin
1570 fTrSec[s]->GetLayer(nr+1)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1571 x = fTrSec[s]->GetLayer(nr+1)->GetX(); y = t.GetY(); z = t.GetZ();
1572 if(!t.PropagateTo(x,radLength,rho)) return 0;
1574 ymax = x*TMath::Tan(0.5*alpha);
1577 if (!t.Rotate(alpha)) return 0;
1578 } else if (y <-ymax) {
1580 if (!t.Rotate(-alpha)) return 0;
1582 if(!t.PropagateTo(x,radLength,rho)) return 0;
1587 //___________________________________________________________________
1589 Int_t AliTRDtracker::PropagateToTPC(AliTRDtrack& t)
1591 // Starting from current radial position of track <t> this function
1592 // extrapolates the track up to radial position of the outermost
1593 // padrow of the TPC.
1594 // Returns 1 if track reaches the TPC, and 0 otherwise
1596 //Int_t ns=Int_t(2*TMath::Pi()/AliTRDgeometry::GetAlpha()+0.5);
1598 Double_t alpha=t.GetAlpha();
1599 alpha = TVector2::Phi_0_2pi(alpha);
1601 Int_t s=Int_t(alpha/AliTRDgeometry::GetAlpha())%AliTRDgeometry::kNsect;
1603 Bool_t lookForCluster;
1604 Double_t radLength, rho, x, dx, y, /*ymax,*/ z;
1608 alpha=AliTRDgeometry::GetAlpha(); // note: change in meaning
1609 Int_t plTPC = fTrSec[0]->GetLayerNumber(246.055);
1611 for (Int_t nr=fTrSec[0]->GetLayerNumber(x); nr>plTPC; nr--) {
1616 // first propagate to the outer surface of the current time bin
1617 fTrSec[s]->GetLayer(nr)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1618 x = fTrSec[s]->GetLayer(nr)->GetX()-dx/2;
1620 if(!t.PropagateTo(x,radLength,rho)) return 0;
1622 if(!t.PropagateTo(x,radLength,rho)) return 0;
1627 // now propagate to the middle plane of the next time bin
1628 fTrSec[s]->GetLayer(nr-1)->GetPropagationParameters(y,z,dx,rho,radLength,lookForCluster);
1629 x = fTrSec[s]->GetLayer(nr-1)->GetX();
1631 if(!t.PropagateTo(x,radLength,rho)) return 0;
1633 if(!t.PropagateTo(x,radLength,rho)) return 0;
1638 void AliTRDtracker::LoadEvent()
1640 // Fills clusters into TRD tracking_sectors
1641 // Note that the numbering scheme for the TRD tracking_sectors
1642 // differs from that of TRD sectors
1644 ReadClusters(fClusters);
1645 Int_t ncl=fClusters->GetEntriesFast();
1646 cout<<"\n LoadSectors: sorting "<<ncl<<" clusters"<<endl;
1650 // printf("\r %d left ",ncl);
1651 AliTRDcluster *c=(AliTRDcluster*)fClusters->UncheckedAt(ncl);
1652 Int_t detector=c->GetDetector();
1653 Int_t localTimeBin=c->GetLocalTimeBin();
1654 Int_t sector=fGeom->GetSector(detector);
1655 Int_t plane=fGeom->GetPlane(detector);
1657 Int_t trackingSector = CookSectorIndex(sector);
1659 Int_t gtb = fTrSec[trackingSector]->CookTimeBinIndex(plane,localTimeBin);
1660 if(gtb < 0) continue;
1661 Int_t layer = fTrSec[trackingSector]->GetLayerNumber(gtb);
1664 fTrSec[trackingSector]->GetLayer(layer)->InsertCluster(c,index);
1670 //_____________________________________________________________________________
1671 Int_t AliTRDtracker::LoadClusters(TTree *cTree)
1673 // Fills clusters into TRD tracking_sectors
1674 // Note that the numbering scheme for the TRD tracking_sectors
1675 // differs from that of TRD sectors
1677 if (ReadClusters(fClusters,cTree)) {
1678 Error("LoadClusters","Problem with reading the clusters !");
1681 Int_t ncl=fClusters->GetEntriesFast();
1682 cout<<"\n LoadSectors: sorting "<<ncl<<" clusters"<<endl;
1686 // printf("\r %d left ",ncl);
1687 AliTRDcluster *c=(AliTRDcluster*)fClusters->UncheckedAt(ncl);
1688 Int_t detector=c->GetDetector();
1689 Int_t localTimeBin=c->GetLocalTimeBin();
1690 Int_t sector=fGeom->GetSector(detector);
1691 Int_t plane=fGeom->GetPlane(detector);
1693 Int_t trackingSector = CookSectorIndex(sector);
1695 Int_t gtb = fTrSec[trackingSector]->CookTimeBinIndex(plane,localTimeBin);
1696 if(gtb < 0) continue;
1697 Int_t layer = fTrSec[trackingSector]->GetLayerNumber(gtb);
1700 fTrSec[trackingSector]->GetLayer(layer)->InsertCluster(c,index);
1707 //_____________________________________________________________________________
1708 void AliTRDtracker::UnloadEvent()
1711 // Clears the arrays of clusters and tracks. Resets sectors and timebins
1716 nentr = fClusters->GetEntriesFast();
1717 for (i = 0; i < nentr; i++) delete fClusters->RemoveAt(i);
1719 nentr = fSeeds->GetEntriesFast();
1720 for (i = 0; i < nentr; i++) delete fSeeds->RemoveAt(i);
1722 nentr = fTracks->GetEntriesFast();
1723 for (i = 0; i < nentr; i++) delete fTracks->RemoveAt(i);
1725 Int_t nsec = AliTRDgeometry::kNsect;
1727 for (i = 0; i < nsec; i++) {
1728 for(Int_t pl = 0; pl < fTrSec[i]->GetNumberOfLayers(); pl++) {
1729 fTrSec[i]->GetLayer(pl)->Clear();
1735 //__________________________________________________________________________
1736 void AliTRDtracker::MakeSeeds(Int_t inner, Int_t outer, Int_t turn)
1738 // Creates track seeds using clusters in timeBins=i1,i2
1741 cerr<<"MakeSeeds: turn "<<turn<<" exceeds the limit of 2"<<endl;
1745 Double_t x[5], c[15];
1746 Int_t maxSec=AliTRDgeometry::kNsect;
1748 Double_t alpha=AliTRDgeometry::GetAlpha();
1749 Double_t shift=AliTRDgeometry::GetAlpha()/2.;
1750 Double_t cs=cos(alpha), sn=sin(alpha);
1751 Double_t cs2=cos(2.*alpha), sn2=sin(2.*alpha);
1754 Int_t i2 = fTrSec[0]->GetLayerNumber(inner);
1755 Int_t i1 = fTrSec[0]->GetLayerNumber(outer);
1757 Double_t x1 =fTrSec[0]->GetX(i1);
1758 Double_t xx2=fTrSec[0]->GetX(i2);
1760 for (Int_t ns=0; ns<maxSec; ns++) {
1762 Int_t nl2 = *(fTrSec[(ns-2+maxSec)%maxSec]->GetLayer(i2));
1763 Int_t nl=(*fTrSec[(ns-1+maxSec)%maxSec]->GetLayer(i2));
1764 Int_t nm=(*fTrSec[ns]->GetLayer(i2));
1765 Int_t nu=(*fTrSec[(ns+1)%maxSec]->GetLayer(i2));
1766 Int_t nu2=(*fTrSec[(ns+2)%maxSec]->GetLayer(i2));
1768 AliTRDpropagationLayer& r1=*(fTrSec[ns]->GetLayer(i1));
1770 for (Int_t is=0; is < r1; is++) {
1771 Double_t y1=r1[is]->GetY(), z1=r1[is]->GetZ();
1773 for (Int_t js=0; js < nl2+nl+nm+nu+nu2; js++) {
1775 const AliTRDcluster *cl;
1776 Double_t x2, y2, z2;
1777 Double_t x3=0., y3=0.;
1780 if(turn != 2) continue;
1781 AliTRDpropagationLayer& r2=*(fTrSec[(ns-2+maxSec)%maxSec]->GetLayer(i2));
1783 y2=cl->GetY(); z2=cl->GetZ();
1788 else if (js<nl2+nl) {
1789 if(turn != 1) continue;
1790 AliTRDpropagationLayer& r2=*(fTrSec[(ns-1+maxSec)%maxSec]->GetLayer(i2));
1792 y2=cl->GetY(); z2=cl->GetZ();
1797 else if (js<nl2+nl+nm) {
1798 if(turn != 1) continue;
1799 AliTRDpropagationLayer& r2=*(fTrSec[ns]->GetLayer(i2));
1801 x2=xx2; y2=cl->GetY(); z2=cl->GetZ();
1803 else if (js<nl2+nl+nm+nu) {
1804 if(turn != 1) continue;
1805 AliTRDpropagationLayer& r2=*(fTrSec[(ns+1)%maxSec]->GetLayer(i2));
1806 cl=r2[js-nl2-nl-nm];
1807 y2=cl->GetY(); z2=cl->GetZ();
1813 if(turn != 2) continue;
1814 AliTRDpropagationLayer& r2=*(fTrSec[(ns+2)%maxSec]->GetLayer(i2));
1815 cl=r2[js-nl2-nl-nm-nu];
1816 y2=cl->GetY(); z2=cl->GetZ();
1822 if(TMath::Abs(z1-z2) > fgkMaxSeedDeltaZ12) continue;
1824 Double_t zz=z1 - z1/x1*(x1-x2);
1826 if (TMath::Abs(zz-z2)>fgkMaxSeedDeltaZ) continue;
1828 Double_t d=(x2-x1)*(0.-y2)-(0.-x2)*(y2-y1);
1829 if (d==0.) {cerr<<"TRD MakeSeeds: Straight seed !\n"; continue;}
1833 x[4]=f1trd(x1,y1,x2,y2,x3,y3);
1835 if (TMath::Abs(x[4]) > fgkMaxSeedC) continue;
1837 x[2]=f2trd(x1,y1,x2,y2,x3,y3);
1839 if (TMath::Abs(x[4]*x1-x[2]) >= 0.99999) continue;
1841 x[3]=f3trd(x1,y1,x2,y2,z1,z2);
1843 if (TMath::Abs(x[3]) > fgkMaxSeedTan) continue;
1845 Double_t a=asin(x[2]);
1846 Double_t zv=z1 - x[3]/x[4]*(a+asin(x[4]*x1-x[2]));
1848 if (TMath::Abs(zv)>fgkMaxSeedVertexZ) continue;
1850 Double_t sy1=r1[is]->GetSigmaY2(), sz1=r1[is]->GetSigmaZ2();
1851 Double_t sy2=cl->GetSigmaY2(), sz2=cl->GetSigmaZ2();
1852 Double_t sy3=fgkSeedErrorSY3, sy=fgkSeedErrorSY, sz=fgkSeedErrorSZ;
1855 Double_t h01 = GetTiltFactor(r1[is]);
1856 Double_t xuFactor = 100.;
1862 sy1=sy1+sz1*h01*h01;
1863 Double_t syz=sz1*(-h01);
1864 // end of tilt changes
1866 Double_t f40=(f1trd(x1,y1+sy,x2,y2,x3,y3)-x[4])/sy;
1867 Double_t f42=(f1trd(x1,y1,x2,y2+sy,x3,y3)-x[4])/sy;
1868 Double_t f43=(f1trd(x1,y1,x2,y2,x3,y3+sy)-x[4])/sy;
1869 Double_t f20=(f2trd(x1,y1+sy,x2,y2,x3,y3)-x[2])/sy;
1870 Double_t f22=(f2trd(x1,y1,x2,y2+sy,x3,y3)-x[2])/sy;
1871 Double_t f23=(f2trd(x1,y1,x2,y2,x3,y3+sy)-x[2])/sy;
1872 Double_t f30=(f3trd(x1,y1+sy,x2,y2,z1,z2)-x[3])/sy;
1873 Double_t f31=(f3trd(x1,y1,x2,y2,z1+sz,z2)-x[3])/sz;
1874 Double_t f32=(f3trd(x1,y1,x2,y2+sy,z1,z2)-x[3])/sy;
1875 Double_t f34=(f3trd(x1,y1,x2,y2,z1,z2+sz)-x[3])/sz;
1879 // c[1]=0.; c[2]=sz1;
1880 c[1]=syz; c[2]=sz1*xuFactor;
1881 c[3]=f20*sy1; c[4]=0.; c[5]=f20*sy1*f20+f22*sy2*f22+f23*sy3*f23;
1882 c[6]=f30*sy1; c[7]=f31*sz1; c[8]=f30*sy1*f20+f32*sy2*f22;
1883 c[9]=f30*sy1*f30+f31*sz1*f31+f32*sy2*f32+f34*sz2*f34;
1884 c[10]=f40*sy1; c[11]=0.; c[12]=f40*sy1*f20+f42*sy2*f22+f43*sy3*f23;
1885 c[13]=f30*sy1*f40+f32*sy2*f42;
1886 c[14]=f40*sy1*f40+f42*sy2*f42+f43*sy3*f43;
1888 UInt_t index=r1.GetIndex(is);
1890 AliTRDtrack *track=new AliTRDtrack(r1[is],index,x,c,x1,ns*alpha+shift);
1892 Int_t rc=FollowProlongation(*track, i2);
1895 (track->GetNumberOfClusters() <
1896 (outer-inner)*fgkMinClustersInSeed)) delete track;
1898 fSeeds->AddLast(track); fNseeds++;
1899 // cerr<<"\r found seed "<<fNseeds;
1906 //_____________________________________________________________________________
1907 Int_t AliTRDtracker::ReadClusters(TObjArray *array, TTree *ClusterTree)
1910 // Reads AliTRDclusters (option >= 0) or AliTRDrecPoints (option < 0)
1911 // from the file. The names of the cluster tree and branches
1912 // should match the ones used in AliTRDclusterizer::WriteClusters()
1914 TObjArray *clusterArray = new TObjArray(400);
1916 TBranch *branch=ClusterTree->GetBranch("TRDcluster");
1918 Error("ReadClusters","Can't get the branch !");
1921 branch->SetAddress(&clusterArray);
1923 Int_t nEntries = (Int_t) ClusterTree->GetEntries();
1924 printf("found %d entries in %s.\n",nEntries,ClusterTree->GetName());
1926 // Loop through all entries in the tree
1928 AliTRDcluster *c = 0;
1931 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
1934 nbytes += ClusterTree->GetEvent(iEntry);
1936 // Get the number of points in the detector
1937 Int_t nCluster = clusterArray->GetEntriesFast();
1938 // printf("\r Read %d clusters from entry %d", nCluster, iEntry);
1940 // Loop through all TRD digits
1941 for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) {
1942 c = (AliTRDcluster*)clusterArray->UncheckedAt(iCluster);
1943 AliTRDcluster *co = new AliTRDcluster(*c);
1944 co->SetSigmaY2(c->GetSigmaY2() * fSY2corr);
1945 Int_t ltb = co->GetLocalTimeBin();
1946 if(ltb == 19) co->SetSigmaZ2(c->GetSigmaZ2());
1947 else if(fNoTilt) co->SetSigmaZ2(c->GetSigmaZ2() * fSZ2corr);
1949 delete clusterArray->RemoveAt(iCluster);
1953 delete clusterArray;
1958 //______________________________________________________________________
1959 void AliTRDtracker::ReadClusters(TObjArray *array, const Char_t *filename)
1962 // Reads AliTRDclusters from file <filename>. The names of the cluster
1963 // tree and branches should match the ones used in
1964 // AliTRDclusterizer::WriteClusters()
1965 // if <array> == 0, clusters are added into AliTRDtracker fCluster array
1968 TDirectory *savedir=gDirectory;
1970 TFile *file = TFile::Open(filename);
1971 if (!file->IsOpen()) {
1972 cerr<<"Can't open file with TRD clusters"<<endl;
1976 Char_t treeName[12];
1977 sprintf(treeName,"TreeR%d_TRD",GetEventNumber());
1978 TTree *clusterTree = (TTree*) gDirectory->Get(treeName);
1981 cerr<<"AliTRDtracker::ReadClusters(): ";
1982 cerr<<"can't get a tree with clusters !\n";
1986 TObjArray *clusterArray = new TObjArray(400);
1988 clusterTree->GetBranch("TRDcluster")->SetAddress(&clusterArray);
1990 Int_t nEntries = (Int_t) clusterTree->GetEntries();
1991 cout<<"found "<<nEntries<<" in clusterTree"<<endl;
1993 // Loop through all entries in the tree
1995 AliTRDcluster *c = 0;
1999 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
2002 nbytes += clusterTree->GetEvent(iEntry);
2004 // Get the number of points in the detector
2005 Int_t nCluster = clusterArray->GetEntriesFast();
2006 printf("\n Read %d clusters from entry %d", nCluster, iEntry);
2008 // Loop through all TRD digits
2009 for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) {
2010 c = (AliTRDcluster*)clusterArray->UncheckedAt(iCluster);
2011 AliTRDcluster *co = new AliTRDcluster(*c);
2012 co->SetSigmaY2(c->GetSigmaY2() * fSY2corr);
2013 Int_t ltb = co->GetLocalTimeBin();
2014 if(ltb == 19) co->SetSigmaZ2(c->GetSigmaZ2());
2015 else if(fNoTilt) co->SetSigmaZ2(c->GetSigmaZ2() * fSZ2corr);
2017 delete clusterArray->RemoveAt(iCluster);
2022 delete clusterArray;
2027 void AliTRDtracker::ReadClusters(TObjArray *array, const TFile *inp)
2030 // Reads AliTRDclusters (option >= 0) or AliTRDrecPoints (option < 0)
2031 // from the file. The names of the cluster tree and branches
2032 // should match the ones used in AliTRDclusterizer::WriteClusters()
2035 TDirectory *savedir=gDirectory;
2038 TFile *in=(TFile*)inp;
2039 if (!in->IsOpen()) {
2040 cerr<<"AliTRDtracker::ReadClusters(): input file is not open !\n";
2048 Char_t treeName[12];
2049 sprintf(treeName,"TreeR%d_TRD",GetEventNumber());
2050 TTree *clusterTree = (TTree*) gDirectory->Get(treeName);
2052 TObjArray *clusterArray = new TObjArray(400);
2054 clusterTree->GetBranch("TRDcluster")->SetAddress(&clusterArray);
2056 Int_t nEntries = (Int_t) clusterTree->GetEntries();
2057 printf("found %d entries in %s.\n",nEntries,clusterTree->GetName());
2059 // Loop through all entries in the tree
2061 AliTRDcluster *c = 0;
2064 for (Int_t iEntry = 0; iEntry < nEntries; iEntry++) {
2067 nbytes += clusterTree->GetEvent(iEntry);
2069 // Get the number of points in the detector
2070 Int_t nCluster = clusterArray->GetEntriesFast();
2071 // printf("\r Read %d clusters from entry %d", nCluster, iEntry);
2073 // Loop through all TRD digits
2074 for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) {
2075 c = (AliTRDcluster*)clusterArray->UncheckedAt(iCluster);
2076 AliTRDcluster *co = new AliTRDcluster(*c);
2077 co->SetSigmaY2(c->GetSigmaY2() * fSY2corr);
2078 Int_t ltb = co->GetLocalTimeBin();
2079 if(ltb == 19) co->SetSigmaZ2(c->GetSigmaZ2());
2080 else if(fNoTilt) co->SetSigmaZ2(c->GetSigmaZ2() * fSZ2corr);
2082 delete clusterArray->RemoveAt(iCluster);
2086 delete clusterArray;
2091 //__________________________________________________________________
2092 void AliTRDtracker::CookLabel(AliKalmanTrack* pt, Float_t wrong) const
2095 // This cooks a label. Mmmmh, smells good...
2098 Int_t label=123456789, index, i, j;
2099 Int_t ncl=pt->GetNumberOfClusters();
2100 const Int_t kRange = fTrSec[0]->GetOuterTimeBin()+1;
2104 // Int_t s[kRange][2];
2105 Int_t **s = new Int_t* [kRange];
2106 for (i=0; i<kRange; i++) {
2107 s[i] = new Int_t[2];
2109 for (i=0; i<kRange; i++) {
2115 for (i=0; i<ncl; i++) {
2116 index=pt->GetClusterIndex(i);
2117 AliTRDcluster *c=(AliTRDcluster*)fClusters->UncheckedAt(index);
2123 for (i=0; i<ncl; i++) {
2124 index=pt->GetClusterIndex(i);
2125 AliTRDcluster *c=(AliTRDcluster*)fClusters->UncheckedAt(index);
2126 for (Int_t k=0; k<3; k++) {
2127 label=c->GetLabel(k);
2128 labelAdded=kFALSE; j=0;
2130 while ( (!labelAdded) && ( j < kRange ) ) {
2131 if (s[j][0]==label || s[j][1]==0) {
2145 for (i=0; i<kRange; i++) {
2147 max=s[i][1]; label=s[i][0];
2151 for (i=0; i<kRange; i++) {
2157 if ((1.- Float_t(max)/ncl) > wrong) label=-label;
2159 pt->SetLabel(label);
2164 //__________________________________________________________________
2165 void AliTRDtracker::UseClusters(const AliKalmanTrack* t, Int_t from) const
2168 // Use clusters, but don't abuse them!
2171 Int_t ncl=t->GetNumberOfClusters();
2172 for (Int_t i=from; i<ncl; i++) {
2173 Int_t index = t->GetClusterIndex(i);
2174 AliTRDcluster *c=(AliTRDcluster*)fClusters->UncheckedAt(index);
2180 //_____________________________________________________________________
2181 Double_t AliTRDtracker::ExpectedSigmaY2(Double_t , Double_t , Double_t ) const
2183 // Parametrised "expected" error of the cluster reconstruction in Y
2185 Double_t s = 0.08 * 0.08;
2189 //_____________________________________________________________________
2190 Double_t AliTRDtracker::ExpectedSigmaZ2(Double_t , Double_t ) const
2192 // Parametrised "expected" error of the cluster reconstruction in Z
2194 Double_t s = 9 * 9 /12.;
2198 //_____________________________________________________________________
2199 Double_t AliTRDtracker::GetX(Int_t sector, Int_t plane, Int_t localTB) const
2202 // Returns radial position which corresponds to time bin <localTB>
2203 // in tracking sector <sector> and plane <plane>
2206 Int_t index = fTrSec[sector]->CookTimeBinIndex(plane, localTB);
2207 Int_t pl = fTrSec[sector]->GetLayerNumber(index);
2208 return fTrSec[sector]->GetLayer(pl)->GetX();
2213 //_______________________________________________________
2214 AliTRDtracker::AliTRDpropagationLayer::AliTRDpropagationLayer(Double_t x,
2215 Double_t dx, Double_t rho, Double_t radLength, Int_t tbIndex)
2218 // AliTRDpropagationLayer constructor
2221 fN = 0; fX = x; fdX = dx; fRho = rho; fX0 = radLength;
2222 fClusters = NULL; fIndex = NULL; fTimeBinIndex = tbIndex;
2225 for(Int_t i=0; i < (Int_t) kZones; i++) {
2226 fZc[i]=0; fZmax[i] = 0;
2231 if(fTimeBinIndex >= 0) {
2232 fClusters = new AliTRDcluster*[kMaxClusterPerTimeBin];
2233 fIndex = new UInt_t[kMaxClusterPerTimeBin];
2246 //_______________________________________________________
2247 void AliTRDtracker::AliTRDpropagationLayer::SetHole(
2248 Double_t Zmax, Double_t Ymax, Double_t rho,
2249 Double_t radLength, Double_t Yc, Double_t Zc)
2252 // Sets hole in the layer
2261 fHoleX0 = radLength;
2265 //_______________________________________________________
2266 AliTRDtracker::AliTRDtrackingSector::AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs, AliTRDparameter* par)
2269 // AliTRDtrackingSector Constructor
2278 for(UInt_t i=0; i < kMaxTimeBinIndex; i++) fTimeBinIndex[i] = -1;
2281 AliTRDpropagationLayer* ppl;
2283 Double_t x, xin, xout, dx, rho, radLength;
2286 // set time bins in the gas of the TPC
2288 xin = 246.055; xout = 254.055; steps = 20; dx = (xout-xin)/steps;
2289 rho = 0.9e-3; radLength = 28.94;
2291 for(Int_t i=0; i<steps; i++) {
2292 x = xin + i*dx + dx/2;
2293 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2297 // set time bins in the outer field cage vessel
2299 dx = 50e-4; xin = xout; xout = xin + dx; rho = 1.71; radLength = 44.77; // Tedlar
2300 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2303 dx = 0.02; xin = xout; xout = xin + dx; rho = 1.45; radLength = 44.86; // prepreg
2304 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2307 dx = 2.; xin = xout; xout = xin + dx; rho = 1.45*0.02; radLength = 41.28; // Nomex
2308 steps = 5; dx = (xout - xin)/steps;
2309 for(Int_t i=0; i<steps; i++) {
2310 x = xin + i*dx + dx/2;
2311 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2315 dx = 0.02; xin = xout; xout = xin + dx; rho = 1.45; radLength = 44.86; // prepreg
2316 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2319 dx = 50e-4; xin = xout; xout = xin + dx; rho = 1.71; radLength = 44.77; // Tedlar
2320 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2324 // set time bins in CO2
2326 xin = xout; xout = 275.0;
2327 steps = 50; dx = (xout - xin)/steps;
2328 rho = 1.977e-3; radLength = 36.2;
2330 for(Int_t i=0; i<steps; i++) {
2331 x = xin + i*dx + dx/2;
2332 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2336 // set time bins in the outer containment vessel
2338 dx = 50e-4; xin = xout; xout = xin + dx; rho = 2.7; radLength = 24.01; // Al
2339 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2342 dx = 50e-4; xin = xout; xout = xin + dx; rho = 1.71; radLength = 44.77; // Tedlar
2343 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2346 dx = 0.06; xin = xout; xout = xin + dx; rho = 1.45; radLength = 44.86; // prepreg
2347 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2350 dx = 3.; xin = xout; xout = xin + dx; rho = 1.45*0.02; radLength = 41.28; // Nomex
2351 steps = 10; dx = (xout - xin)/steps;
2352 for(Int_t i=0; i<steps; i++) {
2353 x = xin + i*dx + dx/2;
2354 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2358 dx = 0.06; xin = xout; xout = xin + dx; rho = 1.45; radLength = 44.86; // prepreg
2359 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2362 dx = 50e-4; xin = xout; xout = xin + dx; rho = 1.71; radLength = 44.77; // Tedlar
2363 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2366 dx = 50e-4; xin = xout; xout = xin + dx; rho = 2.7; radLength = 24.01; // Al
2367 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2370 Double_t xtrd = (Double_t) fGeom->Rmin();
2372 // add layers between TPC and TRD (Air temporarily)
2373 xin = xout; xout = xtrd;
2374 steps = 50; dx = (xout - xin)/steps;
2375 rho = 1.2e-3; radLength = 36.66;
2377 for(Int_t i=0; i<steps; i++) {
2378 x = xin + i*dx + dx/2;
2379 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2384 Double_t alpha=AliTRDgeometry::GetAlpha();
2386 // add layers for each of the planes
2388 Double_t dxRo = (Double_t) fGeom->CroHght(); // Rohacell
2389 Double_t dxSpace = (Double_t) fGeom->Cspace(); // Spacing between planes
2390 Double_t dxAmp = (Double_t) fGeom->CamHght(); // Amplification region
2391 Double_t dxDrift = (Double_t) fGeom->CdrHght(); // Drift region
2392 Double_t dxRad = (Double_t) fGeom->CraHght(); // Radiator
2393 Double_t dxTEC = dxRad + dxDrift + dxAmp + dxRo;
2394 Double_t dxPlane = dxTEC + dxSpace;
2397 const Int_t kNchambers = AliTRDgeometry::Ncham();
2398 Double_t ymax = 0, holeYmax = 0;
2399 Double_t *zc = new Double_t[kNchambers];
2400 Double_t *zmax = new Double_t[kNchambers];
2401 Double_t holeZmax = 1000.; // the whole sector is missing
2403 for(Int_t plane = 0; plane < AliTRDgeometry::Nplan(); plane++) {
2406 xin = xtrd + plane * dxPlane; xout = xin + dxRad;
2407 steps = 12; dx = (xout - xin)/steps; rho = 0.074; radLength = 40.6;
2408 for(Int_t i=0; i<steps; i++) {
2409 x = xin + i*dx + dx/2;
2410 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2411 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2412 holeYmax = x*TMath::Tan(0.5*alpha);
2413 ppl->SetHole(holeYmax, holeZmax);
2415 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2416 holeYmax = x*TMath::Tan(0.5*alpha);
2417 ppl->SetHole(holeYmax, holeZmax);
2422 ymax = fGeom->GetChamberWidth(plane)/2;
2423 for(Int_t ch = 0; ch < kNchambers; ch++) {
2424 zmax[ch] = fGeom->GetChamberLength(plane,ch)/2;
2425 Float_t pad = fPar->GetRowPadSize(plane,ch,0);
2426 Float_t row0 = fPar->GetRow0(plane,ch,0);
2427 Int_t nPads = fPar->GetRowMax(plane,ch,0);
2428 zc[ch] = (pad * nPads)/2 + row0 - pad/2;
2431 dx = fPar->GetTimeBinSize();
2432 rho = 0.00295 * 0.85; radLength = 11.0;
2434 Double_t x0 = (Double_t) fPar->GetTime0(plane);
2435 Double_t xbottom = x0 - dxDrift;
2436 Double_t xtop = x0 + dxAmp;
2438 // Amplification region
2440 steps = (Int_t) (dxAmp/dx);
2442 for(tb = 0; tb < steps; tb++) {
2443 x = x0 + tb * dx + dx/2;
2444 tbIndex = CookTimeBinIndex(plane, -tb-1);
2445 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,tbIndex);
2447 for(Int_t ch = 0; ch < kNchambers; ch++) {
2448 ppl->SetZmax(ch, zc[ch], zmax[ch]);
2450 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2451 holeYmax = x*TMath::Tan(0.5*alpha);
2452 ppl->SetHole(holeYmax, holeZmax);
2454 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2455 holeYmax = x*TMath::Tan(0.5*alpha);
2456 ppl->SetHole(holeYmax, holeZmax);
2460 tbIndex = CookTimeBinIndex(plane, -steps);
2461 x = (x + dx/2 + xtop)/2;
2463 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,tbIndex);
2465 for(Int_t ch = 0; ch < kNchambers; ch++) {
2466 ppl->SetZmax(ch, zc[ch], zmax[ch]);
2468 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2469 holeYmax = x*TMath::Tan(0.5*alpha);
2470 ppl->SetHole(holeYmax, holeZmax);
2472 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2473 holeYmax = x*TMath::Tan(0.5*alpha);
2474 ppl->SetHole(holeYmax, holeZmax);
2479 dx = fPar->GetTimeBinSize();
2480 steps = (Int_t) (dxDrift/dx);
2482 for(tb = 0; tb < steps; tb++) {
2483 x = x0 - tb * dx - dx/2;
2484 tbIndex = CookTimeBinIndex(plane, tb);
2486 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,tbIndex);
2488 for(Int_t ch = 0; ch < kNchambers; ch++) {
2489 ppl->SetZmax(ch, zc[ch], zmax[ch]);
2491 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2492 holeYmax = x*TMath::Tan(0.5*alpha);
2493 ppl->SetHole(holeYmax, holeZmax);
2495 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2496 holeYmax = x*TMath::Tan(0.5*alpha);
2497 ppl->SetHole(holeYmax, holeZmax);
2501 tbIndex = CookTimeBinIndex(plane, steps);
2502 x = (x - dx/2 + xbottom)/2;
2504 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,tbIndex);
2506 for(Int_t ch = 0; ch < kNchambers; ch++) {
2507 ppl->SetZmax(ch, zc[ch], zmax[ch]);
2509 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2510 holeYmax = x*TMath::Tan(0.5*alpha);
2511 ppl->SetHole(holeYmax, holeZmax);
2513 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2514 holeYmax = x*TMath::Tan(0.5*alpha);
2515 ppl->SetHole(holeYmax, holeZmax);
2520 xin = xtop; dx = 0.025; xout = xin + dx; rho = 1.7; radLength = 33.0;
2521 ppl = new AliTRDpropagationLayer(xin+dx/2,dx,rho,radLength,-1);
2522 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2523 holeYmax = (xin+dx/2)*TMath::Tan(0.5*alpha);
2524 ppl->SetHole(holeYmax, holeZmax);
2526 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2527 holeYmax = (xin+dx/2)*TMath::Tan(0.5*alpha);
2528 ppl->SetHole(holeYmax, holeZmax);
2533 xin = xout; xout = xtrd + (plane + 1) * dxPlane - dxSpace;
2534 steps = 5; dx = (xout - xin)/steps; rho = 0.074; radLength = 40.6;
2535 for(Int_t i=0; i<steps; i++) {
2536 x = xin + i*dx + dx/2;
2537 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2538 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2539 holeYmax = x*TMath::Tan(0.5*alpha);
2540 ppl->SetHole(holeYmax, holeZmax);
2542 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2543 holeYmax = x*TMath::Tan(0.5*alpha);
2544 ppl->SetHole(holeYmax, holeZmax);
2549 // Space between the chambers, air
2550 xin = xout; xout = xtrd + (plane + 1) * dxPlane;
2551 steps = 5; dx = (xout - xin)/steps; rho = 1.29e-3; radLength = 36.66;
2552 for(Int_t i=0; i<steps; i++) {
2553 x = xin + i*dx + dx/2;
2554 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2555 if((fGeom->GetPHOShole()) && (fGeomSector >= 2) && (fGeomSector <= 6)) {
2556 holeYmax = x*TMath::Tan(0.5*alpha);
2557 ppl->SetHole(holeYmax, holeZmax);
2559 if((fGeom->GetRICHhole()) && (fGeomSector >= 12) && (fGeomSector <= 14)) {
2560 holeYmax = x*TMath::Tan(0.5*alpha);
2561 ppl->SetHole(holeYmax, holeZmax);
2567 // Space between the TRD and RICH
2568 Double_t xRICH = 500.;
2569 xin = xout; xout = xRICH;
2570 steps = 200; dx = (xout - xin)/steps; rho = 1.29e-3; radLength = 36.66;
2571 for(Int_t i=0; i<steps; i++) {
2572 x = xin + i*dx + dx/2;
2573 ppl = new AliTRDpropagationLayer(x,dx,rho,radLength,-1);
2583 //______________________________________________________
2585 Int_t AliTRDtracker::AliTRDtrackingSector::CookTimeBinIndex(Int_t plane, Int_t localTB) const
2588 // depending on the digitization parameters calculates "global"
2589 // time bin index for timebin <localTB> in plane <plane>
2592 Double_t dxAmp = (Double_t) fGeom->CamHght(); // Amplification region
2593 Double_t dxDrift = (Double_t) fGeom->CdrHght(); // Drift region
2594 Double_t dx = (Double_t) fPar->GetTimeBinSize();
2596 Int_t tbAmp = fPar->GetTimeBefore();
2597 Int_t maxAmp = (Int_t) ((dxAmp+0.000001)/dx);
2598 if(kTRUE) maxAmp = 0; // intentional until we change parameter class
2599 Int_t tbDrift = fPar->GetTimeMax();
2600 Int_t maxDrift = (Int_t) ((dxDrift+0.000001)/dx);
2602 Int_t tbPerPlane = TMath::Min(tbAmp,maxAmp) + TMath::Min(tbDrift,maxDrift);
2604 Int_t gtb = (plane+1) * tbPerPlane - localTB - 1 - TMath::Min(tbAmp,maxAmp);
2607 (TMath::Abs(localTB) > TMath::Min(tbAmp,maxAmp))) return -1;
2608 if(localTB >= TMath::Min(tbDrift,maxDrift)) return -1;
2615 //______________________________________________________
2617 void AliTRDtracker::AliTRDtrackingSector::MapTimeBinLayers()
2620 // For all sensitive time bins sets corresponding layer index
2621 // in the array fTimeBins
2626 for(Int_t i = 0; i < fN; i++) {
2627 index = fLayers[i]->GetTimeBinIndex();
2629 // printf("gtb %d -> pl %d -> x %f \n", index, i, fLayers[i]->GetX());
2631 if(index < 0) continue;
2632 if(index >= (Int_t) kMaxTimeBinIndex) {
2633 printf("*** AliTRDtracker::MapTimeBinLayers: \n");
2634 printf(" index %d exceeds allowed maximum of %d!\n",
2635 index, kMaxTimeBinIndex-1);
2638 fTimeBinIndex[index] = i;
2641 Double_t x1, dx1, x2, dx2, gap;
2643 for(Int_t i = 0; i < fN-1; i++) {
2644 x1 = fLayers[i]->GetX();
2645 dx1 = fLayers[i]->GetdX();
2646 x2 = fLayers[i+1]->GetX();
2647 dx2 = fLayers[i+1]->GetdX();
2648 gap = (x2 - dx2/2) - (x1 + dx1/2);
2650 printf("*** warning: layers %d and %d are overlayed:\n",i,i+1);
2651 printf(" %f + %f + %f > %f\n", x1, dx1/2, dx2/2, x2);
2654 printf("*** warning: layers %d and %d have a large gap:\n",i,i+1);
2655 printf(" (%f - %f) - (%f + %f) = %f\n",
2656 x2, dx2/2, x1, dx1, gap);
2662 //______________________________________________________
2665 Int_t AliTRDtracker::AliTRDtrackingSector::GetLayerNumber(Double_t x) const
2668 // Returns the number of time bin which in radial position is closest to <x>
2671 if(x >= fLayers[fN-1]->GetX()) return fN-1;
2672 if(x <= fLayers[0]->GetX()) return 0;
2674 Int_t b=0, e=fN-1, m=(b+e)/2;
2675 for (; b<e; m=(b+e)/2) {
2676 if (x > fLayers[m]->GetX()) b=m+1;
2679 if(TMath::Abs(x - fLayers[m]->GetX()) >
2680 TMath::Abs(x - fLayers[m+1]->GetX())) return m+1;
2685 //______________________________________________________
2687 Int_t AliTRDtracker::AliTRDtrackingSector::GetInnerTimeBin() const
2690 // Returns number of the innermost SENSITIVE propagation layer
2693 return GetLayerNumber(0);
2696 //______________________________________________________
2698 Int_t AliTRDtracker::AliTRDtrackingSector::GetOuterTimeBin() const
2701 // Returns number of the outermost SENSITIVE time bin
2704 return GetLayerNumber(GetNumberOfTimeBins() - 1);
2707 //______________________________________________________
2709 Int_t AliTRDtracker::AliTRDtrackingSector::GetNumberOfTimeBins() const
2712 // Returns number of SENSITIVE time bins
2716 for(tb = kMaxTimeBinIndex-1; tb >=0; tb--) {
2717 layer = GetLayerNumber(tb);
2723 //______________________________________________________
2725 void AliTRDtracker::AliTRDtrackingSector::InsertLayer(AliTRDpropagationLayer* pl)
2728 // Insert layer <pl> in fLayers array.
2729 // Layers are sorted according to X coordinate.
2731 if ( fN == ((Int_t) kMaxLayersPerSector)) {
2732 printf("AliTRDtrackingSector::InsertLayer(): Too many layers !\n");
2735 if (fN==0) {fLayers[fN++] = pl; return;}
2736 Int_t i=Find(pl->GetX());
2738 memmove(fLayers+i+1 ,fLayers+i,(fN-i)*sizeof(AliTRDpropagationLayer*));
2739 fLayers[i]=pl; fN++;
2743 //______________________________________________________
2745 Int_t AliTRDtracker::AliTRDtrackingSector::Find(Double_t x) const
2748 // Returns index of the propagation layer nearest to X
2751 if (x <= fLayers[0]->GetX()) return 0;
2752 if (x > fLayers[fN-1]->GetX()) return fN;
2753 Int_t b=0, e=fN-1, m=(b+e)/2;
2754 for (; b<e; m=(b+e)/2) {
2755 if (x > fLayers[m]->GetX()) b=m+1;
2761 //______________________________________________________
2763 void AliTRDtracker::AliTRDpropagationLayer::GetPropagationParameters(
2764 Double_t y, Double_t z, Double_t &dx, Double_t &rho, Double_t &radLength,
2765 Bool_t &lookForCluster) const
2768 // Returns radial step <dx>, density <rho>, rad. length <radLength>,
2769 // and sensitivity <lookForCluster> in point <y,z>
2775 lookForCluster = kFALSE;
2777 // check dead regions
2778 if(fTimeBinIndex >= 0) {
2779 for(Int_t ch = 0; ch < (Int_t) kZones; ch++) {
2780 if(TMath::Abs(z - fZc[ch]) < fZmax[ch])
2781 lookForCluster = kTRUE;
2782 // else { rho = 1.7; radLength = 33.0; } // G10
2784 if(TMath::Abs(y) > fYmax) lookForCluster = kFALSE;
2785 if(!lookForCluster) {
2786 // rho = 1.7; radLength = 33.0; // G10
2791 if(fHole && (TMath::Abs(y - fHoleYc) < fHoleYmax) &&
2792 (TMath::Abs(z - fHoleZc) < fHoleZmax)) {
2793 lookForCluster = kFALSE;
2795 radLength = fHoleX0;
2801 //______________________________________________________
2803 void AliTRDtracker::AliTRDpropagationLayer::InsertCluster(AliTRDcluster* c,
2806 // Insert cluster in cluster array.
2807 // Clusters are sorted according to Y coordinate.
2809 if(fTimeBinIndex < 0) {
2810 printf("*** attempt to insert cluster into non-sensitive time bin!\n");
2814 if (fN== (Int_t) kMaxClusterPerTimeBin) {
2815 printf("AliTRDpropagationLayer::InsertCluster(): Too many clusters !\n");
2818 if (fN==0) {fIndex[0]=index; fClusters[fN++]=c; return;}
2819 Int_t i=Find(c->GetY());
2820 memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTRDcluster*));
2821 memmove(fIndex +i+1 ,fIndex +i,(fN-i)*sizeof(UInt_t));
2822 fIndex[i]=index; fClusters[i]=c; fN++;
2825 //______________________________________________________
2827 Int_t AliTRDtracker::AliTRDpropagationLayer::Find(Double_t y) const {
2829 // Returns index of the cluster nearest in Y
2831 if (y <= fClusters[0]->GetY()) return 0;
2832 if (y > fClusters[fN-1]->GetY()) return fN;
2833 Int_t b=0, e=fN-1, m=(b+e)/2;
2834 for (; b<e; m=(b+e)/2) {
2835 if (y > fClusters[m]->GetY()) b=m+1;
2841 //---------------------------------------------------------
2843 Double_t AliTRDtracker::GetTiltFactor(const AliTRDcluster* c) {
2845 // Returns correction factor for tilted pads geometry
2848 Double_t h01 = sin(TMath::Pi() / 180.0 * fPar->GetTiltingAngle());
2849 Int_t det = c->GetDetector();
2850 Int_t plane = fGeom->GetPlane(det);
2852 if((plane == 1) || (plane == 3) || (plane == 5)) h01=-h01;
2854 if(fNoTilt) h01 = 0;