COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ciniTracking.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine cinitracking (incident)
 
subroutine cprimxyz
 
subroutine csetobsz (converter)
 
subroutine cqfirstid (depth)
 
subroutine cqfirstipi (ptrack)
 
subroutine cqfirstcolmedia (A, Z, xs)
 
subroutine ciniasobs
 
subroutine csetemin (gen, eminob, emin, emCas)
 
subroutine cexamparam
 

Function/Subroutine Documentation

◆ cexamparam()

subroutine cexamparam ( )

Definition at line 344 of file ciniTracking.f.

Referenced by cinitracking().

344  implicit none
345 #include "Ztrackp.h"
346 #include "Zelemagp.h"
347 
Here is the caller graph for this function:

◆ ciniasobs()

subroutine ciniasobs ( )

Definition at line 224 of file ciniTracking.f.

Referenced by cinitracking().

224  implicit none
225 
226 #include "Zcoord.h"
227 #include "Zpos.h"
228 #include "Zmagfield.h"
229 #include "Zobs.h"
230 #include "Zobsp.h"
231 #include "Zobsv.h"
232 
233  integer i
234 
235  do i = 1, noofassites
236  asobssites(i)%esize = 0.
237  asobssites(i)%age = 0.
238  enddo
nodes i
Here is the caller graph for this function:

◆ cinitracking()

subroutine cinitracking ( type(track incident)

Definition at line 2 of file ciniTracking.f.

References cerrormsg(), cexamparam(), cgeomag(), ciniasobs(), cl2ttbl(), copenfw(), cprimxyz(), csetemin(), csetobsz(), ctransmagto(), cxyz2det(), cxyz2prim(), d0, d3, horizontal, kseblk(), maxl2t, notused, perpendicular, and spherical.

Referenced by __det2prim.f__(), __det2prim2.f__(), cbegin1ev(), ceventloop(), cresetprim(), and cresetprim2().

2 ! this is called after primary is fixed.
3  implicit none
4 
5 #include "Zmanagerp.h"
6 #include "Ztrack.h"
7 #include "Ztrackp.h"
8 #include "Ztrackv.h"
9 #include "Zobs.h"
10 #include "Zobsp.h"
11 #include "Zobsv.h"
12 #include "Zatmos.h"
13 #include "Zincidentv.h"
14 #include "Zearth.h"
15 
16  external cxyz2prim, cxyz2det
17  integer klena, leng, icon
18  real*8 zanglesave, r1, r2, cosx, lengx
19  real*8 clenbetween2h, cnewcos
20  character*80 tracefile
21  type(track)::incident
22  type(coord)::xyz
23  integer i
24  data zanglesave/-1.d30/
25  save zanglesave
26 
27 
28  zfirst%pos%depth = 0.
29  zsave = -1.d30
30 #if LABELING > 0
31  labelcounter = 0
32 #endif
33 !
34  if(job .eq. 'flesh') then
35  call csetemin(generate2, keminobs2(1), kemin2, kemincas2)
36  call csetemin(generate, keminobs(1), kemin, kemincas)
37  else
38  call csetemin(generate, keminobs(1), kemin, kemincas)
39  kemin2 = kemin
40  kemincas2 = kemincas
41  endif
42 
43 
44  call cprimxyz ! compute primary x,y,z axis in 'xyz' system
45  if((trace .gt. 0 .and. trace .lt. 60) .or.
46  * (trace .gt. 100 .and. trace .lt. 160) ) then
47 ! default trace output is requested. Open disk file
48  write(tracefile, *) tracedir(1:klena(tracedir))//'/trace',
49  * eventno
50  call kseblk(tracefile, ' ', leng)
51  call copenfw(tracedev, tracefile(1:leng), icon)
52  if(icon .ne. 0) then
53  call cerrormsg('tracefile couldnot be opened',0)
54  endif
55  elseif(trace .gt. 60 .and. trace .lt. 100 .or.
56  * trace .gt. 160 .and. trace .lt. 200) then
57  call cputcerenkovs ! cerenkov output header for each event
58  endif
59 !
60  call ciniasobs
61  if(abs(obsplane) .eq. horizontal .or.
62  * obsplane .eq. spherical) then
63  call csetobsz(cxyz2det)
64  elseif(abs(obsplane) .eq. perpendicular ) then
65  call csetobsz(cxyz2prim)
66 ! inicident.where can be fixed here. not in cmkIncidnt
67  call cxyz2prim(obssites(noofsites)%pos%xyz,
68  * incident%pos%xyz, xyz)
69  do i = 1, noofsites
70  if(xyz%r(3) .gt. obssites(i)%zpl ) then
71  incident%where = i
72  goto 222
73  endif
74  enddo
75  incident%where = noofsites + 1
76  incidentcopy%where = incident%where
77  222 continue
78  elseif(obsplane .eq. notused ) then
79 ! Nothing to do. observation is at height =
80 ! BorderHeighL. (for neutrino)
81  else
82  call cerrormsg('ObsPlane value is wrong', 0)
83  endif
84 ! check some parameters
85  call cexamparam
86 ! if one dimensional and large angle, use table method
87 ! for lenth <--> thickness conversion. make table for that
88  usetbl = onedim .eq. 3 .or.
89  * ( onedim .eq. 2 .and.
90  * abs( angleatobscopy%r(3) ) .lt. 0.5 )
91  usetbl = usetbl .and. .not. upgoing
92  if(usetbl .and. zanglesave .ne. angleatobscopy%r(3) ) then
93  hbase = heightlist(noofsites) - 0.3d0 ! make little bit smaller
94  htop =100.d3 ! old value was 30d3
95  r1 = htop + eradius
96  r2 = hbase + eradius
97  lengx = clenbetween2h(r2, r1, -angleatobscopy%r(3))
98  cosx = cnewcos(r2, -angleatobscopy%r(3), lengx)
99  call cl2ttbl(htop, hbase, cosx, -angleatobscopy%r(3),
100  * lenstep,
101  * lentbl, heighttbl, costbl, thicktbl, maxl2t, numstep)
102  zanglesave = angleatobscopy%r(3)
103  endif
104 ! fix B at the starting point
105  if( howgeomag .le. 2 .or. howgeomag .eq. 31 ) then
106  call cgeomag(yearofgeomag, incident%pos%xyz, mag, icon)
107  call ctransmagto('xyz', incident%pos%xyz, mag, mag)
108  else
109  mag = magfieldxyz
110  endif
111 
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
block data cblkIncident data *Za1ry *HeightOfInj d3
Definition: cblkIncident.h:7
latitude latitude this system is used *****************************************************************! type coord sequence union map real z z in m endmap xyz map real ! latitude in deg is to the north ! longitude in deg is to the east *h ! height in m endmap llh map real ! polar angle ! azimuthal angle *radius ! radial distance endmap sph endunion character *sys ! which system xyz
Definition: Zcoord.h:25
real *8 function clenbetween2h(h1, h2, cost)
Definition: catmosutil.f:138
const int notused
Definition: Zobs.h:16
Definition: Ztrack.h:44
subroutine csetobsz(converter)
Definition: ciniTracking.f:155
subroutine cgeomag(yearin, llh, h, icon)
Definition: cgeomag.f:25
integer leng
Definition: interface2.h:1
subroutine cxyz2prim(base, a, b)
Definition: cxyz2prim.f:5
subroutine ciniasobs
Definition: ciniTracking.f:224
subroutine csetemin(gen, eminob, emin, emCas)
Definition: ciniTracking.f:242
! Zobs h header file for observation sites definition ! integer horizontal
Definition: Zobs.h:4
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
! for length to thickness conversion or v v ! integer maxl2t
Definition: Zatmos.h:3
subroutine copenfw(io, fnin, icon)
Definition: copenf.f:122
integer function klena(cha)
Definition: klena.f:20
real *8 function cnewcos(H, cost, L)
Definition: catmosutil.f:70
subroutine cexamparam
Definition: ciniTracking.f:344
subroutine ctransmagto(sys, pos, a, b)
Definition: ctransMagTo.f:11
Definition: Zcoord.h:43
subroutine cprimxyz
Definition: ciniTracking.f:116
subroutine cxyz2det(det, a, b)
Definition: cxyz2det.f:7
! Zobs h header file for observation sites definition ! integer * perpendicular
Definition: Zobs.h:4
subroutine kseblk(text, c, lc)
Definition: kseblk.f:18
subroutine cl2ttbl(h1, h2, cosz1, cosz2, step, lengtb, htb, costb, thicktb, maxsize, tblsize)
Definition: cl2tTbl.f:8
const int spherical
Definition: Zobs.h:19
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cprimxyz()

subroutine cprimxyz ( )

Definition at line 116 of file ciniTracking.f.

References cvecprod(), and e.

Referenced by cinitracking().

116  implicit none
117 #include "Ztrack.h"
118 #include "Zincidentv.h"
119 #include "Zobs.h"
120 #include "Zobsv.h"
121 ! all are unit vector in 'xyz' system.
122 !
123 ! X = Z x V ( Z is primary direction; V is vertical axis )
124 ! = V x(-Z)
125 ! = V x DcAtObsXyz = DetZaxis.r(1) DcAtObsXyz
126 ! Y = Z x X = X x (-Z)
127 ! = X x DcAtObsXyz
128 !
129 ! compute Xprimary, Yprimary, Zprimary in 'xyz' system.
130 
131  real*8 temp
132 !
133  zprimary%r(:) = - dcatobsxyz%r(:)
134  call cvecprod(zprimary, detzaxis, xprimary)
135 ! see if Zprimary // DetZaxis; if so reset Xprimary
136  temp= sum( xprimary%r(:)**2 )
137  if(temp .lt. 1.e-12) then
138  xprimary = detxaxis
139  else
140  temp =sqrt(temp)
141 ! ifort v14 dies here if (:) is used
142  xprimary%r(1) = xprimary%r(1)/temp
143  xprimary%r(2) = xprimary%r(2)/temp
144  xprimary%r(3) = xprimary%r(3)/temp
145  endif
146  call cvecprod(zprimary, xprimary, yprimary)
147  txyz2prim(1,:) = xprimary%r(:)
148  txyz2prim(2,:) = yprimary%r(:)
149  txyz2prim(3,:) = zprimary%r(:)
150  tprim2xyz(:,:) = transpose(txyz2prim(:,:))
151 
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
subroutine cvecprod(a, b, c)
Definition: cvecProd.f:4
real(4), dimension(:), allocatable, save temp
Definition: cNRLAtmos.f:29
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cqfirstcolmedia()

subroutine cqfirstcolmedia ( integer, intent(out)  A,
integer, intent(out)  Z,
real(8), intent(out)  xs 
)

Definition at line 211 of file ciniTracking.f.

Referenced by chookenevent().

211 ! retrns first col. element and Xsecion on it
212  implicit none
213 #include "Ztrack.h"
214 #include "Ztrackv.h"
215  integer,intent(out):: a
216  integer,intent(out):: z
217  real(8),intent(out):: xs
218  a = firstcola
219  z = firstcolz
220  xs = firstcolxs
nodes z
! constants thru Cosmos real ! if multiplied to deg radian Torad ! light velocity m sec ! infinty ! kg m2 *Togpcm2 g cm2 ! g cm2 *Tokgpm2 kg m2 ! cm *Tom m ! m *Tocm cm ! g cm3 *Tokgpm3 kg m3 ! kg m3 *Togpcm3 g cm3 ! sec *Tonsec nsec ! Tesla m ! Avogadro *A2deninv ! mfp *n * xs
Definition: Zglobalc.h:18
real(4), save a
Definition: cNRLAtmos.f:20
Here is the caller graph for this function:

◆ cqfirstid()

subroutine cqfirstid ( real*8  depth)

Definition at line 188 of file ciniTracking.f.

Referenced by chookenevent(), and xbgrun().

188 ! inquire the first interaction depth
189  implicit none
190 
191 #include "Ztrack.h"
192 #include "Ztrackv.h"
193  real*8 depth ! output. to get the first I%D
194 
195  depth = zfirst%pos%depth ! vertical depth
*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
Here is the caller graph for this function:

◆ cqfirstipi()

subroutine cqfirstipi ( type(track ptrack)

Definition at line 199 of file ciniTracking.f.

Referenced by chookenevent().

199 ! inquire the complete first interaction point info.
200 ! as a track of the primary.
201  implicit none
202 
203 #include "Ztrack.h"
204 #include "Ztrackv.h"
205  type(track)::ptrack ! output. if ptrack%pos%depth=0.
206  ! no interaction has been occurred
207 
208  ptrack = zfirst
Definition: Ztrack.h:44
Here is the caller graph for this function:

◆ csetemin()

subroutine csetemin ( character*(*)  gen,
real*8  eminob,
real*8  emin,
real*8  emCas 
)

Definition at line 242 of file ciniTracking.f.

References d0, kalfa, kgnuc, and khvymax.

Referenced by chookbgevent(), and cinitracking().

242 ! ***********************
243  implicit none
244 #include "Zmanagerp.h"
245 #include "Zcode.h"
246 #include "Ztrack.h"
247 #include "Ztrackp.h"
248 #include "Ztrackv.h"
249 #include "Zincidentv.h"
250 #include "Zheavyc.h"
251 #include "Zheavyp.h"
252 !
253  character*(*) gen ! input. a copy of Generate.
254  real*8 eminob ! input. minim observational energy (kientic)
255  real*8 emin ! output. Minimum energy to be followed for non e-g
256  ! ptcls.
257  real*8 emcas ! output. Minimum energy to be followed for e-g
258 !
259 !
260  real*8 ergpn ! energy / nucleon
261  logical cas !
262  logical obas !
263 
264 !
265  cas = index(gen, 'em') .gt. 0
266  obas = index(gen, 'as') .gt. 0 .or.
267  * index(gen, 'lat') .gt. 0
268 
269 
270 ! energy / nucleon for heavy
271  if(incidentcopy%p%code .eq. kgnuc) then
272  ergpn =
273  * incidentcopy%p%fm%p(4)/incidentcopy%p%subcode
274  elseif(incidentcopy%p%code .ge. kalfa .and.
275  * incidentcopy%p%code .le. khvymax) then
276 ! will not come here
277  ergpn =
278  * incidentcopy%p%fm%p(4)/code2massn(incidentcopy%p%code)
279  else
280  ergpn = incidentcopy%p%fm%p(4)
281  endif
282  if(obas ) then
283  ! wait until electon energy becomes < EasWait for AS
284  ! generation. WaitRatio < 1 should be used when 1ry is
285  ! g or e. (say, 0.01)
286  easwait =ergpn * waitratio
287  endif
288 
289 
290  emcas = 1.d30
291 
292  if(obas) then
293  emcas = easwait
294  endif
295  if(cas) then
296  emcas =min(eminob, emcas)
297  endif
298  emin = eminob
299  if(obas) then
300  emin = min(emin, max(ratiotoe0* ergpn, 1.d0) )
301  endif
302 
303  if(thinsampling) then
304 ! thin sampling
305  if(ethinratio(1) .lt. 0.) then
306  ethin(1) = abs(ethinratio(1))
307  else
308  ethin(1) = ethinratio(1)*ergpn
309  endif
310  if(ethinratio(3) .lt. 0.) then
311  ethin(3) = abs(ethinratio(3))
312  elseif(ethinratio(3) .eq. 0.) then
313  ethin(3) = ethin(1)/10.
314  else
315  ethin(3) = ethinratio(3)*ergpn
316  endif
317 
318 
319 ! if(EthinRatio(2) .lt. 0.) then
320 ! Ethin(2) = abs(EthinRatio(2))
321 ! else
322 ! Ethin(2) = EthinRatio(2)*ergpn
323 ! endif
324 ! maximum weight above which no thinning
325  ethin(2) = ethinratio(2)
326  if( ethinratio(4) .eq. 0.) then
327  ethin(4) = ethin(2)/10.
328  else
329  ethin(4) = ethinratio(4)
330  endif
331 !///////////////////
332 ! write(0, *) ' ****** Ethin1,2=', Ethin
333 ! write(0, *) ' ergpn=', ergpn, ' EthinRatio=',EthinRatio
334 !////////////////
335 
336  else
337  ethin(1) = 0.
338  ethin(2) = 0.
339  ethin(3) = 0.
340  ethin(4) = 0.
341  endif
max ptcl codes in the kgnuc
Definition: Zcode.h:2
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kalfa
Definition: cblkHeavy.h:7
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
max ptcl codes in the khvymax
Definition: Zcode.h:2
Here is the caller graph for this function:

◆ csetobsz()

subroutine csetobsz ( external  converter)

Definition at line 155 of file ciniTracking.f.

Referenced by cinitracking().

155 ! *****************************
156 ! compute Z of observation plane
157 !
158  implicit none
159 #include "Zcoord.h"
160 #include "Zpos.h"
161 #include "Zmagfield.h"
162 #include "Zobs.h"
163 #include "Zobsp.h"
164 #include "Zobsv.h"
165 
166  external converter ! cxyz2prim or cxyz2det
167 ! depending on |ObsPlane| =2, 1
168 ! or cxyz2det for ObsPlane=3
169  integer i
170  type(coord)::temp
171 ! compute z from the base detector.
172  do i = 1, noofsites
173  call converter(obssites(noofsites)%pos%xyz,
174  * obssites(i)%pos%xyz,
175  * temp)
176  obssites(i)%zpl = temp%r(3)
177  enddo
178 ! this is for A.S
179  do i = 1, noofassites
180  call converter(asobssites(noofassites)%pos%xyz,
181  * asobssites(i)%pos%xyz,
182  * temp)
183  asobssites(i)%zpl = temp%r(3)
184  enddo
nodes i
real(4), dimension(:), allocatable, save temp
Definition: cNRLAtmos.f:29
Definition: Zcoord.h:43
Here is the caller graph for this function: