source: trunk/examples/extended/electromagnetic/TestEm5/geant3/src/gutrak.F@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 2.3 KB
Line 
1
2 SUBROUTINE GUTRAK
3*
4* User routine to control tracking of one track
5* Called by : GTREVE
6*
7#include "geant321/gckine.inc"
8#include "geant321/gconst.inc"
9#include "geant321/gctrak.inc"
10*
11#include "geomate.inc"
12#include "runinfo.inc"
13#include "histo.inc"
14*
15 logical transmit, reflect, charged, neutral
16*
17* *** beginning of the track
18*
19 charged = (charge.ne.0.)
20 neutral = .not.charged
21*
22 kflag = 0
23 if (charge.eq.pkine(10)) kflag = 1
24 if ((itra.eq.1).and.(istak.eq.0)) kflag = 2
25*
26* *** perform tracking
27*
28 CALL GTRACK
29*
30* *** end of the track
31*
32 transmit = (vect(1).ge. 0.49*xworld)
33 reflect = (vect(1).le.-0.49*xworld)
34*
35 if (transmit) itransmi = max(itransmi,kflag)
36 if (reflect) ireflect = max(ireflect,kflag)
37*
38* *** histograms
39*
40 id = 0
41*
42* energy spectrum at exit
43*
44 if (transmit.and.charged) id = 10
45 if (transmit.and.neutral) id = 20
46 if (reflect .and.charged) id = 30
47 if (reflect .and.neutral) id = 40
48 if (id.ne.0.and.histo(id)) then
49 call hfill (id,gekin/histUnit(id),0.,1.)
50 endif
51*
52* space angle distribution at exit
53*
54 if (transmit.and.charged) id = 12
55 if (transmit.and.neutral) id = 22
56 if (reflect .and.charged) id = 32
57 if (reflect .and.neutral) id = 42
58 if (id.ne.0.and.histo(id)) then
59 unit = histUnit(id)
60 theta = acos(abs(vect(4)))
61 dteta = binWidth(id)*unit
62 dOmega = twopi*sin(theta)*dteta
63 weight = 0.
64 if (dOmega.gt.(1./big)) weight = 1./dOmega
65 call hfill (id,theta/unit,0.,weight*unit*unit)
66 endif
67*
68* projected angle distribution at exit
69*
70 if (transmit.and.charged) id = 13
71 if (transmit.and.neutral) id = 23
72 if (reflect .and.charged) id = 33
73 if (reflect .and.neutral) id = 43
74 if (id.ne.0.and.histo(id)) then
75 thety = atan(vect(5)/abs(vect(4)))
76 thetz = atan(vect(6)/abs(vect(4)))
77 call hfill (id,thety/histUnit(id),0.,1.)
78 call hfill (id,thetz/histUnit(id),0.,1.)
79 endif
80*
81* projected position at exit
82*
83 if (transmit.and.charged) id = 14
84 if (id.ne.0.and.histo(id)) then
85 call hfill (id,vect(2)/histUnit(id),0.,1.)
86 call hfill (id,vect(3)/histUnit(id),0.,1.)
87 endif
88*
89 END
Note: See TracBrowser for help on using the repository browser.