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