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():
52 // Default Constructor
53 fDaughter[0] = fDaughter[1] = 0;
57 AliAODMCParticle::AliAODMCParticle(const AliMCParticle* mcpart, Int_t label,Int_t flag):
59 fPdgCode(mcpart->Particle()->GetPdgCode()),
62 fMother(mcpart->GetMother()),
63 fPx(mcpart->Particle()->Px()),
64 fPy(mcpart->Particle()->Py()),
65 fPz(mcpart->Particle()->Pz()),
66 fE(mcpart->Particle()->Energy()),
67 fVx(mcpart->Particle()->Vx()),
68 fVy(mcpart->Particle()->Vy()),
69 fVz(mcpart->Particle()->Vz()),
70 fVt(mcpart->Particle()->T())
73 fDaughter[0] = mcpart->GetFirstDaughter();
74 fDaughter[1] = mcpart->GetLastDaughter();
78 AliAODMCParticle::AliAODMCParticle(const AliAODMCParticle& mcPart) :
80 fPdgCode(mcPart.fPdgCode),
82 fLabel(mcPart.fLabel),
83 fMother(mcPart.fMother),
94 fDaughter[0] = mcPart.fDaughter[0];
95 fDaughter[1] = mcPart.fDaughter[1];
98 AliAODMCParticle& AliAODMCParticle::operator=(const AliAODMCParticle& mcPart)
102 AliVParticle::operator=(mcPart);
103 fPdgCode = mcPart.fPdgCode;
104 fFlag = mcPart.fFlag;
105 fLabel = mcPart.fLabel;
106 fMother = mcPart.fMother;
115 fDaughter[0] = mcPart.fDaughter[0];
116 fDaughter[1] = mcPart.fDaughter[1];
123 Double_t AliAODMCParticle::M() const
125 TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
127 return (pdg->Mass());
129 return GetCalcMass();
134 Short_t AliAODMCParticle::Charge() const
136 TParticlePDG* pdg = TDatabasePDG::Instance()->GetParticle(fPdgCode);
138 return (Short_t (pdg->Charge()));
144 void AliAODMCParticle::Print(const Option_t */*opt*/) const {
145 // Print particle information
146 if(TDatabasePDG::Instance()->GetParticle(fPdgCode)){
147 Printf(">>> PDG (%d) : %s",fPdgCode,TDatabasePDG::Instance()->GetParticle(fPdgCode)->GetName());
150 Printf(">>> PDG (%d) : %s",fPdgCode,"Unknown");
152 Printf(">> P(%3.3f,%3.3f,%3.3f) V((%3.3f,%3.3f,%3.3f,%3.3f)",fPx,fPy,fPz,fVx,fVy,fVz,fVt);
153 Printf("> Mother %d, First Daughter %d Last Daughter %d , Status %d, PhysicalPrimary %d",
154 fMother,fDaughter[0],fDaughter[1],GetStatus(),
155 IsPhysicalPrimary());