]>
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 | { | |
a25b3368 | 16 | // Interface callback methode invoked by AliRecontruction during tracking after TOF |
17 | // It steers to different way to provide the final reconstructed information sutable for analisys: | |
18 | // 1. AliESD - reconstructed tracks are used | |
19 | // 2. RICH private ntuple for debug- stack particles used instead of reconstructed tracks | |
30c60010 | 20 | AliDebug(1,"Start pattern recognition"); |
a25b3368 | 21 | if(pESD->GetNumberOfTracks()) |
22 | RecWithESD(pESD); | |
30c60010 | 23 | else |
a25b3368 | 24 | RecWithStack(0); |
30c60010 | 25 | AliDebug(1,"Stop pattern recognition"); |
30c60010 | 26 | return 0; // error code: 0=no error; |
a25b3368 | 27 | }//PropagateBack() |
30c60010 | 28 | //__________________________________________________________________________________________________ |
29 | void AliRICHTracker::RecWithESD(AliESD *pESD) | |
30 | { | |
d3eb6079 | 31 | //recontruction from ESD- primary way to reconstruct particle ID signal from tracks provided by core detectors |
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)); | |
998b831f | 36 | |
37 | AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); | |
38 | ||
998b831f | 39 | for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//ESD tracks loop |
40 | AliESDtrack *pTrack = pESD->GetTrack(iTrackN);// get next reconstructed track | |
41 | // if((pTrack->GetStatus()&AliESDtrack::kTOFout)==0) continue; //ignore tracks not recontructed by TOF | |
d3eb6079 | 42 | // pTrack->GetXYZ(xb); |
43 | // pTrack->GetPxPyPz(pb); | |
1cb5a97c | 44 | Int_t status=pTrack->GetStatus()&AliESDtrack::kTOFout;//get running track parameters |
7df3c0b6 | 45 | Int_t charge = (Int_t)(-TMath::Sign(1.,pTrack->GetSign()*b)); |
39853df5 | 46 | AliDebug(1,Form("Track %i pmod=%f charge=%i stat=%i",iTrackN,pTrack->GetP(),charge,status)); |
d3eb6079 | 47 | AliRICHHelix helix(pTrack->X3(),pTrack->P3(),charge,b); |
998b831f | 48 | Int_t iChamber=helix.RichIntersect(pRich->P()); |
49 | AliDebug(1,Form("intersection with %i chamber found",iChamber)); | |
50 | if(!iChamber) continue;//intersection with no chamber found | |
d3eb6079 | 51 | //find MIP cluster candidate (closest to track intersection point cluster) |
52 | Double_t distMip=9999,distX=0,distY=0; //min distance between clusters and track position on PC | |
998b831f | 53 | Int_t iMipId=0; //index of that min distance cluster |
54 | for(Int_t iClusN=0;iClusN<pRich->Clusters(iChamber)->GetEntries();iClusN++){//clusters loop for intersected chamber | |
55 | AliRICHcluster *pClus=(AliRICHcluster*)pRich->Clusters(iChamber)->UncheckedAt(iClusN);//get pointer to current cluster | |
d3eb6079 | 56 | Double_t distCurrent=pClus->DistTo(helix.PosPc());//distance between current cluster and helix intersection with PC |
a25b3368 | 57 | if(distCurrent<distMip){ |
58 | distMip=distCurrent; | |
59 | iMipId=iClusN; | |
d3eb6079 | 60 | distX=pClus->DistX(helix.PosPc()); |
61 | distY=pClus->DistY(helix.PosPc()); | |
a25b3368 | 62 | }//find cluster nearest to the track |
998b831f | 63 | AliDebug(1,Form("Ploc (%f,%f,%f) dist= %f",helix.Ploc().Mag(),helix.Ploc().Theta()*TMath::RadToDeg(), |
a25b3368 | 64 | helix.Ploc().Phi()*TMath::RadToDeg(),pClus->DistTo(helix.PosPc()))); |
65 | }//clusters loop for intersected chamber | |
998b831f | 66 | |
67 | AliDebug(1,Form("Min distance cluster: %i dist is %f",iMipId,distMip)); | |
68 | ||
d3eb6079 | 69 | AliRICHRecon recon(&helix,pRich->Clusters(iChamber),iMipId); //actual job is done there |
70 | ||
71 | pTrack->SetRICHcluster(iMipId); | |
72 | pTrack->SetRICHdxdy(distX,distY); | |
73 | pTrack->SetRICHthetaPhi(helix.Ploc().Theta(),helix.Ploc().Phi()); | |
74 | pTrack->SetRICHsignal(recon.ThetaCerenkov()); | |
75 | pTrack->SetRICHnclusters(recon.GetHoughPhotons()); | |
76 | ||
77 | AliDebug(1,Form("FINAL Theta Cerenkov=%f",pTrack->GetRICHsignal())); | |
998b831f | 78 | |
1cb5a97c | 79 | // Double_t richPID[5]={0.2,0.2,0.2,0.2,0.2}; //start with equal probs for (e,mu,pi,k,p) |
80 | // CalcProb(thetaCerenkov,p0.Mag(),richPID); | |
81 | // pTrack->SetRICHpid(richPID); | |
998b831f | 82 | |
83 | }//ESD tracks loop | |
84 | AliDebug(1,"Stop."); | |
30c60010 | 85 | } //RecWithESD |
86 | //__________________________________________________________________________________________________ | |
1cb5a97c | 87 | void AliRICHTracker::RecWithStack(TNtupleD *hn) |
30c60010 | 88 | { |
d3eb6079 | 89 | //Reconstruction for particles from STACK. This methode is to be used for RICH standalone when no other detectors are switched on, |
90 | //so normal tracking is not available | |
91 | AliDebug(1,"Start."); | |
30c60010 | 92 | AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); |
93 | ||
1cb5a97c | 94 | // pRich->GetLoader()->GetRunLoader()->LoadHeader(); |
d3eb6079 | 95 | if(!pRich->GetLoader()->GetRunLoader()->TreeK()) pRich->GetLoader()->GetRunLoader()->LoadKinematics(); |
30c60010 | 96 | AliStack *pStack = pRich->GetLoader()->GetRunLoader()->Stack(); |
39853df5 | 97 | if(!pStack) {AliDebug(1,Form("No STACK found in AliRoot"));return;} |
30c60010 | 98 | Int_t iNtracks=pStack->GetNtrack(); |
1cb5a97c | 99 | AliDebug(1,Form(" Start reconstruction with %i track(s) from Stack",iNtracks)); |
100 | ||
ab92fbe6 | 101 | Double_t hnvec[20]; |
1cb5a97c | 102 | |
30c60010 | 103 | Double_t b=GetFieldMap()->SolenoidField()/10;// magnetic field in Tesla |
104 | AliDebug(1,Form("Start with simulated %i tracks in %f Tesla field",iNtracks,b)); | |
105 | TVector3 x0(0,0,0); TVector3 p0(0,0,0);//tmp storage for AliRICHHelix | |
106 | ||
107 | ||
1cb5a97c | 108 | if(pRich->GetLoader()->LoadRecPoints()) {AliDebug(1,Form("No clusters found in RICH"));return;} |
109 | pRich->GetLoader()->TreeR()->GetEntry(0); | |
110 | ||
a25b3368 | 111 | for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//stack particles loop |
30c60010 | 112 | TParticle *pParticle = pStack->Particle(iTrackN); |
39853df5 | 113 | if(!pParticle) {AliDebug(1,Form("Not a valid TParticle pointer. Track skipped"));continue;} |
114 | AliDebug(1,Form(" PDG code : %i",pParticle->GetPdgCode())); | |
ab92fbe6 | 115 | // |
116 | // problem of PDG code of some extra particles to be solved!!!!!!!!! | |
117 | // | |
118 | // found problem! Look in TRD directory : codes from Fluka are : | |
119 | // | |
120 | // if ((pdg_code == 10010020) || | |
121 | // (pdg_code == 10010030) || | |
122 | // (pdg_code == 50000050) || | |
123 | // (pdg_code == 50000051) || | |
124 | // (pdg_code == 10020040)) { | |
125 | // | |
126 | if(pParticle->GetPdgCode()>=50000050||pParticle->GetPdgCode()==0||pParticle->GetPdgCode()>10000) {AliDebug(1,Form("A photon as track... Track skipped"));continue;} | |
127 | // | |
128 | // to be updated for us!! | |
129 | // | |
9f873529 | 130 | AliDebug(1,Form("Track %i is a %s with charge %i and momentum %f", |
131 | iTrackN,pParticle->GetPDG()->GetName(),Int_t(pParticle->GetPDG()->Charge()),pParticle->P())); | |
132 | // if(pParticle->GetMother(0)!=-1) continue; //consider only primaries | |
133 | if(pParticle->GetPDG()->Charge()==0||TMath::Abs(Int_t(pParticle->GetPDG()->Charge()))!=3) continue; //to avoid photons from stack... | |
1cb5a97c | 134 | hnvec[0]=pParticle->P(); |
135 | hnvec[1]=pParticle->GetPDG()->Charge(); | |
136 | hnvec[2]=pParticle->Theta(); | |
137 | hnvec[3]=pParticle->Phi(); | |
30c60010 | 138 | p0.SetMagThetaPhi(pParticle->P(),pParticle->Theta(),pParticle->Phi()); |
139 | x0.SetXYZ(pParticle->Vx(),pParticle->Vy(),pParticle->Vz()); | |
9f873529 | 140 | AliRICHHelix helix(x0,p0,TMath::Sign(1,(Int_t)pParticle->GetPDG()->Charge()),b); |
30c60010 | 141 | Int_t iChamber=helix.RichIntersect(pRich->P()); |
142 | AliDebug(1,Form("intersection with %i chamber found",iChamber)); | |
1cb5a97c | 143 | if(!iChamber) continue;// no intersection with RICH found |
144 | hnvec[4]=helix.PosPc().X(); | |
145 | hnvec[5]=helix.PosPc().Y(); | |
146 | Double_t distMip=9999; //min distance between clusters and track position on PC | |
147 | Double_t mipX=kBad; //min distance between clusters and track position on PC | |
148 | Double_t mipY=kBad; //min distance between clusters and track position on PC | |
149 | Double_t chargeMip=kBad; // charge MIP to find | |
150 | Int_t iMipId=kBad; //index of that min distance cluster | |
30c60010 | 151 | for(Int_t iClusN=0;iClusN<pRich->Clusters(iChamber)->GetEntries();iClusN++){//clusters loop for intersected chamber |
152 | AliRICHcluster *pClus=(AliRICHcluster*)pRich->Clusters(iChamber)->UncheckedAt(iClusN);//get pointer to current cluster | |
153 | Double_t distCurrent=pClus->DistTo(helix.PosPc());//ditance between current cluster and helix intersection with PC | |
1cb5a97c | 154 | if(distCurrent<distMip){distMip=distCurrent;mipX=pClus->X(); |
155 | mipY=pClus->Y(); | |
156 | chargeMip=pClus->Q();iMipId=1000000*iChamber+iClusN;}//find cluster nearest to the track | |
30c60010 | 157 | |
158 | AliDebug(1,Form("Ploc (%f,%f,%f) dist= %f",helix.Ploc().Mag(),helix.Ploc().Theta()*TMath::RadToDeg(), | |
159 | helix.Ploc().Phi()*TMath::RadToDeg(),pClus->DistTo(helix.PosPc()))); | |
a25b3368 | 160 | }//clusters loop for intersected chamber |
30c60010 | 161 | |
162 | AliDebug(1,Form("Min distance cluster: %i dist is %f",iMipId,distMip)); | |
1cb5a97c | 163 | hnvec[6]=mipX;hnvec[7]=mipY; |
164 | hnvec[8]=chargeMip; | |
30c60010 | 165 | AliRICHRecon recon(&helix,pRich->Clusters(iChamber),iMipId); |
166 | Double_t thetaCerenkov=recon.ThetaCerenkov(); //search for mean Cerenkov angle for this track | |
1cb5a97c | 167 | hnvec[9]=thetaCerenkov; |
168 | hnvec[10]=recon.GetHoughPhotons(); | |
169 | hnvec[11]=(Double_t)iMipId; | |
ab92fbe6 | 170 | hnvec[12]=(Double_t)iChamber; |
171 | hnvec[13]=(Double_t)pParticle->GetPdgCode(); | |
1cb5a97c | 172 | if(hn) hn->Fill(hnvec); |
30c60010 | 173 | AliDebug(1,Form("FINAL Theta Cerenkov=%f",thetaCerenkov)); |
a25b3368 | 174 | }//stack particles loop |
1cb5a97c | 175 | |
39853df5 | 176 | pRich->GetLoader()->UnloadRecPoints(); |
30c60010 | 177 | AliDebug(1,"Stop."); |
a25b3368 | 178 | }//RecWithStack |
179 | //__________________________________________________________________________________________________ | |
998b831f | 180 | Int_t AliRICHTracker::LoadClusters(TTree *pTree) |
181 | { | |
182 | // Load clusters for RICH | |
183 | AliDebug(1,"Start."); pTree->GetEntry(0); AliDebug(1,"Stop."); return 0; | |
184 | } | |
30c60010 | 185 | //__________________________________________________________________________________________________ |
186 | void AliRICHTracker::CalcProb(Double_t thetaCer,Double_t pmod, Double_t *richPID) | |
187 | { | |
a25b3368 | 188 | // Calculates probability to be a electron-muon-pion-kaon-proton |
189 | // from the given Cerenkov angle and momentum assuming no initial particle composition | |
190 | // (i.e. apriory probability to be the particle of the given sort is the same for all sorts) | |
304864ab | 191 | Double_t height[AliPID::kSPECIES];Double_t totalHeight=0; |
192 | for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++){ | |
193 | Double_t mass = AliPID::ParticleMass(iPart); | |
a25b3368 | 194 | Double_t refIndex=AliRICHParam::RefIdxC6F14(6.755); |
30c60010 | 195 | Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(refIndex*pmod); |
196 | if(cosThetaTh>=1) {break;} | |
197 | Double_t thetaTh = TMath::ACos(cosThetaTh); | |
198 | Double_t sinThetaThNorm = TMath::Sin(thetaTh)/TMath::Sqrt(1-1/(refIndex*refIndex)); | |
199 | Double_t sigmaThetaTh = (0.014*(1/sinThetaThNorm-1) + 0.0043)*1.25; | |
200 | height[iPart] = TMath::Gaus(thetaCer,thetaTh,sigmaThetaTh); | |
201 | totalHeight +=height[iPart]; | |
202 | } | |
304864ab | 203 | for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++) richPID[iPart] = height[iPart]/totalHeight; |
30c60010 | 204 | }//CalcProb |
a25b3368 | 205 | //__________________________________________________________________________________________________ |