3 // Nikolai Amelin, Ludmila Malinina, Timur Pocheptsov (C) JINR/Dubna
4 // amelin@sunhe.jinr.ru, malinina@sunhe.jinr.ru, pocheptsov@sunhe.jinr.ru
7 // Implementation of class Particle
8 // Contains particle PDG, 4-coordinates and 4-momentum vectors, history information
11 #include "ParticlePDG.h"
14 //___________________________________________________________________
15 Particle::Particle(ParticlePDG *prop):
18 fLastMotherDecayCoor(),
19 fLastMotherDecayMom(),
20 fParticleProperties(prop),
21 fLastInteractionTime(0.),
22 fInteractionNumber(0),
23 fPythiaStatusCode(-1),
29 fFirstDaughterIndex(-1),
30 fLastDaughterIndex(-1),
38 //___________________________________________________________________
39 Particle::Particle(ParticlePDG *prop, const TLorentzVector &pos,
40 const TLorentzVector &mom, Double_t lit, Int_t lin, Int_t type):
43 fLastMotherDecayCoor(),
44 fLastMotherDecayMom(),
45 fParticleProperties(prop),
46 fLastInteractionTime(lit),
47 fInteractionNumber(lin),
48 fPythiaStatusCode(-1),
54 fFirstDaughterIndex(-1),
55 fLastDaughterIndex(-1),
63 //___________________________________________________________________
64 Particle::Particle(ParticlePDG *prop, const TLorentzVector &pos, const TLorentzVector &mom,
65 Double_t t, Int_t n, Int_t ty, Int_t motherPdg, const TLorentzVector &mPos,
66 const TLorentzVector &mMom):
69 fLastMotherDecayCoor(mPos),
70 fLastMotherDecayMom(mMom),
71 fParticleProperties(prop),
72 fLastInteractionTime(t),
73 fInteractionNumber(n),
74 fPythiaStatusCode(-1),
75 fLastMotherPdg(motherPdg),
80 fFirstDaughterIndex(-1),
81 fLastDaughterIndex(-1),
89 //___________________________________________________________________
90 Particle::Particle(const Particle& copy) :
91 fPosition(copy.Pos()),
92 fMomentum(copy.Mom()),
93 fLastMotherDecayCoor(copy.GetLastMotherDecayCoor()),
94 fLastMotherDecayMom(copy.GetLastMotherDecayMom()),
95 fParticleProperties(copy.Def()),
96 fLastInteractionTime(copy.GetLastInterTime()),
97 fInteractionNumber(copy.GetLastInterNumber()),
98 fPythiaStatusCode(copy.GetPythiaStatusCode()),
99 fLastMotherPdg(copy.GetLastMotherPdg()),
100 fType(copy.GetType()),
101 fIndex(copy.GetIndex()),
102 fMotherIndex(copy.GetMother()),
103 fNDaughters(copy.GetNDaughters()),
104 fFirstDaughterIndex(copy.GetFirstDaughterIndex()),
105 fLastDaughterIndex(copy.GetLastDaughterIndex()),
106 fDecayed(copy.GetDecayed())
113 //___________________________________________________________________
114 Particle & Particle::operator=(const Particle& /*copy*/) {
116 // assignment operator
121 //___________________________________________________________________
122 Int_t Particle::Encoding() const {
126 return fParticleProperties->GetPDG();
129 //___________________________________________________________________
130 Double_t Particle::TableMass() const {
134 return fParticleProperties->GetMass();
137 //___________________________________________________________________
138 Double_t Particle::Eta() const {
142 if(fMomentum.P() != fMomentum.Pz())
143 return 0.5 * TMath::Log((fMomentum.P() + fMomentum.Pz()) / (fMomentum.P()-fMomentum.Pz()));
147 //___________________________________________________________________
148 Double_t Particle::Rapidity() const {
152 if (fMomentum.E() != fMomentum.Pz())
153 return 0.5 * TMath::Log((fMomentum.E() + fMomentum.Pz()) / (fMomentum.E() - fMomentum.Pz()));
157 //___________________________________________________________________
158 Double_t Particle::Phi() const {
162 return TMath::Pi()+TMath::ATan2(-fMomentum.Py(), -fMomentum.Px());
165 //___________________________________________________________________
166 Double_t Particle::Theta() const {
170 return !fMomentum.Pz() ? TMath::Pi() / 2 : TMath::ACos(fMomentum.Pz() / fMomentum.P());
173 //___________________________________________________________________
174 Double_t Particle::Pt() const {
178 return TMath::Sqrt(fMomentum.Px() * fMomentum.Px() + fMomentum.Py() * fMomentum.Py());
181 //___________________________________________________________________
182 Double_t S(const TLorentzVector &v1, const TLorentzVector &v2) {
186 return TMath::Power(v1.T() + v2.T(), 2) - TMath::Power(v1.X() + v2.X(), 2) -
187 TMath::Power(v1.Y() + v2.Y(), 2) - TMath::Power(v1.Z() + v2.Z(), 2);
190 //___________________________________________________________________
191 Double_t T(const TLorentzVector & v1, const TLorentzVector & v2) {
195 return TMath::Power(v1.T() - v2.T(), 2) - TMath::Power(v1.X() - v2.X(), 2) -
196 TMath::Power(v1.Y() - v2.Y(), 2) - TMath::Power(v1.Z() - v2.Z(), 2);
199 //___________________________________________________________________
200 void ParticleAllocator::AddParticle(const Particle & p, List_t &list) {
202 // Add a particle to the list
204 if(fFreeNodes.empty())
207 list.splice(list.end(), fFreeNodes, fFreeNodes.begin());
212 //___________________________________________________________________
213 void ParticleAllocator::FreeListNode(List_t & list, LPIT_t it) {
215 // remove a particle from list
217 fFreeNodes.splice(fFreeNodes.end(), list, it);
220 //___________________________________________________________________
221 void ParticleAllocator::FreeList(List_t & list) {
225 fFreeNodes.splice(fFreeNodes.end(), list);