fe4da5cc |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // // |
3 | // Interface Class to the Geant3.21 MonteCarlo // |
4 | // // |
5 | //Begin_Html |
6 | /* |
1439f98e |
7 | <img src="picts/TGeant3Class.gif"> |
fe4da5cc |
8 | */ |
9 | //End_Html |
10 | // // |
11 | // // |
12 | /////////////////////////////////////////////////////////////////////////////// |
13 | |
14 | #include "TGeant3.h" |
15 | #include "TROOT.h" |
16 | #include "THIGZ.h" |
17 | #include "ctype.h" |
1578254f |
18 | #include <TDatabasePDG.h> |
fe4da5cc |
19 | #include "AliCallf77.h" |
20 | |
21 | #ifndef WIN32 |
22 | # define gzebra gzebra_ |
23 | # define grfile grfile_ |
24 | # define gpcxyz gpcxyz_ |
25 | # define ggclos ggclos_ |
26 | # define glast glast_ |
27 | # define ginit ginit_ |
28 | # define gcinit gcinit_ |
29 | # define grun grun_ |
30 | # define gtrig gtrig_ |
31 | # define gtrigc gtrigc_ |
32 | # define gtrigi gtrigi_ |
33 | # define gwork gwork_ |
34 | # define gzinit gzinit_ |
35 | # define gfmate gfmate_ |
36 | # define gfpart gfpart_ |
37 | # define gftmed gftmed_ |
38 | # define gmate gmate_ |
39 | # define gpart gpart_ |
40 | # define gsdk gsdk_ |
41 | # define gsmate gsmate_ |
42 | # define gsmixt gsmixt_ |
43 | # define gspart gspart_ |
44 | # define gstmed gstmed_ |
45 | # define gsckov gsckov_ |
46 | # define gstpar gstpar_ |
47 | # define gfkine gfkine_ |
48 | # define gfvert gfvert_ |
49 | # define gskine gskine_ |
50 | # define gsvert gsvert_ |
51 | # define gphysi gphysi_ |
52 | # define gdebug gdebug_ |
53 | # define gekbin gekbin_ |
54 | # define gfinds gfinds_ |
55 | # define gsking gsking_ |
56 | # define gskpho gskpho_ |
57 | # define gsstak gsstak_ |
58 | # define gsxyz gsxyz_ |
59 | # define gtrack gtrack_ |
60 | # define gtreve gtreve_ |
1578254f |
61 | # define gtreve_root gtreve_root_ |
fe4da5cc |
62 | # define grndm grndm_ |
63 | # define grndmq grndmq_ |
64 | # define gdtom gdtom_ |
65 | # define glmoth glmoth_ |
66 | # define gmedia gmedia_ |
67 | # define gmtod gmtod_ |
68 | # define gsdvn gsdvn_ |
69 | # define gsdvn2 gsdvn2_ |
70 | # define gsdvs gsdvs_ |
71 | # define gsdvs2 gsdvs2_ |
72 | # define gsdvt gsdvt_ |
73 | # define gsdvt2 gsdvt2_ |
74 | # define gsord gsord_ |
75 | # define gspos gspos_ |
76 | # define gsposp gsposp_ |
77 | # define gsrotm gsrotm_ |
78 | # define gprotm gprotm_ |
79 | # define gsvolu gsvolu_ |
80 | # define gprint gprint_ |
81 | # define gdinit gdinit_ |
82 | # define gdopt gdopt_ |
83 | # define gdraw gdraw_ |
84 | # define gdrayt gdrayt_ |
85 | # define gdrawc gdrawc_ |
86 | # define gdrawx gdrawx_ |
87 | # define gdhead gdhead_ |
88 | # define gdwmn1 gdwmn1_ |
89 | # define gdwmn2 gdwmn2_ |
90 | # define gdwmn3 gdwmn3_ |
91 | # define gdxyz gdxyz_ |
92 | # define gdcxyz gdcxyz_ |
93 | # define gdman gdman_ |
94 | # define gdspec gdspec_ |
95 | # define gdtree gdtree_ |
96 | # define gdelet gdelet_ |
97 | # define gdclos gdclos_ |
98 | # define gdshow gdshow_ |
99 | # define gdopen gdopen_ |
100 | # define dzshow dzshow_ |
101 | # define gsatt gsatt_ |
102 | # define gfpara gfpara_ |
103 | # define gckpar gckpar_ |
104 | # define gckmat gckmat_ |
105 | # define geditv geditv_ |
7ac3f11b |
106 | # define mzdrop mzdrop_ |
fe4da5cc |
107 | |
108 | # define setbomb setbomb_ |
109 | # define setclip setclip_ |
110 | # define gcomad gcomad_ |
111 | |
112 | #else |
113 | # define gzebra GZEBRA |
114 | # define grfile GRFILE |
115 | # define gpcxyz GPCXYZ |
116 | # define ggclos GGCLOS |
117 | # define glast GLAST |
118 | # define ginit GINIT |
119 | # define gcinit GCINIT |
120 | # define grun GRUN |
121 | # define gtrig GTRIG |
122 | # define gtrigc GTRIGC |
123 | # define gtrigi GTRIGI |
124 | # define gwork GWORK |
125 | # define gzinit GZINIT |
126 | # define gfmate GFMATE |
127 | # define gfpart GFPART |
128 | # define gftmed GFTMED |
129 | # define gmate GMATE |
130 | # define gpart GPART |
131 | # define gsdk GSDK |
132 | # define gsmate GSMATE |
133 | # define gsmixt GSMIXT |
134 | # define gspart GSPART |
135 | # define gstmed GSTMED |
136 | # define gsckov GSCKOV |
137 | # define gstpar GSTPAR |
138 | # define gfkine GFKINE |
139 | # define gfvert GFVERT |
140 | # define gskine GSKINE |
141 | # define gsvert GSVERT |
142 | # define gphysi GPHYSI |
143 | # define gdebug GDEBUG |
144 | # define gekbin GEKBIN |
145 | # define gfinds GFINDS |
146 | # define gsking GSKING |
147 | # define gskpho GSKPHO |
148 | # define gsstak GSSTAK |
149 | # define gsxyz GSXYZ |
150 | # define gtrack GTRACK |
151 | # define gtreve GTREVE |
1578254f |
152 | # define gtreve_root GTREVE_ROOT |
fe4da5cc |
153 | # define grndm GRNDM |
154 | # define grndmq GRNDMQ |
155 | # define gdtom GDTOM |
156 | # define glmoth GLMOTH |
157 | # define gmedia GMEDIA |
158 | # define gmtod GMTOD |
159 | # define gsdvn GSDVN |
160 | # define gsdvn2 GSDVN2 |
161 | # define gsdvs GSDVS |
162 | # define gsdvs2 GSDVS2 |
163 | # define gsdvt GSDVT |
164 | # define gsdvt2 GSDVT2 |
165 | # define gsord GSORD |
166 | # define gspos GSPOS |
167 | # define gsposp GSPOSP |
168 | # define gsrotm GSROTM |
169 | # define gprotm GPROTM |
170 | # define gsvolu GSVOLU |
171 | # define gprint GPRINT |
172 | # define gdinit GDINIT |
173 | # define gdopt GDOPT |
174 | # define gdraw GDRAW |
175 | # define gdrayt GDRAYT |
176 | # define gdrawc GDRAWC |
177 | # define gdrawx GDRAWX |
178 | # define gdhead GDHEAD |
179 | # define gdwmn1 GDWMN1 |
180 | # define gdwmn2 GDWMN2 |
181 | # define gdwmn3 GDWMN3 |
182 | # define gdxyz GDXYZ |
183 | # define gdcxyz GDCXYZ |
184 | # define gdman GDMAN |
185 | # define gdfspc GDFSPC |
186 | # define gdspec GDSPEC |
187 | # define gdtree GDTREE |
188 | # define gdelet GDELET |
189 | # define gdclos GDCLOS |
190 | # define gdshow GDSHOW |
191 | # define gdopen GDOPEN |
192 | # define dzshow DZSHOW |
193 | # define gsatt GSATT |
194 | # define gfpara GFPARA |
195 | # define gckpar GCKPAR |
196 | # define gckmat GCKMAT |
197 | # define geditv GEDITV |
7ac3f11b |
198 | # define mzdrop MZDROP |
fe4da5cc |
199 | |
200 | # define setbomb SETBOMB |
201 | # define setclip SETCLIP |
7ac3f11b |
202 | # define gcomad GCOMAD |
fe4da5cc |
203 | |
204 | #endif |
205 | |
206 | //____________________________________________________________________________ |
207 | extern "C" |
208 | { |
209 | // |
210 | // Prototypes for GEANT functions |
211 | // |
212 | void type_of_call gzebra(const int&); |
213 | |
214 | void type_of_call gpcxyz(); |
215 | |
216 | void type_of_call ggclos(); |
217 | |
218 | void type_of_call glast(); |
219 | |
220 | void type_of_call ginit(); |
221 | |
222 | void type_of_call gcinit(); |
223 | |
224 | void type_of_call grun(); |
225 | |
226 | void type_of_call gtrig(); |
227 | |
228 | void type_of_call gtrigc(); |
229 | |
230 | void type_of_call gtrigi(); |
231 | |
232 | void type_of_call gwork(const int&); |
233 | |
234 | void type_of_call gzinit(); |
235 | |
236 | void type_of_call gmate(); |
237 | |
238 | void type_of_call gpart(); |
239 | |
240 | void type_of_call gsdk(Int_t &, Float_t *, Int_t *); |
241 | |
242 | void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &, |
243 | Int_t &, Float_t *, Int_t &); |
244 | |
245 | void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &, |
246 | Float_t &, Float_t *, Int_t &); |
247 | |
248 | void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *, |
249 | Int_t &, Int_t &); |
250 | |
251 | void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *, |
252 | Int_t &, Int_t &); |
253 | |
254 | void type_of_call gphysi(); |
255 | |
256 | void type_of_call gdebug(); |
257 | |
258 | void type_of_call gekbin(); |
259 | |
260 | void type_of_call gfinds(); |
261 | |
262 | void type_of_call gsking(Int_t &); |
263 | |
264 | void type_of_call gskpho(Int_t &); |
265 | |
266 | void type_of_call gsstak(Int_t &); |
267 | |
268 | void type_of_call gsxyz(); |
269 | |
270 | void type_of_call gtrack(); |
271 | |
272 | void type_of_call gtreve(); |
273 | |
1578254f |
274 | void type_of_call gtreve_root(); |
275 | |
fe4da5cc |
276 | void type_of_call grndm(Float_t *, const Int_t &); |
277 | |
278 | void type_of_call grndmq(Int_t &, Int_t &, const Int_t &, |
279 | DEFCHARD DEFCHARL); |
280 | |
281 | void type_of_call gdtom(Float_t *, Float_t *, Int_t &); |
282 | |
283 | void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *, |
284 | Int_t *, Int_t * DEFCHARL); |
285 | |
286 | void type_of_call gmedia(Float_t *, Int_t &); |
287 | |
288 | void type_of_call gmtod(Float_t *, Float_t *, Int_t &); |
289 | |
290 | void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &, |
291 | const Float_t &, const Float_t &, const Float_t &, |
292 | const Float_t &); |
293 | |
294 | void type_of_call gprotm(const Int_t &); |
295 | |
296 | void type_of_call grfile(const Int_t&, DEFCHARD, |
297 | DEFCHARD DEFCHARL DEFCHARL); |
298 | |
299 | void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &, |
300 | Float_t &, Float_t &, Float_t &, Float_t *, |
301 | Int_t& DEFCHARL); |
302 | |
303 | void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &, |
304 | Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL); |
305 | |
306 | void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &, |
307 | Float_t &, Float_t &, Float_t &, Float_t &, |
308 | Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL); |
309 | |
310 | void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &, |
311 | Float_t &, Float_t &, Float_t &, Float_t *, |
312 | Int_t & DEFCHARL); |
313 | |
314 | void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *, |
315 | Float_t &, Int_t &, Float_t * DEFCHARL); |
316 | |
317 | void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &, |
318 | Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL); |
319 | |
320 | |
321 | void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &, |
322 | Float_t &, Float_t &, Float_t &, Float_t &, |
323 | Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL); |
324 | |
325 | void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov, |
326 | Float_t *absco, Float_t *effic, Float_t *rindex); |
327 | void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL); |
328 | |
329 | void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t & |
330 | DEFCHARL DEFCHARL); |
331 | |
332 | void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &, |
333 | Int_t & DEFCHARL DEFCHARL); |
334 | |
335 | void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t & |
336 | DEFCHARL DEFCHARL); |
337 | |
338 | void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &, |
339 | Int_t & DEFCHARL DEFCHARL); |
340 | |
341 | void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &, |
342 | Int_t & DEFCHARL DEFCHARL); |
343 | |
344 | void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&, |
345 | Int_t &, Int_t & DEFCHARL DEFCHARL); |
346 | |
347 | void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL); |
348 | |
349 | void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &, |
350 | Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL |
351 | DEFCHARL); |
352 | |
353 | void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &, |
354 | Float_t &, Int_t &, DEFCHARD, |
355 | Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL); |
356 | |
357 | void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &, |
358 | Int_t & DEFCHARL DEFCHARL); |
359 | |
360 | void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL); |
361 | |
362 | void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*, |
363 | Float_t* DEFCHARL); |
364 | |
365 | void type_of_call gckpar(Int_t&, Int_t&, Float_t*); |
366 | |
367 | void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL); |
368 | |
369 | void type_of_call gprint(DEFCHARD,const int& DEFCHARL); |
370 | |
371 | void type_of_call gdinit(); |
372 | |
373 | void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL); |
374 | |
375 | void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &, |
376 | Float_t &, Float_t &, Float_t & DEFCHARL); |
377 | void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &, |
378 | Float_t &, Float_t &, Float_t & DEFCHARL); |
379 | void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &, |
380 | Float_t &, Float_t & DEFCHARL); |
381 | void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &, |
382 | Float_t &, Float_t &, Float_t &, Float_t &, |
383 | Float_t & DEFCHARL); |
384 | void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL); |
385 | void type_of_call gdxyz(Int_t &); |
386 | void type_of_call gdcxyz(); |
387 | void type_of_call gdman(Float_t &, Float_t &); |
388 | void type_of_call gdwmn1(Float_t &, Float_t &); |
389 | void type_of_call gdwmn2(Float_t &, Float_t &); |
390 | void type_of_call gdwmn3(Float_t &, Float_t &); |
391 | void type_of_call gdspec(DEFCHARD DEFCHARL); |
392 | void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;} |
393 | void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL); |
394 | |
395 | void type_of_call gdopen(Int_t &); |
396 | void type_of_call gdclos(); |
397 | void type_of_call gdelet(Int_t &); |
398 | void type_of_call gdshow(Int_t &); |
399 | void type_of_call geditv(Int_t &) {;} |
400 | |
401 | |
402 | void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&, |
403 | const int&, const int&, const int& DEFCHARL |
404 | DEFCHARL); |
405 | |
7ac3f11b |
406 | void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL); |
407 | |
fe4da5cc |
408 | void type_of_call setbomb(Float_t &); |
409 | void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &, |
410 | Float_t &, Float_t & DEFCHARL); |
411 | void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL); |
412 | } |
413 | |
414 | // |
415 | // Geant3 global pointer |
416 | // |
417 | static Int_t defSize = 600; |
418 | |
419 | ClassImp(TGeant3) |
420 | |
421 | //____________________________________________________________________________ |
1578254f |
422 | TGeant3::TGeant3() |
fe4da5cc |
423 | { |
424 | // |
425 | // Default constructor |
426 | // |
427 | } |
428 | |
429 | //____________________________________________________________________________ |
430 | TGeant3::TGeant3(const char *title, Int_t nwgeant) |
431 | :AliMC("TGeant3",title) |
432 | { |
433 | // |
434 | // Standard constructor for TGeant3 with ZEBRA initialisation |
435 | // |
436 | |
437 | if(nwgeant) { |
438 | gzebra(nwgeant); |
439 | ginit(); |
440 | gzinit(); |
441 | } else { |
442 | gcinit(); |
443 | } |
444 | // |
445 | // Load Address of Geant3 commons |
446 | LoadAddress(); |
1578254f |
447 | // |
448 | // Zero number of particles |
449 | fNPDGCodes=0; |
fe4da5cc |
450 | } |
451 | |
452 | //____________________________________________________________________________ |
453 | Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, |
454 | Float_t &radl, Float_t &absl) const |
455 | { |
456 | // |
457 | // Return the parameters of the current material during transport |
458 | // |
459 | z = fGcmate->z; |
460 | a = fGcmate->a; |
461 | dens = fGcmate->dens; |
462 | radl = fGcmate->radl; |
463 | absl = fGcmate->absl; |
464 | return 1; //this could be the number of elements in mixture |
465 | } |
466 | |
467 | //____________________________________________________________________________ |
468 | void TGeant3::DefaultRange() |
469 | { |
470 | // |
471 | // Set range of current drawing pad to 20x20 cm |
472 | // |
473 | if (!higz) { |
474 | new THIGZ(defSize); |
475 | gdinit(); |
476 | } |
477 | higz->Range(0,0,20,20); |
478 | } |
479 | |
480 | //____________________________________________________________________________ |
481 | void TGeant3::InitHIGZ() |
482 | { |
483 | // |
484 | // Initialise HIGZ |
485 | // |
486 | if (!higz) { |
487 | new THIGZ(defSize); |
488 | gdinit(); |
489 | } |
490 | } |
491 | |
492 | //____________________________________________________________________________ |
493 | void TGeant3::LoadAddress() |
494 | { |
495 | // |
496 | // Assigns the address of the GEANT common blocks to the structures |
497 | // that allow their access from C++ |
498 | // |
499 | Int_t *addr; |
500 | gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST")); |
7ac3f11b |
501 | gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK")); |
fe4da5cc |
502 | gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK")); |
503 | gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS")); |
504 | gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG")); |
505 | gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE")); |
506 | gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING")); |
507 | gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2")); |
508 | gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3")); |
509 | gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE")); |
510 | gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED")); |
511 | gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK")); |
512 | gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL")); |
513 | gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU")); |
514 | gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM")); |
515 | gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS")); |
516 | gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS")); |
517 | gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI")); |
518 | gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT")); |
519 | gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA")); |
520 | |
521 | gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ")); |
522 | fZiq = addr; |
523 | gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ")); |
524 | fZlq = addr; |
525 | fZq = (float*)fZiq; |
526 | } |
527 | |
528 | //_____________________________________________________________________________ |
529 | void TGeant3::GeomIter() |
530 | { |
531 | // |
532 | // Geometry iterator for moving upward in the geometry tree |
533 | // Initialise the iterator |
534 | // |
535 | fNextVol=fGcvolu->nlevel; |
536 | } |
537 | |
538 | //____________________________________________________________________________ |
539 | Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©) |
540 | { |
541 | // |
542 | // Geometry iterator for moving upward in the geometry tree |
543 | // Return next volume up |
544 | // |
545 | Int_t i, gname; |
546 | fNextVol--; |
547 | if(fNextVol>=0) { |
548 | gname=fGcvolu->names[fNextVol]; |
549 | strncpy(name,(char *) &gname, 4); |
550 | name[4]='\0'; |
551 | copy=fGcvolu->number[fNextVol]; |
552 | i=fGcvolu->lvolum[fNextVol]; |
553 | if(gname == fZiq[fGclink->jvolum+i]) return i; |
554 | else printf("GeomTree: Volume %s not found in bank\n",name); |
555 | } |
556 | return 0; |
557 | } |
558 | |
559 | //_____________________________________________________________________________ |
560 | Int_t TGeant3::CurrentVol(Text_t *name, Int_t ©) const |
561 | { |
562 | // |
563 | // Returns the current volume ID, name and copy number |
564 | // if name=0 no name is returned |
565 | // |
566 | Int_t i, gname; |
567 | if( (i=fGcvolu->nlevel-1) < 0 ) { |
568 | printf("CurrentVol: stack depth %d\n",fGcvolu->nlevel); |
569 | } else { |
570 | gname=fGcvolu->names[i]; |
571 | if(name) { |
572 | strncpy(name,(char *) &gname, 4); |
573 | name[4]='\0'; |
574 | } |
575 | copy=fGcvolu->number[i]; |
576 | i=fGcvolu->lvolum[i]; |
577 | if(gname == fZiq[fGclink->jvolum+i]) return i; |
578 | else printf("CurrentVol: Volume %s not found in bank\n",name); |
579 | } |
580 | return 0; |
581 | } |
582 | |
583 | //_____________________________________________________________________________ |
584 | Int_t TGeant3::CurrentVolOff(Int_t off, Text_t *name, Int_t ©) const |
585 | { |
586 | // |
587 | // Return the current volume "off" upward in the geometrical tree |
588 | // ID, name and copy number |
589 | // if name=0 no name is returned |
590 | // |
591 | Int_t i, gname; |
592 | if( (i=fGcvolu->nlevel-off-1) < 0 ) { |
593 | printf("CurrentVolOff: Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel); |
594 | } else { |
595 | gname=fGcvolu->names[i]; |
596 | if(name) { |
597 | strncpy(name,(char *) &gname, 4); |
598 | name[4]='\0'; |
599 | } |
600 | copy=fGcvolu->number[i]; |
601 | i=fGcvolu->lvolum[i]; |
602 | if(gname == fZiq[fGclink->jvolum+i]) return i; |
603 | else printf("CurrentVolOff: Volume %s not found in bank\n",name); |
604 | } |
605 | return 0; |
606 | } |
607 | |
1578254f |
608 | //_____________________________________________________________________________ |
609 | Int_t TGeant3::IdFromPDG(Int_t pdg) const |
610 | { |
611 | // |
612 | // Return Geant3 code from PDG and pseudo ENDF code |
613 | |
614 | for(Int_t i=0;i<fNPDGCodes;++i) |
615 | if(pdg==fPDGCode[i]) return i; |
616 | return -1; |
617 | } |
618 | |
619 | //_____________________________________________________________________________ |
620 | Int_t TGeant3::PDGFromId(Int_t id) const |
621 | { |
622 | if(id>0 && id<fNPDGCodes) return fPDGCode[id]; |
623 | else return -1; |
624 | } |
625 | |
626 | //_____________________________________________________________________________ |
627 | void TGeant3::DefineParticles() |
628 | { |
629 | // |
630 | // Define standard Geant 3 particles |
631 | Gpart(); |
632 | // |
633 | // Load standard numbers for GEANT particles and PDG conversion |
634 | fPDGCode[fNPDGCodes++]=-99; // 0 = unused location |
635 | fPDGCode[fNPDGCodes++]=22; // 1 = photon |
636 | fPDGCode[fNPDGCodes++]=-11; // 2 = positron |
637 | fPDGCode[fNPDGCodes++]=11; // 3 = electron |
638 | fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e |
639 | fPDGCode[fNPDGCodes++]=-13; // 5 = muon + |
640 | fPDGCode[fNPDGCodes++]=13; // 6 = muon - |
641 | fPDGCode[fNPDGCodes++]=111; // 7 = pi0 |
642 | fPDGCode[fNPDGCodes++]=211; // 8 = pi+ |
643 | fPDGCode[fNPDGCodes++]=-211; // 9 = pi- |
644 | fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long |
645 | fPDGCode[fNPDGCodes++]=321; // 11 = Kaon + |
646 | fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon - |
647 | fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron |
648 | fPDGCode[fNPDGCodes++]=2212; // 14 = Proton |
649 | fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton |
650 | fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short |
651 | fPDGCode[fNPDGCodes++]=221; // 17 = Eta |
652 | fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda |
653 | fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma + |
654 | fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0 |
655 | fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma - |
656 | fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0 |
657 | fPDGCode[fNPDGCodes++]=3312; // 23 = Xi- |
658 | fPDGCode[fNPDGCodes++]=3334; // 24 = Omega- |
659 | fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton |
660 | fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton |
661 | fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma - |
662 | fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0 |
663 | fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0 |
664 | fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0 |
665 | fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi + |
666 | fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega + |
667 | |
668 | |
669 | Int_t mode[6]; |
670 | Int_t kz, ipa; |
671 | Float_t bratio[6]; |
672 | |
673 | /* --- Define additional particles */ |
674 | Gspart(33, "OMEGA(782)", 3, 0.782, 0., 7.836e-23); |
675 | fPDGCode[fNPDGCodes++]=223; // 33 = Omega(782) |
676 | |
677 | Gspart(34, "PHI(1020)", 3, 1.019, 0., 1.486e-22); |
678 | fPDGCode[fNPDGCodes++]=333; // 34 = PHI (1020) |
679 | |
680 | Gspart(35, "D +", 4, 1.87, 1., 1.066e-12); |
681 | fPDGCode[fNPDGCodes++]=411; // 35 = D+ |
682 | |
683 | Gspart(36, "D -", 4, 1.87, -1., 1.066e-12); |
684 | fPDGCode[fNPDGCodes++]=-411; // 36 = D- |
685 | |
686 | Gspart(37, "D 0", 3, 1.865, 0., 4.2e-13); |
687 | fPDGCode[fNPDGCodes++]=421; // 37 = D0 |
688 | |
689 | Gspart(38, "ANTI D 0", 3, 1.865, 0., 4.2e-13); |
690 | fPDGCode[fNPDGCodes++]=-421; // 38 = D0 bar |
691 | |
692 | fPDGCode[fNPDGCodes++]=-99; // 39 = unassigned |
693 | |
694 | fPDGCode[fNPDGCodes++]=-99; // 40 = unassigned |
695 | |
696 | fPDGCode[fNPDGCodes++]=-99; // 41 = unassigned |
697 | |
698 | Gspart(42, "RHO +", 4, 0.768, 1., 4.353e-24); |
699 | fPDGCode[fNPDGCodes++]=213; // 42 = RHO+ |
700 | |
701 | Gspart(43, "RHO -", 4, 0.768, -1., 4.353e-24); |
702 | fPDGCode[fNPDGCodes++]=-213; // 40 = RHO- |
703 | |
704 | Gspart(44, "RHO 0", 3, 0.768, 0., 4.353e-24); |
705 | fPDGCode[fNPDGCodes++]=113; // 37 = D0 |
706 | |
707 | // |
708 | // Use ENDF-6 mapping for ions = 10000*z+10*a+iso |
709 | // and add 1 000 000 |
710 | // and numbers above 5 000 000 for special applications |
711 | // |
712 | |
713 | const Int_t kion=10000000; |
714 | |
715 | const Int_t kspe=50000000; |
716 | |
717 | TDatabasePDG *pdgDB = TDatabasePDG::Instance(); |
718 | |
719 | const Double_t autogev=0.9314943228; |
720 | const Double_t hslash = 1.0545726663e-27; |
721 | const Double_t erggev = 1/1.6021773349e-3; |
722 | const Double_t hshgev = hslash*erggev; |
723 | const Double_t yearstosec = 3600*24*365.25; |
724 | |
725 | |
726 | pdgDB->AddParticle("Deuteron","Deuteron",2*autogev+8.071e-3,kTRUE, |
727 | 0,1,"Ion",kion+10020); |
728 | fPDGCode[fNPDGCodes++]=kion+10020; // 45 = Deuteron |
729 | |
730 | pdgDB->AddParticle("Triton","Triton",3*autogev+14.931e-3,kFALSE, |
731 | hshgev/(12.33*yearstosec),1,"Ion",kion+10030); |
732 | fPDGCode[fNPDGCodes++]=kion+10030; // 46 = Triton |
733 | |
734 | pdgDB->AddParticle("Alpha","Alpha",4*autogev+2.424e-3,kTRUE, |
735 | hshgev/(12.33*yearstosec),2,"Ion",kion+20040); |
736 | fPDGCode[fNPDGCodes++]=kion+20040; // 47 = Alpha |
737 | |
738 | fPDGCode[fNPDGCodes++]=0; // 48 = geantino mapped to rootino |
739 | |
740 | pdgDB->AddParticle("HE3","HE3",3*autogev+14.931e-3,kFALSE, |
741 | 0,2,"Ion",kion+20030); |
742 | fPDGCode[fNPDGCodes++]=kion+20030; // 49 = HE3 |
743 | |
744 | pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE, |
745 | 0,0,"Special",kspe+50); |
746 | fPDGCode[fNPDGCodes++]=kspe+50; // 50 = Cherenkov |
747 | |
748 | /* --- Define additional decay modes --- */ |
749 | /* --- omega(783) --- */ |
750 | for (kz = 0; kz < 6; ++kz) { |
751 | bratio[kz] = 0.; |
752 | mode[kz] = 0; |
753 | } |
754 | ipa = 33; |
755 | bratio[0] = 89.; |
756 | bratio[1] = 8.5; |
757 | bratio[2] = 2.5; |
758 | mode[0] = 70809; |
759 | mode[1] = 107; |
760 | mode[2] = 908; |
761 | Gsdk(ipa, bratio, mode); |
762 | /* --- phi(1020) --- */ |
763 | for (kz = 0; kz < 6; ++kz) { |
764 | bratio[kz] = 0.; |
765 | mode[kz] = 0; |
766 | } |
767 | ipa = 34; |
768 | bratio[0] = 49.; |
769 | bratio[1] = 34.4; |
770 | bratio[2] = 12.9; |
771 | bratio[3] = 2.4; |
772 | bratio[4] = 1.3; |
773 | mode[0] = 1112; |
774 | mode[1] = 1610; |
775 | mode[2] = 4407; |
776 | mode[3] = 90807; |
777 | mode[4] = 1701; |
778 | Gsdk(ipa, bratio, mode); |
779 | /* --- D+ --- */ |
780 | for (kz = 0; kz < 6; ++kz) { |
781 | bratio[kz] = 0.; |
782 | mode[kz] = 0; |
783 | } |
784 | ipa = 35; |
785 | bratio[0] = 25.; |
786 | bratio[1] = 25.; |
787 | bratio[2] = 25.; |
788 | bratio[3] = 25.; |
789 | mode[0] = 80809; |
790 | mode[1] = 120808; |
791 | mode[2] = 111208; |
792 | mode[3] = 110809; |
793 | Gsdk(ipa, bratio, mode); |
794 | /* --- D- --- */ |
795 | for (kz = 0; kz < 6; ++kz) { |
796 | bratio[kz] = 0.; |
797 | mode[kz] = 0; |
798 | } |
799 | ipa = 36; |
800 | bratio[0] = 25.; |
801 | bratio[1] = 25.; |
802 | bratio[2] = 25.; |
803 | bratio[3] = 25.; |
804 | mode[0] = 90908; |
805 | mode[1] = 110909; |
806 | mode[2] = 121109; |
807 | mode[3] = 120908; |
808 | Gsdk(ipa, bratio, mode); |
809 | /* --- D0 --- */ |
810 | for (kz = 0; kz < 6; ++kz) { |
811 | bratio[kz] = 0.; |
812 | mode[kz] = 0; |
813 | } |
814 | ipa = 37; |
815 | bratio[0] = 33.; |
816 | bratio[1] = 33.; |
817 | bratio[2] = 33.; |
818 | mode[0] = 809; |
819 | mode[1] = 1208; |
820 | mode[2] = 1112; |
821 | Gsdk(ipa, bratio, mode); |
822 | /* --- Anti D0 --- */ |
823 | for (kz = 0; kz < 6; ++kz) { |
824 | bratio[kz] = 0.; |
825 | mode[kz] = 0; |
826 | } |
827 | ipa = 38; |
828 | bratio[0] = 33.; |
829 | bratio[1] = 33.; |
830 | bratio[2] = 33.; |
831 | mode[0] = 809; |
832 | mode[1] = 1109; |
833 | mode[2] = 1112; |
834 | Gsdk(ipa, bratio, mode); |
835 | /* --- rho+ --- */ |
836 | for (kz = 0; kz < 6; ++kz) { |
837 | bratio[kz] = 0.; |
838 | mode[kz] = 0; |
839 | } |
840 | ipa = 42; |
841 | bratio[0] = 100.; |
842 | mode[0] = 807; |
843 | Gsdk(ipa, bratio, mode); |
844 | /* --- rho- --- */ |
845 | for (kz = 0; kz < 6; ++kz) { |
846 | bratio[kz] = 0.; |
847 | mode[kz] = 0; |
848 | } |
849 | ipa = 43; |
850 | bratio[0] = 100.; |
851 | mode[0] = 907; |
852 | Gsdk(ipa, bratio, mode); |
853 | /* --- rho0 --- */ |
854 | for (kz = 0; kz < 6; ++kz) { |
855 | bratio[kz] = 0.; |
856 | mode[kz] = 0; |
857 | } |
858 | ipa = 44; |
859 | bratio[0] = 100.; |
860 | mode[0] = 707; |
861 | Gsdk(ipa, bratio, mode); |
862 | /* |
863 | // --- jpsi --- |
864 | for (kz = 0; kz < 6; ++kz) { |
865 | bratio[kz] = 0.; |
866 | mode[kz] = 0; |
867 | } |
868 | ipa = 113; |
869 | bratio[0] = 50.; |
870 | bratio[1] = 50.; |
871 | mode[0] = 506; |
872 | mode[1] = 605; |
873 | Gsdk(ipa, bratio, mode); |
874 | // --- upsilon --- |
875 | ipa = 114; |
876 | Gsdk(ipa, bratio, mode); |
877 | // --- phi --- |
878 | ipa = 115; |
879 | Gsdk(ipa, bratio, mode); |
880 | */ |
881 | |
882 | } |
883 | |
fe4da5cc |
884 | //_____________________________________________________________________________ |
885 | Int_t TGeant3::VolId(Text_t *name) const |
886 | { |
887 | // |
888 | // Return the unique numeric identifier for volume name |
889 | // |
890 | Int_t gname, i; |
891 | strncpy((char *) &gname, name, 4); |
892 | for(i=1; i<=fGcnum->nvolum; i++) |
893 | if(gname == fZiq[fGclink->jvolum+i]) return i; |
894 | printf("VolId: Volume %s not found\n",name); |
895 | return 0; |
896 | } |
897 | |
898 | //_____________________________________________________________________________ |
1f97a957 |
899 | Int_t TGeant3::NofVolumes() const |
fe4da5cc |
900 | { |
901 | // |
902 | // Return total number of volumes in the geometry |
903 | // |
904 | return fGcnum->nvolum; |
905 | } |
906 | |
907 | //_____________________________________________________________________________ |
099385a4 |
908 | const char* TGeant3::VolName(Int_t id) const |
fe4da5cc |
909 | { |
910 | // |
911 | // Return the volume name given the volume identifier |
912 | // |
913 | static char name[5]; |
914 | if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0) |
915 | strcpy(name,"NULL"); |
916 | else |
917 | strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4); |
918 | name[4]='\0'; |
919 | return name; |
920 | } |
921 | |
922 | //_____________________________________________________________________________ |
923 | void TGeant3::TrackPosition(Float_t *xyz) const |
924 | { |
925 | // |
926 | // Return the current position in the master reference frame of the |
927 | // track being transported |
928 | // |
929 | xyz[0]=fGctrak->vect[0]; |
930 | xyz[1]=fGctrak->vect[1]; |
931 | xyz[2]=fGctrak->vect[2]; |
932 | } |
933 | |
934 | //_____________________________________________________________________________ |
935 | Float_t TGeant3::TrackTime() const |
936 | { |
937 | // |
938 | // Return the current time of flight of the track being transported |
939 | // |
940 | return fGctrak->tofg; |
941 | } |
942 | |
943 | //_____________________________________________________________________________ |
944 | void TGeant3::TrackMomentum(Float_t *xyz) const |
945 | { |
946 | // |
947 | // Return the direction and the momentum (GeV/c) of the track |
948 | // currently being transported |
949 | // |
950 | xyz[0]=fGctrak->vect[3]; |
951 | xyz[1]=fGctrak->vect[4]; |
952 | xyz[2]=fGctrak->vect[5]; |
953 | xyz[3]=fGctrak->vect[6]; |
954 | } |
955 | |
956 | //_____________________________________________________________________________ |
957 | Float_t TGeant3::TrackCharge() const |
958 | { |
959 | // |
960 | // Return charge of the track currently transported |
961 | // |
962 | return fGckine->charge; |
963 | } |
964 | |
965 | //_____________________________________________________________________________ |
966 | Float_t TGeant3::TrackMass() const |
967 | { |
968 | // |
969 | // Return the mass of the track currently transported |
970 | // |
971 | return fGckine->amass; |
972 | } |
973 | |
974 | //_____________________________________________________________________________ |
975 | Int_t TGeant3::TrackPid() const |
976 | { |
977 | // |
978 | // Return the id of the particle transported |
979 | // |
980 | return fGckine->ipart; |
981 | } |
982 | |
983 | //_____________________________________________________________________________ |
984 | Float_t TGeant3::TrackStep() const |
985 | { |
986 | // |
987 | // Return the length in centimeters of the current step |
988 | // |
989 | return fGctrak->step; |
990 | } |
991 | |
992 | //_____________________________________________________________________________ |
993 | Float_t TGeant3::TrackLength() const |
994 | { |
995 | // |
996 | // Return the length of the current track from its origin |
997 | // |
998 | return fGctrak->sleng; |
999 | } |
1000 | |
1001 | //_____________________________________________________________________________ |
1002 | Bool_t TGeant3::TrackInside() const |
1003 | { |
1004 | // |
1005 | // True if the track is not at the boundary of the current volume |
1006 | // |
1007 | return (fGctrak->inwvol==0); |
1008 | } |
1009 | |
1010 | //_____________________________________________________________________________ |
1011 | Bool_t TGeant3::TrackEntering() const |
1012 | { |
1013 | // |
1014 | // True if this is the first step of the track in the current volume |
1015 | // |
1016 | return (fGctrak->inwvol==1); |
1017 | } |
1018 | |
1019 | //_____________________________________________________________________________ |
1020 | Bool_t TGeant3::TrackExiting() const |
1021 | { |
1022 | // |
1023 | // True if this is the last step of the track in the current volume |
1024 | // |
1025 | return (fGctrak->inwvol==2); |
1026 | } |
1027 | |
1028 | //_____________________________________________________________________________ |
1029 | Bool_t TGeant3::TrackOut() const |
1030 | { |
1031 | // |
1032 | // True if the track is out of the setup |
1033 | // |
1034 | return (fGctrak->inwvol==3); |
1035 | } |
1036 | |
1037 | //_____________________________________________________________________________ |
1038 | Bool_t TGeant3::TrackStop() const |
1039 | { |
1040 | // |
1041 | // True if the track energy has fallen below the threshold |
1042 | // |
1043 | return (fGctrak->istop==2); |
1044 | } |
1045 | |
1046 | //_____________________________________________________________________________ |
1047 | Int_t TGeant3::NSecondaries() const |
1048 | { |
1049 | // |
1050 | // Number of secondary particles generated in the current step |
1051 | // |
1052 | return fGcking->ngkine; |
1053 | } |
1054 | |
1055 | //_____________________________________________________________________________ |
1056 | Int_t TGeant3::CurrentEvent() const |
1057 | { |
1058 | // |
1059 | // Number of the current event |
1060 | // |
1061 | return fGcflag->idevt; |
1062 | } |
1063 | |
1064 | //_____________________________________________________________________________ |
1065 | void TGeant3::ProdProcess(char* proc) const |
1066 | { |
1067 | // |
1068 | // Name of the process that has produced the secondary particles |
1069 | // in the current step |
1070 | // |
1071 | const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 }; |
1072 | Int_t mec, km, im; |
1073 | // |
1074 | if(fGcking->ngkine>0) { |
1075 | for (km = 0; km < fGctrak->nmec; ++km) { |
1076 | for (im = 0; im < 13; ++im) { |
1077 | if (fGctrak->lmec[km] == ipmec[im]) { |
1078 | mec = fGctrak->lmec[km]; |
1079 | if (0 < mec && mec < 31) { |
1080 | strncpy(proc,(char *)&fGctrak->namec[mec - 1],4); |
1081 | } else if (mec - 100 <= 30 && mec - 100 > 0) { |
1082 | strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4); |
1083 | } |
1084 | proc[4]='\0'; |
1085 | return; |
1086 | } |
1087 | } |
1088 | } |
1089 | strcpy(proc,"UNKN"); |
1090 | } else strcpy(proc,"NONE"); |
1091 | } |
1092 | |
1093 | //_____________________________________________________________________________ |
1094 | void TGeant3::GetSecondary(Int_t isec, Int_t& ipart, Float_t* x, Float_t* p) |
1095 | { |
1096 | // |
1097 | // Get the parameters of the secondary track number isec produced |
1098 | // in the current step |
1099 | // |
1100 | Int_t i; |
1101 | if(-1<isec && isec<fGcking->ngkine) { |
1102 | ipart=Int_t (fGcking->gkin[isec][4] +0.5); |
1103 | for(i=0;i<3;i++) { |
1104 | x[i]=fGckin3->gpos[isec][i]; |
1105 | p[i]=fGcking->gkin[isec][i]; |
1106 | } |
1107 | x[3]=fGcking->tofd[isec]; |
1108 | p[3]=fGcking->gkin[isec][3]; |
1109 | } else { |
1110 | printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec); |
1111 | x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0; |
1112 | ipart=0; |
1113 | } |
1114 | } |
1115 | |
1116 | //_____________________________________________________________________________ |
1117 | void TGeant3::InitLego() |
1118 | { |
1119 | SetSWIT(4,0); |
1120 | SetDEBU(0,0,0); //do not print a message |
1121 | } |
1122 | |
1123 | //_____________________________________________________________________________ |
1124 | Bool_t TGeant3::TrackDisappear() const |
1125 | { |
1126 | // |
1127 | // True if the current particle has disappered |
1128 | // either because it decayed or because it underwent |
1129 | // an inelastic collision |
1130 | // |
1131 | return (fGctrak->istop==1); |
1132 | } |
1133 | |
1134 | //_____________________________________________________________________________ |
1135 | Bool_t TGeant3::TrackAlive() const |
1136 | { |
1137 | // |
1138 | // True if the current particle is alive and will continue to be |
1139 | // transported |
1140 | // |
1141 | return (fGctrak->istop==0); |
1142 | } |
1143 | |
1144 | //_____________________________________________________________________________ |
1145 | void TGeant3::StopTrack() |
1146 | { |
1147 | // |
1148 | // Stop the transport of the current particle and skip to the next |
1149 | // |
1150 | fGctrak->istop=1; |
1151 | } |
1152 | |
1153 | //_____________________________________________________________________________ |
1154 | void TGeant3::StopEvent() |
1155 | { |
1156 | // |
1157 | // Stop simulation of the current event and skip to the next |
1158 | // |
1159 | fGcflag->ieotri=1; |
1160 | } |
1161 | |
1162 | //_____________________________________________________________________________ |
1163 | Float_t TGeant3::MaxStep() const |
1164 | { |
1165 | // |
1166 | // Return the maximum step length in the current medium |
1167 | // |
1168 | return fGctmed->stemax; |
1169 | } |
1170 | |
1171 | //_____________________________________________________________________________ |
1172 | void TGeant3::SetColors() |
1173 | { |
1174 | // |
1175 | // Set the colors for all the volumes |
1176 | // this is done sequentially for all volumes |
1177 | // based on the number of their medium |
1178 | // |
1179 | Int_t kv, icol; |
1180 | Int_t jvolum=fGclink->jvolum; |
1181 | //Int_t jtmed=fGclink->jtmed; |
1182 | //Int_t jmate=fGclink->jmate; |
1183 | Int_t nvolum=fGcnum->nvolum; |
1184 | char name[5]; |
1185 | // |
1186 | // Now for all the volumes |
1187 | for(kv=1;kv<=nvolum;kv++) { |
1188 | // Get the tracking medium |
1189 | Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]); |
1190 | // Get the material |
1191 | //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]); |
1192 | // Get z |
1193 | //Float_t z=fZq[fZlq[jmate-ima]+7]; |
1194 | // Find color number |
1195 | //icol = Int_t(z)%6+2; |
1196 | //icol = 17+Int_t(z*150./92.); |
1197 | //icol = kv%6+2; |
1198 | icol = itm%6+2; |
1199 | strncpy(name,(char*)&fZiq[jvolum+kv],4); |
1200 | name[4]='\0'; |
1201 | Gsatt(name,"COLO",icol); |
1202 | } |
1203 | } |
1204 | |
1205 | //_____________________________________________________________________________ |
1206 | void TGeant3::SetMaxStep(Float_t maxstep) |
1207 | { |
1208 | // |
1209 | // Set the maximum step allowed till the particle is in the current medium |
1210 | // |
1211 | fGctmed->stemax=maxstep; |
1212 | } |
1213 | |
1214 | //_____________________________________________________________________________ |
1215 | void TGeant3::SetMaxNStep(Int_t maxnstp) |
1216 | { |
1217 | // |
1218 | // Set the maximum number of steps till the particle is in the current medium |
1219 | // |
1220 | fGctrak->maxnst=maxnstp; |
1221 | } |
1222 | |
1223 | //_____________________________________________________________________________ |
1224 | Int_t TGeant3::GetMaxNStep() const |
1225 | { |
1226 | // |
1227 | // Maximum number of steps allowed in current medium |
1228 | // |
1229 | return fGctrak->maxnst; |
1230 | } |
1231 | |
1232 | //_____________________________________________________________________________ |
1233 | void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z, |
1234 | Float_t dens, Float_t radl, Float_t absl, Float_t* buf, |
1235 | Int_t nwbuf) |
1236 | { |
1237 | // |
1238 | // Defines a Material |
1239 | // |
1240 | // kmat number assigned to the material |
1241 | // name material name |
1242 | // a atomic mass in au |
1243 | // z atomic number |
1244 | // dens density in g/cm3 |
1245 | // absl absorbtion length in cm |
1246 | // if >=0 it is ignored and the program |
1247 | // calculates it, if <0. -absl is taken |
1248 | // radl radiation length in cm |
1249 | // if >=0 it is ignored and the program |
1250 | // calculates it, if <0. -radl is taken |
1251 | // buf pointer to an array of user words |
1252 | // nbuf number of user words |
1253 | // |
1254 | Int_t jmate=fGclink->jmate; |
1255 | kmat=1; |
1256 | Int_t ns, i; |
1257 | if(jmate>0) { |
1258 | ns=fZiq[jmate-2]; |
1259 | kmat=ns+1; |
1260 | for(i=1; i<=ns; i++) { |
1261 | if(fZlq[jmate-i]==0) { |
1262 | kmat=i; |
1263 | break; |
1264 | } |
1265 | } |
1266 | } |
1267 | gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf, |
1268 | nwbuf PASSCHARL(name)); |
1269 | } |
1270 | |
1271 | //_____________________________________________________________________________ |
1272 | void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z, |
1273 | Float_t dens, Int_t nlmat, Float_t* wmat) |
1274 | { |
1275 | // |
1276 | // Defines mixture OR COMPOUND IMAT as composed by |
1277 | // THE BASIC NLMAT materials defined by arrays A,Z and WMAT |
1278 | // |
1279 | // If NLMAT > 0 then wmat contains the proportion by |
1280 | // weights of each basic material in the mixture. |
1281 | // |
1282 | // If nlmat < 0 then WMAT contains the number of atoms |
1283 | // of a given kind into the molecule of the COMPOUND |
1284 | // In this case, WMAT in output is changed to relative |
1285 | // weigths. |
1286 | // |
1287 | Int_t jmate=fGclink->jmate; |
1288 | kmat=1; |
1289 | Int_t ns, i; |
1290 | if(jmate>0) { |
1291 | ns=fZiq[jmate-2]; |
1292 | kmat=ns+1; |
1293 | for(i=1; i<=ns; i++) { |
1294 | if(fZlq[jmate-i]==0) { |
1295 | kmat=i; |
1296 | break; |
1297 | } |
1298 | } |
1299 | } |
1300 | gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name)); |
1301 | } |
1302 | |
1303 | //_____________________________________________________________________________ |
1304 | void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol, |
1305 | Int_t ifield, Float_t fieldm, Float_t tmaxfd, |
1306 | Float_t stemax, Float_t deemax, Float_t epsil, |
1307 | Float_t stmin, Float_t* ubuf, Int_t nbuf) |
1308 | { |
1309 | // |
1310 | // kmed tracking medium number assigned |
1311 | // name tracking medium name |
1312 | // nmat material number |
1313 | // isvol sensitive volume flag |
1314 | // ifield magnetic field |
1315 | // fieldm max. field value (kilogauss) |
1316 | // tmaxfd max. angle due to field (deg/step) |
1317 | // stemax max. step allowed |
1318 | // deemax max. fraction of energy lost in a step |
1319 | // epsil tracking precision (cm) |
1320 | // stmin min. step due to continuos processes (cm) |
1321 | // |
1322 | // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim; |
1323 | // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking |
1324 | // performed with ghelix; ifield = 3 if tracking performed with ghelx3. |
1325 | // |
1326 | Int_t jtmed=fGclink->jtmed; |
1327 | kmed=1; |
1328 | Int_t ns, i; |
1329 | if(jtmed>0) { |
1330 | ns=fZiq[jtmed-2]; |
1331 | kmed=ns+1; |
1332 | for(i=1; i<=ns; i++) { |
1333 | if(fZlq[jtmed-i]==0) { |
1334 | kmed=i; |
1335 | break; |
1336 | } |
1337 | } |
1338 | } |
1339 | gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax, |
1340 | deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name)); |
1341 | } |
1342 | |
1343 | //_____________________________________________________________________________ |
1344 | void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they, |
1345 | Float_t phiy, Float_t thez, Float_t phiz) |
1346 | { |
1347 | // |
1348 | // krot rotation matrix number assigned |
1349 | // theta1 polar angle for axis i |
1350 | // phi1 azimuthal angle for axis i |
1351 | // theta2 polar angle for axis ii |
1352 | // phi2 azimuthal angle for axis ii |
1353 | // theta3 polar angle for axis iii |
1354 | // phi3 azimuthal angle for axis iii |
1355 | // |
1356 | // it defines the rotation matrix number irot. |
1357 | // |
1358 | Int_t jrotm=fGclink->jrotm; |
1359 | krot=1; |
1360 | Int_t ns, i; |
1361 | if(jrotm>0) { |
1362 | ns=fZiq[jrotm-2]; |
1363 | krot=ns+1; |
1364 | for(i=1; i<=ns; i++) { |
1365 | if(fZlq[jrotm-i]==0) { |
1366 | krot=i; |
1367 | break; |
1368 | } |
1369 | } |
1370 | } |
1371 | gsrotm(krot, thex, phix, they, phiy, thez, phiz); |
1372 | } |
1373 | |
1374 | //_____________________________________________________________________________ |
1578254f |
1375 | void TGeant3::GetParticle(const Int_t pdg, char *name, Float_t &mass) const |
fe4da5cc |
1376 | { |
1578254f |
1377 | Int_t ipart = IdFromPDG(pdg); |
1378 | if(ipart<0) { |
1379 | printf("Particle %d not in geant\n",pdg); |
1380 | name=new char[7]; |
1381 | strcpy(name,"Unknown"); |
1382 | mass=-1; |
1383 | return; |
1384 | } |
fe4da5cc |
1385 | // |
1386 | // Return name and mass of particle code ipart |
1387 | // Geant321 conventions |
1388 | // |
1389 | Int_t hname[6]; |
1390 | Int_t jpart=fGclink->jpart; |
1391 | Int_t jpa=fZlq[jpart-ipart]; |
1392 | // |
1393 | for(Int_t i=1; i<6; i++) hname[i-1]=fZiq[jpa+i]; |
1394 | hname[5]=0; |
1395 | strncpy(name,(char *)hname, 21); |
1396 | mass=fZq[jpa+7]; |
1397 | } |
1398 | |
1399 | //_____________________________________________________________________________ |
1400 | Int_t TGeant3::GetMedium() const |
1401 | { |
1402 | // |
1403 | // Return the number of the current medium |
1404 | // |
1405 | return fGctmed->numed; |
1406 | } |
1407 | |
1408 | //_____________________________________________________________________________ |
1409 | Float_t TGeant3::Edep() const |
1410 | { |
1411 | // |
1412 | // Return the energy lost in the current step |
1413 | // |
1414 | return fGctrak->destep; |
1415 | } |
1416 | |
1417 | //_____________________________________________________________________________ |
1418 | Float_t TGeant3::Etot() const |
1419 | { |
1420 | // |
1421 | // Return the total energy of the current track |
1422 | // |
1423 | return fGctrak->getot; |
1424 | } |
1425 | |
1426 | //_____________________________________________________________________________ |
1427 | void TGeant3::Rndm(Float_t* r, const Int_t n) const |
1428 | { |
1429 | // |
1430 | // Return an array of n random numbers uniformly distributed |
1431 | // between 0 and 1 not included |
1432 | // |
1433 | Grndm(r,n); |
1434 | } |
1435 | |
1436 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1437 | // |
1438 | // Functions from GBASE |
1439 | // |
1440 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1441 | |
1442 | //____________________________________________________________________________ |
1443 | void TGeant3::Gfile(const char *filename, const char *option) |
1444 | { |
1445 | // |
1446 | // Routine to open a GEANT/RZ data base. |
1447 | // |
1448 | // LUN logical unit number associated to the file |
1449 | // |
1450 | // CHFILE RZ file name |
1451 | // |
1452 | // CHOPT is a character string which may be |
1453 | // N To create a new file |
1454 | // U to open an existing file for update |
1455 | // " " to open an existing file for read only |
1456 | // Q The initial allocation (default 1000 records) |
1457 | // is given in IQUEST(10) |
1458 | // X Open the file in exchange format |
1459 | // I Read all data structures from file to memory |
1460 | // O Write all data structures from memory to file |
1461 | // |
1462 | // Note: |
1463 | // If options "I" or "O" all data structures are read or |
1464 | // written from/to file and the file is closed. |
1465 | // See routine GRMDIR to create subdirectories |
1466 | // See routines GROUT,GRIN to write,read objects |
1467 | // |
1468 | grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename) |
1469 | PASSCHARL(option)); |
1470 | } |
1471 | |
1472 | //____________________________________________________________________________ |
1473 | void TGeant3::Gpcxyz() |
1474 | { |
1475 | // |
1476 | // Print track and volume parameters at current point |
1477 | // |
1478 | gpcxyz(); |
1479 | } |
1480 | |
1481 | //_____________________________________________________________________________ |
1482 | void TGeant3::Ggclos() |
1483 | { |
1484 | // |
1485 | // Closes off the geometry setting. |
1486 | // Initializes the search list for the contents of each |
1487 | // volume following the order they have been positioned, and |
1488 | // inserting the content '0' when a call to GSNEXT (-1) has |
1489 | // been required by the user. |
1490 | // Performs the development of the JVOLUM structure for all |
1491 | // volumes with variable parameters, by calling GGDVLP. |
1492 | // Interprets the user calls to GSORD, through GGORD. |
1493 | // Computes and stores in a bank (next to JVOLUM mother bank) |
1494 | // the number of levels in the geometrical tree and the |
1495 | // maximum number of contents per level, by calling GGNLEV. |
1496 | // Sets status bit for CONCAVE volumes, through GGCAVE. |
1497 | // Completes the JSET structure with the list of volume names |
1498 | // which identify uniquely a given physical detector, the |
1499 | // list of bit numbers to pack the corresponding volume copy |
1500 | // numbers, and the generic path(s) in the JVOLUM tree, |
1501 | // through the routine GHCLOS. |
1502 | // |
1503 | ggclos(); |
1504 | } |
1505 | |
1506 | //_____________________________________________________________________________ |
1507 | void TGeant3::Glast() |
1508 | { |
1509 | // |
1510 | // Finish a Geant run |
1511 | // |
1512 | glast(); |
1513 | } |
1514 | |
1515 | //_____________________________________________________________________________ |
1516 | void TGeant3::Gprint(const char *name) |
1517 | { |
1518 | // |
1519 | // Routine to print data structures |
1520 | // CHNAME name of a data structure |
1521 | // |
1522 | char vname[5]; |
1523 | Vname(name,vname); |
1524 | gprint(PASSCHARD(vname),0 PASSCHARL(vname)); |
1525 | } |
1526 | |
1527 | //_____________________________________________________________________________ |
1528 | void TGeant3::Grun() |
1529 | { |
1530 | // |
1531 | // Steering function to process one run |
1532 | // |
1533 | grun(); |
1534 | } |
1535 | |
1536 | //_____________________________________________________________________________ |
1537 | void TGeant3::Gtrig() |
1538 | { |
1539 | // |
1540 | // Steering function to process one event |
1541 | // |
1542 | gtrig(); |
1543 | } |
1544 | |
1545 | //_____________________________________________________________________________ |
1546 | void TGeant3::Gtrigc() |
1547 | { |
1548 | // |
1549 | // Clear event partition |
1550 | // |
1551 | gtrigc(); |
1552 | } |
1553 | |
1554 | //_____________________________________________________________________________ |
1555 | void TGeant3::Gtrigi() |
1556 | { |
1557 | // |
1558 | // Initialises event partition |
1559 | // |
1560 | gtrigi(); |
1561 | } |
1562 | |
1563 | //_____________________________________________________________________________ |
1564 | void TGeant3::Gwork(Int_t nwork) |
1565 | { |
1566 | // |
1567 | // Allocates workspace in ZEBRA memory |
1568 | // |
1569 | gwork(nwork); |
1570 | } |
1571 | |
1572 | //_____________________________________________________________________________ |
1573 | void TGeant3::Gzinit() |
1574 | { |
1575 | // |
1576 | // To initialise GEANT/ZEBRA data structures |
1577 | // |
1578 | gzinit(); |
1579 | } |
1580 | |
1581 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1582 | // |
1583 | // Functions from GCONS |
1584 | // |
1585 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1586 | |
1587 | //_____________________________________________________________________________ |
1588 | void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, |
1589 | Float_t &dens, Float_t &radl, Float_t &absl, |
1590 | Float_t* ubuf, Int_t& nbuf) |
1591 | { |
1592 | // |
1593 | // Return parameters for material IMAT |
1594 | // |
1595 | gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf |
1596 | PASSCHARL(name)); |
1597 | } |
1598 | |
1599 | //_____________________________________________________________________________ |
1600 | void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp, |
1601 | Float_t &amass, Float_t &charge, Float_t &tlife) |
1602 | { |
1603 | // |
1604 | // Return parameters for particle of type IPART |
1605 | // |
1606 | Float_t *ubuf=0; |
1607 | Int_t nbuf; |
1608 | gfpart(ipart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf |
1609 | PASSCHARL(name)); |
1610 | } |
1611 | |
1612 | //_____________________________________________________________________________ |
1613 | void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol, |
1614 | Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd, |
1615 | Float_t &stemax, Float_t &deemax, Float_t &epsil, |
1616 | Float_t &stmin, Float_t *ubuf, Int_t *nbuf) |
1617 | { |
1618 | // |
1619 | // Return parameters for tracking medium NUMED |
1620 | // |
1621 | gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax, |
1622 | deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name)); |
1623 | } |
1624 | |
1625 | //_____________________________________________________________________________ |
1626 | void TGeant3::Gmate() |
1627 | { |
1628 | // |
1629 | // Define standard GEANT materials |
1630 | // |
1631 | gmate(); |
1632 | } |
1633 | |
1634 | //_____________________________________________________________________________ |
1635 | void TGeant3::Gpart() |
1636 | { |
1637 | // |
1638 | // Define standard GEANT particles plus selected decay modes |
1639 | // and branching ratios. |
1640 | // |
1641 | gpart(); |
1642 | } |
1643 | |
1644 | //_____________________________________________________________________________ |
1645 | void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode) |
1646 | { |
1647 | // Defines branching ratios and decay modes for standard |
1648 | // GEANT particles. |
1649 | gsdk(ipart,bratio,mode); |
1650 | } |
1651 | |
1652 | //_____________________________________________________________________________ |
1653 | void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z, |
1654 | Float_t dens, Float_t radl, Float_t absl) |
1655 | { |
1656 | // |
1657 | // Defines a Material |
1658 | // |
1659 | // kmat number assigned to the material |
1660 | // name material name |
1661 | // a atomic mass in au |
1662 | // z atomic number |
1663 | // dens density in g/cm3 |
1664 | // absl absorbtion length in cm |
1665 | // if >=0 it is ignored and the program |
1666 | // calculates it, if <0. -absl is taken |
1667 | // radl radiation length in cm |
1668 | // if >=0 it is ignored and the program |
1669 | // calculates it, if <0. -radl is taken |
1670 | // buf pointer to an array of user words |
1671 | // nbuf number of user words |
1672 | // |
1673 | Float_t *ubuf=0; |
1674 | Int_t nbuf=0; |
1675 | gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf |
1676 | PASSCHARL(name)); |
1677 | } |
1678 | |
1679 | //_____________________________________________________________________________ |
1680 | void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z, |
1681 | Float_t dens, Int_t nlmat, Float_t *wmat) |
1682 | { |
1683 | // |
1684 | // Defines mixture OR COMPOUND IMAT as composed by |
1685 | // THE BASIC NLMAT materials defined by arrays A,Z and WMAT |
1686 | // |
1687 | // If NLMAT.GT.0 then WMAT contains the PROPORTION BY |
1688 | // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE. |
1689 | // |
1690 | // If NLMAT.LT.0 then WMAT contains the number of atoms |
1691 | // of a given kind into the molecule of the COMPOUND |
1692 | // In this case, WMAT in output is changed to relative |
1693 | // weigths. |
1694 | // |
1695 | gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name)); |
1696 | } |
1697 | |
1698 | //_____________________________________________________________________________ |
1699 | void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp, |
1700 | Float_t amass, Float_t charge, Float_t tlife) |
1701 | { |
1702 | // |
1703 | // Store particle parameters |
1704 | // |
1705 | // ipart particle code |
1706 | // name particle name |
1707 | // itrtyp transport method (see GEANT manual) |
1708 | // amass mass in GeV/c2 |
1709 | // charge charge in electron units |
1710 | // tlife lifetime in seconds |
1711 | // |
1712 | Float_t *ubuf=0; |
1713 | Int_t nbuf=0; |
1714 | gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf |
1715 | PASSCHARL(name)); |
1716 | } |
1717 | |
1718 | //_____________________________________________________________________________ |
1719 | void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol, |
1720 | Int_t ifield, Float_t fieldm, Float_t tmaxfd, |
1721 | Float_t stemax, Float_t deemax, Float_t epsil, |
1722 | Float_t stmin) |
1723 | { |
1724 | // |
1725 | // NTMED Tracking medium number |
1726 | // NAME Tracking medium name |
1727 | // NMAT Material number |
1728 | // ISVOL Sensitive volume flag |
1729 | // IFIELD Magnetic field |
1730 | // FIELDM Max. field value (Kilogauss) |
1731 | // TMAXFD Max. angle due to field (deg/step) |
1732 | // STEMAX Max. step allowed |
1733 | // DEEMAX Max. fraction of energy lost in a step |
1734 | // EPSIL Tracking precision (cm) |
1735 | // STMIN Min. step due to continuos processes (cm) |
1736 | // |
1737 | // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM; |
1738 | // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking |
1739 | // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3. |
1740 | // |
1741 | Float_t *ubuf=0; |
1742 | Int_t nbuf=0; |
1743 | gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax, |
1744 | deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name)); |
1745 | } |
1746 | |
1747 | //_____________________________________________________________________________ |
1748 | void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov, |
1749 | Float_t *absco, Float_t *effic, Float_t *rindex) |
1750 | { |
1751 | // |
1752 | // Stores the tables for UV photon tracking in medium ITMED |
1753 | // Please note that it is the user's responsability to |
1754 | // provide all the coefficients: |
1755 | // |
1756 | // |
1757 | // ITMED Tracking medium number |
1758 | // NPCKOV Number of bins of each table |
1759 | // PPCKOV Value of photon momentum (in GeV) |
1760 | // ABSCO Absorbtion coefficients |
1761 | // dielectric: absorbtion length in cm |
1762 | // metals : absorbtion fraction (0<=x<=1) |
1763 | // EFFIC Detection efficiency for UV photons |
1764 | // RINDEX Refraction index (if=0 metal) |
1765 | // |
1766 | gsckov(itmed,npckov,ppckov,absco,effic,rindex); |
1767 | } |
1768 | |
1769 | //_____________________________________________________________________________ |
1770 | void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval) |
1771 | { |
1772 | // |
1773 | // To change the value of cut or mechanism "CHPAR" |
1774 | // to a new value PARVAL for tracking medium ITMED |
1775 | // The data structure JTMED contains the standard tracking |
1776 | // parameters (CUTS and flags to control the physics processes) which |
1777 | // are used by default for all tracking media. It is possible to |
1778 | // redefine individually with GSTPAR any of these parameters for a |
1779 | // given tracking medium. |
1780 | // ITMED tracking medium number |
1781 | // CHPAR is a character string (variable name) |
1782 | // PARVAL must be given as a floating point. |
1783 | // |
1784 | gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param)); |
1785 | } |
1786 | |
1787 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1788 | // |
1789 | // Functions from GCONS |
1790 | // |
1791 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1792 | |
1793 | //_____________________________________________________________________________ |
1794 | void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart, |
1795 | Int_t &nvert) |
1796 | { |
1797 | // Storing/Retrieving Vertex and Track parameters |
1798 | // ---------------------------------------------- |
1799 | // |
1800 | // Stores vertex parameters. |
1801 | // VERT array of (x,y,z) position of the vertex |
1802 | // NTBEAM beam track number origin of the vertex |
1803 | // =0 if none exists |
1804 | // NTTARG target track number origin of the vertex |
1805 | // UBUF user array of NUBUF floating point numbers |
1806 | // NUBUF |
1807 | // NVTX new vertex number (=0 in case of error). |
1808 | // Prints vertex parameters. |
1809 | // IVTX for vertex IVTX. |
1810 | // (For all vertices if IVTX=0) |
1811 | // Stores long life track parameters. |
1812 | // PLAB components of momentum |
1813 | // IPART type of particle (see GSPART) |
1814 | // NV vertex number origin of track |
1815 | // UBUF array of NUBUF floating point user parameters |
1816 | // NUBUF |
1817 | // NT track number (if=0 error). |
1818 | // Retrieves long life track parameters. |
1819 | // ITRA track number for which parameters are requested |
1820 | // VERT vector origin of the track |
1821 | // PVERT 4 momentum components at the track origin |
1822 | // IPART particle type (=0 if track ITRA does not exist) |
1823 | // NVERT vertex number origin of the track |
1824 | // UBUF user words stored in GSKINE. |
1825 | // Prints initial track parameters. |
1826 | // ITRA for track ITRA |
1827 | // (For all tracks if ITRA=0) |
1828 | // |
1829 | Float_t *ubuf=0; |
1830 | Int_t nbuf; |
1831 | gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf); |
1832 | } |
1833 | |
1834 | //_____________________________________________________________________________ |
1835 | void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg, |
1836 | Float_t &tofg) |
1837 | { |
1838 | // |
1839 | // Retrieves the parameter of a vertex bank |
1840 | // Vertex is generated from tracks NTBEAM NTTARG |
1841 | // NVTX is the new vertex number |
1842 | // |
1843 | Float_t *ubuf=0; |
1844 | Int_t nbuf; |
1845 | gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf); |
1846 | } |
1847 | |
1848 | //_____________________________________________________________________________ |
1849 | Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf, |
1850 | Int_t nwbuf) |
1851 | { |
1852 | // |
1853 | // Store kinematics of track NT into data structure |
1854 | // Track is coming from vertex NV |
1855 | // |
1856 | Int_t nt = 0; |
1857 | gskine(plab, ipart, nv, buf, nwbuf, nt); |
1858 | return nt; |
1859 | } |
1860 | |
1861 | //_____________________________________________________________________________ |
1862 | Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf, |
1863 | Int_t nwbuf) |
1864 | { |
1865 | // |
1866 | // Creates a new vertex bank |
1867 | // Vertex is generated from tracks NTBEAM NTTARG |
1868 | // NVTX is the new vertex number |
1869 | // |
1870 | Int_t nwtx = 0; |
1871 | gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx); |
1872 | return nwtx; |
1873 | } |
1874 | |
1875 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1876 | // |
1877 | // Functions from GPHYS |
1878 | // |
1879 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1880 | |
1881 | //_____________________________________________________________________________ |
1882 | void TGeant3::Gphysi() |
1883 | { |
1884 | // |
1885 | // Initialise material constants for all the physics |
1886 | // mechanisms used by GEANT |
1887 | // |
1888 | gphysi(); |
1889 | } |
1890 | |
1891 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1892 | // |
1893 | // Functions from GTRAK |
1894 | // |
1895 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
1896 | |
1897 | //_____________________________________________________________________________ |
1898 | void TGeant3::Gdebug() |
1899 | { |
1900 | // |
1901 | // Debug the current step |
1902 | // |
1903 | gdebug(); |
1904 | } |
1905 | |
1906 | //_____________________________________________________________________________ |
1907 | void TGeant3::Gekbin() |
1908 | { |
1909 | // |
1910 | // To find bin number in kinetic energy table |
1911 | // stored in ELOW(NEKBIN) |
1912 | // |
1913 | gekbin(); |
1914 | } |
1915 | |
1916 | //_____________________________________________________________________________ |
1917 | void TGeant3::Gfinds() |
1918 | { |
1919 | // |
1920 | // Returns the set/volume parameters corresponding to |
1921 | // the current space point in /GCTRAK/ |
1922 | // and fill common /GCSETS/ |
1923 | // |
1924 | // IHSET user set identifier |
1925 | // IHDET user detector identifier |
1926 | // ISET set number in JSET |
1927 | // IDET detector number in JS=LQ(JSET-ISET) |
1928 | // IDTYPE detector type (1,2) |
1929 | // NUMBV detector volume numbers (array of length NVNAME) |
1930 | // NVNAME number of volume levels |
1931 | // |
1932 | gfinds(); |
1933 | } |
1934 | |
1935 | //_____________________________________________________________________________ |
1936 | void TGeant3::Gsking(Int_t igk) |
1937 | { |
1938 | // |
1939 | // Stores in stack JSTAK either the IGKth track of /GCKING/, |
1940 | // or the NGKINE tracks when IGK is 0. |
1941 | // |
1942 | gsking(igk); |
1943 | } |
1944 | |
1945 | //_____________________________________________________________________________ |
1946 | void TGeant3::Gskpho(Int_t igk) |
1947 | { |
1948 | // |
1949 | // Stores in stack JSTAK either the IGKth Cherenkov photon of |
1950 | // /GCKIN2/, or the NPHOT tracks when IGK is 0. |
1951 | // |
1952 | gskpho(igk); |
1953 | } |
1954 | |
1955 | //_____________________________________________________________________________ |
1956 | void TGeant3::Gsstak(Int_t iflag) |
1957 | { |
1958 | // |
1959 | // Stores in auxiliary stack JSTAK the particle currently |
1960 | // described in common /GCKINE/. |
1961 | // |
1962 | // On request, creates also an entry in structure JKINE : |
1963 | // IFLAG = |
1964 | // 0 : No entry in JKINE structure required (user) |
1965 | // 1 : New entry in JVERTX / JKINE structures required (user) |
1966 | // <0 : New entry in JKINE structure at vertex -IFLAG (user) |
1967 | // 2 : Entry in JKINE structure exists already (from GTREVE) |
1968 | // |
1969 | gsstak(iflag); |
1970 | } |
1971 | |
1972 | //_____________________________________________________________________________ |
1973 | void TGeant3::Gsxyz() |
1974 | { |
1975 | // |
1976 | // Store space point VECT in banks JXYZ |
1977 | // |
1978 | gsxyz(); |
1979 | } |
1980 | |
1981 | //_____________________________________________________________________________ |
1982 | void TGeant3::Gtrack() |
1983 | { |
1984 | // |
1985 | // Controls tracking of current particle |
1986 | // |
1987 | gtrack(); |
1988 | } |
1989 | |
1990 | //_____________________________________________________________________________ |
1991 | void TGeant3::Gtreve() |
1992 | { |
1993 | // |
1994 | // Controls tracking of all particles belonging to the current event |
1995 | // |
1996 | gtreve(); |
1997 | } |
1998 | |
1578254f |
1999 | //_____________________________________________________________________________ |
2000 | void TGeant3::Gtreve_root() |
2001 | { |
2002 | // |
2003 | // Controls tracking of all particles belonging to the current event |
2004 | // |
2005 | gtreve_root(); |
2006 | } |
2007 | |
fe4da5cc |
2008 | //_____________________________________________________________________________ |
2009 | void TGeant3::Grndm(Float_t *rvec, const Int_t len) const |
2010 | { |
2011 | // |
2012 | // To generate a vector RVECV of LEN random numbers |
2013 | // Copy of the CERN Library routine RANECU |
2014 | grndm(rvec,len); |
2015 | } |
2016 | |
2017 | //_____________________________________________________________________________ |
2018 | void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq, |
2019 | const Text_t *chopt) |
2020 | { |
2021 | // |
2022 | // To set/retrieve the seed of the random number generator |
2023 | // |
2024 | grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt)); |
2025 | } |
2026 | |
2027 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2028 | // |
2029 | // Functions from GDRAW |
2030 | // |
2031 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2032 | |
2033 | //_____________________________________________________________________________ |
2034 | void TGeant3::Gdxyz(Int_t it) |
2035 | { |
2036 | // |
2037 | // Draw the points stored with Gsxyz relative to track it |
2038 | // |
2039 | gdxyz(it); |
2040 | } |
2041 | |
2042 | //_____________________________________________________________________________ |
2043 | void TGeant3::Gdcxyz() |
2044 | { |
2045 | // |
2046 | // Draw the position of the current track |
2047 | // |
2048 | gdcxyz(); |
2049 | } |
2050 | |
2051 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2052 | // |
2053 | // Functions from GGEOM |
2054 | // |
2055 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2056 | |
2057 | //_____________________________________________________________________________ |
2058 | void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag) |
2059 | { |
2060 | // |
2061 | // Computes coordinates XM (Master Reference System |
2062 | // knowing the coordinates XD (Detector Ref System) |
2063 | // The local reference system can be initialized by |
2064 | // - the tracking routines and GDTOM used in GUSTEP |
2065 | // - a call to GSCMED(NLEVEL,NAMES,NUMBER) |
2066 | // (inverse routine is GMTOD) |
2067 | // |
2068 | // If IFLAG=1 convert coordinates |
2069 | // IFLAG=2 convert direction cosinus |
2070 | // |
2071 | gdtom(xd, xm, iflag); |
2072 | } |
2073 | |
2074 | //_____________________________________________________________________________ |
2075 | void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols, |
2076 | Int_t *lindx) |
2077 | { |
2078 | // |
2079 | // Loads the top part of the Volume tree in LVOLS (IVO's), |
2080 | // LINDX (IN indices) for a given volume defined through |
2081 | // its name IUDET and number IUNUM. |
2082 | // |
2083 | // The routine stores only upto the last level where JVOLUM |
2084 | // data structure is developed. If there is no development |
2085 | // above the current level, it returns NLEV zero. |
2086 | Int_t *idum=0; |
2087 | glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet)); |
2088 | } |
2089 | |
2090 | //_____________________________________________________________________________ |
2091 | void TGeant3::Gmedia(Float_t *x, Int_t &numed) |
2092 | { |
2093 | // |
2094 | // Finds in which volume/medium the point X is, and updates the |
2095 | // common /GCVOLU/ and the structure JGPAR accordingly. |
2096 | // |
2097 | // NUMED returns the tracking medium number, or 0 if point is |
2098 | // outside the experimental setup. |
2099 | // |
2100 | gmedia(x,numed); |
2101 | } |
2102 | |
2103 | //_____________________________________________________________________________ |
2104 | void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag) |
2105 | { |
2106 | // |
2107 | // Computes coordinates XD (in DRS) |
2108 | // from known coordinates XM in MRS |
2109 | // The local reference system can be initialized by |
2110 | // - the tracking routines and GMTOD used in GUSTEP |
2111 | // - a call to GMEDIA(XM,NUMED) |
2112 | // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER) |
2113 | // (inverse routine is GDTOM) |
2114 | // |
2115 | // If IFLAG=1 convert coordinates |
2116 | // IFLAG=2 convert direction cosinus |
2117 | // |
2118 | gmtod(xm, xd, iflag); |
2119 | } |
2120 | |
2121 | //_____________________________________________________________________________ |
2122 | void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv, |
2123 | Int_t iaxis) |
2124 | { |
2125 | // |
2126 | // Create a new volume by dividing an existing one |
2127 | // |
2128 | // NAME Volume name |
2129 | // MOTHER Mother volume name |
2130 | // NDIV Number of divisions |
2131 | // IAXIS Axis value |
2132 | // |
2133 | // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS. |
2134 | // It divides a previously defined volume. |
2135 | // |
2136 | char vname[5]; |
2137 | Vname(name,vname); |
2138 | char vmother[5]; |
2139 | Vname(mother,vmother); |
2140 | gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname) |
2141 | PASSCHARL(vmother)); |
2142 | } |
2143 | |
2144 | //_____________________________________________________________________________ |
2145 | void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv, |
2146 | Int_t iaxis, Float_t c0i, Int_t numed) |
2147 | { |
2148 | // |
2149 | // Create a new volume by dividing an existing one |
2150 | // |
2151 | // Divides mother into ndiv divisions called name |
2152 | // along axis iaxis starting at coordinate value c0. |
2153 | // the new volume created will be medium number numed. |
2154 | // |
2155 | char vname[5]; |
2156 | Vname(name,vname); |
2157 | char vmother[5]; |
2158 | Vname(mother,vmother); |
2159 | gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed |
2160 | PASSCHARL(vname) PASSCHARL(vmother)); |
2161 | } |
2162 | |
2163 | //_____________________________________________________________________________ |
2164 | void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step, |
2165 | Int_t iaxis, Int_t numed) |
2166 | { |
2167 | // |
2168 | // Create a new volume by dividing an existing one |
2169 | // |
2170 | char vname[5]; |
2171 | Vname(name,vname); |
2172 | char vmother[5]; |
2173 | Vname(mother,vmother); |
2174 | gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed |
2175 | PASSCHARL(vname) PASSCHARL(vmother)); |
2176 | } |
2177 | |
2178 | //_____________________________________________________________________________ |
2179 | void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step, |
2180 | Int_t iaxis, Float_t c0, Int_t numed) |
2181 | { |
2182 | // |
2183 | // Create a new volume by dividing an existing one |
2184 | // |
2185 | char vname[5]; |
2186 | Vname(name,vname); |
2187 | char vmother[5]; |
2188 | Vname(mother,vmother); |
2189 | gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed |
2190 | PASSCHARL(vname) PASSCHARL(vmother)); |
2191 | } |
2192 | |
2193 | //_____________________________________________________________________________ |
2194 | void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step, |
2195 | Int_t iaxis, Int_t numed, Int_t ndvmx) |
2196 | { |
2197 | // |
2198 | // Create a new volume by dividing an existing one |
2199 | // |
2200 | // Divides MOTHER into divisions called NAME along |
2201 | // axis IAXIS in steps of STEP. If not exactly divisible |
2202 | // will make as many as possible and will centre them |
2203 | // with respect to the mother. Divisions will have medium |
2204 | // number NUMED. If NUMED is 0, NUMED of MOTHER is taken. |
2205 | // NDVMX is the expected maximum number of divisions |
2206 | // (If 0, no protection tests are performed) |
2207 | // |
2208 | char vname[5]; |
2209 | Vname(name,vname); |
2210 | char vmother[5]; |
2211 | Vname(mother,vmother); |
2212 | gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx |
2213 | PASSCHARL(vname) PASSCHARL(vmother)); |
2214 | } |
2215 | |
2216 | //_____________________________________________________________________________ |
2217 | void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step, |
2218 | Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) |
2219 | { |
2220 | // |
2221 | // Create a new volume by dividing an existing one |
2222 | // |
2223 | // Divides MOTHER into divisions called NAME along |
2224 | // axis IAXIS starting at coordinate value C0 with step |
2225 | // size STEP. |
2226 | // The new volume created will have medium number NUMED. |
2227 | // If NUMED is 0, NUMED of mother is taken. |
2228 | // NDVMX is the expected maximum number of divisions |
2229 | // (If 0, no protection tests are performed) |
2230 | // |
2231 | char vname[5]; |
2232 | Vname(name,vname); |
2233 | char vmother[5]; |
2234 | Vname(mother,vmother); |
2235 | gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, |
2236 | numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother)); |
2237 | } |
2238 | |
2239 | //_____________________________________________________________________________ |
2240 | void TGeant3::Gsord(const char *name, Int_t iax) |
2241 | { |
2242 | // |
2243 | // Flags volume CHNAME whose contents will have to be ordered |
2244 | // along axis IAX, by setting the search flag to -IAX |
2245 | // IAX = 1 X axis |
2246 | // IAX = 2 Y axis |
2247 | // IAX = 3 Z axis |
2248 | // IAX = 4 Rxy (static ordering only -> GTMEDI) |
2249 | // IAX = 14 Rxy (also dynamic ordering -> GTNEXT) |
2250 | // IAX = 5 Rxyz (static ordering only -> GTMEDI) |
2251 | // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT) |
2252 | // IAX = 6 PHI (PHI=0 => X axis) |
2253 | // IAX = 7 THETA (THETA=0 => Z axis) |
2254 | // |
2255 | char vname[5]; |
2256 | Vname(name,vname); |
2257 | gsord(PASSCHARD(vname), iax PASSCHARL(vname)); |
2258 | } |
2259 | |
2260 | //_____________________________________________________________________________ |
2261 | void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x, |
2262 | Float_t y, Float_t z, Int_t irot, const char *konly) |
2263 | { |
2264 | // |
2265 | // Position a volume into an existing one |
2266 | // |
2267 | // NAME Volume name |
2268 | // NUMBER Copy number of the volume |
2269 | // MOTHER Mother volume name |
2270 | // X X coord. of the volume in mother ref. sys. |
2271 | // Y Y coord. of the volume in mother ref. sys. |
2272 | // Z Z coord. of the volume in mother ref. sys. |
2273 | // IROT Rotation matrix number w.r.t. mother ref. sys. |
2274 | // ONLY ONLY/MANY flag |
2275 | // |
2276 | // It positions a previously defined volume in the mother. |
2277 | // |
2278 | char vname[5]; |
2279 | Vname(name,vname); |
2280 | char vmother[5]; |
2281 | Vname(mother,vmother); |
2282 | gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot, |
2283 | PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother) |
2284 | PASSCHARL(konly)); |
2285 | } |
2286 | |
2287 | //_____________________________________________________________________________ |
2288 | void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother, |
2289 | Float_t x, Float_t y, Float_t z, Int_t irot, |
2290 | const char *konly, Float_t *upar, Int_t np ) |
2291 | { |
2292 | // |
2293 | // Place a copy of generic volume NAME with user number |
2294 | // NR inside MOTHER, with its parameters UPAR(1..NP) |
2295 | // |
2296 | char vname[5]; |
2297 | Vname(name,vname); |
2298 | char vmother[5]; |
2299 | Vname(mother,vmother); |
2300 | gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot, |
2301 | PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother) |
2302 | PASSCHARL(konly)); |
2303 | } |
2304 | |
2305 | //_____________________________________________________________________________ |
2306 | void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2, |
2307 | Float_t phi2, Float_t theta3, Float_t phi3) |
2308 | { |
2309 | // |
2310 | // nmat Rotation matrix number |
2311 | // THETA1 Polar angle for axis I |
2312 | // PHI1 Azimuthal angle for axis I |
2313 | // THETA2 Polar angle for axis II |
2314 | // PHI2 Azimuthal angle for axis II |
2315 | // THETA3 Polar angle for axis III |
2316 | // PHI3 Azimuthal angle for axis III |
2317 | // |
2318 | // It defines the rotation matrix number IROT. |
2319 | // |
2320 | gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3); |
2321 | } |
2322 | |
2323 | //_____________________________________________________________________________ |
2324 | void TGeant3::Gprotm(Int_t nmat) |
2325 | { |
2326 | // |
2327 | // To print rotation matrices structure JROTM |
2328 | // nmat Rotation matrix number |
2329 | // |
2330 | gprotm(nmat); |
2331 | } |
2332 | |
2333 | //_____________________________________________________________________________ |
2334 | Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed, |
2335 | Float_t *upar, Int_t npar) |
2336 | { |
2337 | // |
2338 | // NAME Volume name |
2339 | // SHAPE Volume type |
2340 | // NUMED Tracking medium number |
2341 | // NPAR Number of shape parameters |
2342 | // UPAR Vector containing shape parameters |
2343 | // |
2344 | // It creates a new volume in the JVOLUM data structure. |
2345 | // |
2346 | Int_t ivolu = 0; |
2347 | char vname[5]; |
2348 | Vname(name,vname); |
2349 | char vshape[5]; |
2350 | Vname(shape,vshape); |
2351 | gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu |
2352 | PASSCHARL(vname) PASSCHARL(vshape)); |
2353 | return ivolu; |
2354 | } |
2355 | |
2356 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2357 | // |
2358 | // T H E D R A W I N G P A C K A G E |
2359 | // ====================================== |
2360 | // Drawing functions. These functions allow the visualization in several ways |
2361 | // of the volumes defined in the geometrical data structure. It is possible |
2362 | // to draw the logical tree of volumes belonging to the detector (DTREE), |
2363 | // to show their geometrical specification (DSPEC,DFSPC), to draw them |
2364 | // and their cut views (DRAW, DCUT). Moreover, it is possible to execute |
2365 | // these commands when the hidden line removal option is activated; in |
2366 | // this case, the volumes can be also either translated in the space |
2367 | // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is |
2368 | // possible to fill the surfaces of the volumes |
2369 | // with solid colours when the shading option (SHAD) is activated. |
2370 | // Several tools (ZOOM, LENS) have been developed to zoom detailed parts |
2371 | // of the detectors or to scan physical events as well. |
2372 | // Finally, the command MOVE will allow the rotation, translation and zooming |
2373 | // on real time parts of the detectors or tracks and hits of a simulated event. |
2374 | // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed, |
2375 | // the drawing is performed by the Geant ray-tracing; |
2376 | // automatically, the color is assigned according to the tracking medium of each |
2377 | // volume and the volumes with a density lower/equal than the air are considered |
2378 | // transparent; if the option (USER) is set (ON) (again via the command (DOPT)), |
2379 | // the user can set color and visibility for the desired volumes via the command |
2380 | // (SATT), as usual, relatively to the attributes (COLO) and (SEEN). |
2381 | // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE) |
2382 | // is the ratio between the number of pixels drawn and 20 (user coordinates). |
2383 | // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the |
2384 | // first case, we assume that the first mother volume of the tree is a box with |
2385 | // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is |
2386 | // 5000 cm far from the origin along the Z axis of the user coordinates; in the |
2387 | // second case, the distance between the observer and the origin of the world |
2388 | // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle |
2389 | // or telescopic effects can be achieved changing the scale factors in the command |
2390 | // (DRAW). When the final picture does not occupy the full window, |
2391 | // mapping the space before tracing can speed up the drawing, but can also |
2392 | // produce less precise results; values from 1 to 4 are allowed in the command |
2393 | // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for |
2394 | // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed). |
2395 | // The command (VALCUT) allows the cutting of the detector by three planes |
2396 | // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command |
2397 | // SATT for any desired volume and can assume values from 0 to 7; it determines |
2398 | // the different light processing to be performed for different materials: |
2399 | // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals, |
2400 | // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the |
2401 | // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation |
2402 | // is 0.9) and the observer is assumed to have a light source (therefore he will |
2403 | // produce parallel light in the case of parallel view and point-like-source |
2404 | // light in the case of perspective view). |
2405 | // |
2406 | //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
2407 | |
2408 | //_____________________________________________________________________________ |
2409 | void TGeant3::Gsatt(const char *name, const char *att, Int_t val) |
2410 | { |
2411 | // |
2412 | // NAME Volume name |
2413 | // IOPT Name of the attribute to be set |
2414 | // IVAL Value to which the attribute is to be set |
2415 | // |
2416 | // name= "*" stands for all the volumes. |
2417 | // iopt can be chosen among the following : |
2418 | // |
2419 | // WORK 0=volume name is inactive for the tracking |
2420 | // 1=volume name is active for the tracking (default) |
2421 | // |
2422 | // SEEN 0=volume name is invisible |
2423 | // 1=volume name is visible (default) |
2424 | // -1=volume invisible with all its descendants in the tree |
2425 | // -2=volume visible but not its descendants in the tree |
2426 | // |
2427 | // LSTY line style 1,2,3,... (default=1) |
2428 | // LSTY=7 will produce a very precise approximation for |
2429 | // revolution bodies. |
2430 | // |
2431 | // LWID line width -7,...,1,2,3,..7 (default=1) |
2432 | // LWID<0 will act as abs(LWID) was set for the volume |
2433 | // and for all the levels below it. When SHAD is 'ON', LWID |
2434 | // represent the linewidth of the scan lines filling the surfaces |
2435 | // (whereas the FILL value represent their number). Therefore |
2436 | // tuning this parameter will help to obtain the desired |
2437 | // quality/performance ratio. |
2438 | // |
2439 | // COLO colour code -166,...,1,2,..166 (default=1) |
2440 | // n=1=black |
2441 | // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm'; |
2442 | // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm'; |
2443 | // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm'; |
2444 | // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm'; |
2445 | // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm'; |
2446 | // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm'; |
2447 | // colour=n*10+m, m=1,2,...9, will produce the same colour |
2448 | // as 'n', but with increasing luminosity according to 'm'; |
2449 | // COLO<0 will act as if abs(COLO) was set for the volume |
2450 | // and for all the levels below it. |
2451 | // When for a volume the attribute FILL is > 1 (and the |
2452 | // option SHAD is on), the ABS of its colour code must be < 8 |
2453 | // because an automatic shading of its faces will be |
2454 | // performed. |
2455 | // |
2456 | // FILL (1992) fill area -7,...,0,1,...7 (default=0) |
2457 | // when option SHAD is "on" the FILL attribute of any |
2458 | // volume can be set different from 0 (normal drawing); |
2459 | // if it is set to 1, the faces of such volume will be filled |
2460 | // with solid colours; if ABS(FILL) is > 1, then a light |
2461 | // source is placed along the observer line, and the faces of |
2462 | // such volumes will be painted by colours whose luminosity |
2463 | // will depend on the amount of light reflected; |
2464 | // if ABS(FILL) = 1, then it is possible to use all the 166 |
2465 | // colours of the colour table, becouse the automatic shading |
2466 | // is not performed; |
2467 | // for increasing values of FILL the drawing will be performed |
2468 | // with higher and higher resolution improving the quality (the |
2469 | // number of scan lines used to fill the faces increases with FILL); |
2470 | // it is possible to set different values of FILL |
2471 | // for different volumes, in order to optimize at the same time |
2472 | // the performance and the quality of the picture; |
2473 | // FILL<0 will act as if abs(FILL) was set for the volume |
2474 | // and for all the levels below it. |
2475 | // This kind of drawing can be saved in 'picture files' |
2476 | // or in view banks. |
2477 | // 0=drawing without fill area |
2478 | // 1=faces filled with solid colours and resolution = 6 |
2479 | // 2=lowest resolution (very fast) |
2480 | // 3=default resolution |
2481 | // 4=................. |
2482 | // 5=................. |
2483 | // 6=................. |
2484 | // 7=max resolution |
2485 | // Finally, if a coloured background is desired, the FILL |
2486 | // attribute for the first volume of the tree must be set |
2487 | // equal to -abs(colo), colo being >0 and <166. |
2488 | // |
2489 | // SET set number associated to volume name |
2490 | // DET detector number associated to volume name |
2491 | // DTYP detector type (1,2) |
2492 | // |
2493 | InitHIGZ(); |
2494 | char vname[5]; |
2495 | Vname(name,vname); |
2496 | char vatt[5]; |
2497 | Vname(att,vatt); |
2498 | gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname) |
2499 | PASSCHARL(vatt)); |
2500 | } |
2501 | |
2502 | //_____________________________________________________________________________ |
2503 | void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar, |
2504 | Int_t& natt, Float_t* par, Float_t* att) |
2505 | { |
2506 | // |
2507 | // Find the parameters of a volume |
2508 | // |
2509 | gfpara(PASSCHARD(name), number, intext, npar, natt, par, att |
2510 | PASSCHARL(name)); |
2511 | } |
2512 | |
2513 | //_____________________________________________________________________________ |
2514 | void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par) |
2515 | { |
2516 | // |
2517 | // Check the parameters of a shape |
2518 | // |
2519 | gckpar(ish,npar,par); |
2520 | } |
2521 | |
2522 | //_____________________________________________________________________________ |
2523 | void TGeant3::Gckmat(Int_t itmed, char* natmed) |
2524 | { |
2525 | // |
2526 | // Check the parameters of a tracking medium |
2527 | // |
2528 | gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed)); |
2529 | } |
2530 | |
2531 | //_____________________________________________________________________________ |
2532 | void TGeant3::Gdelete(Int_t iview) |
2533 | { |
2534 | // |
2535 | // IVIEW View number |
2536 | // |
2537 | // It deletes a view bank from memory. |
2538 | // |
2539 | gdelet(iview); |
2540 | } |
2541 | |
2542 | //_____________________________________________________________________________ |
2543 | void TGeant3::Gdopen(Int_t iview) |
2544 | { |
2545 | // |
2546 | // IVIEW View number |
2547 | // |
2548 | // When a drawing is very complex and requires a long time to be |
2549 | // executed, it can be useful to store it in a view bank: after a |
2550 | // call to DOPEN and the execution of the drawing (nothing will |
2551 | // appear on the screen), and after a necessary call to DCLOSE, |
2552 | // the contents of the bank can be displayed in a very fast way |
2553 | // through a call to DSHOW; therefore, the detector can be easily |
2554 | // zoomed many times in different ways. Please note that the pictures |
2555 | // with solid colours can now be stored in a view bank or in 'PICTURE FILES' |
2556 | // |
2557 | InitHIGZ(); |
2558 | higz->Clear(); |
2559 | gdopen(iview); |
2560 | } |
2561 | |
2562 | //_____________________________________________________________________________ |
2563 | void TGeant3::Gdclose() |
2564 | { |
2565 | // |
2566 | // It closes the currently open view bank; it must be called after the |
2567 | // end of the drawing to be stored. |
2568 | // |
2569 | gdclos(); |
2570 | } |
2571 | |
2572 | //_____________________________________________________________________________ |
2573 | void TGeant3::Gdshow(Int_t iview) |
2574 | { |
2575 | // |
2576 | // IVIEW View number |
2577 | // |
2578 | // It shows on the screen the contents of a view bank. It |
2579 | // can be called after a view bank has been closed. |
2580 | // |
2581 | gdshow(iview); |
2582 | } |
2583 | |
2584 | //_____________________________________________________________________________ |
2585 | void TGeant3::Gdopt(const char *name,const char *value) |
2586 | { |
2587 | // |
2588 | // NAME Option name |
2589 | // VALUE Option value |
2590 | // |
2591 | // To set/modify the drawing options. |
2592 | // IOPT IVAL Action |
2593 | // |
2594 | // THRZ ON Draw tracks in R vs Z |
2595 | // OFF (D) Draw tracks in X,Y,Z |
2596 | // 180 |
2597 | // 360 |
2598 | // PROJ PARA (D) Parallel projection |
2599 | // PERS Perspective |
2600 | // TRAK LINE (D) Trajectory drawn with lines |
2601 | // POIN " " with markers |
2602 | // HIDE ON Hidden line removal using the CG package |
2603 | // OFF (D) No hidden line removal |
2604 | // SHAD ON Fill area and shading of surfaces. |
2605 | // OFF (D) Normal hidden line removal. |
2606 | // RAYT ON Ray-tracing on. |
2607 | // OFF (D) Ray-tracing off. |
2608 | // EDGE OFF Does not draw contours when shad is on. |
2609 | // ON (D) Normal shading. |
2610 | // MAPP 1,2,3,4 Mapping before ray-tracing. |
2611 | // 0 (D) No mapping. |
2612 | // USER ON User graphics options in the raytracing. |
2613 | // OFF (D) Automatic graphics options. |
2614 | // |
2615 | InitHIGZ(); |
2616 | char vname[5]; |
2617 | Vname(name,vname); |
2618 | char vvalue[5]; |
2619 | Vname(value,vvalue); |
2620 | gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname) |
2621 | PASSCHARL(vvalue)); |
2622 | } |
2623 | |
2624 | //_____________________________________________________________________________ |
2625 | void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi, |
2626 | Float_t u0,Float_t v0,Float_t ul,Float_t vl) |
2627 | { |
2628 | // |
2629 | // NAME Volume name |
2630 | // + |
2631 | // THETA Viewing angle theta (for 3D projection) |
2632 | // PHI Viewing angle phi (for 3D projection) |
2633 | // PSI Viewing angle psi (for 2D rotation) |
2634 | // U0 U-coord. (horizontal) of volume origin |
2635 | // V0 V-coord. (vertical) of volume origin |
2636 | // SU Scale factor for U-coord. |
2637 | // SV Scale factor for V-coord. |
2638 | // |
2639 | // This function will draw the volumes, |
2640 | // selected with their graphical attributes, set by the Gsatt |
2641 | // facility. The drawing may be performed with hidden line removal |
2642 | // and with shading effects according to the value of the options HIDE |
2643 | // and SHAD; if the option SHAD is ON, the contour's edges can be |
2644 | // drawn or not. If the option HIDE is ON, the detector can be |
2645 | // exploded (BOMB), clipped with different shapes (CVOL), and some |
2646 | // of its parts can be shifted from their original |
2647 | // position (SHIFT). When HIDE is ON, if |
2648 | // the drawing requires more than the available memory, the program |
2649 | // will evaluate and display the number of missing words |
2650 | // (so that the user can increase the |
2651 | // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on), |
2652 | // the program will print messages about the memory used and |
2653 | // statistics on the volumes' visibility. |
2654 | // The following commands will produce the drawing of a green |
2655 | // volume, specified by NAME, without using the hidden line removal |
2656 | // technique, using the hidden line removal technique, |
2657 | // with different linewidth and colour (red), with |
2658 | // solid colour, with shading of surfaces, and without edges. |
2659 | // Finally, some examples are given for the ray-tracing. (A possible |
2660 | // string for the NAME of the volume can be found using the command DTREE). |
2661 | // |
2662 | InitHIGZ(); |
2663 | higz->Clear(); |
2664 | char vname[5]; |
2665 | Vname(name,vname); |
2666 | if (fGcvdma->raytra != 1) { |
2667 | gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname)); |
2668 | } else { |
2669 | gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname)); |
2670 | } |
2671 | } |
2672 | |
2673 | //_____________________________________________________________________________ |
2674 | void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0, |
2675 | Float_t v0,Float_t ul,Float_t vl) |
2676 | { |
2677 | // |
2678 | // NAME Volume name |
2679 | // CAXIS Axis value |
2680 | // CUTVAL Cut plane distance from the origin along the axis |
2681 | // + |
2682 | // U0 U-coord. (horizontal) of volume origin |
2683 | // V0 V-coord. (vertical) of volume origin |
2684 | // SU Scale factor for U-coord. |
2685 | // SV Scale factor for V-coord. |
2686 | // |
2687 | // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3), |
2688 | // and placed at the distance cutval from the origin. |
2689 | // The resulting picture is seen from the the same axis. |
2690 | // When HIDE Mode is ON, it is possible to get the same effect with |
2691 | // the CVOL/BOX function. |
2692 | // |
2693 | InitHIGZ(); |
2694 | higz->Clear(); |
2695 | char vname[5]; |
2696 | Vname(name,vname); |
2697 | gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname)); |
2698 | } |
2699 | |
2700 | //_____________________________________________________________________________ |
2701 | void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi, |
2702 | Float_t cutval, Float_t theta, Float_t phi, Float_t u0, |
2703 | Float_t v0,Float_t ul,Float_t vl) |
2704 | { |
2705 | // |
2706 | // NAME Volume name |
2707 | // CUTTHE Theta angle of the line normal to cut plane |
2708 | // CUTPHI Phi angle of the line normal to cut plane |
2709 | // CUTVAL Cut plane distance from the origin along the axis |
2710 | // + |
2711 | // THETA Viewing angle theta (for 3D projection) |
2712 | // PHI Viewing angle phi (for 3D projection) |
2713 | // U0 U-coord. (horizontal) of volume origin |
2714 | // V0 V-coord. (vertical) of volume origin |
2715 | // SU Scale factor for U-coord. |
2716 | // SV Scale factor for V-coord. |
2717 | // |
2718 | // The cut plane is normal to the line given by the cut angles |
2719 | // cutthe and cutphi and placed at the distance cutval from the origin. |
2720 | // The resulting picture is seen from the viewing angles theta,phi. |
2721 | // |
2722 | InitHIGZ(); |
2723 | higz->Clear(); |
2724 | char vname[5]; |
2725 | Vname(name,vname); |
2726 | gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl |
2727 | PASSCHARL(vname)); |
2728 | } |
2729 | |
2730 | //_____________________________________________________________________________ |
2731 | void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz) |
2732 | { |
2733 | // |
2734 | // Parameters |
2735 | // + |
2736 | // ISEL Option flag D=111110 |
2737 | // NAME Title |
2738 | // CHRSIZ Character size (cm) of title NAME D=0.6 |
2739 | // |
2740 | // ISEL = |
2741 | // 0 to have only the header lines |
2742 | // xxxxx1 to add the text name centered on top of header |
2743 | // xxxx1x to add global detector name (first volume) on left |
2744 | // xxx1xx to add date on right |
2745 | // xx1xxx to select thick characters for text on top of header |
2746 | // x1xxxx to add the text 'EVENT NR x' on top of header |
2747 | // 1xxxxx to add the text 'RUN NR x' on top of header |
2748 | // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices, |
2749 | // i.e. they generate overwritten text. |
2750 | // |
2751 | gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name)); |
2752 | } |
2753 | |
2754 | //_____________________________________________________________________________ |
2755 | void TGeant3::Gdman(Float_t u, Float_t v, const char *type) |
2756 | { |
2757 | // |
2758 | // Draw a 2D-man at position (U0,V0) |
2759 | // Parameters |
2760 | // U U-coord. (horizontal) of the centre of man' R |
2761 | // V V-coord. (vertical) of the centre of man' R |
2762 | // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3' |
2763 | // |
2764 | // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v) |
2765 | // It superimposes the picure of a man or of a woman, chosen among |
2766 | // three different ones, with the same scale factors as the detector |
2767 | // in the current drawing. |
2768 | // |
2769 | TString opt = type; |
2770 | if (opt.Contains("WM1")) { |
2771 | gdwmn1(u,v); |
2772 | } else if (opt.Contains("WM3")) { |
2773 | gdwmn3(u,v); |
2774 | } else if (opt.Contains("WM2")) { |
2775 | gdwmn2(u,v); |
2776 | } else { |
2777 | gdman(u,v); |
2778 | } |
2779 | } |
2780 | |
2781 | //_____________________________________________________________________________ |
2782 | void TGeant3::Gdspec(const char *name) |
2783 | { |
2784 | // |
2785 | // NAME Volume name |
2786 | // |
2787 | // Shows 3 views of the volume (two cut-views and a 3D view), together with |
2788 | // its geometrical specifications. The 3D drawing will |
2789 | // be performed according the current values of the options HIDE and |
2790 | // SHAD and according the current SetClipBox clipping parameters for that |
2791 | // volume. |
2792 | // |
2793 | InitHIGZ(); |
2794 | higz->Clear(); |
2795 | char vname[5]; |
2796 | Vname(name,vname); |
2797 | gdspec(PASSCHARD(vname) PASSCHARL(vname)); |
2798 | } |
2799 | |
2800 | //_____________________________________________________________________________ |
2801 | void TGeant3::DrawOneSpec(const char *name) |
2802 | { |
2803 | // |
2804 | // Function called when one double-clicks on a volume name |
2805 | // in a TPavelabel drawn by Gdtree. |
2806 | // |
2807 | THIGZ *higzSave = higz; |
2808 | higzSave->SetName("higzSave"); |
2809 | THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec"); |
2810 | //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec); |
2811 | if (higzSpec) higz = higzSpec; |
2812 | else higzSpec = new THIGZ(defSize); |
2813 | higzSpec->SetName("higzSpec"); |
2814 | higzSpec->cd(); |
2815 | higzSpec->Clear(); |
2816 | char vname[5]; |
2817 | Vname(name,vname); |
2818 | gdspec(PASSCHARD(vname) PASSCHARL(vname)); |
2819 | higzSpec->Update(); |
2820 | higzSave->cd(); |
2821 | higzSave->SetName("higz"); |
2822 | higz = higzSave; |
2823 | } |
2824 | |
2825 | //_____________________________________________________________________________ |
2826 | void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel) |
2827 | { |
2828 | // |
2829 | // NAME Volume name |
2830 | // LEVMAX Depth level |
2831 | // ISELT Options |
2832 | // |
2833 | // This function draws the logical tree, |
2834 | // Each volume in the tree is represented by a TPaveTree object. |
2835 | // Double-clicking on a TPaveTree draws the specs of the corresponding volume. |
2836 | // Use TPaveTree pop-up menu to select: |
2837 | // - drawing specs |
2838 | // - drawing tree |
2839 | // - drawing tree of parent |
2840 | // |
2841 | InitHIGZ(); |
2842 | higz->Clear(); |
2843 | char vname[5]; |
2844 | Vname(name,vname); |
2845 | gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname)); |
2846 | higz->fPname = ""; |
2847 | } |
2848 | |
2849 | //_____________________________________________________________________________ |
2850 | void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel) |
2851 | { |
2852 | // |
2853 | // NAME Volume name |
2854 | // LEVMAX Depth level |
2855 | // ISELT Options |
2856 | // |
2857 | // This function draws the logical tree of the parent of name. |
2858 | // |
2859 | InitHIGZ(); |
2860 | higz->Clear(); |
2861 | // Scan list of volumes in JVOLUM |
2862 | char vname[5]; |
2863 | Int_t gname, i, jvo, in, nin, jin, num; |
2864 | strncpy((char *) &gname, name, 4); |
2865 | for(i=1; i<=fGcnum->nvolum; i++) { |
2866 | jvo = fZlq[fGclink->jvolum-i]; |
2867 | nin = Int_t(fZq[jvo+3]); |
2868 | if (nin == -1) nin = 1; |
2869 | for (in=1;in<=nin;in++) { |
2870 | jin = fZlq[jvo-in]; |
2871 | num = Int_t(fZq[jin+2]); |
2872 | if(gname == fZiq[fGclink->jvolum+num]) { |
2873 | strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4); |
2874 | vname[4] = 0; |
2875 | gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname)); |
2876 | higz->fPname = ""; |
2877 | return; |
2878 | } |
2879 | } |
2880 | } |
2881 | } |
2882 | |
2883 | //_____________________________________________________________________________ |
2884 | void TGeant3::SetABAN(Int_t par) |
2885 | { |
2886 | // |
2887 | // par = 1 particles will be stopped according to their residual |
2888 | // range if they are not in a sensitive material and are |
2889 | // far enough from the boundary |
2890 | // 0 particles are transported normally |
2891 | // |
2892 | fGcphys->dphys1 = par; |
2893 | } |
2894 | |
2895 | |
2896 | //_____________________________________________________________________________ |
2897 | void TGeant3::SetANNI(Int_t par) |
2898 | { |
2899 | // |
2900 | // To control positron annihilation. |
2901 | // par =0 no annihilation |
2902 | // =1 annihilation. Decays processed. |
2903 | // =2 annihilation. No decay products stored. |
2904 | // |
2905 | fGcphys->ianni = par; |
2906 | } |
2907 | |
2908 | |
2909 | //_____________________________________________________________________________ |
2910 | void TGeant3::SetAUTO(Int_t par) |
2911 | { |
2912 | // |
2913 | // To control automatic calculation of tracking medium parameters: |
2914 | // par =0 no automatic calculation; |
2915 | // =1 automati calculation. |
2916 | // |
2917 | fGctrak->igauto = par; |
2918 | } |
2919 | |
2920 | |
2921 | //_____________________________________________________________________________ |
2922 | void TGeant3::SetBOMB(Float_t boom) |
2923 | { |
2924 | // |
2925 | // BOOM : Exploding factor for volumes position |
2926 | // |
2927 | // To 'explode' the detector. If BOOM is positive (values smaller |
2928 | // than 1. are suggested, but any value is possible) |
2929 | // all the volumes are shifted by a distance |
2930 | // proportional to BOOM along the direction between their centre |
2931 | // and the origin of the MARS; the volumes which are symmetric |
2932 | // with respect to this origin are simply not shown. |
2933 | // BOOM equal to 0 resets the normal mode. |
2934 | // A negative (greater than -1.) value of |
2935 | // BOOM will cause an 'implosion'; for even lower values of BOOM |
2936 | // the volumes' positions will be reflected respect to the origin. |
2937 | // This command can be useful to improve the 3D effect for very |
2938 | // complex detectors. The following commands will make explode the |
2939 | // detector: |
2940 | // |
2941 | InitHIGZ(); |
2942 | setbomb(boom); |
2943 | } |
2944 | |
2945 | //_____________________________________________________________________________ |
2946 | void TGeant3::SetBREM(Int_t par) |
2947 | { |
2948 | // |
2949 | // To control bremstrahlung. |
2950 | // par =0 no bremstrahlung |
2951 | // =1 bremstrahlung. Photon processed. |
2952 | // =2 bremstrahlung. No photon stored. |
2953 | // |
2954 | fGcphys->ibrem = par; |
2955 | } |
2956 | |
2957 | |
2958 | //_____________________________________________________________________________ |
2959 | void TGeant3::SetCKOV(Int_t par) |
2960 | { |
2961 | // |
2962 | // To control Cerenkov production |
2963 | // par =0 no Cerenkov; |
2964 | // =1 Cerenkov; |
2965 | // =2 Cerenkov with primary stopped at each step. |
2966 | // |
2967 | fGctlit->itckov = par; |
2968 | } |
2969 | |
2970 | |
2971 | //_____________________________________________________________________________ |
2972 | void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax, |
2973 | Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax) |
2974 | { |
2975 | // |
2976 | // The hidden line removal technique is necessary to visualize properly |
2977 | // very complex detectors. At the same time, it can be useful to visualize |
2978 | // the inner elements of a detector in detail. This function allows |
2979 | // subtractions (via boolean operation) of BOX shape from any part of |
2980 | // the detector, therefore showing its inner contents. |
2981 | // If "*" is given as the name of the |
2982 | // volume to be clipped, all volumes are clipped by the given box. |
2983 | // A volume can be clipped at most twice. |
2984 | // if a volume is explicitely clipped twice, |
2985 | // the "*" will not act on it anymore. Giving "." as the name |
2986 | // of the volume to be clipped will reset the clipping. |
2987 | // Parameters |
2988 | // NAME Name of volume to be clipped |
2989 | // + |
2990 | // XMIN Lower limit of the Shape X coordinate |
2991 | // XMAX Upper limit of the Shape X coordinate |
2992 | // YMIN Lower limit of the Shape Y coordinate |
2993 | // YMAX Upper limit of the Shape Y coordinate |
2994 | // ZMIN Lower limit of the Shape Z coordinate |
2995 | // ZMAX Upper limit of the Shape Z coordinate |
2996 | // |
2997 | // This function performs a boolean subtraction between the volume |
2998 | // NAME and a box placed in the MARS according the values of the given |
2999 | // coordinates. |
3000 | |
3001 | InitHIGZ(); |
3002 | char vname[5]; |
3003 | Vname(name,vname); |
3004 | setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname)); |
3005 | } |
3006 | |
3007 | //_____________________________________________________________________________ |
3008 | void TGeant3::SetCOMP(Int_t par) |
3009 | { |
3010 | // |
3011 | // To control Compton scattering |
3012 | // par =0 no Compton |
3013 | // =1 Compton. Electron processed. |
3014 | // =2 Compton. No electron stored. |
3015 | // |
3016 | // |
3017 | fGcphys->icomp = par; |
3018 | } |
3019 | |
3020 | //_____________________________________________________________________________ |
3021 | void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu, |
3022 | Float_t cuthad,Float_t cutmuo ,Float_t bcute , |
3023 | Float_t bcutm ,Float_t dcute ,Float_t dcutm , |
3024 | Float_t ppcutm, Float_t tofmax) |
3025 | { |
3026 | // |
3027 | // CUTGAM Cut for gammas D=0.001 |
3028 | // CUTELE Cut for electrons D=0.001 |
3029 | // CUTHAD Cut for charged hadrons D=0.01 |
3030 | // CUTNEU Cut for neutral hadrons D=0.01 |
3031 | // CUTMUO Cut for muons D=0.01 |
3032 | // BCUTE Cut for electron brems. D=-1. |
3033 | // BCUTM Cut for muon brems. D=-1. |
3034 | // DCUTE Cut for electron delta-rays D=-1. |
3035 | // DCUTM Cut for muon delta-rays D=-1. |
3036 | // PPCUTM Cut for e+e- pairs by muons D=0.01 |
3037 | // TOFMAX Time of flight cut D=1.E+10 |
3038 | // |
3039 | // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM |
3040 | // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE |
3041 | // respectively. |
3042 | // If one of the parameters from CUTGAM to PPCUTM included |
3043 | // is modified, cross-sections and energy loss tables must be |
3044 | // recomputed via the function Gphysi. |
3045 | // |
3046 | fGccuts->cutgam = cutgam; |
3047 | fGccuts->cutele = cutele; |
3048 | fGccuts->cutneu = cutneu; |
3049 | fGccuts->cuthad = cuthad; |
3050 | fGccuts->cutmuo = cutmuo; |
3051 | fGccuts->bcute = bcute; |
3052 | fGccuts->bcutm = bcutm; |
3053 | fGccuts->dcute = dcute; |
3054 | fGccuts->dcutm = dcutm; |
3055 | fGccuts->ppcutm = ppcutm; |
3056 | fGccuts->tofmax = tofmax; |
3057 | } |
3058 | |
3059 | //_____________________________________________________________________________ |
3060 | void TGeant3::SetDCAY(Int_t par) |
3061 | { |
3062 | // |
3063 | // To control Decay mechanism. |
3064 | // par =0 no decays. |
3065 | // =1 Decays. secondaries processed. |
3066 | // =2 Decays. No secondaries stored. |
3067 | // |
3068 | fGcphys->idcay = par; |
3069 | } |
3070 | |
3071 | |
3072 | //_____________________________________________________________________________ |
3073 | void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod) |
3074 | { |
3075 | // |
3076 | // Set the debug flag and frequency |
3077 | // Selected debug output will be printed from |
3078 | // event emin to even emax each emod event |
3079 | // |
3080 | fGcflag->idemin = emin; |
3081 | fGcflag->idemax = emax; |
3082 | fGcflag->itest = emod; |
3083 | } |
3084 | |
3085 | |
3086 | //_____________________________________________________________________________ |
3087 | void TGeant3::SetDRAY(Int_t par) |
3088 | { |
3089 | // |
3090 | // To control delta rays mechanism. |
3091 | // par =0 no delta rays. |
3092 | // =1 Delta rays. secondaries processed. |
3093 | // =2 Delta rays. No secondaries stored. |
3094 | // |
3095 | fGcphys->idray = par; |
3096 | } |
3097 | |
3098 | //_____________________________________________________________________________ |
3099 | void TGeant3::SetHADR(Int_t par) |
3100 | { |
3101 | // |
3102 | // To control hadronic interactions. |
3103 | // par =0 no hadronic interactions. |
3104 | // =1 Hadronic interactions. secondaries processed. |
3105 | // =2 Hadronic interactions. No secondaries stored. |
3106 | // |
3107 | fGcphys->ihadr = par; |
3108 | } |
3109 | |
3110 | //_____________________________________________________________________________ |
3111 | void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3, |
3112 | Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7, |
3113 | Float_t xk8, Float_t xk9, Float_t xk10) |
3114 | { |
3115 | // |
3116 | // Set the variables in /GCFLAG/ IKINE, PKINE(10) |
3117 | // Their meaning is user defined |
3118 | // |
3119 | fGckine->ikine = kine; |
3120 | fGckine->pkine[0] = xk1; |
3121 | fGckine->pkine[1] = xk2; |
3122 | fGckine->pkine[2] = xk3; |
3123 | fGckine->pkine[3] = xk4; |
3124 | fGckine->pkine[4] = xk5; |
3125 | fGckine->pkine[5] = xk6; |
3126 | fGckine->pkine[6] = xk7; |
3127 | fGckine->pkine[7] = xk8; |
3128 | fGckine->pkine[8] = xk9; |
3129 | fGckine->pkine[9] = xk10; |
3130 | } |
3131 | |
3132 | //_____________________________________________________________________________ |
3133 | void TGeant3::SetLOSS(Int_t par) |
3134 | { |
3135 | // |
3136 | // To control energy loss. |
3137 | // par =0 no energy loss; |
3138 | // =1 restricted energy loss fluctuations; |
3139 | // =2 complete energy loss fluctuations; |
3140 | // =3 same as 1; |
3141 | // =4 no energy loss fluctuations. |
3142 | // If the value ILOSS is changed, then cross-sections and energy loss |
3143 | // tables must be recomputed via the command 'PHYSI'. |
3144 | // |
3145 | fGcphys->iloss = par; |
3146 | } |
3147 | |
3148 | |
3149 | //_____________________________________________________________________________ |
3150 | void TGeant3::SetMULS(Int_t par) |
3151 | { |
3152 | // |
3153 | // To control multiple scattering. |
3154 | // par =0 no multiple scattering. |
3155 | // =1 Moliere or Coulomb scattering. |
3156 | // =2 Moliere or Coulomb scattering. |
3157 | // =3 Gaussian scattering. |
3158 | // |
3159 | fGcphys->imuls = par; |
3160 | } |
3161 | |
3162 | |
3163 | //_____________________________________________________________________________ |
3164 | void TGeant3::SetMUNU(Int_t par) |
3165 | { |
3166 | // |
3167 | // To control muon nuclear interactions. |
3168 | // par =0 no muon-nuclear interactions. |
3169 | // =1 Nuclear interactions. Secondaries processed. |
3170 | // =2 Nuclear interactions. Secondaries not processed. |
3171 | // |
3172 | fGcphys->imunu = par; |
3173 | } |
3174 | |
3175 | //_____________________________________________________________________________ |
3176 | void TGeant3::SetOPTI(Int_t par) |
3177 | { |
3178 | // |
3179 | // This flag controls the tracking optimisation performed via the |
3180 | // GSORD routine: |
3181 | // 1 no optimisation at all; GSORD calls disabled; |
3182 | // 0 no optimisation; only user calls to GSORD kept; |
3183 | // 1 all non-GSORDered volumes are ordered along the best axis; |
3184 | // 2 all volumes are ordered along the best axis. |
3185 | // |
3186 | fGcopti->ioptim = par; |
3187 | } |
3188 | |
3189 | //_____________________________________________________________________________ |
3190 | void TGeant3::SetPAIR(Int_t par) |
3191 | { |
3192 | // |
3193 | // To control pair production mechanism. |
3194 | // par =0 no pair production. |
3195 | // =1 Pair production. secondaries processed. |
3196 | // =2 Pair production. No secondaries stored. |
3197 | // |
3198 | fGcphys->ipair = par; |
3199 | } |
3200 | |
3201 | |
3202 | //_____________________________________________________________________________ |
3203 | void TGeant3::SetPFIS(Int_t par) |
3204 | { |
3205 | // |
3206 | // To control photo fission mechanism. |
3207 | // par =0 no photo fission. |
3208 | // =1 Photo fission. secondaries processed. |
3209 | // =2 Photo fission. No secondaries stored. |
3210 | // |
3211 | fGcphys->ipfis = par; |
3212 | } |
3213 | |
3214 | //_____________________________________________________________________________ |
3215 | void TGeant3::SetPHOT(Int_t par) |
3216 | { |
3217 | // |
3218 | // To control Photo effect. |
3219 | // par =0 no photo electric effect. |
3220 | // =1 Photo effect. Electron processed. |
3221 | // =2 Photo effect. No electron stored. |
3222 | // |
3223 | fGcphys->iphot = par; |
3224 | } |
3225 | |
3226 | //_____________________________________________________________________________ |
3227 | void TGeant3::SetRAYL(Int_t par) |
3228 | { |
3229 | // |
3230 | // To control Rayleigh scattering. |
3231 | // par =0 no Rayleigh scattering. |
3232 | // =1 Rayleigh. |
3233 | // |
3234 | fGcphys->irayl = par; |
3235 | } |
3236 | |
3237 | //_____________________________________________________________________________ |
3238 | void TGeant3::SetSWIT(Int_t sw, Int_t val) |
3239 | { |
3240 | // |
3241 | // sw Switch number |
3242 | // val New switch value |
3243 | // |
3244 | // Change one element of array ISWIT(10) in /GCFLAG/ |
3245 | // |
3246 | if (sw <= 0 || sw > 10) return; |
3247 | fGcflag->iswit[sw-1] = val; |
3248 | } |
3249 | |
3250 | |
3251 | //_____________________________________________________________________________ |
3252 | void TGeant3::SetTRIG(Int_t nevents) |
3253 | { |
3254 | // |
3255 | // Set number of events to be run |
3256 | // |
3257 | fGcflag->nevent = nevents; |
3258 | } |
3259 | |
7ac3f11b |
3260 | //_____________________________________________________________________________ |
1578254f |
3261 | void TGeant3::SetUserDecay(Int_t pdg) |
7ac3f11b |
3262 | { |
3263 | // |
3264 | // Force the decays of particles to be done with Pythia |
3265 | // and not with the Geant routines. |
3266 | // just kill pointers doing mzdrop |
3267 | // |
1578254f |
3268 | Int_t ipart = IdFromPDG(pdg); |
3269 | if(ipart<0) { |
3270 | printf("Particle %d not in geant\n",pdg); |
3271 | return; |
3272 | } |
7ac3f11b |
3273 | Int_t jpart=fGclink->jpart; |
3274 | Int_t jpa=fZlq[jpart-ipart]; |
3275 | // |
3276 | if(jpart && jpa) { |
3277 | Int_t jpa1=fZlq[jpa-1]; |
3278 | if(jpa1) |
3279 | mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" ")); |
3280 | Int_t jpa2=fZlq[jpa-2]; |
3281 | if(jpa2) |
3282 | mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" ")); |
3283 | } |
3284 | } |
3285 | |
fe4da5cc |
3286 | //______________________________________________________________________________ |
3287 | void TGeant3::Vname(const char *name, char *vname) |
3288 | { |
3289 | // |
3290 | // convert name to upper case. Make vname at least 4 chars |
3291 | // |
3292 | Int_t l = strlen(name); |
3293 | Int_t i; |
3294 | l = l < 4 ? l : 4; |
3295 | for (i=0;i<l;i++) vname[i] = toupper(name[i]); |
3296 | for (i=l;i<4;i++) vname[i] = ' '; |
3297 | vname[4] = 0; |
3298 | } |
3299 | |
3300 | //_____________________________________________________________________________ |
3301 | void TGeant3::WriteEuclid(const char* filnam, const char* topvol, |
3302 | Int_t number, Int_t nlevel) |
3303 | { |
3304 | // |
3305 | // |
3306 | // ****************************************************************** |
3307 | // * * |
3308 | // * Write out the geometry of the detector in EUCLID file format * |
3309 | // * * |
3310 | // * filnam : will be with the extension .euc * |
3311 | // * topvol : volume name of the starting node * |
3312 | // * number : copy number of topvol (relevant for gsposp) * |
3313 | // * nlevel : number of levels in the tree structure * |
3314 | // * to be written out, starting from topvol * |
3315 | // * * |
3316 | // * Author : M. Maire * |
3317 | // * * |
3318 | // ****************************************************************** |
3319 | // |
3320 | // File filnam.tme is written out with the definitions of tracking |
3321 | // medias and materials. |
3322 | // As to restore original numbers for materials and medias, program |
3323 | // searches in the file euc_medi.dat and comparing main parameters of |
3324 | // the mat. defined inside geant and the one in file recognizes them |
3325 | // and is able to take number from file. If for any material or medium, |
3326 | // this procedure fails, ordering starts from 1. |
3327 | // Arrays IOTMED and IOMATE are used for this procedure |
3328 | // |
3329 | const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE", |
3330 | "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE", |
3331 | "GTRA","CTUB"}; |
3332 | Int_t i, end, itm, irm, jrm, k, nmed; |
3333 | Int_t imxtmed=0; |
3334 | Int_t imxmate=0; |
3335 | FILE *lun; |
3336 | char *filext, *filetme; |
3337 | char natmed[21], namate[21]; |
3338 | char natmedc[21], namatec[21]; |
3339 | char key[5], name[5], mother[5], konly[5]; |
3340 | char card[133]; |
3341 | Int_t iadvol, iadtmd, iadrot, nwtot, iret; |
3342 | Int_t mlevel, numbr, natt, numed, nin, ndata; |
3343 | Int_t iname, ivo, ish, jvo, nvstak, ivstak; |
3344 | Int_t jdiv, ivin, in, jin, jvin, irot; |
3345 | Int_t jtm, imat, jma, flag=0, imatc; |
3346 | Float_t az, dens, radl, absl, a, step, x, y, z; |
3347 | Int_t npar, ndvmx, left; |
3348 | Float_t zc, densc, radlc, abslc, c0, tmaxfd; |
3349 | Int_t nparc, numb; |
3350 | Int_t iomate[100], iotmed[100]; |
3351 | Float_t par[50], att[20], ubuf[50]; |
3352 | Float_t *qws; |
3353 | Int_t *iws; |
3354 | Int_t level, ndiv, iaxe; |
3355 | Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf; |
3356 | Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm; |
3357 | Float_t tmaxf, stemax, deemax, epsil, stmin; |
3358 | const char *f10000="!\n%s\n!\n"; |
3359 | //Open the input file |
3360 | end=strlen(filnam); |
3361 | for(i=0;i<end;i++) if(filnam[i]=='.') { |
3362 | end=i; |
3363 | break; |
3364 | } |
3365 | filext=new char[end+4]; |
3366 | filetme=new char[end+4]; |
3367 | strncpy(filext,filnam,end); |
3368 | strncpy(filetme,filnam,end); |
3369 | // |
3370 | // *** The output filnam name will be with extension '.euc' |
3371 | strcpy(&filext[end],".euc"); |
3372 | strcpy(&filetme[end],".tme"); |
3373 | lun=fopen(filext,"w"); |
3374 | // |
3375 | // *** Initialisation of the working space |
3376 | iadvol=fGcnum->nvolum; |
3377 | iadtmd=iadvol+fGcnum->nvolum; |
3378 | iadrot=iadtmd+fGcnum->ntmed; |
3379 | if(fGclink->jrotm) { |
3380 | fGcnum->nrotm=fZiq[fGclink->jrotm-2]; |
3381 | } else { |
3382 | fGcnum->nrotm=0; |
3383 | } |
3384 | nwtot=iadrot+fGcnum->nrotm; |
3385 | qws = new float[nwtot+1]; |
3386 | for (i=0;i<nwtot+1;i++) qws[i]=0; |
3387 | iws = (Int_t*) qws; |
3388 | mlevel=nlevel; |
3389 | if(nlevel==0) mlevel=20; |
3390 | // |
3391 | // *** find the top volume and put it in the stak |
3392 | numbr = number>0 ? number : 1; |
3393 | Gfpara(topvol,numbr,1,npar,natt,par,att); |
3394 | if(npar <= 0) { |
3395 | printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n", |
3396 | topvol, numbr); |
3397 | return; |
3398 | } |
3399 | // |
3400 | // *** authorized shape ? |
3401 | strncpy((char *)&iname, topvol, 4); |
3402 | ivo=0; |
3403 | for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) { |
3404 | ivo=i; |
3405 | break; |
3406 | } |
3407 | jvo = fZlq[fGclink->jvolum-ivo]; |
3408 | ish = Int_t (fZq[jvo+2]); |
3409 | if(ish > 12) { |
3410 | printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n", |
3411 | topvol, numbr); |
3412 | } |
3413 | // |
3414 | level = 1; |
3415 | nvstak = 1; |
3416 | iws[nvstak] = ivo; |
3417 | iws[iadvol+ivo] = level; |
3418 | ivstak = 0; |
3419 | // |
3420 | //*** flag all volumes and fill the stak |
3421 | // |
3422 | L10: |
3423 | // |
3424 | // pick the next volume in stak |
3425 | ivstak += 1; |
3426 | ivo = TMath::Abs(iws[ivstak]); |
3427 | jvo = fZlq[fGclink->jvolum - ivo]; |
3428 | // |
3429 | // flag the tracking medium |
3430 | numed = Int_t (fZq[jvo + 4]); |
3431 | iws[iadtmd + numed] = 1; |
3432 | // |
3433 | // get the daughters ... |
3434 | level = iws[iadvol+ivo]; |
3435 | if (level < mlevel) { |
3436 | level += 1; |
3437 | nin = Int_t (fZq[jvo + 3]); |
3438 | // |
3439 | // from division ... |
3440 | if (nin < 0) { |
3441 | jdiv = fZlq[jvo - 1]; |
3442 | ivin = Int_t (fZq[jdiv + 2]); |
3443 | nvstak += 1; |
3444 | iws[nvstak] = -ivin; |
3445 | iws[iadvol+ivin] = level; |
3446 | // |
3447 | // from position ... |
3448 | } else if (nin > 0) { |
3449 | for(in=1; in<=nin; in++) { |
3450 | jin = fZlq[jvo - in]; |
3451 | ivin = Int_t (fZq[jin + 2 ]); |
3452 | jvin = fZlq[fGclink->jvolum - ivin]; |
3453 | ish = Int_t (fZq[jvin + 2]); |
3454 | // authorized shape ? |
3455 | if (ish <= 12) { |
3456 | // not yet flagged ? |
3457 | if (iws[iadvol+ivin]==0) { |
3458 | nvstak += 1; |
3459 | iws[nvstak] = ivin; |
3460 | iws[iadvol+ivin] = level; |
3461 | } |
3462 | // flag the rotation matrix |
3463 | irot = Int_t ( fZq[jin + 4 ]); |
3464 | if (irot > 0) iws[iadrot+irot] = 1; |
3465 | } |
3466 | } |
3467 | } |
3468 | } |
3469 | // |
3470 | // next volume in stak ? |
3471 | if (ivstak < nvstak) goto L10; |
3472 | // |
3473 | // *** restore original material and media numbers |
3474 | // file euc_medi.dat is needed to compare materials and medias |
3475 | // |
3476 | FILE* luncor=fopen("euc_medi.dat","r"); |
3477 | // |
3478 | if(luncor) { |
3479 | for(itm=1; itm<=fGcnum->ntmed; itm++) { |
3480 | if (iws[iadtmd+itm] > 0) { |
3481 | jtm = fZlq[fGclink->jtmed-itm]; |
3482 | strncpy(natmed,(char *)&fZiq[jtm+1],20); |
3483 | imat = Int_t (fZq[jtm+6]); |
3484 | jma = fZlq[fGclink->jmate-imat]; |
3485 | if (jma <= 0) { |
3486 | printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed); |
3487 | flag=1; |
3488 | } else { |
3489 | strncpy(namate,(char *)&fZiq[jma+1],20); |
3490 | } |
3491 | //* |
3492 | //** find the material original number |
3493 | rewind(luncor); |
3494 | L23: |
3495 | iret=fscanf(luncor,"%4s,%130s",key,card); |
3496 | if(iret<=0) goto L26; |
3497 | flag=0; |
3498 | if(!strcmp(key,"MATE")) { |
3499 | sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc); |
3500 | Gfmate(imat,namate,a,z,dens,radl,absl,par,npar); |
3501 | if(!strcmp(namatec,namate)) { |
3502 | if(az==a && zc==z && densc==dens && radlc==radl |
3503 | && abslc==absl && nparc==nparc) { |
3504 | iomate[imat]=imatc; |
3505 | flag=1; |
3506 | printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc); |
3507 | } else { |
3508 | printf("*** GWEUCL *** different definitions for material: %s\n",namate); |
3509 | } |
3510 | } |
3511 | } |
3512 | if(strcmp(key,"END") && !flag) goto L23; |
3513 | if (!flag) { |
3514 | printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate); |
3515 | } |
3516 | //* |
3517 | //* |
3518 | //*** restore original tracking medium number |
3519 | rewind(luncor); |
3520 | L24: |
3521 | iret=fscanf(luncor,"%4s,%130s",key,card); |
3522 | if(iret<=0) goto L26; |
3523 | flag=0; |
3524 | if (!strcmp(key,"TMED")) { |
3525 | sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n", |
3526 | &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc, |
3527 | &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc); |
3528 | Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax, |
3529 | epsil,stmin,ubuf,&nwbuf); |
3530 | if(!strcmp(natmedc,natmed)) { |
3531 | if (iomate[nmat]==nmatc && nwbuf==nwbufc) { |
3532 | iotmed[itm]=itmedc; |
3533 | flag=1; |
3534 | printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n", |
3535 | itm,natmed,itmedc); |
3536 | } else { |
3537 | printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed); |
3538 | } |
3539 | } |
3540 | } |
3541 | if(strcmp(key,"END") && !flag) goto L24; |
3542 | if(!flag) { |
3543 | printf("cannot restore original number for medium : %s\n",natmed); |
3544 | goto L27; |
3545 | } |
3546 | } |
3547 | } |
3548 | goto L29; |
3549 | //* |
3550 | } |
3551 | L26: printf("*** GWEUCL *** cannot read the data file\n"); |
3552 | L27: flag=2; |
3553 | L29: if(luncor) fclose (luncor); |
3554 | // |
3555 | // |
3556 | // *** write down the tracking medium definition |
3557 | // |
3558 | strcpy(card,"! Tracking medium"); |
3559 | fprintf(lun,f10000,card); |
3560 | // |
3561 | for(itm=1;itm<=fGcnum->ntmed;itm++) { |
3562 | if (iws[iadtmd+itm]>0) { |
3563 | jtm = fZlq[fGclink->jtmed-itm]; |
3564 | strncpy(natmed,(char *)&fZiq[jtm+1],20); |
3565 | natmed[20]='\0'; |
3566 | imat = Int_t (fZq[jtm+6]); |
3567 | jma = fZlq[fGclink->jmate-imat]; |
3568 | //* order media from one, if comparing with database failed |
3569 | if (flag==2) { |
3570 | iotmed[itm]=++imxtmed; |
3571 | iomate[imat]=++imxmate; |
3572 | } |
3573 | //* |
3574 | if(jma<=0) { |
3575 | strcpy(namate," "); |
3576 | printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n", |
3577 | itm,natmed); |
3578 | } else { |
3579 | strncpy(namate,(char *)&fZiq[jma+1],20); |
3580 | namate[20]='\0'; |
3581 | } |
3582 | fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate); |
3583 | } |
3584 | } |
3585 | //* |
3586 | //* *** write down the rotation matrix |
3587 | //* |
3588 | strcpy(card,"! Reperes"); |
3589 | fprintf(lun,f10000,card); |
3590 | // |
3591 | for(irm=1;irm<=fGcnum->nrotm;irm++) { |
3592 | if (iws[iadrot+irm]>0) { |
3593 | jrm = fZlq[fGclink->jrotm-irm]; |
3594 | fprintf(lun,"ROTM %3d",irm); |
3595 | for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]); |
3596 | fprintf(lun,"\n"); |
3597 | } |
3598 | } |
3599 | //* |
3600 | //* *** write down the volume definition |
3601 | //* |
3602 | strcpy(card,"! Volumes"); |
3603 | fprintf(lun,f10000,card); |
3604 | //* |
3605 | for(ivstak=1;ivstak<=nvstak;ivstak++) { |
3606 | ivo = iws[ivstak]; |
3607 | if (ivo>0) { |
3608 | strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4); |
3609 | name[4]='\0'; |
3610 | jvo = fZlq[fGclink->jvolum-ivo]; |
3611 | ish = Int_t (fZq[jvo+2]); |
3612 | nmed = Int_t (fZq[jvo+4]); |
3613 | npar = Int_t (fZq[jvo+5]); |
3614 | if (npar>0) { |
3615 | if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i]; |
3616 | Gckpar (ish,npar,par); |
3617 | fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar); |
3618 | for(i=0;i<(npar-1)/6+1;i++) { |
3619 | fprintf(lun," "); |
3620 | left=npar-i*6; |
3621 | for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]); |
3622 | fprintf(lun,"\n"); |
3623 | } |
3624 | } else { |
3625 | fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar); |
3626 | } |
3627 | } |
3628 | } |
3629 | //* |
3630 | //* *** write down the division of volumes |
3631 | //* |
3632 | fprintf(lun,f10000,"! Divisions"); |
3633 | for(ivstak=1;ivstak<=nvstak;ivstak++) { |
3634 | ivo = TMath::Abs(iws[ivstak]); |
3635 | jvo = fZlq[fGclink->jvolum-ivo]; |
3636 | ish = Int_t (fZq[jvo+2]); |
3637 | nin = Int_t (fZq[jvo+3]); |
3638 | //* this volume is divided ... |
3639 | if (nin<0) { |
3640 | jdiv = fZlq[jvo-1]; |
3641 | iaxe = Int_t ( fZq[jdiv+1]); |
3642 | ivin = Int_t ( fZq[jdiv+2]); |
3643 | ndiv = Int_t ( fZq[jdiv+3]); |
3644 | c0 = fZq[jdiv+4]; |
3645 | step = fZq[jdiv+5]; |
3646 | jvin = fZlq[fGclink->jvolum-ivin]; |
3647 | nmed = Int_t ( fZq[jvin+4]); |
3648 | strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4); |
3649 | mother[4]='\0'; |
3650 | strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4); |
3651 | name[4]='\0'; |
3652 | if ((step<=0.)||(ish>=11)) { |
3653 | //* volume with negative parameter or gsposp or pgon ... |
3654 | fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe); |
3655 | } else if ((ndiv<=0)||(ish==10)) { |
3656 | //* volume with negative parameter or gsposp or para ... |
3657 | ndvmx = TMath::Abs(ndiv); |
3658 | fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n", |
3659 | name,mother,step,iaxe,iotmed[nmed],ndvmx); |
3660 | } else { |
3661 | //* normal volume : all kind of division are equivalent |
3662 | fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n", |
3663 | name,mother,step,iaxe,c0,iotmed[nmed],ndiv); |
3664 | } |
3665 | } |
3666 | } |
3667 | //* |
3668 | //* *** write down the the positionnement of volumes |
3669 | //* |
3670 | fprintf(lun,f10000,"! Positionnements\n"); |
3671 | // |
3672 | for(ivstak = 1;ivstak<=nvstak;ivstak++) { |
3673 | ivo = TMath::Abs(iws[ivstak]); |
3674 | strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4); |
3675 | mother[4]='\0'; |
3676 | jvo = fZlq[fGclink->jvolum-ivo]; |
3677 | nin = Int_t( fZq[jvo+3]); |
3678 | //* this volume has daughters ... |
3679 | if (nin>0) { |
3680 | for (in=1;in<=nin;in++) { |
3681 | jin = fZlq[jvo-in]; |
3682 | ivin = Int_t (fZq[jin +2]); |
3683 | numb = Int_t (fZq[jin +3]); |
3684 | irot = Int_t (fZq[jin +4]); |
3685 | x = fZq[jin +5]; |
3686 | y = fZq[jin +6]; |
3687 | z = fZq[jin +7]; |
3688 | strcpy(konly,"ONLY"); |
3689 | if (fZq[jin+8]!=1.) strcpy(konly,"MANY"); |
3690 | strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4); |
3691 | name[4]='\0'; |
3692 | jvin = fZlq[fGclink->jvolum-ivin]; |
3693 | ish = Int_t (fZq[jvin+2]); |
3694 | //* gspos or gsposp ? |
3695 | ndata = fZiq[jin-1]; |
3696 | if (ndata==8) { |
3697 | fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n", |
3698 | name,numb,mother,x,y,z,irot,konly); |
3699 | } else { |
3700 | npar = Int_t (fZq[jin+9]); |
3701 | for(i=0;i<npar;i++) par[i]=fZq[jin+10+i]; |
3702 | Gckpar (ish,npar,par); |
3703 | fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n", |
3704 | name,numb,mother,x,y,z,irot,konly,npar); |
3705 | fprintf(lun," "); |
3706 | for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]); |
3707 | fprintf(lun,"\n"); |
3708 | } |
3709 | } |
3710 | } |
3711 | } |
3712 | //* |
3713 | fprintf(lun,"END\n"); |
3714 | fclose(lun); |
3715 | //* |
3716 | //****** write down the materials and medias ***** |
3717 | //* |
3718 | lun=fopen(filetme,"w"); |
3719 | //* |
3720 | for(itm=1;itm<=fGcnum->ntmed;itm++) { |
3721 | if (iws[iadtmd+itm]>0) { |
3722 | jtm = fZlq[fGclink->jtmed-itm]; |
3723 | strncpy(natmed,(char*)&fZiq[jtm+1],4); |
3724 | imat = Int_t (fZq[jtm+6]); |
3725 | jma = Int_t (fZlq[fGclink->jmate-imat]); |
3726 | //* material |
3727 | Gfmate (imat,namate,a,z,dens,radl,absl,par,npar); |
3728 | fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n", |
3729 | iomate[imat],namate,a,z,dens,radl,absl,npar); |
3730 | //* |
3731 | if (npar>0) { |
3732 | fprintf(lun," "); |
3733 | for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]); |
3734 | fprintf(lun,"\n"); |
3735 | } |
3736 | //* medium |
3737 | Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar); |
3738 | fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n", |
3739 | iotmed[itm],natmed,iomate[nmat],isvol,ifield, |
3740 | fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar); |
3741 | //* |
3742 | if (npar>0) { |
3743 | fprintf(lun," "); |
3744 | for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]); |
3745 | fprintf(lun,"\n"); |
3746 | } |
3747 | |
3748 | } |
3749 | } |
3750 | fprintf(lun,"END\n"); |
3751 | printf(" *** GWEUCL *** file: %s is now written out\n",filext); |
3752 | printf(" *** GWEUCL *** file: %s is now written out\n",filetme); |
3753 | // Clean up |
3754 | delete [] filext; |
3755 | delete [] filetme; |
3756 | delete [] qws; |
3757 | iws=0; |
3758 | return; |
3759 | } |
3760 | |
3761 | //_____________________________________________________________________________ |
3762 | void TGeant3::Streamer(TBuffer &R__b) |
3763 | { |
3764 | // |
3765 | // Stream an object of class TGeant3. |
3766 | // |
3767 | if (R__b.IsReading()) { |
3768 | Version_t R__v = R__b.ReadVersion(); if (R__v) { } |
3769 | AliMC::Streamer(R__b); |
3770 | R__b >> fNextVol; |
1578254f |
3771 | R__b >> fNPDGCodes; |
3772 | R__b.ReadStaticArray(fPDGCode); |
fe4da5cc |
3773 | } else { |
3774 | R__b.WriteVersion(TGeant3::IsA()); |
3775 | AliMC::Streamer(R__b); |
3776 | R__b << fNextVol; |
1578254f |
3777 | R__b << fNPDGCodes; |
3778 | R__b.WriteArray(fPDGCode, fNPDGCodes); |
fe4da5cc |
3779 | } |
3780 | } |
3781 | |
3782 | |