4 // Author: I. Hrivnacova
8 // See the class description in the header file.
11 #include "TG4Messenger.h"
12 #include "TG4VRunConfiguration.h"
13 #include "TG4GeometryManager.h"
14 #include "TG4SDManager.h"
15 #include "TG4PhysicsManager.h"
16 #include "TG4StepManager.h"
17 #include "TG4VisManager.h"
18 #include "TG4RunManager.h"
19 #include "TG4Globals.h"
21 #include "AliDecayer.h"
23 //_____________________________________________________________________________
24 TGeant4::TGeant4(const char* name, const char* title,
25 TG4VRunConfiguration* configuration, int argc, char** argv)
30 fRunManager = new TG4RunManager(configuration, argc, argv);
32 //G4cout << "TG4RunManager has been created." << endl;
34 // create geometry manager
35 fGeometryManager = new TG4GeometryManager();
37 //G4cout << "TG4GeometryManager has been created." << endl;
39 // create sensitive detectors manager
40 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
42 //G4cout << "TG4SDManager has been created." << endl;
44 // create physics manager
45 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
47 //G4cout << "TG4GeometryManager has been created." << endl;
49 // create step manager
50 fStepManager = new TG4StepManager();
52 //G4cout << "TG4StepManager has been created." << endl;
55 // create visualization manager
56 fVisManager = new TG4VisManager();
57 fVisManager->Initialize();
62 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
65 //_____________________________________________________________________________
66 TGeant4::TGeant4(const char* name, const char* title,
67 TG4VRunConfiguration* configuration)
72 fRunManager = new TG4RunManager(configuration);
74 //G4cout << "TG4RunManager has been created." << endl;
76 // create geometry manager
77 fGeometryManager = new TG4GeometryManager();
79 //G4cout << "TG4GeometryManager has been created." << endl;
81 // create sensitive detectors manager
82 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
84 //G4cout << "TG4SDManager has been created." << endl;
86 // create physics manager
87 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
89 //G4cout << "TG4GeometryManager has been created." << endl;
91 // create step manager
92 fStepManager = new TG4StepManager();
94 //G4cout << "TG4StepManager has been created." << endl;
97 // create visualization manager
98 fVisManager = new TG4VisManager();
99 fVisManager->Initialize();
104 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
107 //_____________________________________________________________________________
112 //_____________________________________________________________________________
113 TGeant4::TGeant4(const TGeant4& right) {
115 TG4Globals::Exception("TGeant4 is protected from copying.");
118 //_____________________________________________________________________________
119 TGeant4::~TGeant4() {
122 delete fGeometryManager;
124 delete fPhysicsManager;
126 // fVisManager is deleted with G4RunManager destructor
132 //_____________________________________________________________________________
133 TGeant4& TGeant4::operator=(const TGeant4& right)
135 // check assignement to self
136 if (this == &right) return *this;
138 TG4Globals::Exception("TGeant4 is protected from assigning.");
144 // methods for building/management of geometry
145 // ------------------------------------------------
147 //_____________________________________________________________________________
148 void TGeant4::FinishGeometry() {
150 fGeometryManager->Ggclos();
153 //_____________________________________________________________________________
154 void 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) {
159 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
162 //_____________________________________________________________________________
163 void 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) {
168 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
171 //_____________________________________________________________________________
172 void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
173 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
176 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
179 //_____________________________________________________________________________
180 void 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) {
186 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
187 epsil, stmin, ubuf, nbuf);
190 //_____________________________________________________________________________
191 void TGeant4::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
192 Double_t thetaY, Double_t phiY, Double_t thetaZ,
196 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
199 //_____________________________________________________________________________
200 void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
201 Float_t thetaY, Float_t phiY, Float_t thetaZ,
205 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
208 //_____________________________________________________________________________
209 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
210 Double_t *upar, Int_t np) {
212 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
215 //_____________________________________________________________________________
216 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
217 Float_t *upar, Int_t np) {
219 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
222 //_____________________________________________________________________________
223 void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv,
226 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
229 //_____________________________________________________________________________
230 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
231 Int_t iaxis, Double_t c0i, Int_t numed) {
233 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
236 //_____________________________________________________________________________
237 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
238 Int_t iaxis, Float_t c0i, Int_t numed) {
240 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
243 //_____________________________________________________________________________
244 void TGeant4::Gsdvt(const char *name, const char *mother, Double_t step,
245 Int_t iaxis, Int_t numed, Int_t ndvmx) {
247 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
250 //_____________________________________________________________________________
251 void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step,
252 Int_t iaxis, Int_t numed, Int_t ndvmx) {
254 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
257 //_____________________________________________________________________________
258 void TGeant4::Gsdvt2(const char *name, const char *mother, Double_t step,
259 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) {
261 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
264 //_____________________________________________________________________________
265 void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step,
266 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) {
268 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
271 //_____________________________________________________________________________
272 void TGeant4::Gsord(const char *name, Int_t iax) {
274 fGeometryManager->Gsord(name, iax);
277 //_____________________________________________________________________________
278 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
279 Double_t x, Double_t y, Double_t z, Int_t irot,
282 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
285 //_____________________________________________________________________________
286 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
287 Float_t x, Float_t y, Float_t z, Int_t irot,
290 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
293 //_____________________________________________________________________________
294 void 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) {
298 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
301 //_____________________________________________________________________________
302 void 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) {
306 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
309 //_____________________________________________________________________________
310 void TGeant4::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
311 Float_t *absco, Float_t *effic, Float_t *rindex) {
313 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
316 //_____________________________________________________________________________
317 void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
318 Int_t number, Int_t nlevel) {
320 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
323 //_____________________________________________________________________________
324 Int_t TGeant4::VolId(const Text_t* volName) const {
326 return fSDManager->VolId(volName);
329 //_____________________________________________________________________________
330 const char* TGeant4::VolName(Int_t id) const {
332 return fSDManager->VolName(id);
335 //_____________________________________________________________________________
336 Int_t TGeant4::NofVolumes() const {
338 return fSDManager->NofVolumes();
341 //_____________________________________________________________________________
342 Int_t TGeant4::VolId2Mate(Int_t id) const {
344 return fSDManager->VolId2Mate(id);
349 // methods for physics management
350 // ------------------------------------------------
352 //_____________________________________________________________________________
353 void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
355 fGeometryManager->Gstpar(itmed, param, parval);
356 fPhysicsManager->Gstpar(itmed, param, parval);
359 //_____________________________________________________________________________
360 void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
362 fPhysicsManager->SetCut(cutName, cutValue);
365 //_____________________________________________________________________________
366 void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
368 fPhysicsManager->SetProcess(flagName, flagValue);
371 //_____________________________________________________________________________
372 Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
374 return fPhysicsManager->Xsec(reac, energy, part, mate);
377 //_____________________________________________________________________________
378 void TGeant4::SetExternalDecayer(AliDecayer* decayer) {
380 fPhysicsManager->SetExternalDecayer(decayer);
383 //_____________________________________________________________________________
384 AliDecayer* TGeant4::Decayer() const {
386 return fPhysicsManager->Decayer();
390 //_____________________________________________________________________________
391 Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
393 return fPhysicsManager->IdFromPDG(pdgID);
396 //_____________________________________________________________________________
397 Int_t TGeant4::PDGFromId(Int_t mcID) const {
399 return fPhysicsManager->PDGFromId(mcID);
402 //_____________________________________________________________________________
403 void TGeant4::DefineParticles() {
405 fPhysicsManager->DefineParticles();
408 // methods for step management
409 // ------------------------------------------------
410 // inlined (in TGeant4.icc)
412 // methods for visualization
413 // ------------------------------------------------
416 //_____________________________________________________________________________
417 void TGeant4::DrawOneSpec(const char* name) {
419 fVisManager->DrawOneSpec(name);
422 //_____________________________________________________________________________
423 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
425 fVisManager->Gsatt(name, att, val);
428 //_____________________________________________________________________________
429 void 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) {
433 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
437 //_____________________________________________________________________________
438 void TGeant4::DrawOneSpec(const char* name) {
440 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
443 //_____________________________________________________________________________
444 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
446 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
449 //_____________________________________________________________________________
450 void 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) {
454 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
459 // methods for run control
460 // ------------------------------------------------
462 //_____________________________________________________________________________
463 void TGeant4::Init() {
465 fRunManager->Initialize();
468 //_____________________________________________________________________________
469 void TGeant4::BuildPhysics() {
471 fRunManager->LateInitialize();
474 //_____________________________________________________________________________
475 void TGeant4::ProcessEvent() {
477 fRunManager->ProcessEvent();
480 //_____________________________________________________________________________
481 void TGeant4::ProcessRun(Int_t nofEvents) {
483 fRunManager->ProcessRun(nofEvents);
486 //_____________________________________________________________________________
487 void TGeant4::StartGeantUI() {
489 fRunManager->StartGeantUI();
492 //_____________________________________________________________________________
493 void TGeant4::StartRootUI() {
495 fRunManager->StartRootUI();
498 //_____________________________________________________________________________
499 void TGeant4::ProcessGeantMacro(const char* macroName) {
501 fRunManager->ProcessGeantMacro(macroName);
504 //_____________________________________________________________________________
505 void TGeant4::ProcessGeantCommand(const char* command) {
507 fRunManager->ProcessGeantCommand(command);
510 //_____________________________________________________________________________
511 Int_t TGeant4::CurrentEvent() const {
513 return fRunManager->CurrentEvent();
516 // Geant3 specific methods
517 // !!! need to be transformed to common interface
518 // ------------------------------------------------
520 //_____________________________________________________________________________
521 void TGeant4::Gdopt(const char* name, const char* value) {
523 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
526 //_____________________________________________________________________________
527 void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
528 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
530 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
533 //_____________________________________________________________________________
534 void TGeant4::DefaultRange() {
536 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
539 //_____________________________________________________________________________
540 void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
542 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
545 //_____________________________________________________________________________
546 void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
548 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
551 //_____________________________________________________________________________
552 void TGeant4::SetColors() {
554 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
557 //_____________________________________________________________________________
558 void TGeant4::Gtreve() {
560 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
563 //_____________________________________________________________________________
564 void TGeant4::GtreveRoot() {
566 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
569 //_____________________________________________________________________________
570 void TGeant4::Gckmat(Int_t itmed, char* natmed) {
572 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
575 //_____________________________________________________________________________
576 void TGeant4::InitLego() {
578 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
581 //_____________________________________________________________________________
582 void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
583 Float_t& amass, Float_t& charge, Float_t& tlife) {
585 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
588 //_____________________________________________________________________________
589 void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
590 Float_t amass, Float_t charge, Float_t tlife) {
592 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");