COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cmydecay.f
Go to the documentation of this file.
1 ! activate next to see how the charged ptcl # changes by decay
2 ! #define SEEDETAIL
3  subroutine cmydecay(Jdecay, tau, a, nin, nout)
4  implicit none
5 #include "Zcode.h"
6 #include "Zptcl.h"
7 #include "Zprivate.h"
8 
9  integer,intent(in)::Jdecay(klast) ! if Jdecay(i) != 0
10  ! the ptcl is decayed, if i is one of
11  ! kbomega, kdmes, keta, kgzai, klambda, klambdac, kpion, ksigma
12  ! (kpion --> pi0)
13  real(8),intent(in)::tau ! life time (sec), above which the partcles
14  ! are regarded as stable and not made to decay.
15  ! Below this, decay is forced. For the decay product,
16  ! the same is applied.
17  ! IF tau =0, random sampling is tried if the
18  ! particle decay or not using correct life time and
19  ! distance dist. (see below)
20  ! if decay takes place, decay product is put
21  integer,intent(in):: nin ! # of ptcls in a
22  type(ptcl):: a(*) ! input/output. size of a must be large
23  ! say, > (nout - nin) *3 + nin
24  integer,intent(out):: nout ! ptcls in a. nout >= nin.
25 
26 
27  type(ptcl):: b(maxn) ! working
28  integer i, j, code, m, n
29  real(8):: pol, ctau
30  real(8),save::dist=141.2 ! m from col. to LHCf
31  real(8) u, gamma, decayl
32  logical decay
33 !//////
34 #ifdef SEEDETAIL
35  integer nchgin, nchgout
36  nchgin = 0
37  do i = 1, nin
38  if(a(i)%charge /= 0) nchgin= nchgin+1
39  enddo
40 #endif
41 !//////////////
42  n = 0
43  do i = 1, nin
44  code = a(i)%code
45  j = 0
46  if( jdecay(code) /= 0 .or. tau == 0. ) then
47  call cgetctau(a(i), ctau)
48  if(tau == 0. ) then
49 ! random sample for decay
50  gamma = a(i)%fm%p(4)/a(i)%mass
51  call rndc(u)
52  decayl = -log(u)*ctau*gamma
53  decay = (decayl < dist )
54  else
55  decay = (ctau/3.e8 < tau)
56  endif
57  if(.not. decay) then
58  n = n + 1
59  b(n) = a(i)
60  else
61  if( code == kpion ) then
62  if( a(i)%charge == 0) then
63  call cpi0decay( a(i), b(n+1), j)
64  endif
65  elseif( code == kkaon ) then
66  if( a(i)%subcode == k0s ) then
67  call ckaondecay(a(i), .false., b(n+1), j, pol)
68  endif
69  elseif( code .eq. kdmes ) then
70  call cddecay( a(i), b(n+1), j)
71  elseif( code .eq. keta ) then
72  call cetadecay( a(i), b(n+1), j)
73  elseif( code .eq. kgzai ) then
74  call cgzaidecay( a(i), b(n+1), j )
75  elseif( code .eq. klambda ) then
76  call clambdadcy( a(i), b(n+1), j )
77  elseif( code .eq. klambdac ) then
78  call clambdacdcy( a(i), b(n+1), j )
79  elseif( code .eq. ksigma ) then
80  call csigmadecay( a(i), b(n+1), j )
81  elseif( code .eq. kbomega ) then
82  call cbomegadcy( a(i), b(n+1), j )
83  else
84  write(*,*) ' code =', code
85  call cerrormsg('cmydecay error', 0)
86  endif
87  if(j > 0 ) then
88 !/////////////////////
89 #ifdef SEEDETAIL
90  write(0,*) ' j=',j, ' code=',code, ' chg=',a(i)%charge
91 #endif
92 !///////////////
93  n = n + j
94  endif
95  endif
96  else
97  n = n + 1
98  b(n) = a(i)
99  endif
100  enddo
101 !/////////
102 #ifdef SEEDETAIL
103  nchgout = 0
104  do i = 1, n
105  if(b(i)%charge /= 0) nchgout = nchgout+1
106  enddo
107  write(0,*) ' chgin out', nchgin, nchgout
108 #endif
109 !/////////////////
110  do i = 1, n
111  a(i) = b(i)
112  enddo
113  nout = n
114  end
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
subroutine cddecay(pj, a, np)
Definition: cdDecay.f:11
max ptcl codes in the kgzai
Definition: Zcode.h:2
max ptcl codes in the kdmes
Definition: Zcode.h:2
max ptcl codes in the kseethru ! subcode integer k0s
Definition: Zcode.h:2
subroutine cpi0decay(pj, a, np)
Definition: cpi0Decay.f:9
max ptcl codes in the klambdac
Definition: Zcode.h:2
max ptcl codes in the kkaon
Definition: Zcode.h:2
subroutine cmydecay(Jdecay, tau, a, nin, nout)
Definition: cmydecay.f:4
subroutine rndc(u)
Definition: rnd.f:91
subroutine csigmadecay(pj, a, np)
Definition: csigmaDecay.f:8
subroutine clambdacdcy(pj, a, np)
Definition: clambdacDcy.f:8
max ptcl codes in the klambda
Definition: Zcode.h:2
subroutine cbomegadcy(pj, a, np)
Definition: cbomegaDcy.f:8
subroutine cetadecay(pj, a, np)
Definition: cetaDecay.f:37
nodes a
subroutine cgetctau(proj, ctau)
Definition: cgetctau.f:6
dE dx *! Nuc Int sampling table b
Definition: cblkMuInt.h:130
subroutine ckaondecay(pj, mupol, a, np, polari)
Definition: ckaonDecay.f:8
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
max ptcl codes in the keta
Definition: Zcode.h:2
subroutine cgzaidecay(pj, a, np)
Definition: cgzaiDecay.f:8
subroutine clambdadcy(pj, a, np)
Definition: clambdaDcy.f:8
max ptcl codes in the klast
Definition: Zcode.h:2
Definition: Zptcl.h:75
max ptcl codes in the kpion
Definition: Zcode.h:2
max ptcl codes in the ksigma
Definition: Zcode.h:2
max ptcl codes in the kbomega
Definition: Zcode.h:2