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