4 // See the class description in the header file.
7 #include "TG4Messenger.h"
8 #include "TG4GeometryManager.h"
9 #include "TG4PhysicsManager.h"
10 #include "TG4StepManager.h"
11 #include "TG4VisManager.h"
12 #include "TG4RunManager.h"
13 #include "TG4Globals.h"
15 TGeant4::TGeant4(const char* name, const char* title,
16 TG4VRunConfiguration* configuration, int argc, char** argv)
21 fRunManager = new TG4RunManager(configuration, argc, argv);
23 //G4cout << "TG4RunManager has been created." << endl;
25 // create geometry manager
26 fGeometryManager = new TG4GeometryManager();
28 //G4cout << "TG4GeometryManager has been created." << endl;
30 // create physics manager
31 fPhysicsManager = new TG4PhysicsManager();
33 //G4cout << "TG4GeometryManager has been created." << endl;
35 // create step manager
36 fStepManager = new TG4StepManager();
38 //G4cout << "TG4StepManager has been created." << endl;
41 // create visualization manager
42 fVisManager = new TG4VisManager();
43 fVisManager->Initialize();
48 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
51 TGeant4::TGeant4(const char* name, const char* title,
52 TG4VRunConfiguration* configuration)
57 fRunManager = new TG4RunManager(configuration);
59 //G4cout << "TG4RunManager has been created." << endl;
61 // create geometry manager
62 fGeometryManager = new TG4GeometryManager();
64 //G4cout << "TG4GeometryManager has been created." << endl;
66 // create physics manager
67 fPhysicsManager = new TG4PhysicsManager();
69 //G4cout << "TG4GeometryManager has been created." << endl;
71 // create step manager
72 fStepManager = new TG4StepManager();
74 //G4cout << "TG4StepManager has been created." << endl;
77 // create visualization manager
78 fVisManager = new TG4VisManager();
79 fVisManager->Initialize();
84 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
91 TGeant4::TGeant4(const TGeant4& right) {
93 TG4Globals::Exception("TGeant4 is protected from copying.");
99 delete fGeometryManager;
100 delete fPhysicsManager;
102 // fVisManager is deleted with G4RunManager destructor
108 TGeant4& TGeant4::operator=(const TGeant4& right)
110 // check assignement to self
111 if (this == &right) return *this;
113 TG4Globals::Exception("TGeant4 is protected from assigning.");
119 // methods for building/management of geometry
120 // ------------------------------------------------
122 void TGeant4::FinishGeometry() {
124 fGeometryManager->Ggclos();
127 void TGeant4::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
128 Float_t &dens, Float_t &radl, Float_t &absl,
129 Float_t* ubuf, Int_t& nbuf) {
132 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
135 void TGeant4::Material(Int_t& kmat, const char* name, Float_t a,
136 Float_t z, Float_t dens, Float_t radl, Float_t absl,
137 Float_t* buf, Int_t nwbuf) {
140 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
143 void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
144 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
147 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
150 void TGeant4::Medium(Int_t& kmed, const char *name, Int_t nmat,
151 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
152 Float_t stemax, Float_t deemax, Float_t epsil,
153 Float_t stmin, Float_t* ubuf, Int_t nbuf) {
156 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
157 epsil, stmin, ubuf, nbuf);
160 void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
161 Float_t thetaY, Float_t phiY, Float_t thetaZ,
165 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
168 void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
170 fGeometryManager->Gstpar(itmed, param, parval);
173 void TGeant4::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
174 Float_t *absco, Float_t *effic, Float_t *rindex) {
177 fGeometryManager->Gsckov(itmed, npckov, ppckov, absco, effic, rindex);
180 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
181 Float_t *upar, Int_t np) {
183 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
186 void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv,
189 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
192 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
193 Int_t iaxis, Float_t c0i, Int_t numed) {
195 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
198 void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step,
199 Int_t iaxis, Int_t numed, Int_t ndvmx) {
201 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
204 void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step,
205 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) {
207 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
210 void TGeant4::Gsord(const char *name, Int_t iax) {
212 fGeometryManager->Gsord(name, iax);
215 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
216 Float_t x, Float_t y, Float_t z, Int_t irot,
219 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
222 void TGeant4::Gsposp(const char *name, Int_t nr, const char *mother,
223 Float_t x, Float_t y, Float_t z, Int_t irot,
224 const char *konly, Float_t *upar, Int_t np) {
226 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
229 void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
230 Int_t number, Int_t nlevel) {
232 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
235 Int_t TGeant4::VolId(const Text_t* volName) const {
237 return fGeometryManager->VolId(volName);
240 const char* TGeant4::VolName(Int_t id) const {
242 return fGeometryManager->VolName(id);
245 Int_t TGeant4::NofVolumes() const {
247 return fGeometryManager->NofVolumes();
250 // methods for physics management
251 // ------------------------------------------------
253 void TGeant4::BuildPhysics() {
255 fPhysicsManager->BuildPhysics();
258 void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
260 fPhysicsManager->SetCut(cutName, cutValue);
263 void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
265 fPhysicsManager->SetProcess(flagName, flagValue);
268 Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
270 return fPhysicsManager->Xsec(reac, energy, part, mate);
273 Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
275 return fPhysicsManager->IdFromPDG(pdgID);
278 Int_t TGeant4::PDGFromId(Int_t mcID) const {
280 return fPhysicsManager->PDGFromId(mcID);
283 void TGeant4::DefineParticles() {
285 fPhysicsManager->DefineParticles();
288 // methods for step management
289 // ------------------------------------------------
290 // inlined (in TGeant4.icc)
292 void TGeant4::Rndm(Float_t* array, const Int_t size) const {
294 fStepManager->Rndm(array, size);
297 // methods for visualization
298 // ------------------------------------------------
301 void TGeant4::DrawOneSpec(const char* name) {
303 fVisManager->DrawOneSpec(name);
306 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
308 fVisManager->Gsatt(name, att, val);
311 void TGeant4::Gdraw(const char* name, Float_t theta, Float_t phi,
312 Float_t psi, Float_t u0, Float_t v0,
313 Float_t ul, Float_t vl) {
315 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
319 void TGeant4::DrawOneSpec(const char* name) {
321 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
324 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
326 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
329 void TGeant4::Gdraw(const char* p1, Float_t theta, Float_t phi,
330 Float_t psi, Float_t u0, Float_t v0,
331 Float_t ul, Float_t vl) {
333 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
338 // methods for run control
339 // ------------------------------------------------
341 void TGeant4::Init() {
343 fRunManager->Initialize();
346 void TGeant4::ProcessEvent() {
348 fRunManager->ProcessEvent();
351 void TGeant4::ProcessRun(Int_t nofEvents) {
353 fRunManager->ProcessRun(nofEvents);
356 void TGeant4::StartGeantUI() {
358 fRunManager->StartGeantUI();
361 void TGeant4::StartRootUI() {
363 fRunManager->StartGeantUI();
366 void TGeant4::ProcessGeantMacro(const char* macroName) {
368 fRunManager->ProcessGeantMacro(macroName);
371 void TGeant4::ProcessGeantCommand(const char* command) {
373 fRunManager->ProcessGeantCommand(command);
376 Int_t TGeant4::CurrentEvent() const {
378 return fRunManager->CurrentEvent();
381 // Geant3 specific methods
382 // !!! need to be transformed to common interface
383 // ------------------------------------------------
385 void TGeant4::Gdopt(const char* name, const char* value) {
387 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
390 void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
391 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
393 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
396 void TGeant4::DefaultRange() {
398 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
401 void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
403 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
406 void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
408 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
411 void TGeant4::SetColors() {
413 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
416 void TGeant4::Gtreve() {
418 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
421 void TGeant4::Gtreve_root() {
423 TG4Globals:: Warning("TGeant4::Gtreve_root() is not implemented.");
426 void TGeant4::Gckmat(Int_t itmed, char* natmed) {
428 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
431 void TGeant4::InitLego() {
433 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
436 void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
437 Float_t& amass, Float_t& charge, Float_t& tlife) {
439 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
442 void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
443 Float_t amass, Float_t charge, Float_t tlife) {
445 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");