]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant4/TGeant4.cxx
command directory renamed from /g4mc to /tg4Control
[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
17a7edea 309//_____________________________________________________________________________
310void TGeant4::Gsbool(const char* onlyVolName, const char* manyVolName) {
311//
312 fGeometryManager->Gsbool(onlyVolName, manyVolName);
313}
314
d718b713 315//_____________________________________________________________________________
75578018 316void TGeant4::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
317 Float_t *absco, Float_t *effic, Float_t *rindex) {
318//
319 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
320}
321
d718b713 322//_____________________________________________________________________________
2817d3e2 323void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
324 Int_t number, Int_t nlevel) {
325//
326 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
327}
328
d718b713 329//_____________________________________________________________________________
2817d3e2 330Int_t TGeant4::VolId(const Text_t* volName) const {
331//
002034b1 332 return fSDManager->VolId(volName);
2817d3e2 333}
334
d718b713 335//_____________________________________________________________________________
2817d3e2 336const char* TGeant4::VolName(Int_t id) const {
337//
002034b1 338 return fSDManager->VolName(id);
2817d3e2 339}
340
d718b713 341//_____________________________________________________________________________
2817d3e2 342Int_t TGeant4::NofVolumes() const {
343//
002034b1 344 return fSDManager->NofVolumes();
2817d3e2 345}
346
d718b713 347//_____________________________________________________________________________
fdd271a5 348Int_t TGeant4::VolId2Mate(Int_t id) const {
349//
002034b1 350 return fSDManager->VolId2Mate(id);
fdd271a5 351}
352
353
354
2817d3e2 355// methods for physics management
356// ------------------------------------------------
357
002034b1 358//_____________________________________________________________________________
359void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
360//
361 fGeometryManager->Gstpar(itmed, param, parval);
362 fPhysicsManager->Gstpar(itmed, param, parval);
363}
364
d718b713 365//_____________________________________________________________________________
2817d3e2 366void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
367//
368 fPhysicsManager->SetCut(cutName, cutValue);
369}
370
d718b713 371//_____________________________________________________________________________
2817d3e2 372void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
373//
374 fPhysicsManager->SetProcess(flagName, flagValue);
375}
376
d718b713 377//_____________________________________________________________________________
2817d3e2 378Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
379//
380 return fPhysicsManager->Xsec(reac, energy, part, mate);
381}
382
d718b713 383//_____________________________________________________________________________
e59f13eb 384void TGeant4::SetExternalDecayer(AliDecayer* decayer) {
385//
0b742b85 386 fPhysicsManager->SetExternalDecayer(decayer);
e59f13eb 387}
388
d718b713 389//_____________________________________________________________________________
e59f13eb 390AliDecayer* TGeant4::Decayer() const {
391//
0b742b85 392 return fPhysicsManager->Decayer();
e59f13eb 393}
394
395
d718b713 396//_____________________________________________________________________________
2817d3e2 397Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
398//
399 return fPhysicsManager->IdFromPDG(pdgID);
400}
401
d718b713 402//_____________________________________________________________________________
2817d3e2 403Int_t TGeant4::PDGFromId(Int_t mcID) const {
404//
405 return fPhysicsManager->PDGFromId(mcID);
406}
407
d718b713 408//_____________________________________________________________________________
2817d3e2 409void TGeant4::DefineParticles() {
410//
411 fPhysicsManager->DefineParticles();
412}
413
414// methods for step management
415// ------------------------------------------------
416// inlined (in TGeant4.icc)
417
2817d3e2 418// methods for visualization
419// ------------------------------------------------
420
421#ifdef G4VIS_USE
d718b713 422//_____________________________________________________________________________
2817d3e2 423void TGeant4::DrawOneSpec(const char* name) {
424//
425 fVisManager->DrawOneSpec(name);
426}
427
d718b713 428//_____________________________________________________________________________
2817d3e2 429void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
430//
431 fVisManager->Gsatt(name, att, val);
432}
433
d718b713 434//_____________________________________________________________________________
2817d3e2 435void TGeant4::Gdraw(const char* name, Float_t theta, Float_t phi,
436 Float_t psi, Float_t u0, Float_t v0,
437 Float_t ul, Float_t vl) {
438//
439 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
440}
441
442#else
d718b713 443//_____________________________________________________________________________
2817d3e2 444void TGeant4::DrawOneSpec(const char* name) {
445//
446 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
447}
448
d718b713 449//_____________________________________________________________________________
2817d3e2 450void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
451//
452 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
453}
454
d718b713 455//_____________________________________________________________________________
2817d3e2 456void TGeant4::Gdraw(const char* p1, Float_t theta, Float_t phi,
457 Float_t psi, Float_t u0, Float_t v0,
458 Float_t ul, Float_t vl) {
459//
460 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
461}
462
463#endif //G4VIS_USE
464
465// methods for run control
466// ------------------------------------------------
467
d718b713 468//_____________________________________________________________________________
2817d3e2 469void TGeant4::Init() {
470//
471 fRunManager->Initialize();
472}
473
e5967ab3 474//_____________________________________________________________________________
475void TGeant4::BuildPhysics() {
476//
477 fRunManager->LateInitialize();
478}
479
d718b713 480//_____________________________________________________________________________
2817d3e2 481void TGeant4::ProcessEvent() {
482//
483 fRunManager->ProcessEvent();
484}
485
d718b713 486//_____________________________________________________________________________
2817d3e2 487void TGeant4::ProcessRun(Int_t nofEvents) {
488//
489 fRunManager->ProcessRun(nofEvents);
490}
491
d718b713 492//_____________________________________________________________________________
2817d3e2 493void TGeant4::StartGeantUI() {
494//
495 fRunManager->StartGeantUI();
496}
497
d718b713 498//_____________________________________________________________________________
2817d3e2 499void TGeant4::StartRootUI() {
500//
562476b1 501 fRunManager->StartRootUI();
2817d3e2 502}
503
d718b713 504//_____________________________________________________________________________
2817d3e2 505void TGeant4::ProcessGeantMacro(const char* macroName) {
506//
507 fRunManager->ProcessGeantMacro(macroName);
508}
509
d718b713 510//_____________________________________________________________________________
2817d3e2 511void TGeant4::ProcessGeantCommand(const char* command) {
512//
513 fRunManager->ProcessGeantCommand(command);
514}
515
d718b713 516//_____________________________________________________________________________
2817d3e2 517Int_t TGeant4::CurrentEvent() const {
518//
519 return fRunManager->CurrentEvent();
520}
521
522// Geant3 specific methods
523// !!! need to be transformed to common interface
524// ------------------------------------------------
525
d718b713 526//_____________________________________________________________________________
2817d3e2 527void TGeant4::Gdopt(const char* name, const char* value) {
528//
529 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
530}
531
d718b713 532//_____________________________________________________________________________
2817d3e2 533void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
534 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
535//
536 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
537}
538
d718b713 539//_____________________________________________________________________________
2817d3e2 540void TGeant4::DefaultRange() {
541//
542 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
543}
544
d718b713 545//_____________________________________________________________________________
2817d3e2 546void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
547//
548 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
549}
550
d718b713 551//_____________________________________________________________________________
2817d3e2 552void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
553//
554 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
555}
556
d718b713 557//_____________________________________________________________________________
2817d3e2 558void TGeant4::SetColors() {
559//
560 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
561}
562
d718b713 563//_____________________________________________________________________________
2817d3e2 564void TGeant4::Gtreve() {
565//
566 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
567}
568
d718b713 569//_____________________________________________________________________________
aee8290b 570void TGeant4::GtreveRoot() {
2817d3e2 571//
aee8290b 572 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
2817d3e2 573}
574
d718b713 575//_____________________________________________________________________________
2817d3e2 576void TGeant4::Gckmat(Int_t itmed, char* natmed) {
577//
578 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
579}
580
d718b713 581//_____________________________________________________________________________
2817d3e2 582void TGeant4::InitLego() {
583//
584 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
585}
586
d718b713 587//_____________________________________________________________________________
2817d3e2 588void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
589 Float_t& amass, Float_t& charge, Float_t& tlife) {
590//
591 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
592}
593
d718b713 594//_____________________________________________________________________________
2817d3e2 595void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
596 Float_t amass, Float_t charge, Float_t tlife) {
597//
598 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");
599}