1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 //_________________________________________________________________________
19 // Class for track selection and identification (not done now)
20 // Tracks from the CTS are kept in the AOD.
21 // Few histograms produced.
23 //-- Author: Gustavo Conesa (INFN-LNF)
24 //_________________________________________________________________________
27 // --- ROOT system ---
28 #include "TClonesArray.h"
29 #include "TParticle.h"
32 //---- AliRoot system ----
33 #include "AliAnaChargedParticles.h"
34 #include "AliCaloTrackReader.h"
35 #include "AliAODPWG4Particle.h"
37 #include "AliCaloPID.h"
38 #include "AliFidutialCut.h"
39 #include "AliAODTrack.h"
41 ClassImp(AliAnaChargedParticles)
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)
55 //Initialize parameters
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)
73 //_________________________________________________________________________
74 AliAnaChargedParticles & AliAnaChargedParticles::operator = (const AliAnaChargedParticles & ch)
76 // assignment operator
78 if(this == &ch)return *this;
79 ((AliAnaPartCorrBaseClass *)this)->operator=(ch);
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;
96 //________________________________________________________________________
97 TList * AliAnaChargedParticles::GetCreateOutputObjects()
99 // Create histograms to be saved in output file and
100 // store them in fOutputContainer
103 TList * outputContainer = new TList() ;
104 outputContainer->SetName("ExampleHistos") ;
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();
116 fhPt = new TH1F ("hPtCharged","p_T distribution", nptbins,ptmin,ptmax);
117 fhPt->SetXTitle("p_{T} (GeV/c)");
118 outputContainer->Add(fhPt);
120 fhPhi = new TH2F ("hPhiCharged","#phi distribution",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
121 fhPhi->SetXTitle("#phi (rad)");
122 outputContainer->Add(fhPhi);
124 fhEta = new TH2F ("hEtaCharged","#eta distribution",nptbins,ptmin,ptmax, netabins,etamin,etamax);
125 fhEta->SetXTitle("#eta ");
126 outputContainer->Add(fhEta);
131 fhPtPion = new TH1F ("hPtMCPion","p_T distribution from #pi", nptbins,ptmin,ptmax);
132 fhPtPion->SetXTitle("p_{T} (GeV/c)");
133 outputContainer->Add(fhPtPion);
135 fhPhiPion = new TH2F ("hPhiMCPion","#phi distribution from #pi",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
136 fhPhiPion->SetXTitle("#phi (rad)");
137 outputContainer->Add(fhPhiPion);
139 fhEtaPion = new TH2F ("hEtaMCPion","#eta distribution from #pi",nptbins,ptmin,ptmax, netabins,etamin,etamax);
140 fhEtaPion->SetXTitle("#eta ");
141 outputContainer->Add(fhEtaPion);
143 fhPtProton = new TH1F ("hPtMCProton","p_T distribution from proton", nptbins,ptmin,ptmax);
144 fhPtProton->SetXTitle("p_{T} (GeV/c)");
145 outputContainer->Add(fhPtProton);
147 fhPhiProton = new TH2F ("hPhiMCProton","#phi distribution from proton",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
148 fhPhiProton->SetXTitle("#phi (rad)");
149 outputContainer->Add(fhPhiProton);
151 fhEtaProton = new TH2F ("hEtaMCProton","#eta distribution from proton",nptbins,ptmin,ptmax, netabins,etamin,etamax);
152 fhEtaProton->SetXTitle("#eta ");
153 outputContainer->Add(fhEtaProton);
155 fhPtKaon = new TH1F ("hPtMCKaon","p_T distribution from kaon", nptbins,ptmin,ptmax);
156 fhPtKaon->SetXTitle("p_{T} (GeV/c)");
157 outputContainer->Add(fhPtKaon);
159 fhPhiKaon = new TH2F ("hPhiMCKaon","#phi distribution from kaon",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
160 fhPhiKaon->SetXTitle("#phi (rad)");
161 outputContainer->Add(fhPhiKaon);
163 fhEtaKaon = new TH2F ("hEtaMCKaon","#eta distribution from kaon",nptbins,ptmin,ptmax, netabins,etamin,etamax);
164 fhEtaKaon->SetXTitle("#eta ");
165 outputContainer->Add(fhEtaKaon);
167 fhPtElectron = new TH1F ("hPtMCElectron","p_T distribution from electron", nptbins,ptmin,ptmax);
168 fhPtElectron->SetXTitle("p_{T} (GeV/c)");
169 outputContainer->Add(fhPtElectron);
171 fhPhiElectron = new TH2F ("hPhiMCElectron","#phi distribution from electron",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
172 fhPhiElectron->SetXTitle("#phi (rad)");
173 outputContainer->Add(fhPhiElectron);
175 fhEtaElectron = new TH2F ("hEtaMCElectron","#eta distribution from electron",nptbins,ptmin,ptmax, netabins,etamin,etamax);
176 fhEtaElectron->SetXTitle("#eta ");
177 outputContainer->Add(fhEtaElectron);
179 fhPtUnknown = new TH1F ("hPtMCUnknown","p_T distribution from unknown", nptbins,ptmin,ptmax);
180 fhPtUnknown->SetXTitle("p_{T} (GeV/c)");
181 outputContainer->Add(fhPtUnknown);
183 fhPhiUnknown = new TH2F ("hPhiMCUnknown","#phi distribution from unknown",nptbins,ptmin,ptmax, nphibins,phimin,phimax);
184 fhPhiUnknown->SetXTitle("#phi (rad)");
185 outputContainer->Add(fhPhiUnknown);
187 fhEtaUnknown = new TH2F ("hEtaMCUnknown","#eta distribution from unknown",nptbins,ptmin,ptmax, netabins,etamin,etamax);
188 fhEtaUnknown->SetXTitle("#eta ");
189 outputContainer->Add(fhEtaUnknown);
193 return outputContainer;
197 //__________________________________________________
198 void AliAnaChargedParticles::InitParameters()
200 //Initialize the parameters of the analysis.
201 SetOutputAODClassName("AliAODPWG4Particle");
202 SetOutputAODName("PWG4Particle");
204 AddToHistogramsName("AnaCharged_");
206 fPdg = -1; //Select all tracks
210 //__________________________________________________________________
211 void AliAnaChargedParticles::Print(const Option_t * opt) const
213 //Print some relevant parameters set for the analysis
217 printf("**** Print %s %s ****\n", GetName(), GetTitle() ) ;
218 AliAnaPartCorrBaseClass::Print(" ");
220 printf("Min Pt = %3.2f\n", GetMinPt());
221 printf("Max Pt = %3.2f\n", GetMaxPt());
222 printf("Select clusters with pdg %d \n",fPdg);
226 //____________________________________________________________________________
227 void AliAnaChargedParticles::Init()
231 if(!GetReader()->IsCTSSwitchedOn()){
232 printf("AliAnaChargedParticles::Init() - !!ABORT: You want to use CTS tracks in analysis but not read!! \n!!Check the configuration file!!\n");
238 //__________________________________________________________________
239 void AliAnaChargedParticles::MakeAnalysisFillAOD()
241 //Do analysis and fill aods
242 if(!GetAODCTS() || GetAODCTS()->GetEntriesFast() == 0) return ;
243 Int_t ntracks = GetAODCTS()->GetEntriesFast();
247 printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - In CTS aod entries %d\n", ntracks);
249 //Fill AODParticle with CTS aods
251 for(Int_t i = 0; i < ntracks; i++){
253 AliAODTrack * track = (AliAODTrack*) (GetAODCTS()->At(i));
255 //Fill AODParticle after some selection
256 Double_t mom[3] = {track->Px(),track->Py(),track->Pz()};
257 p3.SetXYZ(mom[0],mom[1],mom[2]);
259 //Acceptance selection
260 Bool_t in = GetFidutialCut()->IsInFidutialCut(mom,"CTS") ;
261 if(GetDebug() > 1) printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Track pt %2.2f, phi %2.2f, in fidutial cut %d\n",p3.Pt(), p3.Phi(), in);
262 if(p3.Pt() > GetMinPt() && in) {
263 //Keep only particles identified with fPdg
264 //Selection not done for the moment
265 //Should be done here.
267 AliAODPWG4Particle tr = AliAODPWG4Particle(mom[0],mom[1],mom[2],0);
268 tr.SetDetector("CTS");
269 tr.SetLabel(track->GetLabel());
270 tr.SetTrackLabel(track->GetID(),-1);
276 printf("AliAnaChargedParticles::MakeAnalysisFillAOD() - Final aod branch entries %d\n", GetOutputAODBranch()->GetEntriesFast());
279 //__________________________________________________________________
280 void AliAnaChargedParticles::MakeAnalysisFillHistograms()
282 //Do analysis and fill histograms
284 //Loop on stored AODParticles
285 Int_t naod = GetOutputAODBranch()->GetEntriesFast();
286 if(GetDebug() > 0) printf("AliAnaChargedParticles::MakeAnalysisFillHistograms() - aod branch entries %d\n", naod);
287 for(Int_t iaod = 0; iaod < naod ; iaod++){
288 AliAODPWG4Particle* tr = (AliAODPWG4Particle*) (GetOutputAODBranch()->At(iaod));
290 fhPt->Fill(tr->Pt());
291 fhPhi->Fill(tr->Pt(), tr->Phi());
292 fhEta->Fill(tr->Pt(), tr->Eta());
295 //Play with the MC stack if available
296 TParticle * mom = GetMCStack()->Particle(tr->GetLabel());
297 Int_t mompdg =TMath::Abs(mom->GetPdgCode());
300 fhPtPion->Fill(tr->Pt());
301 fhPhiPion->Fill(tr->Pt(), tr->Phi());
302 fhEtaPion->Fill(tr->Pt(), tr->Eta());
304 else if(mompdg==2212){
305 fhPtProton->Fill(tr->Pt());
306 fhPhiProton->Fill(tr->Pt(), tr->Phi());
307 fhEtaProton->Fill(tr->Pt(), tr->Eta());
309 else if(mompdg==321){
310 fhPtKaon->Fill(tr->Pt());
311 fhPhiKaon->Fill(tr->Pt(), tr->Phi());
312 fhEtaKaon->Fill(tr->Pt(), tr->Eta());
315 fhPtElectron->Fill(tr->Pt());
316 fhPhiElectron->Fill(tr->Pt(), tr->Phi());
317 fhEtaElectron->Fill(tr->Pt(), tr->Eta());
320 //printf("unknown pdg %d\n",mompdg);
321 fhPtUnknown->Fill(tr->Pt());
322 fhPhiUnknown->Fill(tr->Pt(), tr->Phi());
323 fhEtaUnknown->Fill(tr->Pt(), tr->Eta());
325 }//Work with stack also