COSMOS v7.655  COSMOSv7655
(AirShowerMC)
cxyz2prim.f
Go to the documentation of this file.
1 ! cxyz2prim: xyz to primary system coord. conversion
2 ! cxyz2primD: xyz to primary system for Direction cos.
3 !
4  subroutine cxyz2prim(base, a, b)
5  implicit none
6 !
7 #include "Zcoord.h"
8 #include "Zobs.h"
9 #include "Zpos.h"
10 #include "Zmagfield.h"
11 #include "Zobsv.h"
12 
13 ! origin of primary system is the
14 ! origin of this deepest detector
15  type(coord)::base ! base detector coord. whose origin is the
16  ! origin of 1ry system.
17  type(coord)::a ! input. coord. in 'xyz'
18  type(coord)::b ! output. transformed coord. in 'prim'
19 
20  real(8):: temp(3)
21  temp(:) = a%r(:) - base%r(:)
22  b%r(:) = matmul(txyz2prim(:,:), temp)
23  b%sys = 'prim'
24 ! old one (<= v7.637)
25 ! record /coord/ tempa
26 ! coord in "xyz" from the origin of det.
27 ! tempa.r(1) = a.r(1) - base.r(1)
28 ! tempa.r(2) = a.r(2) - base.r(2)
29 ! tempa.r(3) = a.r(3) - base.r(3)
30 ! call cscalerProd(tempa, Xprimary, b.r(1))
31 ! call cscalerProd(tempa, Yprimary, b.r(2))
32 ! call cscalerProd(tempa, Zprimary, b.r(3))
33 ! b.sys = 'prim'
34  end
35 ! -----------------------------------
36  subroutine cxyz2primd(a, b)
37  implicit none
38 !
39 #include "Zcoord.h"
40 #include "Zobs.h"
41 #include "Zpos.h"
42 #include "Zmagfield.h"
43 #include "Zobsv.h"
44 
45  type(coord)::a
46  type(coord)::b
47  real(8):: temp(3)
48  temp(:) = matmul(txyz2prim(:,:), a%r(:))
49  b%r(:) = temp(:)
50  b%sys = 'prim'
51 ! old version (<= 7.637)
52 ! record /coord/temp
53 
54 ! b can be a
55 
56 ! call cscalerProd(a, Xprimary, temp.r(1))
57 ! call cscalerProd(a, Yprimary, temp.r(2))
58 ! call cscalerProd(a, Zprimary, temp.r(3))
59 ! b = temp
60 ! b.sys = 'prim'
61  end
62 
63  subroutine cprim2xyz(base, a, b)
64  implicit none
65 ! inverse of xyz2prim
66 #include "Zcoord.h"
67 #include "Zobs.h"
68 #include "Zpos.h"
69 #include "Zmagfield.h"
70 #include "Zobsv.h"
71 
72 
73 ! origin of base detector
74  type(coord)::base ! base detector coord. whose origin is the
75  ! origin of 1ry system.
76  type(coord)::a ! input. coord. in 'prim'
77  type(coord)::b ! output. transformed coord. in 'xyz'
78 
79  real(8):: temp(3)
80  temp(:) = matmul(tprim2xyz(:,:), a%r(:))
81  b%r(:) = temp(:) + base%r(:)
82  b%sys = 'xyz'
83  end
84 ! -----------------------------------
85  subroutine cprim2xyzd(a, b)
86  implicit none
87 !
88 #include "Zcoord.h"
89 #include "Zobs.h"
90 #include "Zpos.h"
91 #include "Zmagfield.h"
92 #include "Zobsv.h"
93 
94  type(coord)::a
95  type(coord)::b
96  real(8):: temp(3)
97  temp(:) = matmul(tprim2xyz(:,:), a%r(:))
98  b%r(:) = temp(:)
99  b%sys = 'xyz'
100  end
subroutine cprim2xyzd(a, b)
Definition: cxyz2prim.f:86
subroutine cprim2xyz(base, a, b)
Definition: cxyz2prim.f:64
subroutine cxyz2prim(base, a, b)
Definition: cxyz2prim.f:5
subroutine cxyz2primd(a, b)
Definition: cxyz2prim.f:37
Definition: Zcoord.h:43