COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ctransVectZx.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine ctransvectzx (init, zax, xax, dir1, dir2)
 
subroutine citransvectzx (init, zax, xax, dir1, dir2)
 

Function/Subroutine Documentation

◆ citransvectzx()

subroutine citransvectzx ( integer  init,
type(coord zax,
type(coord xax,
type(coord dir1,
type(coord dir2 
)

Definition at line 102 of file ctransVectZx.f.

References cerrormsg(), and e.

Referenced by __det2prim.f__(), and __det2prim2.f__().

102 ! ===================================================
103 ! This is the inverse of ctransVectZx
104 !
105 ! /usage/ call ciTransVectZx(init, zax, xax, dir1, dir2)
106 ! Suppose 2 system B and R.
107 ! Directions cosines(dir1) are given in B
108 !
109 ! The z axis of R has dircetion cos zax in B.
110 ! The x axis of R has direction cos xax in B.
111 !
112 ! This subroutine transform the angles so that (dir1)
113 ! be the direction cosines in the R-system,
114 ! and put the result into dir2.
115 ! dir2 can be the same one as dir1, or zax.
116 ! init: if zax and xax are different from those from the preious call, give 1
117 ! else give a diff. value.
118 ! zax: /coord/
119 ! xax: /coord/
120 ! dir1: /coord/
121 ! dir2; /coord/
122 !
123  implicit none
124 #include "Zcoord.h"
125  type(coord)::xax
126  type(coord)::zax
127  type(coord)::dir1
128  type(coord)::dir2
129  integer init
130 !
131  type(coord)::yvec
132  type(coord)::temp
133  real*8 norm
134 #ifdef USESAVE
135  save yvec
136 #endif
137  character*70 msg
138 ! y -axis unit vector
139  if(init .eq. 1) then
140  yvec%r(1) = zax%r(2) * xax%r(3) - zax%r(3) * xax%r(2)
141  yvec%r(2) = zax%r(3) * xax%r(1) - zax%r(1) * xax%r(3)
142  yvec%r(3) = zax%r(1) * xax%r(2) - zax%r(2) * xax%r(1)
143 ! need not normalize; but check it
144  norm = yvec%r(1)**2 + yvec%r(2)**2 + yvec%r(3)**2
145  if(abs(norm-1.0) .gt. 1.e-4) then
146  write(msg, *)
147  * 'ctransVectZx: input dir. cos. are not orthogonal'
148  call cerrormsg(msg, 0)
149  endif
150  endif
151 !
152  temp%r(1) = dir1%r(1) * xax%r(1) + dir1%r(2) *xax%r(2) +
153  * dir1%r(3) *xax%r(3)
154  temp%r(2) = dir1%r(1) * yvec%r(1)+ dir1%r(2) *yvec%r(2) +
155  * dir1%r(3) *yvec%r(3)
156  temp%r(3) = dir1%r(1) * zax%r(1) + dir1%r(2) *zax%r(2) +
157  * dir1%r(3) *zax%r(3)
158  dir2 = temp
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
common ZdedxAir norm
Definition: ZdedxAir.h:2
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
real(4), dimension(:), allocatable, save temp
Definition: cNRLAtmos.f:29
subroutine init
Definition: Gencol.f:62
Definition: Zcoord.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctransvectzx()

subroutine ctransvectzx ( integer  init,
type(coord zax,
type(coord xax,
type(coord dir1,
type(coord dir2 
)

Definition at line 36 of file ctransVectZx.f.

References cerrormsg(), and e.

Referenced by cinitobs(), and cmkinc().

36 !
37 !
38 ! /usage/ call ctransVectZx(init, zax, xax, dir1, dir2)
39 ! Directions cosines(dir1) are given in a system
40 ! (=R).
41 ! The z axis of R has dircetion cos zax in B.
42 ! The x axis of R has direction cos xax in B.
43 !
44 ! This subroutine transform the angles so that (dir1)
45 ! be the direction cosines in the B-system,
46 ! and put the result into dir2.
47 ! dir2 can be the same one as dir1, or zax.
48 ! init: if zax and xax are different from those from the
49 ! previous call, give 1 else give a diff. value.
50 ! zax: /coord/
51 ! xax: /coord/
52 ! dir1: /coord/
53 ! dir2; /coord/
54 ! *** Note *** If you are ok with an arbitrary x axis, use ctransVectZ.
55 !
56  implicit none
57 
58 #include "Zcoord.h"
59  type(coord)::xax
60  type(coord)::zax
61  type(coord)::dir1
62  type(coord)::dir2
63  integer init
64 !
65  type(coord)::yvec
66  type(coord)::temp
67  real*8 norm
68 
69 #ifdef USESAVE
70  save yvec
71 #endif
72 
73  character*70 msg
74 ! y -axis unit vector
75  if(init .eq. 1) then
76  yvec%r(1) = zax%r(2) * xax%r(3) - zax%r(3) * xax%r(2)
77  yvec%r(2) = zax%r(3) * xax%r(1) - zax%r(1) * xax%r(3)
78  yvec%r(3) = zax%r(1) * xax%r(2) - zax%r(2) * xax%r(1)
79 ! need not normalize; but check it
80  norm = yvec%r(1)**2 + yvec%r(2)**2 + yvec%r(3)**2
81  if(abs(norm-1.0) .gt. 1.e-4) then
82  write(msg, *)
83  * 'ctransVectZx: input dir. cos. are not orthogonal'
84  call cerrormsg(msg, 0)
85  endif
86  endif
87 !
88  temp%r(1) = dir1%r(1) * xax%r(1) + dir1%r(2) *yvec%r(1) +
89  * dir1%r(3) *zax%r(1)
90  temp%r(2) = dir1%r(1) * xax%r(2) + dir1%r(2) *yvec%r(2) +
91  * dir1%r(3) *zax%r(2)
92  temp%r(3) = dir1%r(1) * xax%r(3) + dir1%r(2) *yvec%r(3) +
93  * dir1%r(3) *zax%r(3)
94 !
95  ! @jaxa, temp undefined warning comes out
96  ! since temp.sys is not used.
97 ! dir2 = temp
98  dir2%r(:) =temp%r(:)
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
common ZdedxAir norm
Definition: ZdedxAir.h:2
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
real(4), dimension(:), allocatable, save temp
Definition: cNRLAtmos.f:29
subroutine init
Definition: Gencol.f:62
Definition: Zcoord.h:43
Here is the call graph for this function:
Here is the caller graph for this function: