2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /* History of cvs commits:
21 * Revision 1.2 2007/08/17 12:40:04 schutz
22 * New analysis classes by Gustavo Conesa
24 * Revision 1.1.2.1 2007/07/26 10:32:09 schutz
25 * new analysis classes in the the new analysis framework
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)
35 //*-- Author: Gustavo Conesa (LNF-INFN)
36 //////////////////////////////////////////////////////////////////////////////
39 // --- ROOT system ---
40 #include <TParticle.h>
43 //---- ANALYSIS system ----
44 #include "AliGammaDataReader.h"
45 #include "AliESDEvent.h"
46 #include "AliESDVertex.h"
47 #include "AliESDCaloCluster.h"
50 ClassImp(AliGammaDataReader)
52 //____________________________________________________________________________
53 AliGammaDataReader::AliGammaDataReader() :
58 //Initialize parameters
63 //____________________________________________________________________________
64 AliGammaDataReader::AliGammaDataReader(const AliGammaDataReader & g) :
70 //_________________________________________________________________________
71 AliGammaDataReader & AliGammaDataReader::operator = (const AliGammaDataReader & source)
73 // assignment operator
75 if(&source == this) return *this;
81 //____________________________________________________________________________
82 void AliGammaDataReader::CreateParticleList(TObject * data, TObject *,
84 TClonesArray * plEMCAL,
85 TClonesArray * plPHOS,
90 //Create a list of particles from the ESD. These particles have been measured
91 //by the Central Tracking system (TPC+ITS+...), PHOS and EMCAL
93 AliESDEvent* esd = (AliESDEvent*) data;
96 Double_t *pid = new Double_t[AliPID::kSPECIESN];
97 AliDebug(3,"Fill particle lists");
99 //Get vertex for momentum calculation
100 Double_t v[3] ; //vertex ;
101 esd->GetVertex()->GetXYZ(v) ;
103 //########### CALORIMETERS ##############
105 Int_t nCaloCluster = esd->GetNumberOfCaloClusters() ;
106 Int_t indexPH = plPHOS->GetEntries() ;
107 Int_t indexEM = plEMCAL->GetEntries() ;
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();
114 //########### PHOS ##############
115 if(fSwitchOnPHOS && type == AliESDCaloCluster::kPHOSCluster){
116 AliDebug(4,Form("PHOS clusters: E %f, match %d", clus->E(),clus->GetTrackMatched()));
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] ) {
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]));
134 Float_t wPhoton = fPHOSPhotonWeight;
135 Float_t wPi0 = fPHOSPi0Weight;
137 if(fPHOSWeightFormula){
138 wPhoton = fPHOSPhotonWeightFormula->Eval(momentum.E()) ;
139 wPi0 = fPHOSPi0WeightFormula->Eval(momentum.E());
142 if(pid[AliPID::kPhoton] > wPhoton)
144 else if(pid[AliPID::kPi0] > wPi0)
146 else if(pid[AliPID::kElectron] > fPHOSElectronWeight)
148 else if(pid[AliPID::kEleCon] > fPHOSElectronWeight)
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 ;
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 ;
159 pdg = kNeutralUnknown ;
160 //neutral cluster, unidentifed.
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);
167 AliDebug(4,Form("PHOS added: pdg %d, pt %f, phi %f, eta %f", pdg, particle->Pt(),particle->Phi(),particle->Eta()));
169 new((*plPHOS)[indexPH++]) TParticle(*particle) ;
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()));
175 else AliDebug(4,"Particle not added");
179 //################ EMCAL ##############
180 else if(fSwitchOnEMCAL && type == AliESDCaloCluster::kEMCALClusterv1){
181 AliDebug(4,Form("EMCAL clusters: E %f, match %d", clus->E(),clus->GetTrackMatched()));
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] ) {
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]));
199 if(pid[AliPID::kPhoton] > fEMCALPhotonWeight)
201 else if(pid[AliPID::kPi0] > fEMCALPi0Weight)
203 else if(pid[AliPID::kElectron] > fEMCALElectronWeight)
205 else if(pid[AliPID::kEleCon] > fEMCALElectronWeight)
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 ;
215 pdg = kNeutralUnknown ;
218 if(pdg != kElectron && pdg != kEleCon && pdg !=kChargedHadron && pdg !=kChargedUnknown){//keep only neutral particles in the array
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()));
224 new((*plEMCAL)[indexEM++]) TParticle(*particle) ;
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()));
230 else AliDebug(4,"Particle not added");
237 //########### CTS (TPC+ITS) #####################
238 Int_t nTracks = esd->GetNumberOfTracks() ;
239 Int_t indexCh = plCTS->GetEntries() ;
242 AliDebug(3,Form("Number of tracks %d",nTracks));
244 for (npar = 0; npar < nTracks; npar++) {////////////// track loop
245 AliESDtrack * track = esd->GetTrack(npar) ; // retrieve track from esd
247 //We want tracks fitted in the detectors:
248 ULong_t status=AliESDtrack::kTPCrefit;
249 status|=AliESDtrack::kITSrefit;
251 //We want tracks whose PID bit is set:
252 // ULong_t status =AliESDtrack::kITSpid;
253 // status|=AliESDtrack::kTPCpid;
255 if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set
256 // Do something with the tracks which were successfully
258 Double_t en = 0; //track ->GetTPCsignal() ;
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);
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
277 AliDebug(3,Form("Particle lists filled, tracks %d , clusters: EMCAL %d, PHOS %d", indexCh,indexEM,indexPH));