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