KaliVeda
Toolkit for HIC analysis
KVSimNucleus.cpp
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 #include <iostream>
7 
9 
10 
11 //___________________________
12 
13 
16 {
17  o.Copy(*this);
18 }
19 
20 
21 
24 
25 void KVSimNucleus::Copy(TObject& obj) const
26 {
27 
28  //Copy l'object "this" vers obj
29 
30  KVNucleus::Copy(obj);
31  ((KVSimNucleus&)obj).position = position;
32  ((KVSimNucleus&)obj).angmom = angmom;
33  ((KVSimNucleus&)obj).fDensity = fDensity;
34 }
35 
36 
37 
40 
42 {
43  //set the position of the nucleus in position space
44  position.SetXYZ(rx, ry, rz);
45 }
46 
47 
48 
51 
53 {
54  //set the position of the nucleus in position space
55  position = r;
56 }
57 
58 
59 
62 
64 {
65  //set density of the nucleus in nuc/fm3
66  fDensity = density;
67 }
68 
69 
70 
73 
75 {
76  //get density of the nucleus in nuc/fm3
77  return fDensity;
78 }
79 
80 
81 
82 
85 
87 {
88  //set the angular momentum of the nucleus
89  angmom.SetXYZ(lx, ly, lz);
90 }
91 
92 
93 
94 
99 
101 {
102  // KVNucleus addition operator.
103  // Add two nuclei together to form a compound nucleus whose Z, A, momentum
104  // and excitation energy are calculated from energy and momentum conservation.
105 
106  const KVSimNucleus& lhs = *this;
107  Int_t ztot = lhs.GetZ() + rhs.GetZ();
108  Int_t atot = lhs.GetA() + ((KVNucleus&) rhs).GetA();
109  KVSimNucleus CN(ztot, atot);
110 
111  Double_t etot = lhs.E() + rhs.E();
112  TVector3 ptot = lhs.GetMomentum() + rhs.GetMomentum();
113  TLorentzVector q(ptot, etot);
114  CN.Set4Mom(q);
115 
116  TVector3 pos;
117  const TVector3* prhs = rhs.GetPosition();
118  pos.SetX(prhs->X()*rhs.GetA() + position.X()*lhs.GetA());
119  pos.SetY(prhs->Y()*rhs.GetA() + position.Y()*lhs.GetA());
120  pos.SetZ(prhs->Z()*rhs.GetA() + position.Z()*lhs.GetA());
121 
122  pos *= 1. / (atot);
123  CN.SetPosition(pos);
124 
125  return CN;
126 
127 }
128 
129 
130 
133 
135 {
136  //KVNucleus addition and assignment operator.
137 
138  KVSimNucleus temp = (*this) + rhs;
139  (*this) = temp;
140  return *this;
141 }
142 
143 
144 
147 
149 {
150  // copy assignment operator
151  if (&p != this)
152  p.Copy(*this);
153  return (*this);
154 }
155 
156 
157 
162 
164 {
165  // For particles whose detection has been simulated in a KVMultiDetArray:
166  // return the energy loss in given detector
167  // returns -1.0 if detector not hit
168 
169  TString parname;
170  parname.Form("DE:%s", detname.Data());
171  return GetParameters()->GetDoubleValue(parname);
172 }
173 
174 
175 
180 
182 {
183  // For particles whose detection has been simulated in a KVMultiDetArray:
184  // returns coordinates of point of entry in detector
185  // returns (0,0,0) (coordinate origin) if detector not hit
186  TString parname;
187  parname.Form("Xin:%s", detname.Data());
188  if (GetParameters()->HasParameter(parname)) {
189  Double_t x = GetParameters()->GetDoubleValue(parname);
190  Double_t y = GetParameters()->GetDoubleValue(Form("Yin:%s", detname.Data()));
191  Double_t z = GetParameters()->GetDoubleValue(Form("Zin:%s", detname.Data()));
192  return TVector3(x, y, z);
193  }
194  return TVector3(0, 0, 0);
195 }
196 
197 
198 
203 
205 {
206  // For particles whose detection has been simulated in a KVMultiDetArray:
207  // returns coordinates of point of exit from detector
208  // returns (0,0,0) (coordinate origin) if detector not hit
209  TString parname;
210  parname.Form("Xout:%s", detname.Data());
211  if (GetParameters()->HasParameter(parname)) {
212  Double_t x = GetParameters()->GetDoubleValue(parname);
213  Double_t y = GetParameters()->GetDoubleValue(Form("Yout:%s", detname.Data()));
214  Double_t z = GetParameters()->GetDoubleValue(Form("Zout:%s", detname.Data()));
215  return TVector3(x, y, z);
216  }
217  return TVector3(0, 0, 0);
218 }
219 
220 
221 
223 
225 {
226  KVNucleus::Print(t);
227  std::cout << "KVSimNucleus: Position : ";
228  position.Print();
229  std::cout << "KVSimNucleus: Ang. Mom. : ";
230  angmom.Print();
231 }
232 
233 
int Int_t
ROOT::R::TRInterface & r
double Double_t
const char Option_t
winID h TVirtualViewer3D TVirtualGLPainter p
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:126
virtual void Print(Option_t *t="") const
Display nucleus parameters.
Definition: KVNucleus.cpp:761
Int_t GetA() const
Definition: KVNucleus.cpp:802
virtual void Copy(TObject &) const
Copy this KVNucleus into the KVNucleus object referenced by "obj".
Definition: KVNucleus.cpp:837
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:773
TVector3 GetMomentum() const
Definition: KVParticle.h:604
KVNameValueList * GetParameters() const
Definition: KVParticle.h:815
void Set4Mom(const TLorentzVector &p)
Definition: KVParticle.h:589
Nucleus in a simulated event.
Definition: KVSimNucleus.h:32
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:36
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:37
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
TVector3 position
vector position of the particle in fm
Definition: KVSimNucleus.h:35
TVector3 GetEntrancePosition(const TString &detname) const
const TVector3 * GetPosition() const
Definition: KVSimNucleus.h:56
KVSimNucleus operator+(const KVSimNucleus &rhs) const
Double_t E() const
virtual void Copy(TObject &object) 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)
void Print(Option_t *option="") const override
Double_t Y() const
Double_t X() const
void SetX(Double_t)
void SetZ(Double_t)
Double_t y[n]
Double_t x[n]
ClassImp(TPyArg)