COSMOS v7.655  COSMOSv7655
(AirShowerMC)
setpcode.f
Go to the documentation of this file.
1  subroutine setpcode( p, code)
2  implicit none
3 #include "Zptcl.h"
4 #include "Zcode.h"
5  type(ptcl):: p
6  integer code
7 ! set parent particle code by using last bit
8 ! bit 2 bit 1
9 ! pi 0 0
10 ! K 0 1
11 ! p 1 0
12 ! pbar/nbar 1 1
13  if( p.code .eq. 4 ) then
14  call krsetbit(code, 1)
15  call krsetbit(code, 2)
16  elseif(p.code .eq. 5) then
17  call ksetbit(code, 1)
18  call krsetbit(code, 2)
19  elseif( (p.code .eq. 6 .and. p.charge .eq. -1 ) .or.
20  * (p.code .eq. 6 .and. p.charge .eq. 0 .and.
21  * p.subcode .eq. antip ) ) then
22  call ksetbit(code, 1)
23  call ksetbit(code, 2)
24  else
25  call krsetbit(code, 1)
26  call ksetbit(code, 2)
27  endif
28  end
29  subroutine getpcode(code, codex)
30  implicit none
31  integer code ! input.
32  integer codex ! output. 4: pi, 5: K, 7: anti p/n 6: p/n and others
33  logical kbitest
34  if(.not. kbitest(code, 2) ) then
35  if( .not. kbitest(code, 1) ) then
36  codex = 4
37  else
38  codex = 5
39  endif
40  else
41  if(.not. kbitest(code, 1) ) then
42  codex = 6
43  else
44  codex = 7
45  endif
46  endif
47  end
subroutine krsetbit(i, bit)
Definition: kmanbit.f:53
subroutine setpcode(p, code)
Definition: setpcode.f:2
subroutine ksetbit(i, bit)
Definition: kmanbit.f:36
subroutine getpcode(code, codex)
Definition: setpcode.f:30
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p charge
Definition: ZavoidUnionMap.h:1
Definition: Zptcl.h:75
max ptcl codes in the kseethru ! subcode integer antip
Definition: Zcode.h:2
*Zfirst p fm *Zfirst p Zfirst p Zfirst p subcode
Definition: ZavoidUnionMap.h:1