00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00503
00504
00505
00506
00507
00509
00510
00511 #include <iostream>
00512 using namespace std;
00513
00514
00515 #include <ctype.h>
00516 #include <stdlib.h>
00517
00518 #include "TROOT.h"
00519 #include "TParticle.h"
00520 #include "TDatabasePDG.h"
00521 #include "TLorentzVector.h"
00522 #include "TArrayI.h"
00523 #include "TArrayD.h"
00524 #include "TString.h"
00525 #include "TParameter.h"
00526 #include "TGeoMatrix.h"
00527 #include "TObjString.h"
00528
00529 #include "TGeant3.h"
00530
00531 #include "TCallf77.h"
00532 #include "TVirtualMCDecayer.h"
00533 #include "TPDGCode.h"
00534
00535 #ifndef WIN32
00536 # define g3zebra g3zebra_
00537 # define grfile grfile_
00538 # define g3pcxyz g3pcxyz_
00539 # define g3gclos g3gclos_
00540 # define g3last g3last_
00541 # define g3init g3init_
00542 # define g3cinit g3cinit_
00543 # define g3run g3run_
00544 # define g3trig g3trig_
00545 # define g3trigc g3trigc_
00546 # define g3trigi g3trigi_
00547 # define g3work g3work_
00548 # define g3zinit g3zinit_
00549 # define g3fmate g3fmate_
00550 # define g3fpart g3fpart_
00551 # define g3ftmed g3ftmed_
00552
00553
00554 # define g3ptmed g3ptmed_
00555
00556
00557
00558 # define g3ppart g3ppart_
00559
00560 # define g3ftmat g3ftmat_
00561 # define g3mate g3mate_
00562 # define g3part g3part_
00563 # define g3sdk g3sdk_
00564 # define g3smate g3smate_
00565 # define g3fang g3fang_
00566 # define g3smixt g3smixt_
00567 # define g3spart g3spart_
00568 # define g3stmed g3stmed_
00569 # define g3sckov g3sckov_
00570 # define g3stpar g3stpar_
00571 # define g3fkine g3fkine_
00572 # define g3fvert g3fvert_
00573 # define g3skine g3skine_
00574 # define g3svert g3svert_
00575 # define g3physi g3physi_
00576 # define g3debug g3debug_
00577 # define g3ekbin g3ekbin_
00578 # define g3finds g3finds_
00579 # define g3sking g3sking_
00580 # define g3skpho g3skpho_
00581 # define g3sstak g3sstak_
00582 # define g3sxyz g3sxyz_
00583 # define g3many g3many_
00584 # define g3track g3track_
00585 # define g3treve g3treve_
00586 # define gtreveroot gtreveroot_
00587 # define grndm grndm_
00588 # define grndmq grndmq_
00589 # define g3dtom g3dtom_
00590 # define g3lmoth g3lmoth_
00591 # define g3media g3media_
00592 # define g3mtod g3mtod_
00593 # define g3sdvn g3sdvn_
00594 # define g3sdvn2 g3sdvn2_
00595 # define g3sdvs g3sdvs_
00596 # define g3sdvs2 g3sdvs2_
00597 # define g3sdvt g3sdvt_
00598 # define g3sdvt2 g3sdvt2_
00599 # define g3sord g3sord_
00600 # define g3spos g3spos_
00601 # define g3sposp g3sposp_
00602 # define g3srotm g3srotm_
00603 # define g3protm g3protm_
00604 # define g3svolu g3svolu_
00605 # define g3print g3print_
00606 # define dzshow dzshow_
00607 # define g3satt g3satt_
00608 # define g3fpara g3fpara_
00609 # define gckpar gckpar_
00610 # define g3ckmat g3ckmat_
00611 # define g3lvolu g3lvolu_
00612 # define geditv geditv_
00613 # define mzdrop mzdrop_
00614
00615 # define ertrak ertrak_
00616 # define ertrgo ertrgo_
00617 # define eufill eufill_
00618 # define eufilp eufilp_
00619 # define eufilv eufilv_
00620 # define trscsp trscsp_
00621 # define trspsc trspsc_
00622 # define trscsd trscsd_
00623 # define trsdsc trsdsc_
00624
00625 # define gcomad gcomad_
00626
00627 # define g3brelm g3brelm_
00628 # define g3prelm g3prelm_
00629
00630 # define rxgtrak rxgtrak_
00631 # define rxouth rxouth_
00632 # define rxinh rxinh_
00633
00634
00635 #else
00636
00637 # define gzebra GZEBRA
00638 # define grfile GRFILE
00639 # define gpcxyz GPCXYZ
00640 # define ggclos GGCLOS
00641 # define glast GLAST
00642 # define ginit GINIT
00643 # define g3cinit G3CINIT
00644 # define grun GRUN
00645 # define gtrig GTRIG
00646 # define gtrigc GTRIGC
00647 # define gtrigi GTRIGI
00648 # define gwork GWORK
00649 # define g3zinit G3ZINIT
00650 # define gfmate GFMATE
00651 # define gfpart GFPART
00652 # define gftmed GFTMED
00653 # define gftmat GFTMAT
00654 # define gmate GMATE
00655 # define gpart GPART
00656 # define gsdk GSDK
00657 # define gsmate GSMATE
00658 # define gsmixt GSMIXT
00659 # define gspart GSPART
00660 # define gstmed GSTMED
00661 # define gsckov GSCKOV
00662 # define gstpar GSTPAR
00663 # define gfkine GFKINE
00664 # define gfvert GFVERT
00665 # define gskine GSKINE
00666 # define gsvert GSVERT
00667 # define gphysi GPHYSI
00668 # define gdebug GDEBUG
00669 # define gekbin GEKBIN
00670 # define gfinds GFINDS
00671 # define gsking GSKING
00672 # define gskpho GSKPHO
00673 # define gsstak GSSTAK
00674 # define gsxyz GSXYZ
00675 # define gtrack GTRACK
00676 # define gtreve GTREVE
00677 # define gtreveroot GTREVEROOT
00678 # define grndm GRNDM
00679 # define grndmq GRNDMQ
00680 # define gdtom GDTOM
00681 # define glmoth GLMOTH
00682 # define gmedia GMEDIA
00683 # define gmtod GMTOD
00684 # define gsdvn GSDVN
00685 # define gsdvn2 GSDVN2
00686 # define gsdvs GSDVS
00687 # define gsdvs2 GSDVS2
00688 # define gsdvt GSDVT
00689 # define gsdvt2 GSDVT2
00690 # define gsord GSORD
00691 # define gspos GSPOS
00692 # define gsposp GSPOSP
00693 # define gsrotm GSROTM
00694 # define gprotm GPROTM
00695 # define gsvolu GSVOLU
00696 # define gprint GPRINT
00697 # define dzshow DZSHOW
00698 # define gsatt GSATT
00699 # define gfpara GFPARA
00700 # define gckpar GCKPAR
00701 # define gckmat GCKMAT
00702 # define glvolu GLVOLU
00703 # define geditv GEDITV
00704 # define mzdrop MZDROP
00705
00706 # define ertrak ERTRAK
00707 # define ertrgo ERTRGO
00708 # define eufill EUFILL
00709 # define eufilp EUFILP
00710 # define eufilv EUFILV
00711 # define trscsp TRSCSP
00712 # define trspsc TRSPSC
00713 # define trscsd TRSCSD
00714 # define trsdsc TRSDSC
00715
00716 # define gcomad GCOMAD
00717
00718 # define gbrelm GBRELM
00719 # define gprelm GPRELM
00720
00721 # define rxgtrak RXGTRAK
00722 # define rxouth RXOUTH
00723 # define rxinh RXINH
00724 # define gfang GFANG
00725
00726 #endif
00727
00728
00729 extern "C"
00730 {
00731
00732
00733
00734 void type_of_call g3zebra(const int&);
00735
00736 void type_of_call g3pcxyz();
00737
00738 void type_of_call g3gclos();
00739
00740 void type_of_call g3last();
00741
00742 void type_of_call g3init();
00743
00744 void type_of_call g3cinit();
00745
00746 void type_of_call g3run();
00747
00748 void type_of_call g3trig();
00749
00750 void type_of_call g3trigc();
00751
00752 void type_of_call g3trigi();
00753
00754 void type_of_call g3work(const int&);
00755
00756 void type_of_call g3zinit();
00757
00758 void type_of_call g3mate();
00759
00760 void type_of_call g3part();
00761
00762 void type_of_call g3sdk(Int_t &, Float_t *, Int_t *);
00763
00764 void type_of_call g3fkine(Int_t &, Float_t *, Float_t *, Int_t &,
00765 Int_t &, Float_t *, Int_t &);
00766
00767 void type_of_call g3fvert(Int_t &, Float_t *, Int_t &, Int_t &,
00768 Float_t &, Float_t *, Int_t &);
00769
00770 void type_of_call g3skine(Float_t *,Int_t &, Int_t &, Float_t *,
00771 Int_t &, Int_t &);
00772
00773 void type_of_call g3svert(Float_t *,Int_t &, Int_t &, Float_t *,
00774 Int_t &, Int_t &);
00775
00776 void type_of_call g3physi();
00777
00778 void type_of_call g3debug();
00779
00780 void type_of_call g3ekbin();
00781
00782 void type_of_call g3finds();
00783
00784 void type_of_call g3sking(Int_t &);
00785
00786 void type_of_call g3skpho(Int_t &);
00787
00788 void type_of_call g3sstak(Int_t &);
00789
00790 void type_of_call g3sxyz();
00791
00792 void type_of_call g3many();
00793
00794 void type_of_call g3track();
00795
00796 void type_of_call g3treve();
00797
00798 void type_of_call gtreveroot();
00799
00800 void type_of_call grndm(Float_t *r, const Int_t &n)
00801 {
00802
00803 for(Int_t i=0; i<n; i++)
00804 do r[i]=gRandom->Rndm(); while(0>=r[i] || r[i]>=1);
00805 }
00806
00807 void type_of_call grndmq(Int_t &is1, Int_t &is2, const Int_t &,
00808 DEFCHARD DEFCHARL)
00809 {is1=gRandom->GetSeed(); is2=0; }
00810
00811 void type_of_call g3dtom(Float_t *, Float_t *, Int_t &);
00812
00813 void type_of_call g3lmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
00814 Int_t *, Int_t * DEFCHARL);
00815
00816 void type_of_call g3media(Float_t *, Int_t &, Int_t&);
00817
00818 void type_of_call g3mtod(Float_t *, Float_t *, Int_t &);
00819
00820 void type_of_call g3srotm(const Int_t &, const Float_t &, const Float_t &,
00821 const Float_t &, const Float_t &, const Float_t &,
00822 const Float_t &);
00823
00824 void type_of_call g3protm(const Int_t &);
00825
00826 void type_of_call g3rfile(const Int_t&, DEFCHARD,
00827 DEFCHARD DEFCHARL DEFCHARL);
00828
00829 void type_of_call g3fmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
00830 Float_t &, Float_t &, Float_t &, Float_t *,
00831 Int_t& DEFCHARL);
00832
00833 void type_of_call g3fang( Float_t *, Float_t &,
00834 Float_t &, Float_t &, Float_t &,
00835 Int_t & );
00836
00837 void type_of_call g3fpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
00838 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
00839
00840
00841
00842 void type_of_call g3ppart(const Int_t&);
00843
00844
00845 void type_of_call g3ftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
00846 Float_t &, Float_t &, Float_t &, Float_t &,
00847 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
00848
00849
00850
00851 void type_of_call g3ptmed(const Int_t&);
00852
00853
00854 void type_of_call g3ftmat(const Int_t&, const Int_t&, DEFCHARD, const Int_t&,
00855 Float_t*, Float_t*
00856 ,Float_t *, Int_t & DEFCHARL);
00857
00858 void type_of_call g3smate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
00859 Float_t &, Float_t &, Float_t &, Float_t *,
00860 Int_t & DEFCHARL);
00861
00862 void type_of_call g3smixt(const Int_t&, DEFCHARD, const Float_t *,
00863 const Float_t *, const Float_t &, const Int_t &,
00864 Float_t * DEFCHARL);
00865
00866 void type_of_call g3spart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
00867 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
00868
00869
00870 void type_of_call g3stmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
00871 Float_t &, Float_t &, Float_t &, Float_t &,
00872 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
00873
00874 void type_of_call g3sckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
00875 Float_t *absco, Float_t *effic, Float_t *rindex);
00876 void type_of_call g3stpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
00877
00878 void type_of_call g3sdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
00879 DEFCHARL DEFCHARL);
00880
00881 void type_of_call g3sdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
00882 Int_t & DEFCHARL DEFCHARL);
00883
00884 void type_of_call g3sdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
00885 DEFCHARL DEFCHARL);
00886
00887 void type_of_call g3sdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
00888 Int_t & DEFCHARL DEFCHARL);
00889
00890 void type_of_call g3sdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
00891 Int_t & DEFCHARL DEFCHARL);
00892
00893 void type_of_call g3sdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
00894 Int_t &, Int_t & DEFCHARL DEFCHARL);
00895
00896 void type_of_call g3sord(DEFCHARD, Int_t & DEFCHARL);
00897
00898 void type_of_call g3spos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
00899 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
00900 DEFCHARL);
00901
00902 void type_of_call g3sposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
00903 Float_t &, Int_t &, DEFCHARD,
00904 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
00905
00906 void type_of_call g3svolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
00907 Int_t & DEFCHARL DEFCHARL);
00908
00909 void type_of_call g3satt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
00910
00911 void type_of_call g3fpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&,
00912 Float_t*, Float_t* DEFCHARL);
00913
00914 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
00915
00916 void type_of_call g3ckmat(Int_t&, DEFCHARD DEFCHARL);
00917
00918 void type_of_call g3lvolu(Int_t&, Int_t*, Int_t*, Int_t&);
00919
00920 void type_of_call g3print(DEFCHARD,const int& DEFCHARL);
00921
00922 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
00923 const int&, const int&, const int& DEFCHARL
00924 DEFCHARL);
00925 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
00926
00927 void type_of_call setbomb(Float_t &);
00928
00929 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
00930 Float_t &, Float_t & DEFCHARL);
00931
00932 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
00933
00934 void type_of_call ertrak(const Float_t *const x1, const Float_t *const p1,
00935 const Float_t *x2, const Float_t *p2,
00936 const Int_t &ipa, DEFCHARD DEFCHARL);
00937 void type_of_call eufill(Int_t n, Float_t *ein,
00938 Float_t *xlf);
00939 void type_of_call eufilp(const int n,Float_t *ein,
00940 Float_t *pli,Float_t *plf);
00941 void type_of_call eufilv(Int_t n, Float_t *ein,
00942 Char_t *namv, Int_t *numv,Int_t *iovl);
00943 void type_of_call trscsd(Float_t *pc,Float_t *rc,Float_t *pd,Float_t *rd,
00944 Float_t *h,Float_t ch,Int_t ierr,Float_t spu,Float_t *dj,Float_t *dk);
00945 void type_of_call trsdsc(Float_t *pd,Float_t *rd,Float_t *pc,Float_t *rc,
00946 Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spu,Float_t *dj,Float_t *dk);
00947 void type_of_call trscsp(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
00948 Float_t *ch,Int_t *ierr,Float_t *spx);
00949 void type_of_call trspsc(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,
00950 Float_t *ch,Int_t *ierr,Float_t *spx);
00951
00952 void type_of_call ertrgo();
00953
00954 float type_of_call g3brelm(const Float_t &z, const Float_t& t,
00955 const Float_t& cut);
00956 float type_of_call g3prelm(const Float_t &z, const Float_t& t,
00957 const Float_t& cut);
00958 }
00959
00960 #ifndef WIN32
00961 # define gudigi gudigi_
00962 # define guhadr guhadr_
00963 # define guout guout_
00964 # define guphad guphad_
00965 # define gudcay gudcay_
00966 # define guiget guiget_
00967 # define guinme guinme_
00968 # define guinti guinti_
00969 # define gunear gunear_
00970 # define guskip guskip_
00971 # define guview guview_
00972 # define gupara gupara_
00973 # define gudtim gudtim_
00974 # define guplsh guplsh_
00975 # define gutrev gutrev_
00976 # define gutrak gutrak_
00977 # define guswim guswim_
00978 # define gufld gufld_
00979 # define gustep gustep_
00980 # define gukine gukine_
00981
00982 # define gheish gheish_
00983 # define flufin flufin_
00984 # define gfmfin gfmfin_
00985 # define gpghei gpghei_
00986 # define fldist fldist_
00987 # define gfmdis gfmdis_
00988 # define g3helx3 g3helx3_
00989 # define g3helix g3helix_
00990 # define g3rkuta g3rkuta_
00991 # define g3track g3track_
00992 # define gtreveroot gtreveroot_
00993 # define g3last g3last_
00994 # define g3invol g3invol_
00995 # define g3tmedi g3tmedi_
00996 # define g3media g3media_
00997 # define g3tmany g3tmany_
00998 # define g3tnext g3tnext_
00999 # define g3gperp g3gperp_
01000 # define ginvol ginvol_
01001 # define gtmedi gtmedi_
01002 # define gtmany gtmany_
01003 # define gtonly gtonly_
01004 # define gmedia gmedia_
01005 # define glvolu glvolu_
01006 # define gtnext gtnext_
01007 # define ggperp ggperp_
01008
01009 #else
01010 # define gudigi GUDIGI
01011 # define guhadr GUHADR
01012 # define guout GUOUT
01013 # define guphad GUPHAD
01014 # define gudcay GUDCAY
01015 # define guiget GUIGET
01016 # define guinme GUINME
01017 # define guinti GUINTI
01018 # define gunear GUNEAR
01019 # define guskip GUSKIP
01020 # define guview GUVIEW
01021 # define gupara GUPARA
01022 # define gudtim GUDTIM
01023 # define guplsh GUPLSH
01024 # define gutrev GUTREV
01025 # define gutrak GUTRAK
01026 # define guswim GUSWIM
01027 # define gufld GUFLD
01028 # define gustep GUSTEP
01029 # define gukine GUKINE
01030
01031 # define gheish GHEISH
01032 # define flufin FLUFIN
01033 # define gfmfin GFMFIN
01034 # define gpghei GPGHEI
01035 # define fldist FLDIST
01036 # define gfmdis GFMDIS
01037 # define g3helx3 G3HELX3
01038 # define g3helix G3HELIX
01039 # define g3gperp G3GPERP
01040 # define g3rkuta G3RKUTA
01041 # define gtrack GTRACK
01042 # define gtreveroot GTREVEROOT
01043 # define glast GLAST
01044 # define ginvol GINVOL
01045 # define gtmedi GTMEDI
01046 # define gtmany GTMANY
01047 # define gmedia GMEDIA
01048 # define glvolu GLVOLU
01049 # define gtnext GTNEXT
01050 # define ggperp GGPERP
01051
01052 #endif
01053
01054 extern "C" type_of_call void gheish();
01055 extern "C" type_of_call void flufin();
01056 extern "C" type_of_call void gfmfin();
01057 extern "C" type_of_call void gpghei();
01058 extern "C" type_of_call void fldist();
01059 extern "C" type_of_call void gfmdis();
01060 extern "C" type_of_call void g3helx3(Float_t&, Float_t&, Float_t*, Float_t*);
01061 extern "C" type_of_call void g3helix(Float_t&, Float_t&, Float_t*, Float_t*);
01062 extern "C" type_of_call void g3rkuta(Float_t&, Float_t&, Float_t*, Float_t*);
01063 extern "C" type_of_call void g3gperp(Float_t*, Float_t*, Int_t&);
01064 extern "C" type_of_call void g3track();
01065 extern "C" type_of_call void gtreveroot();
01066 extern "C" type_of_call void g3last();
01067 extern "C" type_of_call void g3invol(Float_t*, Int_t&);
01068 extern "C" type_of_call void g3tmedi(Float_t*, Int_t&);
01069 extern "C" type_of_call void g3tmany(Int_t&);
01070 extern "C" type_of_call void g3media(Float_t*, Int_t&, Int_t&);
01071 extern "C" type_of_call void g3tnext();
01072 extern "C" type_of_call void ginvol(Float_t*, Int_t&);
01073 extern "C" type_of_call void gtmedi(Float_t*, Int_t&);
01074 extern "C" type_of_call void gtmany(Int_t&);
01075 extern "C" type_of_call void gtonly(Int_t&);
01076 extern "C" type_of_call void gmedia(Float_t*, Int_t&, Int_t&);
01077 extern "C" type_of_call void glvolu(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier);
01078 extern "C" type_of_call void gtnext();
01079 extern "C" type_of_call void ggperp(Float_t*, Float_t*, Int_t&);
01080
01081
01082
01083
01084
01085 Gctrak_t *gctrak = 0;
01086 Gcvolu_t *gcvolu = 0;
01087 Gckine_t *gckine = 0;
01088 TGeant3* geant3 = 0;
01089 static const Int_t kDefSize = 600;
01090 Int_t count_ginvol = 0;
01091 Int_t count_gmedia = 0;
01092 Int_t count_gtmedi = 0;
01093 Int_t count_gtnext = 0;
01094 Gcchan_t *gcchan = 0;
01095
01096 extern "C" type_of_call void gtonlyg3(Int_t&);
01097 void (*fginvol)(Float_t*, Int_t&) = 0;
01098 void (*fgtmedi)(Float_t*, Int_t&) = 0;
01099 void (*fgtmany)(Int_t&) = 0;
01100 void (*fgtonly)(Int_t&) = 0;
01101 void (*fgmedia)(Float_t*, Int_t&, Int_t&) = 0;
01102 void (*fglvolu)(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier) = 0;
01103 void (*fgtnext)() = 0;
01104 void (*fggperp)(Float_t*, Float_t*, Int_t&) = 0;
01105
01106
01107 #ifdef STATISTICS
01108 #include "TTree.h"
01109 #include "TFile.h"
01110 Double_t oldvect[6], oldstep, oldsafety;
01111 Int_t statcode, statsame;
01112 Char_t statpath[120];
01113 Double_t statsafety, statsnext;
01114 TTree *stattree =0;
01115 TFile *statfile=0;
01116 #endif
01117
01118
01119 TGeant3::TGeant3()
01120 : TVirtualMC(),
01121 fNG3Particles(0),
01122 fNPDGCodes(0),
01123 fPDGCode(),
01124 fMCGeo(0),
01125 fImportRootGeometry(kFALSE),
01126 fStopRun(kFALSE),
01127
01128 fUserDecayProductStableMinLifetime(1.E-15)
01129
01130 {
01131
01132
01133
01134 geant3 = this;
01135 }
01136
01137
01138 TGeant3::TGeant3(const char *title, Int_t nwgeant)
01139 : TVirtualMC("TGeant3",title, kFALSE),
01140 fNG3Particles(0),
01141 fNPDGCodes(0),
01142 fPDGCode(),
01143 fMCGeo(0),
01144 fImportRootGeometry(kFALSE),
01145 fStopRun(kFALSE),
01146
01147 fUserDecayProductStableMinLifetime(1.E-15)
01148
01149 {
01150
01151
01152
01153
01154 #ifdef STATISTICS
01155 statfile = new TFile("stat.root","recreate");
01156 stattree = new TTree("stat","stat tree");
01157 stattree->Branch("statcode",&statcode,"statcode/I");
01158 stattree->Branch("statsame",&statsame,"statsame/I");
01159 stattree->Branch("statpath",statpath,"statpath/C");
01160 stattree->Branch("oldvect",oldvect,"oldvect[6]/D");
01161 stattree->Branch("oldsafety",&oldsafety,"oldsafety/D");
01162 stattree->Branch("oldstep",&oldstep,"oldstep/D");
01163 stattree->Branch("snext",&statsnext,"statsnext/D");
01164 stattree->Branch("safety",&statsafety,"statsafety/D");
01165 #endif
01166
01167 geant3 = this;
01168
01169 if(nwgeant) {
01170 g3zebra(nwgeant);
01171 g3init();
01172 g3zinit();
01173 } else {
01174 g3cinit();
01175 }
01176
01177
01178 LoadAddress();
01179
01180
01181 fNG3Particles = 0;
01182 fNPDGCodes=0;
01183
01184
01185 fPDGCode.Set(100);
01186
01187
01188 fginvol = g3invol;
01189 fgtmedi = g3tmedi;
01190 fgtmany = g3tmany;
01191 fgtonly = gtonlyg3;
01192 fgmedia = g3media;
01193 fglvolu = g3lvolu;
01194 fgtnext = g3tnext;
01195 fggperp = g3gperp;
01196
01197 InitGEANE();
01198 }
01199
01200
01201 TGeant3::~TGeant3()
01202 {
01203 if(fVolNames) {
01204 delete [] fVolNames;
01205 fVolNames=0;
01206 }
01207 }
01208
01209
01210 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
01211 Float_t &radl, Float_t &absl) const
01212 {
01213
01214
01215
01216 z = fGcmate->z;
01217 a = fGcmate->a;
01218 dens = fGcmate->dens;
01219 radl = fGcmate->radl;
01220 absl = fGcmate->absl;
01221 return 1;
01222 }
01223
01224
01225 void TGeant3::DefaultRange()
01226 {
01227
01228
01229
01230 }
01231
01232
01233 void TGeant3::InitHIGZ()
01234 {
01235
01236
01237
01238 }
01239
01240
01241 void TGeant3::InitGEANE()
01242 {
01243
01244
01245
01246 Float_t pf[3]={0.,0.,0.};
01247 Float_t w1[3]={0.,0.,0.};
01248 Float_t w2[3]={0.,0.,0.};
01249 Float_t p1[3]={0.,0.,0.};
01250 Float_t p2[3]={0.,0.,0.};
01251 Float_t p3[3]={0.,0.,0.};
01252 Float_t cl[3]={0.,0.,0.};
01253 geant3 = this;
01254 geant3->SetECut(1.);
01255 geant3->SetClose(0,pf,999.,w1,w2,p1,p2,p3,cl);
01256 }
01257
01258
01259 void TGeant3::LoadAddress()
01260 {
01261
01262
01263
01264
01265 Int_t *addr;
01266 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
01267 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
01268 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
01269 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
01270 gcomad(PASSCHARD("GCMORE"),(int*&) fGcmore PASSCHARL("GCMORE"));
01271 gcomad(PASSCHARD("GCMULO"),(int*&) fGcmulo PASSCHARL("GCMULO"));
01272 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
01273 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
01274 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
01275 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
01276 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
01277 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
01278 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
01279 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
01280 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
01281 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
01282 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
01283 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
01284 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
01285 gcomad(PASSCHARD("GCPHLT"),(int*&) fGcphlt PASSCHARL("GCPHLT"));
01286 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
01287 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
01288 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
01289 gcomad(PASSCHARD("GCCHAN"),(int*&) gcchan PASSCHARL("GCCHAN"));
01290
01291
01292 gcomad(PASSCHARD("ERTRIO"),(int*&) fErtrio PASSCHARL("ERTRIO"));
01293 gcomad(PASSCHARD("EROPTS"),(int*&) fEropts PASSCHARL("EROPTS"));
01294 gcomad(PASSCHARD("EROPTC"),(int*&) fEroptc PASSCHARL("EROPTC"));
01295 gcomad(PASSCHARD("ERWORK"),(int*&) fErwork PASSCHARL("ERWORK"));
01296
01297
01298
01299
01300 gcomad(PASSCHARD("PTOPTS"),(int*&) fPtopts PASSCHARL("PTOPTS"));
01301 fPtopts -> use_alt_dedx = 1;
01302
01303
01304
01305 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
01306 fZiq = addr;
01307 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
01308 fZlq = addr;
01309 fZq = (float*)fZiq;
01310 gctrak = fGctrak;
01311 gcvolu = fGcvolu;
01312 gckine = fGckine;
01313 }
01314
01315
01316 void TGeant3::GeomIter()
01317 {
01318
01319
01320
01321
01322 fNextVol=fGcvolu->nlevel;
01323 }
01324
01325
01326 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
01327 {
01328
01329
01330
01331
01332 fNextVol--;
01333 Int_t i, gname;
01334 if(fNextVol>=0) {
01335 gname=fGcvolu->names[fNextVol];
01336 copy=fGcvolu->number[fNextVol];
01337 i=fGcvolu->lvolum[fNextVol];
01338 name = fVolNames[i-1];
01339 if(gname == fZiq[fGclink->jvolum+i]) return i;
01340 else printf("GeomTree: Volume %s not found in bank\n",name);
01341 }
01342 return 0;
01343 }
01344
01345
01346 void TGeant3::BuildPhysics()
01347 {
01348 Gphysi();
01349 }
01350
01351
01352 void TGeant3::AddParticlesToPdgDataBase() const
01353 {
01354
01355
01356
01357
01358 TDatabasePDG *pdgDB = TDatabasePDG::Instance();
01359
01360 const Double_t kAu2Gev=0.9314943228;
01361 const Double_t khSlash = 1.0545726663e-27;
01362 const Double_t kErg2Gev = 1/1.6021773349e-3;
01363 const Double_t khShGev = khSlash*kErg2Gev;
01364 const Double_t kYear2Sec = 3600*24*365.25;
01365
01366
01367
01368
01369
01370
01371
01372
01373
01374
01375 if ( !pdgDB->GetParticle(GetIonPdg(1,2)) )
01376 pdgDB->AddParticle("Deuteron","Deuteron",2*kAu2Gev+8.071e-3,kTRUE,
01377 0,3,"Ion",GetIonPdg(1,2));
01378
01379 if ( !pdgDB->GetParticle(GetIonPdg(1,3)) )
01380 pdgDB->AddParticle("Triton","Triton",3*kAu2Gev+14.931e-3,kFALSE,
01381 khShGev/(12.33*kYear2Sec),3,"Ion",GetIonPdg(1,3));
01382
01383 if ( !pdgDB->GetParticle(GetIonPdg(2,4)) )
01384 pdgDB->AddParticle("Alpha","Alpha",4*kAu2Gev+2.424e-3,kTRUE,
01385 khShGev/(12.33*kYear2Sec),6,"Ion",GetIonPdg(2,4));
01386
01387 if ( !pdgDB->GetParticle(GetIonPdg(2,3)) )
01388 pdgDB->AddParticle("HE3","HE3",3*kAu2Gev+14.931e-3,kFALSE,
01389 0,6,"Ion",GetIonPdg(2,3));
01390
01391
01392
01393 if ( !pdgDB->GetParticle(GetSpecialPdg(50)) )
01394 pdgDB->AddParticle("Cherenkov","Cherenkov",0,kFALSE,
01395 0,0,"Special",GetSpecialPdg(50));
01396
01397 if ( !pdgDB->GetParticle(GetSpecialPdg(51)) )
01398 pdgDB->AddParticle("FeedbackPhoton","FeedbackPhoton",0,kFALSE,
01399 0,0,"Special",GetSpecialPdg(51));
01400
01401 }
01402
01403
01404
01405 Int_t TGeant3::CurrentVolID(Int_t ©) const
01406 {
01407
01408
01409
01410 Int_t i, gname;
01411 if( (i=fGcvolu->nlevel-1) < 0 ) {
01412 Warning("CurrentVolID","Stack depth only %d\n",fGcvolu->nlevel);
01413 } else {
01414 gname=fGcvolu->names[i];
01415 copy=fGcvolu->number[i];
01416 i=fGcvolu->lvolum[i];
01417 if(gname == fZiq[fGclink->jvolum+i]) return i;
01418 else Warning("CurrentVolID","Volume %4s not found\n",(char*)&gname);
01419 }
01420 return 0;
01421 }
01422
01423
01424 Int_t TGeant3::CurrentVolOffID(Int_t off, Int_t ©) const
01425 {
01426
01427
01428
01429
01430 Int_t i, gname;
01431 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
01432 Warning("CurrentVolOffID","Offset requested %d but stack depth %d\n",
01433 off,fGcvolu->nlevel);
01434 } else {
01435 gname=fGcvolu->names[i];
01436 copy=fGcvolu->number[i];
01437 i=fGcvolu->lvolum[i];
01438 if(gname == fZiq[fGclink->jvolum+i]) return i;
01439 else Warning("CurrentVolOffID","Volume %4s not found\n",(char*)&gname);
01440 }
01441 return 0;
01442 }
01443
01444
01445 const char* TGeant3::CurrentVolName() const
01446 {
01447
01448
01449
01450 Int_t i;
01451 if( (i=fGcvolu->nlevel-1) < 0 ) {
01452 Warning("CurrentVolName","Stack depth %d\n",fGcvolu->nlevel);
01453 return 0;
01454 }
01455 Int_t gname=fGcvolu->names[i];
01456 i=fGcvolu->lvolum[i];
01457 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
01458 else Warning("CurrentVolName","Volume %4s not found\n",(char*) &gname);
01459 return 0;
01460 }
01461
01462
01463 const char* TGeant3::CurrentVolOffName(Int_t off) const
01464 {
01465
01466
01467
01468
01469
01470 Int_t i;
01471 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
01472 Warning("CurrentVolOffName",
01473 "Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
01474 return 0;
01475 }
01476 Int_t gname=fGcvolu->names[i];
01477 i=fGcvolu->lvolum[i];
01478 if(gname == fZiq[fGclink->jvolum+i]) return fVolNames[i-1];
01479 else Warning("CurrentVolOffName","Volume %4s not found\n",(char*)&gname);
01480 return 0;
01481 }
01482
01483
01484 const char* TGeant3::CurrentVolPath()
01485 {
01486
01487
01488
01489 return GetPath();
01490 }
01491
01492
01493 Int_t TGeant3::IdFromPDG(Int_t pdg) const
01494 {
01495
01496
01497
01498 for(Int_t i=0;i<fNPDGCodes;++i)
01499 if(pdg==fPDGCode[i]) return i;
01500 return -1;
01501 }
01502
01503
01504 Int_t TGeant3::PDGFromId(Int_t id) const
01505 {
01506
01507
01508
01509 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
01510 else return -1;
01511 }
01512
01513
01514 void TGeant3::DefineParticles()
01515 {
01516
01517
01518 Gpart();
01519
01520
01521 fPDGCode[fNPDGCodes++]=-99;
01522 fPDGCode[fNPDGCodes++]=22;
01523 fPDGCode[fNPDGCodes++]=-11;
01524 fPDGCode[fNPDGCodes++]=11;
01525 fPDGCode[fNPDGCodes++]=12;
01526 fPDGCode[fNPDGCodes++]=-13;
01527 fPDGCode[fNPDGCodes++]=13;
01528 fPDGCode[fNPDGCodes++]=111;
01529 fPDGCode[fNPDGCodes++]=211;
01530 fPDGCode[fNPDGCodes++]=-211;
01531 fPDGCode[fNPDGCodes++]=130;
01532 fPDGCode[fNPDGCodes++]=321;
01533 fPDGCode[fNPDGCodes++]=-321;
01534 fPDGCode[fNPDGCodes++]=2112;
01535 fPDGCode[fNPDGCodes++]=2212;
01536 fPDGCode[fNPDGCodes++]=-2212;
01537 fPDGCode[fNPDGCodes++]=310;
01538 fPDGCode[fNPDGCodes++]=221;
01539 fPDGCode[fNPDGCodes++]=3122;
01540 fPDGCode[fNPDGCodes++]=3222;
01541 fPDGCode[fNPDGCodes++]=3212;
01542 fPDGCode[fNPDGCodes++]=3112;
01543 fPDGCode[fNPDGCodes++]=3322;
01544 fPDGCode[fNPDGCodes++]=3312;
01545 fPDGCode[fNPDGCodes++]=3334;
01546 fPDGCode[fNPDGCodes++]=-2112;
01547 fPDGCode[fNPDGCodes++]=-3122;
01548 fPDGCode[fNPDGCodes++]=-3222;
01549 fPDGCode[fNPDGCodes++]=-3212;
01550 fPDGCode[fNPDGCodes++]=-3112;
01551 fPDGCode[fNPDGCodes++]=-3322;
01552 fPDGCode[fNPDGCodes++]=-3312;
01553 fPDGCode[fNPDGCodes++]=-3334;
01554
01555
01556 Int_t mode[6];
01557 Int_t kz, ipa;
01558 Float_t bratio[6];
01559
01560 fNG3Particles = 33;
01561
01562
01563 Gspart(fNG3Particles++,"OMEGA(782)",3,0.782,0.,7.836e-23);
01564 fPDGCode[fNPDGCodes++]=223;
01565
01566 Gspart(fNG3Particles++,"PHI(1020)",3,1.019,0.,1.486e-22);
01567 fPDGCode[fNPDGCodes++]=333;
01568
01569 Gspart(fNG3Particles++, "D +", 4, 1.8693, 1., 1.040e-12);
01570 fPDGCode[fNPDGCodes++]=411;
01571
01572 Gspart(fNG3Particles++, "D -", 4, 1.8693, -1., 1.040e-12);
01573 fPDGCode[fNPDGCodes++]=-411;
01574
01575 Gspart(fNG3Particles++, "D 0", 3, 1.8645, 0., 0.415e-12);
01576 fPDGCode[fNPDGCodes++]=421;
01577
01578 Gspart(fNG3Particles++,"ANTI D 0",3,1.8645,0.,0.415e-12);
01579 fPDGCode[fNPDGCodes++]=-421;
01580
01581
01582 fNG3Particles++;
01583 fPDGCode[fNPDGCodes++]=-99;
01584
01585 fNG3Particles++;
01586 fPDGCode[fNPDGCodes++]=-99;
01587
01588 fNG3Particles++;
01589 fPDGCode[fNPDGCodes++]=-99;
01590
01591 Gspart(fNG3Particles++, "RHO +", 4, 0.768, 1., 4.353e-24);
01592 fPDGCode[fNPDGCodes++]=213;
01593
01594 Gspart(fNG3Particles++, "RHO -", 4, 0.768, -1., 4.353e-24);
01595 fPDGCode[fNPDGCodes++]=-213;
01596
01597 Gspart(fNG3Particles++, "RHO 0", 3, 0.768, 0., 4.353e-24);
01598 fPDGCode[fNPDGCodes++]=113;
01599
01600
01601
01602
01603 fNG3Particles++;
01604 fPDGCode[fNPDGCodes++]=GetIonPdg(1, 2);
01605
01606 fNG3Particles++;
01607 fPDGCode[fNPDGCodes++]=GetIonPdg(1, 3);
01608
01609 fNG3Particles++;
01610 fPDGCode[fNPDGCodes++]=GetIonPdg(2, 4);
01611
01612 fNG3Particles++;
01613 fPDGCode[fNPDGCodes++]=0;
01614
01615 fNG3Particles++;
01616 fPDGCode[fNPDGCodes++]=GetIonPdg(2, 3);
01617
01618 fNG3Particles++;
01619 fPDGCode[fNPDGCodes++]=GetSpecialPdg(50);
01620
01621 Gspart(fNG3Particles++, "FeedbackPhoton", 7, 0., 0.,1.e20 );
01622 fPDGCode[fNPDGCodes++]=GetSpecialPdg(51);
01623
01624
01625 Gspart(fNG3Particles++, "Lambda_c-", 4, 2.28646, +1., 2.06e-13);
01626
01627 fPDGCode[fNPDGCodes++]=4122;
01628
01629 Gspart(fNG3Particles++, "Lambda_c-", 4, 2.28646, -1., 2.06e-13);
01630
01631 fPDGCode[fNPDGCodes++]=-4122;
01632
01633 Gspart(fNG3Particles++, "D_s+", 4, 1.9682, +1., 0.490e-12);
01634 fPDGCode[fNPDGCodes++]=431;
01635
01636 Gspart(fNG3Particles++, "D_s-", 4, 1.9682, -1., 0.490e-12);
01637 fPDGCode[fNPDGCodes++]=-431;
01638
01639 Gspart(fNG3Particles++, "Tau+", 5, 1.77699, +1., 290.6e-15);
01640 fPDGCode[fNPDGCodes++]=-15;
01641
01642 Gspart(fNG3Particles++, "Tau-", 5, 1.77699, -1., 290.6e-15);
01643 fPDGCode[fNPDGCodes++]= 15;
01644
01645 Gspart(fNG3Particles++, "B0", 3, 5.2794, +0., 1.532e-12);
01646 fPDGCode[fNPDGCodes++]=511;
01647
01648 Gspart(fNG3Particles++, "B0 bar", 3, 5.2794, -0., 1.532e-12);
01649 fPDGCode[fNPDGCodes++]=-511;
01650
01651 Gspart(fNG3Particles++, "B+", 4, 5.2790, +1., 1.638e-12);
01652 fPDGCode[fNPDGCodes++]=521;
01653
01654 Gspart(fNG3Particles++, "B-", 4, 5.2790, -1., 1.638e-12);
01655 fPDGCode[fNPDGCodes++]=-521;
01656
01657 Gspart(fNG3Particles++, "Bs", 3, 5.3675, +0., 1.466e-12);
01658 fPDGCode[fNPDGCodes++]=531;
01659
01660 Gspart(fNG3Particles++, "Bs bar", 3, 5.3675, -0., 1.466e-12);
01661 fPDGCode[fNPDGCodes++]=-531;
01662
01663 Gspart(fNG3Particles++, "Lambda_b", 3, 5.624, +0., 1.24e-12);
01664 fPDGCode[fNPDGCodes++]=5122;
01665
01666 Gspart(fNG3Particles++, "Lambda_b bar", 3, 5.624, -0., 1.24e-12);
01667 fPDGCode[fNPDGCodes++]=-5122;
01668
01669 Gspart(fNG3Particles++, "J/Psi", 3, 3.096916, 0., 7.6e-21);
01670 fPDGCode[fNPDGCodes++]=443;
01671
01672 Gspart(fNG3Particles++, "Psi Prime", 3, 3.686, 0., 0.);
01673 fPDGCode[fNPDGCodes++]=20443;
01674
01675 Gspart(fNG3Particles++, "Upsilon(1S)", 3, 9.46037, 0., 0.);
01676 fPDGCode[fNPDGCodes++]=553;
01677
01678 Gspart(fNG3Particles++, "Upsilon(2S)", 3, 10.0233, 0., 0.);
01679 fPDGCode[fNPDGCodes++]=20553;
01680
01681 Gspart(fNG3Particles++, "Upsilon(3S)", 3, 10.3553, 0., 0.);
01682 fPDGCode[fNPDGCodes++]=30553;
01683
01684 Gspart(fNG3Particles++, "Anti Neutrino (e)", 3, 0., 0., 1.e20);
01685 fPDGCode[fNPDGCodes++]=-12;
01686
01687 Gspart(fNG3Particles++, "Neutrino (mu)", 3, 0., 0., 1.e20);
01688 fPDGCode[fNPDGCodes++]=14;
01689
01690 Gspart(fNG3Particles++, "Anti Neutrino (mu)", 3, 0., 0., 1.e20);
01691 fPDGCode[fNPDGCodes++]=-14;
01692
01693 Gspart(fNG3Particles++, "Neutrino (tau)", 3, 0., 0., 1.e20);
01694 fPDGCode[fNPDGCodes++]=16;
01695
01696 Gspart(fNG3Particles++, "Anti Neutrino (tau)",3, 0., 0., 1.e20);
01697 fPDGCode[fNPDGCodes++]=-16;
01698
01699
01700
01701 for (kz = 0; kz < 6; ++kz) {
01702 bratio[kz] = 0.;
01703 mode[kz] = 0;
01704 }
01705 ipa = 33;
01706 bratio[0] = 89.;
01707 bratio[1] = 8.5;
01708 bratio[2] = 2.5;
01709 mode[0] = 70809;
01710 mode[1] = 107;
01711 mode[2] = 908;
01712 Gsdk(ipa, bratio, mode);
01713
01714 for (kz = 0; kz < 6; ++kz) {
01715 bratio[kz] = 0.;
01716 mode[kz] = 0;
01717 }
01718 ipa = 34;
01719 bratio[0] = 49.;
01720 bratio[1] = 34.4;
01721 bratio[2] = 12.9;
01722 bratio[3] = 2.4;
01723 bratio[4] = 1.3;
01724 mode[0] = 1112;
01725 mode[1] = 1610;
01726 mode[2] = 4407;
01727 mode[3] = 90807;
01728 mode[4] = 1701;
01729 Gsdk(ipa, bratio, mode);
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743
01744
01745
01746
01747
01748
01749
01750
01751
01752
01753
01754
01755
01756
01757
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777
01778
01779
01780
01781
01782
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792
01793
01794
01795 for (kz = 0; kz < 6; ++kz) {
01796 bratio[kz] = 0.;
01797 mode[kz] = 0;
01798 }
01799 ipa = 42;
01800 bratio[0] = 100.;
01801 mode[0] = 807;
01802 Gsdk(ipa, bratio, mode);
01803
01804 for (kz = 0; kz < 6; ++kz) {
01805 bratio[kz] = 0.;
01806 mode[kz] = 0;
01807 }
01808 ipa = 43;
01809 bratio[0] = 100.;
01810 mode[0] = 907;
01811 Gsdk(ipa, bratio, mode);
01812
01813 for (kz = 0; kz < 6; ++kz) {
01814 bratio[kz] = 0.;
01815 mode[kz] = 0;
01816 }
01817 ipa = 44;
01818 bratio[0] = 100.;
01819 mode[0] = 809;
01820 Gsdk(ipa, bratio, mode);
01821
01822
01823
01824
01825
01826
01827
01828
01829
01830
01831
01832
01833
01834
01835
01836
01837
01838
01839
01840
01841 AddParticlesToPdgDataBase();
01842 }
01843
01844
01845 Int_t TGeant3::VolId(const Text_t *name) const
01846 {
01847
01848
01849
01850 Int_t gname,i;
01851 strncpy((char *) &gname, name, 4);
01852 for(i=1; i<=fGcnum->nvolum; i++)
01853 if(gname == fZiq[fGclink->jvolum+i]) return i;
01854 printf("VolId: Volume %s not found\n",name);
01855 return 0;
01856 }
01857
01858
01859 Int_t TGeant3::MediumId(const Text_t *medName) const
01860 {
01861
01862
01863 Int_t nmed = fMedNames.GetEntriesFast();
01864 for ( Int_t imed = 1; imed < nmed; imed++ ) {
01865
01866 TString name = ((TObjString*)fMedNames.At(imed))->GetString();
01867 if ( name == TString(medName) ) return imed;
01868 }
01869 printf("MediumId: Medium %s not found\n", medName);
01870 return 0;
01871 }
01872
01873
01874 Int_t TGeant3::NofVolumes() const
01875 {
01876
01877
01878
01879 return fGcnum->nvolum;
01880 }
01881
01882
01883 Int_t TGeant3::NofVolDaughters(const char* volName) const
01884 {
01885
01886
01887
01888
01889 Int_t idvol = VolId(volName);
01890
01891 Int_t jvo = fZlq[fGclink->jvolum-idvol];
01892 Int_t nin = Int_t(fZq[jvo+3]);
01893 return nin;
01894 }
01895
01896
01897 const char* TGeant3::VolDaughterName(const char* volName, Int_t i) const
01898 {
01899
01900
01901
01902
01903 Int_t idvol = VolId(volName);
01904
01905 Int_t jvo = fZlq[fGclink->jvolum-idvol];
01906 Int_t nin=i+1;
01907 Int_t jin = fZlq[jvo-nin];
01908 Int_t idvold = Int_t(fZq[jin+2]);;
01909
01910 return VolName(idvold);
01911 }
01912
01913
01914
01915 Int_t TGeant3::VolDaughterCopyNo(const char* volName, Int_t i) const
01916 {
01917
01918
01919
01920
01921 Int_t idvol = VolId(volName);
01922
01923 Int_t jvo = fZlq[fGclink->jvolum-idvol];
01924 Int_t nin=i+1;
01925 Int_t jin = fZlq[jvo-nin];
01926
01927 return Int_t(fZq[jin +3]);
01928 }
01929
01930
01931 Int_t TGeant3::VolId2Mate(Int_t id) const
01932 {
01933
01934
01935
01936 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
01937 return 0;
01938 else {
01939 Int_t jvo = fZlq[fGclink->jvolum-id];
01940 return Int_t(fZq[jvo+4]);
01941 }
01942 }
01943
01944
01945 const char* TGeant3::VolName(Int_t id) const
01946 {
01947
01948
01949
01950 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
01951 return fVolNames[fGcnum->nvolum];
01952 else
01953 return fVolNames[id-1];
01954 }
01955
01956
01957 Bool_t TGeant3::SetCut(const char* cutName, Double_t cutValue)
01958 {
01959
01960
01961
01962 Bool_t success = kTRUE;
01963
01964 if(!strcmp(cutName,"CUTGAM"))
01965 fGccuts->cutgam=cutValue;
01966 else if(!strcmp(cutName,"CUTELE"))
01967 fGccuts->cutele=cutValue;
01968 else if(!strcmp(cutName,"CUTNEU"))
01969 fGccuts->cutneu=cutValue;
01970 else if(!strcmp(cutName,"CUTHAD"))
01971 fGccuts->cuthad=cutValue;
01972 else if(!strcmp(cutName,"CUTMUO"))
01973 fGccuts->cutmuo=cutValue;
01974 else if(!strcmp(cutName,"BCUTE"))
01975 fGccuts->bcute=cutValue;
01976 else if(!strcmp(cutName,"BCUTM"))
01977 fGccuts->bcutm=cutValue;
01978 else if(!strcmp(cutName,"DCUTE"))
01979 fGccuts->dcute=cutValue;
01980 else if(!strcmp(cutName,"DCUTM"))
01981 fGccuts->dcutm=cutValue;
01982 else if(!strcmp(cutName,"PPCUTM"))
01983 fGccuts->ppcutm=cutValue;
01984 else if(!strcmp(cutName,"TOFMAX"))
01985 fGccuts->tofmax=cutValue;
01986 else {
01987 Warning("SetCut","Cut %s not implemented\n",cutName);
01988 success = kFALSE;
01989 }
01990
01991 return success;
01992 }
01993
01994
01995 Bool_t TGeant3::SetProcess(const char* flagName, Int_t flagValue)
01996 {
01997
01998
01999
02000 Bool_t success = kTRUE;
02001
02002 if(!strcmp(flagName,"PAIR"))
02003 fGcphys->ipair=flagValue;
02004 else if(!strcmp(flagName,"COMP"))
02005 fGcphys->icomp=flagValue;
02006 else if(!strcmp(flagName,"PHOT"))
02007 fGcphys->iphot=flagValue;
02008 else if(!strcmp(flagName,"PFIS"))
02009 fGcphys->ipfis=flagValue;
02010 else if(!strcmp(flagName,"DRAY"))
02011 fGcphys->idray=flagValue;
02012 else if(!strcmp(flagName,"ANNI"))
02013 fGcphys->ianni=flagValue;
02014 else if(!strcmp(flagName,"BREM"))
02015 fGcphys->ibrem=flagValue;
02016 else if(!strcmp(flagName,"HADR"))
02017 fGcphys->ihadr=flagValue;
02018 else if(!strcmp(flagName,"MUNU"))
02019 fGcphys->imunu=flagValue;
02020 else if(!strcmp(flagName,"DCAY"))
02021 fGcphys->idcay=flagValue;
02022 else if(!strcmp(flagName,"LOSS"))
02023 fGcphys->iloss=flagValue;
02024 else if(!strcmp(flagName,"MULS"))
02025 fGcphys->imuls=flagValue;
02026 else if(!strcmp(flagName,"RAYL"))
02027 fGcphys->irayl=flagValue;
02028 else if(!strcmp(flagName,"STRA"))
02029 fGcphlt->istra=flagValue;
02030 else if(!strcmp(flagName,"SYNC"))
02031 fGcphlt->isync=flagValue;
02032 else if(!strcmp(flagName,"CKOV"))
02033 fGctlit->itckov = flagValue;
02034 else {
02035 Warning("SetFlag","Flag %s not implemented\n",flagName);
02036 success = kFALSE;
02037 }
02038
02039 return success;
02040 }
02041
02042
02043 Bool_t TGeant3::DefineParticle(Int_t pdg,const char* name,TMCParticleType type,
02044 Double_t mass, Double_t charge, Double_t lifetime)
02045 {
02046
02047
02048 TVirtualMC::DefineParticle(pdg, name, type, mass, charge, lifetime);
02049
02050 return false;
02051 }
02052
02053
02054
02055 Bool_t TGeant3::DefineParticle(Int_t pdg,const char* name, TMCParticleType mcType,
02056 Double_t mass, Double_t charge, Double_t lifetime,
02057 const TString& , Double_t ,
02058 Int_t , Int_t , Int_t ,
02059 Int_t , Int_t , Int_t ,
02060 Int_t , Int_t ,
02061 Bool_t , Bool_t ,
02062 const TString& ,
02063 Int_t , Double_t ,
02064 Double_t )
02065 {
02066
02067
02068
02069
02070
02071
02072
02073
02074 if (IdFromPDG(pdg) > 0) {
02075 Error("SetParticle", "Particle already exists.");
02076 return kFALSE;
02077 }
02078
02079
02080 Int_t itrtyp = TransportMethod(mcType);
02081 if (itrtyp < 0) {
02082 Error("SetParticle", "Unknown particle transport.");
02083 return kFALSE;
02084 }
02085
02086
02087 Gspart(fNG3Particles++, name, itrtyp, mass, charge, lifetime);
02088
02089
02090
02091 if (!TDatabasePDG::Instance()->GetParticle(pdg))
02092 TDatabasePDG::Instance()
02093 ->AddParticle(name, name, mass, kTRUE, 0, charge*3,
02094 ParticleClass(mcType).Data(), pdg);
02095
02096
02097 if ( fNPDGCodes >= fPDGCode.GetSize() )
02098 fPDGCode.Set( fPDGCode.GetSize() + 100);
02099
02100 fPDGCode[fNPDGCodes++] = pdg;
02101
02102 return kTRUE;
02103 }
02104
02105
02106 Bool_t TGeant3::DefineIon(const char* name, Int_t Z, Int_t A, Int_t Q,
02107 Double_t , Double_t mass)
02108 {
02109
02110
02111
02112
02113
02114
02115 Int_t pdg = GetIonPdg(Z, A);
02116 Int_t pdgMax = pdg + 9;
02117
02118
02119 while (TDatabasePDG::Instance()->GetParticle(pdg) &&
02120 pdg < pdgMax)
02121 pdg++;
02122 if (TDatabasePDG::Instance()->GetParticle(pdg)) {
02123 Fatal("SetIon", "All isomer numbers are already used");
02124 return kFALSE;
02125 }
02126
02127
02128
02129 if (mass < 1e-09) mass = 0.9382723 * A;
02130
02131 Double_t charge = Q;
02132 TMCParticleType partType = kPTIon;
02133 Double_t lifetime = 1.e20;
02134
02135
02136 return DefineParticle(
02137 pdg, name, partType, mass, charge, lifetime,
02138 "nucleus", 0.0, 1, 1, 0, 1, 1, 0, 0, 1, kTRUE);
02139 }
02140
02141
02142 TString TGeant3::ParticleName(Int_t pdg) const
02143 {
02144
02145
02146
02147 char name[21];
02148 Int_t itrtyp;
02149 Float_t amass, charge, tlife;
02150 Gfpart(pdg, name, itrtyp,amass, charge, tlife);
02151 name[20] = '\0';
02152
02153 return TString(name);
02154 }
02155
02156
02157 Double_t TGeant3::ParticleMass(Int_t pdg) const
02158 {
02159
02160
02161
02162 char name[20];
02163 Int_t itrtyp;
02164 Float_t mass, charge, tlife;
02165 Gfpart(pdg,name, itrtyp, mass, charge, tlife);
02166
02167 return mass;
02168 }
02169
02170
02171 Double_t TGeant3::ParticleCharge(Int_t pdg) const
02172 {
02173
02174
02175
02176 char name[20];
02177 Int_t itrtyp;
02178 Float_t mass, charge, tlife;
02179 Gfpart(pdg,name, itrtyp, mass, charge, tlife);
02180
02181 return charge;
02182 }
02183
02184
02185 Double_t TGeant3::ParticleLifeTime(Int_t pdg) const
02186 {
02187
02188
02189
02190 char name[20];
02191 Int_t itrtyp;
02192 Float_t mass, charge, tlife;
02193 Gfpart(pdg, name, itrtyp, mass, charge, tlife);
02194
02195 return tlife;
02196 }
02197
02198
02199 TMCParticleType TGeant3::ParticleMCType(Int_t pdg) const
02200 {
02201
02202
02203
02204 char name[20];
02205 Int_t itrtyp;
02206 Float_t mass, charge, tlife;
02207 Gfpart(pdg,name, itrtyp, mass, charge, tlife);
02208
02209 return ParticleType(itrtyp);
02210 }
02211
02212
02213
02214 Double_t TGeant3::Xsec(char* reac, Double_t ,
02215 Int_t part, Int_t )
02216 {
02217
02218
02219
02220 if(!strcmp(reac,"PHOT"))
02221 {
02222 if(part!=22) {
02223 Error("Xsec","Can calculate photoelectric only for photons\n");
02224 }
02225 }
02226 return 0;
02227 }
02228
02229
02230 void TGeant3::TrackPosition(TLorentzVector &xyz) const
02231 {
02232
02233
02234
02235
02236 xyz[0]=fGctrak->vect[0];
02237 xyz[1]=fGctrak->vect[1];
02238 xyz[2]=fGctrak->vect[2];
02239 xyz[3]=fGctrak->tofg;
02240 }
02241
02242
02243 void TGeant3::TrackPosition(Double_t &x, Double_t &y, Double_t &z) const
02244 {
02245
02246
02247
02248
02249 x=fGctrak->vect[0];
02250 y=fGctrak->vect[1];
02251 z=fGctrak->vect[2];
02252 }
02253
02254
02255 Double_t TGeant3::TrackTime() const
02256 {
02257
02258
02259
02260 return fGctrak->tofg;
02261 }
02262
02263
02264 void TGeant3::TrackMomentum(TLorentzVector &xyz) const
02265 {
02266
02267
02268
02269
02270 Double_t ptot=fGctrak->vect[6];
02271 xyz[0]=fGctrak->vect[3]*ptot;
02272 xyz[1]=fGctrak->vect[4]*ptot;
02273 xyz[2]=fGctrak->vect[5]*ptot;
02274 xyz[3]=fGctrak->getot;
02275 }
02276
02277
02278 void TGeant3::TrackMomentum(Double_t &px, Double_t &py, Double_t &pz,
02279 Double_t &etot) const
02280 {
02281
02282
02283
02284
02285 Double_t ptot=fGctrak->vect[6];
02286 px =fGctrak->vect[3]*ptot;
02287 py =fGctrak->vect[4]*ptot;
02288 pz =fGctrak->vect[5]*ptot;
02289 etot=fGctrak->getot;
02290 }
02291
02292
02293 Double_t TGeant3::TrackCharge() const
02294 {
02295
02296
02297
02298 return fGckine->charge;
02299 }
02300
02301
02302 Double_t TGeant3::TrackMass() const
02303 {
02304
02305
02306
02307 return fGckine->amass;
02308 }
02309
02310
02311 Int_t TGeant3::TrackPid() const
02312 {
02313
02314
02315
02316 return PDGFromId(fGckine->ipart);
02317 }
02318
02319
02320 Double_t TGeant3::TrackStep() const
02321 {
02322
02323
02324
02325 return fGctrak->step;
02326 }
02327
02328
02329 Double_t TGeant3::TrackLength() const
02330 {
02331
02332
02333
02334 return fGctrak->sleng;
02335 }
02336
02337
02338 Bool_t TGeant3::IsNewTrack() const
02339 {
02340
02341
02342
02343 return (fGctrak->sleng==0);
02344 }
02345
02346
02347 Bool_t TGeant3::IsTrackInside() const
02348 {
02349
02350
02351
02352 return (fGctrak->inwvol==0);
02353 }
02354
02355
02356 Bool_t TGeant3::IsTrackEntering() const
02357 {
02358
02359
02360
02361 return (fGctrak->inwvol==1);
02362 }
02363
02364
02365 Bool_t TGeant3::IsTrackExiting() const
02366 {
02367
02368
02369
02370 return (fGctrak->inwvol==2);
02371 }
02372
02373
02374 Bool_t TGeant3::IsTrackOut() const
02375 {
02376
02377
02378
02379 return (fGctrak->inwvol==3);
02380 }
02381
02382
02383 Bool_t TGeant3::IsTrackStop() const
02384 {
02385
02386
02387
02388 return (fGctrak->istop==2);
02389 }
02390
02391
02392 Int_t TGeant3::NSecondaries() const
02393 {
02394
02395
02396
02397 return fGcking->ngkine;
02398 }
02399
02400
02401 Int_t TGeant3::CurrentEvent() const
02402 {
02403
02404
02405
02406 return fGcflag->idevt;
02407 }
02408
02409
02410 TMCProcess TGeant3::ProdProcess(Int_t ) const
02411 {
02412
02413
02414
02415
02416
02417
02418
02419
02420
02421
02422
02423
02424
02425
02426 if ( fGcking->ngkine <= 0 ) return kPNoProcess;
02427
02428
02429 std::string casestr((const char*)(&(fGcking->kcase)));
02430 casestr.resize(4);
02431
02432 int imech = -1;
02433 for ( Int_t km = fGctrak->nmec - 1; km >= 0; km-- ) {
02434
02435
02436
02437 Int_t proclmec = fGctrak->lmec[km] - 1;
02438 std::string namestr((const char*)(&(fGctrak->namec[proclmec])));
02439 namestr.resize(4);
02440 if ( casestr == namestr ) {
02441 imech = proclmec;
02442 break;
02443 }
02444 }
02445
02446 if ( imech < 0 ) {
02447
02448
02449
02450 for ( Int_t km = 0; km < MAXMEC; km++ ) {
02451 std::string namestr((const char*)(&(fGctrak->namec[km])));
02452 namestr.resize(4);
02453 if ( casestr == namestr ) {
02454 imech = km;
02455 break;
02456 }
02457 }
02458 }
02459
02460 if ( imech < 0 ) {
02461
02462 cerr << "* TGeant3::ProdProcess secondaries present, kcase is "
02463 << casestr.c_str() << " but no matching process!*" << endl;
02464 abort();
02465 }
02466 TMCProcess vmcmech = G3toVMC(imech+1);
02467
02468 return vmcmech;
02469
02470
02471 }
02472
02473
02474 Int_t TGeant3::StepProcesses(TArrayI &proc) const
02475 {
02476
02477
02478
02479 Int_t i;
02480 Int_t nproc=Gctrak()->nmec;
02481
02482
02483 if (nproc==0) {
02484 proc.Set(1);
02485 proc[0] = kPNull;
02486 return 1;
02487 }
02488
02489
02490 proc.Set(nproc);
02491 Int_t nvproc=0;
02492
02493 for (i=0; i<nproc; ++i)
02494 if((proc[nvproc]=G3toVMC(Gctrak()->lmec[i]))!=kPNoProcess) nvproc++;
02495
02496 proc.Set(nvproc);
02497
02498 return nvproc;
02499 }
02500
02501
02502 TMCProcess TGeant3::G3toVMC(Int_t iproc) const
02503 {
02504
02505
02506
02507
02508 const TMCProcess kPG2MC1[30] = {
02509 kPTransportation, kPMultipleScattering, kPEnergyLoss, kPMagneticFieldL, kPDecay,
02510 kPPair, kPCompton, kPPhotoelectric, kPBrem, kPDeltaRay,
02511 kPAnnihilation, kPHadronic, kPHCElastic, kPEvaporation, kPNuclearFission,
02512 kPNuclearAbsorption, kPPbarAnnihilation, kPNCapture, kPHIElastic,
02513 kPHInhelastic, kPMuonNuclear, kPTOFlimit, kPPhotoFission, kPNoProcess,
02514 kPRayleigh, kPNoProcess, kPNoProcess, kPNoProcess, kPNull, kPStop};
02515
02516 const TMCProcess kPG2MC2[9] = {
02517 kPLightAbsorption, kPLightScattering, kStepMax, kPNoProcess, kPCerenkov,
02518 kPLightReflection, kPLightRefraction, kPSynchrotron, kPNoProcess};
02519
02520 TMCProcess proc=kPNoProcess;
02521 if(0<iproc && iproc<=30) proc= kPG2MC1[iproc-1];
02522 else if(101<=iproc && iproc<=109) proc= kPG2MC2[iproc-100-1];
02523
02524
02525
02526
02527 if ( proc == kPNoProcess ) {
02528 cerr << "* TGeant3::G3toVMC failed to find matching TMCProcess "
02529 << "for G3 iproc " << iproc << "!*" << endl;
02530 }
02531
02532
02533 return proc;
02534 }
02535
02536
02537
02538 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart,
02539 TLorentzVector &x, TLorentzVector &p)
02540 {
02541
02542
02543
02544
02545 Int_t i;
02546 if(-1<isec && isec<fGcking->ngkine) {
02547 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
02548 for(i=0;i<3;i++) {
02549 x[i]=fGckin3->gpos[isec][i];
02550 p[i]=fGcking->gkin[isec][i];
02551 }
02552 x[3]=fGcking->tofd[isec];
02553 p[3]=fGcking->gkin[isec][3];
02554 } else {
02555 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
02556 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
02557 ipart=0;
02558 }
02559 }
02560
02561
02562 void TGeant3::InitLego()
02563 {
02564
02565
02566
02567 SetSWIT(4,0);
02568 SetDEBU(0,0,0);
02569 }
02570
02571
02572 Bool_t TGeant3::IsTrackDisappeared() const
02573 {
02574
02575
02576
02577
02578
02579 return (fGctrak->istop==1);
02580 }
02581
02582
02583 Bool_t TGeant3::IsTrackAlive() const
02584 {
02585
02586
02587
02588
02589 return (fGctrak->istop==0);
02590 }
02591
02592
02593 void TGeant3::StopTrack()
02594 {
02595
02596
02597
02598 fGctrak->istop=1;
02599 }
02600
02601
02602 void TGeant3::StopEvent()
02603 {
02604
02605
02606
02607 fGcflag->ieotri=1;
02608 }
02609
02610
02611 void TGeant3::StopRun()
02612 {
02613
02614
02615
02616
02617 StopTrack();
02618 StopEvent();
02619 fStopRun = kTRUE;
02620 }
02621
02622
02623 Double_t TGeant3::MaxStep() const
02624 {
02625
02626
02627
02628 return fGctmed->stemax;
02629 }
02630
02631
02632 void TGeant3::SetMaxStep(Double_t maxstep)
02633 {
02634
02635
02636
02637 fGctmed->stemax=maxstep;
02638 }
02639
02640
02641 void TGeant3::SetMaxNStep(Int_t maxnstp)
02642 {
02643
02644
02645
02646 fGctrak->maxnst=maxnstp;
02647 }
02648
02649 void TGeant3::ForceDecayTime(Float_t time)
02650 {
02651
02652
02653
02654 TLorentzVector p;
02655 TrackMomentum(p);
02656 Gcphys()->sumlif = time / p.Beta() / p.Gamma() * 2.99792458e10;
02657 }
02658
02659
02660 Int_t TGeant3::GetMaxNStep() const
02661 {
02662
02663
02664
02665 return fGctrak->maxnst;
02666 }
02667
02668
02669 void TGeant3::G3Material(Int_t& kmat, const char* name, Double_t a,
02670 Double_t z, Double_t dens, Double_t radl,
02671 Double_t absl, Float_t* buf, Int_t nwbuf)
02672 {
02673
02674
02675
02676
02677
02678
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689
02690 Int_t jmate=fGclink->jmate;
02691 kmat=1;
02692 Int_t ns, i;
02693 if(jmate>0) {
02694 ns=fZiq[jmate-2];
02695 kmat=ns+1;
02696 for(i=1; i<=ns; i++) {
02697 if(fZlq[jmate-i]==0) {
02698 kmat=i;
02699 break;
02700 }
02701 }
02702 }
02703 Float_t fa = a;
02704 Float_t fz = z;
02705 Float_t fdens = dens;
02706 Float_t fradl = radl;
02707 Float_t fabsl = absl;
02708
02709 g3smate(kmat,PASSCHARD(name), fa, fz, fdens, fradl, fabsl, buf,
02710 nwbuf PASSCHARL(name));
02711 }
02712
02713
02714 void TGeant3::Material(Int_t& kmat, const char* name, Double_t a, Double_t z,
02715 Double_t dens, Double_t radl, Double_t absl, Float_t* buf,
02716 Int_t nwbuf)
02717 {
02718
02719
02720
02721
02722
02723
02724
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734
02735
02736 G3Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
02737 }
02738
02739
02740 void TGeant3::Material(Int_t& kmat, const char* name, Double_t a, Double_t z,
02741 Double_t dens, Double_t radl, Double_t absl, Double_t* buf,
02742 Int_t nwbuf)
02743 {
02744
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762
02763 Float_t* fbuf = CreateFloatArray(buf, nwbuf);
02764 G3Material(kmat, name, a, z, dens, radl, absl, fbuf, nwbuf);
02765 delete [] fbuf;
02766 }
02767
02768
02769 void TGeant3::G3Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
02770 Double_t dens, Int_t nlmat, Float_t* wmat)
02771 {
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781
02782
02783
02784
02785 Int_t jmate=fGclink->jmate;
02786 kmat=1;
02787 Int_t ns, i;
02788 if(jmate>0) {
02789 ns=fZiq[jmate-2];
02790 kmat=ns+1;
02791 for(i=1; i<=ns; i++) {
02792 if(fZlq[jmate-i]==0) {
02793 kmat=i;
02794 break;
02795 }
02796 }
02797 }
02798 g3smixt(kmat,PASSCHARD(name),a,z,Float_t(dens),nlmat,wmat PASSCHARL(name));
02799 }
02800
02801
02802 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
02803 Double_t dens, Int_t nlmat, Float_t* wmat)
02804 {
02805
02806
02807
02808
02809
02810
02811
02812
02813
02814
02815
02816
02817
02818 Float_t* fa = CreateFloatArray(a, TMath::Abs(nlmat));
02819 Float_t* fz = CreateFloatArray(z, TMath::Abs(nlmat));
02820 Float_t* fwmat = CreateFloatArray(wmat, TMath::Abs(nlmat));
02821
02822 G3Mixture(kmat, name, fa, fz, dens, nlmat, fwmat);
02823 Int_t i;
02824 for (i=0; i<TMath::Abs(nlmat); i++) {
02825 a[i] = fa[i]; z[i] = fz[i]; wmat[i] = fwmat[i];
02826 }
02827
02828 delete [] fa;
02829 delete [] fz;
02830 delete [] fwmat;
02831 }
02832
02833
02834 void TGeant3::Mixture(Int_t& kmat, const char* name, Double_t* a, Double_t* z,
02835 Double_t dens, Int_t nlmat, Double_t* wmat)
02836 {
02837
02838
02839
02840
02841
02842
02843
02844
02845
02846
02847
02848
02849
02850 Float_t* fa = CreateFloatArray(a, TMath::Abs(nlmat));
02851 Float_t* fz = CreateFloatArray(z, TMath::Abs(nlmat));
02852 Float_t* fwmat = CreateFloatArray(wmat, TMath::Abs(nlmat));
02853
02854 G3Mixture(kmat, name, fa, fz, dens, nlmat, fwmat);
02855 Int_t i;
02856 for (i=0; i<TMath::Abs(nlmat); i++) {
02857 a[i] = fa[i]; z[i] = fz[i]; wmat[i] = fwmat[i];
02858 }
02859
02860 delete [] fa;
02861 delete [] fz;
02862 delete [] fwmat;
02863 }
02864
02865
02866 void TGeant3::G3Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
02867 Int_t ifield, Double_t fieldm, Double_t tmaxfd,
02868 Double_t stemax, Double_t deemax, Double_t epsil,
02869 Double_t stmin, Float_t* ubuf, Int_t nbuf)
02870 {
02871
02872
02873
02874
02875
02876
02877
02878
02879
02880
02881
02882
02883
02884
02885
02886
02887
02888 Int_t jtmed=fGclink->jtmed;
02889 kmed=1;
02890 Int_t ns, i;
02891 if(jtmed>0) {
02892 ns=fZiq[jtmed-2];
02893 kmed=ns+1;
02894 for(i=1; i<=ns; i++) {
02895 if(fZlq[jtmed-i]==0) {
02896 kmed=i;
02897 break;
02898 }
02899 }
02900 }
02901 Float_t ffieldm = fieldm;
02902 Float_t ftmaxfd = tmaxfd;
02903 Float_t fstemax = stemax;
02904 Float_t fdeemax = deemax;
02905 Float_t fepsil = epsil;
02906 Float_t fstmin = stmin;
02907 g3stmed(kmed, PASSCHARD(name),nmat,isvol,ifield,ffieldm,ftmaxfd,fstemax,
02908 fdeemax, fepsil, fstmin, ubuf, nbuf PASSCHARL(name));
02909
02910 fMedNames.AddAtAndExpand(new TObjString(name), kmed);
02911 }
02912
02913
02914 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
02915 Int_t ifield, Double_t fieldm, Double_t tmaxfd,
02916 Double_t stemax, Double_t deemax, Double_t epsil,
02917 Double_t stmin, Float_t* ubuf, Int_t nbuf)
02918 {
02919
02920
02921
02922
02923
02924
02925
02926
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937 G3Medium(kmed,name,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,
02938 stmin, ubuf, nbuf);
02939
02940 }
02941
02942
02943 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
02944 Int_t ifield, Double_t fieldm, Double_t tmaxfd,
02945 Double_t stemax, Double_t deemax, Double_t epsil,
02946 Double_t stmin, Double_t* ubuf, Int_t nbuf)
02947 {
02948
02949
02950
02951
02952
02953
02954
02955
02956
02957
02958
02959
02960
02961
02962
02963
02964
02965
02966 Float_t* fubuf = CreateFloatArray(ubuf, nbuf);
02967 G3Medium(kmed,name,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,
02968 stmin, fubuf, nbuf);
02969 delete [] fubuf;
02970
02971 }
02972
02973
02974 void TGeant3::Matrix(Int_t& krot, Double_t thex, Double_t phix, Double_t they,
02975 Double_t phiy, Double_t thez, Double_t phiz)
02976 {
02977
02978
02979
02980
02981
02982
02983
02984
02985
02986
02987
02988 krot = -1;
02989 Int_t jrotm=fGclink->jrotm;
02990 krot=1;
02991 Int_t ns, i;
02992 if(jrotm>0) {
02993 ns=fZiq[jrotm-2];
02994 krot=ns+1;
02995 for(i=1; i<=ns; i++) {
02996 if(fZlq[jrotm-i]==0) {
02997 krot=i;
02998 break;
02999 }
03000 }
03001 }
03002 g3srotm(krot, thex, phix, they, phiy, thez, phiz);
03003 }
03004
03005
03006 Int_t TGeant3::CurrentMedium() const
03007 {
03008
03009
03010
03011
03012
03013
03014
03015
03016
03017
03018
03019 return fGctmed->numed;
03020 }
03021
03022
03023 Int_t TGeant3::GetMedium() const
03024 {
03025
03026
03027
03028
03029
03030 Warning("GetMedium",
03031 "Deprecated function - use CurrentMedium() instead");
03032
03033 return CurrentMedium();
03034 }
03035
03036
03037 void TGeant3::SetRootGeometry()
03038 {
03039
03040
03041
03042
03043 Fatal("SetRootGeometry",
03044 "TGeant3 does not support Root geometry");
03045
03046 fImportRootGeometry = kTRUE;
03047 }
03048
03049
03050 const char *TGeant3::GetPath()
03051 {
03052
03053 Int_t i,j;
03054 if ((i=fGcvolu->nlevel-1)<0) {
03055 Warning("GetPath", "level null");
03056 return fPath;
03057 }
03058 fPath[0] = '/';
03059 char name[10];
03060 char *namcur = fPath+1;
03061 Int_t gname, copy;
03062 Int_t nch=0;
03063 for (j=0; j<i+1; j++) {
03064 gname = fGcvolu->names[j];
03065 copy = fGcvolu->number[j];
03066 memcpy(name, &gname, 4);
03067 name[4]=0;
03068 sprintf(namcur, "%s_%d/", name, copy);
03069 nch = strlen(fPath);
03070 namcur = fPath+nch;
03071 }
03072 fPath[nch-1]=0;
03073 return fPath;
03074 }
03075
03076
03077 const char *TGeant3::GetNodeName()
03078 {
03079
03080 Int_t i=fGcvolu->nlevel-1;
03081 if (i<0) return "";
03082 Int_t gname = fGcvolu->names[i];
03083 Int_t copy = fGcvolu->number[i];
03084 char name[10];
03085 memcpy(name, &gname, 4);
03086 name[4] = 0;
03087 sprintf(fPath, "%s_%d", name, copy);
03088 return fPath;
03089 }
03090
03091
03092 Double_t TGeant3::Edep() const
03093 {
03094
03095
03096
03097 return fGctrak->destep;
03098 }
03099
03100
03101 Double_t TGeant3::Etot() const
03102 {
03103
03104
03105
03106 return fGctrak->getot;
03107 }
03108
03109
03110
03111
03112
03113
03114
03115
03116 void TGeant3::Gfile(const char * , const char * )
03117 {
03118
03119
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143 }
03144
03145
03146 void TGeant3::Gpcxyz()
03147 {
03148
03149
03150
03151
03152 g3pcxyz();
03153 }
03154
03155 void TGeant3::Ggclos()
03156 {
03157
03158
03159
03160
03161
03162
03163
03164
03165
03166
03167
03168
03169
03170
03171
03172
03173
03174
03175
03176 g3gclos();
03177
03178 fVolNames = new char[fGcnum->nvolum+1][5];
03179 Int_t i;
03180 for(i=0; i<fGcnum->nvolum; ++i) {
03181 strncpy(fVolNames[i], (char *) &fZiq[fGclink->jvolum+i+1], 4);
03182 fVolNames[i][4]='\0';
03183 }
03184 strcpy(fVolNames[fGcnum->nvolum],"NULL");
03185 }
03186
03187
03188 void TGeant3::Glast()
03189 {
03190
03191
03192
03193 g3last();
03194 }
03195
03196
03197 void TGeant3::Gprint(const char *name)
03198 {
03199
03200
03201
03202
03203 char vname[5];
03204 Vname(name,vname);
03205 g3print(PASSCHARD(vname),0 PASSCHARL(vname));
03206 }
03207
03208
03209 void TGeant3::Grun()
03210 {
03211
03212
03213
03214 g3run();
03215 }
03216
03217
03218 void TGeant3::Gtrig()
03219 {
03220
03221
03222
03223 g3trig();
03224
03225
03226
03227
03228
03229 }
03230
03231
03232 void TGeant3::Gtrigc()
03233 {
03234
03235
03236
03237 g3trigc();
03238 }
03239
03240
03241 void TGeant3::Gtrigi()
03242 {
03243
03244
03245
03246 g3trigi();
03247 }
03248
03249
03250 void TGeant3::Gwork(Int_t nwork)
03251 {
03252
03253
03254
03255 g3work(nwork);
03256 }
03257
03258
03259 void TGeant3::Gzinit()
03260 {
03261
03262
03263
03264 g3zinit();
03265 }
03266
03267
03268
03269
03270
03271
03272
03273
03274 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
03275 Float_t &dens, Float_t &radl, Float_t &absl,
03276 Float_t* ubuf, Int_t& nbuf)
03277 {
03278
03279
03280
03281 g3fmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
03282 PASSCHARL(name));
03283 }
03284
03285
03286 void TGeant3::Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,
03287 Double_t &dens, Double_t &radl, Double_t &absl,
03288 Double_t* ubuf, Int_t& nbuf)
03289 {
03290
03291
03292
03293 Float_t fa = a;
03294 Float_t fz = z;
03295 Float_t fdens = dens;
03296 Float_t fradl = radl;
03297 Float_t fabsl = absl;
03298 Float_t* fubuf = CreateFloatArray(ubuf, nbuf);
03299
03300 Gfmate(imat, name, fa, fz, fdens, fradl, fabsl, fubuf, nbuf);
03301
03302 a = fa;
03303 z = fz;
03304 dens = fdens;
03305 radl = fradl;
03306 absl = fabsl;
03307 for (Int_t i=0; i<nbuf; i++) ubuf[i] = fubuf[i];
03308
03309 delete [] fubuf;
03310 }
03311
03312
03313 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
03314 Float_t &amass, Float_t &charge, Float_t &tlife) const
03315 {
03316
03317
03318
03319
03320 Float_t ubuf[100];
03321 Int_t nbuf;
03322 Int_t igpart = IdFromPDG(ipart);
03323 g3fpart(igpart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
03324 PASSCHARL(name));
03325 }
03326
03327
03328
03329
03330 void TGeant3::Gppart(Int_t ipart)
03331 {
03332
03333
03334
03335
03336
03337
03338 Int_t igpart = 0;
03339 if ( ipart != 0 ) igpart = IdFromPDG(ipart);
03340 g3ppart(igpart);
03341
03342 }
03343
03344
03345
03346 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
03347 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
03348 Float_t &stemax, Float_t &deemax, Float_t &epsil,
03349 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
03350 {
03351
03352
03353
03354 g3ftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
03355 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
03356 }
03357
03358
03359
03360
03361 void TGeant3::Gptmed(Int_t numed)
03362 {
03363
03364
03365
03366 g3ptmed(numed);
03367
03368 }
03369
03370
03371
03372 void TGeant3::Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
03373 Float_t* tkin, Float_t* value, Float_t* pcut,
03374 Int_t &ixst)
03375 {
03376
03377
03378
03379 g3ftmat(imate, ipart, PASSCHARD(chmeca), kdim,
03380 tkin, value, pcut, ixst PASSCHARL(chmeca));
03381
03382 }
03383
03384
03385 Float_t TGeant3::Gbrelm(Float_t z, Float_t t, Float_t bcut)
03386 {
03387
03388
03389
03390 return g3brelm(z,t,bcut);
03391 }
03392
03393
03394 Float_t TGeant3::Gprelm(Float_t z, Float_t t, Float_t bcut)
03395 {
03396
03397
03398
03399 return g3prelm(z,t,bcut);
03400 }
03401
03402
03403 void TGeant3::Gmate()
03404 {
03405
03406
03407
03408 g3mate();
03409 }
03410
03411
03412 void TGeant3::Gpart()
03413 {
03414
03415
03416
03417
03418 g3part();
03419 }
03420
03421
03422 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
03423 {
03424
03425
03426 g3sdk(ipart,bratio,mode);
03427 }
03428
03429
03430 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
03431 Float_t dens, Float_t radl, Float_t absl)
03432 {
03433
03434
03435
03436
03437
03438
03439
03440
03441
03442
03443
03444
03445
03446
03447
03448
03449
03450 Float_t *ubuf=0;
03451 Int_t nbuf=0;
03452 if (dens <= 0 && a != 0 && z != 0) {
03453 Warning("Gsmate","Density was o, set to 0.01 for imat=%d, name=%s",
03454 imat,name);
03455 dens = 0.01;
03456 }
03457 g3smate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
03458 PASSCHARL(name));
03459 }
03460
03461
03462 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
03463 Float_t dens, Int_t nlmat, Float_t *wmat)
03464 {
03465
03466
03467
03468
03469
03470
03471
03472
03473
03474
03475
03476
03477 g3smixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
03478 }
03479
03480
03481 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
03482 Double_t amass, Double_t charge, Double_t tlife)
03483 {
03484
03485
03486
03487
03488
03489
03490
03491
03492
03493
03494 Float_t *ubuf=0;
03495 Int_t nbuf=0;
03496 Float_t fmass = amass;
03497 Float_t fcharge = charge;
03498 Float_t flife = tlife;
03499
03500 g3spart(ipart,PASSCHARD(name), itrtyp, fmass, fcharge, flife, ubuf, nbuf
03501 PASSCHARL(name));
03502 }
03503
03504
03505 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
03506 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
03507 Float_t stemax, Float_t deemax, Float_t epsil,
03508 Float_t stmin)
03509 {
03510
03511
03512
03513
03514
03515
03516
03517
03518
03519
03520
03521
03522
03523
03524
03525
03526
03527 Float_t *ubuf=0;
03528 Int_t nbuf=0;
03529 g3stmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
03530 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
03531 }
03532
03533
03534 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
03535 Float_t *absco, Float_t *effic, Float_t *rindex)
03536 {
03537
03538
03539
03540
03541
03542
03543
03544
03545
03546
03547
03548
03549
03550
03551
03552 g3sckov(itmed,npckov,ppckov,absco,effic,rindex);
03553 }
03554
03555
03556 void TGeant3::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
03557 Float_t *absco, Float_t *effic, Float_t *rindex)
03558 {
03559
03560
03561
03562
03563
03564
03565
03566
03567
03568
03569
03570
03571
03572
03573
03574 g3sckov(itmed,npckov,ppckov,absco,effic,rindex);
03575 }
03576
03577
03578 void TGeant3::SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
03579 Double_t *absco, Double_t *effic, Double_t *rindex)
03580 {
03581
03582
03583
03584
03585
03586
03587
03588
03589
03590
03591
03592
03593
03594
03595
03596
03597 Float_t* fppckov = CreateFloatArray(ppckov, npckov);
03598 Float_t* fabsco = CreateFloatArray(absco, npckov);
03599 Float_t* feffic = CreateFloatArray(effic, npckov);
03600 Float_t* frindex = CreateFloatArray(rindex, npckov);
03601
03602 SetCerenkov(itmed, npckov, fppckov, fabsco, feffic, frindex);
03603
03604 delete [] fppckov;
03605 delete [] fabsco;
03606 delete [] feffic;
03607 delete [] frindex;
03608 }
03609
03610
03611 void TGeant3::DefineOpSurface(const char* ,
03612 EMCOpSurfaceModel , EMCOpSurfaceType ,
03613 EMCOpSurfaceFinish , Double_t )
03614 {
03615
03616 Warning("DefineOpSurface",
03617 "Not applicable in Geant3 - setting is ignored.");
03618 }
03619
03620
03621 void TGeant3::SetBorderSurface(const char* ,
03622 const char* , int ,
03623 const char* , int ,
03624 const char* )
03625 {
03626 Warning("SetBorderSurface",
03627 "Not applicable in Geant3 - setting is ignored.");
03628 }
03629
03630
03631 void TGeant3::SetSkinSurface(const char* ,
03632 const char* ,
03633 const char* )
03634 {
03635 Warning("SetSkinSurface",
03636 "Not applicable in Geant3 - setting is ignored.");
03637 }
03638
03639
03640 void TGeant3::SetMaterialProperty(
03641 Int_t , const char* ,
03642 Int_t , Double_t* , Double_t* )
03643 {
03644 Warning("SetMaterialProperty",
03645 "Not applicable in Geant3 - setting is ignored.");
03646 }
03647
03648
03649 void TGeant3::SetMaterialProperty(
03650 Int_t , const char* ,
03651 Double_t )
03652 {
03653 Warning("SetMaterialProperty",
03654 "Not applicable in Geant3 - setting is ignored.");
03655 }
03656
03657
03658 void TGeant3::SetMaterialProperty(
03659 const char* , const char* ,
03660 Int_t , Double_t* , Double_t* )
03661 {
03662 Warning("SetMaterialProperty",
03663 "Not applicable in Geant3 - setting is ignored.");
03664 }
03665
03666
03667 void TGeant3::Gstpar(Int_t itmed, const char *param, Double_t parval)
03668 {
03669
03670
03671
03672
03673
03674
03675
03676
03677
03678
03679
03680
03681
03682 Float_t fparval = parval;
03683 g3stpar(itmed,PASSCHARD(param), fparval PASSCHARL(param));
03684 }
03685
03686
03687
03688
03689
03690
03691
03692
03693 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert,
03694 Int_t &ipart, Int_t &nvert)
03695 {
03696
03697
03698
03699
03700
03701
03702
03703
03704
03705
03706
03707
03708
03709
03710
03711
03712
03713
03714
03715
03716
03717
03718
03719
03720
03721
03722
03723
03724
03725
03726
03727
03728 Float_t *ubuf=0;
03729 Int_t nbuf;
03730 g3fkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
03731 }
03732
03733
03734 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
03735 Float_t &tofg)
03736 {
03737
03738
03739
03740
03741
03742 Float_t *ubuf=0;
03743 Int_t nbuf;
03744 g3fvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
03745 }
03746
03747
03748 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
03749 Int_t nwbuf)
03750 {
03751
03752
03753
03754
03755 Int_t nt = 0;
03756 g3skine(plab, ipart, nv, buf, nwbuf, nt);
03757 return nt;
03758 }
03759
03760
03761 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
03762 Int_t nwbuf)
03763 {
03764
03765
03766
03767
03768
03769 Int_t nwtx = 0;
03770 g3svert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
03771 return nwtx;
03772 }
03773
03774
03775
03776
03777
03778
03779
03780
03781 void TGeant3::Gphysi()
03782 {
03783
03784
03785
03786
03787 g3physi();
03788 }
03789
03790
03791
03792
03793
03794
03795
03796
03797 void TGeant3::Gdebug()
03798 {
03799
03800
03801
03802 g3debug();
03803 }
03804
03805
03806 void TGeant3::Gekbin()
03807 {
03808
03809
03810
03811
03812 g3ekbin();
03813 }
03814
03815
03816 void TGeant3::Gfinds()
03817 {
03818
03819
03820
03821
03822
03823
03824
03825
03826
03827
03828
03829
03830
03831 g3finds();
03832 }
03833
03834
03835 void TGeant3::Gsking(Int_t igk)
03836 {
03837
03838
03839
03840
03841 g3sking(igk);
03842 }
03843
03844
03845 void TGeant3::Gskpho(Int_t igk)
03846 {
03847
03848
03849
03850
03851 g3skpho(igk);
03852 }
03853
03854
03855 void TGeant3::Gsstak(Int_t iflag)
03856 {
03857
03858
03859
03860
03861
03862
03863
03864
03865
03866
03867
03868 g3sstak(iflag);
03869 }
03870
03871
03872 void TGeant3::Gsxyz()
03873 {
03874
03875
03876
03877 g3sxyz();
03878 }
03879
03880
03881 void TGeant3::Gtrack()
03882 {
03883
03884
03885
03886 g3track();
03887 }
03888
03889
03890 void TGeant3::Gtreve()
03891 {
03892
03893
03894
03895 g3treve();
03896 }
03897
03898
03899 void TGeant3::GtreveRoot()
03900 {
03901
03902
03903
03904 gtreveroot();
03905 }
03906
03907
03908 void TGeant3::Grndm(Float_t *rvec, Int_t len) const
03909 {
03910
03911
03912
03913 TRandom* r=gMC->GetRandom();
03914 for(Int_t i=0; i<len; rvec[i++]=r->Rndm()) {};
03915 }
03916
03917
03918 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, Int_t ,
03919 const Text_t *)
03920 {
03921
03922
03923
03924
03925 is1 = gRandom->GetSeed();
03926 is2 = 0;
03927 }
03928
03929
03930
03931
03932
03933
03934
03935
03936 void TGeant3::Gdxyz(Int_t )
03937 {
03938
03939
03940
03941 }
03942
03943
03944 void TGeant3::Gdcxyz()
03945 {
03946
03947
03948
03949 }
03950
03951
03952
03953
03954
03955
03956
03957
03958 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
03959 {
03960
03961
03962
03963
03964
03965
03966
03967
03968
03969
03970
03971 g3dtom(xd, xm, iflag);
03972 }
03973
03974
03975 void TGeant3::Gdtom(Double_t *xd, Double_t *xm, Int_t iflag)
03976 {
03977
03978
03979
03980
03981
03982
03983
03984
03985
03986
03987
03988
03989 Float_t* fxd = CreateFloatArray(xd, 3);
03990 Float_t* fxm = CreateFloatArray(xm, 3);
03991
03992 Gdtom(fxd, fxm, iflag) ;
03993
03994 for (Int_t i=0; i<3; i++) {
03995 xd[i] = fxd[i]; xm[i] = fxm[i];
03996 }
03997
03998 delete [] fxd;
03999 delete [] fxm;
04000 }
04001
04002
04003 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev,
04004 Int_t *lvols, Int_t *lindx)
04005 {
04006
04007
04008
04009
04010
04011
04012
04013
04014 Int_t *idum=0;
04015 g3lmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
04016 }
04017
04018
04019 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
04020 {
04021
04022
04023
04024
04025
04026
04027
04028
04029 static Int_t check = 0;
04030 g3media(x,numed,check);
04031 }
04032
04033
04034 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
04035 {
04036
04037
04038
04039
04040
04041
04042
04043
04044
04045
04046
04047
04048 g3mtod(xm, xd, iflag);
04049 }
04050
04051
04052 void TGeant3::Gmtod(Double_t *xm, Double_t *xd, Int_t iflag)
04053 {
04054
04055
04056
04057
04058
04059
04060
04061
04062
04063
04064
04065
04066
04067
04068 Float_t* fxm = CreateFloatArray(xm, 3);
04069 Float_t* fxd = CreateFloatArray(xd, 3);
04070
04071 Gmtod(fxm, fxd, iflag) ;
04072
04073 for (Int_t i=0; i<3; i++) {
04074 xm[i] = fxm[i]; xd[i] = fxd[i];
04075 }
04076
04077 delete [] fxm;
04078 delete [] fxd;
04079 }
04080
04081
04082 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
04083 Int_t iaxis)
04084 {
04085
04086
04087
04088
04089
04090
04091
04092
04093
04094
04095
04096 char vname[5];
04097 Vname(name,vname);
04098 char vmother[5];
04099 Vname(mother,vmother);
04100
04101 g3sdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
04102 PASSCHARL(vmother));
04103 }
04104
04105
04106 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
04107 Int_t iaxis, Double_t c0i, Int_t numed)
04108 {
04109
04110
04111
04112
04113
04114
04115
04116 char vname[5];
04117 Vname(name,vname);
04118 char vmother[5];
04119 Vname(mother,vmother);
04120
04121 Float_t fc0i = c0i;
04122 g3sdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, fc0i, numed
04123 PASSCHARL(vname) PASSCHARL(vmother));
04124 }
04125
04126
04127 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
04128 Int_t iaxis, Int_t numed)
04129 {
04130
04131
04132
04133 char vname[5];
04134 Vname(name,vname);
04135 char vmother[5];
04136 Vname(mother,vmother);
04137
04138 g3sdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
04139 PASSCHARL(vname) PASSCHARL(vmother));
04140 }
04141
04142
04143 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
04144 Int_t iaxis, Float_t c0, Int_t numed)
04145 {
04146
04147
04148
04149 char vname[5];
04150 Vname(name,vname);
04151 char vmother[5];
04152 Vname(mother,vmother);
04153
04154 g3sdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
04155 PASSCHARL(vname) PASSCHARL(vmother));
04156 }
04157
04158
04159 void TGeant3::Gsdvt(const char *name, const char *mother, Double_t step,
04160 Int_t iaxis, Int_t numed, Int_t ndvmx)
04161 {
04162
04163
04164
04165
04166
04167
04168
04169
04170
04171
04172
04173 char vname[5];
04174 Vname(name,vname);
04175 char vmother[5];
04176 Vname(mother,vmother);
04177
04178 Float_t fstep = step;
04179 g3sdvt(PASSCHARD(vname), PASSCHARD(vmother), fstep, iaxis, numed, ndvmx
04180 PASSCHARL(vname) PASSCHARL(vmother));
04181 }
04182
04183
04184 void TGeant3::Gsdvt2(const char *name, const char *mother, Double_t step,
04185 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)
04186 {
04187
04188
04189
04190
04191
04192
04193
04194
04195
04196
04197
04198 char vname[5];
04199 Vname(name,vname);
04200 char vmother[5];
04201 Vname(mother,vmother);
04202
04203 Float_t fstep = step;
04204 Float_t fc0 = c0;
04205 g3sdvt2(PASSCHARD(vname), PASSCHARD(vmother), fstep, iaxis, fc0,
04206 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
04207 }
04208
04209
04210 void TGeant3::Gsord(const char *name, Int_t iax)
04211 {
04212
04213
04214
04215
04216
04217
04218
04219
04220
04221
04222
04223
04224
04225
04226 char vname[5];
04227 Vname(name,vname);
04228 g3sord(PASSCHARD(vname), iax PASSCHARL(vname));
04229 }
04230
04231
04232 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother,
04233 Double_t x, Double_t y, Double_t z, Int_t irot,
04234 const char *konly)
04235 {
04236
04237
04238
04239
04240
04241
04242
04243
04244
04245
04246
04247
04248
04249
04250
04251 TString only = konly;
04252 only.ToLower();
04253 Bool_t isOnly = kFALSE;
04254 if (only.Contains("only")) isOnly = kTRUE;
04255 char vname[5];
04256 Vname(name,vname);
04257 char vmother[5];
04258 Vname(mother,vmother);
04259
04260 Float_t fx = x;
04261 Float_t fy = y;
04262 Float_t fz = z;
04263 g3spos(PASSCHARD(vname), nr, PASSCHARD(vmother), fx, fy, fz, irot,
04264 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
04265 PASSCHARL(konly));
04266 }
04267
04268
04269 void TGeant3::G3Gsposp(const char *name, Int_t nr, const char *mother,
04270 Double_t x, Double_t y, Double_t z, Int_t irot,
04271 const char *konly, Float_t *upar, Int_t np )
04272 {
04273
04274
04275
04276
04277 TString only = konly;
04278 only.ToLower();
04279 Bool_t isOnly = kFALSE;
04280 if (only.Contains("only")) isOnly = kTRUE;
04281 char vname[5];
04282 Vname(name,vname);
04283 char vmother[5];
04284 Vname(mother,vmother);
04285
04286 Float_t fx = x;
04287 Float_t fy = y;
04288 Float_t fz = z;
04289 g3sposp(PASSCHARD(vname), nr, PASSCHARD(vmother), fx, fy, fz, irot,
04290 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
04291 PASSCHARL(konly));
04292 }
04293
04294
04295 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
04296 Double_t x, Double_t y, Double_t z, Int_t irot,
04297 const char *konly, Float_t *upar, Int_t np )
04298 {
04299
04300
04301
04302
04303
04304 G3Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
04305 }
04306
04307
04308 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
04309 Double_t x, Double_t y, Double_t z, Int_t irot,
04310 const char *konly, Double_t *upar, Int_t np )
04311 {
04312
04313
04314
04315
04316
04317 Float_t* fupar = CreateFloatArray(upar, np);
04318 G3Gsposp(name, nr, mother, x, y, z, irot, konly, fupar, np);
04319 delete [] fupar;
04320 }
04321
04322
04323 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
04324 Float_t phi2, Float_t theta3, Float_t phi3)
04325 {
04326
04327
04328
04329
04330
04331
04332
04333
04334
04335
04336
04337
04338 g3srotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
04339 }
04340
04341
04342 void TGeant3::Gprotm(Int_t nmat)
04343 {
04344
04345
04346
04347
04348 g3protm(nmat);
04349 }
04350
04351
04352 Int_t TGeant3::G3Gsvolu(const char *name, const char *shape, Int_t nmed,
04353 Float_t *upar, Int_t npar)
04354 {
04355
04356
04357
04358
04359
04360
04361
04362
04363
04364 Int_t ivolu = 0;
04365 char vname[5];
04366 Vname(name,vname);
04367 char vshape[5];
04368 Vname(shape,vshape);
04369
04370 g3svolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
04371 PASSCHARL(vname) PASSCHARL(vshape));
04372
04373 return ivolu;
04374 }
04375
04376 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
04377 Float_t *upar, Int_t npar)
04378 {
04379
04380
04381
04382
04383
04384
04385
04386
04387
04388
04389 Int_t ivolu = 0;
04390 ivolu = G3Gsvolu(name, shape, nmed, upar, npar);
04391 return ivolu;
04392
04393 }
04394
04395
04396 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
04397 Double_t *upar, Int_t npar)
04398 {
04399
04400
04401
04402
04403
04404
04405
04406
04407
04408
04409
04410 Int_t ivolu = 0;
04411 Float_t* fupar = CreateFloatArray(upar, npar);
04412 ivolu = G3Gsvolu(name, shape, nmed, fupar, npar);
04413 delete [] fupar;
04414 return ivolu;
04415 }
04416
04417
04418
04419
04420
04421
04422
04423
04424
04425
04426
04427
04428
04429
04430
04431
04432
04433
04434
04435
04436
04437
04438
04439
04440
04441
04442
04443
04444
04445
04446
04447
04448
04449
04450
04451
04452
04453
04454
04455
04456
04457
04458
04459
04460
04461
04462
04463
04464
04465
04466
04467
04468
04469
04470
04471
04472
04473
04474 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
04475 {
04476
04477
04478
04479
04480
04481
04482
04483
04484
04485
04486
04487
04488
04489
04490
04491
04492
04493
04494
04495
04496
04497
04498
04499
04500
04501
04502
04503
04504
04505
04506
04507
04508
04509
04510
04511
04512
04513
04514
04515
04516
04517
04518
04519
04520
04521
04522
04523
04524
04525
04526
04527
04528
04529
04530
04531
04532
04533
04534
04535
04536
04537
04538
04539
04540
04541
04542
04543
04544
04545
04546
04547
04548
04549
04550
04551
04552
04553
04554
04555
04556
04557
04558
04559 char vname[5];
04560 Vname(name,vname);
04561 char vatt[5];
04562 Vname(att,vatt);
04563 g3satt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
04564 PASSCHARL(vatt));
04565 }
04566
04567
04568 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
04569 Int_t& natt, Float_t* par, Float_t* att)
04570 {
04571
04572
04573
04574 g3fpara(PASSCHARD(name), number, intext, npar, natt, par, att
04575 PASSCHARL(name));
04576 }
04577
04578
04579 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
04580 {
04581
04582
04583
04584 gckpar(ish,npar,par);
04585 }
04586
04587
04588 void TGeant3::Gckmat(Int_t itmed, char* natmed)
04589 {
04590
04591
04592
04593 g3ckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
04594 }
04595
04596
04597 Int_t TGeant3::Glvolu(Int_t nlev, Int_t *lnam,Int_t *lnum)
04598 {
04599
04600
04601
04602
04603
04604
04605
04606
04607
04608
04609
04610
04611
04612
04613
04614
04615
04616 Int_t ier;
04617 g3lvolu(nlev, lnam, lnum, ier);
04618 return ier;
04619 }
04620
04621
04622 void TGeant3::Gdelete(Int_t )
04623 {
04624
04625
04626
04627
04628
04629 }
04630
04631
04632 void TGeant3::Gdopen(Int_t )
04633 {
04634
04635
04636
04637
04638
04639
04640
04641
04642
04643
04644
04645
04646 }
04647
04648
04649 void TGeant3::Gdclose()
04650 {
04651
04652
04653
04654
04655 }
04656
04657
04658 void TGeant3::Gdshow(Int_t )
04659 {
04660
04661
04662
04663
04664
04665
04666 }
04667
04668
04669 void TGeant3::Gdopt(const char *name,const char *value)
04670 {
04671
04672
04673
04674
04675
04676
04677
04678
04679
04680
04681
04682
04683
04684
04685
04686
04687
04688
04689
04690
04691
04692
04693
04694
04695
04696
04697
04698
04699
04700 char vname[5];
04701 Vname(name,vname);
04702 char vvalue[5];
04703 Vname(value,vvalue);
04704
04705
04706 }
04707
04708
04709 void TGeant3::Gdraw(const char* ,Double_t , Double_t ,
04710 Double_t , Double_t , Double_t , Double_t ,
04711 Double_t )
04712 {
04713
04714
04715
04716
04717
04718
04719
04720
04721
04722
04723
04724
04725
04726
04727
04728
04729
04730
04731
04732
04733
04734
04735
04736
04737
04738
04739
04740
04741
04742
04743
04744
04745
04746
04747 }
04748
04749
04750 void TGeant3::Gdrawc(const char* ,Int_t , Float_t , Float_t ,
04751 Float_t , Float_t , Float_t )
04752 {
04753
04754
04755
04756
04757
04758
04759
04760
04761
04762
04763
04764
04765
04766
04767
04768
04769 }
04770
04771
04772 void TGeant3::Gdrawx(const char* , Float_t , Float_t ,
04773 Float_t , Float_t , Float_t , Float_t ,
04774 Float_t ,Float_t , Float_t )
04775 {
04776
04777
04778
04779
04780
04781
04782
04783
04784
04785
04786
04787
04788
04789
04790
04791
04792
04793 }
04794
04795
04796 void TGeant3::Gdhead(Int_t , const char* , Double_t )
04797 {
04798
04799
04800
04801
04802
04803
04804
04805
04806
04807
04808
04809
04810
04811
04812
04813
04814
04815
04816 }
04817
04818
04819 void TGeant3::Gdman(Double_t , Double_t , const char* )
04820 {
04821
04822
04823
04824
04825
04826
04827
04828
04829
04830
04831
04832
04833 }
04834
04835
04836 void TGeant3::Gdspec(const char* )
04837 {
04838
04839
04840
04841
04842
04843
04844
04845
04846
04847 }
04848
04849
04850 void TGeant3::DrawOneSpec(const char* )
04851 {
04852
04853
04854
04855
04856 }
04857
04858
04859 void TGeant3::Gdtree(const char* , Int_t , Int_t )
04860 {
04861
04862
04863
04864
04865
04866
04867
04868
04869
04870
04871
04872
04873
04874
04875 }
04876
04877
04878 void TGeant3::GdtreeParent(const char* , Int_t , Int_t )
04879 {
04880
04881
04882
04883
04884
04885
04886
04887 }
04888
04889
04890 void TGeant3::SetABAN(Int_t par)
04891 {
04892
04893
04894
04895
04896
04897
04898 fGcphys->dphys1 = par;
04899 SetBit(kABAN);
04900 }
04901
04902
04903
04904 void TGeant3::SetANNI(Int_t par)
04905 {
04906
04907
04908
04909
04910
04911
04912 fGcphys->ianni = par;
04913 }
04914
04915
04916
04917 void TGeant3::SetAUTO(Int_t par)
04918 {
04919
04920
04921
04922
04923
04924 fGctrak->igauto = par;
04925 SetBit(kAUTO);
04926 }
04927
04928
04929
04930 void TGeant3::SetBOMB(Float_t )
04931 {
04932
04933
04934
04935
04936
04937
04938
04939
04940
04941
04942
04943
04944
04945
04946
04947
04948
04949 }
04950
04951
04952 void TGeant3::SetBREM(Int_t par)
04953 {
04954
04955
04956
04957
04958
04959
04960 fGcphys->ibrem = par;
04961 }
04962
04963
04964
04965 void TGeant3::SetCKOV(Int_t par)
04966 {
04967
04968
04969
04970
04971
04972
04973 fGctlit->itckov = par;
04974 }
04975
04976
04977
04978 void TGeant3::SetClipBox(const char* , Double_t , Double_t ,
04979 Double_t , Double_t , Double_t , Double_t )
04980 {
04981
04982
04983
04984
04985
04986
04987
04988
04989
04990
04991
04992
04993
04994
04995
04996
04997
04998
04999
05000
05001
05002
05003
05004
05005
05006
05007 }
05008
05009
05010 void TGeant3::SetCOMP(Int_t par)
05011 {
05012
05013
05014
05015
05016
05017
05018
05019 fGcphys->icomp = par;
05020 }
05021
05022
05023
05024
05025 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
05026 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
05027 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
05028 Float_t ppcutm, Float_t tofmax, Float_t *gcuts)
05029 {
05030
05031
05032
05033
05034
05035
05036
05037
05038
05039
05040
05041
05042
05043
05044
05045
05046
05047
05048
05049
05050 fGccuts->cutgam = cutgam;
05051 fGccuts->cutele = cutele;
05052 fGccuts->cutneu = cutneu;
05053 fGccuts->cuthad = cuthad;
05054 fGccuts->cutmuo = cutmuo;
05055 fGccuts->bcute = bcute;
05056 fGccuts->bcutm = bcutm;
05057 fGccuts->dcute = dcute;
05058 fGccuts->dcutm = dcutm;
05059 fGccuts->ppcutm = ppcutm;
05060 fGccuts->tofmax = tofmax;
05061
05062
05063 if ( gcuts != 0 ) {
05064 fGccuts->gcuts[0] = gcuts[0];
05065 fGccuts->gcuts[1] = gcuts[1];
05066 fGccuts->gcuts[2] = gcuts[2];
05067 fGccuts->gcuts[3] = gcuts[3];
05068 fGccuts->gcuts[4] = gcuts[4];
05069 }
05070
05071 }
05072
05073
05074
05075 void TGeant3::SetECut(Float_t gcalpha)
05076 {
05077 fGcmore->gcalpha = gcalpha;
05078 }
05079
05080 void TGeant3::SetClose(Int_t iclose,Float_t *pf,Float_t dstrt,
05081 Float_t *w1, Float_t *w2,
05082 Float_t *p1,Float_t *p2,Float_t *p3,Float_t *clen)
05083 {
05084 fGcmore->iclose = iclose;
05085 fGcmore->pfinal[0] = pf[0];
05086 fGcmore->pfinal[1] = pf[1];
05087 fGcmore->pfinal[2] = pf[2];
05088 fGcmore->dstrt = dstrt;
05089 fGcmore->wire1[0] = w1[0];
05090 fGcmore->wire1[1] = w1[1];
05091 fGcmore->wire1[2] = w1[2];
05092 fGcmore->wire2[0] = w2[0];
05093 fGcmore->wire2[1] = w2[1];
05094 fGcmore->wire2[2] = w2[2];
05095 fGcmore->p1[0] = p1[0];
05096 fGcmore->p1[1] = p1[1];
05097 fGcmore->p1[2] = p1[2];
05098 fGcmore->p2[0] = p2[0];
05099 fGcmore->p2[1] = p2[1];
05100 fGcmore->p2[2] = p2[2];
05101 fGcmore->p3[0] = p3[0];
05102 fGcmore->p3[1] = p3[1];
05103 fGcmore->p3[2] = p3[2];
05104 fGcmore->cleng[0] = clen[0];
05105 fGcmore->cleng[1] = clen[1];
05106 fGcmore->cleng[2] = clen[2];
05107 }
05108
05109 void TGeant3::GetClose(Float_t *p1,Float_t *p2,Float_t *p3,Float_t *len)
05110 {
05111 p1[0] = fGcmore->p1[0];
05112 p1[1] = fGcmore->p1[1];
05113 p1[2] = fGcmore->p1[2];
05114 p2[0] = fGcmore->p2[0];
05115 p2[1] = fGcmore->p2[1];
05116 p2[2] = fGcmore->p2[2];
05117 p3[0] = fGcmore->p3[0];
05118 p3[1] = fGcmore->p3[1];
05119 p3[2] = fGcmore->p3[2];
05120 len[0] = fGcmore->cleng[0];
05121 len[1] = fGcmore->cleng[1];
05122 len[2] = fGcmore->cleng[2];
05123 }
05124
05125
05126 void TGeant3::SetDCAY(Int_t par)
05127 {
05128
05129
05130
05131
05132
05133
05134 fGcphys->idcay = par;
05135 }
05136
05137
05138
05139 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
05140 {
05141
05142
05143
05144
05145
05146 fGcflag->idemin = emin;
05147 fGcflag->idemax = emax;
05148 fGcflag->itest = emod;
05149 SetBit(kDEBU);
05150 }
05151
05152
05153
05154 void TGeant3::SetDRAY(Int_t par)
05155 {
05156
05157
05158
05159
05160
05161
05162 fGcphys->idray = par;
05163 }
05164
05165
05166 void TGeant3::SetERAN(Float_t ekmin, Float_t ekmax, Int_t nekbin)
05167 {
05168
05169
05170
05171
05172
05173
05174 fGcmulo->ekmin = ekmin;
05175 fGcmulo->ekmax = ekmax;
05176 fGcmulo->nekbin = nekbin;
05177 SetBit(kERAN);
05178 }
05179
05180
05181 void TGeant3::SetHADR(Int_t par)
05182 {
05183
05184
05185
05186
05187
05188
05189 fGcphys->ihadr = par;
05190 }
05191
05192
05193 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
05194 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
05195 Float_t xk8, Float_t xk9, Float_t xk10)
05196 {
05197
05198
05199
05200
05201 fGckine->ikine = kine;
05202 fGckine->pkine[0] = xk1;
05203 fGckine->pkine[1] = xk2;
05204 fGckine->pkine[2] = xk3;
05205 fGckine->pkine[3] = xk4;
05206 fGckine->pkine[4] = xk5;
05207 fGckine->pkine[5] = xk6;
05208 fGckine->pkine[6] = xk7;
05209 fGckine->pkine[7] = xk8;
05210 fGckine->pkine[8] = xk9;
05211 fGckine->pkine[9] = xk10;
05212 }
05213
05214
05215 void TGeant3::SetLOSS(Int_t par)
05216 {
05217
05218
05219
05220
05221
05222
05223
05224
05225
05226
05227 fGcphys->iloss = par;
05228 }
05229
05230
05231
05232 void TGeant3::SetMULS(Int_t par)
05233 {
05234
05235
05236
05237
05238
05239
05240
05241 fGcphys->imuls = par;
05242 }
05243
05244
05245
05246 void TGeant3::SetMUNU(Int_t par)
05247 {
05248
05249
05250
05251
05252
05253
05254 fGcphys->imunu = par;
05255 }
05256
05257
05258 void TGeant3::SetOPTI(Int_t par)
05259 {
05260
05261
05262
05263
05264
05265
05266
05267
05268 fGcopti->ioptim = par;
05269 SetBit(kOPTI);
05270 }
05271
05272
05273 void TGeant3::SetPAIR(Int_t par)
05274 {
05275
05276
05277
05278
05279
05280
05281 fGcphys->ipair = par;
05282 }
05283
05284
05285
05286 void TGeant3::SetPFIS(Int_t par)
05287 {
05288
05289
05290
05291
05292
05293
05294 fGcphys->ipfis = par;
05295 }
05296
05297
05298 void TGeant3::SetPHOT(Int_t par)
05299 {
05300
05301
05302
05303
05304
05305
05306 fGcphys->iphot = par;
05307 }
05308
05309
05310 void TGeant3::SetRAYL(Int_t par)
05311 {
05312
05313
05314
05315
05316
05317 fGcphys->irayl = par;
05318 }
05319
05320
05321 void TGeant3::SetSTRA(Int_t par)
05322 {
05323
05324
05325
05326
05327
05328
05329 fGcphlt->istra = par;
05330 }
05331
05332
05333 void TGeant3::SetSWIT(Int_t sw, Int_t val)
05334 {
05335
05336
05337
05338
05339
05340
05341 if (sw <= 0 || sw > 10) return;
05342 fGcflag->iswit[sw-1] = val;
05343 SetBit(kSWIT);
05344 }
05345
05346
05347
05348 void TGeant3::SetTRIG(Int_t nevents)
05349 {
05350
05351
05352
05353 fGcflag->nevent = nevents;
05354 SetBit(kTRIG);
05355 }
05356
05357
05358 void TGeant3::SetUserDecay(Int_t pdg)
05359 {
05360
05361
05362
05363
05364
05365 Int_t ipart = IdFromPDG(pdg);
05366 if(ipart<0) {
05367 printf("Particle %d not in geant\n",pdg);
05368 return;
05369 }
05370 Int_t jpart=fGclink->jpart;
05371 Int_t jpa=fZlq[jpart-ipart];
05372
05373 if(jpart && jpa) {
05374 Int_t jpa1=fZlq[jpa-1];
05375 if(jpa1)
05376 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
05377 Int_t jpa2=fZlq[jpa-2];
05378 if(jpa2)
05379 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
05380 }
05381 }
05382
05383 Bool_t TGeant3::SetDecayMode(Int_t pdg, Float_t bratio[6], Int_t mode[6][3])
05384 {
05385
05386
05387
05388 if ( pdg == 0 ) {
05389 printf("Cannot define decay mode for particle with PDG=0");
05390 return false;
05391 }
05392
05393 if ( IdFromPDG(pdg) < 0 ) {
05394 printf("Particle %d not in geant\n",pdg);
05395 return false;
05396 }
05397
05398 SetUserDecay(pdg);
05399
05400 Int_t g3mode[6];
05401 Int_t id1,id2,id3;
05402 for (Int_t k1=0; k1<6; k1++) g3mode[k1]=0;
05403 for (Int_t k=0; k<6; k++) {
05404
05405 if(mode[k][0]!=0) {
05406 id1= IdFromPDG(mode[k][0]);
05407 if ( id1 < 0 ) {
05408 printf("Particle %d not in geant\n",mode[k][0]);
05409 return false;
05410 }
05411 }
05412 else id1=0;
05413
05414 if(mode[k][1]!=0) {
05415 id2= IdFromPDG(mode[k][1]);
05416 if ( id2 < 0 ) {
05417 printf("Particle %d not in geant\n",mode[k][1]);
05418 return false;
05419 }
05420 }
05421 else id2=0;
05422
05423 if(mode[k][2]!=0) {
05424 id3= IdFromPDG(mode[k][2]);
05425 if ( id3 < 0 ) {
05426 printf("Particle %d not in geant\n",mode[k][1]);
05427 return false;
05428 }
05429 }
05430 else id3=0;
05431 g3mode[k]=id1 + id2* 100+ id3 * 10000 ;
05432
05433 }
05434 Gsdk(IdFromPDG(pdg), bratio, g3mode);
05435 return kTRUE;
05436 }
05437
05438
05439 void TGeant3::Vname(const char *name, char *vname)
05440 {
05441
05442
05443
05444 Int_t l = strlen(name);
05445 Int_t i;
05446 l = l < 4 ? l : 4;
05447 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
05448 for (i=l;i<4;i++) vname[i] = ' ';
05449 vname[4] = 0;
05450 }
05451
05452
05453 void TGeant3::Ertrgo()
05454 {
05455
05456
05457
05458 ertrgo();
05459 }
05460
05461
05462 void TGeant3::Ertrak(const Float_t *x1, const Float_t *p1,
05463 const Float_t *x2, const Float_t *p2,
05464 Int_t ipa, Option_t *chopt)
05465 {
05466
05467
05468
05469
05470
05471
05472
05473
05474
05475
05476
05477
05478
05479
05480
05481
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491
05492
05493
05494
05495
05496
05497
05498
05499 ertrak(x1,p1,x2,p2,ipa,PASSCHARD(chopt) PASSCHARL(chopt));
05500 }
05501
05502 void TGeant3::Eufill(Int_t n,Float_t *ein,Float_t *xlf){
05503
05504
05505
05506
05507
05508
05509
05510
05511
05512
05513
05514
05515
05516
05517
05518 for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
05519 const Int_t mxpred=10;
05520 if (n<mxpred) {
05521 fErtrio->nepred=n;
05522 } else {
05523 fErtrio->nepred=mxpred;
05524 }
05525 for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
05526 for(Int_t i=0;i<fErtrio->nepred;i++) fEropts->erleng[i]=xlf[i];
05527
05528 }
05529
05530 void TGeant3::Eufilp(const Int_t n, Float_t *ein,
05531 Float_t *pli, Float_t *plf)
05532 {
05533
05534
05535
05536
05537
05538
05539
05540
05541
05542
05543
05544
05545
05546
05547
05548
05549
05550
05551
05552 for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
05553 const Int_t mxpred=10;
05554 if (n<mxpred) {
05555 fErtrio->nepred=n;
05556 } else {
05557 fErtrio->nepred=mxpred;
05558 }
05559 for(Int_t i=0;i<6;i++) fEropts->erpli[i]=pli[i];
05560
05561 for (Int_t j=0;j<n;j++) {
05562 for(Int_t i=0;i<9;i++) {
05563 fEropts->erplo[i+12*j]=plf[i+12*j];
05564 }
05565 TVector3 v1(fEropts->erplo[0+12*j],fEropts->erplo[1+12*j],fEropts->erplo[2+12*j]);
05566 TVector3 v2(fEropts->erplo[3+12*j],fEropts->erplo[4+12*j],fEropts->erplo[5+12*j]);
05567 TVector3 v3=v1.Cross(v2);
05568 fEropts->erplo[9]=v3(0);
05569 fEropts->erplo[10]=v3(1);
05570 fEropts->erplo[11]=v3(2);
05571 }
05572
05573
05574 }
05575 void TGeant3::Eufilv(Int_t n, Float_t *ein,
05576 Char_t *namv, Int_t *numv,Int_t *iovl)
05577 {
05578
05579
05580
05581
05582
05583
05584
05585
05586
05587
05588
05589
05590
05591
05592
05593
05594
05595 for(Int_t i=0;i<15;i++) fErtrio->errin[i]=ein[i];
05596 const Int_t mxpred=15;
05597 if (n<mxpred) {
05598 fErtrio->nepred=n;
05599 } else {
05600 fErtrio->nepred=mxpred;
05601 }
05602
05603 for(Int_t i=0;i<fErtrio->nepred;i++) {
05604 fEropts->nameer[i]=*((int*)namv);
05605 fEropts->iovler[i]=iovl[i];
05606 fEropts->numver[i]=numv[i];
05607 }
05608 }
05609 void TGeant3::Trscsd(Float_t *pc,Float_t *rc,Float_t *pd,Float_t *rd,Float_t *h,Float_t ch,Int_t ierr,Float_t spu,Float_t *dj,Float_t *dk){
05610
05611
05612
05613
05614
05615
05616
05617
05618
05619
05620
05621
05622
05623
05624
05625
05626
05627
05628
05629
05630
05631
05632
05633
05634
05635
05636 printf("%d\n",ierr);
05637 trscsd(pc,rc,pd,rd,h,ch,ierr,spu,dj,dk);
05638 }
05639
05640 void TGeant3::Trsdsc(Float_t *pd,Float_t *rd,Float_t *pc,Float_t *rc,Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spu,Float_t *dj,Float_t *dk) {
05641
05642
05643
05644
05645
05646
05647
05648
05649
05650
05651
05652
05653
05654
05655
05656
05657
05658
05659
05660
05661
05662
05663
05664
05665 trsdsc(pd,rd,pc,rc,h,ch,ierr,spu,dj,dk);
05666 }
05667
05668 void TGeant3::Trscsp(Float_t *pc,Float_t *rc,Float_t *ps,Float_t *rs,Float_t *h,Float_t *ch,Int_t *ierr, Float_t *spx){
05669
05670
05671
05672
05673
05674
05675
05676
05677
05678
05679
05680
05681
05682
05683
05684
05685
05686
05687
05688
05689
05690
05691
05692
05693
05694
05695 trscsp(pc,rc,ps,rs,h,ch,ierr,spx);
05696 }
05697 void TGeant3::Trspsc(Float_t *ps,Float_t *rs,Float_t *pc,Float_t *rc,Float_t *h,Float_t *ch,Int_t *ierr,Float_t *spx) {
05698
05699
05700
05701
05702
05703
05704
05705
05706
05707
05708
05709
05710
05711
05712
05713
05714
05715
05716
05717
05718
05719
05720
05721
05722
05723
05724
05725
05726 trspsc(ps,rs,pc,rc,h,ch,ierr,spx);
05727
05728 }
05729
05730
05731
05732
05733 void TGeant3::SetALTDEDX(Int_t par)
05734 {
05735
05736
05737
05738
05739
05740 fPtopts->use_alt_dedx = par;
05741 }
05742
05743
05744 void TGeant3::SetUserDecayProductStableMinLifetime(Double_t minlifetime)
05745 {
05746
05747
05748
05749
05750
05751
05752
05753
05754 fUserDecayProductStableMinLifetime = minlifetime;
05755 }
05756
05757
05758
05759 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
05760 Int_t number, Int_t nlevel)
05761 {
05762
05763
05764
05765
05766
05767
05768
05769
05770
05771
05772
05773
05774
05775
05776
05777
05778
05779
05780
05781
05782
05783
05784
05785
05786
05787 const char kShape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
05788 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
05789 "GTRA","CTUB"};
05790 Int_t i, end, itm, irm, jrm, k, nmed;
05791 Int_t imxtmed=0;
05792 Int_t imxmate=0;
05793 FILE *lun;
05794 char *filext, *filetme;
05795 char natmed[21], namate[21];
05796 char natmedc[21], namatec[21];
05797 char key[5], name[5], mother[5], konly[5];
05798 char card[133];
05799 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
05800 Int_t mlevel, numbr, natt, numed, nin, ndata;
05801 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
05802 Int_t jdiv, ivin, in, jin, jvin, irot;
05803 Int_t jtm, imat, jma, flag=0, imatc;
05804 Float_t az, dens, radl, absl, a, step, x, y, z;
05805 Int_t npar, ndvmx, left;
05806 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
05807 Int_t nparc, numb;
05808 Int_t iomate[100], iotmed[100];
05809 Float_t par[100], att[20], ubuf[50];
05810 Float_t *qws;
05811 Int_t *iws;
05812 Int_t level, ndiv, iaxe;
05813 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
05814 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
05815 Float_t tmaxf, stemax, deemax, epsil, stmin;
05816 const char *k10000="!\n%s\n!\n";
05817
05818 end=strlen(filnam);
05819 for(i=0;i<end;i++) if(filnam[i]=='.') {
05820 end=i;
05821 break;
05822 }
05823 filext=new char[end+5];
05824 filetme=new char[end+5];
05825 strncpy(filext,filnam,end);
05826 strncpy(filetme,filnam,end);
05827
05828
05829 strcpy(&filext[end],".euc");
05830 strcpy(&filetme[end],".tme");
05831 lun=fopen(filext,"w");
05832
05833
05834 iadvol=fGcnum->nvolum;
05835 iadtmd=iadvol+fGcnum->nvolum;
05836 iadrot=iadtmd+fGcnum->ntmed;
05837 if(fGclink->jrotm) {
05838 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
05839 } else {
05840 fGcnum->nrotm=0;
05841 }
05842 nwtot=iadrot+fGcnum->nrotm;
05843 qws = new float[nwtot+1];
05844 for (i=0;i<nwtot+1;i++) qws[i]=0;
05845 iws = (Int_t*) qws;
05846 mlevel=nlevel;
05847 if(nlevel==0) mlevel=20;
05848
05849
05850 numbr = number>0 ? number : 1;
05851 Gfpara(topvol,numbr,1,npar,natt,par,att);
05852 if(npar <= 0) {
05853 printf(" *** GWEUCL *** top volume : %s number : %3d can not be "
05854 "a valid root\n", topvol, numbr);
05855 return;
05856 }
05857
05858
05859 strncpy((char *)&iname, topvol, 4);
05860 ivo=0;
05861 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
05862 ivo=i;
05863 break;
05864 }
05865 jvo = fZlq[fGclink->jvolum-ivo];
05866 ish = Int_t (fZq[jvo+2]);
05867 if(ish > 12) {
05868 printf(" *** GWEUCL *** top volume : %s number : %3d can not be "
05869 "a valid root\n",topvol, numbr);
05870 }
05871
05872 level = 1;
05873 nvstak = 1;
05874 iws[nvstak] = ivo;
05875 iws[iadvol+ivo] = level;
05876 ivstak = 0;
05877
05878
05879
05880 L10:
05881
05882
05883 ivstak += 1;
05884 ivo = TMath::Abs(iws[ivstak]);
05885 jvo = fZlq[fGclink->jvolum - ivo];
05886
05887
05888 numed = Int_t (fZq[jvo + 4]);
05889 iws[iadtmd + numed] = 1;
05890
05891
05892 level = iws[iadvol+ivo];
05893 if (level < mlevel) {
05894 level += 1;
05895 nin = Int_t (fZq[jvo + 3]);
05896
05897
05898 if (nin < 0) {
05899 jdiv = fZlq[jvo - 1];
05900 ivin = Int_t (fZq[jdiv + 2]);
05901 nvstak += 1;
05902 iws[nvstak] = -ivin;
05903 iws[iadvol+ivin] = level;
05904
05905
05906 } else if (nin > 0) {
05907 for(in=1; in<=nin; in++) {
05908 jin = fZlq[jvo - in];
05909 ivin = Int_t (fZq[jin + 2 ]);
05910 jvin = fZlq[fGclink->jvolum - ivin];
05911 ish = Int_t (fZq[jvin + 2]);
05912
05913 if (ish <= 12) {
05914
05915 if (iws[iadvol+ivin]==0) {
05916 nvstak += 1;
05917 iws[nvstak] = ivin;
05918 iws[iadvol+ivin] = level;
05919 }
05920
05921 irot = Int_t ( fZq[jin + 4 ]);
05922 if (irot > 0) iws[iadrot+irot] = 1;
05923 }
05924 }
05925 }
05926 }
05927
05928
05929 if (ivstak < nvstak) goto L10;
05930
05931
05932
05933
05934 FILE* luncor=fopen("euc_medi.dat","r");
05935
05936 if(luncor) {
05937 for(itm=1; itm<=fGcnum->ntmed; itm++) {
05938 if (iws[iadtmd+itm] > 0) {
05939 jtm = fZlq[fGclink->jtmed-itm];
05940 strncpy(natmed,(char *)&fZiq[jtm+1],20);
05941 imat = Int_t (fZq[jtm+6]);
05942 jma = fZlq[fGclink->jmate-imat];
05943 if (jma <= 0) {
05944 printf(" *** GWEUCL *** material not defined for tracking medium "
05945 "%5i %s\n",itm,natmed);
05946 flag=1;
05947 } else {
05948 strncpy(namate,(char *)&fZiq[jma+1],20);
05949 }
05950
05951
05952 rewind(luncor);
05953 L23:
05954 iret=fscanf(luncor,"%4s,%130s",key,card);
05955 if(iret<=0) goto L26;
05956 flag=0;
05957 if(!strcmp(key,"MATE")) {
05958 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,
05959 &densc,&radlc,&abslc,&nparc);
05960 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
05961 if(!strcmp(namatec,namate)) {
05962 if(az==a && zc==z && densc==dens && radlc==radl
05963 && abslc==absl && nparc==nparc) {
05964 iomate[imat]=imatc;
05965 flag=1;
05966 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",
05967 imat,namate,imatc);
05968 } else {
05969 printf("*** GWEUCL *** different definitions for material: %s\n",
05970 namate);
05971 }
05972 }
05973 }
05974 if(strcmp(key,"END") && !flag) goto L23;
05975 if (!flag) {
05976 printf("*** GWEUCL *** cannot restore original number for "
05977 "material: %s\n",namate);
05978 }
05979
05980
05981
05982 rewind(luncor);
05983 L24:
05984 iret=fscanf(luncor,"%4s,%130s",key,card);
05985 if(iret<=0) goto L26;
05986 flag=0;
05987 if (!strcmp(key,"TMED")) {
05988 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
05989 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
05990 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
05991 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
05992 epsil,stmin,ubuf,&nwbuf);
05993 if(!strcmp(natmedc,natmed)) {
05994 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
05995 iotmed[itm]=itmedc;
05996 flag=1;
05997 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
05998 itm,natmed,itmedc);
05999 } else {
06000 printf("*** GWEUCL *** different definitions for tracking "
06001 "medium: %s\n",natmed);
06002 }
06003 }
06004 }
06005 if(strcmp(key,"END") && !flag) goto L24;
06006 if(!flag) {
06007 printf("cannot restore original number for medium : %s\n",natmed);
06008 goto L27;
06009 }
06010 }
06011 }
06012 goto L29;
06013
06014 }
06015 L26: printf("*** GWEUCL *** cannot read the data file\n");
06016 L27: flag=2;
06017 L29: if(luncor) fclose (luncor);
06018
06019
06020
06021
06022 strcpy(card,"! Tracking medium");
06023 fprintf(lun,k10000,card);
06024
06025 for(itm=1;itm<=fGcnum->ntmed;itm++) {
06026 if (iws[iadtmd+itm]>0) {
06027 jtm = fZlq[fGclink->jtmed-itm];
06028 strncpy(natmed,(char *)&fZiq[jtm+1],20);
06029 natmed[20]='\0';
06030 imat = Int_t (fZq[jtm+6]);
06031 jma = fZlq[fGclink->jmate-imat];
06032
06033 if (flag==2) {
06034 iotmed[itm]=++imxtmed;
06035 iomate[imat]=++imxmate;
06036 }
06037
06038 if(jma<=0) {
06039 strcpy(namate," ");
06040 printf(" *** GWEUCL *** material not defined for tracking "
06041 "medium %5d %s\n", itm,natmed);
06042 } else {
06043 strncpy(namate,(char *)&fZiq[jma+1],20);
06044 namate[20]='\0';
06045 }
06046 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,
06047 iomate[imat],namate);
06048 }
06049 }
06050
06051
06052
06053 strcpy(card,"! Reperes");
06054 fprintf(lun,k10000,card);
06055
06056 for(irm=1;irm<=fGcnum->nrotm;irm++) {
06057 if (iws[iadrot+irm]>0) {
06058 jrm = fZlq[fGclink->jrotm-irm];
06059 fprintf(lun,"ROTM %3d",irm);
06060 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
06061 fprintf(lun,"\n");
06062 }
06063 }
06064
06065
06066
06067 strcpy(card,"! Volumes");
06068 fprintf(lun,k10000,card);
06069
06070 for(ivstak=1;ivstak<=nvstak;ivstak++) {
06071 ivo = iws[ivstak];
06072 if (ivo>0) {
06073 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
06074 name[4]='\0';
06075 jvo = fZlq[fGclink->jvolum-ivo];
06076 ish = Int_t (fZq[jvo+2]);
06077 nmed = Int_t (fZq[jvo+4]);
06078 npar = Int_t (fZq[jvo+5]);
06079 if (npar>0) {
06080 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
06081 Gckpar (ish,npar,par);
06082 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],
06083 iotmed[nmed],npar);
06084 for(i=0;i<(npar-1)/6+1;i++) {
06085 fprintf(lun," ");
06086 left=npar-i*6;
06087 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
06088 fprintf(lun,"\n");
06089 }
06090 } else {
06091 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,kShape[ish-1],
06092 iotmed[nmed],npar);
06093 }
06094 }
06095 }
06096
06097
06098
06099 fprintf(lun,k10000,"! Divisions");
06100 for(ivstak=1;ivstak<=nvstak;ivstak++) {
06101 ivo = TMath::Abs(iws[ivstak]);
06102 jvo = fZlq[fGclink->jvolum-ivo];
06103 ish = Int_t (fZq[jvo+2]);
06104 nin = Int_t (fZq[jvo+3]);
06105
06106 if (nin<0) {
06107 jdiv = fZlq[jvo-1];
06108 iaxe = Int_t ( fZq[jdiv+1]);
06109 ivin = Int_t ( fZq[jdiv+2]);
06110 ndiv = Int_t ( fZq[jdiv+3]);
06111 c0 = fZq[jdiv+4];
06112 step = fZq[jdiv+5];
06113 jvin = fZlq[fGclink->jvolum-ivin];
06114 nmed = Int_t ( fZq[jvin+4]);
06115 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
06116 mother[4]='\0';
06117 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
06118 name[4]='\0';
06119 if ((step<=0.)||(ish>=11)) {
06120
06121 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
06122 } else if ((ndiv<=0)||(ish==10)) {
06123
06124 ndvmx = TMath::Abs(ndiv);
06125 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
06126 name,mother,step,iaxe,iotmed[nmed],ndvmx);
06127 } else {
06128
06129 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
06130 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
06131 }
06132 }
06133 }
06134
06135
06136
06137 fprintf(lun,k10000,"! Positionnements\n");
06138
06139 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
06140 ivo = TMath::Abs(iws[ivstak]);
06141 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
06142 mother[4]='\0';
06143 jvo = fZlq[fGclink->jvolum-ivo];
06144 nin = Int_t( fZq[jvo+3]);
06145
06146 if (nin>0) {
06147 for (in=1;in<=nin;in++) {
06148 jin = fZlq[jvo-in];
06149 ivin = Int_t (fZq[jin +2]);
06150 numb = Int_t (fZq[jin +3]);
06151 irot = Int_t (fZq[jin +4]);
06152 x = fZq[jin +5];
06153 y = fZq[jin +6];
06154 z = fZq[jin +7];
06155 strcpy(konly,"ONLY");
06156 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
06157 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
06158 name[4]='\0';
06159 jvin = fZlq[fGclink->jvolum-ivin];
06160 ish = Int_t (fZq[jvin+2]);
06161
06162 ndata = fZiq[jin-1];
06163 if (ndata==8) {
06164 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
06165 name,numb,mother,x,y,z,irot,konly);
06166 } else {
06167 npar = Int_t (fZq[jin+9]);
06168 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
06169 Gckpar (ish,npar,par);
06170 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
06171 name,numb,mother,x,y,z,irot,konly,npar);
06172 fprintf(lun," ");
06173 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
06174 fprintf(lun,"\n");
06175 }
06176 }
06177 }
06178 }
06179
06180 fprintf(lun,"END\n");
06181 fclose(lun);
06182
06183
06184
06185 lun=fopen(filetme,"w");
06186
06187 for(itm=1;itm<=fGcnum->ntmed;itm++) {
06188 if (iws[iadtmd+itm]>0) {
06189 jtm = fZlq[fGclink->jtmed-itm];
06190 strncpy(natmed,(char*)&fZiq[jtm+1],4);
06191 imat = Int_t (fZq[jtm+6]);
06192 jma = Int_t (fZlq[fGclink->jmate-imat]);
06193
06194 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
06195 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
06196 iomate[imat],namate,a,z,dens,radl,absl,npar);
06197
06198 if (npar>0) {
06199 fprintf(lun," ");
06200 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
06201 fprintf(lun,"\n");
06202 }
06203
06204 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,
06205 epsil,stmin,par,&npar);
06206 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f "
06207 "%11.5f %11.5f %11.5f %3d\n",
06208 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
06209 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
06210
06211 if (npar>0) {
06212 fprintf(lun," ");
06213 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
06214 fprintf(lun,"\n");
06215 }
06216
06217 }
06218 }
06219 fprintf(lun,"END\n");
06220 fclose(lun);
06221 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
06222 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
06223
06224 delete [] filext;
06225 delete [] filetme;
06226 delete [] qws;
06227 iws=0;
06228 return;
06229 }
06230
06231
06232 Int_t TGeant3::TransportMethod(TMCParticleType particleType) const
06233 {
06234
06235
06236
06237
06238 switch (particleType) {
06239 case kPTGamma: return 1;
06240 case kPTElectron: return 2;
06241 case kPTNeutron: return 3;
06242 case kPTHadron: return 4;
06243 case kPTMuon: return 5;
06244 case kPTGeantino: return 6;
06245 case kPTOpticalPhoton: return 7;
06246 case kPTIon: return 8;
06247 default: return -1;
06248 }
06249 }
06250
06251
06252 TMCParticleType TGeant3::ParticleType(Int_t itrtyp) const
06253 {
06254
06255
06256
06257
06258 switch (itrtyp) {
06259 case 1: return kPTGamma;
06260 case 2: return kPTElectron;
06261 case 3: return kPTNeutron;
06262 case 4: return kPTHadron;
06263 case 5: return kPTMuon;
06264 case 6: return kPTGeantino;
06265 case 7: return kPTOpticalPhoton;
06266 case 8: return kPTIon;
06267 default: return kPTUndefined;
06268 }
06269 }
06270
06271
06272 TString TGeant3::ParticleClass(TMCParticleType particleType) const
06273 {
06274
06275
06276
06277
06278
06279
06280 switch (particleType) {
06281 case kPTGamma: return TString("Photon");
06282 case kPTElectron: return TString("Lepton");
06283 case kPTNeutron: return TString("Hadron");
06284 case kPTHadron: return TString("Hadron");
06285 case kPTMuon: return TString("Lepton");
06286 case kPTGeantino: return TString("Special");
06287 case kPTIon: return TString("Ion");
06288 case kPTOpticalPhoton: return TString("Photon");
06289 default: return TString("Unknown");
06290 }
06291 }
06292
06293
06294 void TGeant3::FinishGeometry()
06295 {
06296
06297
06298
06299
06300
06301 if (gDebug > 0) printf("FinishGeometry, calling ggclos\n");
06302 Ggclos();
06303
06304
06305
06306 if (gDebug > 0) printf("FinishGeometry, calling SetColors\n");
06307
06308
06309 SetColors();
06310 if (gDebug > 0) printf("FinishGeometry, returning\n");
06311 }
06312
06313
06314 void TGeant3::Init()
06315 {
06316
06317
06318
06319
06320
06321 if (!TestBit(kTRIG)) SetTRIG(1);
06322 if (!TestBit(kSWIT)) SetSWIT(4, 10);
06323 if (!TestBit(kDEBU)) SetDEBU(0, 0, 1);
06324 if (!TestBit(kAUTO)) SetAUTO(1);
06325
06326 if (!TestBit(kABAN)) SetABAN(0);
06327
06328 if (!TestBit(kOPTI)) SetOPTI(2);
06329
06330 if (!TestBit(kERAN)) SetERAN(5.e-7);
06331
06332 DefineParticles();
06333 fApplication->AddParticles();
06334 fApplication->AddIons();
06335 fApplication->ConstructGeometry();
06336 FinishGeometry();
06337 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,01,1)
06338 fApplication->ConstructOpGeometry();
06339 #endif
06340 fApplication->InitGeometry();
06341 }
06342
06343
06344 Bool_t TGeant3::ProcessRun(Int_t nevent)
06345 {
06346
06347
06348
06349
06350 Int_t todo = TMath::Abs(nevent);
06351 for (Int_t i=0; i<todo; i++) {
06352
06353 fGcflag->idevt = i;
06354 fGcflag->ievent = i+1;
06355 if (fStopRun) break;
06356 fApplication->BeginEvent();
06357 if (fStopRun) break;
06358 ProcessEvent();
06359 if (fStopRun) break;
06360 fApplication->FinishEvent();
06361 if (fStopRun) break;
06362 }
06363
06364 if (fStopRun) printf(" **** Run stopped ***\n");
06365
06366 Bool_t returnValue = !fStopRun;
06367 fStopRun = kFALSE;
06368 #ifdef STATISTICS
06369 printf("count_gmedia= %8d\n",count_gmedia);
06370 printf("count_gtmedi= %8d\n",count_gtmedi);
06371 printf("count_ginvol= %8d\n",count_ginvol);
06372 printf("count_gtnext= %8d\n",count_gtnext);
06373 stattree->AutoSave();
06374 statfile->Close();
06375 printf("Statistics tree saved.\n");
06376 #endif
06377 return returnValue;
06378 }
06379
06380
06381 void TGeant3::ProcessEvent()
06382 {
06383
06384
06385
06386 Gtrigi();
06387 Gtrigc();
06388 Gtrig();
06389 }
06390
06391
06392 void TGeant3::SetColors()
06393 {
06394
06395
06396
06397
06398
06399
06400 Int_t kv, icol;
06401 Int_t jvolum=fGclink->jvolum;
06402
06403
06404 Int_t nvolum=fGcnum->nvolum;
06405 char name[5];
06406
06407
06408 for(kv=1;kv<=nvolum;kv++) {
06409
06410 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
06411
06412
06413
06414
06415
06416
06417
06418
06419 icol = itm%6+2;
06420 strncpy(name,(char*)&fZiq[jvolum+kv],4);
06421 name[4]='\0';
06422 Gsatt(name,"COLO",icol);
06423 }
06424 }
06425
06426
06427 void TGeant3::SetTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom,
06428 Float_t *vpos, Float_t *polar, Float_t tof,
06429 TMCProcess mech, Int_t &ntr, Float_t weight, Int_t is)
06430 {
06431
06432
06433
06434
06435
06436
06437
06438
06439
06440
06441
06442
06443
06444
06445
06446
06447
06448
06449
06450
06451
06452
06453
06454
06455 Float_t mass = TDatabasePDG::Instance()->GetParticle(pdg)->Mass();
06456 Float_t e=TMath::Sqrt(mass*mass+pmom[0]*pmom[0]+
06457 pmom[1]*pmom[1]+pmom[2]*pmom[2]);
06458
06459
06460
06461
06462
06463
06464
06465 GetStack()->PushTrack(done, parent, pdg, pmom[0], pmom[1], pmom[2], e,
06466 vpos[0],vpos[1],vpos[2],tof,polar[0],polar[1],polar[2],
06467 mech, ntr, weight, is);
06468 }
06469
06470
06471
06472 Float_t* TGeant3::CreateFloatArray(Float_t* array, Int_t size) const
06473 {
06474
06475
06476
06477
06478 Float_t* floatArray;
06479 if (size>0) {
06480 floatArray = new Float_t[size];
06481 for (Int_t i=0; i<size; i++)
06482 if (array[i] >= FLT_MAX )
06483 floatArray[i] = FLT_MAX/100.;
06484 else
06485 floatArray[i] = array[i];
06486 }
06487 else {
06488
06489 floatArray = new Float_t[1];
06490 }
06491 return floatArray;
06492 }
06493
06494
06495
06496 Float_t* TGeant3::CreateFloatArray(Double_t* array, Int_t size) const
06497 {
06498
06499
06500
06501
06502 Float_t* floatArray;
06503 if (size>0) {
06504 floatArray = new Float_t[size];
06505 for (Int_t i=0; i<size; i++)
06506 if (array[i] >= FLT_MAX )
06507 floatArray[i] = FLT_MAX/100.;
06508 else
06509 floatArray[i] = array[i];
06510 }
06511 else {
06512
06513 floatArray = new Float_t[1];
06514 }
06515 return floatArray;
06516 }
06517
06518
06519
06520 void TGeant3::Streamer(TBuffer &R__b)
06521 {
06522
06523
06524
06525 if (R__b.IsReading()) {
06526 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
06527 TVirtualMC::Streamer(R__b);
06528 R__b >> fNextVol;
06529 R__b >> fNPDGCodes;
06530
06531 fPDGCode.Streamer(R__b);
06532 } else {
06533 R__b.WriteVersion(TGeant3::IsA());
06534 TVirtualMC::Streamer(R__b);
06535 R__b << fNextVol;
06536 R__b << fNPDGCodes;
06537
06538 fPDGCode.Streamer(R__b);
06539 }
06540 }
06541
06542
06543
06544
06545
06546
06547
06548
06549
06550 extern "C" void type_of_call rxgtrak(Int_t &mtrack,Int_t &ipart,Float_t *pmom,
06551 Float_t &e,Float_t *vpos,Float_t *polar,
06552 Float_t &tof)
06553 {
06554
06555
06556
06557
06558
06559
06560
06561
06562
06563
06564
06565
06566
06567
06568 TParticle* track = gMC->GetStack()->PopNextTrack(mtrack);
06569
06570 if (track) {
06571
06572 pmom[0] = track->Px();
06573 pmom[1] = track->Py();
06574 pmom[2] = track->Pz();
06575 e = track->Energy();
06576 vpos[0] = track->Vx();;
06577 vpos[1] = track->Vy();
06578 vpos[2] = track->Vz();
06579 tof = track->T();
06580 TVector3 pol;
06581 track->GetPolarisation(pol);
06582 polar[0] = pol.X();
06583 polar[1] = pol.Y();
06584 polar[2] = pol.Z();
06585 ipart = gMC->IdFromPDG(track->GetPdgCode());
06586 }
06587
06588 mtrack++;
06589 }
06590
06591
06592
06593 extern "C" void type_of_call rxouth ()
06594 {
06595
06596
06597
06598 TVirtualMCApplication::Instance()->FinishPrimary();
06599 }
06600
06601
06602 extern "C" void type_of_call rxinh ()
06603 {
06604
06605
06606
06607 TVirtualMCApplication::Instance()->BeginPrimary();
06608 }
06609
06610
06611 void ginvol(Float_t *x, Int_t &isame)
06612 {
06613 fginvol(x,isame);
06614 }
06615
06616
06617
06618 void gtmedi(Float_t *x, Int_t &numed)
06619 {
06620 fgtmedi(x,numed);
06621 #ifdef STATISTICS
06622 statcode = 2;
06623 statsame = gcchan->lsamvl;
06624 for (int j=0;j<6;j++) if (j <3) oldvect[j] = x[j]; else oldvect[j]=0;
06625 oldsafety = gctrak->safety;
06626 oldstep = gctrak->step;
06627 sprintf(statpath,"%s",geant3->GetPath());
06628 statsnext=gctrak->snext;
06629 statsafety=gctrak->safety;
06630 stattree->Fill();
06631 count_gtmedi++;
06632 #endif
06633 }
06634
06635
06636
06637 void gmedia(Float_t *x, Int_t &numed, Int_t &check)
06638 {
06639 fgmedia(x,numed,check);
06640 #ifdef STATISTICS
06641 statcode = 1;
06642 statsame = 0;
06643 for (int j=0;j<6;j++) if (j <3) oldvect[j] = x[j]; else oldvect[j]=0;
06644 oldsafety = gctrak->safety;
06645 oldstep = gctrak->step;
06646 sprintf(statpath,"%s",geant3->GetPath());
06647 statsnext=gctrak->snext;
06648 statsafety=gctrak->safety;
06649 stattree->Fill();
06650 count_gmedia++;
06651 #endif
06652 }
06653
06654
06655 void gtmany(Int_t &level1)
06656 {
06657 fgtmany(level1);
06658 }
06659
06660
06661 void gtonlyg3(Int_t &isOnly)
06662 {
06663
06664 isOnly = (Int_t)gcvolu->gonly[gcvolu->nlevel-1];
06665 }
06666
06667
06668 void gtonly(Int_t &isOnly)
06669 {
06670
06671 fgtonly(isOnly);
06672 }
06673
06674
06675 void glvolu(Int_t &nlev, Int_t *lnam,Int_t *lnum, Int_t &ier)
06676 {
06677
06678
06679
06680
06681
06682
06683
06684
06685
06686
06687
06688
06689
06690
06691
06692
06693
06694
06695
06696 fglvolu(nlev, lnam, lnum, ier);
06697 }
06698
06699
06700
06701 void gtnext()
06702 {
06703 #ifdef STATISTICS
06704 count_gtnext++;
06705 statcode = 3;
06706 statsame = 1;
06707 for (int j=0;j<6;j++) oldvect[j] = gctrak->vect[j];
06708 oldsafety = gctrak->safety;
06709 oldstep = gctrak->step;
06710 sprintf(statpath,"%s",geant3->GetPath());
06711 #endif
06712
06713 fgtnext();
06714
06715 #ifdef STATISTICS
06716 statsnext=gctrak->snext;
06717 statsafety=gctrak->safety;
06718 stattree->Fill();
06719 #endif
06720 }
06721
06722 void ggperp(Float_t *x, Float_t *norm, Int_t &ierr){
06723
06724
06725
06726 fggperp(x,norm,ierr);
06727 }
06728
06729 Bool_t TGeant3::GetTransformation(const TString &volumePath,TGeoHMatrix &mat){
06730
06731
06732
06733
06734
06735
06736
06737
06738
06739
06740
06741
06742
06743
06744
06745
06746
06747
06748 Int_t i,n,k,*lnam=0,*lnum=0;
06749
06750 Double_t m[9] = {1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0};
06751 Double_t s[3] = {1.0,1.0,1.0};
06752 Double_t t[3] = {0.0,0.0,0.0};
06753
06754 k =ConvertVolumePathString(volumePath,&lnam,&lnum);
06755 if(k<=0) {
06756 delete[] lnam;
06757 delete[] lnum;
06758 return kFALSE;
06759 }
06760 if(k==1){
06761 delete[] lnam;
06762 delete[] lnum;
06763 mat.SetRotation(m);
06764 mat.SetTranslation(t);
06765 mat.SetScale(s);
06766 return kTRUE;
06767 }
06768 this->Gcvolu()->nlevel = 0;
06769 i = this->Glvolu(k,lnam,lnum);
06770 n = this->Gcvolu()->nlevel -1;
06771 delete[] lnam;
06772 delete[] lnum;
06773 if(i!=0) return kFALSE;
06774 mat.SetScale(s);
06775 if(!((this->Gcvolu()->grmat[n][9])==0.0)) {
06776 for(i=0;i<9;i++) m[i] = (Double_t) this->Gcvolu()->grmat[n][i];
06777 }
06778 mat.SetRotation(m);
06779 for(i=0;i<3;i++) t[i] = (Double_t) (this->Gcvolu()->gtran[n][i]);
06780 mat.SetTranslation(t);
06781 return kTRUE;
06782 }
06783
06784
06785
06786
06787
06788
06789
06790
06791
06792
06793
06794
06795
06796
06797
06798
06799
06800
06801
06802
06803
06804
06805
06806
06807
06808
06809
06810
06811
06812
06813
06814
06815
06816
06817
06818 Bool_t TGeant3::GetShape(const TString &volumePath,TString &shapeType,
06819 TArrayD &par){
06820
06821
06822
06823
06824
06825
06826
06827
06828
06829
06830
06831
06832
06833
06834
06835
06836
06837
06838
06839 const Int_t nshapes = 16;
06840 const Char_t *vname[nshapes] = {"BOX","TRD1","TRD2","TRAP","TUBE","TUBS",
06841 "CONE","CONS","SPHE","PARA","PGON","PCON",
06842 "ELTU","HYPE","GTRA","CTUB"};
06843 Int_t volid,i,k,jv0,ishape,npar,*lnam=0,*lnum=0;
06844 Float_t *qpar;
06845
06846 k=ConvertVolumePathString(volumePath,&lnam,&lnum);
06847 if(k<=0) {
06848 delete[] lnam;
06849 delete[] lnum;
06850 return kFALSE;
06851 }
06852 this->Gcvolu()->nlevel = 0;
06853 i = this->Glvolu(k,lnam,lnum);
06854 delete[] lnam;
06855 delete[] lnum;
06856 if(i!=0) {
06857 par.Set(0);
06858 return kFALSE;
06859 }
06860 volid = this->Gcvolu()->lvolum[this->Gcvolu()->nlevel-1];
06861 jv0 = this->Lq()[this->Gclink()->jvolum-volid];
06862 ishape = (Int_t)(this->Q()[jv0+2]);
06863 if(ishape<1||ishape>nshapes) return kFALSE;
06864 npar = (Int_t)(this->Q()[jv0+5]);
06865 qpar = (this->Q())+jv0+7;
06866 par.Set(npar);
06867 for(i=0;i<npar;i++) par.AddAt((Double_t)qpar[i],i);
06868 shapeType = vname[ishape-1];
06869 shapeType = shapeType.Strip();
06870 return kTRUE;
06871 }
06872
06873 Bool_t TGeant3::GetMaterial(const TString &volumeName,
06874 TString &name,Int_t &imat,
06875 Double_t &a,Double_t &z,Double_t &dens,
06876 Double_t &radl,Double_t &inter,TArrayD &par){
06877
06878
06879
06880
06881
06882
06883
06884
06885
06886
06887
06888
06889
06890
06891
06892
06893
06894
06895 Int_t i,volid,jma,nbuf;
06896 Float_t af,zf,densf,radlf,interf;
06897 Float_t *ubuf;
06898 Char_t *ch,namec[20] = {20*'\0'};
06899
06900 volid = VolId(volumeName.Data());
06901 if(volid==0) return kFALSE;
06902 if(volid>0){
06903 Int_t imed = (Int_t) (this->Q()[this->Lq()[
06904 this->Gclink()->jvolum-volid]+4]);
06905 Int_t jtm = this->Lq()[this->Gclink()->jtmed-imed];
06906 imat = (Int_t)(this->Q()[jtm+6]);
06907 } else {
06908 i = this->Gclink()->jvolum + volid;
06909 Int_t jdiv = this->Lq()[i];
06910 Int_t ivin = (Int_t) (this->Q()[jdiv+2]);
06911 i = this->Gclink()->jvolum - ivin;
06912 Int_t jvin = this->Lq()[i];
06913 Int_t idmed = (Int_t)(this->Q()[jvin+4]);
06914 i = this->Gclink()->jtmed-idmed;
06915 Int_t jtm = this->Lq()[i];
06916 imat = (Int_t)(this->Q()[jtm+6]);
06917 }
06918 nbuf = jma = this->Lq()[this->Gclink()->jmate-imat];
06919 ubuf = new Float_t[nbuf];
06920 Gfmate(imat,namec,af,zf,densf,radlf,interf,ubuf,nbuf);
06921
06922
06923 ch = (char *)(this->Iq()+jma+1);
06924 for(i=0;i<20;i++) if(ch[i]!=' ') namec[i] = ch[i];
06925 name = namec;
06926 name = name.Strip();
06927
06928 par.Set(nbuf);
06929 for(i=0;i<nbuf;i++) par.AddAt(((Double_t)ubuf[i]),i);
06930 delete[] ubuf;
06931 a = (Double_t) af;
06932 z = (Double_t) zf;
06933 dens = (Double_t) densf;
06934 radl = (Double_t) radlf;
06935 inter = (Double_t) interf;
06936 return kTRUE;
06937 }
06938
06939 Bool_t TGeant3::GetMedium(const TString &volumeName,TString &name,
06940 Int_t &imed,Int_t &nmat,Int_t &isvol,Int_t &ifield,
06941 Double_t &fieldm,Double_t &tmaxfd,Double_t &stemax,
06942 Double_t &deemax,Double_t &epsil, Double_t &stmin,
06943 TArrayD &par){
06944
06945
06946
06947
06948
06949
06950
06951
06952
06953
06954
06955
06956
06957
06958
06959
06960
06961
06962
06963
06964
06965 Int_t i,volid,nbuf;
06966 Float_t fieldmf,tmaxfdf,stemaxf,deemaxf,epsilf,stminf;
06967 Float_t *buf;
06968 Char_t namec[25] = {25*'\0'};
06969
06970 volid = VolId(volumeName.Data());
06971 if(volid==0) return kFALSE;
06972 if(volid>0){
06973 imed = (Int_t)(this->Q()[this->Lq()[this->Gclink()->jvolum-volid]+4]);
06974 } else {
06975 Int_t jdiv = this->Lq()[this->Gclink()->jvolum + volid];
06976 Int_t ivin = (Int_t) (this->Q()[jdiv+2]);
06977 Int_t jvin = this->Lq()[this->Gclink()->jvolum - ivin];
06978 imed = (Int_t)(this->Q()[jvin+4]);
06979 }
06980 nbuf = this->Lq()[this->Gclink()->jtmed-imed];
06981 buf = new Float_t[nbuf];
06982 Gftmed(imed,namec,nmat,isvol,ifield,fieldmf,tmaxfdf,stemaxf,deemaxf,
06983 epsilf,stminf,buf,&nbuf);
06984 name = namec;
06985 name = name.Strip();
06986 par.Set(nbuf);
06987 for(i=0;i<nbuf;i++) par.AddAt(((Double_t)buf[i]),i);
06988 delete[] buf;
06989 fieldm = (Double_t) fieldmf;
06990 tmaxfd = (Double_t) tmaxfdf;
06991 stemax = (Double_t) stemaxf;
06992 deemax = (Double_t) deemaxf;
06993 epsil = (Double_t) epsilf;
06994 stmin = (Double_t) stminf;
06995 return kTRUE;
06996 }
06997
06998 Int_t TGeant3::ConvertVolumePathString(const TString &volumePath,
06999 Int_t **lnam,Int_t **lnum){
07000
07001
07002
07003
07004
07005
07006
07007
07008
07009
07010
07011
07012
07013
07014
07015
07016
07017 Int_t i,j=0,k=0,ireturn,ichar,*inam;
07018 Char_t *buf,**levels,**copies,nam[4];
07019
07020 inam = (Int_t*)nam;
07021 buf = new Char_t[volumePath.Length()+1];
07022 for(i=0;i<volumePath.Length();i++) {
07023 if(volumePath[i]!=' ')buf[j++] = volumePath[i];
07024 if(volumePath[i]=='/') k++;
07025 }
07026 buf[j] = '\0';
07027 if(buf[j-1]=='/') {k--; buf[j-1]='\0';}
07028
07029 levels = new Char_t*[k];
07030 copies = new Char_t*[k];
07031 (*lnam) = new Int_t[k];
07032 (*lnum) = new Int_t[k];
07033 ireturn = k;
07034 ichar = j;
07035 k = 0;
07036 j = 0;
07037 for(i=0;i<ichar;i++) {
07038 if(buf[i]=='/'){
07039 levels[k++] = &(buf[i+1]);
07040 buf[i] = '\0';
07041 }
07042 if(buf[i]=='_'){
07043 copies[j++] = &(buf[i+1]);
07044 buf[i] = '\0';
07045 }
07046 }
07047 if(k!=j){
07048
07049 delete[] buf;
07050 delete[] levels;
07051 delete[] copies;
07052 delete[] (*lnam);
07053 delete[] (*lnum);
07054 (*lnam) = 0;
07055 (*lnum) = 0;
07056 Error("ConvertVolumePathString","Different number of volume names %d"
07057 " and copy numbers %d in volumePath:%s",k,j,volumePath.Data());
07058 return 0;
07059 }
07060 for(i=0;i<k;i++){
07061 *inam = 0;
07062 (*lnum)[i] = atoi(copies[i]);
07063 for(j=0;j<4;j++) {
07064 if(levels[i][j] == 0) break;
07065 nam[j] = levels[i][j];
07066 }
07067 (*lnam)[i] = *inam;
07068 }
07069
07070 delete[] buf;
07071 delete[] levels;
07072 delete[] copies;
07073 return ireturn;
07074 }
07075
07076
07077 void TGeant3::Gfang( Float_t* p, Float_t& costh, Float_t& sinth,
07078 Float_t& cosph, Float_t& sinph, Int_t& rotate)
07079 {
07080
07081 g3fang(p, costh, sinth, cosph, sinph, rotate );
07082 }
07083
07084
07085 Int_t TGeant3::GetIonPdg(Int_t z, Int_t a, Int_t i) const
07086 {
07087
07088
07089
07090 return 1000000000 + 10*1000*z + 10*a + i;
07091 }
07092
07093
07094 Int_t TGeant3::GetSpecialPdg(Int_t number) const
07095 {
07096
07097
07098 return 50000000 + number;
07099 }
07100