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