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