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