1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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 //-------------------------------------------------------------------------
25 #include "AliAODMCParticle.h"
26 #include "AliAODEvent.h"
28 #include "TDatabasePDG.h"
29 #include "TParticle.h"
30 #include "TClonesArray.h"
33 ClassImp(AliAODMCParticle)
35 TString AliAODMCParticle::fgkStdBranchName("mcparticles");
37 AliAODMCParticle::AliAODMCParticle():
53 // Default Constructor
54 fDaughter[0] = fDaughter[1] = 0;
58 AliAODMCParticle::AliAODMCParticle(const AliMCParticle* mcpart, Int_t label,Int_t flag):
59 AliVParticle(*mcpart),
60 fPdgCode(mcpart->Particle()->GetPdgCode()),
63 fMother(mcpart->GetMother()),
64 fPx(mcpart->Particle()->Px()),
65 fPy(mcpart->Particle()->Py()),
66 fPz(mcpart->Particle()->Pz()),
67 fE(mcpart->Particle()->Energy()),
68 fVx(mcpart->Particle()->Vx()),
69 fVy(mcpart->Particle()->Vy()),
70 fVz(mcpart->Particle()->Vz()),
71 fVt(mcpart->Particle()->T()),
72 fGeneratorIndex(mcpart->GetGeneratorIndex())
75 fDaughter[0] = mcpart->GetFirstDaughter();
76 fDaughter[1] = mcpart->GetLastDaughter();
80 AliAODMCParticle::AliAODMCParticle(const AliAODMCParticle& mcPart) :
82 fPdgCode(mcPart.fPdgCode),
84 fLabel(mcPart.fLabel),
85 fMother(mcPart.fMother),
97 fDaughter[0] = mcPart.fDaughter[0];
98 fDaughter[1] = mcPart.fDaughter[1];
101 AliAODMCParticle& AliAODMCParticle::operator=(const AliAODMCParticle& mcPart)
104 // assignment operator
107 AliVParticle::operator=(mcPart);
108 fPdgCode = mcPart.fPdgCode;
109 fFlag = mcPart.fFlag;
110 fLabel = mcPart.fLabel;
111 fMother = mcPart.fMother;
120 fGeneratorIndex = mcPart.fGeneratorIndex;
121 fDaughter[0] = mcPart.fDaughter[0];
122 fDaughter[1] = mcPart.fDaughter[1];
129 Double_t AliAODMCParticle::M() const
134 TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
136 return (pdg->Mass());
138 return GetCalcMass();
143 Short_t AliAODMCParticle::Charge() const
148 TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
150 return (Short_t (pdg->Charge()));
156 void AliAODMCParticle::Print(const Option_t */*opt*/) const {
157 // Print particle information
158 if(TDatabasePDG::Instance()->GetParticle(fPdgCode)){
159 Printf(">>> PDG (%d) : %s",fPdgCode,TDatabasePDG::Instance()->GetParticle(fPdgCode)->GetName());
162 Printf(">>> PDG (%d) : %s",fPdgCode,"Unknown");
164 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 Printf("> Mother %d, First Daughter %d Last Daughter %d , Status %d, PhysicalPrimary %d",
166 fMother,fDaughter[0],fDaughter[1],GetStatus(),
167 IsPhysicalPrimary());