Pluto v6.3.0
Loading...
Searching...
No Matches
UEvent.cc
Go to the documentation of this file.
1#include <iostream>
2using namespace std;
3
4#include "TObject.h"
5#include "TString.h"
6#include "TClonesArray.h"
7
8#include "UParticle.h"
9#include "UEvent.h"
10
11
12//____________________________________________________________________
13//
14// UEvent
15//
16// Class for event description. Contains the particle array
17//
18
19
20//--------------------------------------------------------------------
22 // Default constructor
23 fEventNr = 0;
24 fB = fPhi = 0.;
25 fNes = 1;
26 fStepNr = 0;
27 fStepT = 0.;
28 fNpa = 0;
29 fParticles = new TClonesArray("UParticle", 100);
30}
31//--------------------------------------------------------------------
32
33
34//--------------------------------------------------------------------
35UEvent::UEvent(const UEvent &right) : TObject(right) {
36 // Copy constructor
37 fEventNr = right.fEventNr;
38 fB = right.fB;
39 fPhi = right.fPhi;
40 fNes = right.fNes;
41 fStepNr = right.fStepNr;
42 fStepT = right.fStepT;
43 fNpa = right.fNpa;
44 fParticles = new TClonesArray("UParticle", 100);
45 UParticle* p;
46 for(Int_t i=0; i<fNpa; i++) {
47 p = (UParticle*) right.fParticles->At(i);
48 new ((*fParticles)[i]) UParticle(*p);
49 }
50}
51//--------------------------------------------------------------------
52
53
54//--------------------------------------------------------------------
56 // Destructor
57 Clear();
58 delete fParticles;
59}
60//--------------------------------------------------------------------
61
62
63
64//--------------------------------------------------------------------
65void UEvent::Print(Option_t *option) {
66 // Print data members to the standard output
67 cout << "---------------------------------------------" << endl
68 << "-I- Event -I-" << endl
69 << "Event number : " << fEventNr << endl
70 << "Impact parameter (fm) : " << fB << endl
71 << "Reaction plane angle (rad) : " << fPhi << endl
72 << "Number of time steps : " << fNes << endl
73 << "Time step number : " << fStepNr << endl
74 << "Time of the time step (fm) : " << fStepT << endl
75 << "Number of particles : " << fNpa << endl;
76 TString opt = option;
77 if(opt.Contains("all")) {
78 UParticle *particle;
79 for(Int_t iPa=0; iPa<fNpa; iPa++) {
80 particle = (UParticle*) fParticles->At(iPa);
81 particle->Print(option);
82 }
83 }
84 cout << "---------------------------------------------" << endl;
85}
86//--------------------------------------------------------------------
87
88
89
90//--------------------------------------------------------------------
91UParticle *UEvent::GetParticle(Int_t index) const {
92 // Get pointer to the particle.
93 // index - index of the particle
94 if(index < 0) {
95 return NULL;
96 }
97 if(index >= fNpa) {
98 return NULL;
99 }
100 return ((UParticle*) fParticles->At(index));
101}
102//--------------------------------------------------------------------
103
104
105
106//--------------------------------------------------------------------
107void UEvent::AddParticle(Int_t index, Int_t pdg, Int_t status,
108 Int_t parent, Int_t parentDecay,
109 Int_t mate, Int_t decay, Int_t child[2],
110 Double_t px, Double_t py, Double_t pz, Double_t e,
111 Double_t x, Double_t y, Double_t z, Double_t t,
112 Double_t weight) {
113 // Add particle to the array
114 new ((*fParticles)[fNpa]) UParticle(index, pdg, status, parent,
115 parentDecay, mate, decay, child,
116 px, py, pz, e, x, y, z, t, weight);
117 fNpa += 1;
118}
119//--------------------------------------------------------------------
120
121
122
123//--------------------------------------------------------------------
124void UEvent::AddParticle(Int_t index, Int_t pdg, Int_t status,
125 Int_t parent, Int_t parentDecay,
126 Int_t mate, Int_t decay, Int_t child[2],
127 TLorentzVector mom, TLorentzVector pos,
128 Double_t weight) {
129 // Add particle to the array
130 new ((*fParticles)[fNpa]) UParticle(index, pdg, status, parent,
131 parentDecay, mate, decay, child,
132 mom, pos, weight);
133 fNpa += 1;
134}
135//--------------------------------------------------------------------
136
137
138
139//--------------------------------------------------------------------
140void UEvent::AddParticle(const UParticle &particle) {
141 // Add particle to the array
142 new ((*fParticles)[fNpa]) UParticle(particle);
143 fNpa += 1;
144}
145//--------------------------------------------------------------------
146
147
148
149//--------------------------------------------------------------------
150void UEvent::SetParameters(Int_t eventNr, Double_t b, Double_t phi, Int_t nes,
151 Int_t stepNr, Double_t stepT) {
152 // Set the event parameters
153 fEventNr = eventNr;
154 fB = b;
155 fPhi = phi;
156 fNes = nes;
157 fStepNr = stepNr;
158 fStepT = stepT;
159}
160//--------------------------------------------------------------------
161
162
163
164//--------------------------------------------------------------------
165void UEvent::Clear(const Option_t*) {
166 // Remove the particles from the array and reset counter
167 fParticles->Clear();
168 fNpa = 0;
169}
170//--------------------------------------------------------------------
171
172
173
174//--------------------------------------------------------------------
175void UEvent::RemoveAt(Int_t i) {
176 // Remove one particle from the array.
177 // i - index of the particle.
178 // Array is automaticaly compressed afterwards, mind the indexing
179 fParticles->RemoveAt(i);
180 fParticles->Compress();
181}
182//--------------------------------------------------------------------
183
184
186
ClassImp(UEvent)
double pz
double px
double py
void AddParticle(Int_t index, Int_t pdg, Int_t status, Int_t parent, Int_t parentDecay, Int_t mate, Int_t decay, Int_t child[2], Double_t px, Double_t py, Double_t pz, Double_t e, Double_t x, Double_t y, Double_t z, Double_t t, Double_t weight)
Definition UEvent.cc:107
void RemoveAt(Int_t i)
Definition UEvent.cc:175
void SetParameters(Int_t eventNr, Double_t b, Double_t phi, Int_t nes, Int_t stepNr, Double_t stepT)
Definition UEvent.cc:150
virtual ~UEvent()
Definition UEvent.cc:55
UEvent()
Definition UEvent.cc:21
void Print(Option_t *option="")
Definition UEvent.cc:65
void Clear(const Option_t *=NULL)
Definition UEvent.cc:165
UParticle * GetParticle(Int_t index) const
Definition UEvent.cc:91
void Print(Option_t *option="")
Definition UParticle.cc:201
PParticle * p
Definition dp_mult.C:24
PPDGPlugin * pdg
PDalitzDistribution * decay