KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimNucleus.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Mon Jun 28 15:02:00 2010
2 //Author: bonnet
3 
4 #include "KVSimNucleus.h"
5 #include "TVector3.h"
6 
8 
9 
10 //___________________________
11 
12 
15 {
16  o.Copy(*this);
17 }
18 
19 
20 
23 
24 void KVSimNucleus::Copy(TObject& obj) const
25 {
26 
27  //Copy l'object "this" vers obj
28 
29  KVNucleus::Copy(obj);
30  ((KVSimNucleus&)obj).position = position;
31  ((KVSimNucleus&)obj).angmom = angmom;
32  ((KVSimNucleus&)obj).fDensity = fDensity;
33 }
34 
35 
36 
39 
41 {
42  //set the position of the nucleus in position space
43  position.SetXYZ(rx, ry, rz);
44 }
45 
46 
47 
50 
52 {
53  //set the position of the nucleus in position space
54  position = r;
55 }
56 
57 
58 
61 
63 {
64  //set density of the nucleus in nuc/fm3
65  fDensity = density;
66 }
67 
68 
69 
72 
74 {
75  //get density of the nucleus in nuc/fm3
76  return fDensity;
77 }
78 
79 
80 
81 
84 
86 {
87  //set the angular momentum of the nucleus
88  angmom.SetXYZ(lx, ly, lz);
89 }
90 
91 
92 
93 
98 
100 {
101  // KVNucleus addition operator.
102  // Add two nuclei together to form a compound nucleus whose Z, A, momentum
103  // and excitation energy are calculated from energy and momentum conservation.
104 
105  const KVSimNucleus& lhs = *this;
106  Int_t ztot = lhs.GetZ() + rhs.GetZ();
107  Int_t atot = lhs.GetA() + ((KVNucleus&) rhs).GetA();
108  KVSimNucleus CN(ztot, atot);
109 
110  Double_t etot = lhs.E() + rhs.E();
111  TVector3 ptot = lhs.GetMomentum() + rhs.GetMomentum();
112  TLorentzVector q(ptot, etot);
113  CN.Set4Mom(q);
114 
115  TVector3 pos;
116  const TVector3* prhs = rhs.GetPosition();
117  pos.SetX(prhs->X()*rhs.GetA() + position.X()*lhs.GetA());
118  pos.SetY(prhs->Y()*rhs.GetA() + position.Y()*lhs.GetA());
119  pos.SetZ(prhs->Z()*rhs.GetA() + position.Z()*lhs.GetA());
120 
121  pos *= 1. / (atot);
122  CN.SetPosition(pos);
123 
124  return CN;
125 
126 }
127 
128 
129 
132 
134 {
135  //KVNucleus addition and assignment operator.
136 
137  KVSimNucleus temp = (*this) + rhs;
138  (*this) = temp;
139  return *this;
140 }
141 
142 
143 
146 
148 {
149  // copy assignment operator
150  if (&p != this)
151  p.Copy(*this);
152  return (*this);
153 }
154 
155 
156 
161 
163 {
164  // For particles whose detection has been simulated in a KVMultiDetArray:
165  // return the energy loss in given detector
166  // returns -1.0 if detector not hit
167 
168  TString parname;
169  parname.Form("DE:%s", detname.Data());
170  return GetParameters()->GetDoubleValue(parname);
171 }
172 
173 
174 
179 
181 {
182  // For particles whose detection has been simulated in a KVMultiDetArray:
183  // returns coordinates of point of entry in detector
184  // returns (0,0,0) (coordinate origin) if detector not hit
185  TString parname;
186  parname.Form("Xin:%s", detname.Data());
187  if (GetParameters()->HasParameter(parname)) {
188  Double_t x = GetParameters()->GetDoubleValue(parname);
189  Double_t y = GetParameters()->GetDoubleValue(Form("Yin:%s", detname.Data()));
190  Double_t z = GetParameters()->GetDoubleValue(Form("Zin:%s", detname.Data()));
191  return TVector3(x, y, z);
192  }
193  return TVector3(0, 0, 0);
194 }
195 
196 
197 
202 
204 {
205  // For particles whose detection has been simulated in a KVMultiDetArray:
206  // returns coordinates of point of exit from detector
207  // returns (0,0,0) (coordinate origin) if detector not hit
208  TString parname;
209  parname.Form("Xout:%s", detname.Data());
210  if (GetParameters()->HasParameter(parname)) {
211  Double_t x = GetParameters()->GetDoubleValue(parname);
212  Double_t y = GetParameters()->GetDoubleValue(Form("Yout:%s", detname.Data()));
213  Double_t z = GetParameters()->GetDoubleValue(Form("Zout:%s", detname.Data()));
214  return TVector3(x, y, z);
215  }
216  return TVector3(0, 0, 0);
217 }
218 
219 
220 
222 
224 {
225  KVNucleus::Print(t);
226  std::cout << "KVSimNucleus: Position : ";
227  position.Print();
228  std::cout << "KVSimNucleus: Ang. Mom. : ";
229  angmom.Print();
230 }
231 
232 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
ROOT::R::TRInterface & r
double Double_t
const char Option_t
float * q
char * Form(const char *fmt,...)
Double_t GetDoubleValue(const Char_t *name) const
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
virtual void Print(Option_t *t="") const
Display nucleus parameters.
Definition: KVNucleus.cpp:758
Int_t GetA() const
Definition: KVNucleus.cpp:799
virtual void Copy(TObject &) const
Copy this KVNucleus into the KVNucleus object referenced by "obj".
Definition: KVNucleus.cpp:834
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:770
TVector3 GetMomentum() const
Definition: KVParticle.h:606
KVNameValueList * GetParameters() const
Definition: KVParticle.h:816
void Set4Mom(const TLorentzVector &p)
Definition: KVParticle.h:591
Nucleus in a simulated event.
Definition: KVSimNucleus.h:31
void SetPosition(Double_t rx, Double_t ry, Double_t rz)
set the position of the nucleus in position space
TVector3 GetExitPosition(const TString &detname) const
KVSimNucleus & operator+=(const KVSimNucleus &rhs)
KVNucleus addition and assignment operator.
void SetAngMom(Double_t lx, Double_t ly, Double_t lz)
set the angular momentum of the nucleus
TVector3 angmom
angular momentum of the particle in units
Definition: KVSimNucleus.h:35
void Copy(TObject &obj) const
Copy l'object "this" vers obj.
Double_t GetEnergyLoss(const TString &detname) const
void SetDensity(Double_t)
set density of the nucleus in nuc/fm3
Double_t fDensity
density of the nucleus in nuc.fm-3
Definition: KVSimNucleus.h:36
KVSimNucleus & operator=(const KVSimNucleus &)
copy assignment operator
Double_t GetDensity() const
get density of the nucleus in nuc/fm3
void Print(Option_t *t="") const
Display nucleus parameters.
TVector3 position
vector position of the particle in fm
Definition: KVSimNucleus.h:34
TVector3 GetEntrancePosition(const TString &detname) const
const TVector3 * GetPosition() const
Definition: KVSimNucleus.h:55
KVSimNucleus operator+(const KVSimNucleus &rhs) const
Double_t E() const
const char * Data() const
void Form(const char *fmt,...)
Double_t Z() const
void SetY(Double_t)
void SetXYZ(Double_t x, Double_t y, Double_t z)
Double_t Y() const
Double_t X() const
void SetX(Double_t)
void Print(Option_t *option="") const
void SetZ(Double_t)
Double_t y[n]
Double_t x[n]