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