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 **************************************************************************/
16 //-----------------------------------------------------------------//
18 // AliTOFtracker Class //
19 // Task: Perform association of the ESD tracks to TOF Clusters //
20 // and Update ESD track with associated TOF Cluster parameters //
22 //-----------------------------------------------------------------//
26 #include "TClonesArray.h"
28 #include "TTreeStream.h"
30 #include "AliESDEvent.h"
31 #include "AliESDtrack.h"
32 #include "AliESDpid.h"
34 #include "AliTOFRecoParam.h"
35 #include "AliTOFReconstructor.h"
36 #include "AliTOFcluster.h"
37 #include "AliTOFGeometry.h"
38 #include "AliTOFtrackerMI.h"
39 #include "AliTOFtrack.h"
43 extern TGeoManager *gGeoManager;
45 ClassImp(AliTOFtrackerMI)
47 //_____________________________________________________________________________
48 AliTOFtrackerMI::AliTOFtrackerMI():
64 fTracks(new TClonesArray("AliTOFtrack")),
65 fSeeds(new TClonesArray("AliESDtrack")),
68 //AliTOFtrackerMI main Ctor
70 fDy=AliTOFGeometry::XPad();
71 fDz=AliTOFGeometry::ZPad();
72 fDebugStreamer = new TTreeSRedirector("TOFdebug.root");
75 //_____________________________________________________________________________
76 AliTOFtrackerMI::~AliTOFtrackerMI(){
81 //fDebugStreamer->Close();
82 delete fDebugStreamer;
97 //_____________________________________________________________________________
98 void AliTOFtrackerMI::GetPidSettings(AliESDpid *esdPID) {
100 // Sets TOF resolution from RecoParams
103 esdPID->GetTOFResponse().SetTimeResolution(fkRecoParam->GetTimeResolution());
105 AliWarning("fkRecoParam not yet set; cannot set PID settings");
108 //_____________________________________________________________________________
109 Int_t AliTOFtrackerMI::PropagateBack(AliESDEvent * const event) {
111 // Gets seeds from ESD event and Match with TOF Clusters
114 // initialize RecoParam for current event
115 AliDebug(1,"Initializing params for TOF");
117 fkRecoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER...
119 if (fkRecoParam == 0x0) {
120 AliFatal("No Reco Param found for TOF!!!");
122 //fkRecoParam->Dump();
123 //if(fkRecoParam->GetApplyPbPbCuts())fkRecoParam=fkRecoParam->GetPbPbparam();
124 //fkRecoParam->PrintParameters();
126 //Initialise some counters
135 Int_t ntrk=event->GetNumberOfTracks();
137 TClonesArray &aESDTrack = *fSeeds;
140 //Load ESD tracks into a local Array of ESD Seeds
142 for (Int_t i=0; i<fNseeds; i++) {
143 AliESDtrack *t=event->GetTrack(i);
144 new(aESDTrack[i]) AliESDtrack(*t);
147 //Prepare ESD tracks candidates for TOF Matching
150 //First Step with Strict Matching Criterion
151 //MatchTracks(kFALSE);
153 //Second Step with Looser Matching Criterion
154 //MatchTracks(kTRUE);
155 MatchTracksMI(kFALSE); // assign track to clusters
156 MatchTracksMI(kTRUE); // assign clusters to esd
158 AliInfo(Form("Number of matched tracks = %d (good = %d, bad = %d)",fnmatch,fngoodmatch,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);
166 if ( (seed->GetStatus()&AliESDtrack::kTOFin)!=0 ) {
167 t->SetStatus(AliESDtrack::kTOFin);
168 //if(seed->GetTOFsignal()>0){
169 if ( (seed->GetStatus()&AliESDtrack::kTOFout)!=0 ) {
170 t->SetStatus(AliESDtrack::kTOFout);
171 t->SetTOFsignal(seed->GetTOFsignal());
172 t->SetTOFcluster(seed->GetTOFcluster());
173 Int_t tlab[3]; seed->GetTOFLabel(tlab);
174 t->SetTOFLabel(tlab);
177 // by calling the AliESDtrack::UpdateTrackParams,
178 // the current track parameters are changed
179 // and it could cause refit problems.
180 // We need to update only the following track parameters:
181 // the track length and expected times.
182 // Removed AliESDtrack::UpdateTrackParams call
183 // Called AliESDtrack::SetIntegratedTimes(...) and
184 // AliESDtrack::SetIntegratedLength() routines.
186 AliTOFtrack *track = new AliTOFtrack(*seed);
187 t->UpdateTrackParams(track,AliESDtrack::kTOFout);
191 Double_t times[10]; seed->GetIntegratedTimes(times);
192 t->SetIntegratedTimes(times);
193 t->SetIntegratedLength(seed->GetIntegratedLength());
194 t->SetTOFsignalToT(seed->GetTOFsignalToT());
195 t->SetTOFCalChannel(seed->GetTOFCalChannel());
197 // Make attention, please:
198 // AliESDtrack::fTOFInfo array does not be stored in the AliESDs.root file
199 // it is there only for a check during the reconstruction step.
201 seed->GetTOFInfo(info);
215 //_________________________________________________________________________
216 void AliTOFtrackerMI::CollectESD() {
217 //prepare the set of ESD tracks to be matched to clusters in TOF
219 TClonesArray &aTOFTrack = *fTracks;
222 for (Int_t i=0; i<fNseeds; i++) {
224 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
225 if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
227 AliTOFtrack *track = new AliTOFtrack(*t); // New
228 Float_t x = (Float_t)track->GetX(); //New
230 // TRD good tracks, already propagated at 371 cm
231 if ( ( (t->GetStatus()&AliESDtrack::kTRDout)!=0 ) &&
232 ( x >= AliTOFGeometry::Rmin() ) ) {
233 if ( track->PropagateToInnerTOF() ) {
234 track->SetSeedIndex(i);
235 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
236 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
243 // Propagate the rest of TPCbp
245 if ( track->PropagateToInnerTOF() ) { // temporary solution
246 track->SetSeedIndex(i);
247 t->UpdateTrackParams(track,AliESDtrack::kTOFin);
248 new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
257 printf("TRD\tOn\t%d\tOff\t%d\n",c0,c1);
259 // Sort according uncertainties on track position
264 //_________________________________________________________________________
265 void AliTOFtrackerMI::MatchTracks( Bool_t /*mLastStep*/) const {
270 //_________________________________________________________________________
271 void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
273 //Match ESD tracks to clusters in TOF
274 const Float_t kTofOffset = 26; // time offset
275 const Float_t kMinQuality = -6.; // minimal quality
276 const Float_t kMaxQualityD = 1.; // max delta quality if cluster used
277 const Float_t kForbiddenR = 0.1; // minimal PID according TPC
279 static const Double_t kMasses[]={
280 0.000511, 0.105658, 0.139570, 0.493677, 0.938272, 1.875613
283 Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
285 //AliTOFcalib *calib = new AliTOFcalib(); // AdC
287 //PH Arrays (moved outside of the loop)
288 Float_t * trackPos[4];
289 for (Int_t ii=0; ii<4; ii++) trackPos[ii] = new Float_t[nSteps];
290 Int_t * clind = new Int_t[fN];
293 const Int_t kNclusterMax = 1000; // related to fN value
294 AliTOFcluster *clusters[kNclusterMax];
295 Int_t index[kNclusterMax];
296 Float_t quality[kNclusterMax];
297 Float_t dist3D[kNclusterMax][6];
298 Double_t times[kNclusterMax][6];
299 Float_t mintimedist[kNclusterMax];
300 Float_t likelihood[kNclusterMax];
301 Float_t length[kNclusterMax];
305 for (Int_t i=0; i<fNseedsTOF; i++) {
307 AliTOFtrack *track =(AliTOFtrack*)fTracks->UncheckedAt(i);
308 AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(track->GetSeedIndex());
309 Bool_t hasTime = ( (t->GetStatus()& AliESDtrack::kTIME)>0) ? kTRUE:kFALSE; // did we integrate time
310 Float_t trdquality = t->GetTRDQuality();
314 t->GetTPCpid(tpcpid);
316 for (Int_t ipid=0;ipid<5;ipid++){
317 sumpid+=tpcpid[ipid];
319 for (Int_t ipid=0;ipid<5;ipid++){
320 if (sumpid>0) tpcpid[ipid]/=sumpid;
326 if (trdquality<0) continue; // no chance
328 AliTOFtrack *trackTOFin =new AliTOFtrack(*track);
330 //propagat track to the middle of TOF
332 Float_t xs = 379.2; // should be defined in the TOF geometry
333 Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
335 Double_t ysect=trackTOFin->GetYat(xs,skip);
338 ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
339 ysect=trackTOFin->GetYat(xs,skip);
342 if (!trackTOFin->Rotate(AliTOFGeometry::GetAlpha())) {
345 } else if (ysect <-ymax) {
346 if (!trackTOFin->Rotate(-AliTOFGeometry::GetAlpha())) {
350 if(!trackTOFin->PropagateTo(xs)) {
354 // Determine a window around the track
357 trackTOFin->GetExternalParameters(x,par);
359 trackTOFin->GetExternalCovariance(cov);
361 if (cov[0]<0. || cov[2]<0.) {
362 AliWarning(Form("Very strange track (%d)! At least one of its covariance matrix diagonal elements is negative!",i));
367 Float_t scalefact=3.;
370 ((5*TMath::Sqrt(TMath::Abs(cov[0])) + 3.*fDy + 10.*TMath::Abs(par[2]))/fR);
373 (5*TMath::Sqrt(TMath::Abs(cov[2])) + 3.*fDz + 10.*TMath::Abs(par[3]));
375 Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
376 if (phi<-TMath::Pi())phi+=2*TMath::Pi();
377 if (phi>=TMath::Pi())phi-=2*TMath::Pi();
382 // find the clusters in the window of the track
384 for (Int_t k=FindClusterIndex(z-dz); k<fN; k++) {
386 if (nc>=kNclusterMax) {
387 AliWarning("No more matchable clusters can be stored! Please, increase the corresponding vectors size.");
391 AliTOFcluster *c=fClusters[k];
392 if (c->GetZ() > z+dz) break;
393 // if (c->IsUsed()) continue;
395 Double_t dph=TMath::Abs(c->GetPhi()-phi);
396 if (dph>TMath::Pi()) dph-=2.*TMath::Pi();
397 if (TMath::Abs(dph)>dphi) continue;
403 AliDebug(1,Form(" Number of matchable TOF clusters for the track number %d: %d",i,nc));
406 // select close clusters
408 Double_t mom=t->GetP();
409 // Bool_t dump = kTRUE;
410 for (Int_t icl=0; icl<nc; icl++){
411 Float_t distances[5];
413 index[nfound]=clind[icl];
414 AliTOFcluster *cluster = fClusters[clind[icl]];
415 GetLinearDistances(trackTOFin, cluster, distances);
416 dist3D[nfound][0] = distances[4];
417 dist3D[nfound][1] = distances[1];
418 dist3D[nfound][2] = distances[2];
420 if (TMath::Abs(dist3D[nfound][1])>20 || TMath::Abs(dist3D[nfound][2])>20) continue;
422 GetLikelihood(distances[1],distances[2],cov,trackTOFin, dist3D[nfound][3], dist3D[nfound][4]);
425 if (dist3D[nfound][3]*dist3D[nfound][4]<0.00000000000001) continue; // log likelihood
426 if (TMath::Log(dist3D[nfound][3]*dist3D[nfound][4])<-9) continue; // log likelihood
428 clusters[nfound] = cluster;
430 //length and TOF updates
431 trackTOFin->GetIntegratedTimes(times[nfound]);
432 length[nfound] = trackTOFin->GetIntegratedLength();
433 length[nfound]+=distances[4];
434 mintimedist[nfound]=1000;
435 Double_t tof2=AliTOFGeometry::TdcBinWidth()*cluster->GetTDC()+kTofOffset; // in ps
436 // Float_t tgamma = TMath::Sqrt(cluster->GetR()*cluster->GetR()+cluster->GetZ()*cluster->GetZ())/0.03; //time for "primary" gamma
437 //if (trackTOFin->GetPt()<0.7 && TMath::Abs(tgamma-tof2)<350) continue; // gamma conversion candidate - TEMPORARY
438 for(Int_t j=0;j<=5;j++){
439 Double_t mass=kMasses[j];
440 times[nfound][j]+=distances[4]/3e-2*TMath::Sqrt(mom*mom+mass*mass)/mom; // add time distance
441 if ( TMath::Abs(times[nfound][j]-tof2)<mintimedist[nfound] && tpcpid[j]>kForbiddenR){
442 mintimedist[nfound]=TMath::Abs(times[nfound][j]-tof2);
446 Float_t liketime = TMath::Exp(-mintimedist[nfound]/90.)+0.25*TMath::Exp(-mintimedist[nfound]/180.);
447 if (!hasTime) liketime=0.2;
448 likelihood[nfound] = TMath::Log(dist3D[nfound][3]*dist3D[nfound][4]*liketime);
450 if (TMath::Log(dist3D[nfound][3]*dist3D[nfound][4])<-1){
451 if (likelihood[nfound]<-9.) continue;
457 AliDebug(1,Form(" Number of track points for the track number %d: %d",i,nfound));
465 //choose the best cluster
467 //Float_t quality[kNclusterMax];
468 //Int_t index[kNclusterMax];
469 for (Int_t kk=0; kk<kNclusterMax; kk++) quality[kk]=0;
471 AliTOFcluster * cgold=0;
473 for (Int_t icl=0;icl<nfound;icl++){
474 quality[icl] = dist3D[icl][3]*dist3D[icl][4];
476 TMath::Sort(nfound,quality,index,kTRUE);
478 cgold = clusters[igold];
479 if (nfound>1 &&likelihood[index[1]]>likelihood[index[0]]){
480 if ( quality[index[0]]<quality[index[1]]+0.5){
482 cgold = clusters[igold];
487 Float_t qualityGold = TMath::Log(0.0000001+(quality[igold]*(0.1+TMath::Exp(-mintimedist[igold]/80.))*(0.2+trdquality)));
489 if (cgold->GetQuality()<qualityGold) cgold->SetQuality(qualityGold);
494 //signed better cluster
495 if (cgold->GetQuality()>qualityGold+kMaxQualityD) continue;
496 if (2.*qualityGold-cgold->GetQuality()<kMinQuality) continue;
501 for (Int_t icl=0;icl<nfound;icl++){
503 (clusters[index[icl]]->GetLabel(0)==TMath::Abs(trackTOFin->GetLabel()))
505 (clusters[index[icl]]->GetLabel(1)==TMath::Abs(trackTOFin->GetLabel()))
507 (clusters[index[icl]]->GetLabel(2)==TMath::Abs(trackTOFin->GetLabel()))
514 if (inonfake==0) fngoodmatch++;
520 tlab[0]=cgold->GetLabel(0);
521 tlab[1]=cgold->GetLabel(1);
522 tlab[2]=cgold->GetLabel(2);
523 // Double_t tof2=25.*cgold->GetTDC()-350; // in ps
524 Double_t tof2=AliTOFGeometry::TdcBinWidth()*cgold->GetTDC()+kTofOffset; // in ps
525 Float_t tgamma = TMath::Sqrt(cgold->GetR()*cgold->GetR()+cgold->GetZ()*cgold->GetZ())/0.03;
526 Float_t info[10]={dist3D[igold][0],
535 cgold->GetQuality()};
536 // GetLinearDistances(trackTOFin,cgold,&info[6]);
539 // info[7] = mintimedist[index[inonfake]];
542 // Store quantities to be used for TOF Calibration
543 Float_t tToT=cgold->GetToT(); // in ps
544 t->SetTOFsignalToT(tToT);
546 ind[0]=cgold->GetDetInd(0);
547 ind[1]=cgold->GetDetInd(1);
548 ind[2]=cgold->GetDetInd(2);
549 ind[3]=cgold->GetDetInd(3);
550 ind[4]=cgold->GetDetInd(4);
551 Int_t calindex = AliTOFGeometry::GetIndex(ind);
552 t->SetTOFCalChannel(calindex);
555 t->SetTOFsignal(tof2);
556 t->SetTOFcluster(cgold->GetIndex());
558 AliDebug(2, Form("%7i %7i %10i %10i %10i %10i %7i",
561 TMath::Abs(trackTOFin->GetLabel()),
562 tlab[0], tlab[1], tlab[2],
565 AliTOFtrack *trackTOFout = new AliTOFtrack(*t);
566 trackTOFout->PropagateTo(379.);
568 // Fill the track residual histograms.
569 FillResiduals(trackTOFout,cgold,kFALSE);
571 t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);
572 t->SetIntegratedLength(length[igold]);
573 t->SetIntegratedTimes(times[igold]);
574 t->SetTOFLabel(tlab);
583 for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
585 //delete calib; // AdC
587 //_________________________________________________________________________
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 static TClonesArray dummy("AliTOFcluster",10000);
602 TClonesArray *clusters=&dummy;
603 branch->SetAddress(&clusters);
606 Int_t nc=clusters->GetEntriesFast();
607 AliInfo(Form("Number of clusters: %d",nc));
609 for (Int_t i=0; i<nc; i++) {
610 AliTOFcluster *c=(AliTOFcluster*)clusters->UncheckedAt(i);
612 //PH fClusters[i]=new AliTOFcluster(*c); fN++;
613 fClusters[i]=c; fN++;
615 //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)));
616 //AliInfo(Form("%i %f",i, fClusters[i]->GetZ()));
619 //AliInfo(Form("Number of clusters: %d",fN));
623 //_________________________________________________________________________
624 void AliTOFtrackerMI::UnloadClusters() {
625 //--------------------------------------------------------------------
626 //This function unloads TOF clusters
627 //--------------------------------------------------------------------
628 for (Int_t i=0; i<fN; i++) {
629 //PH delete fClusters[i];
638 //_________________________________________________________________________
639 Int_t AliTOFtrackerMI::InsertCluster(AliTOFcluster *c) {
640 //--------------------------------------------------------------------
641 //This function adds a cluster to the array of clusters sorted in Z
642 //--------------------------------------------------------------------
643 if (fN==kMaxCluster) {
644 AliError("Too many clusters !");
648 if (fN==0) {fClusters[fN++]=c; return 0;}
649 Int_t i=FindClusterIndex(c->GetZ());
650 memmove(fClusters+i+1 ,fClusters+i,(fN-i)*sizeof(AliTOFcluster*));
651 fClusters[i]=c; fN++;
656 //_________________________________________________________________________
657 Int_t AliTOFtrackerMI::FindClusterIndex(Double_t z) const {
658 //--------------------------------------------------------------------
659 // This function returns the index of the nearest cluster
660 //--------------------------------------------------------------------
662 if (z <= fClusters[0]->GetZ()) return 0;
663 if (z > fClusters[fN-1]->GetZ()) return fN;
664 Int_t b=0, e=fN-1, m=(b+e)/2;
665 for (; b<e; m=(b+e)/2) {
666 if (z > fClusters[m]->GetZ()) b=m+1;
672 //_________________________________________________________________________
673 Float_t AliTOFtrackerMI::GetLinearDistances(AliTOFtrack * track, AliTOFcluster *cluster, Float_t distances[5])
676 // calclates distance between cluster and track
677 // use linear aproximation
679 //const Float_t kRaddeg = 180/3.14159265358979312;
680 const Float_t kRaddeg = TMath::RadToDeg();
682 // Float_t tiltangle = fGeom->GetAngles(cluster->fdetIndex[1],cluster->fdetIndex[2])/kRaddeg; //tiltangle
684 cind[0]= cluster->GetDetInd(0);
685 cind[1]= cluster->GetDetInd(1);
686 cind[2]= cluster->GetDetInd(2);
687 cind[3]= cluster->GetDetInd(3);
688 cind[4]= cluster->GetDetInd(4);
689 Float_t tiltangle = AliTOFGeometry::GetAngles(cluster->GetDetInd(1),cluster->GetDetInd(2))/kRaddeg; //tiltangle
691 Float_t cpos[3]; //cluster position
692 Float_t cpos0[3]; //cluster position
693 // fGeom->GetPos(cluster->fdetIndex,cpos);
694 //fGeom->GetPos(cluster->fdetIndex,cpos0);
696 fGeom->GetPos(cind,cpos);
697 fGeom->GetPos(cind,cpos0);
699 Float_t phi = TMath::ATan2(cpos[1],cpos[0]);
700 if(phi<0) phi=2.*TMath::Pi()+phi;
701 // Get the local angle in the sector philoc
702 Float_t phiangle = (Int_t (phi*kRaddeg/20.) + 0.5)*20./kRaddeg;
707 track->GetPxPyPz(dir);
708 dir[0]/=track->GetP();
709 dir[1]/=track->GetP();
710 dir[2]/=track->GetP();
714 Float_t sinphi = TMath::Sin(phiangle);
715 Float_t cosphi = TMath::Cos(phiangle);
716 Float_t sinth = TMath::Sin(tiltangle);
717 Float_t costh = TMath::Cos(tiltangle);
720 temp = cpos[0]*cosphi+cpos[1]*sinphi;
721 cpos[1] = -cpos[0]*sinphi+cpos[1]*cosphi;
723 temp = v0[0]*cosphi+v0[1]*sinphi;
724 v0[1] = -v0[0]*sinphi+v0[1]*cosphi;
727 temp = cpos[0]*costh+cpos[2]*sinth;
728 cpos[2] = -cpos[0]*sinth+cpos[2]*costh;
730 temp = v0[0]*costh+v0[2]*sinth;
731 v0[2] = -v0[0]*sinth+v0[2]*costh;
735 //rotate direction vector
737 temp = dir[0]*cosphi+dir[1]*sinphi;
738 dir[1] = -dir[0]*sinphi+dir[1]*cosphi;
741 temp = dir[0]*costh+dir[2]*sinth;
742 dir[2] = -dir[0]*sinth+dir[2]*costh;
746 Float_t k = (cpos[0]-v0[0])/dir[0];
747 v3[0] = v0[0]+k*dir[0];
748 v3[1] = v0[1]+k*dir[1];
749 v3[2] = v0[2]+k*dir[2];
751 distances[0] = v3[0]-cpos[0];
752 distances[1] = v3[1]-cpos[1];
753 distances[2] = v3[2]-cpos[2];
754 distances[3] = TMath::Sqrt( distances[0]*distances[0]+distances[1]*distances[1]+distances[2]*distances[2]); //distance
755 distances[4] = k; //length
758 // Debuging part of the matching
760 if (track->GetLabel()==cluster->GetLabel(0) ||
761 track->GetLabel()==cluster->GetLabel(1) ||
762 track->GetLabel()==cluster->GetLabel(2) ){
763 TTreeSRedirector& cstream = *fDebugStreamer;
764 Float_t tdc = cluster->GetTDC();
771 "Dist0="<<distances[0]<<
772 "Dist1="<<distances[1]<<
773 "Dist2="<<distances[2]<<
780 //_________________________________________________________________________
781 void AliTOFtrackerMI::GetLikelihood(Float_t dy, Float_t dz, const Double_t *cov, AliTOFtrack * /*track*/, Float_t & py, Float_t &pz) const
784 // get likelihood - track covariance taken
785 // 75 % of gauss with expected sigma
786 // 25 % of gauss with extended sigma
788 Double_t kMaxSigmaY = 0.6; // ~ 90% of TRD tracks
789 Double_t kMaxSigmaZ = 1.2; // ~ 90% of TRD tracks
790 Double_t kMeanSigmaY = 0.25; // mean TRD sigma
791 Double_t kMeanSigmaZ = 0.5; // mean TRD sigma
794 Float_t normwidth, normd, p0,p1;
795 Float_t sigmay = TMath::Max(TMath::Sqrt(cov[0]+kMeanSigmaY*kMeanSigmaY),kMaxSigmaY);
796 Float_t sigmaz = TMath::Max(TMath::Sqrt(cov[2]+kMeanSigmaZ*kMeanSigmaZ),kMaxSigmaZ);
801 // py calculation - 75% admixture of original sigma - 25% tails
803 normwidth = fDy/sigmay;
805 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
806 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
809 normwidth = fDy/(3.*sigmay);
810 normd = dy/(3.*sigmay);
811 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
812 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
815 // pz calculation - 75% admixture of original sigma - 25% tails
817 normwidth = fDz/sigmaz;
819 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
820 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
823 normwidth = fDz/(3.*sigmaz);
824 normd = dz/(3.*sigmaz);
825 p0 = 0.5*(1+TMath::Erf(normd-normwidth*0.5));
826 p1 = 0.5*(1+TMath::Erf(normd+normwidth*0.5));
829 //_________________________________________________________________________
831 void AliTOFtrackerMI::FillClusterArray(TObjArray* arr) const
834 // Returns the TOF cluster array
840 for (Int_t i=0; i<fN; ++i) arr->Add(fClusters[i]);