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
66 //____________________________________________________________________//
67 AliProtonFeedDownAnalysis::~AliProtonFeedDownAnalysis()
70 if(fProtonAnalysisBase) delete fProtonAnalysisBase;
71 if(fProtonContainer) delete fProtonContainer;
72 if(fAntiProtonContainer) delete fAntiProtonContainer;
73 if(fweightfunction) delete fweightfunction;
74 if(fLambda) delete fLambda;
75 if(fLambdaweighted) delete fLambdaweighted;
76 if(fAntiLambda) delete fAntiLambda;
77 if(fAntiLambdaweighted) delete fAntiLambdaweighted;
79 //____________________________________________________________________//
80 void AliProtonFeedDownAnalysis::InitAnalysisHistograms(Int_t nbinsY, Float_t fLowY, Float_t fHighY, Int_t nbinsPt, Float_t fLowPt, Float_t fHighPt)
82 //Initializes the histograms
91 //setting up the containers
95 Double_t *binLimY = new Double_t[nbinsY+1];
96 Double_t *binLimPt = new Double_t[nbinsPt+1];
97 //values for bin lower bounds
98 for(Int_t i = 0; i <= nbinsY; i++)
99 binLimY[i]=(Double_t)fLowY + (fHighY - fLowY) /nbinsY*(Double_t)i;
100 for(Int_t i = 0; i <= nbinsPt; i++)
101 binLimPt[i]=(Double_t)fLowPt + (fHighPt - fLowPt) /nbinsPt*(Double_t)i;
103 fProtonContainer = new AliCFContainer("containerProtons","container for protons",kNSteps,2,iBin);
104 fProtonContainer->SetBinLimits(0,binLimY); //rapidity
105 fProtonContainer->SetBinLimits(1,binLimPt); //pT
106 fAntiProtonContainer = new AliCFContainer("containerAntiProtons","container for antiprotons",kNSteps,2,iBin);
107 fAntiProtonContainer->SetBinLimits(0,binLimY); //rapidity
108 fAntiProtonContainer->SetBinLimits(1,binLimPt); //pT
109 fLambda=new TH1F("Lambda","Lambda",35,0.5,4.0);
110 fLambdaweighted=new TH1F("Lambdaweighted","Lambdaweighted",35,0.5,4.0);
111 fAntiLambda=new TH1F("AntiLambda","AntiLambda",35,0.5,4.0);
112 fAntiLambdaweighted=new TH1F("AntiLambdaweighted","AntiLambdaweighted",35,0.5,4.0);
114 //_________________________________________________________________________//
115 void AliProtonFeedDownAnalysis::Analyze(AliESDEvent *esd, const AliESDVertex *vertex,AliStack *stack)
118 Int_t nIdentifiedProtons = 0, nIdentifiedAntiProtons = 0;
119 Int_t nSurvivedProtons = 0, nSurvivedAntiProtons = 0;
121 //fHistEvents->Fill(0); //number of analyzed events
122 Double_t containerInput[2] ;
123 Double_t gPt = 0.0, gP = 0.0;
124 nTracks = esd->GetNumberOfTracks();
127 for(Int_t iTracks = 0; iTracks < nTracks; iTracks++)
130 AliESDtrack* track = esd->GetTrack(iTracks);
131 AliESDtrack trackTPC;
132 Int_t label= track->GetLabel();
133 /* Int_t trackflag=LambdaIsMother(label,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
135 weight=GetWeightforProton(label,stack);
139 if((fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kTPC)||(fProtonAnalysisBase->GetAnalysisMode()==AliProtonAnalysisBase::kHybrid))
141 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)track->GetTPCInnerParam();
144 gPt = tpcTrack->Pt();
146 if(fProtonAnalysisBase->IsProton(track))
148 trackflag=LambdaIsMother(label,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
150 weight=GetWeightforProton(label,stack);
153 if(tpcTrack->Charge() > 0)
155 nIdentifiedProtons += 1;
156 if(!fProtonAnalysisBase->IsAccepted(esd,vertex,track))
157 continue;//track cuts
158 if(!fProtonAnalysisBase->IsInPhaseSpace(track))
159 continue; //track outside the analyzed y-Pt
160 nSurvivedProtons += 1;
161 if(fProtonAnalysisBase->GetEtaMode())
163 containerInput[0] = tpcTrack->Eta();
168 containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz());
170 containerInput[1] = gPt;
171 fProtonContainer->Fill(containerInput,kSelected,weight);
174 fProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
177 else if(tpcTrack->Charge() < 0)
179 nIdentifiedAntiProtons += 1;
180 if(!fProtonAnalysisBase->IsAccepted(esd,vertex,track))
181 continue;//track cuts
182 if(!fProtonAnalysisBase->IsInPhaseSpace(track))
183 continue; //track outside the analyzed y-Pt
184 nSurvivedAntiProtons += 1;
185 if(fProtonAnalysisBase->GetEtaMode())
187 containerInput[0] = tpcTrack->Eta();
192 containerInput[0] = fProtonAnalysisBase->Rapidity(tpcTrack->Px(),tpcTrack->Py(),tpcTrack->Pz());
194 containerInput[1] = gPt;
195 fAntiProtonContainer->Fill(containerInput,kSelected,weight);
198 fAntiProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
202 else if(fProtonAnalysisBase->GetAnalysisMode() == AliProtonAnalysisBase::kGlobal)
206 if(fProtonAnalysisBase->IsProton(track))
208 trackflag=LambdaIsMother(label,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
210 weight=GetWeightforProton(label,stack);
213 if(track->Charge() > 0)
215 nIdentifiedProtons += 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 nSurvivedProtons += 1;
221 if(fProtonAnalysisBase->GetEtaMode())
223 containerInput[0] = track->Eta();
228 containerInput[0] = fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz());
230 containerInput[1] = gPt;
231 fProtonContainer->Fill(containerInput,kSelected,weight);
234 fProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
236 else if(track->Charge() < 0)
238 nIdentifiedAntiProtons += 1;
239 if(!fProtonAnalysisBase->IsAccepted(esd,vertex,track))
240 continue;//track cuts
241 if(!fProtonAnalysisBase->IsInPhaseSpace(track))
242 continue; //track outside the analyzed y-Pt
243 nSurvivedAntiProtons += 1;
244 if(fProtonAnalysisBase->GetEtaMode())
246 containerInput[0] = track->Eta();
251 containerInput[0] = fProtonAnalysisBase->Rapidity(track->Px(),track->Py(),track->Pz());
253 containerInput[1] = gPt;
254 fAntiProtonContainer->Fill(containerInput,kSelected,weight);
256 fAntiProtonContainer->Fill(containerInput,kSelectedfromLambda,weight);
262 if(fProtonAnalysisBase->GetDebugMode())
263 Printf("Initial number of tracks: %d | Identified (anti)protons: %d - %d | Survived (anti)protons: %d - %d",nTracks,nIdentifiedProtons,nIdentifiedAntiProtons,nSurvivedProtons,nSurvivedAntiProtons);
266 //_________________________________________________________________________//
267 void AliProtonFeedDownAnalysis::Analyze(AliAODEvent *fAOD)
269 // Analysis from AOD: to be implemented...
270 // in the near future.
274 //_________________________________________________________________________//
275 void AliProtonFeedDownAnalysis::Analyze(AliStack *stack)
277 Double_t containerInput[2] ;
279 for (Int_t ipart=0; ipart<stack->GetNtrack(); ipart++)
281 TParticle *particle = stack->Particle(ipart);
282 Int_t code=particle->GetPdgCode();
285 fLambda->Fill(particle->Pt());
286 fLambdaweighted->Fill(particle->Pt(),GetWeightforLambda(particle->Pt()));
290 fAntiLambda->Fill(particle->Pt());
291 fAntiLambdaweighted->Fill(particle->Pt(),GetWeightforLambda(particle->Pt()));
293 if (TMath::Abs(code)==2212)
295 Int_t trackflag=LambdaIsMother(ipart,stack);//1 mother lambda -1 mother anti lambda 0 mother something else
297 weight=GetWeightforProton(ipart,stack);
300 if(particle->GetUniqueID() == 13) //recject hadronic inter.
302 if((particle->Pt() > fMaxPt)||(particle->Pt() < fMinPt))
304 if(fProtonAnalysisBase->GetEtaMode())
306 if((particle->Eta()> fMaxY)||(particle->Eta()< fMinY))
311 if((fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz()) > fMaxY)||(fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz())< fMinY))
314 if(fProtonAnalysisBase->GetEtaMode())
316 containerInput[0] =particle->Eta();
320 containerInput[0] = fProtonAnalysisBase->Rapidity(particle->Px(),particle->Py(),particle->Pz());
322 //containerInput[0] = particle->Eta() ;
323 containerInput[1] = (Float_t)particle->Pt();
324 if (particle->GetPdgCode()==2212)
326 fProtonContainer->Fill(containerInput,kAll,weight);
327 if(ipart<stack->GetNprimary())
329 fProtonContainer->Fill(containerInput,kPrimary,weight);
334 fProtonContainer->Fill(containerInput,kFromLambda,weight);
337 if (particle->GetPdgCode()==-2212)
339 fAntiProtonContainer->Fill(containerInput,kAll,weight);
340 if(ipart<stack->GetNprimary())
342 fAntiProtonContainer->Fill(containerInput,kPrimary,weight);
347 fAntiProtonContainer->Fill(containerInput,kFromLambda,weight);
353 //______________________________________________________________________________________________
354 Int_t AliProtonFeedDownAnalysis::LambdaIsMother(Int_t number, AliStack *stack)
358 TParticle *particle = stack->Particle(number);
361 lmother=particle->GetFirstMother();
364 TParticle *mparticle=stack->Particle(lmother);
365 motherPDG=mparticle->GetPdgCode();
372 //___________________________________________________________________________________________
373 Float_t AliProtonFeedDownAnalysis::GetWeightforProton(Int_t number,AliStack *stack)
377 TParticle *particle = stack->Particle(number);
378 Int_t lmother=particle->GetFirstMother();
379 TParticle *mparticle=stack->Particle(lmother);
380 return fweightfunction->Eval(mparticle->Pt());
382 //______________________________________________________________________________________________
383 Float_t AliProtonFeedDownAnalysis::GetWeightforLambda(Float_t pt)
385 return fweightfunction->Eval(pt);