COSMOS v7.655  COSMOSv7655
(AirShowerMC)
chook.f
Go to the documentation of this file.
1 #include "cmain.f"
2 #include "chookHybAS.f"
3 #include "ctemplCeren.f"
4 ! *************************************** hook for Beginning of a Run
5 ! * At this moment, all (system-level) initialization for this run
6 ! * has been ended. After this routine is executed, the system goes into the
7 ! * event creation loop.
8 ! *
9  subroutine chookbgrun
10  implicit none
11 #include "Zmanagerp.h"
12 #include "Ztrack.h"
13 #include "Ztrackv.h"
14 
15 !
16 !
17 
18 ! If you feel writing the parameters on stderr is
19 ! a bother, comment out the next or
20 ! use other device than ErrorOut.
21 ! Also you may comment out all output routines below.
22 #ifdef sun4
23  external csighandler
24  integer ieeer, ieee_handler
25  ieeer = ieee_handler('set', 'invalid', csighandler)
26 #endif
27 
28 !
29 ! namelist output
30  call cwriteparam(errorout, 0)
31 ! primary information
32  call cprintprim(errorout)
33 ! observation level information
34  call cprintobs(errorout)
35 
36  call xbgrun
37 
38  end
39 #ifdef sun4
40  integer function csighandler(sig, code, context)
41  implicit none
42 #include "Zmanagerp.h"
43  integer sig, code, context(5)
44  write(errorout, *) ' f.p exception content=' , context(4)
45 ! call abort()
46  end
47 #endif
48 ! *********************************** hook for Beginning of 1 event
49 ! * All system-level initialization for 1 event generation has been
50 ! * eneded at this moment.
51 ! * After this is executed, event generation starts.
52 ! *
53  subroutine chookbgevent
54 
55  call xbgevent
56 
57  end
58 
59 ! ************************************ hook for observation
60 ! * One particel information is brought here by the system.
61 ! * All information of the particle is in aTrack
62 ! *
63  subroutine chookobs(aTrack, id)
64 !
65 ! Note that every real variable is in double precision so
66 ! that you may output it in sigle precision to save the memory.
67 ! In some cases it is essential to put it in sigle (say,
68 ! for gnuplot).
69 !
70  implicit none
71 #include "Zmanagerp.h"
72 #include "Zcode.h"
73 #include "Ztrack.h"
74 #include "Ztrackv.h"
75 #include "Zheavyp.h"
76 #include "Zobs.h"
77 #include "Zobsp.h"
78 
79  integer id ! input. 1 ==> aTrack is going out from
80 ! outer boundery.
81 ! 2 ==> reached at an observation level
82 ! 3 ==> reached at inner boundery.
83  type(track):: aTrack
84 
85  call xobs(atrack, id)
86  end
87 
88 ! *********************************** hook for end of 1 event
89 ! * At this moment, 1 event generation has been ended.
90 ! *
91  subroutine chookenevent
92 
93  implicit none
94 #include "Zmanagerp.h"
95 #include "Ztrack.h"
96 #include "Ztrackv.h"
97 #include "Zobs.h"
98 #include "Zobsp.h"
99 #include "Zobsv.h"
100  integer nevent, ntevent
101 
102  call xenevent
103 
104  call cqeventno(nevent, ntevent)
105  write(0,*) 'end_of_event #=',ntevent
106  end
107 ! ********************************* hook for end of a run
108 ! * all events have been created or time lacks
109 ! *
110  subroutine chookenrun
112  implicit none
113  write(0,*) " end of run"
114  end
115 ! ********************************* hook for trace
116 ! * This is called only when trace > 100
117 ! * User should manage the trace information here.
118 ! * If you use this, you may need some output for trace
119 ! * at the beginning of 1 event generatio and at the end of 1 event
120 ! * generation so that you can identfy each event.
121 ! *
122 ! *
123  subroutine chooktrace
124  implicit none
125 
126 #include "Ztrack.h"
127 #include "Ztrackv.h"
128 #include "Ztrackp.h"
129 #include "Zobs.h"
130 #include "Zobsv.h"
131 
132  real*4 h1, h2
133 !
134 ! Every time a particle is moved in the atmosphere, this routine is called,
135 ! if trace > 100
136 ! For a one track segment,
137 ! TrackBefMove has track information at the beginning of the segment.
138 ! MoveTrack has track information at the end of the segment.
139 !
140 ! You can know the information a track contains in the
141 ! chookObs routine. (Note however, no conversion of coordinate
142 ! has been done. The values are in the Earth xyz system.)
143 ! Besides quantities explained there, you can use, for a given 'track'
144 !
145 ! atrack.pos.xyz.x, atrack.pos.xyz.y, atrack.pos.xyz.z (x,y.z)
146 ! atrack.pos.radiallen (distance from the center of the earth)
147 ! atrack.pos.depth (vertical depth)
148 ! atrack.pos.height (vertical heigth from sea level)
149 !
150 
151  h1 = trackbefmove.pos.height- obssites(noofsites).pos.height
152  h2 = movedtrack.pos.height - obssites(noofsites).pos.height
153 
154  end
155 
156 ! ********************* this is the hook called when
157 ! an electron made an interaction.
158 !
159  subroutine chookeint(never)
160  implicit none
161 
162 #include "Ztrack.h"
163 #include "Ztrackv.h"
164 ! #include "Ztrackp.h"
165 
166  integer never ! input & output
167 
168 ! don't make never = 1, if you want to get
169 ! information after an electron made interaction
170 ! if this is made non zero, this routine will never be called.
171 !
172 ! MovedTrack is the electron that made interaction
173 ! Pwork contains produced particles.
174 ! Nproduced has the number of particles in Pwork
175 ! IntInfArray(ProcessNo) contains the type of interaction
176 !
177 ! default setting
178  never = 1
179 !
180 ! IntInfArray(ProcessNo).process will have one of
181 ! 'brems', 'mscat', 'bscat', 'anihi' or 'mbrem'
182 !
183  end
184 
185 ! ********************* this is the hook called when
186 ! a gamma ray made an interaction.
187 !
188  subroutine chookgint(never)
189  implicit none
190 
191 #include "Ztrack.h"
192 #include "Ztrackv.h"
193 ! #include "Ztrackp.h"
194 
195  integer never ! input & output
196 
197 ! don't make never = 1, if you want to get
198 ! information after a gamma ray made interaction
199 ! if this is made non zero, this routine will never be called.
200 !
201 ! MovedTrack is the gamma that made interaction
202 ! Pwork contains produced particles.
203 ! Nproduced has the number of particles in Pwork
204 ! IntInfArray(ProcessNo) contains the type of interaction
205 !
206 ! default setting
207  never = 1
208 ! IntInfArray(ProcessNo).process will have one of
209 ! 'pair', 'comp', 'photoe' 'photop' 'mpair'
210 !
211  end
212 
213 ! ********************* this is the hook called when
214 ! non e-g particle made an interaction.
215 !
216  subroutine chooknepint(never)
217  implicit none
218 
219 
220 #include "Zcode.h"
221 #include "Ztrack.h"
222 #include "Ztrackv.h"
223 
224 ! #include "Ztrackp.h"
225 
226  integer never ! input & output
227 
228 ! don't make never = 1, if you want to get
229 ! information after a non-e-g particle made interaction
230 ! if this is made 1, this routine will never be called.
231 ! make never 5 if the event is not good for you
232 ! and retry the event generation.
233 ! MovedTrack is the particle that made interaction
234 ! Pwork contains produced particles.
235 ! Nproduced has the number of particles in Pwork
236 ! IntInfArray(ProcessNo) contains the type of interaction
237 !
238 ! default setting
239 ! never = 1
240 !
241  integer::i
242  type(ptcl):: proj
243  real(8):: pz
244 
245  if( intinfarray(processno).process /= 'coll' ) then ! even if this is absent, OK
246  return ! ;inside cutptcl same is done
247  endif
248 
249 ! first make Z axis as the incident particle
250  do i = 1, nproduced
251  call cirot3vec(i, movedtrack.p.fm, pwork(i).fm, pwork(i).fm)
252  enddo
253 
254 ! make projectile move +z direction
255 ! with the same energy as MovedTrack.p
256  proj = movedtrack.p
257  pz =sqrt( dot_product(proj.fm.p(1:3), proj.fm.p(1:3)) )
258  proj.fm.p(1:3) =(/0.d0, 0.d0, pz/)
259  call cutptcl(proj)
260 
261 ! again convert Z axis to be the one where
262 ! MovedTrack is defined
263  do i = 1, nproduced
264  call crot3vec( movedtrack.p.fm, pwork(i).fm, pwork(i).fm )
265  enddo
266  never = 0
267  end
subroutine cprintobs(io)
Definition: cprintObs.f:2
subroutine chookgint(never)
Definition: chook.f:191
! parameters for Elemag process(-> ---------------------------------------------- real *8 RecoilKineMinE !2 Recoil Kinetic Min Energy above which the recoil(=knock-on process) ! is treated. Below this energy, the effect is included as continuous ! energy loss. Used only if KnockOnRatio $>$ 1. ! If this is 0 or if KnockOnRatio=1, KEminObs(gamma)=KEminObs(elec) is used. ! See also KnockOnRatio. real *8 KnockOnRatio !2 KnockOnRatio *KEminoObs is used instead of RecoilKineMinE if KnockOnRatio $< $1. real *8 X0 !2 Radiation length in kg/m$^2$ for air. Normally the user should not touch this. real *8 Ecrit !2 Critical energy in GeV. \newline ! Employed only when calculating air shower size in the hybrid ! air shower generation. The value would be dependent on the ! experimental purpose. The default value, 81 MeV, is bit too ! small in many applications(The air shower size is overestimated). ! Comparisons of sizes by the hybrid method and by the full Monte ! Carlo tell that \newline ! $N_e$(full 3-D M.C) $< N_e$(hybrid AS with $E_c=81$ MeV) $< N_e$(full 1-D M.C) ! $ {\ \lower-1.2pt\vbox{\hbox{\rlap{$<$}\lower5pt\vbox{\hbox{$\sim$}}}}\ } ! N_e$(hybrid AS with $E_c={76}$ MeV) at around shower maximum. ! Hybrid AS is always essentially 1-D. logical Knockon !2 Obsolete. Don 't use this. See RecoilKineMinE ! and KnockonRatio. real *8 AnihiE !2 If E(positron) $<$ AnihiE, annihilation is considered. real *8 Es !2 Modified scattering constant. 19.3d-3 GeV real *8 MaxComptonE !2 Above this energy, Compton scattering is neglected. real *8 MaxPhotoE !2 Above this energy, photoelectric effect is neglected. real *8 MinPhotoProdE !1 Below this energy, no photo-prod of hadron. See also PhotoProd. logical PhotoProd !1 Switch. if .false., no photo prod. of hadron is considered at all. ! See also MinPhotoProdE, HowPhotoP real *8 Excom1 !2(GeV). If photon energy is<=Excom1, use XCOM data for ! compton/p.e/coherent scattering(must be< 100 GeV). real *8 Excom2 !2(GeV). If photon energy is<=Excom2, use XCOM data for ! pair creation cross-section.(must be< 100 GeV). integer Moliere !2 2$\rightarrow$ use Moliere scat.\newline ! 0$\rightarrow$ use Gaussian scattrign. \newline ! 1$\rightarrow$ use Moli\`ere scattering for non-electrons \newline ! 2$\rightarrow$ use Moli\`ere scattering for all charged ! particles. But treatment is not so rigorous as case of 3. ! \newline ! 3$\rightarrow$ use rigorus Moliere scattering. Diff. from 2 is verysmall. May be some effect in the ! core region. integer ALateCor !2 1$\rightarrow$ angular and lateral correlation is taken into account when Moliere=0 .\newline ! t$\rightarrow$ Use angular-lateral correlation by Gaussian ! approximation. No effect is seen if path length is short. !<-) ---------------------------------------------- common/Zelemagc/RecoilKineMinE
subroutine chookenrun
Definition: chook.f:147
Definition: Ztrack.h:44
subroutine chooknepint(never)
Definition: chook.f:219
subroutine cprintprim(out)
Definition: cprintPrim.f:3
subroutine chookenevent
Definition: chook.f:116
subroutine cutptcl(proj)
Definition: cutptcl.f:2
subroutine cwriteparam(io, force)
Definition: cwriteParam.f:4
subroutine cirot3vec(init, p1, p2, po)
Definition: crot3vec.f:97
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
subroutine chooktrace
Definition: chook.f:275
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
*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
integer function csighandler(sig, code, context)
Definition: chook.f:63
subroutine cqeventno(num, cumnum)
Definition: cqEventNo.f:3
subroutine chookobs(aTrack, id)
Definition: chook.f:59
subroutine chookbgevent
Definition: chook.f:39
subroutine crot3vec(zax, vec1, vec2)
Definition: crot3vec.f:33
Definition: Zptcl.h:75
subroutine chookbgrun
Definition: chook.f:15
subroutine xbgrun
Definition: interface.f:10
subroutine chookeint(never)
Definition: chook.f:162