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