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