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