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