AliRoot Core  ee782a0 (ee782a0)
AliAODMCParticle.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2007, 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 
17 #include "AliAODMCParticle.h"
18 #include "AliAODEvent.h"
19 
20 #include "TDatabasePDG.h"
21 #include "TParticle.h"
22 #include "TClonesArray.h"
23 
24 
25 ClassImp(AliAODMCParticle)
26 
27 TString AliAODMCParticle::fgkStdBranchName("mcparticles");
28 
30 AliVParticle(),
31  fPdgCode(0),
32  fFlag(0),
33  fLabel(0),
34  fMother(0),
35  fPx(0),
36  fPy(0),
37  fPz(0),
38  fE(0),
39  fVx(0),
40  fVy(0),
41  fVz(0),
42  fVt(0),
43  fGeneratorIndex(-1)
44 {
46 
47  fDaughter[0] = fDaughter[1] = 0;
48 }
49 
50 
51 AliAODMCParticle::AliAODMCParticle(const AliMCParticle* mcpart, Int_t label,Int_t flag):
52  AliVParticle(*mcpart),
53  fPdgCode(mcpart->Particle()->GetPdgCode()),
54  fFlag(flag),
55  fLabel(label),
56  fMother(mcpart->GetMother()),
57  fPx(mcpart->Particle()->Px()),
58  fPy(mcpart->Particle()->Py()),
59  fPz(mcpart->Particle()->Pz()),
60  fE(mcpart->Particle()->Energy()),
61  fVx(mcpart->Particle()->Vx()),
62  fVy(mcpart->Particle()->Vy()),
63  fVz(mcpart->Particle()->Vz()),
64  fVt(mcpart->Particle()->T()),
65  fGeneratorIndex(mcpart->GetGeneratorIndex())
66 {
68 
69  fDaughter[0] = mcpart->GetFirstDaughter();
70  fDaughter[1] = mcpart->GetLastDaughter();
71 }
72 
73 
75  AliVParticle(mcPart),
76  fPdgCode(mcPart.fPdgCode),
77  fFlag(mcPart.fFlag),
78  fLabel(mcPart.fLabel),
79  fMother(mcPart.fMother),
80  fPx(mcPart.fPx),
81  fPy(mcPart.fPy),
82  fPz(mcPart.fPz),
83  fE(mcPart.fE),
84  fVx(mcPart.fVx),
85  fVy(mcPart.fVy),
86  fVz(mcPart.fVz),
87  fVt(mcPart.fVt),
88  fGeneratorIndex(-1)
89 {
91 
92  fDaughter[0] = mcPart.fDaughter[0];
93  fDaughter[1] = mcPart.fDaughter[1];
94 }
95 
97 {
99 
100  if (this!=&mcPart) {
101  AliVParticle::operator=(mcPart);
102  fPdgCode = mcPart.fPdgCode;
103  fFlag = mcPart.fFlag;
104  fLabel = mcPart.fLabel;
105  fMother = mcPart.fMother;
106  fPx = mcPart.fPx;
107  fPy = mcPart.fPy;
108  fPz = mcPart.fPz;
109  fE = mcPart.fE;
110  fVx = mcPart.fVx;
111  fVy = mcPart.fVy;
112  fVz = mcPart.fVz;
113  fVt = mcPart.fVt;
115  fDaughter[0] = mcPart.fDaughter[0];
116  fDaughter[1] = mcPart.fDaughter[1];
117  }
118 
119  return *this;
120 
121 }
122 
123 Double_t AliAODMCParticle::M() const
124 {
126 
127  TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
128  if (pdg) {
129  return (pdg->Mass());
130  } else {
131  return GetCalcMass();
132  }
133 }
134 
135 
137 {
139 
140  TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
141  if (pdg) {
142  return (Short_t (pdg->Charge()));
143  } else {
144  return -99;
145  }
146 }
147 
148 void AliAODMCParticle::Print(const Option_t */*opt*/) const {
150 
151  if(TDatabasePDG::Instance()->GetParticle(fPdgCode)){
152  Printf(">>> PDG (%d) : %s",fPdgCode,TDatabasePDG::Instance()->GetParticle(fPdgCode)->GetName());
153  }
154  else{
155  Printf(">>> PDG (%d) : %s",fPdgCode,"Unknown");
156  }
157  Printf(">> P(%3.3f,%3.3f,%3.3f) V((%3.3f,%3.3f,%3.3f,%3.3f)",fPx,fPy,fPz,fVx,fVy,fVz,fVt);
158  Printf("> Mother %d, First Daughter %d Last Daughter %d , Status %llu, PhysicalPrimary %d",
161 }
virtual Double_t M() const
Double32_t fPx
x component of momentum
Double32_t fE
Energy.
Int_t fPdgCode
PDG code of the particle.
Bool_t IsPhysicalPrimary() const
virtual void Print(const Option_t *opt="") const
Double32_t fPy
y component of momentum
AliVParticle & operator=(const AliVParticle &vPart)
Double32_t fVz
z of production vertex
Int_t GetFirstDaughter() const
Definition: AliMCParticle.h:77
Double32_t fPz
z component of momentum
AliVParticle realisation for MC Particles in the AOD.
Double32_t fVy
y of production vertex
Double32_t fVt
t of production vertex
Int_t fDaughter[2]
Indices of the daughter particles.
Int_t GetLastDaughter() const
Definition: AliMCParticle.h:78
UInt_t fFlag
Flag for indication of primary etc, Status code in the upper 16 bits 17-32, MC process id (AKA Unique...
Int_t fMother
Index of the mother particles.
virtual ULong64_t GetStatus() const
Short_t fGeneratorIndex
! Index of generator in cocktail
AliAODMCParticle & operator=(const AliAODMCParticle &mcPart)
Double32_t fVx
x of production vertex
Int_t fLabel
Label of the original MCParticle.
virtual Short_t Charge() const
virtual Double_t GetCalcMass() const