Line data Source code
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 : //-------------------------------------------------------------------------
18 : // Realisation of AliVParticle for MC Particles
19 : // Basically a stripped down AliMCParicle / TParticle
20 : // with minimum information on MC tracks
21 : // Author: Christian Klein-Bösing, CERN
22 : //-------------------------------------------------------------------------
23 :
24 :
25 : #include "AliAODMCParticle.h"
26 : #include "AliAODEvent.h"
27 :
28 : #include "TDatabasePDG.h"
29 : #include "TParticle.h"
30 : #include "TClonesArray.h"
31 :
32 :
33 170 : ClassImp(AliAODMCParticle)
34 :
35 170 : TString AliAODMCParticle::fgkStdBranchName("mcparticles");
36 :
37 : AliAODMCParticle::AliAODMCParticle():
38 1 : AliVParticle(),
39 1 : fPdgCode(0),
40 1 : fFlag(0),
41 1 : fLabel(0),
42 1 : fMother(0),
43 1 : fPx(0),
44 1 : fPy(0),
45 1 : fPz(0),
46 1 : fE(0),
47 1 : fVx(0),
48 1 : fVy(0),
49 1 : fVz(0),
50 1 : fVt(0),
51 1 : fGeneratorIndex(-1)
52 5 : {
53 : // Default Constructor
54 1 : fDaughter[0] = fDaughter[1] = 0;
55 2 : }
56 :
57 :
58 : AliAODMCParticle::AliAODMCParticle(const AliMCParticle* mcpart, Int_t label,Int_t flag):
59 219 : AliVParticle(*mcpart),
60 438 : fPdgCode(mcpart->Particle()->GetPdgCode()),
61 219 : fFlag(flag),
62 219 : fLabel(label),
63 438 : fMother(mcpart->GetMother()),
64 438 : fPx(mcpart->Particle()->Px()),
65 438 : fPy(mcpart->Particle()->Py()),
66 438 : fPz(mcpart->Particle()->Pz()),
67 438 : fE(mcpart->Particle()->Energy()),
68 438 : fVx(mcpart->Particle()->Vx()),
69 438 : fVy(mcpart->Particle()->Vy()),
70 438 : fVz(mcpart->Particle()->Vz()),
71 438 : fVt(mcpart->Particle()->T()),
72 438 : fGeneratorIndex(mcpart->GetGeneratorIndex())
73 1095 : {
74 : // Constructor
75 438 : fDaughter[0] = mcpart->GetFirstDaughter();
76 438 : fDaughter[1] = mcpart->GetLastDaughter();
77 438 : }
78 :
79 :
80 : AliAODMCParticle::AliAODMCParticle(const AliAODMCParticle& mcPart) :
81 219 : AliVParticle(mcPart),
82 219 : fPdgCode(mcPart.fPdgCode),
83 219 : fFlag(mcPart.fFlag),
84 219 : fLabel(mcPart.fLabel),
85 219 : fMother(mcPart.fMother),
86 219 : fPx(mcPart.fPx),
87 219 : fPy(mcPart.fPy),
88 219 : fPz(mcPart.fPz),
89 219 : fE(mcPart.fE),
90 219 : fVx(mcPart.fVx),
91 219 : fVy(mcPart.fVy),
92 219 : fVz(mcPart.fVz),
93 219 : fVt(mcPart.fVt),
94 219 : fGeneratorIndex(-1)
95 1095 : {
96 : // Copy constructor
97 219 : fDaughter[0] = mcPart.fDaughter[0];
98 219 : fDaughter[1] = mcPart.fDaughter[1];
99 438 : }
100 :
101 : AliAODMCParticle& AliAODMCParticle::operator=(const AliAODMCParticle& mcPart)
102 : {
103 : //
104 : // assignment operator
105 : //
106 0 : if (this!=&mcPart) {
107 0 : AliVParticle::operator=(mcPart);
108 0 : fPdgCode = mcPart.fPdgCode;
109 0 : fFlag = mcPart.fFlag;
110 0 : fLabel = mcPart.fLabel;
111 0 : fMother = mcPart.fMother;
112 0 : fPx = mcPart.fPx;
113 0 : fPy = mcPart.fPy;
114 0 : fPz = mcPart.fPz;
115 0 : fE = mcPart.fE;
116 0 : fVx = mcPart.fVx;
117 0 : fVy = mcPart.fVy;
118 0 : fVz = mcPart.fVz;
119 0 : fVt = mcPart.fVt;
120 0 : fGeneratorIndex = mcPart.fGeneratorIndex;
121 0 : fDaughter[0] = mcPart.fDaughter[0];
122 0 : fDaughter[1] = mcPart.fDaughter[1];
123 0 : }
124 :
125 0 : return *this;
126 :
127 : }
128 :
129 : Double_t AliAODMCParticle::M() const
130 : {
131 : //
132 : // return the mass
133 : //
134 0 : TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
135 0 : if (pdg) {
136 0 : return (pdg->Mass());
137 : } else {
138 0 : return GetCalcMass();
139 : }
140 0 : }
141 :
142 :
143 : Short_t AliAODMCParticle::Charge() const
144 : {
145 : //
146 : // return tha charge
147 : //
148 0 : TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
149 0 : if (pdg) {
150 0 : return (Short_t (pdg->Charge()));
151 : } else {
152 0 : return -99;
153 : }
154 0 : }
155 :
156 : void AliAODMCParticle::Print(const Option_t */*opt*/) const {
157 : // Print particle information
158 0 : if(TDatabasePDG::Instance()->GetParticle(fPdgCode)){
159 0 : Printf(">>> PDG (%d) : %s",fPdgCode,TDatabasePDG::Instance()->GetParticle(fPdgCode)->GetName());
160 0 : }
161 : else{
162 0 : Printf(">>> PDG (%d) : %s",fPdgCode,"Unknown");
163 : }
164 0 : Printf(">> P(%3.3f,%3.3f,%3.3f) V((%3.3f,%3.3f,%3.3f,%3.3f)",fPx,fPy,fPz,fVx,fVy,fVz,fVt);
165 0 : Printf("> Mother %d, First Daughter %d Last Daughter %d , Status %d, PhysicalPrimary %d",
166 0 : fMother,fDaughter[0],fDaughter[1],GetStatus(),
167 0 : IsPhysicalPrimary());
168 0 : }
|