Geant4_10
gustep.F
Go to the documentation of this file.
1 
2  SUBROUTINE gustep
3 *
4 * User routine called at the end of each tracking step
5 *
6 #include "geant321/gcflag.inc"
7 #include "geant321/gckine.inc"
8 #include "geant321/gcking.inc"
9 #include "geant321/gctrak.inc"
10 *
11 #include "process.inc"
12 #include "histo.inc"
13 *
14  character*20 cdum
15 *
16 * *** Debug event and store tracks for drawing
17  IF (idebug.NE.0) CALL gpcxyz
18  IF (idebug.NE.0) CALL gpgkin
19  IF ((iswit(1).EQ.1).AND.(charge.NE.0.)) CALL gsxyz
20  IF (iswit(1).EQ.2) CALL gsxyz
21 *
22 * *** if no process: return
23  IF (nmec.EQ.0) return
24 *
25 * *** count nb of invoked processes
26  DO im = 1,nmec
27  iproc = lmec(im)
28  IF (iproc.EQ.21) iproc = 12
29  IF (iproc.LE.12) nbcall(iproc) = nbcall(iproc)+1
30  ENDDO
31 *
32 * *** sum track length for discrete processes
33  if ((iproc.gt.5)) then
34  nbtot = nbtot + 1
35  sumtrak = sumtrak + sleng
36  sumtrak2 = sumtrak2 + sleng*sleng
37  endif
38 *
39 * *** plot final state
40 *
41 * scattered primary particle (if still alive)
42  if (istop.eq.0) then
43  id = 1
44  if (histo(id)) call hfill(id,gekin/histunit(id),0.,1.)
45  id = 2
46  if (histo(id)) call hfill(id,vect(4),0.,1.)
47  endif
48 *
49 * *** secondaries
50  if (ngkine.gt.0) then
51  do lp = 1,ngkine
52  ipar = gkin(5,lp) + 0.1
53  call gfpart(ipar,cdum,ndum,gmass,gcharg,dum,dum,ndum)
54  ekin = gkin(4,lp) - gmass
55  pc = sqrt(gkin(1,lp)**2 + gkin(2,lp)**2 + gkin(3,lp)**2)
56  cost = gkin(1,lp)/pc
57  if (gcharg.ne.0.) id = 3
58  if (gcharg.eq.0.) id = 5
59  if (histo(id)) call hfill(id,ekin/histunit(id),0.,1.)
60  id = id + 1
61  if (histo(id)) call hfill(id,cost,0.,1.)
62  enddo
63  endif
64 *
65 * *** stop the tracking
66  istop = 1
67 *
68  END
subroutine gustep
Definition: gustep.F:2
G4double ekin(const G4LorentzVector &p) const
Hep3Vector vect() const
static c2_sqrt_p< float_type > & sqrt()
make a *new object
Definition: c2_factory.hh:142