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"
22 //_____________________________________________________________________________
23 TGeant4::TGeant4(const char* name, const char* title,
24 TG4VRunConfiguration* configuration, int argc, char** argv)
29 fRunManager = new TG4RunManager(configuration, argc, argv);
31 //G4cout << "TG4RunManager has been created." << endl;
33 // create geometry manager
34 fGeometryManager = new TG4GeometryManager();
36 //G4cout << "TG4GeometryManager has been created." << endl;
38 // create sensitive detectors manager
39 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
41 //G4cout << "TG4SDManager has been created." << endl;
43 // create physics manager
44 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
46 //G4cout << "TG4GeometryManager has been created." << endl;
48 // create step manager
49 fStepManager = new TG4StepManager();
51 //G4cout << "TG4StepManager has been created." << endl;
54 // create visualization manager
55 fVisManager = new TG4VisManager();
56 fVisManager->Initialize();
60 //_____________________________________________________________________________
61 TGeant4::TGeant4(const char* name, const char* title,
62 TG4VRunConfiguration* configuration)
67 fRunManager = new TG4RunManager(configuration);
69 //G4cout << "TG4RunManager has been created." << endl;
71 // create geometry manager
72 fGeometryManager = new TG4GeometryManager();
74 //G4cout << "TG4GeometryManager has been created." << endl;
76 // create sensitive detectors manager
77 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
79 //G4cout << "TG4SDManager has been created." << endl;
81 // create physics manager
82 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
84 //G4cout << "TG4GeometryManager has been created." << endl;
86 // create step manager
87 fStepManager = new TG4StepManager();
89 //G4cout << "TG4StepManager has been created." << endl;
92 // create visualization manager
93 fVisManager = new TG4VisManager();
94 fVisManager->Initialize();
98 //_____________________________________________________________________________
103 //_____________________________________________________________________________
104 TGeant4::TGeant4(const TGeant4& right) {
106 TG4Globals::Exception("TGeant4 is protected from copying.");
109 //_____________________________________________________________________________
110 TGeant4::~TGeant4() {
113 delete fGeometryManager;
115 delete fPhysicsManager;
117 // fVisManager is deleted with G4RunManager destructor
122 //_____________________________________________________________________________
123 TGeant4& TGeant4::operator=(const TGeant4& right)
125 // check assignement to self
126 if (this == &right) return *this;
128 TG4Globals::Exception("TGeant4 is protected from assigning.");
134 // methods for building/management of geometry
135 // ------------------------------------------------
137 //_____________________________________________________________________________
138 void TGeant4::FinishGeometry() {
140 fGeometryManager->Ggclos();
143 //_____________________________________________________________________________
144 void 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) {
149 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
152 //_____________________________________________________________________________
153 void 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) {
158 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
161 //_____________________________________________________________________________
162 void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
163 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
166 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
169 //_____________________________________________________________________________
170 void 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) {
176 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
177 epsil, stmin, ubuf, nbuf);
180 //_____________________________________________________________________________
181 void TGeant4::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
182 Double_t thetaY, Double_t phiY, Double_t thetaZ,
186 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
189 //_____________________________________________________________________________
190 void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
191 Float_t thetaY, Float_t phiY, Float_t thetaZ,
195 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
198 //_____________________________________________________________________________
199 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
200 Double_t *upar, Int_t np) {
202 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
205 //_____________________________________________________________________________
206 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
207 Float_t *upar, Int_t np) {
209 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
212 //_____________________________________________________________________________
213 void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv,
216 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
219 //_____________________________________________________________________________
220 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
221 Int_t iaxis, Double_t c0i, Int_t numed) {
223 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
226 //_____________________________________________________________________________
227 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
228 Int_t iaxis, Float_t c0i, Int_t numed) {
230 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
233 //_____________________________________________________________________________
234 void TGeant4::Gsdvt(const char *name, const char *mother, Double_t step,
235 Int_t iaxis, Int_t numed, Int_t ndvmx) {
237 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
240 //_____________________________________________________________________________
241 void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step,
242 Int_t iaxis, Int_t numed, Int_t ndvmx) {
244 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
247 //_____________________________________________________________________________
248 void TGeant4::Gsdvt2(const char *name, const char *mother, Double_t step,
249 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) {
251 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
254 //_____________________________________________________________________________
255 void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step,
256 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) {
258 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
261 //_____________________________________________________________________________
262 void TGeant4::Gsord(const char *name, Int_t iax) {
264 fGeometryManager->Gsord(name, iax);
267 //_____________________________________________________________________________
268 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
269 Double_t x, Double_t y, Double_t z, Int_t irot,
272 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
275 //_____________________________________________________________________________
276 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
277 Float_t x, Float_t y, Float_t z, Int_t irot,
280 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
283 //_____________________________________________________________________________
284 void 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) {
288 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
291 //_____________________________________________________________________________
292 void 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) {
296 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
299 //_____________________________________________________________________________
300 void TGeant4::Gsbool(const char* onlyVolName, const char* manyVolName) {
302 fGeometryManager->Gsbool(onlyVolName, manyVolName);
305 //_____________________________________________________________________________
306 void TGeant4::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
307 Float_t *absco, Float_t *effic, Float_t *rindex) {
309 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
312 //_____________________________________________________________________________
313 void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
314 Int_t number, Int_t nlevel) {
316 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
319 //_____________________________________________________________________________
320 Int_t TGeant4::VolId(const Text_t* volName) const {
322 return fSDManager->VolId(volName);
325 //_____________________________________________________________________________
326 const char* TGeant4::VolName(Int_t id) const {
328 return fSDManager->VolName(id);
331 //_____________________________________________________________________________
332 Int_t TGeant4::NofVolumes() const {
334 return fSDManager->NofVolumes();
337 //_____________________________________________________________________________
338 Int_t TGeant4::VolId2Mate(Int_t id) const {
340 return fSDManager->VolId2Mate(id);
345 // methods for physics management
346 // ------------------------------------------------
348 //_____________________________________________________________________________
349 void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
351 fGeometryManager->Gstpar(itmed, param, parval);
352 fPhysicsManager->Gstpar(itmed, param, parval);
355 //_____________________________________________________________________________
356 void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
358 fPhysicsManager->SetCut(cutName, cutValue);
361 //_____________________________________________________________________________
362 void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
364 fPhysicsManager->SetProcess(flagName, flagValue);
367 //_____________________________________________________________________________
368 Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
370 return fPhysicsManager->Xsec(reac, energy, part, mate);
373 //_____________________________________________________________________________
374 void TGeant4::SetExternalDecayer(AliDecayer* decayer) {
376 fPhysicsManager->SetExternalDecayer(decayer);
379 //_____________________________________________________________________________
380 AliDecayer* TGeant4::Decayer() const {
382 return fPhysicsManager->Decayer();
386 //_____________________________________________________________________________
387 Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
389 return fPhysicsManager->IdFromPDG(pdgID);
392 //_____________________________________________________________________________
393 Int_t TGeant4::PDGFromId(Int_t mcID) const {
395 return fPhysicsManager->PDGFromId(mcID);
398 //_____________________________________________________________________________
399 void TGeant4::DefineParticles() {
401 fPhysicsManager->DefineParticles();
404 // methods for step management
405 // ------------------------------------------------
406 // inlined (in TGeant4.icc)
408 // methods for visualization
409 // ------------------------------------------------
412 //_____________________________________________________________________________
413 void TGeant4::DrawOneSpec(const char* name) {
415 fVisManager->DrawOneSpec(name);
418 //_____________________________________________________________________________
419 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
421 fVisManager->Gsatt(name, att, val);
424 //_____________________________________________________________________________
425 void 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) {
429 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
433 //_____________________________________________________________________________
434 void TGeant4::DrawOneSpec(const char* name) {
436 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
439 //_____________________________________________________________________________
440 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
442 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
445 //_____________________________________________________________________________
446 void 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) {
450 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
455 // methods for run control
456 // ------------------------------------------------
458 //_____________________________________________________________________________
459 void TGeant4::Init() {
461 fRunManager->Initialize();
464 //_____________________________________________________________________________
465 void TGeant4::BuildPhysics() {
467 fRunManager->LateInitialize();
470 //_____________________________________________________________________________
471 void TGeant4::ProcessEvent() {
473 fRunManager->ProcessEvent();
476 //_____________________________________________________________________________
477 void TGeant4::ProcessRun(Int_t nofEvents) {
479 fRunManager->ProcessRun(nofEvents);
482 //_____________________________________________________________________________
483 void TGeant4::StartGeantUI() {
485 fRunManager->StartGeantUI();
488 //_____________________________________________________________________________
489 void TGeant4::StartRootUI() {
491 fRunManager->StartRootUI();
494 //_____________________________________________________________________________
495 void TGeant4::ProcessGeantMacro(const char* macroName) {
497 fRunManager->ProcessGeantMacro(macroName);
500 //_____________________________________________________________________________
501 void TGeant4::ProcessGeantCommand(const char* command) {
503 fRunManager->ProcessGeantCommand(command);
506 //_____________________________________________________________________________
507 Int_t TGeant4::CurrentEvent() const {
509 return fRunManager->CurrentEvent();
512 // Geant3 specific methods
513 // !!! need to be transformed to common interface
514 // ------------------------------------------------
516 //_____________________________________________________________________________
517 void TGeant4::Gdopt(const char* name, const char* value) {
519 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
522 //_____________________________________________________________________________
523 void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
524 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
526 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
529 //_____________________________________________________________________________
530 void TGeant4::DefaultRange() {
532 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
535 //_____________________________________________________________________________
536 void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
538 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
541 //_____________________________________________________________________________
542 void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
544 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
547 //_____________________________________________________________________________
548 void TGeant4::SetColors() {
550 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
553 //_____________________________________________________________________________
554 void TGeant4::Gtreve() {
556 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
559 //_____________________________________________________________________________
560 void TGeant4::GtreveRoot() {
562 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
565 //_____________________________________________________________________________
566 void TGeant4::Gckmat(Int_t itmed, char* natmed) {
568 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
571 //_____________________________________________________________________________
572 void TGeant4::InitLego() {
574 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
577 //_____________________________________________________________________________
578 void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
579 Float_t& amass, Float_t& charge, Float_t& tlife) {
581 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
584 //_____________________________________________________________________________
585 void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
586 Float_t amass, Float_t charge, Float_t tlife) {
588 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");