]>
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 | **************************************************************************/ | |
15 | /* $Id: $ */ | |
16 | ||
17 | //_________________________________________________________________________ | |
18 | // | |
19 | // Class for track selection and identification (not done now) | |
20 | // Tracks from the CTS are kept in the AOD. | |
21 | // Few histograms produced. | |
22 | // | |
23 | //-- Author: Gustavo Conesa (INFN-LNF) | |
24 | //_________________________________________________________________________ | |
25 | ||
26 | ||
27 | // --- ROOT system --- | |
28 | #include "TClonesArray.h" | |
29 | #include "TParticle.h" | |
30 | #include "TH2F.h" | |
31 | ||
32 | //---- AliRoot system ---- | |
33 | #include "AliAnaChargedParticles.h" | |
34 | #include "AliCaloTrackReader.h" | |
35 | #include "AliAODPWG4Particle.h" | |
36 | #include "AliStack.h" | |
37 | #include "AliCaloPID.h" | |
38 | #include "AliFidutialCut.h" | |
39 | #include "AliAODTrack.h" | |
40 | ||
41 | ClassImp(AliAnaChargedParticles) | |
42 | ||
43 | //____________________________________________________________________________ | |
44 | AliAnaChargedParticles::AliAnaChargedParticles() : | |
45 | AliAnaPartCorrBaseClass(),fPdg(0), fhPt(0),fhPhi(0),fhEta(0), | |
46 | fhPtPion(0),fhPhiPion(0),fhEtaPion(0), | |
47 | fhPtProton(0),fhPhiProton(0),fhEtaProton(0), | |
48 | fhPtElectron(0),fhPhiElectron(0),fhEtaElectron(0), | |
49 | fhPtKaon(0),fhPhiKaon(0),fhEtaKaon(0), | |
50 | fhPtUnknown(0),fhPhiUnknown(0),fhEtaUnknown(0) | |
51 | ||
52 | { | |
53 | //Default Ctor | |
54 | ||
55 | //Initialize parameters | |
56 | InitParameters(); | |
57 | } | |
58 | ||
59 | //____________________________________________________________________________ | |
60 | AliAnaChargedParticles::AliAnaChargedParticles(const AliAnaChargedParticles & ch) : | |
61 | AliAnaPartCorrBaseClass(ch), fPdg(ch.fPdg), fhPt(ch.fhPt), fhPhi(ch.fhPhi),fhEta(ch.fhEta), | |
62 | fhPtPion(ch. fhPtPion),fhPhiPion(ch.fhPhiPion),fhEtaPion(ch.fhEtaPion), | |
63 | fhPtProton(ch.fhPtProton),fhPhiProton(ch.fhPhiProton),fhEtaProton(ch.fhEtaProton), | |
64 | fhPtElectron(ch. fhPtElectron),fhPhiElectron(ch.fhPhiElectron),fhEtaElectron(ch.fhEtaElectron), | |
65 | fhPtKaon(ch. fhPtKaon),fhPhiKaon(ch.fhPhiKaon),fhEtaKaon(ch.fhEtaKaon), | |
66 | fhPtUnknown(ch.fhPtUnknown),fhPhiUnknown(ch.fhPhiUnknown),fhEtaUnknown(ch.fhEtaUnknown) | |
67 | ||
68 | { | |
69 | // cpy ctor | |
70 | ||
71 | } | |
72 | ||
73 | //_________________________________________________________________________ | |
74 | AliAnaChargedParticles & AliAnaChargedParticles::operator = (const AliAnaChargedParticles & ch) | |
75 | { | |
76 | // assignment operator | |
77 | ||
78 | if(this == &ch)return *this; | |
79 | ((AliAnaPartCorrBaseClass *)this)->operator=(ch); | |
80 | ||
81 | fPdg = ch.fPdg; | |
82 | fhPt = ch.fhPt; | |
83 | fhPhi = ch.fhPhi; | |
84 | fhEta = ch.fhEta; | |
85 | ||
86 | fhPtPion = ch. fhPtPion; fhPhiPion = ch.fhPhiPion; fhEtaPion = ch.fhEtaPion; | |
87 | fhPtProton = ch.fhPtProton; fhPhiProton = ch.fhPhiProton; fhEtaProton = ch.fhEtaProton; | |
88 | fhPtElectron = ch. fhPtElectron; fhPhiElectron = ch.fhPhiElectron; fhEtaElectron = ch.fhEtaElectron; | |
89 | fhPtKaon = ch. fhPtKaon; fhPhiKaon = ch.fhPhiKaon; fhEtaKaon = ch.fhEtaKaon; | |
90 | fhPtUnknown = ch.fhPtUnknown; fhPhiUnknown = ch.fhPhiUnknown; fhEtaUnknown = ch.fhEtaUnknown; | |
91 | ||
92 | return *this; | |
93 | ||
94 | } | |
95 | ||
96 | //________________________________________________________________________ | |
97 | TList * AliAnaChargedParticles::GetCreateOutputObjects() | |
98 | { | |
99 | // Create histograms to be saved in output file and | |
100 | // store them in fOutputContainer | |
101 | ||
102 | ||
103 | TList * outputContainer = new TList() ; | |
104 | outputContainer->SetName("ExampleHistos") ; | |
105 | ||
106 | Int_t nptbins = GetHistoNPtBins(); | |
107 | Int_t nphibins = GetHistoNPhiBins(); | |
108 | Int_t netabins = GetHistoNEtaBins(); | |
109 | Float_t ptmax = GetHistoPtMax(); | |
110 | Float_t phimax = GetHistoPhiMax(); | |
111 | Float_t etamax = GetHistoEtaMax(); | |
112 | Float_t ptmin = GetHistoPtMin(); | |
113 | Float_t phimin = GetHistoPhiMin(); | |
114 | Float_t etamin = GetHistoEtaMin(); | |
115 | ||
116 | fhPt = new TH1F ("hPtCharged","p_T distribution", nptbins,ptmin,ptmax); | |
117 | fhPt->SetXTitle("p_{T} (GeV/c)"); | |
118 | outputContainer->Add(fhPt); | |
119 | ||
120 | fhPhi = new TH2F ("hPhiCharged","#phi distribution",nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
121 | fhPhi->SetXTitle("#phi (rad)"); | |
122 | outputContainer->Add(fhPhi); | |
123 | ||
124 | fhEta = new TH2F ("hEtaCharged","#eta distribution",nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
125 | fhEta->SetXTitle("#eta "); | |
126 | outputContainer->Add(fhEta); | |
127 | ||
128 | ||
129 | if(IsDataMC()){ | |
130 | ||
131 | fhPtPion = new TH1F ("hPtChargedPion","p_T distribution from #pi", nptbins,ptmin,ptmax); | |
132 | fhPtPion->SetXTitle("p_{T} (GeV/c)"); | |
133 | outputContainer->Add(fhPtPion); | |
134 | ||
135 | fhPhiPion = new TH2F ("hPhiChargedPion","#phi distribution from #pi",nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
136 | fhPhiPion->SetXTitle("#phi (rad)"); | |
137 | outputContainer->Add(fhPhiPion); | |
138 | ||
139 | fhEtaPion = new TH2F ("hEtaChargedPion","#eta distribution from #pi",nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
140 | fhEtaPion->SetXTitle("#eta "); | |
141 | outputContainer->Add(fhEtaPion); | |
142 | ||
143 | fhPtProton = new TH1F ("hPtChargedProton","p_T distribution from proton", nptbins,ptmin,ptmax); | |
144 | fhPtProton->SetXTitle("p_{T} (GeV/c)"); | |
145 | outputContainer->Add(fhPtProton); | |
146 | ||
147 | fhPhiProton = new TH2F ("hPhiChargedProton","#phi distribution from proton",nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
148 | fhPhiProton->SetXTitle("#phi (rad)"); | |
149 | outputContainer->Add(fhPhiProton); | |
150 | ||
151 | fhEtaProton = new TH2F ("hEtaChargedProton","#eta distribution from proton",nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
152 | fhEtaProton->SetXTitle("#eta "); | |
153 | outputContainer->Add(fhEtaProton); | |
154 | ||
155 | fhPtKaon = new TH1F ("hPtChargedKaon","p_T distribution from kaon", nptbins,ptmin,ptmax); | |
156 | fhPtKaon->SetXTitle("p_{T} (GeV/c)"); | |
157 | outputContainer->Add(fhPtKaon); | |
158 | ||
159 | fhPhiKaon = new TH2F ("hPhiChargedKaon","#phi distribution from kaon",nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
160 | fhPhiKaon->SetXTitle("#phi (rad)"); | |
161 | outputContainer->Add(fhPhiKaon); | |
162 | ||
163 | fhEtaKaon = new TH2F ("hEtaChargedKaon","#eta distribution from kaon",nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
164 | fhEtaKaon->SetXTitle("#eta "); | |
165 | outputContainer->Add(fhEtaKaon); | |
166 | ||
167 | ||
168 | fhPtElectron = new TH1F ("hPtChargedElectron","p_T distribution from electron", nptbins,ptmin,ptmax); | |
169 | fhPtElectron->SetXTitle("p_{T} (GeV/c)"); | |
170 | outputContainer->Add(fhPtElectron); | |
171 | ||
172 | fhPhiElectron = new TH2F ("hPhiChargedElectron","#phi distribution from electron",nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
173 | fhPhiElectron->SetXTitle("#phi (rad)"); | |
174 | outputContainer->Add(fhPhiElectron); | |
175 | ||
176 | fhEtaElectron = new TH2F ("hEtaChargedElectron","#eta distribution from electron",nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
177 | fhEtaElectron->SetXTitle("#eta "); | |
178 | outputContainer->Add(fhEtaElectron); | |
179 | ||
180 | fhPtUnknown = new TH1F ("hPtChargedUnknown","p_T distribution from unknown", nptbins,ptmin,ptmax); | |
181 | fhPtUnknown->SetXTitle("p_{T} (GeV/c)"); | |
182 | outputContainer->Add(fhPtUnknown); | |
183 | ||
184 | fhPhiUnknown = new TH2F ("hPhiChargedUnknown","#phi distribution from unknown",nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
185 | fhPhiUnknown->SetXTitle("#phi (rad)"); | |
186 | outputContainer->Add(fhPhiUnknown); | |
187 | ||
188 | fhEtaUnknown = new TH2F ("hEtaChargedUnknown","#eta distribution from unknown",nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
189 | fhEtaUnknown->SetXTitle("#eta "); | |
190 | outputContainer->Add(fhEtaUnknown); | |
191 | ||
192 | } | |
193 | return outputContainer; | |
194 | } | |
195 | ||
196 | //__________________________________________________ | |
197 | void AliAnaChargedParticles::InitParameters() | |
198 | { | |
199 | //Initialize the parameters of the analysis. | |
200 | SetOutputAODClassName("AliAODPWG4Particle"); | |
201 | SetOutputAODName("Charged"); | |
202 | fPdg = -1; //Select all tracks | |
203 | ||
204 | } | |
205 | ||
206 | //__________________________________________________________________ | |
207 | void AliAnaChargedParticles::Print(const Option_t * opt) const | |
208 | { | |
209 | //Print some relevant parameters set for the analysis | |
210 | if(! opt) | |
211 | return; | |
212 | ||
213 | printf("Min Pt = %3.2f\n", GetMinPt()); | |
214 | printf("Max Pt = %3.2f\n", GetMaxPt()); | |
215 | printf("Select clusters with pdg %d \n",fPdg); | |
216 | ||
217 | } | |
218 | ||
219 | //____________________________________________________________________________ | |
220 | void AliAnaChargedParticles::Init() | |
221 | { | |
222 | //Init | |
223 | //Do some checks | |
224 | if(!GetReader()->IsCTSSwitchedOn()){ | |
225 | printf("!!ABORT: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n"); | |
226 | abort(); | |
227 | } | |
228 | ||
229 | } | |
230 | ||
231 | //__________________________________________________________________ | |
232 | void AliAnaChargedParticles::MakeAnalysisFillAOD() | |
233 | { | |
234 | //Do analysis and fill aods | |
235 | if(!GetAODCTS() || GetAODCTS()->GetEntriesFast() == 0) return ; | |
236 | Int_t ntracks = GetAODCTS()->GetEntriesFast(); | |
237 | ||
238 | //Some prints | |
239 | if(GetDebug() > 0) | |
240 | printf("AliAnaChargedParticles : in CTS aod entries %d\n", ntracks); | |
241 | ||
242 | //Fill AODParticle with CTS aods | |
243 | TVector3 p3; | |
244 | for(Int_t i = 0; i < ntracks; i++){ | |
245 | ||
246 | AliAODTrack * track = (AliAODTrack*) (GetAODCTS()->At(i)); | |
247 | ||
248 | //Fill AODParticle after some selection | |
249 | Double_t mom[3] = {track->Px(),track->Py(),track->Pz()}; | |
250 | p3.SetXYZ(mom[0],mom[1],mom[2]); | |
251 | ||
252 | //Acceptance selection | |
253 | Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"CTS") ; | |
254 | if(GetDebug() > 1) printf("track pt %2.2f, phi %2.2f, in fidutial cut %d\n",p3.Pt(), p3.Phi(), in); | |
255 | if(p3.Pt() > GetMinPt() && in) { | |
256 | //Keep only particles identified with fPdg | |
257 | //Selection not done for the moment | |
258 | //Should be done here. | |
259 | ||
260 | AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0); | |
261 | tr.SetDetector("CTS"); | |
262 | tr.SetLabel(track->GetLabel()); | |
263 | tr.SetTrackLabel(track->GetID(),-1); | |
264 | AddAODParticle(tr); | |
265 | }//selection | |
266 | }//loop | |
267 | ||
268 | if(GetDebug() > 0) | |
269 | printf("AliAnaChargedParticles: final aod branch entries %d\n", GetOutputAODBranch()->GetEntriesFast()); | |
270 | } | |
271 | ||
272 | //__________________________________________________________________ | |
273 | void AliAnaChargedParticles::MakeAnalysisFillHistograms() | |
274 | { | |
275 | //Do analysis and fill histograms | |
276 | ||
277 | //Loop on stored AODParticles | |
278 | Int_t naod = GetOutputAODBranch()->GetEntriesFast(); | |
279 | if(GetDebug() > 0) printf("AliAnaChargedParticles::histo aod branch entries %d\n", naod); | |
280 | for(Int_t iaod = 0; iaod < naod ; iaod++){ | |
281 | AliAODPWG4Particle* tr = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod)); | |
282 | ||
283 | fhPt->Fill(tr->Pt()); | |
284 | fhPhi->Fill(tr->Pt(), tr->Phi()); | |
285 | fhEta->Fill(tr->Pt(), tr->Eta()); | |
286 | ||
287 | if(IsDataMC()){ | |
288 | //Play with the MC stack if available | |
289 | TParticle * mom = GetMCStack()->Particle(tr->GetLabel()); | |
290 | Int_t mompdg =TMath::Abs(mom->GetPdgCode()); | |
291 | ||
292 | if(mompdg==211){ | |
293 | fhPtPion->Fill(tr->Pt()); | |
294 | fhPhiPion->Fill(tr->Pt(), tr->Phi()); | |
295 | fhEtaPion->Fill(tr->Pt(), tr->Eta()); | |
296 | } | |
297 | else if(mompdg==2212){ | |
298 | fhPtProton->Fill(tr->Pt()); | |
299 | fhPhiProton->Fill(tr->Pt(), tr->Phi()); | |
300 | fhEtaProton->Fill(tr->Pt(), tr->Eta()); | |
301 | } | |
302 | else if(mompdg==321){ | |
303 | fhPtKaon->Fill(tr->Pt()); | |
304 | fhPhiKaon->Fill(tr->Pt(), tr->Phi()); | |
305 | fhEtaKaon->Fill(tr->Pt(), tr->Eta()); | |
306 | } | |
307 | else if(mompdg==11){ | |
308 | fhPtElectron->Fill(tr->Pt()); | |
309 | fhPhiElectron->Fill(tr->Pt(), tr->Phi()); | |
310 | fhEtaElectron->Fill(tr->Pt(), tr->Eta()); | |
311 | } | |
312 | else { | |
313 | //printf("unknown pdg %d\n",mompdg); | |
314 | fhPtUnknown->Fill(tr->Pt()); | |
315 | fhPhiUnknown->Fill(tr->Pt(), tr->Phi()); | |
316 | fhEtaUnknown->Fill(tr->Pt(), tr->Eta()); | |
317 | } | |
318 | }//Work with stack also | |
319 | }// aod branch loop | |
320 | ||
321 | } |