COSMOS v7.655  COSMOSv7655
(AirShowerMC)
crdPrimData.f
Go to the documentation of this file.
1 ! include '../Sysdep/copenf.f'
2 ! include '../Sysdep/cskipComment.f'
3 !c test crdPrimData etc
4 !c
5 ! include '../Particle/Zptcl.h'
6 ! include 'Zprimary.h'
7 ! type(primaries):: Prm
8 ! call copenf(TempDev,
9 ! * '../Data/Primary/sample.d')
10 ! call cskipComment(TempDev, icon)
11 ! call crdPrimData(Prm)
12 ! write(*, *) ' no. of comps=', Prm.no_of_comps
13 ! end
14 ! *************************************************
15 ! * crdPrimData: read primary information
16 !
17  subroutine crdprimdata(prm)
18  implicit none
19 #include "Zmanagerp.h"
20 #include "Zptcl.h"
21 #include "Zprimary.h"
22 #include "Zprimaryc.h"
23 #include "Zprimaryv.h"
24 
25  type(primaries):: prm
26  type(component):: onecomp
27 !
28  integer icon, n
29 !
30  n = 0
31  icon = 0
32  do while(icon .eq. 0)
33 ! call crdCompPrim(prm.each(n+1),
34  call crdcompprim(onecomp,
35  * n+1, icon) ! each component of primaries.
36  if(icon .eq. 0) then
37  n = n + 1
38  if(n .gt. maxnoofcomps) then
39  write(0,*) ' # of 1ry comp. > maxNoOfComps=',
40  * maxnoofcomps
41  write(0,*) ' change the value in Zmaxdef%h '
42  stop
43  endif
44  prm%each(n)= onecomp
45  endif
46  enddo
47 
48  close(tempdev)
49 
50  if(n .le. 0) then
51  write(*,*) ' no primary is given'
52  stop 9999
53  endif
54  prm%no_of_comps = n
55  end
56 ! ***********************************************
57  subroutine crdcompprim(each, n, icon)
58 ! ***********************************************
59 ! each: /component/. Output. one composition of primary data is read
60 ! n: integer. Input. n+1-th block in the table is next data
61 ! icon: integer. output. 0--> more data
62 ! 1--> eof reached.
63  implicit none
64 
65 #include "Zmanagerp.h"
66 #include "Zptcl.h"
67 #include "Zprimary.h"
68 #include "Zprimaryc.h"
69  integer n !n+1-th primary data in the table is being read
70  integer icon
71  type(component):: each
72  integer ios, np ! np is the data points counter
73 ! read 1ry type, energy unit, energy type, etc
74  each%cut = 0.
75  each%cut2 = 0.
76  read(tempdev, *, iostat=ios) each%symb, each%eunit,
77  * each%etype, each%diff_or_inte, each%flatterer, each%cut,
78  * each%cut2
79 !
80  if(ios .eq. 0) then
81 ! ! not yet eof or no error
82  np = 0 ! segment counter
83  do while(.true.) ! read until end of 1 block
84  read(tempdev, *, iostat =ios)
85  * each%energy(np+1),
86  * each%flux(np+1)
87  if(ios .ne. 0) then
88  write(*, *) ' error in the primary data'
89  write(*, *) ' data position: Primary block=',
90  * n+1,' segment # =', np + 1
91  close(tempdev)
92  stop 9999
93  endif
94 ! see if end of the composition
95  if(each%energy(np+1) .le. 0.) goto 100
96  np = np + 1
97  if(np .gt. maxsegments+1) then
98  write(*, *) 'too many segments in ',n+1,
99  * '-th composition. must be <',maxsegments+1
100  close(tempdev)
101  stop 9999
102  endif
103  enddo
104  100 continue
105  each%no_of_seg =max(0, np -1) ! segments
106 ! note that each.no_of_seg is data points -1
107 ! (2 points makes a segment !)
108  icon = 0
109  else
110  icon = 1 ! eof
111  endif
112  end
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
subroutine crdcompprim(each, n, icon)
Definition: crdPrimData.f:58
const int maxnoofcomps
Definition: Zprimary.h:21
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
const int maxsegments
Definition: Zprimary.h:16
subroutine crdprimdata(prm)
Definition: crdPrimData.f:18