COSMOS v7.655  COSMOSv7655
(AirShowerMC)
reducenow.f
Go to the documentation of this file.
1 #define REALLIMITg 100
2 #define REALLIMITe 100
3 #define REALLIMITmu 75
4 #define REALLIMITh 75
5 
6  rewind(fnodat)
7 ! msg =input(1:leng)//"/"//execid(1:lengid)//
8 ! * "-@."//numb(1:lengn)//".dat"
9  msg =dir(1:lengdir)//"/"//execid(1:lengid)//
10  * "-@."//numb(1:lengn)//"-ascii.dat"
11  call copenfw2(fnodat+1, msg, 1, icon)
12  if(icon .gt. 1) then
13  write(0,*) ' icon=', icon
14  call cerrormsg(msg, 1)
15  call cerrormsg('could not be opened', 0)
16  endif
17 
18 
19  limit(1) = reallimitg
20  limit(2) = reallimite
21  limit(3) = reallimitmu
22  limit(4) = reallimith
23 
24 
25  do k = 1, ansites
26  do j = 1, 4
27  do l = 1,nfai
28  do i = 1, nrbin
29  rnrfairec(i, l, j, k)=0
30  enddo
31  enddo
32  enddo
33  enddo
34 
35 ! nrec= 0 ! not used
36  do while(.true.)
37  read(fnodat,end=100) bufc, (buf(i), i=1, bufc)
38  do i = 1, bufc
39 ! nrec= nrec+1
40  ldep = buf(i).ldep
41  depidx = w2il(ldep)
42  faiidx= buf(i).faiidx
43  ridx = buf(i).ridx
44  codex = buf(i).code
45  codex = min(codex, 4)
46  wgt = buf(i).wgt
47  if( nrfairec(ridx, faiidx, codex, depidx) .gt.
48  * limit(codex)/mcpu ) then
49 ! accept with this prob.
50  prob = limit(codex)/mcpu/
51  * nrfairec(ridx, faiidx, codex, depidx)
52 
53  else
54  prob = 1.0
55  endif
56 
57  if( prob .gt. 1.) then
58  wwgt = wgt
59  accept = .true.
60  else
61  prob = prob * wgt
62  if(prob .gt. 1.) then
63  accept = .true.
64  wwgt = prob
65  else
66  call rndc(u)
67  if(u .lt. prob) then
68  accept = .true.
69  wwgt= 1.
70  else
71  accept = .false.
72  endif
73  endif
74  endif
75  if(accept) then
76  rnrfairec(ridx, faiidx, codex, depidx)=
77  * rnrfairec(ridx, faiidx, codex, depidx) + wwgt
78 #if KeepWeight == yes
79  write(fnodat+1,
80  * '(6i3, 1pE11.3, 0p,f6.1,1p2E11.3,0p, 2f8.4,f10.6,1pE11.3)')
81  * buf(i).ldep, buf(i).code, buf(i).subcode,
82  * buf(i).charge, buf(i).ridx, buf(i).faiidx,
83  * buf(i).rinmu, buf(i).fai, buf(i).ek,
84  * buf(i).t, buf(i).wx, buf(i).wy, buf(i).wz,
85  * wwgt
86 #else
87  write(fnodat+1,
88  * '(6i3, 1pE11.3, 0p,f6.1,1p2E11.3,0p, 2f8.4,f10.6)')
89  * buf(i).ldep, buf(i).code, buf(i).subcode,
90  * buf(i).charge, buf(i).ridx, buf(i).faiidx,
91  * buf(i).rinmu, buf(i).fai, buf(i).ek,
92  * buf(i).t, buf(i).wx, buf(i).wy, buf(i).wz
93 #endif
94  endif
95  enddo
96  enddo
97  100 continue
98  close(fnodat)
99  close(fnodat+1)
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
integer lengn
Definition: interface2.h:1
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
subroutine rndc(u)
Definition: rnd.f:91
! timing nrbin
Definition: Zprivate2.h:12
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
subroutine copenfw2(io, fnin, form, icon)
Definition: copenf.f:205
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p charge
Definition: ZavoidUnionMap.h:1
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon ! knockon is considered Obsolete *PhotoProd false
Definition: cblkElemag.h:7
nodes t
*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 *Zfirst wgt
Definition: ZavoidUnionMap.h:1
! timing nfai
Definition: Zprivate2.h:12
*Zfirst p fm *Zfirst p Zfirst p Zfirst p subcode
Definition: ZavoidUnionMap.h:1