new AliMC methods SetExternalDecayer(), Decayer() added
[u/mrichter/AliRoot.git] / TGeant4 / TGeant4.cxx
CommitLineData
2817d3e2 1// $Id$
2// Category: run
3//
4// See the class description in the header file.
5
6#include "TGeant4.h"
7#include "TG4Messenger.h"
8#include "TG4GeometryManager.h"
9#include "TG4PhysicsManager.h"
10#include "TG4StepManager.h"
11#include "TG4VisManager.h"
12#include "TG4RunManager.h"
13#include "TG4Globals.h"
14
15TGeant4::TGeant4(const char* name, const char* title,
16 TG4VRunConfiguration* configuration, int argc, char** argv)
17 : AliMC(name, title),
18 fVisManager(0)
19{
20 // create run manager
21 fRunManager = new TG4RunManager(configuration, argc, argv);
22 // add verbose level
23 //G4cout << "TG4RunManager has been created." << endl;
24
25 // create geometry manager
26 fGeometryManager = new TG4GeometryManager();
27 // add verbose level
28 //G4cout << "TG4GeometryManager has been created." << endl;
29
30 // create physics manager
31 fPhysicsManager = new TG4PhysicsManager();
32 // add verbose level
33 //G4cout << "TG4GeometryManager has been created." << endl;
34
35 // create step manager
36 fStepManager = new TG4StepManager();
37 // add verbose level
38 //G4cout << "TG4StepManager has been created." << endl;
39
40#ifdef G4VIS_USE
41 // create visualization manager
42 fVisManager = new TG4VisManager();
43 fVisManager->Initialize();
44#endif
45
46 // create messenger
47 fMessenger =
48 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
49}
50
51TGeant4::TGeant4(const char* name, const char* title,
52 TG4VRunConfiguration* configuration)
53 : AliMC(name, title),
54 fVisManager(0)
55{
56 // create run manager
57 fRunManager = new TG4RunManager(configuration);
58 // add verbose level
59 //G4cout << "TG4RunManager has been created." << endl;
60
61 // create geometry manager
62 fGeometryManager = new TG4GeometryManager();
63 // add verbose level
64 //G4cout << "TG4GeometryManager has been created." << endl;
65
66 // create physics manager
67 fPhysicsManager = new TG4PhysicsManager();
68 // add verbose level
69 //G4cout << "TG4GeometryManager has been created." << endl;
70
71 // create step manager
72 fStepManager = new TG4StepManager();
73 // add verbose level
74 //G4cout << "TG4StepManager has been created." << endl;
75
76#ifdef G4VIS_USE
77 // create visualization manager
78 fVisManager = new TG4VisManager();
79 fVisManager->Initialize();
80#endif
81
82 // create messenger
83 fMessenger =
84 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
85}
86
87TGeant4::TGeant4() {
88//
89}
90
91TGeant4::TGeant4(const TGeant4& right) {
92//
93 TG4Globals::Exception("TGeant4 is protected from copying.");
94}
95
96TGeant4::~TGeant4() {
97//
98 delete fRunManager;
99 delete fGeometryManager;
100 delete fPhysicsManager;
101 delete fStepManager;
102 // fVisManager is deleted with G4RunManager destructor
103 delete fMessenger;
104}
105
106// operators
107
108TGeant4& TGeant4::operator=(const TGeant4& right)
109{
110 // check assignement to self
111 if (this == &right) return *this;
112
113 TG4Globals::Exception("TGeant4 is protected from assigning.");
114
115 return *this;
116}
117
118
119// methods for building/management of geometry
120// ------------------------------------------------
121
122void TGeant4::FinishGeometry() {
123//
124 fGeometryManager->Ggclos();
125}
126
127void TGeant4::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
128 Float_t &dens, Float_t &radl, Float_t &absl,
129 Float_t* ubuf, Int_t& nbuf) {
130//
131 fGeometryManager
132 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
133}
134
135void TGeant4::Material(Int_t& kmat, const char* name, Float_t a,
136 Float_t z, Float_t dens, Float_t radl, Float_t absl,
137 Float_t* buf, Int_t nwbuf) {
138//
139 fGeometryManager
140 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
141}
142
143void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
144 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
145//
146 fGeometryManager
147 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
148}
149
150void TGeant4::Medium(Int_t& kmed, const char *name, Int_t nmat,
151 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
152 Float_t stemax, Float_t deemax, Float_t epsil,
153 Float_t stmin, Float_t* ubuf, Int_t nbuf) {
154//
155 fGeometryManager
156 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
157 epsil, stmin, ubuf, nbuf);
158}
159
160void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
161 Float_t thetaY, Float_t phiY, Float_t thetaZ,
162 Float_t phiZ) {
163//
164 fGeometryManager
165 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
166}
167
168void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
169//
170 fGeometryManager->Gstpar(itmed, param, parval);
171}
172
173void TGeant4::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
174 Float_t *absco, Float_t *effic, Float_t *rindex) {
175//
176
177 fGeometryManager->Gsckov(itmed, npckov, ppckov, absco, effic, rindex);
178}
179
180Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
181 Float_t *upar, Int_t np) {
182//
183 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
184}
185
186void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv,
187 Int_t iaxis) {
188//
189 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
190}
191
192void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
193 Int_t iaxis, Float_t c0i, Int_t numed) {
194//
195 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
196}
197
198void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step,
199 Int_t iaxis, Int_t numed, Int_t ndvmx) {
200//
201 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
202}
203
204void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step,
205 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) {
206//
207 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
208}
209
210void TGeant4::Gsord(const char *name, Int_t iax) {
211//
212 fGeometryManager->Gsord(name, iax);
213}
214
215void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
216 Float_t x, Float_t y, Float_t z, Int_t irot,
217 const char *konly) {
218//
219 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
220}
221
222void TGeant4::Gsposp(const char *name, Int_t nr, const char *mother,
223 Float_t x, Float_t y, Float_t z, Int_t irot,
224 const char *konly, Float_t *upar, Int_t np) {
225//
226 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
227}
228
229void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
230 Int_t number, Int_t nlevel) {
231//
232 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
233}
234
235Int_t TGeant4::VolId(const Text_t* volName) const {
236//
237 return fGeometryManager->VolId(volName);
238}
239
240const char* TGeant4::VolName(Int_t id) const {
241//
242 return fGeometryManager->VolName(id);
243}
244
245Int_t TGeant4::NofVolumes() const {
246//
247 return fGeometryManager->NofVolumes();
248}
249
250// methods for physics management
251// ------------------------------------------------
252
253void TGeant4::BuildPhysics() {
254//
255 fPhysicsManager->BuildPhysics();
256}
257
258void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
259//
260 fPhysicsManager->SetCut(cutName, cutValue);
261}
262
263void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
264//
265 fPhysicsManager->SetProcess(flagName, flagValue);
266}
267
268Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
269//
270 return fPhysicsManager->Xsec(reac, energy, part, mate);
271}
272
273Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
274//
275 return fPhysicsManager->IdFromPDG(pdgID);
276}
277
278Int_t TGeant4::PDGFromId(Int_t mcID) const {
279//
280 return fPhysicsManager->PDGFromId(mcID);
281}
282
283void TGeant4::DefineParticles() {
284//
285 fPhysicsManager->DefineParticles();
286}
287
288// methods for step management
289// ------------------------------------------------
290// inlined (in TGeant4.icc)
291
292void TGeant4::Rndm(Float_t* array, const Int_t size) const {
293//
294 fStepManager->Rndm(array, size);
295}
296
297// methods for visualization
298// ------------------------------------------------
299
300#ifdef G4VIS_USE
301void TGeant4::DrawOneSpec(const char* name) {
302//
303 fVisManager->DrawOneSpec(name);
304}
305
306void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
307//
308 fVisManager->Gsatt(name, att, val);
309}
310
311void TGeant4::Gdraw(const char* name, Float_t theta, Float_t phi,
312 Float_t psi, Float_t u0, Float_t v0,
313 Float_t ul, Float_t vl) {
314//
315 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
316}
317
318#else
319void TGeant4::DrawOneSpec(const char* name) {
320//
321 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
322}
323
324void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
325//
326 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
327}
328
329void TGeant4::Gdraw(const char* p1, Float_t theta, Float_t phi,
330 Float_t psi, Float_t u0, Float_t v0,
331 Float_t ul, Float_t vl) {
332//
333 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
334}
335
336#endif //G4VIS_USE
337
338// methods for run control
339// ------------------------------------------------
340
341void TGeant4::Init() {
342//
343 fRunManager->Initialize();
344}
345
346void TGeant4::ProcessEvent() {
347//
348 fRunManager->ProcessEvent();
349}
350
351void TGeant4::ProcessRun(Int_t nofEvents) {
352//
353 fRunManager->ProcessRun(nofEvents);
354}
355
356void TGeant4::StartGeantUI() {
357//
358 fRunManager->StartGeantUI();
359}
360
361void TGeant4::StartRootUI() {
362//
562476b1 363 fRunManager->StartRootUI();
2817d3e2 364}
365
366void TGeant4::ProcessGeantMacro(const char* macroName) {
367//
368 fRunManager->ProcessGeantMacro(macroName);
369}
370
371void TGeant4::ProcessGeantCommand(const char* command) {
372//
373 fRunManager->ProcessGeantCommand(command);
374}
375
376Int_t TGeant4::CurrentEvent() const {
377//
378 return fRunManager->CurrentEvent();
379}
380
381// Geant3 specific methods
382// !!! need to be transformed to common interface
383// ------------------------------------------------
384
385void TGeant4::Gdopt(const char* name, const char* value) {
386//
387 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
388}
389
390void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
391 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
392//
393 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
394}
395
396void TGeant4::DefaultRange() {
397//
398 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
399}
400
401void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
402//
403 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
404}
405
406void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
407//
408 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
409}
410
411void TGeant4::SetColors() {
412//
413 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
414}
415
416void TGeant4::Gtreve() {
417//
418 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
419}
420
aee8290b 421void TGeant4::GtreveRoot() {
2817d3e2 422//
aee8290b 423 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
2817d3e2 424}
425
426void TGeant4::Gckmat(Int_t itmed, char* natmed) {
427//
428 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
429}
430
431void TGeant4::InitLego() {
432//
433 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
434}
435
436void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
437 Float_t& amass, Float_t& charge, Float_t& tlife) {
438//
439 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
440}
441
442void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
443 Float_t amass, Float_t charge, Float_t tlife) {
444//
445 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");
446}