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