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