4 // See the class description in the header file.
7 #include "TG4Messenger.h"
8 #include "TG4VRunConfiguration.h"
9 #include "TG4GeometryManager.h"
10 #include "TG4PhysicsManager.h"
11 #include "TG4StepManager.h"
12 #include "TG4VisManager.h"
13 #include "TG4RunManager.h"
14 #include "TG4Globals.h"
16 #include "AliDecayer.h"
18 //_____________________________________________________________________________
19 TGeant4::TGeant4(const char* name, const char* title,
20 TG4VRunConfiguration* configuration, int argc, char** argv)
25 fRunManager = new TG4RunManager(configuration, argc, argv);
27 //G4cout << "TG4RunManager has been created." << endl;
29 // create geometry manager
30 fGeometryManager = new TG4GeometryManager();
32 //G4cout << "TG4GeometryManager has been created." << endl;
34 // create physics manager
35 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
37 //G4cout << "TG4GeometryManager has been created." << endl;
39 // create step manager
40 fStepManager = new TG4StepManager();
42 //G4cout << "TG4StepManager has been created." << endl;
45 // create visualization manager
46 fVisManager = new TG4VisManager();
47 fVisManager->Initialize();
52 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
55 //_____________________________________________________________________________
56 TGeant4::TGeant4(const char* name, const char* title,
57 TG4VRunConfiguration* configuration)
62 fRunManager = new TG4RunManager(configuration);
64 //G4cout << "TG4RunManager has been created." << endl;
66 // create geometry manager
67 fGeometryManager = new TG4GeometryManager();
69 //G4cout << "TG4GeometryManager has been created." << endl;
71 // create physics manager
72 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
74 //G4cout << "TG4GeometryManager has been created." << endl;
76 // create step manager
77 fStepManager = new TG4StepManager();
79 //G4cout << "TG4StepManager has been created." << endl;
82 // create visualization manager
83 fVisManager = new TG4VisManager();
84 fVisManager->Initialize();
89 new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager);
92 //_____________________________________________________________________________
97 //_____________________________________________________________________________
98 TGeant4::TGeant4(const TGeant4& right) {
100 TG4Globals::Exception("TGeant4 is protected from copying.");
103 //_____________________________________________________________________________
104 TGeant4::~TGeant4() {
107 delete fGeometryManager;
108 delete fPhysicsManager;
110 // fVisManager is deleted with G4RunManager destructor
116 //_____________________________________________________________________________
117 TGeant4& TGeant4::operator=(const TGeant4& right)
119 // check assignement to self
120 if (this == &right) return *this;
122 TG4Globals::Exception("TGeant4 is protected from assigning.");
128 // methods for building/management of geometry
129 // ------------------------------------------------
131 //_____________________________________________________________________________
132 void TGeant4::FinishGeometry() {
134 fGeometryManager->Ggclos();
137 //_____________________________________________________________________________
138 void TGeant4::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
139 Float_t &dens, Float_t &radl, Float_t &absl,
140 Float_t* ubuf, Int_t& nbuf) {
143 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
146 //_____________________________________________________________________________
147 void TGeant4::Material(Int_t& kmat, const char* name, Float_t a,
148 Float_t z, Float_t dens, Float_t radl, Float_t absl,
149 Float_t* buf, Int_t nwbuf) {
152 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
155 //_____________________________________________________________________________
156 void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
157 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
160 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
163 //_____________________________________________________________________________
164 void TGeant4::Medium(Int_t& kmed, const char *name, Int_t nmat,
165 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
166 Float_t stemax, Float_t deemax, Float_t epsil,
167 Float_t stmin, Float_t* ubuf, Int_t nbuf) {
170 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
171 epsil, stmin, ubuf, nbuf);
174 //_____________________________________________________________________________
175 void TGeant4::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
176 Double_t thetaY, Double_t phiY, Double_t thetaZ,
180 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
183 //_____________________________________________________________________________
184 void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
185 Float_t thetaY, Float_t phiY, Float_t thetaZ,
189 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
192 //_____________________________________________________________________________
193 void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
195 fGeometryManager->Gstpar(itmed, param, parval);
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::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
301 Float_t *absco, Float_t *effic, Float_t *rindex) {
303 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
306 //_____________________________________________________________________________
307 void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
308 Int_t number, Int_t nlevel) {
310 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
313 //_____________________________________________________________________________
314 Int_t TGeant4::VolId(const Text_t* volName) const {
316 return fGeometryManager->VolId(volName);
319 //_____________________________________________________________________________
320 const char* TGeant4::VolName(Int_t id) const {
322 return fGeometryManager->VolName(id);
325 //_____________________________________________________________________________
326 Int_t TGeant4::NofVolumes() const {
328 return fGeometryManager->NofVolumes();
331 //_____________________________________________________________________________
332 Int_t TGeant4::VolId2Mate(Int_t id) const {
334 return fGeometryManager->VolId2Mate(id);
339 // methods for physics management
340 // ------------------------------------------------
342 //_____________________________________________________________________________
343 void TGeant4::BuildPhysics() {
345 fPhysicsManager->BuildPhysics();
348 //_____________________________________________________________________________
349 void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
351 fPhysicsManager->SetCut(cutName, cutValue);
354 //_____________________________________________________________________________
355 void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
357 fPhysicsManager->SetProcess(flagName, flagValue);
360 //_____________________________________________________________________________
361 Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
363 return fPhysicsManager->Xsec(reac, energy, part, mate);
366 //_____________________________________________________________________________
367 void TGeant4::SetExternalDecayer(AliDecayer* decayer) {
369 fPhysicsManager->SetExternalDecayer(decayer);
372 //_____________________________________________________________________________
373 AliDecayer* TGeant4::Decayer() const {
375 return fPhysicsManager->Decayer();
379 //_____________________________________________________________________________
380 Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
382 return fPhysicsManager->IdFromPDG(pdgID);
385 //_____________________________________________________________________________
386 Int_t TGeant4::PDGFromId(Int_t mcID) const {
388 return fPhysicsManager->PDGFromId(mcID);
391 //_____________________________________________________________________________
392 void TGeant4::DefineParticles() {
394 fPhysicsManager->DefineParticles();
397 // methods for step management
398 // ------------------------------------------------
399 // inlined (in TGeant4.icc)
401 // methods for visualization
402 // ------------------------------------------------
405 //_____________________________________________________________________________
406 void TGeant4::DrawOneSpec(const char* name) {
408 fVisManager->DrawOneSpec(name);
411 //_____________________________________________________________________________
412 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
414 fVisManager->Gsatt(name, att, val);
417 //_____________________________________________________________________________
418 void TGeant4::Gdraw(const char* name, Float_t theta, Float_t phi,
419 Float_t psi, Float_t u0, Float_t v0,
420 Float_t ul, Float_t vl) {
422 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
426 //_____________________________________________________________________________
427 void TGeant4::DrawOneSpec(const char* name) {
429 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
432 //_____________________________________________________________________________
433 void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
435 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
438 //_____________________________________________________________________________
439 void TGeant4::Gdraw(const char* p1, Float_t theta, Float_t phi,
440 Float_t psi, Float_t u0, Float_t v0,
441 Float_t ul, Float_t vl) {
443 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
448 // methods for run control
449 // ------------------------------------------------
451 //_____________________________________________________________________________
452 void TGeant4::Init() {
454 fRunManager->Initialize();
457 //_____________________________________________________________________________
458 void TGeant4::ProcessEvent() {
460 fRunManager->ProcessEvent();
463 //_____________________________________________________________________________
464 void TGeant4::ProcessRun(Int_t nofEvents) {
466 fRunManager->ProcessRun(nofEvents);
469 //_____________________________________________________________________________
470 void TGeant4::StartGeantUI() {
472 fRunManager->StartGeantUI();
475 //_____________________________________________________________________________
476 void TGeant4::StartRootUI() {
478 fRunManager->StartRootUI();
481 //_____________________________________________________________________________
482 void TGeant4::ProcessGeantMacro(const char* macroName) {
484 fRunManager->ProcessGeantMacro(macroName);
487 //_____________________________________________________________________________
488 void TGeant4::ProcessGeantCommand(const char* command) {
490 fRunManager->ProcessGeantCommand(command);
493 //_____________________________________________________________________________
494 Int_t TGeant4::CurrentEvent() const {
496 return fRunManager->CurrentEvent();
499 // Geant3 specific methods
500 // !!! need to be transformed to common interface
501 // ------------------------------------------------
503 //_____________________________________________________________________________
504 void TGeant4::Gdopt(const char* name, const char* value) {
506 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
509 //_____________________________________________________________________________
510 void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
511 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
513 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
516 //_____________________________________________________________________________
517 void TGeant4::DefaultRange() {
519 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
522 //_____________________________________________________________________________
523 void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
525 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
528 //_____________________________________________________________________________
529 void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
531 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
534 //_____________________________________________________________________________
535 void TGeant4::SetColors() {
537 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
540 //_____________________________________________________________________________
541 void TGeant4::Gtreve() {
543 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
546 //_____________________________________________________________________________
547 void TGeant4::GtreveRoot() {
549 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
552 //_____________________________________________________________________________
553 void TGeant4::Gckmat(Int_t itmed, char* natmed) {
555 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
558 //_____________________________________________________________________________
559 void TGeant4::InitLego() {
561 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
564 //_____________________________________________________________________________
565 void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
566 Float_t& amass, Float_t& charge, Float_t& tlife) {
568 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
571 //_____________________________________________________________________________
572 void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
573 Float_t amass, Float_t charge, Float_t tlife) {
575 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");