]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TUHKMgen/UHKM/Particle.h
o adapt Macro to new TPC structure (Benjamin Hess)
[u/mrichter/AliRoot.git] / TUHKMgen / UHKM / Particle.h
CommitLineData
03896fc4 1//
2//
3// Nikolai Amelin, Ludmila Malinina, Timur Pocheptsov (C) JINR/Dubna
4// amelin@sunhe.jinr.ru, malinina@sunhe.jinr.ru, pocheptsov@sunhe.jinr.ru
5// November. 2, 2005
6//
7//
b1c2e580 8
03896fc4 9#ifndef PARTICLE_H
10#define PARTICLE_H
b1c2e580 11
12#include <list>
03896fc4 13#include <iostream>
14using namespace std;
b1c2e580 15
16#include <TLorentzRotation.h>
17#include <TLorentzVector.h>
18#include <TVector3.h>
b1c2e580 19#include "ParticlePDG.h"
b1c2e580 20
21class Particle {
b1c2e580 22 public:
23 Particle(const TLorentzVector &, const TLorentzVector &);
7b7936e9 24 Particle(const Particle& copy);
25 Particle& operator=(const Particle&);
7b7936e9 26 virtual ~Particle() {};
b1c2e580 27 Particle(ParticlePDG *pdg = 0);
28 Particle(ParticlePDG *pdg, const TLorentzVector &pos, const TLorentzVector &mom,
29 Double_t lastInterTime = 0., Int_t lastInterNum = 0, Int_t type=0);
30 Particle(ParticlePDG *pdg, const TLorentzVector &pos, const TLorentzVector &mom,
31 Double_t lastInterTime, Int_t lastInterNum, Int_t type, Int_t motherPdg,
32 const TLorentzVector &motherPos, const TLorentzVector &motherMom);
33
34 Double_t X()const{return fPosition.X();}
35 Double_t X(Double_t val){fPosition.SetX(val); return val;}
36 Double_t Y()const{return fPosition.Y();}
37 Double_t Y(Double_t val){fPosition.SetY(val); return val;}
38 Double_t Z()const{return fPosition.Z();}
39 Double_t Z(Double_t val){fPosition.SetZ(val); return val;}
40 Double_t T()const{return fPosition.T();}
41 Double_t T(Double_t val){fPosition.SetT(val); return val;}
42 Double_t Px()const{return fMomentum.Px();}
43 Double_t Px(Double_t val){fMomentum.SetPx(val); return val;}
44 Double_t Py()const{return fMomentum.Py();}
45 Double_t Py(Double_t val){fMomentum.SetPy(val); return val;}
46 Double_t Pz()const{return fMomentum.Pz();}
47 Double_t Pz(Double_t val){fMomentum.SetPz(val); return val;}
48 Double_t E()const{return fMomentum.E();}
49 Double_t E(Double_t val){fMomentum.SetE(val); return val;}
50
51 TLorentzVector &Pos(){return fPosition;}
52 const TLorentzVector &Pos()const{return fPosition;}
53 TLorentzVector &Pos(const TLorentzVector &val){return fPosition = val;}
54 TLorentzVector &Mom(){return fMomentum;}
55 const TLorentzVector &Mom()const{return fMomentum;}
56 TLorentzVector &Mom(const TLorentzVector &val){return fMomentum = val;}
3fa37a65 57
58 void SetDecayed() {fDecayed = kTRUE;}
59 Bool_t GetDecayed() const {return fDecayed;}
b1c2e580 60
61 void Boost(const TVector3 &val){fMomentum.Boost(val);}
62 void Boost(const TLorentzVector &val){fMomentum.Boost(val.BoostVector());}
63 void TransformMomentum(const TRotation &rotator){fMomentum *= rotator;}
64 void TransformPosition(const TRotation &rotator){fPosition *= rotator;}
65 void Shift(const TVector3 &val){fPosition += TLorentzVector(val, 0.);}
66
67 //Pseudorapidity
68 Double_t Eta ()const;
69 //Rapidity
70 Double_t Rapidity()const;
71 Double_t Phi()const;
72 Double_t Theta()const;
73 Double_t Pt()const;
74
75 Int_t Encoding() const;
76 Double_t TableMass() const;
03896fc4 77 ParticlePDG* Def() const {return fParticleProperties;}
78 void Def(ParticlePDG *newProp) {fParticleProperties = newProp;}
b1c2e580 79 //mother
80 void SetLastMotherPdg(Int_t value){fLastMotherPdg = value;}
81 Int_t GetLastMotherPdg() const {return fLastMotherPdg;}
82
83 // aic(2008/08/08): functions added in order to enable tracking of mother/daughter particles by a unique index
84 // The index coincides with the position of the particle in the secondaries list.
3fa37a65 85 Int_t SetIndex() {
03896fc4 86 fIndex = ++fgLastIndex;
3fa37a65 87 return fIndex;
88 }
7b7936e9 89 Int_t GetIndex() const {return fIndex;}
03896fc4 90 static Int_t GetLastIndex() {return fgLastIndex;}
3fa37a65 91 static void InitIndexing() {
03896fc4 92 fgLastIndex = -1;
3fa37a65 93 }
b1c2e580 94 void SetMother(Int_t value) {fMotherIndex = value;}
7b7936e9 95 Int_t GetMother() const {return fMotherIndex;}
3fa37a65 96 void SetFirstDaughterIndex(Int_t index) {fFirstDaughterIndex = index;}
97 void SetLastDaughterIndex(Int_t index) {fLastDaughterIndex = index;}
98 void SetPythiaStatusCode(Int_t code) {fPythiaStatusCode = code;}
99 Int_t GetPythiaStatusCode() const {return fPythiaStatusCode;}
100
3fa37a65 101 Int_t GetNDaughters() const {
03896fc4 102 if(fFirstDaughterIndex==-1 || fLastDaughterIndex==-1) return 0;
103 else return fLastDaughterIndex-fFirstDaughterIndex+1;
b1c2e580 104 }
3fa37a65 105 Int_t GetFirstDaughterIndex() const {return fFirstDaughterIndex;}
106 Int_t GetLastDaughterIndex() const {return fLastDaughterIndex;}
b1c2e580 107
b1c2e580 108 TLorentzVector &SetLastMotherDecayCoor(const TLorentzVector &val){return fLastMotherDecayCoor = val;}
109 const TLorentzVector &GetLastMotherDecayCoor()const{return fLastMotherDecayCoor;}
b1c2e580 110 TLorentzVector &SetLastMotherDecayMom(const TLorentzVector &val){return fLastMotherDecayMom = val;}
111 const TLorentzVector &GetLastMotherDecayMom()const{return fLastMotherDecayMom;}
112
113 void SetLastInterTime(Double_t value){fLastInteractionTime = value;}
114 Double_t GetLastInterTime()const{return fLastInteractionTime;}
115 void SetLastInterNumber(Int_t value){fInteractionNumber = value;}
116 Int_t GetLastInterNumber()const{return fInteractionNumber;}
117 void IncInter(){++fInteractionNumber;}
118
119 void SetType(Int_t value){fType = value;}
120 Int_t GetType()const{return fType;}
121
786056a2 122 protected:
03896fc4 123 TLorentzVector fPosition; // 4-position vector
124 TLorentzVector fMomentum; // 4-momentum vector
125 TLorentzVector fLastMotherDecayCoor; // 4-position vector of mother
126 TLorentzVector fLastMotherDecayMom; // 4-momentum vector of mother
127 ParticlePDG *fParticleProperties; // particle PDG properties
128 Double_t fLastInteractionTime; // last interaction time
129 Int_t fInteractionNumber; // interaction number
130 Int_t fPythiaStatusCode; // PYTHIA status code
131 Int_t fLastMotherPdg; // mother's PDG code
132 Int_t fType; // particle type: 0-hydro, 1-jets
786056a2 133 Int_t fIndex; // index (0 based) of particle in the final particle list which will contain both primaries and secondaries
134 Int_t fMotherIndex; // index of the mother (-1 if its a primary particle)
135 Int_t fNDaughters; // number of daughter particles (0 if the particle had not decayed)
3fa37a65 136 Int_t fFirstDaughterIndex; // index for the first daughter particle (-1 if non-existing)
137 Int_t fLastDaughterIndex; // index for the last daughter particle (-1 if non-existing)
138 Bool_t fDecayed; // true if the decay procedure already applied
03896fc4 139 static Int_t fgLastIndex; // the last index assigned
b1c2e580 140};
141
142Double_t S(const TLorentzVector &, const TLorentzVector &);
143Double_t T(const TLorentzVector &, const TLorentzVector &);
144
145typedef std::list<Particle> List_t;
146typedef std::list<Particle>::iterator LPIT_t;
147
148class ParticleAllocator {
149 public:
25c1936c 150 ParticleAllocator() : fFreeNodes() {};
b1c2e580 151 void AddParticle(const Particle & particle, List_t & list);
152 void FreeListNode(List_t & list, LPIT_t it);
153 void FreeList(List_t & list);
154
155 private:
03896fc4 156 List_t fFreeNodes; // list
b1c2e580 157};
158
42f55a0f 159#endif