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 non zero, this routine will never be called.
231 !
232 ! MovedTrack is the particle that made interaction
233 ! Pwork contains produced particles.
234 ! Nproduced has the number of particles in Pwork
235 ! IntInfArray(ProcessNo) contains the type of interaction
236 !
237 ! default setting
238  never = 1
239 !
240 ! never = 0
241  end
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
*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 chookbgrun
Definition: chook.f:15
subroutine xbgrun
Definition: interface.f:10
subroutine chookeint(never)
Definition: chook.f:162