]>
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 --- | |
477d6cee | 28 | #include "TParticle.h" |
29 | #include "TH2F.h" | |
30 | ||
31 | //---- AliRoot system ---- | |
32 | #include "AliAnaChargedParticles.h" | |
33 | #include "AliCaloTrackReader.h" | |
34 | #include "AliAODPWG4Particle.h" | |
35 | #include "AliStack.h" | |
ff45398a | 36 | #include "AliFiducialCut.h" |
477d6cee | 37 | #include "AliAODTrack.h" |
591cc579 | 38 | #include "AliAODMCParticle.h" |
477d6cee | 39 | |
40 | ClassImp(AliAnaChargedParticles) | |
41 | ||
42 | //____________________________________________________________________________ | |
43 | AliAnaChargedParticles::AliAnaChargedParticles() : | |
44 | AliAnaPartCorrBaseClass(),fPdg(0), fhPt(0),fhPhi(0),fhEta(0), | |
45 | fhPtPion(0),fhPhiPion(0),fhEtaPion(0), | |
46 | fhPtProton(0),fhPhiProton(0),fhEtaProton(0), | |
47 | fhPtElectron(0),fhPhiElectron(0),fhEtaElectron(0), | |
48 | fhPtKaon(0),fhPhiKaon(0),fhEtaKaon(0), | |
49 | fhPtUnknown(0),fhPhiUnknown(0),fhEtaUnknown(0) | |
50 | ||
51 | { | |
52 | //Default Ctor | |
53 | ||
54 | //Initialize parameters | |
55 | InitParameters(); | |
56 | } | |
57 | ||
78219bac | 58 | /* |
477d6cee | 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 | } | |
78219bac | 95 | */ |
477d6cee | 96 | |
97 | //________________________________________________________________________ | |
98 | TList * AliAnaChargedParticles::GetCreateOutputObjects() | |
99 | { | |
100 | // Create histograms to be saved in output file and | |
101 | // store them in fOutputContainer | |
102 | ||
103 | ||
104 | TList * outputContainer = new TList() ; | |
105 | outputContainer->SetName("ExampleHistos") ; | |
106 | ||
5a2dbc3c | 107 | Int_t nptbins = GetHistoPtBins(); |
108 | Int_t nphibins = GetHistoPhiBins(); | |
109 | Int_t netabins = GetHistoEtaBins(); | |
477d6cee | 110 | Float_t ptmax = GetHistoPtMax(); |
111 | Float_t phimax = GetHistoPhiMax(); | |
112 | Float_t etamax = GetHistoEtaMax(); | |
113 | Float_t ptmin = GetHistoPtMin(); | |
114 | Float_t phimin = GetHistoPhiMin(); | |
115 | Float_t etamin = GetHistoEtaMin(); | |
116 | ||
117 | fhPt = new TH1F ("hPtCharged","p_T distribution", nptbins,ptmin,ptmax); | |
118 | fhPt->SetXTitle("p_{T} (GeV/c)"); | |
119 | outputContainer->Add(fhPt); | |
120 | ||
121 | fhPhi = new TH2F ("hPhiCharged","#phi distribution",nptbins,ptmin,ptmax, nphibins,phimin,phimax); | |
122 | fhPhi->SetXTitle("#phi (rad)"); | |
123 | outputContainer->Add(fhPhi); | |
124 | ||
125 | fhEta = new TH2F ("hEtaCharged","#eta distribution",nptbins,ptmin,ptmax, netabins,etamin,etamax); | |
126 | fhEta->SetXTitle("#eta "); | |
127 | outputContainer->Add(fhEta); | |
128 | ||
129 | ||
130 | if(IsDataMC()){ | |
131 | ||
a3aebfff | 132 | fhPtPion = new TH1F ("hPtMCPion","p_T distribution from #pi", nptbins,ptmin,ptmax); |
477d6cee | 133 | fhPtPion->SetXTitle("p_{T} (GeV/c)"); |
134 | outputContainer->Add(fhPtPion); | |
135 | ||
a3aebfff | 136 | fhPhiPion = new TH2F ("hPhiMCPion","#phi distribution from #pi",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 137 | fhPhiPion->SetXTitle("#phi (rad)"); |
138 | outputContainer->Add(fhPhiPion); | |
139 | ||
a3aebfff | 140 | fhEtaPion = new TH2F ("hEtaMCPion","#eta distribution from #pi",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 141 | fhEtaPion->SetXTitle("#eta "); |
142 | outputContainer->Add(fhEtaPion); | |
143 | ||
a3aebfff | 144 | fhPtProton = new TH1F ("hPtMCProton","p_T distribution from proton", nptbins,ptmin,ptmax); |
477d6cee | 145 | fhPtProton->SetXTitle("p_{T} (GeV/c)"); |
146 | outputContainer->Add(fhPtProton); | |
147 | ||
a3aebfff | 148 | fhPhiProton = new TH2F ("hPhiMCProton","#phi distribution from proton",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 149 | fhPhiProton->SetXTitle("#phi (rad)"); |
150 | outputContainer->Add(fhPhiProton); | |
151 | ||
a3aebfff | 152 | fhEtaProton = new TH2F ("hEtaMCProton","#eta distribution from proton",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 153 | fhEtaProton->SetXTitle("#eta "); |
154 | outputContainer->Add(fhEtaProton); | |
155 | ||
a3aebfff | 156 | fhPtKaon = new TH1F ("hPtMCKaon","p_T distribution from kaon", nptbins,ptmin,ptmax); |
477d6cee | 157 | fhPtKaon->SetXTitle("p_{T} (GeV/c)"); |
158 | outputContainer->Add(fhPtKaon); | |
159 | ||
a3aebfff | 160 | fhPhiKaon = new TH2F ("hPhiMCKaon","#phi distribution from kaon",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 161 | fhPhiKaon->SetXTitle("#phi (rad)"); |
162 | outputContainer->Add(fhPhiKaon); | |
163 | ||
a3aebfff | 164 | fhEtaKaon = new TH2F ("hEtaMCKaon","#eta distribution from kaon",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 165 | fhEtaKaon->SetXTitle("#eta "); |
166 | outputContainer->Add(fhEtaKaon); | |
167 | ||
a3aebfff | 168 | fhPtElectron = new TH1F ("hPtMCElectron","p_T distribution from electron", nptbins,ptmin,ptmax); |
477d6cee | 169 | fhPtElectron->SetXTitle("p_{T} (GeV/c)"); |
170 | outputContainer->Add(fhPtElectron); | |
171 | ||
a3aebfff | 172 | fhPhiElectron = new TH2F ("hPhiMCElectron","#phi distribution from electron",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 173 | fhPhiElectron->SetXTitle("#phi (rad)"); |
174 | outputContainer->Add(fhPhiElectron); | |
175 | ||
a3aebfff | 176 | fhEtaElectron = new TH2F ("hEtaMCElectron","#eta distribution from electron",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 177 | fhEtaElectron->SetXTitle("#eta "); |
178 | outputContainer->Add(fhEtaElectron); | |
179 | ||
a3aebfff | 180 | fhPtUnknown = new TH1F ("hPtMCUnknown","p_T distribution from unknown", nptbins,ptmin,ptmax); |
477d6cee | 181 | fhPtUnknown->SetXTitle("p_{T} (GeV/c)"); |
182 | outputContainer->Add(fhPtUnknown); | |
183 | ||
a3aebfff | 184 | fhPhiUnknown = new TH2F ("hPhiMCUnknown","#phi distribution from unknown",nptbins,ptmin,ptmax, nphibins,phimin,phimax); |
477d6cee | 185 | fhPhiUnknown->SetXTitle("#phi (rad)"); |
186 | outputContainer->Add(fhPhiUnknown); | |
187 | ||
a3aebfff | 188 | fhEtaUnknown = new TH2F ("hEtaMCUnknown","#eta distribution from unknown",nptbins,ptmin,ptmax, netabins,etamin,etamax); |
477d6cee | 189 | fhEtaUnknown->SetXTitle("#eta "); |
190 | outputContainer->Add(fhEtaUnknown); | |
191 | ||
192 | } | |
a3aebfff | 193 | |
477d6cee | 194 | return outputContainer; |
a3aebfff | 195 | |
477d6cee | 196 | } |
197 | ||
198 | //__________________________________________________ | |
199 | void AliAnaChargedParticles::InitParameters() | |
200 | { | |
201 | //Initialize the parameters of the analysis. | |
202 | SetOutputAODClassName("AliAODPWG4Particle"); | |
a3aebfff | 203 | SetOutputAODName("PWG4Particle"); |
204 | ||
205 | AddToHistogramsName("AnaCharged_"); | |
206 | ||
477d6cee | 207 | fPdg = -1; //Select all tracks |
208 | ||
209 | } | |
210 | ||
211 | //__________________________________________________________________ | |
212 | void AliAnaChargedParticles::Print(const Option_t * opt) const | |
213 | { | |
214 | //Print some relevant parameters set for the analysis | |
215 | if(! opt) | |
216 | return; | |
217 | ||
a3aebfff | 218 | printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ; |
219 | AliAnaPartCorrBaseClass::Print(" "); | |
220 | ||
477d6cee | 221 | printf("Min Pt = %3.2f\n", GetMinPt()); |
222 | printf("Max Pt = %3.2f\n", GetMaxPt()); | |
223 | printf("Select clusters with pdg %d \n",fPdg); | |
224 | ||
225 | } | |
226 | ||
227 | //____________________________________________________________________________ | |
228 | void AliAnaChargedParticles::Init() | |
229 | { | |
230 | //Init | |
231 | //Do some checks | |
232 | if(!GetReader()->IsCTSSwitchedOn()){ | |
7cd4e982 | 233 | printf("AliAnaChargedParticles::Init() - STOP!: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n"); |
477d6cee | 234 | abort(); |
235 | } | |
236 | ||
237 | } | |
238 | ||
239 | //__________________________________________________________________ | |
240 | void AliAnaChargedParticles::MakeAnalysisFillAOD() | |
241 | { | |
242 | //Do analysis and fill aods | |
243 | if(!GetAODCTS() || GetAODCTS()->GetEntriesFast() == 0) return ; | |
244 | Int_t ntracks = GetAODCTS()->GetEntriesFast(); | |
245 | ||
246 | //Some prints | |
247 | if(GetDebug() > 0) | |
a3aebfff | 248 | printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - In CTS aod entries %d\n", ntracks); |
477d6cee | 249 | |
250 | //Fill AODParticle with CTS aods | |
251 | TVector3 p3; | |
252 | for(Int_t i = 0; i < ntracks; i++){ | |
253 | ||
254 | AliAODTrack * track = (AliAODTrack*) (GetAODCTS()->At(i)); | |
255 | ||
256 | //Fill AODParticle after some selection | |
257 | Double_t mom[3] = {track->Px(),track->Py(),track->Pz()}; | |
258 | p3.SetXYZ(mom[0],mom[1],mom[2]); | |
259 | ||
260 | //Acceptance selection | |
ff45398a | 261 | Bool_t in = GetFiducialCut()->IsInFiducialCut(mom,"CTS") ; |
262 | if(GetDebug() > 1) printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Track pt %2.2f, phi %2.2f, in fiducial cut %d\n",p3.Pt(), p3.Phi(), in); | |
477d6cee | 263 | if(p3.Pt() > GetMinPt() && in) { |
264 | //Keep only particles identified with fPdg | |
265 | //Selection not done for the moment | |
266 | //Should be done here. | |
267 | ||
268 | AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0); | |
269 | tr.SetDetector("CTS"); | |
270 | tr.SetLabel(track->GetLabel()); | |
271 | tr.SetTrackLabel(track->GetID(),-1); | |
7cd4e982 | 272 | //Input from second AOD? |
1e68a3f4 | 273 | //if(GetReader()->GetAODCTSNormalInputEntries() <= i) tr.SetInputFileIndex(1); |
7cd4e982 | 274 | |
477d6cee | 275 | AddAODParticle(tr); |
276 | }//selection | |
277 | }//loop | |
278 | ||
279 | if(GetDebug() > 0) | |
a3aebfff | 280 | printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Final aod branch entries %d\n", GetOutputAODBranch()->GetEntriesFast()); |
477d6cee | 281 | } |
282 | ||
283 | //__________________________________________________________________ | |
284 | void AliAnaChargedParticles::MakeAnalysisFillHistograms() | |
285 | { | |
286 | //Do analysis and fill histograms | |
287 | ||
288 | //Loop on stored AODParticles | |
289 | Int_t naod = GetOutputAODBranch()->GetEntriesFast(); | |
a3aebfff | 290 | if(GetDebug() > 0) printf("AliAnaChargedParticles::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod); |
477d6cee | 291 | for(Int_t iaod = 0; iaod < naod ; iaod++){ |
292 | AliAODPWG4Particle* tr = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod)); | |
293 | ||
294 | fhPt->Fill(tr->Pt()); | |
295 | fhPhi->Fill(tr->Pt(), tr->Phi()); | |
296 | fhEta->Fill(tr->Pt(), tr->Eta()); | |
297 | ||
298 | if(IsDataMC()){ | |
299 | //Play with the MC stack if available | |
591cc579 | 300 | Int_t mompdg = -1; |
7cd4e982 | 301 | Int_t label = tr->GetLabel(); |
591cc579 | 302 | if(GetReader()->ReadStack()){ |
303 | TParticle * mom = GetMCStack()->Particle(label); | |
304 | mompdg =TMath::Abs(mom->GetPdgCode()); | |
305 | } | |
7cd4e982 | 306 | else if(GetReader()->ReadAODMCParticles()){ |
591cc579 | 307 | AliAODMCParticle * aodmom = 0; |
308 | //Get the list of MC particles | |
7cd4e982 | 309 | aodmom = (AliAODMCParticle*) (GetReader()->GetAODMCParticles(tr->GetInputFileIndex()))->At(label); |
310 | mompdg =TMath::Abs(aodmom->GetPdgCode()); | |
311 | } | |
591cc579 | 312 | |
7cd4e982 | 313 | if(mompdg==211){ |
477d6cee | 314 | fhPtPion->Fill(tr->Pt()); |
315 | fhPhiPion->Fill(tr->Pt(), tr->Phi()); | |
316 | fhEtaPion->Fill(tr->Pt(), tr->Eta()); | |
317 | } | |
318 | else if(mompdg==2212){ | |
319 | fhPtProton->Fill(tr->Pt()); | |
320 | fhPhiProton->Fill(tr->Pt(), tr->Phi()); | |
321 | fhEtaProton->Fill(tr->Pt(), tr->Eta()); | |
322 | } | |
323 | else if(mompdg==321){ | |
324 | fhPtKaon->Fill(tr->Pt()); | |
325 | fhPhiKaon->Fill(tr->Pt(), tr->Phi()); | |
326 | fhEtaKaon->Fill(tr->Pt(), tr->Eta()); | |
327 | } | |
328 | else if(mompdg==11){ | |
329 | fhPtElectron->Fill(tr->Pt()); | |
330 | fhPhiElectron->Fill(tr->Pt(), tr->Phi()); | |
331 | fhEtaElectron->Fill(tr->Pt(), tr->Eta()); | |
332 | } | |
333 | else { | |
334 | //printf("unknown pdg %d\n",mompdg); | |
335 | fhPtUnknown->Fill(tr->Pt()); | |
336 | fhPhiUnknown->Fill(tr->Pt(), tr->Phi()); | |
337 | fhEtaUnknown->Fill(tr->Pt(), tr->Eta()); | |
338 | } | |
339 | }//Work with stack also | |
340 | }// aod branch loop | |
341 | ||
342 | } |