COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cprocPrimDt.f
Go to the documentation of this file.
1 ! ********************************************************
2  subroutine cprocprimdt(prm)
3 ! process primaries( examine primary data in prm. and
4 ! make some computation and store the results in prm)
5 ! character data is coverted into lower case.
6 ! prm: /primaries/ Input/output
7 !
8  implicit none
9 
10 #include "Zmanagerp.h"
11 #include "Zptcl.h"
12 #include "Zprimary.h"
13 !
14  type(primaries):: prm
15 
16  character*70 msg
17 !
18  integer i, icon
19  character*10 temp1
20 !
21  icon = 0
22  prm%NoOfSamplings = eventsintherun ! counter, including discarded ones
23  ! how many primaries generated
24  eventno = preveventno ! the same
25 
26  do i = 1, prm%no_of_comps
27  prm%NoOfSampComp(i, 1) =0 ! all
28  prm%NoOfSampComp(i, 2) =0 ! only for accepted ones
29 ! to lower case string
30  temp1 = prm%each(i)%symb
31  call c2lowercase(temp1, prm%each(i)%symb)
32  temp1 = prm%each(i)%eunit
33  call c2lowercase(temp1, prm%each(i)%eunit)
34  temp1 = prm%each(i)%etype
35  call c2lowercase(temp1, prm%each(i)%etype)
36  temp1 = prm%each(i)%diff_or_inte
37  call c2lowercase(temp1, prm%each(i)%diff_or_inte)
38 !
39  prm%each(i)%label = i ! numbering
40  call cexmprimsymb(prm%each(i), icon)
41  call cexmprimeu(prm%each(i),icon)
42  call cmkprimstbl(prm%each(i),icon)
43  enddo
44  if(icon .ne. 0) then
45  write(msg, *) ' correct primary data table'
46  call cerrormsg(msg, 0)
47  endif
48  prm%cummInteFlux(1) = prm%each(1)%inte_value
49  do i = 1, prm%no_of_comps-1
50  prm%cummInteFlux(i+1) = prm%cummInteFlux(i)
51  * + prm%each(i+1)%inte_value
52  enddo
53 ! normalize
54  do i = 1, prm%no_of_comps
55  prm%cummInteFlux(i) = prm%cummInteFlux(i) /
56  * prm%cummInteFlux(prm%no_of_comps)
57  enddo
58  end
59 ! ***********************************
60  subroutine cexmprimsymb(each, icon)
61 ! ***********************************
62 ! examine a given primary symbol and if it is valid
63 ! one, set each.code, each.subcode, each.charge
64 ! if not, icon = 1 is given.
65 !
66  implicit none
67 
68 #include "Zptcl.h"
69 #include "Zprimary.h"
70 #include "Zprimaryc.h"
71  type(component):: each
72  integer icon
73 !
74 !
75  character*12 symb
76  integer k, pap, massn, chgn
77  character*70 msg
78  integer:: kf
79 
80  symb = each%symb
81  icon = 0
82  k = index(symb, '~')
83  if(k .gt. 0) then
84 ! anti particle specification
85  pap = 1
86  symb = symb(1:k-1) !drop ~
87  else
88  pap = 0
89  endif
90 !
91  k = 1
92  if(symb(1:3) .eq. 'iso') then
93 ! read A, Z
94  read(symb(4:12), *) massn, chgn
95  if(massn .le. chgn) then
96  write(msg,*) ' primary =',symb,
97  * ' invalid(becaus A=',massn,'<= Z=',chgn
98  call cerrormsg(msg, 0)
99  endif
100  each%subcode = massn
101  each%charge = chgn
102  symb = 'iso' ! erase A and Z
103  elseif(symb(1:3) .eq. 'pdg') then
104 ! read PDG code ! no heavy primary
105  read(symb(4:12), *) kf
106  call ckf2cos(kf, each%code, each%subcode, each%charge)
107  symb = 'pdg' ! erase kf code
108  return !!!!!!!
109  endif
110 
111 
112 
113  do while ( k .le. noofsymbols )
114  if(primaryidtbl(k)%symb .eq. symb) then
115  each%code = primaryidtbl(k)%code
116  each%subcode = primaryidtbl(k)%subcode
117  each%charge = primaryidtbl(k)%charge
118  k = noofsymbols +1
119  endif
120  k = k+1
121  enddo
122 
123  if(k .ne. noofsymbols + 2) then
124  write(msg, *) each%label, '-th primary component=',
125  * each%symb,' invalid'
126  call cerrormsg(msg, 1)
127  icon = 1
128  else
129  if(pap .ne. 0) then
130 ! anti particle
131  each%charge = - each%charge
132  if( symb .ne. 'iso' ) then
133  each%subcode = - each%subcode
134  endif
135  endif
136  endif
137  end
138 ! *********************************
139  subroutine cexmprimeu(each, icon)
140 ! *********************************
141 ! examine a given primary energy unit and if it is valid
142 ! one, set each.togev
143 ! if not, icon = 1 is given.
144 !
145  implicit none
146 #include "Zptcl.h"
147 #include "Zprimary.h"
148 #include "Zprimaryc.h"
149  type(component):: each
150  integer icon
151 !
152 !
153  character*12 symb
154  integer k
155  character*70 msg
156 
157  symb = each%eunit
158 !
159  k = 1
160  do while ( k .le. maxergunit)
161  if(ergunittbl(k)%symb .eq. symb) then
162  each%togev = ergunittbl(k)%togev
163  k = maxergunit +1
164  endif
165  k = k+1
166  enddo
167  if(k .ne. maxergunit + 2) then
168  write(msg, *) each%label, '-th primary energy unit symbol=',
169  * each%eunit,' invalid'
170  call cerrormsg(msg, 1)
171  icon = 1
172  endif
173 ! set emin and emax
174  each%emin = each%energy(1)
175  each%emax = each%energy(each%no_of_seg + 1)
176  end
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
subroutine ckf2cos(kf, code, subcode, chg)
Definition: ckf2cos.f:2
subroutine c2lowercase(cu, cl)
Definition: c2lowerCase.f:11
subroutine cexmprimsymb(each, icon)
Definition: cprocPrimDt.f:61
subroutine cprocprimdt(prm)
Definition: cprocPrimDt.f:3
subroutine cexmprimeu(each, icon)
Definition: cprocPrimDt.f:140
subroutine cmkprimstbl(each, icon)
Definition: cmkPrimSTbl.f:3
const int maxergunit
Definition: Zprimary.h:25