]>
Commit | Line | Data |
---|---|---|
998b831f | 1 | #include "AliRICHTracker.h" |
2 | #include <AliESD.h> | |
3 | #include <TVector3.h> | |
4 | #include <TTree.h> | |
5 | #include "AliRICH.h" | |
6 | #include "AliRICHHelix.h" | |
7 | #include <AliMagF.h> | |
8 | #include "AliRICHRecon.h" | |
9 | #include <AliStack.h> | |
10 | #include <TParticle.h> | |
30c60010 | 11 | #include <TMath.h> |
998b831f | 12 | ClassImp(AliRICHTracker) |
30c60010 | 13 | //__________________________________________________________________________________________________ |
998b831f | 14 | Int_t AliRICHTracker::PropagateBack(AliESD *pESD) |
15 | { | |
30c60010 | 16 | //invoked by AliRecontruction for RICH |
17 | //if ESD doesn't contain tracks, try to reconstruct with particle from STACK | |
18 | //(this case is just to forsee a standalone RICH simulation | |
1cb5a97c | 19 | TNtupleD *hn=0; |
30c60010 | 20 | AliDebug(1,"Start pattern recognition"); |
21 | if(pESD->GetNumberOfTracks()) RecWithESD(pESD); | |
22 | else | |
1cb5a97c | 23 | RecWithStack(hn); |
30c60010 | 24 | AliDebug(1,"Stop pattern recognition"); |
25 | ||
26 | return 0; // error code: 0=no error; | |
27 | } //pure virtual from AliTracker | |
28 | //__________________________________________________________________________________________________ | |
29 | void AliRICHTracker::RecWithESD(AliESD *pESD) | |
30 | { | |
31 | //recontruction from ESD | |
32 | // | |
998b831f | 33 | Int_t iNtracks=pESD->GetNumberOfTracks(); |
34 | Double_t b=GetFieldMap()->SolenoidField()/10;// magnetic field in Tesla | |
35 | AliDebug(1,Form("Start with %i tracks in %f Tesla field",iNtracks,b)); | |
36 | Double_t xb[3],pb[3];//tmp storage for track parameters | |
37 | TVector3 x0(0,0,0); TVector3 p0(0,0,0);//tmp storage for AliRICHHelix | |
38 | ||
39 | AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); | |
40 | ||
998b831f | 41 | for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//ESD tracks loop |
42 | AliESDtrack *pTrack = pESD->GetTrack(iTrackN);// get next reconstructed track | |
43 | // if((pTrack->GetStatus()&AliESDtrack::kTOFout)==0) continue; //ignore tracks not recontructed by TOF | |
44 | pTrack->GetXYZ(xb); | |
1cb5a97c | 45 | pTrack->GetPxPyPz(pb); |
46 | Int_t status=pTrack->GetStatus()&AliESDtrack::kTOFout;//get running track parameters | |
998b831f | 47 | AliDebug(1,Form("Track %i pmod=%f mass=%f stat=%i",iTrackN,pTrack->GetP(),pTrack->GetMass(),status)); |
998b831f | 48 | x0.SetXYZ(xb[0],xb[1],xb[2]); p0.SetXYZ(xb[0],xb[1],xb[2]); |
49 | AliRICHHelix helix(x0,p0,pTrack->GetSign(),b); | |
50 | Int_t iChamber=helix.RichIntersect(pRich->P()); | |
51 | AliDebug(1,Form("intersection with %i chamber found",iChamber)); | |
52 | if(!iChamber) continue;//intersection with no chamber found | |
53 | ||
54 | Double_t distMip=9999; //min distance between clusters and track position on PC | |
55 | Int_t iMipId=0; //index of that min distance cluster | |
56 | for(Int_t iClusN=0;iClusN<pRich->Clusters(iChamber)->GetEntries();iClusN++){//clusters loop for intersected chamber | |
57 | AliRICHcluster *pClus=(AliRICHcluster*)pRich->Clusters(iChamber)->UncheckedAt(iClusN);//get pointer to current cluster | |
58 | Double_t distCurrent=pClus->DistTo(helix.PosPc());//ditance between current cluster and helix intersection with PC | |
59 | if(distCurrent<distMip){distMip=distCurrent;iMipId=iClusN;}//find cluster nearest to the track | |
60 | ||
61 | AliDebug(1,Form("Ploc (%f,%f,%f) dist= %f",helix.Ploc().Mag(),helix.Ploc().Theta()*TMath::RadToDeg(), | |
62 | helix.Ploc().Phi()*TMath::RadToDeg(),pClus->DistTo(helix.PosPc()))); | |
63 | }////clusters loop for intersected chamber | |
64 | ||
65 | AliDebug(1,Form("Min distance cluster: %i dist is %f",iMipId,distMip)); | |
66 | ||
67 | AliRICHRecon recon(&helix,pRich->Clusters(iChamber),iMipId); | |
68 | Double_t thetaCerenkov=recon.ThetaCerenkov(); //search for mean Cerenkov angle for this track | |
69 | AliDebug(1,Form("FINAL Theta Cerenkov=%f",thetaCerenkov)); | |
70 | pTrack->SetRICHsignal(thetaCerenkov); | |
71 | ||
1cb5a97c | 72 | // Double_t richPID[5]={0.2,0.2,0.2,0.2,0.2}; //start with equal probs for (e,mu,pi,k,p) |
73 | // CalcProb(thetaCerenkov,p0.Mag(),richPID); | |
74 | // pTrack->SetRICHpid(richPID); | |
998b831f | 75 | |
76 | }//ESD tracks loop | |
77 | AliDebug(1,"Stop."); | |
30c60010 | 78 | } //RecWithESD |
79 | //__________________________________________________________________________________________________ | |
1cb5a97c | 80 | void AliRICHTracker::RecWithStack(TNtupleD *hn) |
30c60010 | 81 | { |
82 | // reconstruction for particles from STACK | |
83 | // | |
84 | AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); | |
85 | ||
1cb5a97c | 86 | // pRich->GetLoader()->GetRunLoader()->LoadHeader(); |
87 | pRich->GetLoader()->GetRunLoader()->LoadKinematics(); | |
30c60010 | 88 | AliStack *pStack = pRich->GetLoader()->GetRunLoader()->Stack(); |
89 | Int_t iNtracks=pStack->GetNtrack(); | |
1cb5a97c | 90 | AliDebug(1,Form(" Start reconstruction with %i track(s) from Stack",iNtracks)); |
91 | ||
92 | Double_t hnvec[12]; | |
93 | ||
30c60010 | 94 | Double_t b=GetFieldMap()->SolenoidField()/10;// magnetic field in Tesla |
95 | AliDebug(1,Form("Start with simulated %i tracks in %f Tesla field",iNtracks,b)); | |
96 | TVector3 x0(0,0,0); TVector3 p0(0,0,0);//tmp storage for AliRICHHelix | |
97 | ||
98 | ||
1cb5a97c | 99 | if(pRich->GetLoader()->LoadRecPoints()) {AliDebug(1,Form("No clusters found in RICH"));return;} |
100 | pRich->GetLoader()->TreeR()->GetEntry(0); | |
101 | ||
30c60010 | 102 | for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//ESD tracks loop |
103 | TParticle *pParticle = pStack->Particle(iTrackN); | |
9f873529 | 104 | AliDebug(1,Form("Track %i is a %s with charge %i and momentum %f", |
105 | iTrackN,pParticle->GetPDG()->GetName(),Int_t(pParticle->GetPDG()->Charge()),pParticle->P())); | |
106 | // if(pParticle->GetMother(0)!=-1) continue; //consider only primaries | |
107 | if(pParticle->GetPDG()->Charge()==0||TMath::Abs(Int_t(pParticle->GetPDG()->Charge()))!=3) continue; //to avoid photons from stack... | |
1cb5a97c | 108 | hnvec[0]=pParticle->P(); |
109 | hnvec[1]=pParticle->GetPDG()->Charge(); | |
110 | hnvec[2]=pParticle->Theta(); | |
111 | hnvec[3]=pParticle->Phi(); | |
30c60010 | 112 | p0.SetMagThetaPhi(pParticle->P(),pParticle->Theta(),pParticle->Phi()); |
113 | x0.SetXYZ(pParticle->Vx(),pParticle->Vy(),pParticle->Vz()); | |
9f873529 | 114 | AliRICHHelix helix(x0,p0,TMath::Sign(1,(Int_t)pParticle->GetPDG()->Charge()),b); |
30c60010 | 115 | Int_t iChamber=helix.RichIntersect(pRich->P()); |
116 | AliDebug(1,Form("intersection with %i chamber found",iChamber)); | |
1cb5a97c | 117 | if(!iChamber) continue;// no intersection with RICH found |
118 | hnvec[4]=helix.PosPc().X(); | |
119 | hnvec[5]=helix.PosPc().Y(); | |
120 | Double_t distMip=9999; //min distance between clusters and track position on PC | |
121 | Double_t mipX=kBad; //min distance between clusters and track position on PC | |
122 | Double_t mipY=kBad; //min distance between clusters and track position on PC | |
123 | Double_t chargeMip=kBad; // charge MIP to find | |
124 | Int_t iMipId=kBad; //index of that min distance cluster | |
30c60010 | 125 | for(Int_t iClusN=0;iClusN<pRich->Clusters(iChamber)->GetEntries();iClusN++){//clusters loop for intersected chamber |
126 | AliRICHcluster *pClus=(AliRICHcluster*)pRich->Clusters(iChamber)->UncheckedAt(iClusN);//get pointer to current cluster | |
127 | Double_t distCurrent=pClus->DistTo(helix.PosPc());//ditance between current cluster and helix intersection with PC | |
1cb5a97c | 128 | if(distCurrent<distMip){distMip=distCurrent;mipX=pClus->X(); |
129 | mipY=pClus->Y(); | |
130 | chargeMip=pClus->Q();iMipId=1000000*iChamber+iClusN;}//find cluster nearest to the track | |
30c60010 | 131 | |
132 | AliDebug(1,Form("Ploc (%f,%f,%f) dist= %f",helix.Ploc().Mag(),helix.Ploc().Theta()*TMath::RadToDeg(), | |
133 | helix.Ploc().Phi()*TMath::RadToDeg(),pClus->DistTo(helix.PosPc()))); | |
134 | }////clusters loop for intersected chamber | |
135 | ||
136 | AliDebug(1,Form("Min distance cluster: %i dist is %f",iMipId,distMip)); | |
1cb5a97c | 137 | hnvec[6]=mipX;hnvec[7]=mipY; |
138 | hnvec[8]=chargeMip; | |
30c60010 | 139 | AliRICHRecon recon(&helix,pRich->Clusters(iChamber),iMipId); |
140 | Double_t thetaCerenkov=recon.ThetaCerenkov(); //search for mean Cerenkov angle for this track | |
1cb5a97c | 141 | hnvec[9]=thetaCerenkov; |
142 | hnvec[10]=recon.GetHoughPhotons(); | |
143 | hnvec[11]=(Double_t)iMipId; | |
144 | if(hn) hn->Fill(hnvec); | |
30c60010 | 145 | AliDebug(1,Form("FINAL Theta Cerenkov=%f",thetaCerenkov)); |
146 | // pTrack->SetRICHsignal(thetaCerenkov); | |
147 | ||
1cb5a97c | 148 | // Double_t richPID[5]={0.2,0.2,0.2,0.2,0.2}; //start with equal probs for (e,mu,pi,k,p) |
149 | // CalcProb(thetaCerenkov,p0.Mag(),richPID); | |
30c60010 | 150 | |
151 | }//ESD tracks loop | |
1cb5a97c | 152 | |
153 | pRich->GetLoader()->UnloadRecPoints(); | |
154 | ||
30c60010 | 155 | AliDebug(1,"Stop."); |
156 | } //RecWithStack | |
998b831f | 157 | |
158 | Int_t AliRICHTracker::LoadClusters(TTree *pTree) | |
159 | { | |
160 | // Load clusters for RICH | |
161 | AliDebug(1,"Start."); pTree->GetEntry(0); AliDebug(1,"Stop."); return 0; | |
162 | } | |
30c60010 | 163 | |
164 | //__________________________________________________________________________________________________ | |
165 | void AliRICHTracker::CalcProb(Double_t thetaCer,Double_t pmod, Double_t *richPID) | |
166 | { | |
167 | // | |
304864ab | 168 | Double_t height[AliPID::kSPECIES];Double_t totalHeight=0; |
169 | for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++){ | |
170 | Double_t mass = AliPID::ParticleMass(iPart); | |
30c60010 | 171 | Double_t refIndex=AliRICHParam::IndOfRefC6F14(6.755); |
172 | Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(refIndex*pmod); | |
173 | if(cosThetaTh>=1) {break;} | |
174 | Double_t thetaTh = TMath::ACos(cosThetaTh); | |
175 | Double_t sinThetaThNorm = TMath::Sin(thetaTh)/TMath::Sqrt(1-1/(refIndex*refIndex)); | |
176 | Double_t sigmaThetaTh = (0.014*(1/sinThetaThNorm-1) + 0.0043)*1.25; | |
177 | height[iPart] = TMath::Gaus(thetaCer,thetaTh,sigmaThetaTh); | |
178 | totalHeight +=height[iPart]; | |
179 | } | |
304864ab | 180 | for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++) richPID[iPart] = height[iPart]/totalHeight; |
30c60010 | 181 | }//CalcProb |