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