ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uglast.F
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file uglast.F
1 
2  SUBROUTINE uglast
3 *
4 * Termination routine to print histograms and statistics
5 *
6 #include "geant321/gcflag.inc"
7 #include "geant321/gctrak.inc"
8 #include "calor.inc"
9 #include "celoss.inc"
10 #include "histo.inc"
11 *
12  dimension edeptot(maxabs)
13 *
14  CHARACTER*20 matnam
15  CHARACTER*4 unit1, unit2
16 *
17  data amev /1.e-3/
18 *
19 * *** mean energy deposit and track length
20  print 749
21  print 750,ievent
22  print 751
23  fnorm = 1./ievent
24  do k=1,nbabsor
25  call gfmate(materabs(k),matnam,dua,duz,dud,dur,dui,udu,idu)
26  aveedep = fnorm*sumedep(k)
27  aveedep2 = fnorm*su2edep(k)
28  rmsedep = sqrt(abs(aveedep2-aveedep**2))
29  avetrck = fnorm*sumtrck(k)
30  avetrck2 = fnorm*su2trck(k)
31  rmstrck = sqrt(abs(avetrck2-avetrck**2))
32 *
33  CALL gevkev(aveedep,edmean,unit1)
34  CALL gevkev(rmsedep,edrms ,unit2)
35  print 752,k,matnam,edmean,unit1,edrms,unit2,avetrck,rmstrck
36  enddo
37  print 749
38 *
39 * *** Energy flow
40  iplmax = nbabsor*nblayer + 1
41  do k=1,iplmax
42  fk = k
43  enerflow(k) = enerflow(k)*fnorm
44  eleaklat(k) = eleaklat(k)*fnorm
45  ih = 2*maxabs + 1
46  if (histo(ih)) call hfill(ih, fk, 0., enerflow(k)/amev)
47  ih = 2*maxabs + 2
48  if (histo(ih)) call hfill(ih, fk, 0., eleaklat(k)/amev)
49  enddo
50 *
51 * *** Energy deposit from energy flow balance
52  do k=1,nbabsor
53  edeptot(k) = 0.
54  enddo
55 *
56  idmax = nbabsor*nblayer
57  do k=1,idmax
58  iabsor = mod(k,nbabsor)
59  if (iabsor.eq.0) iabsor = nbabsor
60  ebalance = enerflow(k) - enerflow(k+1) - eleaklat(k)
61  edeptot(iabsor) = edeptot(iabsor) + ebalance
62  enddo
63 
64  print 761
65  do k=1,nbabsor
66  call gfmate(materabs(k),matnam,dua,duz,dud,dur,dui,udu,idu)
67  CALL gevkev(abs(edeptot(k)),edtot,unit1)
68  if (edeptot(k).lt.0.) edtot = -edtot
69  print 762,k,matnam,edtot,unit1
70  enddo
71  print 749
72 *
73 *
74 * *** geant termination
75  CALL glast
76 *
77 * *** close HIGZ
78  CALL hplend
79 *
80 * *** Save histo
81  CALL hrput(0,filename,'N')
82 
83 *
84 *
85 * *** formats
86  749 FORMAT(/, 60(1h-),/)
87  750 FORMAT(1x,'Nb of events:',i6)
88  751 FORMAT(1x,'AbsNo Material',5x,'Energy deposit',14x,'Trck length')
89  752 FORMAT(i5,3x,a10,f8.3,a4,' +- ',f6.2,a4,f9.3,' cm +- ',f6.2,' cm')
90  761 FORMAT(' Energy deposition from energy flow balance:',/,/,
91  & 1x,'AbsNo Material',5x,'Total Edep')
92  762 FORMAT(i5,3x,a10,f10.3,a4)
93 *
94  END