COSMOS v7.655  COSMOSv7655
(AirShowerMC)
bin2asciiComp.f
Go to the documentation of this file.
1  implicit none
2 ! This progaram reads binary histogram file and ascii
3 ! hybrid data and output it to stdout.
4 ! For hist file id is modified to be consistent with
5 ! each assembled shower. (This is the difference from
6 ! bin2ascii.f
7  integer ndepth
8  parameter(ndepth= 30)
9  integer fn1
10  real*8 ASdep(ndepth), munit(ndepth)
11  real*8 Esize0(ndepth),
12  * age0(ndepth), cogdep0(ndepth),
13  * seloss0(ndepth),
14  * ng0(ndepth), ne0(ndepth), nmu0(ndepth),
15  * cog0
16  integer EvNo0
17 
18  common /zbin2ascii/
19  * asdep, esize0, age0,
20  * cogdep0, seloss0, munit,
21  * ng0, ne0, nmu0, cog0,
22  * fn1, evno0
23 
24 
25  include "../../Hist/Z90histc.f"
26  include "../../Hist/Z90hist.f"
27  include "../../Hist/Z90hist2.f"
28  include "../../Hist/Z90hist3.f"
29  type(histogram1) h10
30  type(histogram2) h20
31  type(histogram3) h30
32 
33 
34  integer fn0
35  integer kgetenv2
36  integer EventNo
37  integer leng, i, idx
38  integer icon0
39  character*120 hist0, hyb0
40  character*6 histid0
41 
42 
43  fn0 = 2
44  fn1 = 3
45  leng = kgetenv2("HISTFILE0", hist0)
46  call copenfw2(fn0, hist0, 2, icon0)
47  if(icon0 .ne. 1) then
48  write(0,*) hist0(1:leng)
49  if( icon0 .eq. 0) then
50  write(0,*) 'not exists'
51  else
52  write(0,*) ' cannot be opened '
53  endif
54  write(0,*) ' icon=',icon0
55  stop 9999
56  else
57  write(0,*) hist0(1:leng), ' opened'
58  endif
59 
60  leng = kgetenv2("HYBFILE0", hyb0)
61  call copenfw2(fn1, hyb0, 1, icon0)
62  if(icon0 .ne. 1) then
63  write(0,*) hyb0(1:leng)
64  if( icon0 .eq. 0) then
65  write(0,*) 'not exists'
66  else
67  write(0,*) ' cannot be opened '
68  endif
69  write(0,*) ' icon=',icon0
70  stop 9999
71  else
72  write(0,*) hyb0(1:leng), ' opened'
73  endif
74 
75  evno0 =0
76  do while(.true.)
77  read( fn0, end=1000 ) histid0
78  100 continue
79  if( histid0 .eq. '#hist1' ) then
80  call kwhistr(h10, fn0, icon0)
81  read( h10%id(1:21), '(3x, i4, i3)') eventno,idx
82  do while (eventno .ne. evno0)
83  call get1hyb
84  enddo
85  write( h10%id(1:21),
86  * '(" # ", i4, i3, f5.2, f5.2)') eventno,
87  * idx, age0(idx), asdep(idx)/cog0
88  call kwhists(h10, 0.0)
89  call kwhistpr(h10, -6) ! to stdout
90  call kwhistd(h10)
91  elseif(histid0 .eq. '#hist2' ) then
92  call kwhistr2(h20, fn0, icon0)
93 
94  read( h20%id(1:21), '(3x, i4, i3)') eventno, idx
95  do while (eventno .ne. evno0)
96  call get1hyb
97  enddo
98  write( h20%id(1:21), '(" # ", i4, i3, f5.2, f5.2)') eventno,
99  * idx, age0(idx), asdep(idx)/cog0
100 
101  call kwhists2(h20, 0.0)
102  call kwhistpr2(h20, -6)
103  call kwhistd2(h20)
104  elseif(histid0 .eq. '#hist3' ) then
105  call kwhistr3(h30, fn0, icon0)
106 
107  read( h30%id(1:21), '(3x, i4, i3)') eventno, idx
108  do while (eventno .ne. evno0)
109  call get1hyb
110  enddo
111  write( h30%id(1:21), '(" # ", i4, i3, f5.2, f5.2)') eventno,
112  * idx, age0(idx), asdep(idx)/cog0
113 
114  call kwhists3(h30, 0.0)
115  call kwhistpr3(h30, -6)
116  call kwhistd3(h30)
117  else
118  write(0,*) 'histid=', histid0, ' invalid'
119  stop 9000
120  endif
121  enddo
122  1000 continue
123  write(0,*) 'all events processed '
124  end
125 ! **********************
126  subroutine get1hyb
127  implicit none
128  character*120 input0
129  integer i, klena
130 
131  integer ndepth
132  parameter(ndepth= 30)
133  integer fn1
134  real*8 ASdep(ndepth), munit(ndepth)
135  real*8 Esize0(ndepth),
136  * age0(ndepth), cogdep0(ndepth),
137  * seloss0(ndepth),
138  * ng0(ndepth), ne0(ndepth), nmu0(ndepth),
139  * cog0
140  integer EvNo0
141 
142  common /zbin2ascii/
143  * asdep, esize0, age0,
144  * cogdep0, seloss0, munit,
145  * ng0, ne0, nmu0, cog0,
146  * fn1, evno0
147  input0 = "x"
148  do while (input0 .ne. " ")
149  read( fn1 ,'(a)') input0
150  if(input0 .ne. " ") then
151  read(input0(1:klena(input0)), *)
152  * evno0, i, asdep(i), esize0(i), age0(i),
153  * cogdep0(i), seloss0(i),
154  * munit(i), ng0(i), ne0(i), nmu0(i), cog0
155  endif
156  enddo
157  end
158 
159 
integer npitbl real *nx parameter(n=101, npitbl=46, nx=n-1) real *8 uconst
subroutine get1hyb
integer function kgetenv2(envname, envresult)
Definition: cgetLoginN.f:77
void kwhistd(struct histogram1 *h)
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
integer leng
Definition: interface2.h:1
averg real MaxCPU integer idx(Maxp)
subroutine copenfw2(io, fnin, form, icon)
Definition: copenf.f:205
void kwhistr(struct histogram1 *h, FILE *bfnor, int icon)
void kwhists(struct histogram1 *h, float inorm)
void kwhistpr(struct histogram1 *h, FILE *fno)