1 #include "AliRICHTracker.h"
6 #include "AliRICHHelix.h"
8 #include "AliRICHRecon.h"
10 #include <TParticle.h>
12 ClassImp(AliRICHTracker)
15 Int_t AliRICHTracker::PropagateBack(AliESD *pESD)
17 Int_t iNtracks=pESD->GetNumberOfTracks();
18 Double_t b=GetFieldMap()->SolenoidField()/10;// magnetic field in Tesla
19 AliDebug(1,Form("Start with %i tracks in %f Tesla field",iNtracks,b));
20 Double_t xb[3],pb[3];//tmp storage for track parameters
21 TVector3 x0(0,0,0); TVector3 p0(0,0,0);//tmp storage for AliRICHHelix
23 AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH"));
25 // pRich->GetLoader()->GetRunLoader()->LoadHeader();pRich->GetLoader()->GetRunLoader()->LoadKinematics();
26 // AliStack *pStack = pRich->GetLoader()->GetRunLoader()->Stack();
27 // TParticle *pParticle = pStack->Particle(0);
28 // p0.SetMagThetaPhi(pParticle->P(),pParticle->Theta(),pParticle->Phi());
30 for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//ESD tracks loop
31 AliESDtrack *pTrack = pESD->GetTrack(iTrackN);// get next reconstructed track
32 // if((pTrack->GetStatus()&AliESDtrack::kTOFout)==0) continue; //ignore tracks not recontructed by TOF
34 pTrack->GetPxPyPz(pb);
35 Int_t status=pTrack->GetStatus()&AliESDtrack::kTOFout;//get running track parameters
36 AliDebug(1,Form("Track %i pmod=%f mass=%f stat=%i",iTrackN,pTrack->GetP(),pTrack->GetMass(),status));
37 // x.Print();p.Print();
38 x0.SetXYZ(xb[0],xb[1],xb[2]); p0.SetXYZ(xb[0],xb[1],xb[2]);
39 AliRICHHelix helix(x0,p0,pTrack->GetSign(),b);
40 Int_t iChamber=helix.RichIntersect(pRich->P());
41 AliDebug(1,Form("intersection with %i chamber found",iChamber));
42 if(!iChamber) continue;//intersection with no chamber found
44 Double_t distMip=9999; //min distance between clusters and track position on PC
45 Int_t iMipId=0; //index of that min distance cluster
46 for(Int_t iClusN=0;iClusN<pRich->Clusters(iChamber)->GetEntries();iClusN++){//clusters loop for intersected chamber
47 AliRICHcluster *pClus=(AliRICHcluster*)pRich->Clusters(iChamber)->UncheckedAt(iClusN);//get pointer to current cluster
48 Double_t distCurrent=pClus->DistTo(helix.PosPc());//ditance between current cluster and helix intersection with PC
49 if(distCurrent<distMip){distMip=distCurrent;iMipId=iClusN;}//find cluster nearest to the track
51 AliDebug(1,Form("Ploc (%f,%f,%f) dist= %f",helix.Ploc().Mag(),helix.Ploc().Theta()*TMath::RadToDeg(),
52 helix.Ploc().Phi()*TMath::RadToDeg(),pClus->DistTo(helix.PosPc())));
53 }////clusters loop for intersected chamber
55 AliDebug(1,Form("Min distance cluster: %i dist is %f",iMipId,distMip));
57 AliRICHRecon recon(&helix,pRich->Clusters(iChamber),iMipId);
58 Double_t thetaCerenkov=recon.ThetaCerenkov(); //search for mean Cerenkov angle for this track
59 AliDebug(1,Form("FINAL Theta Cerenkov=%f",thetaCerenkov));
60 pTrack->SetRICHsignal(thetaCerenkov);
66 } //pure virtual from AliTracker
68 Int_t AliRICHTracker::LoadClusters(TTree *pTree)
70 // Load clusters for RICH
71 AliDebug(1,"Start."); pTree->GetEntry(0); AliDebug(1,"Stop."); return 0;