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