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