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