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