7 #ifndef PORTABLE_LAR_SHAPE
10 #include "CLHEP/Units/PhysicalConstants.h"
17 LWSDBG(1, std::cout <<
TypeStr() <<
" DisToIn" << MSG_VECTOR(inputP) << std::endl);
22 LWSDBG(2, std::cout <<
"Outside BS" << std::endl);
25 G4ThreeVector
p(inputP);
34 const G4double
d = fabs(
GetCalculator()->DistanceToTheNearestFan(
p, p_fan));
37 LWSDBG(2, std::cout <<
"dti result = " <<
result << std::endl);
40 LWSDBG(2, std::cout <<
"already inside, return 0" << MSG_VECTOR(
p) << std::endl);
45 const G4ThreeVector &inputV)
const
47 LWSDBG(1, std::cout <<
TypeStr() <<
" DisToIn" << MSG_VECTOR(inputP)
48 << MSG_VECTOR(inputV) << std::endl);
52 G4ThreeVector
p(inputP);
53 if(inside_BS == kOutside) {
56 LWSDBG(2, std::cout <<
"Infinity distance to m_BoundingShape"
57 << MSG_VECTOR(inputP) << MSG_VECTOR(inputV)
63 LWSDBG(2, std::cout <<
"shift" << MSG_VECTOR(inputP) << std::endl);
66 const G4double
phi0 =
p.phi();
70 LWSDBG(2, std::cout <<
"already inside fan" << MSG_VECTOR(
p) << std::endl);
72 if(inside_BS == kSurface) {
73 LWSDBG(2, std::cout <<
"On BS surface" << std::endl);
78 G4ThreeVector
v(inputV);
84 #ifdef DEBUG_LARWHEELSLICESOLID
87 std::cout << MSG_VECTOR(inputP)
88 <<
" " << MSG_VECTOR(inputV) << std::endl;
90 std::cout <<
"dti: " <<
d0 <<
", DTI: " <<
distance << std::endl;
96 std::cout <<
"DTI hit at dist. " <<
distance <<
", point "
97 << MSG_VECTOR(
p2) <<
", "
100 std::cout <<
"got infinity from dti" << std::endl;
103 #ifdef LWS_HARD_TEST_DTI
104 if(test_dti(inputP, inputV,
distance)){
106 std::cout <<
TypeStr() <<
" DisToIn" << MSG_VECTOR(inputP)
107 << MSG_VECTOR(inputV) << std::endl;
111 std::cout <<
TypeStr() <<
" DisToIn" << MSG_VECTOR(inputP)
112 << MSG_VECTOR(inputV) <<
" " <<
distance << std::endl;
114 #endif // ifdef LWS_HARD_TEST_DTI
116 #endif // ifdef DEBUG_LARWHEELSLICESOLID
123 LWSDBG(4, std::cout <<
"dti: " << MSG_VECTOR(
p) <<
" "
124 << MSG_VECTOR(
v) << std::endl);
129 if(
v.x() >= 0.)
return kInfinity;
130 const G4double
b = (
m_Xmax -
p.x()) /
v.x();
131 const G4double
y2 =
p.y() +
v.y() *
b;
132 const G4double z2 =
p.z() +
v.z() *
b;
136 if(
v.x() <= 0.)
return kInfinity;
137 const G4double
b = (
m_Xmin -
p.x()) /
v.x();
138 const G4double
y2 =
p.y() +
v.y() *
b;
139 const G4double z2 =
p.z() +
v.z() *
b;
146 LWSDBG(5, std::cout <<
"dti corrected: " << MSG_VECTOR(
p) << std::endl);
150 LWSDBG(5, std::cout <<
"hit fan dist_p=" << dist_p <<
", m_FHTminusT=" <<
m_FHTminusT << std::endl);
157 LWSDBG(5, std::cout <<
"dti exit point: " << MSG_VECTOR(
q) <<
" "
158 << dist_q << std::endl);
159 G4double
dd = kInfinity;
160 if(dist_p * dist_q < 0.){
166 }
else if(
dd < kInfinity){
178 const G4ThreeVector &
p, G4double dist_p, G4ThreeVector &
B,
int p_fan
181 LWSDBG(6, std::cout <<
"iip from " <<
p <<
" to " <<
B
182 <<
" dir " << (
B -
p).
unit()
188 unsigned int niter = 0;
195 if(dist_c * dist_p < 0. || fabs(dist_c) <
m_FHTminusT){
206 LWSDBG(7, std::cout <<
"iip result in " << niter <<
" = " <<
B
207 <<
" " <<
diff.mag() << std::endl);
214 const G4ThreeVector &p_in,
const G4double dist_p_in,
215 const G4ThreeVector &p_out,
int p_fan
218 LWSDBG(6, std::cout <<
"sfnp " << MSG_VECTOR(p_in) <<
" "
219 << MSG_VECTOR(p_out) << std::endl);
227 G4double
sign = dist_p_in < 0.? -1. : 1.;
230 unsigned long niter = 0;
235 if(dist_c *
sign <= 0.){
236 LWSDBG(7, std::cout <<
"sfnp0 " << dist_c << std::endl);
243 if(d_prime < 0.)
A =
C;
250 LWSDBG(7, std::cout <<
"sfnp1 " << dist_c << std::endl);
254 if(dist_p_in *
sign < dist_c *
sign){
259 if(dist_p_out *
sign < dist_c *
sign)
C = p_out;
261 LWSDBG(7, std::cout <<
"sfnp2 " << dist_p_out << std::endl);