]>
Commit | Line | Data |
---|---|---|
db910db9 | 1 | #include "AliRICHTracker.h" //class header |
2 | #include "AliRICH.h" | |
3 | #include "AliRICHRecon.h" | |
998b831f | 4 | #include <AliESD.h> |
5 | #include <TVector3.h> | |
db910db9 | 6 | #include <TTree.h> //EsdPrint() |
7 | #include <TFile.h> //EsdPrint() | |
998b831f | 8 | #include "AliRICHHelix.h" |
9 | #include <AliMagF.h> | |
998b831f | 10 | #include <AliStack.h> |
11 | #include <TParticle.h> | |
30c60010 | 12 | #include <TMath.h> |
0fe8fa07 | 13 | #include <AliRun.h> |
db910db9 | 14 | #include <TNtupleD.h> //RecWithStack(); |
15 | #include <AliTrackPointArray.h> //GetTrackPoint() | |
16 | #include <AliAlignObj.h> //GetTrackPoint() | |
998b831f | 17 | ClassImp(AliRICHTracker) |
db910db9 | 18 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
19 | AliRICHTracker::AliRICHTracker():AliTracker() | |
998b831f | 20 | { |
db910db9 | 21 | // AliRICHTracker is created from AliReconstraction::Run() which invokes AliReconstraction::CreateTrackers() |
22 | // which in turn invokes AliRICHReconstructor::CreateTracker(). | |
23 | // Note that this is done just once per session before AliReconstruction::Run() goes to events loop. | |
24 | AliRICHParam::Instance()->CdbRead(0,0); | |
25 | for(Int_t i=0;i<5;i++)fErrPar[i]=0; | |
26 | } | |
27 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
28 | Bool_t AliRICHTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const | |
30c60010 | 29 | { |
db910db9 | 30 | // Interface callback methode invoked from AliReconstruction::WriteAlignmentData() to get position of MIP cluster in MARS associated to a current track. |
31 | // MIP cluster is reffered by index which is stored in AliESDtrack ??????? | |
32 | // Arguments: idx- cluster index which is stored by RICH in AliESDtrack | |
33 | // point- reference to the object where to store the point | |
34 | // Returns: status of operation if FALSE then AliReconstruction::WriteAlignmentData() do not store this point to array of points for current track. | |
35 | if(idx<0) return kFALSE; //no MIP cluster assigned to this track in PropagateBack() | |
36 | Int_t iCham=idx/1000000; | |
37 | Int_t iClu=idx%1000000; | |
38 | point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kRICH,iCham-1));//layer and chamber number | |
39 | AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); | |
40 | AliRICHCluster *pClu=(AliRICHCluster*)pRich->Clus(iCham)->UncheckedAt(iClu);//get pointer to cluster | |
41 | TVector3 mars=AliRICHParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y()); | |
42 | point.SetXYZ(mars.X(),mars.Y(),mars.Z()); | |
43 | return kTRUE; | |
44 | } | |
45 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
46 | Int_t AliRICHTracker::LoadClusters(TTree *pCluTree) | |
47 | { | |
48 | // Interface callback methode invoked from AliReconstruction::RunTracking() to load RICH clusters for RICH | |
49 | // Arguments: pCluTree- pointer to clusters tree got by AliRICHLoader::LoadRecPoints("read") then AliRICHLoader::TreeR() | |
50 | // Returns: error code (currently ignored in AliReconstruction::RunTraking()) | |
51 | AliDebug(1,"Start."); pCluTree->GetEntry(0); AliDebug(1,"Stop."); return 0; | |
52 | } | |
53 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
54 | Int_t AliRICHTracker::PropagateBack(AliESD *pESD) | |
55 | { | |
56 | // Interface callback methode invoked by AliRecontruction::RunTracking() during tracking after TOF. It's done just once per event | |
57 | // Arguments: pESD - pointer to Event Summary Data class instance which contains a list of tracks | |
58 | // Returns: error code, 0 if no errors | |
59 | Int_t iNtracks=pESD->GetNumberOfTracks(); | |
60 | AliDebug(1,Form("Start with %i tracks",iNtracks)); | |
61 | AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); | |
62 | AliRICHRecon recon; | |
63 | ||
64 | for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){//ESD tracks loop | |
65 | AliESDtrack *pTrack = pESD->GetTrack(iTrk);// get next reconstructed track | |
2a92c3fe | 66 | AliRICHHelix helix(pTrack->X3(),pTrack->P3(),(Int_t)pTrack->GetSign(),-GetBz()/10); //construct helix out of track running parameters |
67 | //Printf(" magnetic field %f charged %f\n",GetBz(),pTrack->GetSign()); helix.Print("Track"); | |
db910db9 | 68 | Int_t iChamber=helix.RichIntersect(AliRICHParam::Instance()); |
69 | if(!iChamber) continue; //no intersection with chambers, ignore this track go after the next one | |
70 | ||
71 | //find MIP cluster candidate (closest to track intersection point cluster with large enough QDC) | |
72 | Double_t dR=9999, dX=9999, dY=9999; //distance between track-PC intersection point and current cluster | |
73 | Double_t dRmip=9999,dXmip=9999,dYmip=9999; //distance between track-PC intersection point and nearest cluster | |
74 | Int_t iMipId=-1; //index of this nearest cluster | |
75 | for(Int_t iClu=0;iClu<pRich->Clus(iChamber)->GetEntries();iClu++){//clusters loop for intersected chamber | |
76 | AliRICHCluster *pClu=(AliRICHCluster*)pRich->Clus(iChamber)->UncheckedAt(iClu);//get pointer to current cluster | |
77 | if(pClu->Q()<AliRICHParam::QthMIP()) continue; //to low QDC, go after another one | |
78 | pClu->DistXY(helix.PosPc(),dX,dY); dR=TMath::Sqrt(dX*dX+dY*dY); //get distance for current cluster | |
79 | if(dR<dRmip){iMipId=iClu; dRmip=dR; dXmip=dX; dYmip=dY; } //current cluster is closer, overwrite data for min cluster | |
a25b3368 | 80 | }//clusters loop for intersected chamber |
01c81d9d | 81 | |
db910db9 | 82 | pTrack->SetRICHthetaPhi(helix.Ploc().Theta(),helix.Ploc().Phi()); //store track impact angles with respect to RICH planes |
83 | pTrack->SetRICHdxdy(dXmip,dYmip); //distance between track-PC intersection and closest cluster with Qdc>100 | |
d3eb6079 | 84 | |
db910db9 | 85 | if(iMipId==-1) {pTrack->SetRICHsignal(kMipQdcCut); continue;} //no cluster with enough QDC found |
86 | if(dRmip>AliRICHParam::DmatchMIP()) {pTrack->SetRICHsignal(kMipDistCut); continue;} //closest cluster with enough carge is still too far | |
87 | ||
88 | pTrack->SetRICHcluster(iMipId+1000000*iChamber); //set mip cluster index | |
89 | pTrack->SetRICHsignal(recon.ThetaCerenkov(&helix,pRich->Clus(iChamber),iMipId));//search for mean Cerenkov angle for this track | |
90 | pTrack->SetRICHnclusters(iMipId); //on return iMipId is number of photon clusters accepted in reconstruction | |
fab9e039 | 91 | |
db910db9 | 92 | AliDebug(1,Form("Ch=%i PC Intersection=(%5.2f,%5.2f) cm MIP cluster dist=(%5.2f,%5.2f)=%5.2f cm ThetaCkov=%f", |
93 | iChamber,helix.PosPc().X(),helix.PosPc().Y(), dXmip,dYmip,dRmip, pTrack->GetRICHsignal())); | |
94 | ||
95 | //here comes PID calculations | |
101624cd | 96 | if(pTrack->GetRICHsignal()>0) { |
97 | AliDebug(1,Form("Start to assign the probabilities")); | |
98 | Double_t sigmaPID[AliPID::kSPECIES]; | |
99 | Double_t richPID[AliPID::kSPECIES]; | |
100 | for (Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++) { | |
101 | sigmaPID[iPart] = 0; | |
068217e3 | 102 | fErrPar[iPart] = 0; |
db910db9 | 103 | for(Int_t iphot=0;iphot<pRich->Clus(iChamber)->GetEntries();iphot++) { |
101624cd | 104 | recon.SetPhotonIndex(iphot); |
105 | if(recon.GetPhotonFlag() == 2) { | |
fab9e039 | 106 | Double_t theta_g=recon.GetTrackTheta(); |
107 | Double_t phi_g=(recon.GetPhiPoint()-recon.GetTrackPhi()); | |
db910db9 | 108 | Double_t sigma2 = AliRICHParam::Instance()->SigmaSinglePhoton(iPart,pTrack->GetP(),theta_g,phi_g).Mag2(); |
01c81d9d | 109 | if(sigma2>0) sigmaPID[iPart] += 1/sigma2; |
101624cd | 110 | } |
111 | } | |
db910db9 | 112 | if (sigmaPID[iPart]>0) |
113 | sigmaPID[iPart] *= (Double_t)(iMipId-recon.GetPhotBKG())/(Double_t)(iMipId); // n total phots, m are background...the sigma are scaled.. | |
114 | if(sigmaPID[iPart]>0) sigmaPID[iPart] = 1/TMath::Sqrt(sigmaPID[iPart])*0.001; // sigma from parametrization are in mrad... | |
01c81d9d | 115 | else sigmaPID[iPart] = 0; |
116 | fErrPar[iPart]=sigmaPID[iPart]; | |
101624cd | 117 | AliDebug(1,Form("sigma for %s is %f rad",AliPID::ParticleName(iPart),sigmaPID[iPart])); |
118 | } | |
db910db9 | 119 | CalcProb(pTrack->GetRICHsignal(),pTrack->GetP(),sigmaPID,richPID); |
101624cd | 120 | pTrack->SetRICHpid(richPID); |
121 | AliDebug(1,Form("PROBABILITIES ---> %f - %f - %f - %f - %f",richPID[0],richPID[1],richPID[2],richPID[3],richPID[4])); | |
910735ae | 122 | } |
db910db9 | 123 | }//ESD tracks loop |
124 | AliDebug(1,"Stop pattern recognition"); | |
125 | return 0; // error code: 0=no error; | |
126 | }//PropagateBack() | |
127 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
1cb5a97c | 128 | void AliRICHTracker::RecWithStack(TNtupleD *hn) |
30c60010 | 129 | { |
db910db9 | 130 | // Reconstruction for particles from STACK. This methode is to be used for RICH standalone when no other detectors are switched on, so normal tracking is not available. |
131 | // Arguments: hn- output ntuple where to store all variables | |
132 | // Returns: none | |
d3eb6079 | 133 | AliDebug(1,"Start."); |
30c60010 | 134 | AliRICH *pRich=((AliRICH*)gAlice->GetDetector("RICH")); |
135 | ||
1cb5a97c | 136 | // pRich->GetLoader()->GetRunLoader()->LoadHeader(); |
d3eb6079 | 137 | if(!pRich->GetLoader()->GetRunLoader()->TreeK()) pRich->GetLoader()->GetRunLoader()->LoadKinematics(); |
30c60010 | 138 | AliStack *pStack = pRich->GetLoader()->GetRunLoader()->Stack(); |
39853df5 | 139 | if(!pStack) {AliDebug(1,Form("No STACK found in AliRoot"));return;} |
30c60010 | 140 | Int_t iNtracks=pStack->GetNtrack(); |
1cb5a97c | 141 | AliDebug(1,Form(" Start reconstruction with %i track(s) from Stack",iNtracks)); |
142 | ||
ab92fbe6 | 143 | Double_t hnvec[20]; |
1cb5a97c | 144 | |
30c60010 | 145 | Double_t b=GetFieldMap()->SolenoidField()/10;// magnetic field in Tesla |
146 | AliDebug(1,Form("Start with simulated %i tracks in %f Tesla field",iNtracks,b)); | |
147 | TVector3 x0(0,0,0); TVector3 p0(0,0,0);//tmp storage for AliRICHHelix | |
148 | ||
149 | ||
1cb5a97c | 150 | if(pRich->GetLoader()->LoadRecPoints()) {AliDebug(1,Form("No clusters found in RICH"));return;} |
151 | pRich->GetLoader()->TreeR()->GetEntry(0); | |
152 | ||
db910db9 | 153 | AliRICHRecon recon; |
a25b3368 | 154 | for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//stack particles loop |
30c60010 | 155 | TParticle *pParticle = pStack->Particle(iTrackN); |
39853df5 | 156 | if(!pParticle) {AliDebug(1,Form("Not a valid TParticle pointer. Track skipped"));continue;} |
157 | AliDebug(1,Form(" PDG code : %i",pParticle->GetPdgCode())); | |
ab92fbe6 | 158 | // |
159 | // problem of PDG code of some extra particles to be solved!!!!!!!!! | |
160 | // | |
161 | // found problem! Look in TRD directory : codes from Fluka are : | |
162 | // | |
163 | // if ((pdg_code == 10010020) || | |
164 | // (pdg_code == 10010030) || | |
165 | // (pdg_code == 50000050) || | |
166 | // (pdg_code == 50000051) || | |
167 | // (pdg_code == 10020040)) { | |
168 | // | |
169 | if(pParticle->GetPdgCode()>=50000050||pParticle->GetPdgCode()==0||pParticle->GetPdgCode()>10000) {AliDebug(1,Form("A photon as track... Track skipped"));continue;} | |
1e066c96 | 170 | if(!pParticle->GetPDG()) continue; |
ab92fbe6 | 171 | // |
172 | // to be updated for us!! | |
173 | // | |
9f873529 | 174 | AliDebug(1,Form("Track %i is a %s with charge %i and momentum %f", |
175 | iTrackN,pParticle->GetPDG()->GetName(),Int_t(pParticle->GetPDG()->Charge()),pParticle->P())); | |
176 | // if(pParticle->GetMother(0)!=-1) continue; //consider only primaries | |
177 | if(pParticle->GetPDG()->Charge()==0||TMath::Abs(Int_t(pParticle->GetPDG()->Charge()))!=3) continue; //to avoid photons from stack... | |
1cb5a97c | 178 | hnvec[0]=pParticle->P(); |
179 | hnvec[1]=pParticle->GetPDG()->Charge(); | |
db910db9 | 180 | |
181 | p0.SetMagThetaPhi(pParticle->P(),pParticle->Theta(),pParticle->Phi()); x0.SetXYZ(pParticle->Vx(),pParticle->Vy(),pParticle->Vz()); | |
9f873529 | 182 | AliRICHHelix helix(x0,p0,TMath::Sign(1,(Int_t)pParticle->GetPDG()->Charge()),b); |
db910db9 | 183 | Int_t iChamber=helix.RichIntersect(AliRICHParam::Instance()); |
184 | if(!iChamber) continue;// no intersection with RICH found | |
185 | ||
ef210ba6 | 186 | hnvec[2]=helix.Ploc().Theta(); |
187 | hnvec[3]=helix.Ploc().Phi(); | |
1cb5a97c | 188 | hnvec[4]=helix.PosPc().X(); |
189 | hnvec[5]=helix.PosPc().Y(); | |
db910db9 | 190 | |
191 | Double_t dX,dY,dR,dRmip=9999; //min distance between clusters and track position on PC | |
0fe8fa07 | 192 | Int_t iMipId=-1; //index of that min distance cluster |
db910db9 | 193 | for(Int_t iClu=0;iClu<pRich->Clus(iChamber)->GetEntries();iClu++){//clusters loop for intersected chamber |
194 | AliRICHCluster *pClu=(AliRICHCluster*)pRich->Clus(iChamber)->UncheckedAt(iClu);//get pointer to current cluster | |
195 | pClu->DistXY(helix.PosPc(),dX,dY); dR=TMath::Sqrt(dX*dX+dY*dY);//ditance between current cluster and helix intersection with PC | |
196 | if(dR<dRmip){dRmip=dR; hnvec[6]=pClu->X();hnvec[7]=pClu->Y();hnvec[8]=pClu->Q(); | |
197 | iMipId=1000000*iChamber+iClu;}//find cluster nearest to the track | |
30c60010 | 198 | |
a25b3368 | 199 | }//clusters loop for intersected chamber |
30c60010 | 200 | |
db910db9 | 201 | |
202 | hnvec[9]=recon.ThetaCerenkov(&helix,pRich->Clus(iChamber),iMipId); //search for mean Cerenkov angle for this track | |
203 | hnvec[10]=iMipId;//on return from ThetaCerenkov() contains number of photon candidates accepted | |
1cb5a97c | 204 | hnvec[11]=(Double_t)iMipId; |
ab92fbe6 | 205 | hnvec[12]=(Double_t)iChamber; |
206 | hnvec[13]=(Double_t)pParticle->GetPdgCode(); | |
1cb5a97c | 207 | if(hn) hn->Fill(hnvec); |
db910db9 | 208 | AliDebug(1,Form("FINAL Theta Cerenkov=%f",hnvec[9])); |
a25b3368 | 209 | }//stack particles loop |
1cb5a97c | 210 | |
39853df5 | 211 | pRich->GetLoader()->UnloadRecPoints(); |
30c60010 | 212 | AliDebug(1,"Stop."); |
a25b3368 | 213 | }//RecWithStack |
db910db9 | 214 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
101624cd | 215 | void AliRICHTracker::CalcProb(Double_t thetaCer,Double_t pmod, Double_t *sigmaPID, Double_t *richPID) |
30c60010 | 216 | { |
12b0e5f4 | 217 | // Calculates probability to be a electron-muon-pion-kaon-proton |
a25b3368 | 218 | // from the given Cerenkov angle and momentum assuming no initial particle composition |
12b0e5f4 | 219 | // (i.e. apriory probability to be the particle of the given sort is the same for all sorts) |
304864ab | 220 | Double_t height[AliPID::kSPECIES];Double_t totalHeight=0; |
101624cd | 221 | Double_t thetaTh[AliPID::kSPECIES]; |
304864ab | 222 | for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++){ |
101624cd | 223 | height[iPart]=0; |
068217e3 | 224 | Double_t mass = AliRICHParam::fgMass[iPart]; |
db910db9 | 225 | Double_t refIndex=AliRICHParam::Instance()->IdxC6F14(AliRICHParam::EckovMean()); |
30c60010 | 226 | Double_t cosThetaTh = TMath::Sqrt(mass*mass+pmod*pmod)/(refIndex*pmod); |
101624cd | 227 | thetaTh[iPart]=0; |
228 | if(cosThetaTh>=1) continue; | |
229 | thetaTh[iPart] = TMath::ACos(cosThetaTh); | |
230 | // Double_t sinThetaThNorm = TMath::Sin(thetaTh)/TMath::Sqrt(1-1/(refIndex*refIndex)); | |
231 | // Double_t sigmaThetaTh = (0.014*(1/sinThetaThNorm-1) + 0.0043)*1.25; | |
232 | // height[iPart] = TMath::Gaus(thetaCer,thetaTh,sigmaThetaTh); | |
01c81d9d | 233 | if(sigmaPID[iPart]>0) height[iPart] = TMath::Gaus(thetaCer,thetaTh[iPart],sigmaPID[iPart],kTRUE); |
234 | else height[iPart] = 0; | |
30c60010 | 235 | totalHeight +=height[iPart]; |
db910db9 | 236 | AliDebugClass(1,Form(" Particle %s with mass %f with height %f and thetaTH %f",AliPID::ParticleName(iPart),mass,height[iPart],thetaTh[iPart])); |
237 | AliDebugClass(1,Form(" partial height %15.14f total height %15.14f",height[iPart],totalHeight)); | |
30c60010 | 238 | } |
12b0e5f4 | 239 | if(totalHeight<1e-5) {for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++)richPID[iPart]=1.0/AliPID::kSPECIES;return;} |
101624cd | 240 | for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++) richPID[iPart] = height[iPart]/totalHeight; |
241 | Int_t iPartNear = TMath::LocMax(AliPID::kSPECIES,richPID); | |
01c81d9d | 242 | if(TMath::Abs(thetaCer-thetaTh[iPartNear])>5.*sigmaPID[iPartNear]) for(Int_t iPart=0;iPart<AliPID::kSPECIES;iPart++)richPID[iPart]=1.0/AliPID::kSPECIES; |
07625543 | 243 | //last line is to check if the nearest thetacerenkov to the teorethical one is within 5 sigma, otherwise no response (equal prob to every particle |
101624cd | 244 | |
30c60010 | 245 | }//CalcProb |
db910db9 | 246 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
247 | void AliRICHTracker::EsdPrint() | |
248 | { | |
2a92c3fe | 249 | // Reads a set of ESD files and print out some information |
250 | // Arguments: probCut - cut on probability | |
251 | // Returns: none | |
252 | ||
253 | TFile *pFile=TFile::Open("AliESDs.root","read"); if(!pFile) {Printf("ERROR: AliESDs.root does not exist!");return;} | |
254 | TTree *pTr=(TTree*)pFile->Get("esdTree"); if(!pTr) {Printf("ERROR: AliESDs.root, no ESD tree inside!");return;} | |
255 | AliESD *pEsd=new AliESD; pTr->SetBranchAddress("ESD", &pEsd); | |
db910db9 | 256 | |
2a92c3fe | 257 | Int_t iNevt=pTr->GetEntries(); Printf("This ESD contains %i events",iNevt); |
db910db9 | 258 | for(Int_t iEvt=0;iEvt<iNevt;iEvt++){//ESD events loop |
2a92c3fe | 259 | pTr->GetEvent(iEvt); |
260 | Int_t iNtracks=pEsd->GetNumberOfTracks(); Printf("ESD contains %i tracks created in Bz=%.2f Tesla",iNtracks,pEsd->GetMagneticField()/10.); | |
db910db9 | 261 | for(Int_t iTrk=0;iTrk<iNtracks;iTrk++){//ESD tracks loop |
2a92c3fe | 262 | AliESDtrack *pTrack = pEsd->GetTrack(iTrk);// get next reconstructed track |
db910db9 | 263 | Double_t dx,dy; pTrack->GetRICHdxdy(dx,dy); |
264 | Double_t theta,phi; pTrack->GetRICHthetaPhi(theta,phi); | |
265 | Printf("Track %2i Q=%4.1f P=%.3f GeV RICH: ChamberCluster %7i Track-Mip=(%7.2f,%7.2f)=%5.2f cm ThetaCer %7.1f rad",iTrk,pTrack->GetSign(),pTrack->GetP(), | |
266 | pTrack->GetRICHcluster(),dx,dy,TMath::Sqrt(dx*dx+dy*dy),pTrack->GetRICHsignal()); | |
267 | }//ESD tracks loop | |
268 | }//ESD events loop | |
2a92c3fe | 269 | delete pEsd; pFile->Close();//close AliESDs.root |
270 | } | |
271 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
272 | void AliRICHTracker::MatrixPrint(Double_t probCut) | |
273 | { | |
274 | // Reads a set of 3 ESD files from current directory and prints out the matrix of probabilities to pion kaon or proton completely blindly withou nay assumption on the contents of files. | |
275 | // Normally it implies that those 3 ESDs contain only particles of the same sort namly pions, kaons and protons in that order. | |
276 | // Arguments: probCut - cut on probability | |
277 | // Returns: none | |
278 | for(Int_t iFile=0;iFile<3;iFile++){ | |
279 | TFile *pFile=TFile::Open(Form("Esd%1i.root",iFile+1),"read"); if(!pFile) {Printf("ERROR: Esd%1i.root does not exist!",iFile+1);return;} | |
280 | TTree *pTr=(TTree*)pFile->Get("esdTree"); if(!pTr) {Printf("ERROR: Esd%1i.root, no ESD tree inside!",iFile+1);return;} | |
281 | AliESD *pEsd=new AliESD; pTr->SetBranchAddress("ESD", &pEsd); | |
282 | Int_t iProtCnt=0,iKaonCnt=0,iPionCnt=0,iUnreconCnt=0,iTrkCnt=0; //counters | |
283 | ||
284 | for(Int_t iEvt=0;iEvt<pTr->GetEntries();iEvt++){//ESD events loop | |
285 | pTr->GetEvent(iEvt); | |
286 | iTrkCnt+=pEsd->GetNumberOfTracks(); | |
287 | for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//ESD tracks loop | |
288 | AliESDtrack *pTrack = pEsd->GetTrack(iTrk);// get next reconstructed track | |
289 | Double_t dx,dy; pTrack->GetRICHdxdy(dx,dy); | |
290 | Double_t theta,phi; pTrack->GetRICHthetaPhi(theta,phi); | |
291 | Double_t prob[5]; pTrack->GetRICHpid(prob); | |
292 | if(pTrack->GetRICHsignal()>0){ | |
293 | if(prob[4]>probCut) iProtCnt++; | |
294 | if(prob[3]>probCut) iKaonCnt++; | |
295 | if((prob[0]+prob[1]+prob[2])>probCut) iPionCnt++; | |
296 | } else | |
297 | iUnreconCnt++; | |
298 | }//ESD tracks loop | |
299 | ||
300 | }//ESD events loop | |
301 | Printf("Bz=%5.2f Events=%i Total tracks=%i No recognized tracks=%i Pion=%i Kaon=%i Proton=%i ProbCut=%.2f", | |
302 | 0.1*pEsd->GetMagneticField(),pTr->GetEntries(),iTrkCnt,iUnreconCnt,iPionCnt,iKaonCnt,iProtCnt,probCut); | |
303 | delete pEsd; pFile->Close();//close AliESDs.root | |
304 | }//files loop | |
db910db9 | 305 | } |
306 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |