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 #include "AliDecayer.h"
17 TGeant4::TGeant4(const char* name, const char* title,
18 TG4VRunConfiguration* configuration, int argc, char** argv)
23 fRunManager = new TG4RunManager(configuration, argc, argv);
25 //G4cout << "TG4RunManager has been created." << endl;
27 // create geometry manager
28 fGeometryManager = new TG4GeometryManager();
30 //G4cout << "TG4GeometryManager has been created." << endl;
32 // create physics manager
33 fPhysicsManager = new TG4PhysicsManager();
35 //G4cout << "TG4GeometryManager has been created." << endl;
37 // create step manager
38 fStepManager = new TG4StepManager();
40 //G4cout << "TG4StepManager has been created." << endl;
43 // create visualization manager
44 fVisManager = new TG4VisManager();
45 fVisManager->Initialize();
50 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
53 TGeant4::TGeant4(const char* name, const char* title,
54 TG4VRunConfiguration* configuration)
59 fRunManager = new TG4RunManager(configuration);
61 //G4cout << "TG4RunManager has been created." << endl;
63 // create geometry manager
64 fGeometryManager = new TG4GeometryManager();
66 //G4cout << "TG4GeometryManager has been created." << endl;
68 // create physics manager
69 fPhysicsManager = new TG4PhysicsManager();
71 //G4cout << "TG4GeometryManager has been created." << endl;
73 // create step manager
74 fStepManager = new TG4StepManager();
76 //G4cout << "TG4StepManager has been created." << endl;
79 // create visualization manager
80 fVisManager = new TG4VisManager();
81 fVisManager->Initialize();
86 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
93 TGeant4::TGeant4(const TGeant4& right) {
95 TG4Globals::Exception("TGeant4 is protected from copying.");
101 delete fGeometryManager;
102 delete fPhysicsManager;
104 // fVisManager is deleted with G4RunManager destructor
110 TGeant4& TGeant4::operator=(const TGeant4& right)
112 // check assignement to self
113 if (this == &right) return *this;
115 TG4Globals::Exception("TGeant4 is protected from assigning.");
121 // methods for building/management of geometry
122 // ------------------------------------------------
124 void TGeant4::FinishGeometry() {
126 fGeometryManager->Ggclos();
129 void TGeant4::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
130 Float_t &dens, Float_t &radl, Float_t &absl,
131 Float_t* ubuf, Int_t& nbuf) {
134 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
137 void TGeant4::Material(Int_t& kmat, const char* name, Float_t a,
138 Float_t z, Float_t dens, Float_t radl, Float_t absl,
139 Float_t* buf, Int_t nwbuf) {
142 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
145 void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
146 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
149 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
152 void TGeant4::Medium(Int_t& kmed, const char *name, Int_t nmat,
153 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
154 Float_t stemax, Float_t deemax, Float_t epsil,
155 Float_t stmin, Float_t* ubuf, Int_t nbuf) {
158 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
159 epsil, stmin, ubuf, nbuf);
162 void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
163 Float_t thetaY, Float_t phiY, Float_t thetaZ,
167 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
170 void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
172 fGeometryManager->Gstpar(itmed, param, parval);
175 Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
176 Float_t *upar, Int_t np) {
178 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
181 void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv,
184 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
187 void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
188 Int_t iaxis, Float_t c0i, Int_t numed) {
190 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
193 void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step,
194 Int_t iaxis, Int_t numed, Int_t ndvmx) {
196 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
199 void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step,
200 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) {
202 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
205 void TGeant4::Gsord(const char *name, Int_t iax) {
207 fGeometryManager->Gsord(name, iax);
210 void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
211 Float_t x, Float_t y, Float_t z, Int_t irot,
214 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
217 void TGeant4::Gsposp(const char *name, Int_t nr, const char *mother,
218 Float_t x, Float_t y, Float_t z, Int_t irot,
219 const char *konly, Float_t *upar, Int_t np) {
221 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
224 void TGeant4::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
225 Float_t *absco, Float_t *effic, Float_t *rindex) {
227 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
230 void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
231 Int_t number, Int_t nlevel) {
233 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
236 Int_t TGeant4::VolId(const Text_t* volName) const {
238 return fGeometryManager->VolId(volName);
241 const char* TGeant4::VolName(Int_t id) const {
243 return fGeometryManager->VolName(id);
246 Int_t TGeant4::NofVolumes() const {
248 return fGeometryManager->NofVolumes();
251 Int_t TGeant4::VolId2Mate(Int_t id) const {
253 return fGeometryManager->VolId2Mate(id);
258 // methods for physics management
259 // ------------------------------------------------
261 void TGeant4::BuildPhysics() {
263 fPhysicsManager->BuildPhysics();
266 void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
268 fPhysicsManager->SetCut(cutName, cutValue);
271 void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
273 fPhysicsManager->SetProcess(flagName, flagValue);
276 Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
278 return fPhysicsManager->Xsec(reac, energy, part, mate);
281 void TGeant4::SetExternalDecayer(AliDecayer* decayer) {
283 TG4Globals:: Warning("TGeant4::SetExternalDecayer() is not implemented.");
286 AliDecayer* TGeant4::Decayer() const {
288 TG4Globals:: Warning("TGeant4::Decayer() is not implemented.");
293 Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
295 return fPhysicsManager->IdFromPDG(pdgID);
298 Int_t TGeant4::PDGFromId(Int_t mcID) const {
300 return fPhysicsManager->PDGFromId(mcID);
303 void TGeant4::DefineParticles() {
305 fPhysicsManager->DefineParticles();
308 // methods for step management
309 // ------------------------------------------------
310 // inlined (in TGeant4.icc)
312 // methods for visualization
313 // ------------------------------------------------
316 void TGeant4::DrawOneSpec(const char* name) {
318 fVisManager->DrawOneSpec(name);
321 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
323 fVisManager->Gsatt(name, att, val);
326 void TGeant4::Gdraw(const char* name, Float_t theta, Float_t phi,
327 Float_t psi, Float_t u0, Float_t v0,
328 Float_t ul, Float_t vl) {
330 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
334 void TGeant4::DrawOneSpec(const char* name) {
336 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
339 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
341 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
344 void TGeant4::Gdraw(const char* p1, Float_t theta, Float_t phi,
345 Float_t psi, Float_t u0, Float_t v0,
346 Float_t ul, Float_t vl) {
348 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
353 // methods for run control
354 // ------------------------------------------------
356 void TGeant4::Init() {
358 fRunManager->Initialize();
361 void TGeant4::ProcessEvent() {
363 fRunManager->ProcessEvent();
366 void TGeant4::ProcessRun(Int_t nofEvents) {
368 fRunManager->ProcessRun(nofEvents);
371 void TGeant4::StartGeantUI() {
373 fRunManager->StartGeantUI();
376 void TGeant4::StartRootUI() {
378 fRunManager->StartRootUI();
381 void TGeant4::ProcessGeantMacro(const char* macroName) {
383 fRunManager->ProcessGeantMacro(macroName);
386 void TGeant4::ProcessGeantCommand(const char* command) {
388 fRunManager->ProcessGeantCommand(command);
391 Int_t TGeant4::CurrentEvent() const {
393 return fRunManager->CurrentEvent();
396 // Geant3 specific methods
397 // !!! need to be transformed to common interface
398 // ------------------------------------------------
400 void TGeant4::Gdopt(const char* name, const char* value) {
402 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
405 void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
406 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
408 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
411 void TGeant4::DefaultRange() {
413 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
416 void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
418 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
421 void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
423 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
426 void TGeant4::SetColors() {
428 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
431 void TGeant4::Gtreve() {
433 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
436 void TGeant4::GtreveRoot() {
438 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
441 void TGeant4::Gckmat(Int_t itmed, char* natmed) {
443 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
446 void TGeant4::InitLego() {
448 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
451 void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
452 Float_t& amass, Float_t& charge, Float_t& tlife) {
454 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
457 void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
458 Float_t amass, Float_t charge, Float_t tlife) {
460 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");