10 #include <AliExternalTrackParam.h>
11 #include <AliAODEvent.h>
12 #include <AliESDEvent.h>
16 #include <AliCFContainer.h>
17 #include <AliCFEffGrid.h>
18 #include <AliCFDataGrid.h>
19 //#include <AliESDVertex.h>
23 #include "AliProtonFeedDownAnalysis.h"
24 #include "AliProtonAnalysisBase.h"
26 ClassImp(AliProtonFeedDownAnalysis)
28 //____________________________________________________________________//
29 AliProtonFeedDownAnalysis::AliProtonFeedDownAnalysis() :
30 TObject(), fProtonAnalysisBase(0),
31 fNBinsY(0), fMinY(0), fMaxY(0),
32 fNBinsPt(0), fMinPt(0), fMaxPt(0),
33 fProtonContainer(0), fAntiProtonContainer(0), fweightfunction(0),fLambda(0),fLambdaweighted(0),fAntiLambda(0),fAntiLambdaweighted(0)
37 //____________________________________________________________________//
38 /*AliProtonFeedDownAnalysis::AliProtonFeedDownAnalysis(Int_t nbinsY, Float_t fLowY, Float_t fHighY,Int_t nbinsPt, Float_t fLowPt, Float_t fHighPt) :
39 TObject(), fProtonAnalysisBase(0),
40 fNBinsY(nbinsY), fMinY(fLowY), fMaxY(fHighY),
41 fNBinsPt(nbinsPt), fMinPt(fLowPt), fMaxPt(fHighPt),
42 fProtonContainer(0), fAntiProtonContainer(0),fweightfunction(0),fLambda(0),fLambdaweighted(0),fAntiLambda(0),fAntiLambdaweighted(0)
46 //setting up the containers
50 Double_t *binLimY = new Double_t[nbinsY+1];
51 Double_t *binLimPt = new Double_t[nbinsPt+1];
52 //values for bin lower bounds
53 for(Int_t i = 0; i <= nbinsY; i++)
54 binLimY[i]=(Double_t)fLowY + (fHighY - fLowY) /nbinsY*(Double_t)i;
55 for(Int_t i = 0; i <= nbinsPt; i++)
56 binLimPt[i]=(Double_t)fLowPt + (fHighPt - fLowPt) /nbinsPt*(Double_t)i;
58 fProtonContainer = new AliCFContainer("containerProtons","container for protons",4,2,iBin);
59 fProtonContainer->SetBinLimits(0,binLimY); //rapidity or eta
60 fProtonContainer->SetBinLimits(1,binLimPt); //pT
61 fAntiProtonContainer = new AliCFContainer("containerAntiProtons","container for antiprotons",4,2,iBin);
62 fAntiProtonContainer->SetBinLimits(0,binLimY); //rapidity or eta
63 fAntiProtonContainer->SetBinLimits(1,binLimPt); //pT
67 //____________________________________________________________________//
68 AliProtonFeedDownAnalysis::~AliProtonFeedDownAnalysis()
71 if(fProtonAnalysisBase) delete fProtonAnalysisBase;
72 if(fProtonContainer) delete fProtonContainer;
73 if(fAntiProtonContainer) delete fAntiProtonContainer;
74 if(fweightfunction) delete fweightfunction;
75 if(fLambda) delete fLambda;
76 if(fLambdaweighted) delete fLambdaweighted;
77 if(fAntiLambda) delete fAntiLambda;
78 if(fAntiLambdaweighted) delete fAntiLambdaweighted;
80 //____________________________________________________________________//
81 void AliProtonFeedDownAnalysis::InitAnalysisHistograms(Int_t nbinsY, Float_t fLowY, Float_t fHighY, Int_t nbinsPt, Float_t fLowPt, Float_t fHighPt)
83 //Initializes the histograms
92 //setting up the containers
96 Double_t *binLimY = new Double_t[nbinsY+1];
97 Double_t *binLimPt = new Double_t[nbinsPt+1];
98 //values for bin lower bounds
99 for(Int_t i = 0; i <= nbinsY; i++)
100 binLimY[i]=(Double_t)fLowY + (fHighY - fLowY) /nbinsY*(Double_t)i;
101 for(Int_t i = 0; i <= nbinsPt; i++)
102 binLimPt[i]=(Double_t)fLowPt + (fHighPt - fLowPt) /nbinsPt*(Double_t)i;
104 fProtonContainer = new AliCFContainer("containerProtons","container for protons",kNSteps,2,iBin);
105 fProtonContainer->SetBinLimits(0,binLimY); //rapidity
106 fProtonContainer->SetBinLimits(1,binLimPt); //pT
107 fAntiProtonContainer = new AliCFContainer("containerAntiProtons","container for antiprotons",kNSteps,2,iBin);
108 fAntiProtonContainer->SetBinLimits(0,binLimY); //rapidity
109 fAntiProtonContainer->SetBinLimits(1,binLimPt); //pT
110 /*fLambda=new TH1F("Lambda","Lambda",35,0.5,4.0);
111 fLambdaweighted=new TH1F("Lambdaweighted","Lambdaweighted",35,0.5,4.0);
112 fAntiLambda=new TH1F("AntiLambda","AntiLambda",35,0.5,4.0);
113 fAntiLambdaweighted=new TH1F("AntiLambdaweighted","AntiLambdaweighted",35,0.5,4.0);*/
114 fLambda=new TH2F("Lambda","Lambda",fNBinsY,fMinY,fMaxY,fNBinsPt,fMinPt,fMaxPt);
115 fLambdaweighted=new TH2F("Lambdaweighted","Lambdaweighted",fNBinsY,fMinY,fMaxY,fNBinsPt,fMinPt,fMaxPt);
116 fAntiLambda=new TH2F("AntiLambda","AntiLambda",fNBinsY,fMinY,fMaxY,fNBinsPt,fMinPt,fMaxPt);
117 fAntiLambdaweighted=new TH2F("AntiLambdaweighted","AntiLambdaweighted",fNBinsY,fMinY,fMaxY,fNBinsPt,fMinPt,fMaxPt);
118 fLambda->GetYaxis()->SetTitle("P_{T} [GeV/c]");
119 fLambdaweighted->GetYaxis()->SetTitle("P_{T} [GeV/c]");
120 fAntiLambda->GetYaxis()->SetTitle("P_{T} [GeV/c]");
121 fAntiLambdaweighted->GetYaxis()->SetTitle("P_{T} [GeV/c]");
122 if(fProtonAnalysisBase->GetEtaMode())
124 fLambda->GetXaxis()->SetTitle("#eta");
125 fLambdaweighted->GetXaxis()->SetTitle("#eta");
126 fAntiLambda->GetXaxis()->SetTitle("#eta");
127 fAntiLambdaweighted->GetXaxis()->SetTitle("#eta");
131 fLambda->GetXaxis()->SetTitle("y");
132 fLambdaweighted->GetXaxis()->SetTitle("y");
133 fAntiLambda->GetXaxis()->SetTitle("y");
134 fAntiLambdaweighted->GetXaxis()->SetTitle("y");
137 //_________________________________________________________________________//
138 void AliProtonFeedDownAnalysis::Analyze(AliESDEvent *esd, const AliESDVertex *vertex,AliStack *stack)
141 Int_t nIdentifiedProtons = 0, nIdentifiedAntiProtons = 0;
142 Int_t nSurvivedProtons = 0, nSurvivedAntiProtons = 0;
144 //fHistEvents->Fill(0); //number of analyzed events
145 Double_t containerInput[2] ;
146 Double_t gPt = 0.0, gP = 0.0;
147 nTracks = esd->GetNumberOfTracks();
150 for(Int_t iTracks = 0; iTracks < nTracks; iTracks++)
153 AliESDtrack* track = esd->GetTrack(iTracks);
154 AliESDtrack trackTPC;
155 Int_t label= track->GetLabel();
156 /* Int_t trackflag=LambdaIsMother(label,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
158 weight=GetWeightforProton(label,stack);
162 if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid))
164 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
167 gPt = tpcTrack->Pt();
169 if(fProtonAnalysisBase->IsProton(track))
171 trackflag=LambdaIsMother(label,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
173 weight=GetWeightforProton(label,stack);
176 if(tpcTrack->Charge() > 0)
178 nIdentifiedProtons += 1;
179 if(!fProtonAnalysisBase->IsAccepted(esd,vertex,track))
180 continue;//track cuts
181 if(!fProtonAnalysisBase->IsInPhaseSpace(track))
182 continue; //track outside the analyzed y-Pt
183 nSurvivedProtons += 1;
184 if(fProtonAnalysisBase->GetEtaMode())
186 containerInput[0] = tpcTrack->Eta();
191 containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz());
193 containerInput[1] = gPt;
194 fProtonContainer->Fill(containerInput,kSelected,weight);
198 fProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
199 TParticle *particle = stack->Particle(label);
200 Int_t lmother=particle->GetFirstMother();
201 TParticle *mparticle=stack->Particle(lmother);
202 Double_t ptlambda= mparticle->Pt();
203 Double_t eta_or_y=0.0;
204 if(fProtonAnalysisBase->GetEtaMode())
205 eta_or_y=mparticle->Eta();
207 eta_or_y=0.5*TMath::Log((mparticle->Energy()+mparticle->Pz())/(mparticle->Energy()-mparticle->Pz()));
208 fLambda->Fill(eta_or_y, ptlambda);
209 fLambdaweighted->Fill(eta_or_y, ptlambda,weight);
213 else if(tpcTrack->Charge() < 0)
215 nIdentifiedAntiProtons += 1;
216 if(!fProtonAnalysisBase->IsAccepted(esd,vertex,track))
217 continue;//track cuts
218 if(!fProtonAnalysisBase->IsInPhaseSpace(track))
219 continue; //track outside the analyzed y-Pt
220 nSurvivedAntiProtons += 1;
221 if(fProtonAnalysisBase->GetEtaMode())
223 containerInput[0] = tpcTrack->Eta();
228 containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz());
230 containerInput[1] = gPt;
231 fAntiProtonContainer->Fill(containerInput,kSelected,weight);
235 fAntiProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
236 TParticle *particle = stack->Particle(label);
237 Int_t lmother=particle->GetFirstMother();
238 TParticle *mparticle=stack->Particle(lmother);
239 Double_t ptlambda= mparticle->Pt();
240 Double_t eta_or_y=0.0;
241 if(fProtonAnalysisBase->GetEtaMode())
242 eta_or_y=mparticle->Eta();
244 eta_or_y=0.5*TMath::Log((mparticle->Energy()+mparticle->Pz())/(mparticle->Energy()-mparticle->Pz()));
245 fAntiLambda->Fill(eta_or_y, ptlambda);
246 fAntiLambdaweighted->Fill(eta_or_y, ptlambda,weight);
251 else if(fProtonAnalysisBase->GetAnalysisMode() == AliProtonAnalysisBase::kGlobal)
255 if(fProtonAnalysisBase->IsProton(track))
257 trackflag=LambdaIsMother(label,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
259 weight=GetWeightforProton(label,stack);
262 if(track->Charge() > 0)
264 nIdentifiedProtons += 1;
265 if(!fProtonAnalysisBase->IsAccepted(esd,vertex,track))
266 continue;//track cuts
267 if(!fProtonAnalysisBase->IsInPhaseSpace(track))
268 continue; //track outside the analyzed y-Pt
269 nSurvivedProtons += 1;
270 if(fProtonAnalysisBase->GetEtaMode())
272 containerInput[0] = track->Eta();
277 containerInput[0] = fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz());
279 containerInput[1] = gPt;
280 fProtonContainer->Fill(containerInput,kSelected,weight);
284 fProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
285 TParticle *particle = stack->Particle(label);
286 Int_t lmother=particle->GetFirstMother();
287 TParticle *mparticle=stack->Particle(lmother);
288 Double_t ptlambda= mparticle->Pt();
289 Double_t eta_or_y=0.0;
290 if(fProtonAnalysisBase->GetEtaMode())
291 eta_or_y=mparticle->Eta();
293 eta_or_y=0.5*TMath::Log((mparticle->Energy()+mparticle->Pz())/(mparticle->Energy()-mparticle->Pz()));
294 fLambda->Fill(eta_or_y, ptlambda);
295 fLambdaweighted->Fill(eta_or_y, ptlambda,weight);
298 else if(track->Charge() < 0)
300 nIdentifiedAntiProtons += 1;
301 if(!fProtonAnalysisBase->IsAccepted(esd,vertex,track))
302 continue;//track cuts
303 if(!fProtonAnalysisBase->IsInPhaseSpace(track))
304 continue; //track outside the analyzed y-Pt
305 nSurvivedAntiProtons += 1;
306 if(fProtonAnalysisBase->GetEtaMode())
308 containerInput[0] = track->Eta();
313 containerInput[0] = fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz());
315 containerInput[1] = gPt;
316 fAntiProtonContainer->Fill(containerInput,kSelected,weight);
319 fAntiProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
320 TParticle *particle = stack->Particle(label);
321 Int_t lmother=particle->GetFirstMother();
322 TParticle *mparticle=stack->Particle(lmother);
323 Double_t ptlambda= mparticle->Pt();
324 Double_t eta_or_y=0.0;
325 if(fProtonAnalysisBase->GetEtaMode())
326 eta_or_y=mparticle->Eta();
328 eta_or_y=0.5*TMath::Log((mparticle->Energy()+mparticle->Pz())/(mparticle->Energy()-mparticle->Pz()));
329 fAntiLambda->Fill(eta_or_y, ptlambda);
330 fAntiLambdaweighted->Fill(eta_or_y, ptlambda,weight);
337 if(fProtonAnalysisBase->GetDebugMode())
338 Printf("Initial number of tracks: %d | Identified (anti)protons: %d - %d | Survived (anti)protons: %d - %d",nTracks,nIdentifiedProtons,nIdentifiedAntiProtons,nSurvivedProtons,nSurvivedAntiProtons);
341 //_________________________________________________________________________//
342 void AliProtonFeedDownAnalysis::Analyze(AliAODEvent *fAOD)
344 // Analysis from AOD: to be implemented...
345 // in the near future.
349 //_________________________________________________________________________//
350 void AliProtonFeedDownAnalysis::Analyze(AliStack *stack)
352 Double_t containerInput[2] ;
354 for (Int_t ipart=0; ipart<stack->GetNtrack(); ipart++)
356 TParticle *particle = stack->Particle(ipart);
357 Int_t code=particle->GetPdgCode();
360 fLambda->Fill(particle->Pt());
361 fLambdaweighted->Fill(particle->Pt(),GetWeightforLambda(particle->Pt()));
365 fAntiLambda->Fill(particle->Pt());
366 fAntiLambdaweighted->Fill(particle->Pt(),GetWeightforLambda(particle->Pt()));
368 if (TMath::Abs(code)==2212)
370 Int_t trackflag=LambdaIsMother(ipart,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
372 weight=GetWeightforProton(ipart,stack);
375 if(particle->GetUniqueID() == 13) //recject hadronic inter.
377 if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt))
379 if(fProtonAnalysisBase->GetEtaMode())
381 if((particle->Eta()> fMaxY)||(particle->Eta()< fMinY))
386 if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz())< fMinY))
389 if(fProtonAnalysisBase->GetEtaMode())
391 containerInput[0] =particle->Eta();
395 containerInput[0] = fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz());
397 //containerInput[0] = particle->Eta() ;
398 containerInput[1] = (Float_t)particle->Pt();
399 if (particle->GetPdgCode()==2212)
401 fProtonContainer->Fill(containerInput,kAll,weight);
402 if(ipart<stack->GetNprimary())
404 fProtonContainer->Fill(containerInput,kPrimary,weight);
409 fProtonContainer->Fill(containerInput,kFromLambda,weight);
412 if (particle->GetPdgCode()==-2212)
414 fAntiProtonContainer->Fill(containerInput,kAll,weight);
415 if(ipart<stack->GetNprimary())
417 fAntiProtonContainer->Fill(containerInput,kPrimary,weight);
422 fAntiProtonContainer->Fill(containerInput,kFromLambda,weight);
428 //______________________________________________________________________________________________
429 Int_t AliProtonFeedDownAnalysis::LambdaIsMother(Int_t number, AliStack *stack)
433 TParticle *particle = stack->Particle(number);
436 lmother=particle->GetFirstMother();
439 TParticle *mparticle=stack->Particle(lmother);
440 motherPDG=mparticle->GetPdgCode();
447 //___________________________________________________________________________________________
448 Float_t AliProtonFeedDownAnalysis::GetWeightforProton(Int_t number,AliStack *stack)
452 TParticle *particle = stack->Particle(number);
453 Int_t lmother=particle->GetFirstMother();
454 TParticle *mparticle=stack->Particle(lmother);
455 return fweightfunction->Eval(mparticle->Pt());
457 //______________________________________________________________________________________________
458 Float_t AliProtonFeedDownAnalysis::GetWeightforLambda(Float_t pt)
460 return fweightfunction->Eval(pt);