]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/CaloTrackCorrBase/AliCaloTrackMCReader.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliCaloTrackMCReader.cxx
CommitLineData
1c5acb87 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 *
477d6cee 12 * about the suitability of this software for any purpose. It is *
1c5acb87 13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
1c5acb87 15
16//_________________________________________________________________________
17// Class for reading data (Kinematics) in order to do prompt gamma
18// or other particle identification and correlations
29b2ceec 19// Separates generated particles into charged (CTS)
20// and neutral (PHOS or EMCAL acceptance)
2007809d 21// Now, it only works with data stored in Kinematics.root and
22// not in filtered Kinematics branch in AODs
1c5acb87 23//
24//*-- Author: Gustavo Conesa (LNF-INFN)
25//////////////////////////////////////////////////////////////////////////////
26
27
28// --- ROOT system ---
29
30#include <TParticle.h>
c180f65d 31#include <TDatabasePDG.h>
1c5acb87 32#include <TRandom.h>
477d6cee 33#include <TArrayI.h>
29b2ceec 34#include "TParticle.h"
1c5acb87 35
36//---- ANALYSIS system ----
37#include "AliCaloTrackMCReader.h"
1c5acb87 38#include "AliGenEventHeader.h"
39#include "AliStack.h"
0ae57829 40#include "AliVCluster.h"
1c5acb87 41#include "AliAODTrack.h"
477d6cee 42#include "AliAODEvent.h"
ff45398a 43#include "AliFiducialCut.h"
29b2ceec 44#include "AliMCAnalysisUtils.h"
1c5acb87 45
0de1814a 46ClassImp(AliCaloTrackMCReader)
1c5acb87 47
0de1814a 48//____________________________________________
1c5acb87 49AliCaloTrackMCReader::AliCaloTrackMCReader() :
0de1814a 50AliCaloTrackReader(), fDecayPi0(0),
51fNeutralParticlesArray(0x0), fChargedParticlesArray(0x0),
52fStatusArray(0x0), fKeepAllStatus(0),
53fCheckOverlap(0), fEMCALOverlapAngle(0),fPHOSOverlapAngle(0),
54fIndex2ndPhoton(0), fOnlyGeneratorParticles(kTRUE)
1c5acb87 55{
56 //Ctor
57
58 //Initialize parameters
59 InitParameters();
1c5acb87 60}
0de1814a 61//___________________________________________
62AliCaloTrackMCReader::~AliCaloTrackMCReader()
63{
1c5acb87 64 //Dtor
0de1814a 65
1c5acb87 66 if(fChargedParticlesArray) delete fChargedParticlesArray ;
67 if(fNeutralParticlesArray) delete fNeutralParticlesArray ;
2007809d 68 if(fStatusArray) delete fStatusArray ;
0de1814a 69
1c5acb87 70}
71
0de1814a 72//________________________________________________________
73void AliCaloTrackMCReader::GetVertex(Double_t v[3]) const
74{
1c5acb87 75 //Return vertex position
0de1814a 76
1c5acb87 77 TArrayF pv;
78 GetGenEventHeader()->PrimaryVertex(pv);
79 v[0]=pv.At(0);
80 v[1]=pv.At(1);
81 v[2]=pv.At(2);
0de1814a 82
1c5acb87 83}
84
0de1814a 85//_________________________________________
1c5acb87 86void AliCaloTrackMCReader::InitParameters()
87{
88
89 //Initialize the parameters of the analysis.
0de1814a 90
1c5acb87 91 fDecayPi0 = kFALSE;
0de1814a 92
1c5acb87 93 fChargedParticlesArray = new TArrayI(1);
94 fChargedParticlesArray->SetAt(11,0);
95 //Int_t pdgarray[]={12,14,16};// skip neutrinos
96 //fNeutralParticlesArray = new TArrayI(3, pdgarray);
97 fNeutralParticlesArray = new TArrayI(3);
98 fNeutralParticlesArray->SetAt(12,0); fNeutralParticlesArray->SetAt(14,1); fNeutralParticlesArray->SetAt(16,2);
99 fStatusArray = new TArrayI(1);
100 fStatusArray->SetAt(1,0);
2007809d 101
102 fOnlyGeneratorParticles = kTRUE;
103 fKeepAllStatus = kTRUE;
0de1814a 104
2007809d 105 fCheckOverlap = kFALSE;
106 fEMCALOverlapAngle = 2.5 * TMath::DegToRad();
107 fPHOSOverlapAngle = 0.5 * TMath::DegToRad();
108 fIndex2ndPhoton = -1;
d7c10d78 109
2007809d 110 fDataType = kMC;
d7c10d78 111 fReadStack = kTRUE;
2007809d 112 fReadAODMCParticles = kFALSE; //This class only works with Kinematics.root input.
d7c10d78 113
114 //For this reader we own the objects of the arrays
be518ab0 115 fCTSTracks ->SetOwner(kTRUE);
116 fEMCALClusters->SetOwner(kTRUE);
117 fPHOSClusters ->SetOwner(kTRUE);
d7c10d78 118
691bdd02 119}
d7c10d78 120
8a2dbbff 121//__________________________________________________________________________
122void AliCaloTrackMCReader::CheckOverlap(Float_t anglethres, Int_t imom,
123 Int_t & iPrimary, Int_t & index,
124 TLorentzVector & mom, Int_t & pdg)
0de1814a 125{
691bdd02 126 //Check overlap of decay photons
0de1814a 127 if( fIndex2ndPhoton==iPrimary )
128 {
691bdd02 129 fIndex2ndPhoton=-1;
130 return;
131 }
0de1814a 132 else
133 fIndex2ndPhoton=-1;
691bdd02 134
691bdd02 135 if(pdg!=22) return;
136
137 TLorentzVector ph1, ph2;
138 TParticle *meson = GetStack()->Particle(imom);
139 Int_t mepdg = meson->GetPdgCode();
140 Int_t idaug1 = meson->GetFirstDaughter();
0de1814a 141 if((mepdg == 111 || mepdg == 221 ) && meson->GetNDaughters() == 2)
142 { //Check only decay in 2 photons
691bdd02 143 TParticle * d1 = GetStack()->Particle(idaug1);
144 TParticle *d2 = GetStack()->Particle(idaug1+1);
0de1814a 145 if(d1->GetPdgCode() == 22 && d2->GetPdgCode() == 22 )
146 {
691bdd02 147 d1->Momentum(ph1);
148 d2->Momentum(ph2);
149 //printf("angle %2.2f\n",ph1.Angle(ph2.Vect()));
150
0de1814a 151 if(anglethres > ph1.Angle(ph2.Vect()))
152 {
153 //Keep the meson
154 pdg=mepdg;
155 index=imom;
156 meson->Momentum(mom);
157 //printf("Overlap:: pt %2.2f, phi %2.2f, eta %2.2f\n",mom.Pt(),mom.Phi(),mom.Eta());
158 if(iPrimary == idaug1) iPrimary++; //skip next photon in list
691bdd02 159 }
0de1814a 160 else
161 {
162 //Do not check overlapping for next decay photon from same meson
8a2dbbff 163 if(iPrimary == idaug1)
164 {
165 fIndex2ndPhoton = idaug1+1;
0de1814a 166 }
167
691bdd02 168 }
169 }
170 }//Meson Decay with 2 photon daughters
1c5acb87 171}
172
0de1814a 173//____________________________________________________________________
174void AliCaloTrackMCReader::FillCalorimeters(Int_t & iParticle,
175 TParticle* particle,
176 TLorentzVector &momentum)
177{
477d6cee 178 //Fill AODCaloClusters or TParticles lists of PHOS or EMCAL
179 //In PHOS
0de1814a 180
181 if(fFillPHOS && momentum.Pt() > fPHOSPtMin)
182 {
183 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) return;
5efec477 184
477d6cee 185 Int_t index = iParticle ;
186 Int_t pdg = TMath::Abs(particle->GetPdgCode());
187 if(fCheckOverlap)
188 CheckOverlap(fPHOSOverlapAngle,particle->GetFirstMother(),index, iParticle, momentum, pdg);
189
0ae57829 190 Char_t ttype= AliVCluster::kPHOSNeutral;
477d6cee 191 Int_t labels[] = {index};
192 Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()};
193 //Create object and write it to file
0ae57829 194 AliAODCaloCluster *calo = new AliAODCaloCluster(index,1,labels,momentum.E(), x, NULL, ttype, 0);
477d6cee 195
196 SetCaloClusterPID(pdg,calo) ;
197 if(fDebug > 3 && momentum.Pt() > 0.2)
a3aebfff 198 printf("AliCaloTrackMCReader::FillCalorimeters() - PHOS : Selected cluster %s E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
0de1814a 199 particle->GetName(),momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
be518ab0 200 fPHOSClusters->Add(calo);//reference the selected object to the list
477d6cee 201 }
9415d854 202
477d6cee 203 //In EMCAL
0de1814a 204 if(fFillEMCAL && momentum.Pt() > fEMCALPtMin)
205 {
5efec477 206
0de1814a 207 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return;
5efec477 208
477d6cee 209 Int_t index = iParticle ;
210 Int_t pdg = TMath::Abs(particle->GetPdgCode());
211 //Int_t pdgorg=pdg;
212 if(fCheckOverlap)
213 CheckOverlap(fEMCALOverlapAngle,particle->GetFirstMother(),iParticle, index, momentum, pdg);
214
0ae57829 215 Char_t ttype= AliVCluster::kEMCALClusterv1;
477d6cee 216 Int_t labels[] = {index};
217 Float_t x[] = {momentum.X(), momentum.Y(), momentum.Z()};
218 //Create object and write it to file
0ae57829 219 AliAODCaloCluster *calo = new AliAODCaloCluster(iParticle,1,labels,momentum.E(), x, NULL, ttype, 0);
477d6cee 220
221 SetCaloClusterPID(pdg,calo) ;
222 if(fDebug > 3 && momentum.Pt() > 0.2)
a3aebfff 223 printf("AliCaloTrackMCReader::FillCalorimeters() - EMCAL : Selected cluster %s E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
0de1814a 224 particle->GetName(),momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
be518ab0 225 fEMCALClusters->Add(calo);//reference the selected object to the list
477d6cee 226 }
1c5acb87 227}
228
0de1814a 229//___________________________________________________________________________
8a2dbbff 230Bool_t AliCaloTrackMCReader::FillInputEvent(Int_t iEntry,
0de1814a 231 const char * /*currentFileName*/)
232{
477d6cee 233 //Fill the event counter and input lists that are needed, called by the analysis maker.
234
2007809d 235 fEventNumber = iEntry;
1510eee3 236 //fCurrentFileName = TString(currentFileName);
2007809d 237 fTrackMult = 0;
0de1814a 238
29b2ceec 239 //In case of analysis of events with jets, skip those with jet pt > 5 pt hard
0de1814a 240 if(fComparePtHardAndJetPt && GetStack())
241 {
90995603 242 if(!ComparePtHardAndJetPt()) return kFALSE ;
591cc579 243 }
29b2ceec 244
edffc439 245 //Fill Vertex array
246 FillVertexArray();
247
2007809d 248 Int_t iParticle = 0 ;
249 Double_t charge = 0.;
250 Int_t nparticles = GetStack()->GetNtrack() ;
0de1814a 251
2007809d 252 if(fOnlyGeneratorParticles) nparticles=GetStack()->GetNprimary();
0de1814a 253
254 for (iParticle = 0 ; iParticle < nparticles ; iParticle++)
255 {
477d6cee 256 TParticle * particle = GetStack()->Particle(iParticle);
257 TLorentzVector momentum;
258 Float_t p[3];
259 Float_t x[3];
260 Int_t pdg = particle->GetPdgCode();
261
262 //Keep particles with a given status
0de1814a 263 if(KeepParticleWithStatus(particle->GetStatusCode()) && (particle->Pt() > 0) )
264 {
477d6cee 265 //Skip bizarre particles, they crash when charge is calculated
266 // if(TMath::Abs(pdg) == 3124 || TMath::Abs(pdg) > 10000000) continue ;
267
268 charge = TDatabasePDG::Instance()->GetParticle(pdg)->Charge();
269 particle->Momentum(momentum);
270 //---------- Charged particles ----------------------
0de1814a 271 if(charge != 0)
272 {
90995603 273 if(TMath::Abs(momentum.Eta())< fTrackMultEtaCut) fTrackMult++;
274
275 if(fFillCTS && (momentum.Pt() > fCTSPtMin)){
276 //Particles in CTS acceptance
277
278 if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
279
280 if(TMath::Abs(pdg) == 11 && GetStack()->Particle(particle->GetFirstMother())->GetPdgCode()==22) continue ;
281
282 if(fDebug > 3 && momentum.Pt() > 0.2)
283 printf("AliCaloTrackMCReader::FillInputEvent() - CTS : Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
284 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
285
286 x[0] = particle->Vx(); x[1] = particle->Vy(); x[2] = particle->Vz();
287 p[0] = particle->Px(); p[1] = particle->Py(); p[2] = particle->Pz();
288 //Create object and write it to file
289 AliAODTrack *aodTrack = new AliAODTrack(0, iParticle, p, kTRUE, x, kFALSE,NULL, 0, 0,
290 NULL,
291 0x0,//primary,
292 kFALSE, // No fit performed
293 kFALSE, // No fit performed
294 AliAODTrack::kPrimary,
295 0);
296 SetTrackChargeAndPID(pdg, aodTrack);
be518ab0 297 fCTSTracks->Add(aodTrack);//reference the selected object to the list
90995603 298 }
299 //Keep some charged particles in calorimeters lists
300 if((fFillPHOS || fFillEMCAL) && KeepChargedParticles(pdg)) FillCalorimeters(iParticle, particle, momentum);
301
477d6cee 302 }//Charged
303
304 //-------------Neutral particles ----------------------
0de1814a 305 else if(charge == 0 && (fFillPHOS || fFillEMCAL))
306 {
90995603 307 //Skip neutrinos or other neutral particles
308 //if(SkipNeutralParticles(pdg) || particle->IsPrimary()) continue ; // protection added (MG)
309 if(SkipNeutralParticles(pdg)) continue ;
310 //Fill particle/calocluster arrays
0de1814a 311 if(!fDecayPi0)
312 {
90995603 313 FillCalorimeters(iParticle, particle, momentum);
314 }
0de1814a 315 else
316 {
90995603 317 //Sometimes pi0 are stable for the generator, if needed decay it by hand
0de1814a 318 if(pdg == 111 )
319 {
320 if(momentum.Pt() > fPHOSPtMin || momentum.Pt() > fEMCALPtMin)
321 {
90995603 322 TLorentzVector lvGamma1, lvGamma2 ;
323 //Double_t angle = 0;
324
325 //Decay
326 MakePi0Decay(momentum,lvGamma1,lvGamma2);//,angle);
327
328 //Check if Pi0 is in the acceptance of the calorimeters, if aperture angle is small, keep it
329 TParticle * pPhoton1 = new TParticle(22,1,iParticle,0,0,0,lvGamma1.Px(),lvGamma1.Py(),
330 lvGamma1.Pz(),lvGamma1.E(),0,0,0,0);
331 TParticle * pPhoton2 = new TParticle(22,1,iParticle,0,0,0,lvGamma2.Px(),lvGamma2.Py(),
332 lvGamma2.Pz(),lvGamma2.E(),0,0,0,0);
333 //Fill particle/calocluster arrays
334 FillCalorimeters(iParticle,pPhoton1,lvGamma1);
335 FillCalorimeters(iParticle,pPhoton2,lvGamma2);
336 }//pt cut
337 }//pi0
338 else FillCalorimeters(iParticle,particle, momentum); //Add the rest
339 }
477d6cee 340 }//neutral particles
341 } //particle with correct status
342 }//particle loop
343
344 fIndex2ndPhoton = -1; //In case of overlapping studies, reset for each event
29b2ceec 345
346 return kTRUE;
90995603 347
1c5acb87 348}
349
0de1814a 350//_____________________________________________________________________
351Bool_t AliCaloTrackMCReader::KeepParticleWithStatus(Int_t status) const
352{
1c5acb87 353 //Check if status is equal to one of the list
354 //These particles will be used in analysis.
0de1814a 355 if(!fKeepAllStatus)
356 {
1c5acb87 357 for(Int_t i= 0; i < fStatusArray->GetSize(); i++)
358 if(status == fStatusArray->At(i)) return kTRUE ;
1c5acb87 359
0de1814a 360 return kFALSE;
1c5acb87 361 }
362 else
363 return kTRUE ;
364}
365
366//________________________________________________________________
0de1814a 367Bool_t AliCaloTrackMCReader::KeepChargedParticles(Int_t pdg) const
368{
1c5acb87 369 //Check if pdg is equal to one of the charged particles list
370 //These particles will be added to the calorimeters lists.
0de1814a 371
1c5acb87 372 for(Int_t i= 0; i < fChargedParticlesArray->GetSize(); i++)
373 if(TMath::Abs(pdg) == fChargedParticlesArray->At(i)) return kTRUE ;
374
375 return kFALSE;
376
377}
378
0de1814a 379//__________________________________________________________
1c5acb87 380void AliCaloTrackMCReader::Print(const Option_t * opt) const
381{
382 //Print some relevant parameters set for the analysis
383 if(! opt)
384 return;
385
0ae57829 386 AliCaloTrackReader::Print(opt);
387
a3aebfff 388 printf("**** Print **** %s %s ****\n", GetName(), GetTitle() ) ;
1c5acb87 389
390 printf("Decay Pi0? : %d\n", fDecayPi0) ;
691bdd02 391 printf("Check Overlap in Calo? : %d\n", fCheckOverlap) ;
1c5acb87 392 printf("Keep all status? : %d\n", fKeepAllStatus) ;
393
394 if(!fKeepAllStatus) printf("Keep particles with status : ");
395 for(Int_t i= 0; i < fStatusArray->GetSize(); i++)
396 printf(" %d ; ", fStatusArray->At(i));
397 printf("\n");
398
399 printf("Skip neutral particles in calo : ");
400 for(Int_t i= 0; i < fNeutralParticlesArray->GetSize(); i++)
401 printf(" %d ; ", fNeutralParticlesArray->At(i));
402 printf("\n");
403
404 printf("Keep charged particles in calo : ");
405 for(Int_t i= 0; i < fChargedParticlesArray->GetSize(); i++)
406 printf(" %d ; ", fChargedParticlesArray->At(i));
407 printf("\n");
0de1814a 408
1c5acb87 409}
410
0de1814a 411//________________________________________________________________
8a2dbbff 412void AliCaloTrackMCReader::MakePi0Decay(TLorentzVector p0,
f3138ecf 413 TLorentzVector &p1,
414 TLorentzVector &p2) const
415//, Double_t &angle)
416{
1c5acb87 417 // Perform isotropic decay pi0 -> 2 photons
418 // p0 is pi0 4-momentum (inut)
419 // p1 and p2 are photon 4-momenta (output)
f3138ecf 420
1c5acb87 421 // cout<<"Boost vector"<<endl;
422 Double_t mPi0 = TDatabasePDG::Instance()->GetParticle(111)->Mass();
423 TVector3 b = p0.BoostVector();
424 //cout<<"Parameters"<<endl;
425 //Double_t mPi0 = p0.M();
426 Double_t phi = TMath::TwoPi() * gRandom->Rndm();
427 Double_t cosThe = 2 * gRandom->Rndm() - 1;
428 Double_t cosPhi = TMath::Cos(phi);
429 Double_t sinPhi = TMath::Sin(phi);
430 Double_t sinThe = TMath::Sqrt(1-cosThe*cosThe);
431 Double_t ePi0 = mPi0/2.;
432 //cout<<"ePi0 "<<ePi0<<endl;
433 //cout<<"Components"<<endl;
434 p1.SetPx(+ePi0*cosPhi*sinThe);
435 p1.SetPy(+ePi0*sinPhi*sinThe);
436 p1.SetPz(+ePi0*cosThe);
437 p1.SetE(ePi0);
438 //cout<<"p1: "<<p1.Px()<<" "<<p1.Py()<<" "<<p1.Pz()<<" "<<p1.E()<<endl;
439 //cout<<"p1 Mass: "<<p1.Px()*p1.Px()+p1.Py()*p1.Py()+p1.Pz()*p1.Pz()-p1.E()*p1.E()<<endl;
440 p2.SetPx(-ePi0*cosPhi*sinThe);
441 p2.SetPy(-ePi0*sinPhi*sinThe);
442 p2.SetPz(-ePi0*cosThe);
443 p2.SetE(ePi0);
444 //cout<<"p2: "<<p2.Px()<<" "<<p2.Py()<<" "<<p2.Pz()<<" "<<p2.E()<<endl;
445 //cout<<"p2 Mass: "<<p2.Px()*p2.Px()+p2.Py()*p2.Py()+p2.Pz()*p2.Pz()-p2.E()*p2.E()<<endl;
446 //cout<<"Boost "<<b.X()<<" "<<b.Y()<<" "<<b.Z()<<endl;
447 p1.Boost(b);
448 //cout<<"p1: "<<p1.Px()<<" "<<p1.Py()<<" "<<p1.Pz()<<" "<<p1.E()<<endl;
449 p2.Boost(b);
450 //cout<<"p2: "<<p2.Px()<<" "<<p2.Py()<<" "<<p2.Pz()<<" "<<p2.E()<<endl;
451 //cout<<"angle"<<endl;
452 //angle = p1.Angle(p2.Vect());
453 //cout<<angle<<endl;
454}
455
0de1814a 456//__________________________________________________________________
457void AliCaloTrackMCReader::SetInputOutputMCEvent(AliVEvent* /*esd*/,
458 AliAODEvent* aod,
459 AliMCEvent* mc)
460{
1c5acb87 461 // Connect the data pointer
477d6cee 462 SetMC(mc);
463 SetOutputEvent(aod);
1c5acb87 464}
465
1c5acb87 466//________________________________________________________________
0de1814a 467Bool_t AliCaloTrackMCReader::SkipNeutralParticles(Int_t pdg) const
468{
1c5acb87 469 //Check if pdg is equal to one of the neutral particles list
470 //These particles will be skipped from analysis.
0de1814a 471
1c5acb87 472 for(Int_t i= 0; i < fNeutralParticlesArray->GetSize(); i++)
473 if(TMath::Abs(pdg) == fNeutralParticlesArray->At(i)) return kTRUE ;
474
475 return kFALSE;
476
477}
478
0de1814a 479//_______________________________________________________________________
8a2dbbff 480void AliCaloTrackMCReader::SetTrackChargeAndPID(Int_t pdgCode,
0de1814a 481 AliAODTrack *track) const
482{
483 //Give a PID weight for tracks equal to 1 depending on the particle type
484
1c5acb87 485 Float_t pid[10] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
0de1814a 486
487 switch (pdgCode)
488 {
489 case 22: // gamma
490 track->SetCharge(0);
491 pid[AliAODTrack::kUnknown] = 1.;
492 track->SetPID(pid);
493 break;
494
495 case 11: // e-
496 track->SetCharge(-1);
497 pid[AliAODTrack::kElectron] = 1.;
498 track->SetPID(pid);
499 break;
500
501 case -11: // e+
502 track->SetCharge(+1);
503 pid[AliAODTrack::kElectron] = 1.;
504 track->SetPID(pid);
505 break;
506
507 case 13: // mu-
508 track->SetCharge(-1);
509 pid[AliAODTrack::kMuon] = 1.;
510 track->SetPID(pid);
511 break;
512
513 case -13: // mu+
514 track->SetCharge(+1);
515 pid[AliAODTrack::kMuon] = 1.;
516 track->SetPID(pid);
517 break;
518
519 case 111: // pi0
520 track->SetCharge(0);
521 pid[AliAODTrack::kUnknown] = 1.;
522 track->SetPID(pid);
523 break;
524
525 case 211: // pi+
526 track->SetCharge(+1);
527 pid[AliAODTrack::kPion] = 1.;
528 track->SetPID(pid);
529 break;
530
531 case -211: // pi-
532 track->SetCharge(-1);
533 pid[AliAODTrack::kPion] = 1.;
534 track->SetPID(pid);
535 break;
536
537 case 130: // K0L
538 track->SetCharge(0);
539 pid[AliAODTrack::kUnknown] = 1.;
540 track->SetPID(pid);
541 break;
542
543 case 321: // K+
544 track->SetCharge(+1);
545 pid[AliAODTrack::kKaon] = 1.;
546 track->SetPID(pid);
547 break;
548
549 case -321: // K-
550 track->SetCharge(-1);
551 pid[AliAODTrack::kKaon] = 1.;
552 track->SetPID(pid);
553 break;
554
555 case 2112: // n
556 track->SetCharge(0);
557 pid[AliAODTrack::kUnknown] = 1.;
558 track->SetPID(pid);
559 break;
560
561 case 2212: // p
562 track->SetCharge(+1);
563 pid[AliAODTrack::kProton] = 1.;
564 track->SetPID(pid);
565 break;
566
567 case -2212: // anti-p
568 track->SetCharge(-1);
569 pid[AliAODTrack::kProton] = 1.;
570 track->SetPID(pid);
571 break;
572
573 case 310: // K0S
574 track->SetCharge(0);
575 pid[AliAODTrack::kUnknown] = 1.;
576 track->SetPID(pid);
577 break;
578
579 case 311: // K0
580 track->SetCharge(0);
581 pid[AliAODTrack::kUnknown] = 1.;
582 track->SetPID(pid);
583 break;
584
585 case -311: // anti-K0
586 track->SetCharge(0);
587 pid[AliAODTrack::kUnknown] = 1.;
588 track->SetPID(pid);
589 break;
590
591 case 221: // eta
592 track->SetCharge(0);
593 pid[AliAODTrack::kUnknown] = 1.;
594 track->SetPID(pid);
595 break;
596
597 case 3122: // lambda
598 track->SetCharge(0);
599 pid[AliAODTrack::kUnknown] = 1.;
600 track->SetPID(pid);
601 break;
602
603 case 3222: // Sigma+
604 track->SetCharge(+1);
605 pid[AliAODTrack::kUnknown] = 1.;
606 track->SetPID(pid);
607 break;
608
609 case 3212: // Sigma0
610 track->SetCharge(-1);
611 pid[AliAODTrack::kUnknown] = 1.;
612 track->SetPID(pid);
613 break;
614
615 case 3112: // Sigma-
616 track->SetCharge(-1);
617 pid[AliAODTrack::kUnknown] = 1.;
618 track->SetPID(pid);
619 break;
620
621 case 3322: // Xi0
622 track->SetCharge(0);
623 pid[AliAODTrack::kUnknown] = 1.;
624 track->SetPID(pid);
625 break;
626
627 case 3312: // Xi-
628 track->SetCharge(-1);
629 pid[AliAODTrack::kUnknown] = 1.;
630 track->SetPID(pid);
631 break;
632
633 case 3334: // Omega-
634 track->SetCharge(-1);
635 pid[AliAODTrack::kUnknown] = 1.;
636 track->SetPID(pid);
637 break;
638
639 case -2112: // n-bar
640 track->SetCharge(0);
641 pid[AliAODTrack::kUnknown] = 1.;
642 track->SetPID(pid);
643 break;
644
645 case -3122: // anti-Lambda
646 track->SetCharge(0);
647 pid[AliAODTrack::kUnknown] = 1.;
648 track->SetPID(pid);
649 break;
650
651 case -3222: // anti-Sigma-
652 track->SetCharge(-1);
653 pid[AliAODTrack::kUnknown] = 1.;
654 track->SetPID(pid);
655 break;
656
657 case -3212: // anti-Sigma0
658 track->SetCharge(0);
659 pid[AliAODTrack::kUnknown] = 1.;
660 track->SetPID(pid);
661 break;
662
663 case -3112: // anti-Sigma+
664 track->SetCharge(+1);
665 pid[AliAODTrack::kUnknown] = 1.;
666 track->SetPID(pid);
667 break;
668
669 case -3322: // anti-Xi0
670 track->SetCharge(0);
671 pid[AliAODTrack::kUnknown] = 1.;
672 track->SetPID(pid);
673 break;
674
675 case -3312: // anti-Xi+
676 track->SetCharge(+1);
677 break;
678
679 case -3334: // anti-Omega+
680 track->SetCharge(+1);
681 pid[AliAODTrack::kUnknown] = 1.;
682 track->SetPID(pid);
683 break;
684
685 case 411: // D+
686 track->SetCharge(+1);
687 pid[AliAODTrack::kUnknown] = 1.;
688 track->SetPID(pid);
689 break;
690
691 case -411: // D-
692 track->SetCharge(-1);
693 pid[AliAODTrack::kUnknown] = 1.;
694 track->SetPID(pid);
695 break;
696
697 case 421: // D0
698 track->SetCharge(0);
699 pid[AliAODTrack::kUnknown] = 1.;
700 track->SetPID(pid);
701 break;
702
703 case -421: // anti-D0
704 track->SetCharge(0);
705 pid[AliAODTrack::kUnknown] = 1.;
706 track->SetPID(pid);
707 break;
708
709 default : // unknown
710 track->SetCharge(-99);
711 pid[AliAODTrack::kUnknown] = 1.;
712 track->SetPID(pid);
713 }
714
1c5acb87 715 track->SetPID(pid);
0de1814a 716
1c5acb87 717 return;
718}
719
720//____________________________________________________________________
0de1814a 721void AliCaloTrackMCReader::SetCaloClusterPID(const Int_t pdgCode,
722 AliVCluster *calo) const
723{
724 //Give a PID weight for CaloClusters equal to 1 depending on the particle type
725
1c5acb87 726 Float_t pid[13] = {0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.};
0de1814a 727
728 switch (pdgCode)
729 {
730 case 22: // gamma
731 pid[AliVCluster::kPhoton] = 1.;
732 calo->SetPID(pid);
733 break;
734
735 case 11: // e-
736 pid[AliVCluster::kElectron] = 1.;
737 calo->SetPID(pid);
738 break;
739
740 case -11: // e+
741 pid[AliVCluster::kElectron] = 1.;
742 calo->SetPID(pid);
743 break;
744
745 case 13: // mu-
746 pid[AliVCluster::kCharged] = 1.;
747 calo->SetPID(pid);
748 break;
749
750 case -13: // mu+
751 pid[AliVCluster::kCharged] = 1.;
752 calo->SetPID(pid);
753 break;
754
755 case 111: // pi0
756 pid[AliVCluster::kPi0] = 1.;
757 calo->SetPID(pid);
758 break;
759
760 case 211: // pi+
761 pid[AliVCluster::kCharged] = 1.;
762 calo->SetPID(pid);
763 break;
764
765 case -211: // pi-
766 pid[AliVCluster::kCharged] = 1.;
767 calo->SetPID(pid);
768 break;
769
770 case 130: // K0L
771 pid[AliVCluster::kKaon0] = 1.;
772 pid[AliVCluster::kNeutral] = 1;
773 calo->SetPID(pid);
774 break;
775
776 case 321: // K+
777 pid[AliVCluster::kCharged] = 1.;
778 calo->SetPID(pid);
779 break;
780
781 case -321: // K-
782 pid[AliVCluster::kCharged] = 1.;
783 calo->SetPID(pid);
784 break;
785
786 case 2112: // n
787 pid[AliVCluster::kNeutron] = 1.;
788 pid[AliVCluster::kNeutral] = 1.;
789 calo->SetPID(pid);
790 break;
791
792 case 2212: // p
793 pid[AliVCluster::kCharged] = 1.;
794 calo->SetPID(pid);
795 break;
796
797 case -2212: // anti-p
798 pid[AliVCluster::kCharged] = 1.;
799 calo->SetPID(pid);
800 break;
801
802 case 310: // K0S
803 pid[AliVCluster::kKaon0] = 1.;
804 pid[AliVCluster::kNeutral] = 1.;
805 calo->SetPID(pid);
806 break;
807
808 case 311: // K0
809 pid[AliVCluster::kKaon0] = 1.;
810 pid[AliVCluster::kNeutral] = 1.;
811 calo->SetPID(pid);
812 break;
813
814 case -311: // anti-K0
815 pid[AliVCluster::kKaon0] = 1.;
816 pid[AliVCluster::kNeutral] = 1.;
817 calo->SetPID(pid);
818 break;
819
820 case 221: // eta
821 pid[AliVCluster::kNeutral] = 1.;
822 calo->SetPID(pid);
823 break;
824
825 case 3122: // lambda
826 pid[AliVCluster::kUnknown] = 1.;
827 calo->SetPID(pid);
828 break;
829
830 case 3222: // Sigma+
831 pid[AliVCluster::kUnknown] = 1.;
832 calo->SetPID(pid);
833 break;
834
835 case 3212: // Sigma0
836 pid[AliVCluster::kUnknown] = 1.;
837 calo->SetPID(pid);
838 break;
839
840 case 3112: // Sigma-
841 pid[AliVCluster::kUnknown] = 1.;
842 calo->SetPID(pid);
843 break;
844
845 case 3322: // Xi0
846 pid[AliVCluster::kUnknown] = 1.;
847 calo->SetPID(pid);
848 break;
849
850 case 3312: // Xi-
851 pid[AliVCluster::kUnknown] = 1.;
852 calo->SetPID(pid);
853 break;
854
855 case 3334: // Omega-
856 pid[AliVCluster::kUnknown] = 1.;
857 calo->SetPID(pid);
858 break;
859
860 case -2112: // n-bar
861 pid[AliVCluster::kNeutron] = 1.;
862 pid[AliVCluster::kNeutral] = 1.;
863 calo->SetPID(pid);
864 break;
865
866 case -3122: // anti-Lambda
867 pid[AliVCluster::kUnknown] = 1.;
868 calo->SetPID(pid);
869 break;
870
871 case -3222: // anti-Sigma-
872 pid[AliVCluster::kUnknown] = 1.;
873 calo->SetPID(pid);
874 break;
875
876 case -3212: // anti-Sigma0
877 pid[AliVCluster::kUnknown] = 1.;
878 calo->SetPID(pid);
879 break;
880
881 case -3112: // anti-Sigma+
882 pid[AliVCluster::kUnknown] = 1.;
883 calo->SetPID(pid);
884 break;
885
886 case -3322: // anti-Xi0
887 pid[AliVCluster::kUnknown] = 1.;
888 calo->SetPID(pid);
889 break;
890
891 case -3312: // anti-Xi+
892 pid[AliVCluster::kUnknown] = 1.;
893 calo->SetPID(pid);
894 break;
895
896 case -3334: // anti-Omega+
897 pid[AliVCluster::kUnknown] = 1.;
898 calo->SetPID(pid);
899 break;
900
901 case 411: // D+
902 pid[AliVCluster::kUnknown] = 1.;
903 calo->SetPID(pid);
904 break;
905
906 case -411: // D-
907 pid[AliVCluster::kUnknown] = 1.;
908 calo->SetPID(pid);
909 break;
910
911 case 421: // D0
912 pid[AliVCluster::kUnknown] = 1.;
913 calo->SetPID(pid);
914 break;
915
916 case -421: // anti-D0
917 pid[AliVCluster::kUnknown] = 1.;
918 calo->SetPID(pid);
919 break;
920
921 default : // unknown
922 pid[AliVCluster::kUnknown] = 1.;
923 calo->SetPID(pid);
924 }
925
926
1c5acb87 927 return;
928}