4 // Author: I. Hrivnacova
8 // See the class description in the header file.
11 #include "TG4VRunConfiguration.h"
12 #include "TG4GeometryManager.h"
13 #include "TG4SDManager.h"
14 #include "TG4PhysicsManager.h"
15 #include "TG4StepManager.h"
16 #include "TG4VisManager.h"
17 #include "TG4RunManager.h"
18 #include "TG4Globals.h"
20 #include "AliDecayer.h"
24 //_____________________________________________________________________________
25 TGeant4::TGeant4(const char* name, const char* title,
26 TG4VRunConfiguration* configuration, int argc, char** argv)
31 fRunManager = new TG4RunManager(configuration, argc, argv);
33 //G4cout << "TG4RunManager has been created." << endl;
35 // create geometry manager
36 fGeometryManager = new TG4GeometryManager();
38 //G4cout << "TG4GeometryManager has been created." << endl;
40 // create sensitive detectors manager
41 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
43 //G4cout << "TG4SDManager has been created." << endl;
45 // create physics manager
46 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
48 //G4cout << "TG4GeometryManager has been created." << endl;
50 // create step manager
51 fStepManager = new TG4StepManager();
53 //G4cout << "TG4StepManager has been created." << endl;
56 // create visualization manager
57 fVisManager = new TG4VisManager();
58 fVisManager->Initialize();
62 //_____________________________________________________________________________
63 TGeant4::TGeant4(const char* name, const char* title,
64 TG4VRunConfiguration* configuration)
69 fRunManager = new TG4RunManager(configuration);
71 //G4cout << "TG4RunManager has been created." << endl;
73 // create geometry manager
74 fGeometryManager = new TG4GeometryManager();
76 //G4cout << "TG4GeometryManager has been created." << endl;
78 // create sensitive detectors manager
79 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
81 //G4cout << "TG4SDManager has been created." << endl;
83 // create physics manager
84 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
86 //G4cout << "TG4GeometryManager has been created." << endl;
88 // create step manager
89 fStepManager = new TG4StepManager();
91 //G4cout << "TG4StepManager has been created." << endl;
94 // create visualization manager
95 fVisManager = new TG4VisManager();
96 fVisManager->Initialize();
100 //_____________________________________________________________________________
105 //_____________________________________________________________________________
106 TGeant4::TGeant4(const TGeant4& right) {
108 TG4Globals::Exception("TGeant4 is protected from copying.");
111 //_____________________________________________________________________________
112 TGeant4::~TGeant4() {
115 delete fGeometryManager;
117 delete fPhysicsManager;
119 // fVisManager is deleted with G4RunManager destructor
124 //_____________________________________________________________________________
125 TGeant4& TGeant4::operator=(const TGeant4& right)
127 // check assignement to self
128 if (this == &right) return *this;
130 TG4Globals::Exception("TGeant4 is protected from assigning.");
136 // methods for building/management of geometry
137 // ------------------------------------------------
139 //_____________________________________________________________________________
140 void TGeant4::FinishGeometry() {
142 fGeometryManager->Ggclos();
145 //_____________________________________________________________________________
146 void TGeant4::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
147 Float_t &dens, Float_t &radl, Float_t &absl,
148 Float_t* ubuf, Int_t& nbuf) {
151 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
154 //_____________________________________________________________________________
155 void TGeant4::Material(Int_t& kmat, const char* name, Float_t a,
156 Float_t z, Float_t dens, Float_t radl, Float_t absl,
157 Float_t* buf, Int_t nwbuf) {
160 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
163 //_____________________________________________________________________________
164 void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
165 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
168 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
171 //_____________________________________________________________________________
172 void TGeant4::Medium(Int_t& kmed, const char *name, Int_t nmat,
173 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
174 Float_t stemax, Float_t deemax, Float_t epsil,
175 Float_t stmin, Float_t* ubuf, Int_t nbuf) {
178 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
179 epsil, stmin, ubuf, nbuf);
182 //_____________________________________________________________________________
183 void TGeant4::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
184 Double_t thetaY, Double_t phiY, Double_t thetaZ,
188 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
191 //_____________________________________________________________________________
192 void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
193 Float_t thetaY, Float_t phiY, Float_t thetaZ,
197 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
200 //_____________________________________________________________________________
201 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
202 Double_t *upar, Int_t np) {
204 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
207 //_____________________________________________________________________________
208 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
209 Float_t *upar, Int_t np) {
211 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
214 //_____________________________________________________________________________
215 void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv,
218 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
221 //_____________________________________________________________________________
222 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
223 Int_t iaxis, Double_t c0i, Int_t numed) {
225 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
228 //_____________________________________________________________________________
229 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
230 Int_t iaxis, Float_t c0i, Int_t numed) {
232 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
235 //_____________________________________________________________________________
236 void TGeant4::Gsdvt(const char *name, const char *mother, Double_t step,
237 Int_t iaxis, Int_t numed, Int_t ndvmx) {
239 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
242 //_____________________________________________________________________________
243 void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step,
244 Int_t iaxis, Int_t numed, Int_t ndvmx) {
246 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
249 //_____________________________________________________________________________
250 void TGeant4::Gsdvt2(const char *name, const char *mother, Double_t step,
251 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) {
253 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
256 //_____________________________________________________________________________
257 void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step,
258 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) {
260 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
263 //_____________________________________________________________________________
264 void TGeant4::Gsord(const char *name, Int_t iax) {
266 fGeometryManager->Gsord(name, iax);
269 //_____________________________________________________________________________
270 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
271 Double_t x, Double_t y, Double_t z, Int_t irot,
274 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
277 //_____________________________________________________________________________
278 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
279 Float_t x, Float_t y, Float_t z, Int_t irot,
282 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
285 //_____________________________________________________________________________
286 void TGeant4::Gsposp(const char *name, Int_t nr, const char *mother,
287 Double_t x, Double_t y, Double_t z, Int_t irot,
288 const char *konly, Double_t *upar, Int_t np) {
290 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
293 //_____________________________________________________________________________
294 void TGeant4::Gsposp(const char *name, Int_t nr, const char *mother,
295 Float_t x, Float_t y, Float_t z, Int_t irot,
296 const char *konly, Float_t *upar, Int_t np) {
298 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
301 //_____________________________________________________________________________
302 void TGeant4::Gsbool(const char* onlyVolName, const char* manyVolName) {
304 fGeometryManager->Gsbool(onlyVolName, manyVolName);
307 //_____________________________________________________________________________
308 void TGeant4::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
309 Float_t *absco, Float_t *effic, Float_t *rindex) {
311 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
314 //_____________________________________________________________________________
315 void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
316 Int_t number, Int_t nlevel) {
318 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
321 //_____________________________________________________________________________
322 Int_t TGeant4::VolId(const Text_t* volName) const {
324 return fSDManager->VolId(volName);
327 //_____________________________________________________________________________
328 const char* TGeant4::VolName(Int_t id) const {
330 return fSDManager->VolName(id);
333 //_____________________________________________________________________________
334 Int_t TGeant4::NofVolumes() const {
336 return fSDManager->NofVolumes();
339 //_____________________________________________________________________________
340 Int_t TGeant4::VolId2Mate(Int_t id) const {
342 return fSDManager->VolId2Mate(id);
347 // methods for physics management
348 // ------------------------------------------------
350 //_____________________________________________________________________________
351 void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
353 fGeometryManager->Gstpar(itmed, param, parval);
354 fPhysicsManager->Gstpar(itmed, param, parval);
357 //_____________________________________________________________________________
358 void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
360 fPhysicsManager->SetCut(cutName, cutValue);
363 //_____________________________________________________________________________
364 void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
366 fPhysicsManager->SetProcess(flagName, flagValue);
369 //_____________________________________________________________________________
370 Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
372 return fPhysicsManager->Xsec(reac, energy, part, mate);
375 //_____________________________________________________________________________
376 void TGeant4::SetExternalDecayer(AliDecayer* decayer) {
378 fPhysicsManager->SetExternalDecayer(decayer);
381 //_____________________________________________________________________________
382 AliDecayer* TGeant4::Decayer() const {
384 return fPhysicsManager->Decayer();
388 //_____________________________________________________________________________
389 Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
391 return fPhysicsManager->IdFromPDG(pdgID);
394 //_____________________________________________________________________________
395 Int_t TGeant4::PDGFromId(Int_t mcID) const {
397 return fPhysicsManager->PDGFromId(mcID);
400 //_____________________________________________________________________________
401 void TGeant4::DefineParticles() {
403 fPhysicsManager->DefineParticles();
406 // methods for step management
407 // ------------------------------------------------
408 // inlined (in TGeant4.icc)
410 // methods for visualization
411 // ------------------------------------------------
414 //_____________________________________________________________________________
415 void TGeant4::DrawOneSpec(const char* name) {
417 fVisManager->DrawOneSpec(name);
420 //_____________________________________________________________________________
421 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
423 fVisManager->Gsatt(name, att, val);
426 //_____________________________________________________________________________
427 void TGeant4::Gdraw(const char* name, Float_t theta, Float_t phi,
428 Float_t psi, Float_t u0, Float_t v0,
429 Float_t ul, Float_t vl) {
431 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
435 //_____________________________________________________________________________
436 void TGeant4::DrawOneSpec(const char* name) {
438 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
441 //_____________________________________________________________________________
442 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
444 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
447 //_____________________________________________________________________________
448 void TGeant4::Gdraw(const char* p1, Float_t theta, Float_t phi,
449 Float_t psi, Float_t u0, Float_t v0,
450 Float_t ul, Float_t vl) {
452 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
457 // methods for run control
458 // ------------------------------------------------
460 //_____________________________________________________________________________
461 void TGeant4::Init() {
463 fRunManager->Initialize();
466 //_____________________________________________________________________________
467 void TGeant4::BuildPhysics() {
469 fRunManager->LateInitialize();
472 //_____________________________________________________________________________
473 void TGeant4::ProcessEvent() {
475 fRunManager->ProcessEvent();
478 //_____________________________________________________________________________
479 void TGeant4::ProcessRun(Int_t nofEvents) {
481 fRunManager->ProcessRun(nofEvents);
484 //_____________________________________________________________________________
485 void TGeant4::StartGeantUI() {
487 fRunManager->StartGeantUI();
490 //_____________________________________________________________________________
491 void TGeant4::StartRootUI() {
493 fRunManager->StartRootUI();
496 //_____________________________________________________________________________
497 void TGeant4::ProcessGeantMacro(const char* macroName) {
499 fRunManager->ProcessGeantMacro(macroName);
502 //_____________________________________________________________________________
503 void TGeant4::ProcessGeantCommand(const char* command) {
505 fRunManager->ProcessGeantCommand(command);
508 //_____________________________________________________________________________
509 Int_t TGeant4::CurrentEvent() const {
511 return fRunManager->CurrentEvent();
514 // Geant3 specific methods
515 // !!! need to be transformed to common interface
516 // ------------------------------------------------
518 //_____________________________________________________________________________
519 void TGeant4::Gdopt(const char* name, const char* value) {
521 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
524 //_____________________________________________________________________________
525 void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
526 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
528 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
531 //_____________________________________________________________________________
532 void TGeant4::DefaultRange() {
534 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
537 //_____________________________________________________________________________
538 void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
540 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
543 //_____________________________________________________________________________
544 void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
546 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
549 //_____________________________________________________________________________
550 void TGeant4::SetColors() {
552 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
555 //_____________________________________________________________________________
556 void TGeant4::Gtreve() {
558 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
561 //_____________________________________________________________________________
562 void TGeant4::GtreveRoot() {
564 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
567 //_____________________________________________________________________________
568 void TGeant4::Gckmat(Int_t itmed, char* natmed) {
570 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
573 //_____________________________________________________________________________
574 void TGeant4::InitLego() {
576 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
579 //_____________________________________________________________________________
580 void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
581 Float_t& amass, Float_t& charge, Float_t& tlife) {
583 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
586 //_____________________________________________________________________________
587 void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
588 Float_t amass, Float_t charge, Float_t tlife) {
590 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");