]>
Commit | Line | Data |
---|---|---|
477d6cee | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
477d6cee | 15 | |
16 | //_________________________________________________________________________ | |
17 | // | |
18 | // Class for track selection and identification (not done now) | |
19 | // Tracks from the CTS are kept in the AOD. | |
20 | // Few histograms produced. | |
21 | // | |
22 | //-- Author: Gustavo Conesa (INFN-LNF) | |
23 | //_________________________________________________________________________ | |
24 | ||
25 | ||
26 | // --- ROOT system --- | |
477d6cee | 27 | #include "TParticle.h" |
28 | #include "TH2F.h" | |
05d0d05d | 29 | |
477d6cee | 30 | //---- AliRoot system ---- |
31 | #include "AliAnaChargedParticles.h" | |
32 | #include "AliCaloTrackReader.h" | |
33 | #include "AliAODPWG4Particle.h" | |
34 | #include "AliStack.h" | |
ff45398a | 35 | #include "AliFiducialCut.h" |
88f9563f | 36 | #include "AliVTrack.h" |
591cc579 | 37 | #include "AliAODMCParticle.h" |
477d6cee | 38 | |
39 | ClassImp(AliAnaChargedParticles) | |
40 | ||
05d0d05d | 41 | //__________________________________________________ |
477d6cee | 42 | AliAnaChargedParticles::AliAnaChargedParticles() : |
745913ae | 43 | AliAnaCaloTrackCorrBaseClass(), |
05d0d05d | 44 | fPdg(0), |
45 | fhNtracks(0), fhPt(0), | |
46 | fhPhiNeg(0), fhEtaNeg(0), | |
47 | fhPhiPos(0), fhEtaPos(0), | |
48 | fhEtaPhiPos(0), fhEtaPhiNeg(0), | |
49 | //MC | |
50 | fhPtPion(0), fhPhiPion(0), fhEtaPion(0), | |
51 | fhPtProton(0), fhPhiProton(0), fhEtaProton(0), | |
52 | fhPtElectron(0),fhPhiElectron(0), fhEtaElectron(0), | |
53 | fhPtKaon(0), fhPhiKaon(0), fhEtaKaon(0), | |
54 | fhPtUnknown(0), fhPhiUnknown(0), fhEtaUnknown(0) | |
477d6cee | 55 | { |
56 | //Default Ctor | |
57 | ||
58 | //Initialize parameters | |
59 | InitParameters(); | |
477d6cee | 60 | |
477d6cee | 61 | } |
62 | ||
05d0d05d | 63 | //_______________________________________________________ |
477d6cee | 64 | TList * AliAnaChargedParticles::GetCreateOutputObjects() |
65 | { | |
66 | // Create histograms to be saved in output file and | |
67 | // store them in fOutputContainer | |
68 | ||
69 | ||
70 | TList * outputContainer = new TList() ; | |
71 | outputContainer->SetName("ExampleHistos") ; | |
72 | ||
745913ae | 73 | Int_t nptbins = GetHistogramRanges()->GetHistoPtBins(); Int_t nphibins = GetHistogramRanges()->GetHistoPhiBins(); Int_t netabins = GetHistogramRanges()->GetHistoEtaBins(); |
74 | Float_t ptmax = GetHistogramRanges()->GetHistoPtMax(); Float_t phimax = GetHistogramRanges()->GetHistoPhiMax(); Float_t etamax = GetHistogramRanges()->GetHistoEtaMax(); | |
75 | Float_t ptmin = GetHistogramRanges()->GetHistoPtMin(); Float_t phimin = GetHistogramRanges()->GetHistoPhiMin(); Float_t etamin = GetHistogramRanges()->GetHistoEtaMin(); | |
5025c139 | 76 | |
77 | fhNtracks = new TH1F ("hNtracks","# of tracks", 1000,0,1000); | |
78 | fhNtracks->SetXTitle("# of tracks"); | |
79 | outputContainer->Add(fhNtracks); | |
05d0d05d | 80 | |
81 | fhPt = new TH1F ("hPt","p_T distribution", nptbins,ptmin,ptmax); | |
477d6cee | 82 | fhPt->SetXTitle("p_{T} (GeV/c)"); |
83 | outputContainer->Add(fhPt); | |
84 | ||
05d0d05d | 85 | fhPhiNeg = new TH2F ("hPhiNegative","#phi of negative charges distribution", |
86 | nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
87 | fhPhiNeg->SetYTitle("#phi (rad)"); | |
88 | fhPhiNeg->SetXTitle("p_{T} (GeV/c)"); | |
89 | outputContainer->Add(fhPhiNeg); | |
90 | ||
91 | fhEtaNeg = new TH2F ("hEtaNegative","#eta of negative charges distribution", | |
92 | nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
93 | fhEtaNeg->SetYTitle("#eta "); | |
94 | fhEtaNeg->SetXTitle("p_{T} (GeV/c)"); | |
95 | outputContainer->Add(fhEtaNeg); | |
477d6cee | 96 | |
192689a4 | 97 | fhPhiPos = new TH2F ("hPhiPositive","#phi of positive charges distribution", |
05d0d05d | 98 | nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
99 | fhPhiPos->SetYTitle("#phi (rad)"); | |
100 | fhPhiPos->SetXTitle("p_{T} (GeV/c)"); | |
101 | outputContainer->Add(fhPhiPos); | |
477d6cee | 102 | |
192689a4 | 103 | fhEtaPos = new TH2F ("hEtaPositive","#eta of positive charges distribution", |
05d0d05d | 104 | nptbins,ptmin,ptmax, netabins,etamin,etamax); |
105 | fhEtaPos->SetYTitle("#eta "); | |
106 | fhEtaPos->SetXTitle("p_{T} (GeV/c)"); | |
107 | outputContainer->Add(fhEtaPos); | |
5025c139 | 108 | |
192689a4 | 109 | fhEtaPhiPos = new TH2F ("hEtaPhiPositive","pt/eta/phi of positive charge",netabins,etamin,etamax, nphibins,phimin,phimax); |
05d0d05d | 110 | fhEtaPhiPos->SetXTitle("p_{T}^{h^{+}} (GeV/c)"); |
111 | fhEtaPhiPos->SetYTitle("#eta "); | |
112 | fhEtaPhiPos->SetZTitle("#phi (rad)"); | |
113 | outputContainer->Add(fhEtaPhiPos); | |
114 | ||
115 | fhEtaPhiNeg = new TH2F ("hEtaPhiNegative","eta vs phi of negative charge",netabins,etamin,etamax, nphibins,phimin,phimax); | |
116 | fhEtaPhiNeg->SetXTitle("p_{T}^{h^{-}} (GeV/c)"); | |
117 | fhEtaPhiNeg->SetYTitle("#eta "); | |
118 | fhEtaPhiNeg->SetZTitle("#phi (rad)"); | |
119 | outputContainer->Add(fhEtaPhiNeg); | |
477d6cee | 120 | |
121 | if(IsDataMC()){ | |
122 | ||
a3aebfff | 123 | fhPtPion = new TH1F ("hPtMCPion","p_T distribution from #pi", nptbins,ptmin,ptmax); |
477d6cee | 124 | fhPtPion->SetXTitle("p_{T} (GeV/c)"); |
125 | outputContainer->Add(fhPtPion); | |
126 | ||
a3aebfff | 127 | fhPhiPion = new TH2F ("hPhiMCPion","#phi distribution from #pi",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 128 | fhPhiPion->SetXTitle("#phi (rad)"); |
129 | outputContainer->Add(fhPhiPion); | |
130 | ||
a3aebfff | 131 | fhEtaPion = new TH2F ("hEtaMCPion","#eta distribution from #pi",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 132 | fhEtaPion->SetXTitle("#eta "); |
133 | outputContainer->Add(fhEtaPion); | |
134 | ||
a3aebfff | 135 | fhPtProton = new TH1F ("hPtMCProton","p_T distribution from proton", nptbins,ptmin,ptmax); |
477d6cee | 136 | fhPtProton->SetXTitle("p_{T} (GeV/c)"); |
137 | outputContainer->Add(fhPtProton); | |
138 | ||
a3aebfff | 139 | fhPhiProton = new TH2F ("hPhiMCProton","#phi distribution from proton",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 140 | fhPhiProton->SetXTitle("#phi (rad)"); |
141 | outputContainer->Add(fhPhiProton); | |
142 | ||
a3aebfff | 143 | fhEtaProton = new TH2F ("hEtaMCProton","#eta distribution from proton",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 144 | fhEtaProton->SetXTitle("#eta "); |
145 | outputContainer->Add(fhEtaProton); | |
146 | ||
a3aebfff | 147 | fhPtKaon = new TH1F ("hPtMCKaon","p_T distribution from kaon", nptbins,ptmin,ptmax); |
477d6cee | 148 | fhPtKaon->SetXTitle("p_{T} (GeV/c)"); |
149 | outputContainer->Add(fhPtKaon); | |
150 | ||
a3aebfff | 151 | fhPhiKaon = new TH2F ("hPhiMCKaon","#phi distribution from kaon",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 152 | fhPhiKaon->SetXTitle("#phi (rad)"); |
153 | outputContainer->Add(fhPhiKaon); | |
154 | ||
a3aebfff | 155 | fhEtaKaon = new TH2F ("hEtaMCKaon","#eta distribution from kaon",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 156 | fhEtaKaon->SetXTitle("#eta "); |
157 | outputContainer->Add(fhEtaKaon); | |
158 | ||
a3aebfff | 159 | fhPtElectron = new TH1F ("hPtMCElectron","p_T distribution from electron", nptbins,ptmin,ptmax); |
477d6cee | 160 | fhPtElectron->SetXTitle("p_{T} (GeV/c)"); |
161 | outputContainer->Add(fhPtElectron); | |
162 | ||
a3aebfff | 163 | fhPhiElectron = new TH2F ("hPhiMCElectron","#phi distribution from electron",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 164 | fhPhiElectron->SetXTitle("#phi (rad)"); |
165 | outputContainer->Add(fhPhiElectron); | |
166 | ||
a3aebfff | 167 | fhEtaElectron = new TH2F ("hEtaMCElectron","#eta distribution from electron",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 168 | fhEtaElectron->SetXTitle("#eta "); |
169 | outputContainer->Add(fhEtaElectron); | |
170 | ||
a3aebfff | 171 | fhPtUnknown = new TH1F ("hPtMCUnknown","p_T distribution from unknown", nptbins,ptmin,ptmax); |
477d6cee | 172 | fhPtUnknown->SetXTitle("p_{T} (GeV/c)"); |
173 | outputContainer->Add(fhPtUnknown); | |
174 | ||
a3aebfff | 175 | fhPhiUnknown = new TH2F ("hPhiMCUnknown","#phi distribution from unknown",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 176 | fhPhiUnknown->SetXTitle("#phi (rad)"); |
177 | outputContainer->Add(fhPhiUnknown); | |
178 | ||
a3aebfff | 179 | fhEtaUnknown = new TH2F ("hEtaMCUnknown","#eta distribution from unknown",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 180 | fhEtaUnknown->SetXTitle("#eta "); |
181 | outputContainer->Add(fhEtaUnknown); | |
182 | ||
183 | } | |
a3aebfff | 184 | |
477d6cee | 185 | return outputContainer; |
a3aebfff | 186 | |
477d6cee | 187 | } |
188 | ||
05d0d05d | 189 | //___________________________________________ |
477d6cee | 190 | void AliAnaChargedParticles::InitParameters() |
191 | { | |
192 | //Initialize the parameters of the analysis. | |
193 | SetOutputAODClassName("AliAODPWG4Particle"); | |
a3aebfff | 194 | SetOutputAODName("PWG4Particle"); |
195 | ||
196 | AddToHistogramsName("AnaCharged_"); | |
197 | ||
477d6cee | 198 | fPdg = -1; //Select all tracks |
199 | ||
200 | } | |
201 | ||
05d0d05d | 202 | //____________________________________________________________ |
477d6cee | 203 | void AliAnaChargedParticles::Print(const Option_t * opt) const |
204 | { | |
205 | //Print some relevant parameters set for the analysis | |
206 | if(! opt) | |
207 | return; | |
208 | ||
a3aebfff | 209 | printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; |
745913ae | 210 | AliAnaCaloTrackCorrBaseClass::Print(" "); |
a3aebfff | 211 | |
477d6cee | 212 | printf("Min Pt = %3.2f\n", GetMinPt()); |
213 | printf("Max Pt = %3.2f\n", GetMaxPt()); | |
214 | printf("Select clusters with pdg %d \n",fPdg); | |
215 | ||
216 | } | |
217 | ||
05d0d05d | 218 | //_________________________________ |
477d6cee | 219 | void AliAnaChargedParticles::Init() |
220 | { | |
221 | //Init | |
222 | //Do some checks | |
223 | if(!GetReader()->IsCTSSwitchedOn()){ | |
7cd4e982 | 224 | printf("AliAnaChargedParticles::Init() - STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n"); |
477d6cee | 225 | abort(); |
226 | } | |
227 | ||
228 | } | |
229 | ||
05d0d05d | 230 | //_________________________________________________ |
477d6cee | 231 | void AliAnaChargedParticles::MakeAnalysisFillAOD() |
232 | { | |
233 | //Do analysis and fill aods | |
be518ab0 | 234 | if(!GetCTSTracks() || GetCTSTracks()->GetEntriesFast() == 0) return ; |
192689a4 | 235 | |
be518ab0 | 236 | Int_t ntracks = GetCTSTracks()->GetEntriesFast(); |
2244659d | 237 | Double_t vert[3] = {0,0,0}; //vertex ; |
192689a4 | 238 | |
477d6cee | 239 | //Some prints |
240 | if(GetDebug() > 0) | |
a3aebfff | 241 | printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - In CTS aod entries %d\n", ntracks); |
477d6cee | 242 | |
243 | //Fill AODParticle with CTS aods | |
244 | TVector3 p3; | |
5025c139 | 245 | Int_t evtIndex = 0; |
477d6cee | 246 | for(Int_t i = 0; i < ntracks; i++){ |
247 | ||
88f9563f | 248 | AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i)); |
477d6cee | 249 | |
250 | //Fill AODParticle after some selection | |
251 | Double_t mom[3] = {track->Px(),track->Py(),track->Pz()}; | |
252 | p3.SetXYZ(mom[0],mom[1],mom[2]); | |
253 | ||
192689a4 | 254 | Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ; |
255 | ||
05d0d05d | 256 | if(GetDebug() > 1) |
192689a4 | 257 | printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Track pt %2.2f, phi %2.2f, eta %2.2f in fiducial cut %d\n",p3.Pt(), p3.Phi(), p3.Eta(),in); |
258 | ||
259 | //Acceptance selection | |
260 | if(IsFiducialCutOn() && ! in ) continue ; | |
261 | ||
262 | // Momentum selection | |
263 | if(p3.Pt() < GetMinPt() || p3.Pt() > GetMaxPt()) continue; | |
264 | ||
265 | //Keep only particles identified with fPdg | |
266 | //Selection not done for the moment | |
267 | //Should be done here. | |
268 | ||
269 | // Mixed event | |
270 | if (GetMixedEvent()){ | |
271 | evtIndex = GetMixedEvent()->EventIndex(track->GetID()) ; | |
272 | } | |
273 | GetVertex(vert,evtIndex); | |
274 | if(TMath::Abs(vert[2])> GetZvertexCut()) return; | |
275 | ||
276 | AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0); | |
277 | tr.SetDetector("CTS"); | |
278 | tr.SetLabel(track->GetLabel()); | |
279 | tr.SetTrackLabel(track->GetID(),-1); | |
280 | tr.SetChargedBit(track->Charge()>0); | |
7cd4e982 | 281 | |
192689a4 | 282 | AddAODParticle(tr); |
283 | ||
477d6cee | 284 | }//loop |
285 | ||
286 | if(GetDebug() > 0) | |
a3aebfff | 287 | printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Final aod branch entries %d\n", GetOutputAODBranch()->GetEntriesFast()); |
477d6cee | 288 | } |
289 | ||
290 | //__________________________________________________________________ | |
291 | void AliAnaChargedParticles::MakeAnalysisFillHistograms() | |
292 | { | |
293 | //Do analysis and fill histograms | |
294 | ||
295 | //Loop on stored AODParticles | |
296 | Int_t naod = GetOutputAODBranch()->GetEntriesFast(); | |
05d0d05d | 297 | |
2244659d | 298 | fhNtracks->Fill(GetReader()->GetTrackMultiplicity()) ; |
05d0d05d | 299 | |
300 | if(GetDebug() > 0) | |
301 | printf("AliAnaChargedParticles::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod); | |
302 | ||
477d6cee | 303 | for(Int_t iaod = 0; iaod < naod ; iaod++){ |
304 | AliAODPWG4Particle* tr = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod)); | |
2244659d | 305 | |
477d6cee | 306 | fhPt->Fill(tr->Pt()); |
05d0d05d | 307 | |
308 | if(tr->GetChargedBit()){ | |
309 | fhPhiPos ->Fill(tr->Pt(), tr->Phi()); | |
b2fbc116 | 310 | fhEtaPos ->Fill(tr->Pt(), tr->Eta()); |
05d0d05d | 311 | fhEtaPhiPos->Fill(tr->Eta(),tr->Phi()); |
312 | } | |
313 | else{ | |
b2fbc116 | 314 | fhPhiNeg ->Fill(tr->Pt(), tr->Phi()); |
05d0d05d | 315 | fhEtaNeg ->Fill(tr->Pt(), tr->Eta()); |
316 | fhEtaPhiNeg->Fill(tr->Eta(),tr->Phi()); | |
317 | } | |
477d6cee | 318 | |
319 | if(IsDataMC()){ | |
320 | //Play with the MC stack if available | |
5025c139 | 321 | Int_t mompdg = -1; |
f6661bbc | 322 | Int_t label = TMath::Abs(tr->GetLabel()); |
5025c139 | 323 | if(GetReader()->ReadStack()){ |
324 | TParticle * mom = GetMCStack()->Particle(label); | |
325 | mompdg =TMath::Abs(mom->GetPdgCode()); | |
591cc579 | 326 | } |
5025c139 | 327 | else if(GetReader()->ReadAODMCParticles()){ |
328 | AliAODMCParticle * aodmom = 0; | |
329 | //Get the list of MC particles | |
330 | aodmom = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(tr->GetInputFileIndex()))->At(label); | |
331 | mompdg =TMath::Abs(aodmom->GetPdgCode()); | |
332 | } | |
333 | ||
334 | if(mompdg==211){ | |
05d0d05d | 335 | fhPtPion ->Fill(tr->Pt()); |
5025c139 | 336 | fhPhiPion->Fill(tr->Pt(), tr->Phi()); |
337 | fhEtaPion->Fill(tr->Pt(), tr->Eta()); | |
477d6cee | 338 | } |
339 | else if(mompdg==2212){ | |
05d0d05d | 340 | fhPtProton ->Fill(tr->Pt()); |
5025c139 | 341 | fhPhiProton->Fill(tr->Pt(), tr->Phi()); |
342 | fhEtaProton->Fill(tr->Pt(), tr->Eta()); | |
477d6cee | 343 | } |
344 | else if(mompdg==321){ | |
05d0d05d | 345 | fhPtKaon ->Fill(tr->Pt()); |
5025c139 | 346 | fhPhiKaon->Fill(tr->Pt(), tr->Phi()); |
347 | fhEtaKaon->Fill(tr->Pt(), tr->Eta()); | |
477d6cee | 348 | } |
349 | else if(mompdg==11){ | |
05d0d05d | 350 | fhPtElectron ->Fill(tr->Pt()); |
5025c139 | 351 | fhPhiElectron->Fill(tr->Pt(), tr->Phi()); |
352 | fhEtaElectron->Fill(tr->Pt(), tr->Eta()); | |
477d6cee | 353 | } |
354 | else { | |
5025c139 | 355 | //printf("unknown pdg %d\n",mompdg); |
05d0d05d | 356 | fhPtUnknown ->Fill(tr->Pt()); |
5025c139 | 357 | fhPhiUnknown->Fill(tr->Pt(), tr->Phi()); |
358 | fhEtaUnknown->Fill(tr->Pt(), tr->Eta()); | |
477d6cee | 359 | } |
05d0d05d | 360 | |
477d6cee | 361 | }//Work with stack also |
f6661bbc | 362 | |
477d6cee | 363 | }// aod branch loop |
364 | ||
365 | } |