COSMOS v7.655  COSMOSv7655
(AirShowerMC)
chookASbyH2.f
Go to the documentation of this file.
1 !
2 ! chookASbyH2: This is a special user hook to compute
3 ! AS generated by heavy primaries with
4 ! generate='qas'. This is a slave of chookASbyH.
5 !
6  subroutine chookbgrunas
7  implicit none
8 #include "Zmanagerp.h"
9  include "ZASbyH.h" ! this is in UserHook
10  integer ios, i,j
11 
12 
13 ! open component disk file,
14 ! We assume that over all information is in the first
15 ! and 2nd record of the direct access file.
16 ! and record number =3 to NoOfCompS + 2 have component showers.
17 !
18 ! *************** record organization *****************
19 !
20 ! First rec: NoOfCompS, NdpethComp, E0
21 ! Second rec: Depths
22 ! later rec: first collision depth (vertical) and sizes, ages
23 !
24 ! ****************************************************
25 
26 
27 !
28 !
29 !
30  open(13, file='cs', status='OLD')
31 
32 ! read direct access file.
33 ! Number of compoentent showers
34 ! Number of depths
35 ! Depth list
36 
37  read(13, *) noofcomps, ndepthcomp, e0comp
38  * , firstcoldep
39  if(noofcomps .gt. ncs) then
40  write(0, *) 'too many comp showers '
41  stop
42  endif
43  read(13, *)
44  * (depthcomp(i), i = 1, ndepthcomp)
45 
46  do i=1,noofcomps
47  read(13,*) (elecsizecomp(i,j),j=1,ndepthcomp)
48  read(13,*) (elecagecomp(i,j),j=1,ndepthcomp)
49  end do
50 
51  close(13)
52 
53  end
54 
55  subroutine chooknepinta
56  implicit none
57 #include "Zcode.h"
58 #include "Ztrack.h"
59 #include "Ztrackv.h"
60 #include "Zobs.h"
61 #include "Zobsv.h"
62  include "ZASbyH.h"
63 ! #include "Ztrackp.h"
64 
65 
66 
67 ! MovedTrack is the particle that made interaction
68 ! Pwork contains produced particles.
69 ! Nproduced has the number of particles in Pwork
70 ! IntInfArray(ProcessNo) contains the type of interaction
71 !
72 ! IntInfArray(ProcessNo).process will have
73 ! 'col' or 'decay'
74 
75  integer i, recn, ios, j
76  integer noofintn ! no. of interacting nucleons
77  type(ptcl):: ptcla(maxheavymassn) ! to get nucleon inf.
78  real*8 u ! uniform random number
79  real*8 esizetemp(ndepthcompm), depstep, depfirst, dep
80  real*8 eagetemp(ndepthcompm)
81  real*8 ans, zobs, t, cosz, length, clenbetween2h, eno
82  real*8 clen2thick, age
83 
84 
85 ! inquire the interacting nucleons
86  call cqinteptcl(ptcla, noofintn)
87 
88 
89 ! for each nucleon
90  do i = 1, noofintn
91 ! select a component shower
92  call rnde(u, 1) ! get one unif. random. n.
93 !
94  recn = u* noofcomps + 1
95 
96 ! you may need to verify that
97 ! the primary energy of the component shower and
98 ! ptclA.fm.p(4) is almost the same for safety.
99 
100  depfirst = depthcomp(1) ! first depth
101  depstep = depthcomp(2) - depthcomp(1) ! equi step depth
102 
103 
104 ! move to real*8 array for use of kintp3
105  do j =1, ndepthcomp
106  esizetemp(j) = elecsizecomp(recn,j) ! log10( size )
107  eagetemp(j) = elecagecomp(recn, j)
108 
109  enddo
110 ! cos of c.s
111  cosz = movedtrack.vec.coszenith
112 ! compute size at
113  do j = 1, noofassites
114  zobs = asobssites(j).pos.depth
115 ! current nucleon depth to obseration depth
116 ! (vertical depth)
117  dep = zobs - movedtrack.pos.depth
118  if(dep .gt. 0.) then
119  if(abs(cosz) .gt. 0.5) then
120 ! amount of air
121  t= dep/abs(cosz)
122  else
123 ! slant lenngth between two depths
124  length = clenbetween2h(
125  * movedtrack.pos.radiallen,
126  * asobssites(j).pos.radiallen,
127  * cosz)
128 ! amount of air
129  t = clen2thick(
130  * movedtrack.pos.height,
131  * cosz, length)
132  endif
133 ! current obs depth corresponds to dep in c.s
134  dep = t + firstcoldep
135 ! interpolate; use diff. one if DepthComp is not
136 ! equisteped.
137  call kintp3(esizetemp, 1, ndepthcomp, depfirst,
138  * depstep, dep, ans)
139 
140 
141 ! *********************************
142 ! for age
143  call kintp3(eagetemp, 1, ndepthcomp, depfirst,
144  * depstep, dep, age)
145 ! *********************************
146 
147 ! IMPORTANT: assume that eSizeTemp is in log10
148  eno = 10.**ans * movedtrack.wgt
149 
150  asobssites(j).esize = asobssites(j).esize + eno
151 
152 ! *********************************************
153  asobssites(j).age = asobssites(j).age +
154  * eno * age
155 ! *********************************************
156  endif
157  enddo
158 
159  enddo
160  end
161 !**********
162 
163 ! IMPORTANT: assume that eSizeTemp is in log10
164  eno = 10.**ans * movedtrack.wgt
165  asobssites(j).esize = asobssites(j).esize + eno
166 
167 ! *********************************************
168 ! ASObsSites(j).age = ASObsSites(j).age +
169 ! * eno * age
170 ! *********************************************
171  endif
172  enddo
173  enddo
174  end
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos depth
Definition: ZavoidUnionMap.h:1
subroutine cqinteptcl(ptclA, num)
Definition: cinteraction.f:482
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
nodes i
real *8 function clen2thick(z, cosz, leng)
Definition: clen2thick.f:27
real *8 function clenbetween2h(h1, h2, cost)
Definition: catmosutil.f:138
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos height
Definition: ZavoidUnionMap.h:1
*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
nodes t
subroutine kintp3(f, intv, n, x1, h, x, ans)
Definition: kintp3.f:19
const int maxheavymassn
Definition: Zcode.h:60
Definition: Zptcl.h:75
*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 *Zfirst wgt
Definition: ZavoidUnionMap.h:1
subroutine rnde(ua, n)
Definition: rnd.f:316
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos radiallen
Definition: ZavoidUnionMap.h:1