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
60 fHoles=geom->GetHoles();
62 //_____________________________________________________________________________
63 AliTOFtrackerMI::AliTOFtrackerMI(const AliTOFtrackerMI &t):AliTracker() {
64 //AliTOFtrackerMI copy Ctor
68 fNseedsTOF=t.fNseedsTOF;
69 fngoodmatch=t.fngoodmatch;
70 fnbadmatch=t.fnbadmatch;
71 fnunmatch=t.fnunmatch;
76 fTOFHeigth=t.fTOFHeigth;
86 //_________________________________________________________________________________
87 AliTOFtrackerMI::~AliTOFtrackerMI(){
92 //fDebugStreamer->Close();
93 delete fDebugStreamer;
98 //_____________________________________________________________________________
100 void AliTOFtrackerMI::Init() {
102 // temporary solution to know about Holes/no Holes, will be implemented as
103 // an AliTOFGeometry getter
105 AliModule* frame=gAlice->GetModule("FRAME");
108 Error("Init","Could Not load FRAME! Assume Frame with Holes \n");
111 if(frame->IsVersion()==1) {fHoles=false;}
116 //_____________________________________________________________________________
117 Int_t AliTOFtrackerMI::PropagateBack(AliESD* event) {
119 // Gets seeds from ESD event and Match with TOF Clusters
123 //Initialise some counters
132 Int_t ntrk=event->GetNumberOfTracks();
134 fSeeds= new TClonesArray("AliESDtrack");
135 TClonesArray &aESDTrack = *fSeeds;
138 //Load ESD tracks into a local Array of ESD Seeds
140 for (Int_t i=0; i<fNseeds; i++) {
141 AliESDtrack *t=event->GetTrack(i);
142 new(aESDTrack[i]) AliESDtrack(*t);
145 //Prepare ESD tracks candidates for TOF Matching
148 //First Step with Strict Matching Criterion
149 //MatchTracks(kFALSE);
151 //Second Step with Looser Matching Criterion
152 //MatchTracks(kTRUE);
153 MatchTracksMI(kFALSE); // assign track to clusters
154 MatchTracksMI(kTRUE); // assign clusters to esd
156 Info("PropagateBack","Number of matched tracks: %d",fnmatch);
157 Info("PropagateBack","Number of good matched tracks: %d",fngoodmatch);
158 Info("PropagateBack","Number of bad matched tracks: %d",fnbadmatch);
160 //Update the matched ESD tracks
162 for (Int_t i=0; i<ntrk; i++) {
163 AliESDtrack *t=event->GetTrack(i);
164 AliESDtrack *seed =(AliESDtrack*)fSeeds->UncheckedAt(i);
165 if(seed->GetTOFsignal()>0){
166 t->SetTOFsignal(seed->GetTOFsignal());
167 t->SetTOFcluster(seed->GetTOFcluster());
169 seed->GetTOFLabel(tlab);
170 t->SetTOFLabel(tlab);
171 AliTOFtrack *track = new AliTOFtrack(*seed);
174 seed->GetTOFInfo(info);
175 seed->GetIntegratedTimes(times);
176 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
177 t->SetIntegratedLength(seed->GetIntegratedLength());
178 t->SetIntegratedTimes(times);
187 fTOFpid->MakePID(event);
202 //_________________________________________________________________________
203 void AliTOFtrackerMI::CollectESD() {
204 //prepare the set of ESD tracks to be matched to clusters in TOF
206 fTracks= new TClonesArray("AliTOFtrack");
207 TClonesArray &aTOFTrack = *fTracks;
210 for (Int_t i=0; i<fNseeds; i++) {
212 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
213 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
215 // TRD good tracks, already propagated at 371 cm
217 AliTOFtrack *track = new AliTOFtrack(*t); // New
218 Double_t x = track->GetX(); //New
220 if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) &&
221 ( x >= fGeom->RinTOF()) ){
222 track->SetSeedIndex(i);
223 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
224 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
230 // Propagate the rest of TPCbp
233 if(track->PropagateToInnerTOF(fHoles)){ // temporary solution
234 // if(track->PropagateToInnerTOF(fGeom->GetHoles())){
235 track->SetSeedIndex(i);
236 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
237 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
246 printf("TRD\tOn\t%d\tOff\t%d\n",c0,c1);
248 // Sort according uncertainties on track position
261 //_________________________________________________________________________
262 void AliTOFtrackerMI::MatchTracks( Bool_t /*mLastStep*/){
267 //_________________________________________________________________________
268 void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
270 //Match ESD tracks to clusters in TOF
271 const Float_t kTofOffset = 26; // time offset
272 const Float_t kMinQuality = -6.; // minimal quality
273 const Float_t kMaxQualityD = 1.; // max delta quality if cluster used
274 const Float_t kForbiddenR = 0.1; // minimal PID according TPC
276 static const Double_t kMasses[]={
277 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
280 Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
282 //PH Arrays (moved outside of the loop)
283 Float_t * trackPos[4];
284 for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
286 for (Int_t ii=0;ii<6;ii++) clind[ii] = new Int_t[fN];
291 Float_t dist3D[1000][6];
292 Double_t times[1000][6];
293 Float_t mintimedist[1000];
294 Float_t likelihood[1000];
295 Float_t length[1000];
296 AliTOFcluster *clusters[1000];
300 for (Int_t i=0; i<fNseedsTOF; i++) {
302 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(i);
303 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
304 Bool_t hasTime = ( (t->GetStatus()& AliESDtrack::kTIME)>0) ? kTRUE:kFALSE; // did we integrate time
305 Float_t trdquality = t->GetTRDQuality();
309 t->GetTPCpid(tpcpid);
311 for (Int_t ipid=0;ipid<5;ipid++){
312 sumpid+=tpcpid[ipid];
314 for (Int_t ipid=0;ipid<5;ipid++){
315 if (sumpid>0) tpcpid[ipid]/=sumpid;
321 if (trdquality<0) continue; // no chance
323 AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
325 //propagat track to the middle of TOF
327 Float_t xs = 378.2; // should be defined in the TOF geometry
328 Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
330 Double_t ysect=trackTOFin->GetYat(xs,skip);
333 ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
334 ysect=trackTOFin->GetYat(xs,skip);
337 if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) {
340 } else if (ysect <-ymax) {
341 if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) {
345 if(!trackTOFin->PropagateTo(xs)) {
349 // Determine a window around the track
352 trackTOFin->GetExternalParameters(x,par);
354 trackTOFin->GetExternalCovariance(cov);
355 Float_t scalefact=3.;
358 ((5*TMath::Sqrt(cov[0]) + 3.*fDy +10.*TMath::Abs(par[2]))/fR);
361 (5*TMath::Sqrt(cov[2]) + 3.*fDz +10.*TMath::Abs(par[3]));
363 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
364 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
365 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
370 // find the clusters in the window of the track
372 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
373 AliTOFcluster *c=fClusters[k];
374 if (c->GetZ() > z+dz) break;
375 // if (c->IsUsed()) continue;
377 Double_t dph=TMath::Abs(c->GetPhi()-phi);
378 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
379 if (TMath::Abs(dph)>dphi) continue;
381 clind[0][nc] = c->GetDetInd(0);
382 clind[1][nc] = c->GetDetInd(1);
383 clind[2][nc] = c->GetDetInd(2);
384 clind[3][nc] = c->GetDetInd(3);
385 clind[4][nc] = c->GetDetInd(4);
391 // select close clusters
393 Double_t mom=t->GetP();
394 // Bool_t dump = kTRUE;
395 for (Int_t icl=0; icl<nc; icl++){
396 Float_t distances[5];
397 if (nfound>=1000) break;
398 index[nfound]=clind[5][icl];
399 AliTOFcluster *cluster = fClusters[clind[5][icl]];
400 GetLinearDistances(trackTOFin,cluster, distances);
401 dist3D[nfound][0] = distances[4];
402 dist3D[nfound][1] = distances[1];
403 dist3D[nfound][2] = distances[2];
405 if (TMath::Abs(dist3D[nfound][1])>20 || TMath::Abs(dist3D[nfound][2])>20) continue;
407 GetLikelihood(distances[1],distances[2],cov,trackTOFin, dist3D[nfound][3], dist3D[nfound][4]);
410 if (dist3D[nfound][3]*dist3D[nfound][4]<0.00000000000001) continue; // log likelihood
411 if (TMath::Log(dist3D[nfound][3]*dist3D[nfound][4])<-9) continue; // log likelihood
413 clusters[nfound] = cluster;
415 //length and TOF updates
416 trackTOFin->GetIntegratedTimes(times[nfound]);
417 length[nfound] = trackTOFin->GetIntegratedLength();
418 length[nfound]+=distances[4];
419 mintimedist[nfound]=1000;
420 Double_t tof2=AliTOFGeometry::TdcBinWidth()*cluster->GetTDC()+kTofOffset; // in ps
421 // Float_t tgamma = TMath::Sqrt(cluster->GetR()*cluster->GetR()+cluster->GetZ()*cluster->GetZ())/0.03; //time for "primary" gamma
422 //if (trackTOFin->GetPt()<0.7 && TMath::Abs(tgamma-tof2)<350) continue; // gamma conversion candidate - TEMPORARY
423 for(Int_t j=0;j<=5;j++){
424 Double_t mass=kMasses[j];
425 times[nfound][j]+=distances[4]/3e-2*TMath::Sqrt(mom*mom+mass*mass)/mom; // add time distance
426 if ( TMath::Abs(times[nfound][j]-tof2)<mintimedist[nfound] && tpcpid[j]>kForbiddenR){
427 mintimedist[nfound]=TMath::Abs(times[nfound][j]-tof2);
431 Float_t liketime = TMath::Exp(-mintimedist[nfound]/90.)+0.25*TMath::Exp(-mintimedist[nfound]/180.);
432 if (!hasTime) liketime=0.2;
433 likelihood[nfound] = TMath::Log(dist3D[nfound][3]*dist3D[nfound][4]*liketime);
435 if (TMath::Log(dist3D[nfound][3]*dist3D[nfound][4])<-1){
436 if (likelihood[nfound]<-9.) continue;
447 //choose the best cluster
449 Float_t quality[1000];
452 AliTOFcluster * cgold=0;
454 for (Int_t icl=0;icl<nfound;icl++){
455 quality[icl] = dist3D[icl][3]*dist3D[icl][4];
457 TMath::Sort(nfound,quality,index,kTRUE);
459 cgold = clusters[igold];
460 if (nfound>1 &&likelihood[index[1]]>likelihood[index[0]]){
461 if ( quality[index[0]]<quality[index[1]]+0.5){
463 cgold = clusters[igold];
468 Float_t qualityGold = TMath::Log(0.0000001+(quality[igold]*(0.1+TMath::Exp(-mintimedist[igold]/80.))*(0.2+trdquality)));
470 if (cgold->GetQuality()<qualityGold) cgold->SetQuality(qualityGold);
475 //signed better cluster
476 if (cgold->GetQuality()>qualityGold+kMaxQualityD) continue;
477 if (2.*qualityGold-cgold->GetQuality()<kMinQuality) continue;
482 for (Int_t icl=0;icl<nfound;icl++){
484 (clusters[index[icl]]->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
486 (clusters[index[icl]]->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
488 (clusters[index[icl]]->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
495 if (inonfake==0) fngoodmatch++;
501 tlab[0]=cgold->GetLabel(0);
502 tlab[1]=cgold->GetLabel(1);
503 tlab[2]=cgold->GetLabel(2);
504 // Double_t tof2=25.*cgold->GetTDC()-350; // in ps
505 Double_t tof2=AliTOFGeometry::TdcBinWidth()*cgold->GetTDC()+kTofOffset; // in ps
506 Float_t tgamma = TMath::Sqrt(cgold->GetR()*cgold->GetR()+cgold->GetZ()*cgold->GetZ())/0.03;
507 Float_t info[11]={dist3D[igold][0],dist3D[igold][1],dist3D[igold][2],dist3D[igold][3],dist3D[igold][4],mintimedist[igold],
508 -1,tgamma, qualityGold,cgold->GetQuality(),0};
509 // GetLinearDistances(trackTOFin,cgold,&info[6]);
512 // info[7] = mintimedist[index[inonfake]];
516 t->SetTOFsignal(tof2);
517 t->SetTOFcluster(cgold->GetIndex());
518 AliTOFtrack *trackTOFout = new AliTOFtrack(*t);
519 trackTOFout->PropagateTo(378.);
520 t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);
521 t->SetIntegratedLength(length[igold]);
522 t->SetIntegratedTimes(times[igold]);
523 t->SetTOFLabel(tlab);
532 for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
533 for (Int_t ii=0;ii<6;ii++) delete [] clind[ii];
539 // //_________________________________________________________________________
540 // Int_t AliTOFtrackerMI::LoadClusters(TTree *dTree) {
541 // //--------------------------------------------------------------------
542 // //This function loads the TOF clusters
543 // //--------------------------------------------------------------------
545 // TBranch *branch=dTree->GetBranch("TOF");
547 // Error("LoadClusters"," can't get the branch with the TOF digits !\n");
551 // TClonesArray dummy("AliTOFdigit",10000), *digits=&dummy;
552 // branch->SetAddress(&digits);
554 // dTree->GetEvent(0);
555 // Int_t nd=digits->GetEntriesFast();
556 // Info("LoadClusters","number of digits: %d",nd);
558 // for (Int_t i=0; i<nd; i++) {
559 // AliTOFdigit *d=(AliTOFdigit*)digits->UncheckedAt(i);
560 // Int_t dig[5]; Float_t g[3];
561 // dig[0]=d->GetSector();
562 // dig[1]=d->GetPlate();
563 // dig[2]=d->GetStrip();
564 // dig[3]=d->GetPadz();
565 // dig[4]=d->GetPadx();
567 // fGeom->GetPos(dig,g);
570 // h[0]=TMath::Sqrt(g[0]*g[0]+g[1]*g[1]);
571 // h[1]=TMath::ATan2(g[1],g[0]); h[2]=g[2];
572 // h[3]=d->GetTdc(); h[4]=d->GetAdc();
574 // AliTOFcluster *cl=new AliTOFcluster(h,d->GetTracks(),dig,i);
575 // InsertCluster(cl);
580 // //_________________________________________________________________________
581 // void AliTOFtrackerMI::UnloadClusters() {
582 // //--------------------------------------------------------------------
583 // //This function unloads TOF clusters
584 // //--------------------------------------------------------------------
585 // for (Int_t i=0; i<fN; i++) delete fClusters[i];
591 //_________________________________________________________________________
592 Int_t AliTOFtrackerMI::LoadClusters(TTree *cTree) {
593 //--------------------------------------------------------------------
594 //This function loads the TOF clusters
595 //--------------------------------------------------------------------
597 TBranch *branch=cTree->GetBranch("TOF");
599 AliError("can't get the branch with the TOF clusters !");
603 TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
604 branch->SetAddress(&clusters);
607 Int_t nc=clusters->GetEntriesFast();
608 AliInfo(Form("Number of clusters: %d",nc));
610 for (Int_t i=0; i<nc; i++) {
611 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
613 for (Int_t jj=0; jj<5; jj++) dig[jj]=c->GetDetInd(jj);
623 for (Int_t jj=0; jj<3; jj++) indexDig[jj] = c->GetLabel(jj);
625 AliTOFcluster *cl=new AliTOFcluster(h,c->GetTracks(),dig,i);
628 // fClusters[i]=c; fN++;
629 fClusters[i]=new AliTOFcluster(*c); fN++;
631 //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)));
632 //AliInfo(Form("%i %f",i, fClusters[i]->GetZ()));
635 //AliInfo(Form("Number of clusters: %d",fN));
639 //_________________________________________________________________________
640 void AliTOFtrackerMI::UnloadClusters() {
641 //--------------------------------------------------------------------
642 //This function unloads TOF clusters
643 //--------------------------------------------------------------------
644 for (Int_t i=0; i<fN; i++) {
654 //_________________________________________________________________________
655 Int_t AliTOFtrackerMI::InsertCluster(AliTOFcluster *c) {
656 //--------------------------------------------------------------------
657 //This function adds a cluster to the array of clusters sorted in Z
658 //--------------------------------------------------------------------
659 if (fN==kMaxCluster) {
660 Error("InsertCluster","Too many clusters !\n");
664 if (fN==0) {fClusters[fN++]=c; return 0;}
665 Int_t i=FindClusterIndex(c->GetZ());
666 memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTOFcluster*));
667 fClusters[i]=c; fN++;
672 //_________________________________________________________________________
673 Int_t AliTOFtrackerMI::FindClusterIndex(Double_t z) const {
674 //--------------------------------------------------------------------
675 // This function returns the index of the nearest cluster
676 //--------------------------------------------------------------------
678 if (z <= fClusters[0]->GetZ()) return 0;
679 if (z > fClusters[fN-1]->GetZ()) return fN;
680 Int_t b=0, e=fN-1, m=(b+e)/2;
681 for (; b<e; m=(b+e)/2) {
682 if (z > fClusters[m]->GetZ()) b=m+1;
690 Float_t AliTOFtrackerMI::GetLinearDistances(AliTOFtrack * track, AliTOFcluster *cluster, Float_t distances[5])
693 // calclates distance between cluster and track
694 // use linear aproximation
696 const Float_t kRaddeg = 180/3.14159265358979312;
698 // Float_t tiltangle = fGeom->GetAngles(cluster->fdetIndex[1],cluster->fdetIndex[2])/kRaddeg; //tiltangle
700 cind[0]= cluster->GetDetInd(0);
701 cind[1]= cluster->GetDetInd(1);
702 cind[2]= cluster->GetDetInd(2);
703 cind[3]= cluster->GetDetInd(3);
704 cind[4]= cluster->GetDetInd(4);
705 Float_t tiltangle = fGeom->GetAngles(cluster->GetDetInd(1),cluster->GetDetInd(2))/kRaddeg; //tiltangle
707 Float_t cpos[3]; //cluster position
708 Float_t cpos0[3]; //cluster position
709 // fGeom->GetPos(cluster->fdetIndex,cpos);
710 //fGeom->GetPos(cluster->fdetIndex,cpos0);
712 fGeom->GetPos(cind,cpos);
713 fGeom->GetPos(cind,cpos0);
715 Float_t phi = TMath::ATan2(cpos[1],cpos[0]);
716 if(phi<0) phi=2.*TMath::Pi()+phi;
717 // Get the local angle in the sector philoc
718 Float_t phiangle = (Int_t (phi*kRaddeg/20.) + 0.5)*20./kRaddeg;
722 track->GetGlobalXYZ(v0[0],v0[1],v0[2]);
723 track->GetPxPyPz(dir[0],dir[1],dir[2]);
724 dir[0]/=track->GetP();
725 dir[1]/=track->GetP();
726 dir[2]/=track->GetP();
730 Float_t sinphi = TMath::Sin(phiangle);
731 Float_t cosphi = TMath::Cos(phiangle);
732 Float_t sinth = TMath::Sin(tiltangle);
733 Float_t costh = TMath::Cos(tiltangle);
736 temp = cpos[0]*cosphi+cpos[1]*sinphi;
737 cpos[1] = -cpos[0]*sinphi+cpos[1]*cosphi;
739 temp = v0[0]*cosphi+v0[1]*sinphi;
740 v0[1] = -v0[0]*sinphi+v0[1]*cosphi;
743 temp = cpos[0]*costh+cpos[2]*sinth;
744 cpos[2] = -cpos[0]*sinth+cpos[2]*costh;
746 temp = v0[0]*costh+v0[2]*sinth;
747 v0[2] = -v0[0]*sinth+v0[2]*costh;
751 //rotate direction vector
753 temp = dir[0]*cosphi+dir[1]*sinphi;
754 dir[1] = -dir[0]*sinphi+dir[1]*cosphi;
757 temp = dir[0]*costh+dir[2]*sinth;
758 dir[2] = -dir[0]*sinth+dir[2]*costh;
762 Float_t k = (cpos[0]-v0[0])/dir[0];
763 v3[0] = v0[0]+k*dir[0];
764 v3[1] = v0[1]+k*dir[1];
765 v3[2] = v0[2]+k*dir[2];
767 distances[0] = v3[0]-cpos[0];
768 distances[1] = v3[1]-cpos[1];
769 distances[2] = v3[2]-cpos[2];
770 distances[3] = TMath::Sqrt( distances[0]*distances[0]+distances[1]*distances[1]+distances[2]*distances[2]); //distance
771 distances[4] = k; //length
774 // Debuging part of the matching
776 if (track->GetLabel()==cluster->GetLabel(0) ||track->GetLabel()==cluster->GetLabel(1) ){
777 TTreeSRedirector& cstream = *fDebugStreamer;
778 Float_t tdc = cluster->GetTDC();
785 "Dist0="<<distances[0]<<
786 "Dist1="<<distances[1]<<
787 "Dist2="<<distances[2]<<
796 void AliTOFtrackerMI::GetLikelihood(Float_t dy, Float_t dz, const Double_t *cov, AliTOFtrack * /*track*/, Float_t & py, Float_t &pz)
799 // get likelihood - track covariance taken
800 // 75 % of gauss with expected sigma
801 // 25 % of gauss with extended sigma
803 Double_t kMaxSigmaY = 0.6; // ~ 90% of TRD tracks
804 Double_t kMaxSigmaZ = 1.2; // ~ 90% of TRD tracks
805 Double_t kMeanSigmaY = 0.25; // mean TRD sigma
806 Double_t kMeanSigmaZ = 0.5; // mean TRD sigma
809 Float_t normwidth, normd, p0,p1;
810 Float_t sigmay = TMath::Max(TMath::Sqrt(cov[0]+kMeanSigmaY*kMeanSigmaY),kMaxSigmaY);
811 Float_t sigmaz = TMath::Max(TMath::Sqrt(cov[2]+kMeanSigmaZ*kMeanSigmaZ),kMaxSigmaZ);
816 // py calculation - 75% admixture of original sigma - 25% tails
818 normwidth = fDy/sigmay;
820 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
821 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
824 normwidth = fDy/(3.*sigmay);
825 normd = dy/(3.*sigmay);
826 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
827 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
830 // pz calculation - 75% admixture of original sigma - 25% tails
832 normwidth = fDz/sigmaz;
834 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
835 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
838 normwidth = fDz/(3.*sigmaz);
839 normd = dz/(3.*sigmaz);
840 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
841 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));