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 ! NOTE: chookEInt and chookGInt should not be used as of
5 ! version uv0.64001
6 !
7 ! *************************************** hook for Beginning of a Run
8 ! * At this moment, all (system-level) initialization for this run
9 ! * has been ended. After this routine is executed, the system goes into the
10 ! * event creation loop.
11 ! *
12  subroutine chookbgrun
13  implicit none
14 #include "Zmanagerp.h"
15 
16 ! If you feel writing the parameters on stderr is
17 ! a bother, comment out the next or
18 ! use other device than ErrorOut.
19 ! Also you may comment out all output routines below.
20 
21 !
22 ! namelist output
23  call cwriteparam(errorout, 0)
24 ! primary information
25  call cprintprim(errorout)
26 ! observation level information
27  call cprintobs(errorout)
28  end
29 
30 
31 ! *********************************** hook for Beginning of 1 event
32 ! * All system-level initialization for 1 event generation has been
33 ! * eneded at this moment.
34 ! * After this is executed, event generation starts.
35 ! *
36  subroutine chookbgevent
37  implicit none
38 ! write(*, *) ' bigin event generation'
39  end
40 
41 
42 ! ************************************ hook for observation
43 ! * One particel information is brought here by the system.
44 ! * All information of the particle is in aTrack
45 ! *
46  subroutine chookobs(aTrack, id)
47 !
48 ! Note that every real variable is in double precision so
49 ! that you may output it in sigle precision to save the memory.
50 ! In some cases it is essential to put it in sigle (say,
51 ! for gnuplot).
52 !
53  implicit none
54 #include "Ztrack.h"
55  integer id ! input. 1 ==> aTrack is going out from
56 ! outer boundery.
57 ! 2 ==> reached at an observation level
58 ! 3 ==> reached at inner boundery.
59  type(track):: aTrack
60 ! record /track/ aTrack
61 !
62 ! For id =2, you need not output the z value, because it is always
63 ! 0 (within the computational accuracy).
64 !
65  if(id .eq. 2) then
66 ! output typical quantities.
67  write(*, *)
68  * atrack%where, ! observation level. integer*2. 1 is highest.
69  * atrack%p%code, ! ptcl code integer*2.
70  * atrack%p%charge, ! charge, integer*2
71  * sngl(atrack%t), ! relateive arrival time in nsec (NOT sec).
72  ! if TimeStructure is F, nonsense.
73  * sngl(atrack%p%fm%p(4)), ! total energy in GeV.
74  * sngl(atrack%pos%xyz%r(1)), sngl(atrack%pos%xyz%r(2)), ! x, y in m
75  * sngl(atrack%vec%w%r(1)), ! direc. cos.x in the current detector system.
76  * sngl(atrack%vec%w%r(2)), ! direc. cos.y
77  * sngl(atrack%vec%w%r(3)), ! direc. cos.z
78  * sngl(atrack%vec%coszenith) ! cos of zenith angle
79  endif
80 ! you may need in some case other information such as
81 ! aTrack%p%subcode ! sub code of the particle integer*2
82 ! aTrack%p%mass ! mass
83 ! aTrack%wgt ! weight of the particle (may not be 1. if
84  ! ThinSampling =T)
85 ! aTrack%p%fm%p(1) ! momentum x component. Note. Momentum is
86 ! given in the Earth xyz system%
87 ! aTrack%p%fm%p(2) ! y
88 ! aTrack%p%fm%p(3) ! z
89 
90 ! To convert the momentum into the observational
91 ! coordinate system, you may call
92 ! call cresetMom(aTrack)
93  end
94 
95 ! *********************************** hook for end of 1 vent
96 ! * At this moment, 1 event generation has been ended.
97 ! *
98  subroutine chookenevent
99 
100  implicit none
101 #include "Ztrack.h"
102 #include "Ztrackv.h"
103 #include "Zobs.h"
104 #include "Zobsp.h"
105 #include "Zobsv.h"
106 
107 
108  integer i
109  if(observeas) then
110 ! electron size in B approx.
111  write(*, *) (asobssites(i)%esize, i=1, noofassites)
112 ! size weighted age
113  write(*, *) (asobssites(i)%age, i=1, noofassites)
114  endif
115 ! ************ if you want to flesh this event later
116 ! you may keep the random no. seed by the following
117 ! call cwriteSeed ! SeedFile
118  end
119 
120 
121 ! ********************************* hook for end of a run
122 ! * all events have been created or time lacks
123 ! *
124  subroutine chookenrun
125  implicit none
126  call cprintstatus ! if don't like, comment out
127  end
128 ! ********************************* hook for trace
129 ! * This is called only when trace > 100
130 ! * User should manage the trace information here.
131 ! * If you use this, you may need some output for trace
132 ! * at the beginning of 1 event generatio and at the end of 1 event
133 ! * generation so that you can identfy each event.
134 ! *
135 ! *
136  subroutine chooktrace
137  implicit none
138 
139 #include "Ztrack.h"
140 #include "Ztrackv.h"
141 #include "Ztrackp.h"
142 #include "Zobs.h"
143 #include "Zobsv.h"
144 
145  real*4 h1, h2
146 !
147 ! Every time a particle is moved in the atmosphere, this routine is called,
148 ! if trace > 100
149 ! For a one track segment,
150 ! TrackBefMove has track information at the beginning of the segment.
151 ! MoveTrack has track information at the end of the segment.
152 !
153 ! You can know the information a track contains in the
154 ! chookObs routine. (Note however, no conversion of coordinate
155 ! has been done. The values are in the Earth xyz system.)
156 ! Besides quantities explained there, you can use, for a given 'track'
157 !
158 ! atrack.pos.xyz.x, atrack.pos.xyz.y, atrack.pos.xyz.z (x,y.z)
159 ! atrack.pos.radiallen (distance from the center of the earth)
160 ! atrack.pos.depth (vertical depth)
161 ! atrack.pos.height (vertical heigth from sea level)
162 !
163 
164  h1 = trackbefmove%pos%height- obssites(noofsites)%pos%height
165  h2 = movedtrack%pos%height - obssites(noofsites)%pos%height
166 
167  end
168 ! ********************* this is the hook called when
169 ! an electron made an interaction.
170 !
171  subroutine chookeint(never)
172  implicit none
173 
174 #include "Ztrack.h"
175 #include "Ztrackv.h"
176 ! #include "Ztrackp.h"
177 
178  integer never ! input & output
179 
180 ! don't make never = 1, if you want to get
181 ! information after an electron made interaction
182 ! if this is made non zero, this routine will never be called.
183 !
184 ! MovedTrack is the electron that made interaction
185 ! Pwork contains produced particles.
186 ! Nproduced has the number of particles in Pwork
187 ! IntInfArray(ProcessNo) contains the type of interaction
188 !
189 ! default setting
190  never = 1
191 !
192 ! IntInfArray(ProcessNo).process will have one of
193 ! 'brems', 'mscat', 'bscat' 'anihi' or 'mbrem'
194 !
195  end
196 
197 ! ********************* this is the hook called when
198 ! a gamma ray made an interaction.
199 !
200  subroutine chookgint(never)
201  implicit none
202 
203 #include "Ztrack.h"
204 #include "Ztrackv.h"
205 ! #include "Ztrackp.h"
206 
207  integer never ! input & output
208 
209 ! don't make never = 1, if you want to get
210 ! information after a gamma ray made interaction
211 ! if this is made non zero, this routine will never be called.
212 !
213 ! MovedTrack is the gamma that made interaction
214 ! Pwork contains produced particles.
215 ! Nproduced has the number of particles in Pwork
216 ! IntInfArray(ProcessNo) contains the type of interaction
217 !
218 ! default setting
219  never = 1
220 ! IntInfArray(ProcessNo).process will have one of
221 ! 'pair', 'comp', 'photoe' 'photop' 'mpair'
222 !
223  end
224 
225 ! ********************* this is the hook called when
226 ! non e-g particle made an interaction.
227 !
228  subroutine chooknepint(never)
229  implicit none
230 
231 #include "Ztrack.h"
232 #include "Ztrackv.h"
233 ! #include "Ztrackp.h"
234 
235  integer never ! input & output
236 
237 ! don't make never = 1, if you want to get
238 ! information after a non-e-g particle made interaction
239 ! if this is made non zero, this routine will never be called.
240 !
241 ! MovedTrack is the particle that made interaction
242 ! Pwork contains produced particles.
243 ! Nproduced has the number of particles in Pwork
244 ! IntInfArray(ProcessNo) contains the type of interaction
245 !
246 ! default setting
247  never = 1
248 !
249 ! IntInfArray(ProcessNo)%process will have
250 ! 'coll' or 'decay'
251  end
252 
253 
subroutine cprintobs(io)
Definition: cprintObs.f:2
subroutine chookgint(never)
Definition: chook.f:191
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 cwriteparam(io, force)
Definition: cwriteParam.f:4
subroutine chooktrace
Definition: chook.f:275
subroutine chookobs(aTrack, id)
Definition: chook.f:59
subroutine chookbgevent
Definition: chook.f:39
subroutine cprintstatus
Definition: cendRun.f:35
subroutine chookbgrun
Definition: chook.f:15
subroutine chookeint(never)
Definition: chook.f:162