]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliGammaDataReader.cxx
Corrected coding violations
[u/mrichter/AliRoot.git] / PWG4 / AliGammaDataReader.cxx
CommitLineData
bdcfac30 1
2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16/* $Id$ */
17
18/* History of cvs commits:
19 *
20 * $Log$
4b707925 21 * Revision 1.2 2007/08/17 12:40:04 schutz
22 * New analysis classes by Gustavo Conesa
23 *
bdcfac30 24 * Revision 1.1.2.1 2007/07/26 10:32:09 schutz
25 * new analysis classes in the the new analysis framework
26 *
27 *
28 */
29
30//_________________________________________________________________________
31// Class for reading data (ESDs) in order to do prompt gamma correlations
32// Class created from old AliPHOSGammaJet
33// (see AliRoot versions previous Release 4-09)
34//
35//*-- Author: Gustavo Conesa (LNF-INFN)
36//////////////////////////////////////////////////////////////////////////////
37
38
39// --- ROOT system ---
bdcfac30 40#include <TParticle.h>
3bb2c538 41#include <TFormula.h>
bdcfac30 42
43//---- ANALYSIS system ----
44#include "AliGammaDataReader.h"
bdcfac30 45#include "AliESDEvent.h"
46#include "AliESDVertex.h"
47#include "AliESDCaloCluster.h"
3bb2c538 48#include "AliLog.h"
bdcfac30 49
50ClassImp(AliGammaDataReader)
51
52//____________________________________________________________________________
53AliGammaDataReader::AliGammaDataReader() :
4b707925 54 AliGammaReader()
bdcfac30 55{
56 //Default Ctor
57
58 //Initialize parameters
59 fDataType=kData;
bdcfac30 60
61}
62
63//____________________________________________________________________________
64AliGammaDataReader::AliGammaDataReader(const AliGammaDataReader & g) :
4b707925 65 AliGammaReader(g)
bdcfac30 66{
67 // cpy ctor
68}
69
70//_________________________________________________________________________
71AliGammaDataReader & AliGammaDataReader::operator = (const AliGammaDataReader & source)
72{
73 // assignment operator
74
75 if(&source == this) return *this;
76
bdcfac30 77 return *this;
78
79}
80
81//____________________________________________________________________________
82void AliGammaDataReader::CreateParticleList(TObject * data, TObject *,
83 TClonesArray * plCTS,
84 TClonesArray * plEMCAL,
4b707925 85 TClonesArray * plPHOS,
86 TClonesArray * ,
87 TClonesArray * ,
88 TClonesArray * ){
bdcfac30 89
90 //Create a list of particles from the ESD. These particles have been measured
3bb2c538 91 //by the Central Tracking system (TPC+ITS+...), PHOS and EMCAL
bdcfac30 92
93 AliESDEvent* esd = (AliESDEvent*) data;
94
95 Int_t npar = 0 ;
4b707925 96 Double_t *pid = new Double_t[AliPID::kSPECIESN];
bdcfac30 97 AliDebug(3,"Fill particle lists");
98
99 //Get vertex for momentum calculation
100 Double_t v[3] ; //vertex ;
101 esd->GetVertex()->GetXYZ(v) ;
102
3bb2c538 103 //########### CALORIMETERS ##############
104
105 Int_t nCaloCluster = esd->GetNumberOfCaloClusters() ;
bdcfac30 106 Int_t indexPH = plPHOS->GetEntries() ;
3bb2c538 107 Int_t indexEM = plEMCAL->GetEntries() ;
bdcfac30 108
bdcfac30 109
3bb2c538 110 for (npar = 0; npar < nCaloCluster; npar++) {//////////////CaloCluster loop
111 AliESDCaloCluster * clus = esd->GetCaloCluster(npar) ; // retrieve cluster from esd
112 Int_t type = clus->GetClusterType();
113
114 //########### PHOS ##############
115 if(fSwitchOnPHOS && type == AliESDCaloCluster::kPHOSCluster){
116 AliDebug(4,Form("PHOS clusters: E %f, match %d", clus->E(),clus->GetTrackMatched()));
117
118 if(clus->GetTrackMatched()==-1){
119 TLorentzVector momentum ;
120 clus->GetMomentum(momentum, v);
121 Double_t phi = momentum.Phi();
122 if(phi<0) phi+=TMath::TwoPi() ;
123 if(momentum.Pt() > fNeutralPtCut && TMath::Abs(momentum.Eta()) < fPHOSEtaCut &&
124 phi > fPhiPHOSCut[0] && phi < fPhiPHOSCut[1] ) {
4b707925 125
3bb2c538 126 pid=clus->GetPid();
127 Int_t pdg = 22;
128
129 if(IsPHOSPIDOn()){
130 AliDebug(5,Form("E %1.2f; PID: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f ",
131 momentum.E(),pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion],
132 pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]));
133
134 Float_t wPhoton = fPHOSPhotonWeight;
135 Float_t wPi0 = fPHOSPi0Weight;
136
137 if(fPHOSWeightFormula){
138 wPhoton = fPHOSPhotonWeightFormula->Eval(momentum.E()) ;
139 wPi0 = fPHOSPi0WeightFormula->Eval(momentum.E());
140 }
141
142 if(pid[AliPID::kPhoton] > wPhoton)
143 pdg = kPhoton ;
144 else if(pid[AliPID::kPi0] > wPi0)
145 pdg = kPi0 ;
146 else if(pid[AliPID::kElectron] > fPHOSElectronWeight)
147 pdg = kElectron ;
148 else if(pid[AliPID::kEleCon] > fPHOSElectronWeight)
149 pdg = kEleCon ;
150 else if(pid[AliPID::kPion]+pid[AliPID::kKaon]+pid[AliPID::kProton] > fPHOSChargeWeight)
151 pdg = kChargedHadron ;
152 else if(pid[AliPID::kKaon0]+pid[AliPID::kNeutron] > fPHOSNeutralWeight)
153 pdg = kNeutralHadron ;
154
155 else if(pid[AliPID::kElectron]+pid[AliPID::kEleCon]+pid[AliPID::kPion]+pid[AliPID::kKaon]+pid[AliPID::kProton] >
156 pid[AliPID::kPhoton] + pid[AliPID::kPi0]+pid[AliPID::kKaon0]+pid[AliPID::kNeutron])
157 pdg = kChargedUnknown ;
158 else
159 pdg = kNeutralUnknown ;
160 //neutral cluster, unidentifed.
161 }
4b707925 162
3bb2c538 163 if(pdg != kElectron && pdg != kEleCon && pdg !=kChargedHadron && pdg !=kChargedUnknown ){//keep only neutral particles in the array
164 TParticle * particle = new TParticle(pdg, 1, -1, -1, -1, -1,
165 momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E(), v[0], v[1], v[2], 0);
166
167 AliDebug(4,Form("PHOS added: pdg %d, pt %f, phi %f, eta %f", pdg, particle->Pt(),particle->Phi(),particle->Eta()));
168
169 new((*plPHOS)[indexPH++]) TParticle(*particle) ;
4b707925 170 }
3bb2c538 171 else AliDebug(4,Form("PHOS charged cluster NOT added: pdg %d, pt %f, phi %f, eta %f\n",
172 pdg, momentum.Pt(),momentum.Phi(),momentum.Eta()));
4b707925 173
3bb2c538 174 }//pt, eta, phi cut
175 else AliDebug(4,"Particle not added");
176 }//track-match?
177 }//PHOS cluster
178
179 //################ EMCAL ##############
180 else if(fSwitchOnEMCAL && type == AliESDCaloCluster::kEMCALClusterv1){
181 AliDebug(4,Form("EMCAL clusters: E %f, match %d", clus->E(),clus->GetTrackMatched()));
182
183 if(clus->GetTrackMatched()==-1 ){
184 TLorentzVector momentum ;
185 clus->GetMomentum(momentum, v);
186 Double_t phi = momentum.Phi();
187 if(phi<0) phi+=TMath::TwoPi() ;
188 if(momentum.Pt() > fNeutralPtCut && TMath::Abs(momentum.Eta()) < fEMCALEtaCut &&
189 phi > fPhiEMCALCut[0] && phi < fPhiEMCALCut[1] ) {
4b707925 190
3bb2c538 191 pid=clus->GetPid();
192 Int_t pdg = 22;
4b707925 193
3bb2c538 194 if(IsEMCALPIDOn()){
195 AliDebug(5,Form("E %1.2f; PID: ph %0.2f, pi0 %0.2f, el %0.2f, conv el %0.2f,pi %0.2f, k %0.2f, p %0.2f, k0 %0.2f, n %0.2f, mu %0.2f ",
196 momentum.E(),pid[AliPID::kPhoton],pid[AliPID::kPi0],pid[AliPID::kElectron],pid[AliPID::kEleCon],pid[AliPID::kPion],
197 pid[AliPID::kKaon],pid[AliPID::kProton], pid[AliPID::kKaon0],pid[AliPID::kNeutron], pid[AliPID::kMuon]));
198
199 if(pid[AliPID::kPhoton] > fEMCALPhotonWeight)
200 pdg = kPhoton ;
201 else if(pid[AliPID::kPi0] > fEMCALPi0Weight)
202 pdg = kPi0 ;
203 else if(pid[AliPID::kElectron] > fEMCALElectronWeight)
204 pdg = kElectron ;
205 else if(pid[AliPID::kEleCon] > fEMCALElectronWeight)
206 pdg = kEleCon ;
207 else if(pid[AliPID::kPion]+pid[AliPID::kKaon]+pid[AliPID::kProton] > fEMCALChargeWeight)
208 pdg = kChargedHadron ;
209 else if(pid[AliPID::kKaon0]+pid[AliPID::kNeutron] > fEMCALNeutralWeight)
210 pdg = kNeutralHadron ;
211 else if(pid[AliPID::kElectron]+pid[AliPID::kEleCon]+pid[AliPID::kPion]+pid[AliPID::kKaon]+pid[AliPID::kProton] >
212 pid[AliPID::kPhoton] + pid[AliPID::kPi0]+pid[AliPID::kKaon0]+pid[AliPID::kNeutron])
213 pdg = kChargedUnknown ;
214 else
215 pdg = kNeutralUnknown ;
216 }
217
218 if(pdg != kElectron && pdg != kEleCon && pdg !=kChargedHadron && pdg !=kChargedUnknown){//keep only neutral particles in the array
219
220 TParticle * particle = new TParticle(pdg, 1, -1, -1, -1, -1,
221 momentum.Px(), momentum.Py(), momentum.Pz(), momentum.E(), v[0], v[1], v[2], 0);
222 AliDebug(4,Form("EMCAL cluster added: pdg %f, pt %f, phi %f, eta %f", pdg, particle->Pt(),particle->Phi(),particle->Eta()));
223
224 new((*plEMCAL)[indexEM++]) TParticle(*particle) ;
225 }
226 else AliDebug(4,Form("EMCAL charged cluster NOT added: pdg %d, pt %f, phi %f, eta %f",
227 pdg, momentum.Pt(),momentum.Phi(),momentum.Eta()));
4b707925 228
3bb2c538 229 }//pt, phi, eta cut
230 else AliDebug(4,"Particle not added");
231 }//track-matched
232 }//EMCAL cluster
4b707925 233
bdcfac30 234 }//cluster loop
3bb2c538 235
236
bdcfac30 237 //########### CTS (TPC+ITS) #####################
3bb2c538 238 Int_t nTracks = esd->GetNumberOfTracks() ;
bdcfac30 239 Int_t indexCh = plCTS->GetEntries() ;
bdcfac30 240
3bb2c538 241 if(fSwitchOnCTS){
242 AliDebug(3,Form("Number of tracks %d",nTracks));
bdcfac30 243
3bb2c538 244 for (npar = 0; npar < nTracks; npar++) {////////////// track loop
245 AliESDtrack * track = esd->GetTrack(npar) ; // retrieve track from esd
bdcfac30 246
3bb2c538 247 //We want tracks fitted in the detectors:
248 ULong_t status=AliESDtrack::kTPCrefit;
249 status|=AliESDtrack::kITSrefit;
bdcfac30 250
3bb2c538 251 //We want tracks whose PID bit is set:
252 // ULong_t status =AliESDtrack::kITSpid;
253 // status|=AliESDtrack::kTPCpid;
254
255 if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set
256 // Do something with the tracks which were successfully
257 // re-fitted
258 Double_t en = 0; //track ->GetTPCsignal() ;
259 Double_t mom[3];
260 track->GetPxPyPz(mom) ;
261 Double_t px = mom[0];
262 Double_t py = mom[1];
263 Double_t pz = mom[2]; //Check with TPC people if this is correct.
264 Int_t pdg = 11; //Give any charged PDG code, in this case electron.
265 //I just want to tag the particle as charged
266 TParticle * particle = new TParticle(pdg, 1, -1, -1, -1, -1,
267 px, py, pz, en, v[0], v[1], v[2], 0);
bdcfac30 268
3bb2c538 269 //TParticle * particle = new TParticle() ;
270 //particle->SetMomentum(px,py,pz,en) ;
271 if(particle->Pt() > fChargedPtCut && TMath::Abs(particle->Eta())<fCTSEtaCut)
272 new((*plCTS)[indexCh++]) TParticle(*particle) ;
273 }// select track from refit
274 }//track loop
275 }//CTS
276
277 AliDebug(3,Form("Particle lists filled, tracks %d , clusters: EMCAL %d, PHOS %d", indexCh,indexEM,indexPH));
bdcfac30 278
bdcfac30 279}
280