]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant4/TGeant4.cxx
Changed for new Aliroot version.
[u/mrichter/AliRoot.git] / TGeant4 / TGeant4.cxx
CommitLineData
2817d3e2 1// $Id$
2// Category: run
3//
e5967ab3 4// Author: I. Hrivnacova
5//
6// Class TGeant4
7// -------------
2817d3e2 8// See the class description in the header file.
9
10#include "TGeant4.h"
fb5a4f03 11#include "TG4VRunConfiguration.h"
2817d3e2 12#include "TG4GeometryManager.h"
002034b1 13#include "TG4SDManager.h"
2817d3e2 14#include "TG4PhysicsManager.h"
15#include "TG4StepManager.h"
16#include "TG4VisManager.h"
17#include "TG4RunManager.h"
18#include "TG4Globals.h"
19
e59f13eb 20#include "AliDecayer.h"
21
17056b16 22ClassImp(TGeant4)
23
d718b713 24//_____________________________________________________________________________
2817d3e2 25TGeant4::TGeant4(const char* name, const char* title,
26 TG4VRunConfiguration* configuration, int argc, char** argv)
27 : AliMC(name, title),
28 fVisManager(0)
29{
30 // create run manager
31 fRunManager = new TG4RunManager(configuration, argc, argv);
32 // add verbose level
33 //G4cout << "TG4RunManager has been created." << endl;
34
35 // create geometry manager
36 fGeometryManager = new TG4GeometryManager();
37 // add verbose level
38 //G4cout << "TG4GeometryManager has been created." << endl;
39
002034b1 40 // create sensitive detectors manager
41 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
42 // add verbose level
43 //G4cout << "TG4SDManager has been created." << endl;
44
2817d3e2 45 // create physics manager
fb5a4f03 46 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
2817d3e2 47 // add verbose level
48 //G4cout << "TG4GeometryManager has been created." << endl;
49
50 // create step manager
51 fStepManager = new TG4StepManager();
52 // add verbose level
53 //G4cout << "TG4StepManager has been created." << endl;
54
55#ifdef G4VIS_USE
56 // create visualization manager
57 fVisManager = new TG4VisManager();
58 fVisManager->Initialize();
59#endif
2817d3e2 60}
61
d718b713 62//_____________________________________________________________________________
2817d3e2 63TGeant4::TGeant4(const char* name, const char* title,
64 TG4VRunConfiguration* configuration)
65 : AliMC(name, title),
66 fVisManager(0)
67{
68 // create run manager
69 fRunManager = new TG4RunManager(configuration);
70 // add verbose level
71 //G4cout << "TG4RunManager has been created." << endl;
72
73 // create geometry manager
74 fGeometryManager = new TG4GeometryManager();
75 // add verbose level
76 //G4cout << "TG4GeometryManager has been created." << endl;
77
002034b1 78 // create sensitive detectors manager
79 fSDManager = new TG4SDManager(configuration->GetSDConstruction());
80 // add verbose level
81 //G4cout << "TG4SDManager has been created." << endl;
82
2817d3e2 83 // create physics manager
fb5a4f03 84 fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList());
2817d3e2 85 // add verbose level
86 //G4cout << "TG4GeometryManager has been created." << endl;
87
88 // create step manager
89 fStepManager = new TG4StepManager();
90 // add verbose level
91 //G4cout << "TG4StepManager has been created." << endl;
92
93#ifdef G4VIS_USE
94 // create visualization manager
95 fVisManager = new TG4VisManager();
96 fVisManager->Initialize();
97#endif
2817d3e2 98}
99
d718b713 100//_____________________________________________________________________________
2817d3e2 101TGeant4::TGeant4() {
102//
103}
104
d718b713 105//_____________________________________________________________________________
2817d3e2 106TGeant4::TGeant4(const TGeant4& right) {
107//
108 TG4Globals::Exception("TGeant4 is protected from copying.");
109}
110
d718b713 111//_____________________________________________________________________________
2817d3e2 112TGeant4::~TGeant4() {
113//
114 delete fRunManager;
115 delete fGeometryManager;
002034b1 116 delete fSDManager;
2817d3e2 117 delete fPhysicsManager;
118 delete fStepManager;
119 // fVisManager is deleted with G4RunManager destructor
2817d3e2 120}
121
122// operators
123
d718b713 124//_____________________________________________________________________________
2817d3e2 125TGeant4& TGeant4::operator=(const TGeant4& right)
126{
127 // check assignement to self
128 if (this == &right) return *this;
129
130 TG4Globals::Exception("TGeant4 is protected from assigning.");
131
132 return *this;
133}
134
135
136// methods for building/management of geometry
137// ------------------------------------------------
138
d718b713 139//_____________________________________________________________________________
2817d3e2 140void TGeant4::FinishGeometry() {
141//
142 fGeometryManager->Ggclos();
143}
144
d718b713 145//_____________________________________________________________________________
2817d3e2 146void 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) {
149//
150 fGeometryManager
151 ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
152}
153
d718b713 154//_____________________________________________________________________________
2817d3e2 155void 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) {
158//
159 fGeometryManager
160 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
161}
162
d718b713 163//_____________________________________________________________________________
2817d3e2 164void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a,
165 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) {
166//
167 fGeometryManager
168 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
169}
170
d718b713 171//_____________________________________________________________________________
2817d3e2 172void 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) {
176//
177 fGeometryManager
178 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
179 epsil, stmin, ubuf, nbuf);
180}
181
d718b713 182//_____________________________________________________________________________
183void TGeant4::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
184 Double_t thetaY, Double_t phiY, Double_t thetaZ,
185 Double_t phiZ) {
186//
187 fGeometryManager
188 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
189}
190
191//_____________________________________________________________________________
2817d3e2 192void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
193 Float_t thetaY, Float_t phiY, Float_t thetaZ,
194 Float_t phiZ) {
195//
196 fGeometryManager
197 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
198}
199
d718b713 200//_____________________________________________________________________________
201Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
202 Double_t *upar, Int_t np) {
203//
204 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
205}
206
207//_____________________________________________________________________________
2817d3e2 208Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed,
209 Float_t *upar, Int_t np) {
210//
211 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
212}
213
d718b713 214//_____________________________________________________________________________
2817d3e2 215void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv,
216 Int_t iaxis) {
217//
218 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
219}
220
d718b713 221//_____________________________________________________________________________
222void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
223 Int_t iaxis, Double_t c0i, Int_t numed) {
224//
225 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
226}
227
228//_____________________________________________________________________________
2817d3e2 229void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
230 Int_t iaxis, Float_t c0i, Int_t numed) {
231//
232 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
233}
234
d718b713 235//_____________________________________________________________________________
236void TGeant4::Gsdvt(const char *name, const char *mother, Double_t step,
237 Int_t iaxis, Int_t numed, Int_t ndvmx) {
238//
239 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
240}
241
242//_____________________________________________________________________________
2817d3e2 243void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step,
244 Int_t iaxis, Int_t numed, Int_t ndvmx) {
245//
246 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
247}
248
d718b713 249//_____________________________________________________________________________
250void TGeant4::Gsdvt2(const char *name, const char *mother, Double_t step,
251 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) {
252//
253 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
254}
255
256//_____________________________________________________________________________
2817d3e2 257void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step,
258 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) {
259//
260 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
261}
262
d718b713 263//_____________________________________________________________________________
2817d3e2 264void TGeant4::Gsord(const char *name, Int_t iax) {
265//
266 fGeometryManager->Gsord(name, iax);
267}
268
d718b713 269//_____________________________________________________________________________
270void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
271 Double_t x, Double_t y, Double_t z, Int_t irot,
272 const char *konly) {
273//
274 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
275}
276
277//_____________________________________________________________________________
2817d3e2 278void TGeant4::Gspos(const char *name, Int_t nr, const char *mother,
279 Float_t x, Float_t y, Float_t z, Int_t irot,
280 const char *konly) {
281//
282 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
283}
284
d718b713 285//_____________________________________________________________________________
286void 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) {
289//
290 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
291}
292
293//_____________________________________________________________________________
2817d3e2 294void 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) {
297//
298 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
299}
300
17a7edea 301//_____________________________________________________________________________
302void TGeant4::Gsbool(const char* onlyVolName, const char* manyVolName) {
303//
304 fGeometryManager->Gsbool(onlyVolName, manyVolName);
305}
306
d718b713 307//_____________________________________________________________________________
75578018 308void TGeant4::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
309 Float_t *absco, Float_t *effic, Float_t *rindex) {
310//
311 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
312}
313
d718b713 314//_____________________________________________________________________________
2817d3e2 315void TGeant4::WriteEuclid(const char* fileName, const char* topVol,
316 Int_t number, Int_t nlevel) {
317//
318 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
319}
320
d718b713 321//_____________________________________________________________________________
2817d3e2 322Int_t TGeant4::VolId(const Text_t* volName) const {
323//
002034b1 324 return fSDManager->VolId(volName);
2817d3e2 325}
326
d718b713 327//_____________________________________________________________________________
2817d3e2 328const char* TGeant4::VolName(Int_t id) const {
329//
002034b1 330 return fSDManager->VolName(id);
2817d3e2 331}
332
d718b713 333//_____________________________________________________________________________
2817d3e2 334Int_t TGeant4::NofVolumes() const {
335//
002034b1 336 return fSDManager->NofVolumes();
2817d3e2 337}
338
d718b713 339//_____________________________________________________________________________
fdd271a5 340Int_t TGeant4::VolId2Mate(Int_t id) const {
341//
002034b1 342 return fSDManager->VolId2Mate(id);
fdd271a5 343}
344
345
346
2817d3e2 347// methods for physics management
348// ------------------------------------------------
349
002034b1 350//_____________________________________________________________________________
351void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) {
352//
353 fGeometryManager->Gstpar(itmed, param, parval);
354 fPhysicsManager->Gstpar(itmed, param, parval);
355}
356
d718b713 357//_____________________________________________________________________________
2817d3e2 358void TGeant4::SetCut(const char* cutName, Float_t cutValue) {
359//
360 fPhysicsManager->SetCut(cutName, cutValue);
361}
362
d718b713 363//_____________________________________________________________________________
2817d3e2 364void TGeant4::SetProcess(const char* flagName, Int_t flagValue) {
365//
366 fPhysicsManager->SetProcess(flagName, flagValue);
367}
368
d718b713 369//_____________________________________________________________________________
2817d3e2 370Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) {
371//
372 return fPhysicsManager->Xsec(reac, energy, part, mate);
373}
374
d718b713 375//_____________________________________________________________________________
e59f13eb 376void TGeant4::SetExternalDecayer(AliDecayer* decayer) {
377//
0b742b85 378 fPhysicsManager->SetExternalDecayer(decayer);
e59f13eb 379}
380
d718b713 381//_____________________________________________________________________________
e59f13eb 382AliDecayer* TGeant4::Decayer() const {
383//
0b742b85 384 return fPhysicsManager->Decayer();
e59f13eb 385}
386
387
d718b713 388//_____________________________________________________________________________
2817d3e2 389Int_t TGeant4::IdFromPDG(Int_t pdgID) const {
390//
391 return fPhysicsManager->IdFromPDG(pdgID);
392}
393
d718b713 394//_____________________________________________________________________________
2817d3e2 395Int_t TGeant4::PDGFromId(Int_t mcID) const {
396//
397 return fPhysicsManager->PDGFromId(mcID);
398}
399
d718b713 400//_____________________________________________________________________________
2817d3e2 401void TGeant4::DefineParticles() {
402//
403 fPhysicsManager->DefineParticles();
404}
405
406// methods for step management
407// ------------------------------------------------
408// inlined (in TGeant4.icc)
409
2817d3e2 410// methods for visualization
411// ------------------------------------------------
412
413#ifdef G4VIS_USE
d718b713 414//_____________________________________________________________________________
2817d3e2 415void TGeant4::DrawOneSpec(const char* name) {
416//
417 fVisManager->DrawOneSpec(name);
418}
419
d718b713 420//_____________________________________________________________________________
2817d3e2 421void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
422//
423 fVisManager->Gsatt(name, att, val);
424}
425
d718b713 426//_____________________________________________________________________________
2817d3e2 427void 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) {
430//
431 fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl);
432}
433
434#else
d718b713 435//_____________________________________________________________________________
2817d3e2 436void TGeant4::DrawOneSpec(const char* name) {
437//
438 TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available.");
439}
440
d718b713 441//_____________________________________________________________________________
2817d3e2 442void TGeant4::Gsatt(const char* name, const char* att, Int_t val) {
443//
444 TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available.");
445}
446
d718b713 447//_____________________________________________________________________________
2817d3e2 448void 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) {
451//
452 TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available.");
453}
454
455#endif //G4VIS_USE
456
457// methods for run control
458// ------------------------------------------------
459
d718b713 460//_____________________________________________________________________________
2817d3e2 461void TGeant4::Init() {
462//
463 fRunManager->Initialize();
464}
465
e5967ab3 466//_____________________________________________________________________________
467void TGeant4::BuildPhysics() {
468//
469 fRunManager->LateInitialize();
470}
471
d718b713 472//_____________________________________________________________________________
2817d3e2 473void TGeant4::ProcessEvent() {
474//
475 fRunManager->ProcessEvent();
476}
477
d718b713 478//_____________________________________________________________________________
2817d3e2 479void TGeant4::ProcessRun(Int_t nofEvents) {
480//
481 fRunManager->ProcessRun(nofEvents);
482}
483
d718b713 484//_____________________________________________________________________________
2817d3e2 485void TGeant4::StartGeantUI() {
486//
487 fRunManager->StartGeantUI();
488}
489
d718b713 490//_____________________________________________________________________________
2817d3e2 491void TGeant4::StartRootUI() {
492//
562476b1 493 fRunManager->StartRootUI();
2817d3e2 494}
495
d718b713 496//_____________________________________________________________________________
2817d3e2 497void TGeant4::ProcessGeantMacro(const char* macroName) {
498//
499 fRunManager->ProcessGeantMacro(macroName);
500}
501
d718b713 502//_____________________________________________________________________________
2817d3e2 503void TGeant4::ProcessGeantCommand(const char* command) {
504//
505 fRunManager->ProcessGeantCommand(command);
506}
507
d718b713 508//_____________________________________________________________________________
2817d3e2 509Int_t TGeant4::CurrentEvent() const {
510//
511 return fRunManager->CurrentEvent();
512}
513
514// Geant3 specific methods
515// !!! need to be transformed to common interface
516// ------------------------------------------------
517
d718b713 518//_____________________________________________________________________________
2817d3e2 519void TGeant4::Gdopt(const char* name, const char* value) {
520//
521 TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented.");
522}
523
d718b713 524//_____________________________________________________________________________
2817d3e2 525void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax,
526 Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) {
527//
528 TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented.");
529}
530
d718b713 531//_____________________________________________________________________________
2817d3e2 532void TGeant4::DefaultRange() {
533//
534 TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented.");
535}
536
d718b713 537//_____________________________________________________________________________
2817d3e2 538void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) {
539//
540 TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented.");
541}
542
d718b713 543//_____________________________________________________________________________
2817d3e2 544void TGeant4::Gdman(Float_t u, Float_t v, const char* type) {
545//
546 TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented.");
547}
548
d718b713 549//_____________________________________________________________________________
2817d3e2 550void TGeant4::SetColors() {
551//
552 TG4Globals:: Warning("TGeant4::SetColours() is not implemented.");
553}
554
d718b713 555//_____________________________________________________________________________
2817d3e2 556void TGeant4::Gtreve() {
557//
558 TG4Globals:: Warning("TGeant4::Gtreve() is not implemented.");
559}
560
d718b713 561//_____________________________________________________________________________
aee8290b 562void TGeant4::GtreveRoot() {
2817d3e2 563//
aee8290b 564 TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented.");
2817d3e2 565}
566
d718b713 567//_____________________________________________________________________________
2817d3e2 568void TGeant4::Gckmat(Int_t itmed, char* natmed) {
569//
570 TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented.");
571}
572
d718b713 573//_____________________________________________________________________________
2817d3e2 574void TGeant4::InitLego() {
575//
576 TG4Globals:: Warning("TGeant4::InitLego() is not implemented.");
577}
578
d718b713 579//_____________________________________________________________________________
2817d3e2 580void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp,
581 Float_t& amass, Float_t& charge, Float_t& tlife) {
582//
583 TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented.");
584}
585
d718b713 586//_____________________________________________________________________________
2817d3e2 587void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
588 Float_t amass, Float_t charge, Float_t tlife) {
589//
590 TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented.");
591}