13 LWSDBG(1, std::cout << TypeStr() <<
" DisToOut" << MSG_VECTOR(inputP) << std::endl);
15 LWSDBG(2, std::cout <<
"DistanceToOut(p):"
16 <<
" point " << MSG_VECTOR(inputP)
17 <<
" is not inside of the m_BoundingShape."
21 G4ThreeVector
p( inputP );
25 LWSDBG(2, std::cout <<
"already not inside " << MSG_VECTOR(
p) << std::endl);
29 LWSDBG(2, std::cout <<
"dto " <<
d <<
" " <<
d0 << std::endl);
35 const G4ThreeVector &inputV,
36 const G4bool calcNorm,
38 G4ThreeVector* sn)
const
40 LWSDBG(1, std::cout << TypeStr() <<
" DisToOut" << MSG_VECTOR(inputP)
41 << MSG_VECTOR(inputV) << std::endl);
44 if(inside_BS == kOutside){
45 LWSDBG(2, std::cout <<
"DistanceToOut(p):"
46 <<
" point " << MSG_VECTOR(inputP)
47 <<
" is outside of m_BoundingShape." << std::endl);
48 if(calcNorm) *validNorm =
false;
53 G4ThreeVector
p(inputP);
55 const G4double adtnf_p = fabs(
GetCalculator()->DistanceToTheNearestFan(
p, p_fan));
57 LWSDBG(2, std::cout <<
"DistanceToOut(p, v): point "
59 <<
" is outside of solid." << std::endl);
60 if(calcNorm) *validNorm =
false;
64 G4ThreeVector
v(inputV);
65 const G4double
phi0 =
p.phi() - inputP.phi();
68 #ifdef CHECK_DIRTONORM_ANGLE_ON_SURFACE
69 if(adtnf_p < FHTminusT) {
70 LWSDBG(5, std::cout <<
"inside fan point " << MSG_VECTOR(inputP) <<
", FHTminusT=" << FHTminusT << std::endl);
72 LWSDBG(5, std::cout <<
"on fan surface adtnf_p=" << adtnf_p <<
", m_FHTplusT=" <<
m_FHTplusT <<
", FHTminusT=" << FHTminusT << std::endl);
76 if ( (
p-
d).cosTheta(
v) > AngularTolerance ) {
85 LWSDBG(4, std::cout <<
"dto: " << MSG_VECTOR(
p) <<
" "
86 << MSG_VECTOR(
v) << std::endl);
89 #ifdef LARWHEELSOLID_USE_BS_DTO
91 inputP, inputV, calcNorm, validNorm, sn
95 LWSDBG(5, std::cout <<
"dto exit point too low " << MSG_VECTOR(
q) << std::endl);
97 q.setX(
p.x() +
v.x() *
dy);
99 q.setZ(
p.z() +
v.z() *
dy);
103 LWSDBG(5, std::cout <<
"dto exit " <<
exit << std::endl);
105 LWSDBG(5, std::cout <<
"dto exit point " << MSG_VECTOR(
q) << std::endl);
112 LWSDBG(5, std::cout <<
"dto sections " <<
start <<
" " <<
stop <<
" " <<
step << std::endl);
121 LWSDBG(5, std::cout <<
"at " <<
i <<
" dist to zsec = " <<
d1 << std::endl);
122 const G4double
x1 =
p.x() +
v.x() *
d1,
y1 =
p.y() +
v.y() *
d1;
132 #ifndef LARWHEELSOLID_USE_BS_DTO
139 #ifndef LARWHEELSOLID_USE_BS_DTO
149 LWSDBG(5, std::cout <<
"q=" << MSG_VECTOR(
q) <<
" outside fan cur distance=" <<
distance <<
", m_FHTplusT=" <<
m_FHTplusT << std::endl);
151 #ifndef LARWHEELSOLID_USE_BS_DTO
160 #ifndef LARWHEELSOLID_USE_BS_DTO
167 LWSDBG(5, std::cout <<
"At end_dto distance=" <<
distance << std::endl);
168 #ifdef LARWHEELSOLID_USE_BS_DTO
169 if(calcNorm &&
distance < dto_bs) *validNorm =
false;
172 LWSDBG(5, std::cout <<
"dto calc norm " <<
exit << std::endl);
179 sn->set(0., 0., -1.);
184 sn->set(
q.x(),
q.y(), 0.);
196 #ifdef DEBUG_LARWHEELSOLID
198 std::cout <<
"DTO: " <<
distance <<
" ";
200 std::cout << *validNorm <<
" " << MSG_VECTOR((*sn));
202 std::cout <<
"Norm is not valid";
204 std::cout << std::endl;
206 G4ThreeVector
p2 = inputP + inputV *
distance;
208 std::cout <<
"DTO hit at " << MSG_VECTOR(
p2) <<
", "
212 #ifdef LWS_HARD_TEST_DTO
213 if(test_dto(inputP, inputV,
distance)){
215 std::cout << TypeStr() <<
" DisToOut" << MSG_VECTOR(inputP)
216 << MSG_VECTOR(inputV) << std::endl;
230 G4ThreeVector &
B,
const int p_fan)
const
232 LWSDBG(6, std::cout <<
"oip: " <<
p <<
" " <<
B);
236 unsigned int niter = 0;
251 LWSDBG(7, std::cout <<
" -> " <<
B <<
" " <<
diff.mag());
252 LWSDBG(6, std::cout << std::endl);
260 const G4ThreeVector &
a,
const G4ThreeVector &
b, G4ThreeVector &
C,
const int p_fan
263 LWSDBG(6, std::cout <<
"sfmrp " <<
a <<
" " <<
b << std::endl);
264 G4ThreeVector
diff(
b -
a);
272 unsigned int niter = 0;
280 LWSDBG(7, std::cout <<
"sfmrp -> " <<
C <<
" " << fabs(
d1)
281 <<
" " << (
C -
a).
unit() <<
" "
282 << (
C -
a).
mag() << std::endl);