]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: run | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "TGeant4.h" | |
7 | #include "TG4Messenger.h" | |
fb5a4f03 | 8 | #include "TG4VRunConfiguration.h" |
2817d3e2 | 9 | #include "TG4GeometryManager.h" |
10 | #include "TG4PhysicsManager.h" | |
11 | #include "TG4StepManager.h" | |
12 | #include "TG4VisManager.h" | |
13 | #include "TG4RunManager.h" | |
14 | #include "TG4Globals.h" | |
15 | ||
e59f13eb | 16 | #include "AliDecayer.h" |
17 | ||
2817d3e2 | 18 | TGeant4::TGeant4(const char* name, const char* title, |
19 | TG4VRunConfiguration* configuration, int argc, char** argv) | |
20 | : AliMC(name, title), | |
21 | fVisManager(0) | |
22 | { | |
23 | // create run manager | |
24 | fRunManager = new TG4RunManager(configuration, argc, argv); | |
25 | // add verbose level | |
26 | //G4cout << "TG4RunManager has been created." << endl; | |
27 | ||
28 | // create geometry manager | |
29 | fGeometryManager = new TG4GeometryManager(); | |
30 | // add verbose level | |
31 | //G4cout << "TG4GeometryManager has been created." << endl; | |
32 | ||
33 | // create physics manager | |
fb5a4f03 | 34 | fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList()); |
2817d3e2 | 35 | // add verbose level |
36 | //G4cout << "TG4GeometryManager has been created." << endl; | |
37 | ||
38 | // create step manager | |
39 | fStepManager = new TG4StepManager(); | |
40 | // add verbose level | |
41 | //G4cout << "TG4StepManager has been created." << endl; | |
42 | ||
43 | #ifdef G4VIS_USE | |
44 | // create visualization manager | |
45 | fVisManager = new TG4VisManager(); | |
46 | fVisManager->Initialize(); | |
47 | #endif | |
48 | ||
49 | // create messenger | |
50 | fMessenger = | |
51 | new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager); | |
52 | } | |
53 | ||
54 | TGeant4::TGeant4(const char* name, const char* title, | |
55 | TG4VRunConfiguration* configuration) | |
56 | : AliMC(name, title), | |
57 | fVisManager(0) | |
58 | { | |
59 | // create run manager | |
60 | fRunManager = new TG4RunManager(configuration); | |
61 | // add verbose level | |
62 | //G4cout << "TG4RunManager has been created." << endl; | |
63 | ||
64 | // create geometry manager | |
65 | fGeometryManager = new TG4GeometryManager(); | |
66 | // add verbose level | |
67 | //G4cout << "TG4GeometryManager has been created." << endl; | |
68 | ||
69 | // create physics manager | |
fb5a4f03 | 70 | fPhysicsManager = new TG4PhysicsManager(configuration->GetPhysicsList()); |
2817d3e2 | 71 | // add verbose level |
72 | //G4cout << "TG4GeometryManager has been created." << endl; | |
73 | ||
74 | // create step manager | |
75 | fStepManager = new TG4StepManager(); | |
76 | // add verbose level | |
77 | //G4cout << "TG4StepManager has been created." << endl; | |
78 | ||
79 | #ifdef G4VIS_USE | |
80 | // create visualization manager | |
81 | fVisManager = new TG4VisManager(); | |
82 | fVisManager->Initialize(); | |
83 | #endif | |
84 | ||
85 | // create messenger | |
86 | fMessenger = | |
87 | new TG4Messenger(fGeometryManager, fPhysicsManager, fStepManager); | |
88 | } | |
89 | ||
90 | TGeant4::TGeant4() { | |
91 | // | |
92 | } | |
93 | ||
94 | TGeant4::TGeant4(const TGeant4& right) { | |
95 | // | |
96 | TG4Globals::Exception("TGeant4 is protected from copying."); | |
97 | } | |
98 | ||
99 | TGeant4::~TGeant4() { | |
100 | // | |
101 | delete fRunManager; | |
102 | delete fGeometryManager; | |
103 | delete fPhysicsManager; | |
104 | delete fStepManager; | |
105 | // fVisManager is deleted with G4RunManager destructor | |
106 | delete fMessenger; | |
107 | } | |
108 | ||
109 | // operators | |
110 | ||
111 | TGeant4& TGeant4::operator=(const TGeant4& right) | |
112 | { | |
113 | // check assignement to self | |
114 | if (this == &right) return *this; | |
115 | ||
116 | TG4Globals::Exception("TGeant4 is protected from assigning."); | |
117 | ||
118 | return *this; | |
119 | } | |
120 | ||
121 | ||
122 | // methods for building/management of geometry | |
123 | // ------------------------------------------------ | |
124 | ||
125 | void TGeant4::FinishGeometry() { | |
126 | // | |
127 | fGeometryManager->Ggclos(); | |
128 | } | |
129 | ||
130 | void TGeant4::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, | |
131 | Float_t &dens, Float_t &radl, Float_t &absl, | |
132 | Float_t* ubuf, Int_t& nbuf) { | |
133 | // | |
134 | fGeometryManager | |
135 | ->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf); | |
136 | } | |
137 | ||
138 | void TGeant4::Material(Int_t& kmat, const char* name, Float_t a, | |
139 | Float_t z, Float_t dens, Float_t radl, Float_t absl, | |
140 | Float_t* buf, Int_t nwbuf) { | |
141 | // | |
142 | fGeometryManager | |
143 | ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf); | |
144 | } | |
145 | ||
146 | void TGeant4::Mixture(Int_t& kmat, const char *name, Float_t *a, | |
147 | Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) { | |
148 | // | |
149 | fGeometryManager | |
150 | ->Mixture(kmat, name, a, z, dens, nlmat, wmat); | |
151 | } | |
152 | ||
153 | void TGeant4::Medium(Int_t& kmed, const char *name, Int_t nmat, | |
154 | Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, | |
155 | Float_t stemax, Float_t deemax, Float_t epsil, | |
156 | Float_t stmin, Float_t* ubuf, Int_t nbuf) { | |
157 | // | |
158 | fGeometryManager | |
159 | ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, | |
160 | epsil, stmin, ubuf, nbuf); | |
161 | } | |
162 | ||
163 | void TGeant4::Matrix(Int_t& krot, Float_t thetaX, Float_t phiX, | |
164 | Float_t thetaY, Float_t phiY, Float_t thetaZ, | |
165 | Float_t phiZ) { | |
166 | // | |
167 | fGeometryManager | |
168 | ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ); | |
169 | } | |
170 | ||
171 | void TGeant4::Gstpar(Int_t itmed, const char *param, Float_t parval) { | |
172 | // | |
173 | fGeometryManager->Gstpar(itmed, param, parval); | |
174 | } | |
175 | ||
2817d3e2 | 176 | Int_t TGeant4::Gsvolu(const char *name, const char *shape, Int_t nmed, |
177 | Float_t *upar, Int_t np) { | |
178 | // | |
179 | return fGeometryManager->Gsvolu(name, shape, nmed, upar, np); | |
180 | } | |
181 | ||
182 | void TGeant4::Gsdvn(const char *name, const char *mother, Int_t ndiv, | |
183 | Int_t iaxis) { | |
184 | // | |
185 | fGeometryManager->Gsdvn(name, mother, ndiv, iaxis); | |
186 | } | |
187 | ||
188 | void TGeant4::Gsdvn2(const char *name, const char *mother, Int_t ndiv, | |
189 | Int_t iaxis, Float_t c0i, Int_t numed) { | |
190 | // | |
191 | fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed); | |
192 | } | |
193 | ||
194 | void TGeant4::Gsdvt(const char *name, const char *mother, Float_t step, | |
195 | Int_t iaxis, Int_t numed, Int_t ndvmx) { | |
196 | // | |
197 | fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx); | |
198 | } | |
199 | ||
200 | void TGeant4::Gsdvt2(const char *name, const char *mother, Float_t step, | |
201 | Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) { | |
202 | // | |
203 | fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx); | |
204 | } | |
205 | ||
206 | void TGeant4::Gsord(const char *name, Int_t iax) { | |
207 | // | |
208 | fGeometryManager->Gsord(name, iax); | |
209 | } | |
210 | ||
211 | void TGeant4::Gspos(const char *name, Int_t nr, const char *mother, | |
212 | Float_t x, Float_t y, Float_t z, Int_t irot, | |
213 | const char *konly) { | |
214 | // | |
215 | fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly); | |
216 | } | |
217 | ||
218 | void TGeant4::Gsposp(const char *name, Int_t nr, const char *mother, | |
219 | Float_t x, Float_t y, Float_t z, Int_t irot, | |
220 | const char *konly, Float_t *upar, Int_t np) { | |
221 | // | |
222 | fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np); | |
223 | } | |
224 | ||
75578018 | 225 | void TGeant4::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov, |
226 | Float_t *absco, Float_t *effic, Float_t *rindex) { | |
227 | // | |
228 | fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex); | |
229 | } | |
230 | ||
2817d3e2 | 231 | void TGeant4::WriteEuclid(const char* fileName, const char* topVol, |
232 | Int_t number, Int_t nlevel) { | |
233 | // | |
234 | fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel); | |
235 | } | |
236 | ||
237 | Int_t TGeant4::VolId(const Text_t* volName) const { | |
238 | // | |
239 | return fGeometryManager->VolId(volName); | |
240 | } | |
241 | ||
242 | const char* TGeant4::VolName(Int_t id) const { | |
243 | // | |
244 | return fGeometryManager->VolName(id); | |
245 | } | |
246 | ||
247 | Int_t TGeant4::NofVolumes() const { | |
248 | // | |
249 | return fGeometryManager->NofVolumes(); | |
250 | } | |
251 | ||
fdd271a5 | 252 | Int_t TGeant4::VolId2Mate(Int_t id) const { |
253 | // | |
254 | return fGeometryManager->VolId2Mate(id); | |
255 | } | |
256 | ||
257 | ||
258 | ||
2817d3e2 | 259 | // methods for physics management |
260 | // ------------------------------------------------ | |
261 | ||
262 | void TGeant4::BuildPhysics() { | |
263 | // | |
264 | fPhysicsManager->BuildPhysics(); | |
265 | } | |
266 | ||
267 | void TGeant4::SetCut(const char* cutName, Float_t cutValue) { | |
268 | // | |
269 | fPhysicsManager->SetCut(cutName, cutValue); | |
270 | } | |
271 | ||
272 | void TGeant4::SetProcess(const char* flagName, Int_t flagValue) { | |
273 | // | |
274 | fPhysicsManager->SetProcess(flagName, flagValue); | |
275 | } | |
276 | ||
277 | Float_t TGeant4::Xsec(char* reac, Float_t energy, Int_t part, Int_t mate) { | |
278 | // | |
279 | return fPhysicsManager->Xsec(reac, energy, part, mate); | |
280 | } | |
281 | ||
e59f13eb | 282 | void TGeant4::SetExternalDecayer(AliDecayer* decayer) { |
283 | // | |
284 | TG4Globals:: Warning("TGeant4::SetExternalDecayer() is not implemented."); | |
285 | } | |
286 | ||
287 | AliDecayer* TGeant4::Decayer() const { | |
288 | // | |
289 | TG4Globals:: Warning("TGeant4::Decayer() is not implemented."); | |
290 | return 0; | |
291 | } | |
292 | ||
293 | ||
2817d3e2 | 294 | Int_t TGeant4::IdFromPDG(Int_t pdgID) const { |
295 | // | |
296 | return fPhysicsManager->IdFromPDG(pdgID); | |
297 | } | |
298 | ||
299 | Int_t TGeant4::PDGFromId(Int_t mcID) const { | |
300 | // | |
301 | return fPhysicsManager->PDGFromId(mcID); | |
302 | } | |
303 | ||
304 | void TGeant4::DefineParticles() { | |
305 | // | |
306 | fPhysicsManager->DefineParticles(); | |
307 | } | |
308 | ||
309 | // methods for step management | |
310 | // ------------------------------------------------ | |
311 | // inlined (in TGeant4.icc) | |
312 | ||
2817d3e2 | 313 | // methods for visualization |
314 | // ------------------------------------------------ | |
315 | ||
316 | #ifdef G4VIS_USE | |
317 | void TGeant4::DrawOneSpec(const char* name) { | |
318 | // | |
319 | fVisManager->DrawOneSpec(name); | |
320 | } | |
321 | ||
322 | void TGeant4::Gsatt(const char* name, const char* att, Int_t val) { | |
323 | // | |
324 | fVisManager->Gsatt(name, att, val); | |
325 | } | |
326 | ||
327 | void TGeant4::Gdraw(const char* name, Float_t theta, Float_t phi, | |
328 | Float_t psi, Float_t u0, Float_t v0, | |
329 | Float_t ul, Float_t vl) { | |
330 | // | |
331 | fVisManager->Gdraw(name, theta, phi, psi, u0, v0, ul, vl); | |
332 | } | |
333 | ||
334 | #else | |
335 | void TGeant4::DrawOneSpec(const char* name) { | |
336 | // | |
337 | TG4Globals:: Warning("TGeant4::DrawOneSpec(): no visualization available."); | |
338 | } | |
339 | ||
340 | void TGeant4::Gsatt(const char* name, const char* att, Int_t val) { | |
341 | // | |
342 | TG4Globals:: Warning("TGeant4::Gsatt(): no visualization available."); | |
343 | } | |
344 | ||
345 | void TGeant4::Gdraw(const char* p1, Float_t theta, Float_t phi, | |
346 | Float_t psi, Float_t u0, Float_t v0, | |
347 | Float_t ul, Float_t vl) { | |
348 | // | |
349 | TG4Globals:: Warning("TGeant4::Gdraw(): no visualization available."); | |
350 | } | |
351 | ||
352 | #endif //G4VIS_USE | |
353 | ||
354 | // methods for run control | |
355 | // ------------------------------------------------ | |
356 | ||
357 | void TGeant4::Init() { | |
358 | // | |
359 | fRunManager->Initialize(); | |
360 | } | |
361 | ||
362 | void TGeant4::ProcessEvent() { | |
363 | // | |
364 | fRunManager->ProcessEvent(); | |
365 | } | |
366 | ||
367 | void TGeant4::ProcessRun(Int_t nofEvents) { | |
368 | // | |
369 | fRunManager->ProcessRun(nofEvents); | |
370 | } | |
371 | ||
372 | void TGeant4::StartGeantUI() { | |
373 | // | |
374 | fRunManager->StartGeantUI(); | |
375 | } | |
376 | ||
377 | void TGeant4::StartRootUI() { | |
378 | // | |
562476b1 | 379 | fRunManager->StartRootUI(); |
2817d3e2 | 380 | } |
381 | ||
382 | void TGeant4::ProcessGeantMacro(const char* macroName) { | |
383 | // | |
384 | fRunManager->ProcessGeantMacro(macroName); | |
385 | } | |
386 | ||
387 | void TGeant4::ProcessGeantCommand(const char* command) { | |
388 | // | |
389 | fRunManager->ProcessGeantCommand(command); | |
390 | } | |
391 | ||
392 | Int_t TGeant4::CurrentEvent() const { | |
393 | // | |
394 | return fRunManager->CurrentEvent(); | |
395 | } | |
396 | ||
397 | // Geant3 specific methods | |
398 | // !!! need to be transformed to common interface | |
399 | // ------------------------------------------------ | |
400 | ||
401 | void TGeant4::Gdopt(const char* name, const char* value) { | |
402 | // | |
403 | TG4Globals:: Warning("TGeant4::Gdopt(..) is not implemented."); | |
404 | } | |
405 | ||
406 | void TGeant4::SetClipBox(const char *name, Float_t xmin, Float_t xmax, | |
407 | Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax) { | |
408 | // | |
409 | TG4Globals:: Warning("TGeant4::SetClipBox(..) is not implemented."); | |
410 | } | |
411 | ||
412 | void TGeant4::DefaultRange() { | |
413 | // | |
414 | TG4Globals:: Warning("TGeant4::DefaultRange() is not implemented."); | |
415 | } | |
416 | ||
417 | void TGeant4::Gdhead(Int_t isel, const char* name, Float_t chrsiz) { | |
418 | // | |
419 | TG4Globals:: Warning("TGeant4::Gdhead(..) is not implemented."); | |
420 | } | |
421 | ||
422 | void TGeant4::Gdman(Float_t u, Float_t v, const char* type) { | |
423 | // | |
424 | TG4Globals:: Warning("TGeant4::Gdman(..) is not implemented."); | |
425 | } | |
426 | ||
427 | void TGeant4::SetColors() { | |
428 | // | |
429 | TG4Globals:: Warning("TGeant4::SetColours() is not implemented."); | |
430 | } | |
431 | ||
432 | void TGeant4::Gtreve() { | |
433 | // | |
434 | TG4Globals:: Warning("TGeant4::Gtreve() is not implemented."); | |
435 | } | |
436 | ||
aee8290b | 437 | void TGeant4::GtreveRoot() { |
2817d3e2 | 438 | // |
aee8290b | 439 | TG4Globals:: Warning("TGeant4::GtreveRoot() is not implemented."); |
2817d3e2 | 440 | } |
441 | ||
442 | void TGeant4::Gckmat(Int_t itmed, char* natmed) { | |
443 | // | |
444 | TG4Globals:: Warning("TGeant4::Gckmat(..) is not implemented."); | |
445 | } | |
446 | ||
447 | void TGeant4::InitLego() { | |
448 | // | |
449 | TG4Globals:: Warning("TGeant4::InitLego() is not implemented."); | |
450 | } | |
451 | ||
452 | void TGeant4::Gfpart(Int_t ipart, char *name, Int_t& itrtyp, | |
453 | Float_t& amass, Float_t& charge, Float_t& tlife) { | |
454 | // | |
455 | TG4Globals:: Warning("TGeant4::Gfpart(..) is not implemented."); | |
456 | } | |
457 | ||
458 | void TGeant4::Gspart(Int_t ipart, const char *name, Int_t itrtyp, | |
459 | Float_t amass, Float_t charge, Float_t tlife) { | |
460 | // | |
461 | TG4Globals:: Warning("TGeant4::Gspart(..) is not implemented."); | |
462 | } |