COSMOS v7.655  COSMOSv7655
(AirShowerMC)
getST3.f
Go to the documentation of this file.
1 #include "BlockData/cblkGene.h"
2  implicit none
3 #include "Zglobalc.h"
4 #include "Zmanagerp.h"
5 #include "ZrigCut.h"
6 #include "Zptcl.h"
7 #include "Zobs.h"
8 #include "Zobsp.h"
9 #include "Zprimary.h"
10 #include "Zprimaryc.h"
11 #include "Zprimaryv.h"
12 #include "Zincidentp.h"
13 #ifdef NEXT486
14 #define IMAG_P dimag
15 #else
16 #define IMAG_P imag
17 #endif
18  include 'Zflux.h'
19 
20  integer i
21 
22  real*8 cosmin, cosmax
23  real*8 ans, sum, dazim
24  logical deg
25 
26  call creadparam(5)
27  call cbeginrun
28  call cprintprim(errorout)
29  cosmax = imag_p(coszenith)
30  cosmin = real(coszenith)
31  azmmax = imag_p(azimuth) + xaxisfromsouth
32  azmmin = real(Azimuth) + XaxisFromSouth
33  dazim =abs(azmmax-azmmin)*torad
34  if(cosmax .ne. cosmin) then
35  write(*, *) ' this program is to compute integral of'
36  write(*, *) ' primary for a fixed zenith angle '
37  write(*, *) ' give the same lower and upper limit for'
38  write(*, *) ' CosZenith'
39  stop 9999
40  elseif( (abs(imag_p(azimuth)-real(azimuth))/360.d0 -1.d0)
41  * .gt. 1.d-3 ) then
42  if(azmmax .ne. azmmin) then
43  write(*,*) ' warning: fai region is not 2pi '
44  write(*,*)
45  * ' integral will be performed in the given fai region'
46  else
47  write(*,*) ' no fai region; for a fixed fai'
48  write(*,*) ' use getST2'
49  stop 9999
50  endif
51  endif
52  if(cutofffile .eq. ' ') then
53  rigc = 0.
54  deg = .false.
55  else
56  rigc = 100.
57  if(zenvalue .eq. 'deg') then
58  deg = .true.
59  else
60  deg = .false.
61  endif
62  endif
63  zen1 = cosmin
64 
65 
66  write(*,*)
67  * ' cos value=',zen1
68  write(*,*)
69  * ' fai region=', real(Azimuth),' to ',
70  * imag_p(azimuth), ' deg'
71  write(*,*) ' X-axis From South=', xaxisfromsouth, ' deg'
72 
73  write(*,*)
74  if(rigc .eq. 0) then
75  write(*,*) ' No rigidity cut is assumed'
76  write(*,*)
77  " ' primary Int(dI/dE) sum(cumlative);'
78  else
79  write(*,*) ' Rigidity cut is applied'
80  write(*,*)
81  " ' primary Int(dI/dE*RigCut) sum(cumlative);'
82  endif
83  sum = 0.
84  do i = 1, prim%no_of_comps
85  call inteflux(prim%each(i), ans)
86  sum = sum + ans
87  write(*,*)' ', prim%each(i)%symb,' ', sngl(ans),
88  * ' ', sngl(sum)/dazim
89  enddo
90 
91  write(*,*)
92  * 'If N primaries are generated in simulation,',
93  * 'ST2pidcos= N/sum'
94  write(*,*) 'if azimuthal angle range is not 0~2pi',
95  * ' 2pi in ST2pidcos has been adjusted'
96 
97  end
98 ! ******************
99  subroutine inteflux(comp, ans)
100  implicit none
101 #include "Zglobalc.h"
102 #include "Zptcl.h"
103 #include "Zprimary.h"
104  type(component):: comp
105  real*8 ans
106  include 'Zflux.h'
107 
108  real*8 eps, error, ans2, Eth, e_or_p
109  integer icon
110 
111 
112  integer imax
113  external primdn
114  real*8 primdN
115  type(ptcl)::aptcl
116  integer j
117  data eps/1.d-4/
118 
119 
120 
121  compx = comp
122  imax = comp%no_of_seg
123  if(rigc .eq. 0.) then
124 ! no rigidy cut. integrate segmented power functions
125  call inteprim2(comp, 1, imax, ans)
126  if(abs(ans/comp%inte_value-1.d0) .gt. 1.d-3 ) then
127  write(*,*) ' ans=',ans, ' internal integral=',
128  * comp%inte_value
129  stop 9999
130  endif
131  else
132  call cmkptc(comp%code, comp%subcode, comp%charge, aptcl)
133  eth =sqrt( (rigc*comp%charge)**2 + aptcl%mass**2 )
134  call cconv_prim_e2(comp, eth, e_or_p)
135  call kdwhereis(e_or_p, comp%no_of_seg+1, comp%energy, 1, j)
136  if(j .le. imax) then
137 ! energy integral;
138  call kdexpintfb(primdn, comp%energy(1), comp%energy(j+1),
139  * eps, ans, error, icon)
140  ans = ans * torad
141  endif
142 ! add E> comp.energy(j+1)
143  if(j+1 .lt. imax ) then
144  call inteprim2(comp, j+1, imax, ans2)
145  ans2 = ans2 * abs(azmmax - azmmin)*torad
146  else
147  ans2 = 0.
148  endif
149  ans = ans + ans2
150  endif
151  end
152 
153 ! ****************************
154  real*8 function primdn(eorp)
155  implicit none
156 
157 #include "Zglobalc.h"
158 #include "Zptcl.h"
159 #include "Zprimary.h"
160 ! primary flux at E
161  real*8 eorp
162 
163  include 'Zflux.h'
164 
165 
166  integer icon
167 
168  real*8 eps, ans, error
169  real*8 funcazim
170  external funcazim
171  data eps/1.d-5/
172 
173  e = eorp
174  zen = zen1
175  call kdexpintf(funcazim, azmmin, azmmax, eps, ans, error, icon)
176  primdn = ans
177  end
178 !.......................
179  real*8 function funcazim(azm)
180  implicit none
181 #include "Zglobalc.h"
182 #include "Zptcl.h"
183 #include "Zprimary.h"
184  include 'Zflux.h'
185 
186  type(ptcl):: aptcl
187  real*8 rig, azm, prob, flux, zeny
188 
189 ! E= E_or_P must be converted to rigidity
190  call cconv_prim_e(compx, e, aptcl)
191 
192  rig =sqrt( aptcl%fm%p(4)**2 - aptcl%mass**2)/aptcl%charge
193  if(degree) then
194  zeny = zen/torad
195  else
196  zeny = zen
197  endif
198  call crigcut(azm, zeny, rig, prob)
199  call cprimflux0(compx, e, flux) ! E = EorP
200  funcazim = flux * prob
201  end
202 
203  subroutine chooktrace
204  end
205  subroutine chookceren
206  end
207  subroutine chookcerens
208  end
209  subroutine chookcerene
210  end
211  subroutine chookbgrun
212  end
213 
real *8 function primdn(eorp)
Definition: getST.f:246
real zen1
Definition: Zflux.h:1
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
atmos%rho(atmos%nodes) **exp(-(z-atmos%z(atmos%nodes))/Hinf) elseif(z .lt. atmos%z(1)) then ans=atmos%rho(1) **exp((atmos%z(1) -z)/atmos%H(1)) else call kdwhereis(z, atmos%nodes, atmos%z, 1, i) a=atmos%a(i) if(a .ne. 0.d0) then ans=atmos%rho(i) **(1+a *(z-atmos%z(i))/atmos%H(i)) **(-1.0d0-1.d0/a) else ans=*atmos%rho(i) *exp(-(z-atmos%z(i))/atmos%H(i)) endif endif ! zsave=z ! endif cvh2den=ans end ! ---------------------------------- real *8 function cvh2temp(z) implicit none ! vettical height to temperatur(Kelvin) real *8 z ! input. vertical height in m ! output is temperature of the atmospher in Kelvin real *8 ans integer i if(z .gt. atmos%z(atmos%nodes)) then ans=atmos%T(atmos%nodes) elseif(z .lt. atmos%z(1)) then ans=atmos%T(1)+atmos%b(1) *(z - atmos%z(1)) else call kdwhereis(z, atmos%nodes, atmos%z, 1, i) ans=atmos%T(i)+atmos%b(i) *(z-atmos%z(i)) endif cvh2temp=ans end !--------------------------------------------- real *8 function cthick2h(t) implicit none real *8 t ! input. air thickness in kg/m^2 real *8 logt, ans integer i real *8 dod0, fd, a logt=log(t) if(t .ge. atmos%cumd(1)) then ans=atmos%z(1) - *(logt - atmos%logcumd(1)) *atmos%H(1) elseif(t .le. atmos%cumd(atmos%nodes)) then ans=atmos%z(atmos%nodes) - *Hinf *log(t/atmos%cumd(atmos%nodes)) else call kdwhereis(t, atmos%nodes, atmos%cumd, 1, i) ! i is such that X(i) > x >=x(i+1) ans
real *8 function funcazim(azm)
Definition: getST.f:286
nodes i
subroutine crigcut(azmin, zen, rig, prob)
Definition: crigCut.f:6
subroutine cconv_prim_e2(comp, E, e_or_p)
Definition: csampPrimary.f:230
subroutine kdwhereis(x, in, a, step, loc)
Definition: kdwhereis.f:27
real * azmmin
Definition: Zflux.h:1
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
subroutine cprintprim(out)
Definition: cprintPrim.f:3
subroutine cconv_prim_e(comp, e_or_p, aPtcl)
Definition: csampPrimary.f:128
subroutine chookceren
Definition: det2Exyz.f:63
real rigc
Definition: Zflux.h:1
subroutine creadparam(io)
Definition: creadParam.f:5
subroutine chooktrace
Definition: chook.f:275
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine kdexpintf(func, a, b, eps, ans, error, icon)
Definition: kdexpIntF.f:55
subroutine kdexpintfb(func, a, b, eps, ans, error, icon)
Definition: kdexpIntFb.f:10
subroutine chookcerene
Definition: det2Exyz.f:67
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos *Zfirst pos *Zfirst Zfirst vec w *Zfirst vec w Zfirst vec coszenith
Definition: ZavoidUnionMap.h:1
subroutine chookcerens(no, primary, angle)
Definition: ctemplCeren.f:19
subroutine inteprim2(comp, i1, i2, ans)
Definition: intePrim2.f:2
subroutine cprimflux0(comp, e_or_p, flux)
Definition: cprimFlux0.f:2
subroutine inteflux(comp, ans)
Definition: getST.f:150
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 ! knockon is considered Obsolete *PhotoProd false
Definition: cblkElemag.h:7
subroutine cmkptc(code, subcode, charge, p)
Definition: cmkptc.f:15
real azmmax
Definition: Zflux.h:1
Definition: Zptcl.h:75
subroutine cbeginrun
Definition: cbeginRun.f:7
real zen
Definition: Zflux.h:1
subroutine chookbgrun
Definition: chook.f:15
real zen logical degree
Definition: Zflux.h:1