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 **************************************************************************/
15 // AliTOFtracker Class
16 // Task: Perform association of the ESD tracks to TOF Clusters
17 // and Update ESD track with associated TOF Cluster parameters
19 //--------------------------------------------------------------------
22 #include "AliTOFtrackerMI.h"
23 #include "AliTOFtrack.h"
24 #include "TClonesArray.h"
26 #include "AliTOFdigit.h"
27 #include "AliTOFGeometry.h"
30 #include "AliModule.h"
31 #include "TTreeStream.h"
32 #include "AliTOFcluster.h"
34 ClassImp(AliTOFtrackerMI)
36 //_____________________________________________________________________________
37 AliTOFtrackerMI::AliTOFtrackerMI(AliTOFGeometry * geom, Double_t parPID[2]) {
38 //AliTOFtrackerMI main Ctor
48 fTOFpid = new AliTOFpidESD(parPID);
52 fDy=AliTOFGeometry::XPad();
53 fDz=AliTOFGeometry::ZPad();
58 fDebugStreamer = new TTreeSRedirector("TOFdebug.root");
59 Init(); // temporary solution to know about Holes/no Holes
61 //_____________________________________________________________________________
62 AliTOFtrackerMI::AliTOFtrackerMI(const AliTOFtrackerMI &t):AliTracker() {
63 //AliTOFtrackerMI copy Ctor
67 fNseedsTOF=t.fNseedsTOF;
68 fngoodmatch=t.fngoodmatch;
69 fnbadmatch=t.fnbadmatch;
70 fnunmatch=t.fnunmatch;
75 fTOFHeigth=t.fTOFHeigth;
85 //_________________________________________________________________________________
86 AliTOFtrackerMI::~AliTOFtrackerMI(){
91 //fDebugStreamer->Close();
92 delete fDebugStreamer;
97 //_____________________________________________________________________________
98 void AliTOFtrackerMI::Init() {
100 // temporary solution to know about Holes/no Holes, will be implemented as
101 // an AliTOFGeometry getter
103 AliModule* frame=gAlice->GetModule("FRAME");
106 Error("Init","Could Not load FRAME! Assume Frame with Holes \n");
109 if(frame->IsVersion()==1) {fHoles=false;}
113 //_____________________________________________________________________________
114 Int_t AliTOFtrackerMI::PropagateBack(AliESD* event) {
116 // Gets seeds from ESD event and Match with TOF Clusters
120 //Initialise some counters
129 Int_t ntrk=event->GetNumberOfTracks();
131 fSeeds= new TClonesArray("AliESDtrack");
132 TClonesArray &aESDTrack = *fSeeds;
135 //Load ESD tracks into a local Array of ESD Seeds
137 for (Int_t i=0; i<fNseeds; i++) {
138 AliESDtrack *t=event->GetTrack(i);
139 new(aESDTrack[i]) AliESDtrack(*t);
142 //Prepare ESD tracks candidates for TOF Matching
145 //First Step with Strict Matching Criterion
146 //MatchTracks(kFALSE);
148 //Second Step with Looser Matching Criterion
149 //MatchTracks(kTRUE);
150 MatchTracksMI(kFALSE); // assign track to clusters
151 MatchTracksMI(kTRUE); // assign clusters to esd
153 Info("PropagateBack","Number of matched tracks: %d",fnmatch);
154 Info("PropagateBack","Number of good matched tracks: %d",fngoodmatch);
155 Info("PropagateBack","Number of bad matched tracks: %d",fnbadmatch);
157 //Update the matched ESD tracks
159 for (Int_t i=0; i<ntrk; i++) {
160 AliESDtrack *t=event->GetTrack(i);
161 AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
162 if(seed->GetTOFsignal()>0){
163 t->SetTOFsignal(seed->GetTOFsignal());
164 t->SetTOFcluster(seed->GetTOFcluster());
166 seed->GetTOFLabel(tlab);
167 t->SetTOFLabel(tlab);
168 AliTOFtrack *track = new AliTOFtrack(*seed);
171 seed->GetTOFInfo(info);
172 seed->GetIntegratedTimes(times);
173 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
174 t->SetIntegratedLength(seed->GetIntegratedLength());
175 t->SetIntegratedTimes(times);
184 fTOFpid->MakePID(event);
199 //_________________________________________________________________________
200 void AliTOFtrackerMI::CollectESD() {
201 //prepare the set of ESD tracks to be matched to clusters in TOF
203 fTracks= new TClonesArray("AliTOFtrack");
204 TClonesArray &aTOFTrack = *fTracks;
207 for (Int_t i=0; i<fNseeds; i++) {
209 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
210 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
212 // TRD good tracks, already propagated at 371 cm
214 AliTOFtrack *track = new AliTOFtrack(*t); // New
215 Double_t x = track->GetX(); //New
217 if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) &&
218 ( x >= AliTOFGeometry::RinTOF()) ){
219 track->SetSeedIndex(i);
220 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
221 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
227 // Propagate the rest of TPCbp
230 if(track->PropagateToInnerTOF(fHoles)){ // temporary solution
231 // if(track->PropagateToInnerTOF(fGeom->GetHoles())){
232 track->SetSeedIndex(i);
233 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
234 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
243 printf("TRD\tOn\t%d\tOff\t%d\n",c0,c1);
245 // Sort according uncertainties on track position
258 //_________________________________________________________________________
259 void AliTOFtrackerMI::MatchTracks( Bool_t /*mLastStep*/){
264 //_________________________________________________________________________
265 void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
267 //Match ESD tracks to clusters in TOF
268 const Float_t kTofOffset = 26; // time offset
269 const Float_t kMinQuality = -6.; // minimal quality
270 const Float_t kMaxQualityD = 1.; // max delta quality if cluster used
271 const Float_t kForbiddenR = 0.1; // minimal PID according TPC
273 static const Double_t kMasses[]={
274 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
277 Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
279 //PH Arrays (moved outside of the loop)
280 Float_t * trackPos[4];
281 for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
283 for (Int_t ii=0;ii<6;ii++) clind[ii] = new Int_t[fN];
288 Float_t dist3D[1000][6];
289 Double_t times[1000][6];
290 Float_t mintimedist[1000];
291 Float_t likelihood[1000];
292 Float_t length[1000];
293 AliTOFcluster *clusters[1000];
297 for (Int_t i=0; i<fNseedsTOF; i++) {
299 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(i);
300 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
301 Bool_t hasTime = ( (t->GetStatus()& AliESDtrack::kTIME)>0) ? kTRUE:kFALSE; // did we integrate time
302 Float_t trdquality = t->GetTRDQuality();
306 t->GetTPCpid(tpcpid);
308 for (Int_t ipid=0;ipid<5;ipid++){
309 sumpid+=tpcpid[ipid];
311 for (Int_t ipid=0;ipid<5;ipid++){
312 if (sumpid>0) tpcpid[ipid]/=sumpid;
318 if (trdquality<0) continue; // no chance
320 AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
322 //propagat track to the middle of TOF
324 Float_t xs = 378.2; // should be defined in the TOF gemotry
325 Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
327 Double_t ysect=trackTOFin->GetYat(xs,skip);
330 ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
331 ysect=trackTOFin->GetYat(xs,skip);
334 if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) {
337 } else if (ysect <-ymax) {
338 if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) {
342 if(!trackTOFin->PropagateTo(xs)) {
346 // Determine a window around the track
349 trackTOFin->GetExternalParameters(x,par);
351 trackTOFin->GetExternalCovariance(cov);
352 Float_t scalefact=3.;
355 ((5*TMath::Sqrt(cov[0]) + 3.*fDy +10.*TMath::Abs(par[2]))/fR);
358 (5*TMath::Sqrt(cov[2]) + 3.*fDz +10.*TMath::Abs(par[3]));
360 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
361 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
362 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
367 // find the clusters in the window of the track
369 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
370 AliTOFcluster *c=fClusters[k];
371 if (c->GetZ() > z+dz) break;
372 // if (c->IsUsed()) continue;
374 Double_t dph=TMath::Abs(c->GetPhi()-phi);
375 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
376 if (TMath::Abs(dph)>dphi) continue;
378 clind[0][nc] = c->GetDetInd(0);
379 clind[1][nc] = c->GetDetInd(1);
380 clind[2][nc] = c->GetDetInd(2);
381 clind[3][nc] = c->GetDetInd(3);
382 clind[4][nc] = c->GetDetInd(4);
388 // select close clusters
390 Double_t mom=t->GetP();
391 // Bool_t dump = kTRUE;
392 for (Int_t icl=0; icl<nc; icl++){
393 Float_t distances[5];
394 if (nfound>=1000) break;
395 index[nfound]=clind[5][icl];
396 AliTOFcluster *cluster = fClusters[clind[5][icl]];
397 GetLinearDistances(trackTOFin,cluster, distances);
398 dist3D[nfound][0] = distances[4];
399 dist3D[nfound][1] = distances[1];
400 dist3D[nfound][2] = distances[2];
402 if (TMath::Abs(dist3D[nfound][1])>20 || TMath::Abs(dist3D[nfound][2])>20) continue;
404 GetLikelihood(distances[1],distances[2],cov,trackTOFin, dist3D[nfound][3], dist3D[nfound][4]);
407 if (dist3D[nfound][3]*dist3D[nfound][4]<0.00000000000001) continue; // log likelihood
408 if (TMath::Log(dist3D[nfound][3]*dist3D[nfound][4])<-9) continue; // log likelihood
410 clusters[nfound] = cluster;
412 //length and TOF updates
413 trackTOFin->GetIntegratedTimes(times[nfound]);
414 length[nfound] = trackTOFin->GetIntegratedLength();
415 length[nfound]+=distances[4];
416 mintimedist[nfound]=1000;
417 Double_t tof2=AliTOFGeometry::TdcBinWidth()*cluster->GetTDC()+kTofOffset; // in ps
418 // Float_t tgamma = TMath::Sqrt(cluster->GetR()*cluster->GetR()+cluster->GetZ()*cluster->GetZ())/0.03; //time for "primary" gamma
419 //if (trackTOFin->GetPt()<0.7 && TMath::Abs(tgamma-tof2)<350) continue; // gamma conversion candidate - TEMPORARY
420 for(Int_t j=0;j<=5;j++){
421 Double_t mass=kMasses[j];
422 times[nfound][j]+=distances[4]/3e-2*TMath::Sqrt(mom*mom+mass*mass)/mom; // add time distance
423 if ( TMath::Abs(times[nfound][j]-tof2)<mintimedist[nfound] && tpcpid[j]>kForbiddenR){
424 mintimedist[nfound]=TMath::Abs(times[nfound][j]-tof2);
428 Float_t liketime = TMath::Exp(-mintimedist[nfound]/90.)+0.25*TMath::Exp(-mintimedist[nfound]/180.);
429 if (!hasTime) liketime=0.2;
430 likelihood[nfound] = TMath::Log(dist3D[nfound][3]*dist3D[nfound][4]*liketime);
432 if (TMath::Log(dist3D[nfound][3]*dist3D[nfound][4])<-1){
433 if (likelihood[nfound]<-9.) continue;
444 //choose the best cluster
446 Float_t quality[1000];
449 AliTOFcluster * cgold=0;
451 for (Int_t icl=0;icl<nfound;icl++){
452 quality[icl] = dist3D[icl][3]*dist3D[icl][4];
454 TMath::Sort(nfound,quality,index,kTRUE);
456 cgold = clusters[igold];
457 if (nfound>1 &&likelihood[index[1]]>likelihood[index[0]]){
458 if ( quality[index[0]]<quality[index[1]]+0.5){
460 cgold = clusters[igold];
465 Float_t qualityGold = TMath::Log(0.0000001+(quality[igold]*(0.1+TMath::Exp(-mintimedist[igold]/80.))*(0.2+trdquality)));
467 if (cgold->GetQuality()<qualityGold) cgold->SetQuality(qualityGold);
472 //signed better cluster
473 if (cgold->GetQuality()>qualityGold+kMaxQualityD) continue;
474 if (2.*qualityGold-cgold->GetQuality()<kMinQuality) continue;
479 for (Int_t icl=0;icl<nfound;icl++){
481 (clusters[index[icl]]->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
483 (clusters[index[icl]]->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
485 (clusters[index[icl]]->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
492 if (inonfake==0) fngoodmatch++;
498 tlab[0]=cgold->GetLabel(0);
499 tlab[1]=cgold->GetLabel(1);
500 tlab[2]=cgold->GetLabel(2);
501 // Double_t tof2=25.*cgold->GetTDC()-350; // in ps
502 Double_t tof2=AliTOFGeometry::TdcBinWidth()*cgold->GetTDC()+kTofOffset; // in ps
503 Float_t tgamma = TMath::Sqrt(cgold->GetR()*cgold->GetR()+cgold->GetZ()*cgold->GetZ())/0.03;
504 Float_t info[11]={dist3D[igold][0],dist3D[igold][1],dist3D[igold][2],dist3D[igold][3],dist3D[igold][4],mintimedist[igold],
505 -1,tgamma, qualityGold,cgold->GetQuality(),0};
506 // GetLinearDistances(trackTOFin,cgold,&info[6]);
509 // info[7] = mintimedist[index[inonfake]];
513 t->SetTOFsignal(tof2);
514 t->SetTOFcluster(cgold->GetIndex());
515 AliTOFtrack *trackTOFout = new AliTOFtrack(*t);
516 trackTOFout->PropagateTo(378.);
517 t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);
518 t->SetIntegratedLength(length[igold]);
519 t->SetIntegratedTimes(times[igold]);
520 t->SetTOFLabel(tlab);
529 for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
530 for (Int_t ii=0;ii<6;ii++) delete [] clind[ii];
536 // //_________________________________________________________________________
537 // Int_t AliTOFtrackerMI::LoadClusters(TTree *dTree) {
538 // //--------------------------------------------------------------------
539 // //This function loads the TOF clusters
540 // //--------------------------------------------------------------------
542 // TBranch *branch=dTree->GetBranch("TOF");
544 // Error("LoadClusters"," can't get the branch with the TOF digits !\n");
548 // TClonesArray dummy("AliTOFdigit",10000), *digits=&dummy;
549 // branch->SetAddress(&digits);
551 // dTree->GetEvent(0);
552 // Int_t nd=digits->GetEntriesFast();
553 // Info("LoadClusters","number of digits: %d",nd);
555 // for (Int_t i=0; i<nd; i++) {
556 // AliTOFdigit *d=(AliTOFdigit*)digits->UncheckedAt(i);
557 // Int_t dig[5]; Float_t g[3];
558 // dig[0]=d->GetSector();
559 // dig[1]=d->GetPlate();
560 // dig[2]=d->GetStrip();
561 // dig[3]=d->GetPadz();
562 // dig[4]=d->GetPadx();
564 // fGeom->GetPos(dig,g);
567 // h[0]=TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
568 // h[1]=TMath::ATan2(g[1],g[0]); h[2]=g[2];
569 // h[3]=d->GetTdc(); h[4]=d->GetAdc();
571 // AliTOFcluster *cl=new AliTOFcluster(h,d->GetTracks(),dig,i);
572 // InsertCluster(cl);
577 // //_________________________________________________________________________
578 // void AliTOFtrackerMI::UnloadClusters() {
579 // //--------------------------------------------------------------------
580 // //This function unloads TOF clusters
581 // //--------------------------------------------------------------------
582 // for (Int_t i=0; i<fN; i++) delete fClusters[i];
588 //_________________________________________________________________________
589 Int_t AliTOFtrackerMI::LoadClusters(TTree *cTree) {
590 //--------------------------------------------------------------------
591 //This function loads the TOF clusters
592 //--------------------------------------------------------------------
594 TBranch *branch=cTree->GetBranch("TOF");
596 AliError("can't get the branch with the TOF clusters !");
600 TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
601 branch->SetAddress(&clusters);
604 Int_t nc=clusters->GetEntriesFast();
605 AliInfo(Form("Number of clusters: %d",nc));
607 for (Int_t i=0; i<nc; i++) {
608 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
610 for (Int_t jj=0; jj<5; jj++) dig[jj]=c->GetDetInd(jj);
620 for (Int_t jj=0; jj<3; jj++) indexDig[jj] = c->GetLabel(jj);
622 AliTOFcluster *cl=new AliTOFcluster(h,c->GetTracks(),dig,i);
625 // fClusters[i]=c; fN++;
626 fClusters[i]=new AliTOFcluster(*c); fN++;
628 //AliInfo(Form("%4i %4i %f %f %f %f %f %2i %1i %2i %1i %2i",i, fClusters[i]->GetIndex(),fClusters[i]->GetZ(),fClusters[i]->GetR(),fClusters[i]->GetPhi(), fClusters[i]->GetTDC(),fClusters[i]->GetADC(),fClusters[i]->GetDetInd(0),fClusters[i]->GetDetInd(1),fClusters[i]->GetDetInd(2),fClusters[i]->GetDetInd(3),fClusters[i]->GetDetInd(4)));
629 //AliInfo(Form("%i %f",i, fClusters[i]->GetZ()));
632 //AliInfo(Form("Number of clusters: %d",fN));
636 //_________________________________________________________________________
637 void AliTOFtrackerMI::UnloadClusters() {
638 //--------------------------------------------------------------------
639 //This function unloads TOF clusters
640 //--------------------------------------------------------------------
641 for (Int_t i=0; i<fN; i++) {
651 //_________________________________________________________________________
652 Int_t AliTOFtrackerMI::InsertCluster(AliTOFcluster *c) {
653 //--------------------------------------------------------------------
654 //This function adds a cluster to the array of clusters sorted in Z
655 //--------------------------------------------------------------------
656 if (fN==kMaxCluster) {
657 Error("InsertCluster","Too many clusters !\n");
661 if (fN==0) {fClusters[fN++]=c; return 0;}
662 Int_t i=FindClusterIndex(c->GetZ());
663 memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTOFcluster*));
664 fClusters[i]=c; fN++;
669 //_________________________________________________________________________
670 Int_t AliTOFtrackerMI::FindClusterIndex(Double_t z) const {
671 //--------------------------------------------------------------------
672 // This function returns the index of the nearest cluster
673 //--------------------------------------------------------------------
675 if (z <= fClusters[0]->GetZ()) return 0;
676 if (z > fClusters[fN-1]->GetZ()) return fN;
677 Int_t b=0, e=fN-1, m=(b+e)/2;
678 for (; b<e; m=(b+e)/2) {
679 if (z > fClusters[m]->GetZ()) b=m+1;
687 Float_t AliTOFtrackerMI::GetLinearDistances(AliTOFtrack * track, AliTOFcluster *cluster, Float_t distances[5])
690 // calclates distance between cluster and track
691 // use linear aproximation
693 const Float_t kRaddeg = 180/3.14159265358979312;
695 // Float_t tiltangle = fGeom->GetAngles(cluster->fdetIndex[1],cluster->fdetIndex[2])/kRaddeg; //tiltangle
697 cind[0]= cluster->GetDetInd(0);
698 cind[1]= cluster->GetDetInd(1);
699 cind[2]= cluster->GetDetInd(2);
700 cind[3]= cluster->GetDetInd(3);
701 cind[4]= cluster->GetDetInd(4);
702 Float_t tiltangle = fGeom->GetAngles(cluster->GetDetInd(1),cluster->GetDetInd(2))/kRaddeg; //tiltangle
704 Float_t cpos[3]; //cluster position
705 Float_t cpos0[3]; //cluster position
706 // fGeom->GetPos(cluster->fdetIndex,cpos);
707 //fGeom->GetPos(cluster->fdetIndex,cpos0);
709 fGeom->GetPos(cind,cpos);
710 fGeom->GetPos(cind,cpos0);
712 Float_t phi = TMath::ATan2(cpos[1],cpos[0]);
713 if(phi<0) phi=2.*TMath::Pi()+phi;
714 // Get the local angle in the sector philoc
715 Float_t phiangle = (Int_t (phi*kRaddeg/20.) + 0.5)*20./kRaddeg;
719 track->GetGlobalXYZ(v0[0],v0[1],v0[2]);
720 track->GetPxPyPz(dir[0],dir[1],dir[2]);
721 dir[0]/=track->GetP();
722 dir[1]/=track->GetP();
723 dir[2]/=track->GetP();
727 Float_t sinphi = TMath::Sin(phiangle);
728 Float_t cosphi = TMath::Cos(phiangle);
729 Float_t sinth = TMath::Sin(tiltangle);
730 Float_t costh = TMath::Cos(tiltangle);
733 temp = cpos[0]*cosphi+cpos[1]*sinphi;
734 cpos[1] = -cpos[0]*sinphi+cpos[1]*cosphi;
736 temp = v0[0]*cosphi+v0[1]*sinphi;
737 v0[1] = -v0[0]*sinphi+v0[1]*cosphi;
740 temp = cpos[0]*costh+cpos[2]*sinth;
741 cpos[2] = -cpos[0]*sinth+cpos[2]*costh;
743 temp = v0[0]*costh+v0[2]*sinth;
744 v0[2] = -v0[0]*sinth+v0[2]*costh;
748 //rotate direction vector
750 temp = dir[0]*cosphi+dir[1]*sinphi;
751 dir[1] = -dir[0]*sinphi+dir[1]*cosphi;
754 temp = dir[0]*costh+dir[2]*sinth;
755 dir[2] = -dir[0]*sinth+dir[2]*costh;
759 Float_t k = (cpos[0]-v0[0])/dir[0];
760 v3[0] = v0[0]+k*dir[0];
761 v3[1] = v0[1]+k*dir[1];
762 v3[2] = v0[2]+k*dir[2];
764 distances[0] = v3[0]-cpos[0];
765 distances[1] = v3[1]-cpos[1];
766 distances[2] = v3[2]-cpos[2];
767 distances[3] = TMath::Sqrt( distances[0]*distances[0]+distances[1]*distances[1]+distances[2]*distances[2]); //distance
768 distances[4] = k; //length
771 // Debuging part of the matching
773 if (track->GetLabel()==cluster->GetLabel(0) ||track->GetLabel()==cluster->GetLabel(1) ){
774 TTreeSRedirector& cstream = *fDebugStreamer;
775 Float_t tdc = cluster->GetTDC();
782 "Dist0="<<distances[0]<<
783 "Dist1="<<distances[1]<<
784 "Dist2="<<distances[2]<<
793 void AliTOFtrackerMI::GetLikelihood(Float_t dy, Float_t dz, const Double_t *cov, AliTOFtrack * /*track*/, Float_t & py, Float_t &pz)
796 // get likelihood - track covariance taken
797 // 75 % of gauss with expected sigma
798 // 25 % of gauss with extended sigma
800 Double_t kMaxSigmaY = 0.6; // ~ 90% of TRD tracks
801 Double_t kMaxSigmaZ = 1.2; // ~ 90% of TRD tracks
802 Double_t kMeanSigmaY = 0.25; // mean TRD sigma
803 Double_t kMeanSigmaZ = 0.5; // mean TRD sigma
806 Float_t normwidth, normd, p0,p1;
807 Float_t sigmay = TMath::Max(TMath::Sqrt(cov[0]+kMeanSigmaY*kMeanSigmaY),kMaxSigmaY);
808 Float_t sigmaz = TMath::Max(TMath::Sqrt(cov[2]+kMeanSigmaZ*kMeanSigmaZ),kMaxSigmaZ);
813 // py calculation - 75% admixture of original sigma - 25% tails
815 normwidth = fDy/sigmay;
817 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
818 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
821 normwidth = fDy/(3.*sigmay);
822 normd = dy/(3.*sigmay);
823 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
824 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
827 // pz calculation - 75% admixture of original sigma - 25% tails
829 normwidth = fDz/sigmaz;
831 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
832 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
835 normwidth = fDz/(3.*sigmaz);
836 normd = dz/(3.*sigmaz);
837 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
838 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));