20 _direction = direction * (1 / direction.mag());
29 std::cout <<
"***** ALILine::intersect (constructor) two lines: " << std::endl
30 <<
" line1: " << *
this << std::endl
31 <<
" line2: " << l2 << std::endl;
33 CLHEP::Hep3Vector inters;
35 double acosvec =
vec().dot(l2.
vec()) /
vec().mag() / l2.
vec().mag();
38 std::cout <<
"\t Determination of acosvec = vec().dot(l2.vec()) / vec().mag() / l2.vec().mag() " << std::endl
43 std::cout <<
"\t vec().mag() = " <<
vec().mag() << std::endl;
44 std::cout <<
"\t l2.vec().mag() = " << l2.
vec().mag() << std::endl << std::endl;
48 std::cout <<
" acosvec = " << acosvec << std::endl;
51 std::cerr <<
" !!!EXITING ALILine::intersect: two lines are parallel" << std::endl;
55 std::cout <<
" !!! ALILine::intersect: two lines are parallel (no errors)" << std::endl;
79 std::cout << std::endl << std::endl <<
"*** START CALC OF FACT ***" << std::endl;
80 std::cout <<
" ==================" << std::endl << std::endl;
81 std::cout <<
"*** Determination of fact ->";
83 <<
vec().y() * l2.
pt().x() -
vec().x() * l2.
pt().y() -
vec().y() *
pt().x() +
vec().x() *
pt().y()
100 std::cout <<
" ** Problem: old_fact_denominator -> " << old_fact_denominator << std::endl;
103 std::cout <<
" ** Problem: fact -> " << fact << std::endl;
106 std::cout <<
" ** Division by 0 !!! " << std::endl;
108 std::cout <<
" ** Must rotate to yz plane for calculation (X-> Z) ";
110 fact = (-1 *
vec().y() * l2.
pt().z() +
vec().z() * l2.
pt().y() +
vec().y() *
pt().z() -
vec().z() *
pt().y()) /
111 (-1 *
vec().z() * l2.
vec().y() +
vec().y() * l2.
vec().z());
114 std::cout <<
"\t -- 1st Recalculation of fact in yz plane = " << fact << std::endl;
116 old_fact_denominator2 = -1 *
vec().z() * l2.
vec().y() +
vec().y() * l2.
vec().z();
120 std::cout <<
" ** Must rotate to xz plane for calculation (Y-> -Z) ";
122 std::cout <<
" ** Problem: old_fact_denominator2 -> " << old_fact_denominator2 << std::endl;
125 fact = (-1 *
vec().z() * l2.
pt().x() +
vec().x() * l2.
pt().z() +
vec().z() *
pt().x() -
vec().x() *
pt().z()) /
126 (-1 *
vec().x() * l2.
vec().z() +
vec().z() * l2.
vec().x());
129 std::cout <<
"\t -- 2nd Recalculation of fact in xz plane = " << fact << std::endl;
133 std::cout <<
"*!* 2nd calculation sufficient" << std::endl;
138 std::cout <<
"*!* Standard calculation - things are fine" << std::endl;
141 <<
vec().y() * l2.
pt().x() -
vec().x() * l2.
pt().y() -
vec().y() *
pt().x() +
vec().x() *
pt().y()
142 <<
" / " <<
vec().x() * l2.
vec().y() -
vec().y() * l2.
vec().x() <<
" ) = " << fact << std::endl;
153 inters = l2.
pt() + fact * l2.
vec();
156 std::cout <<
"Determination of intersection = l2.pt() + fact * l2.vec()" << std::endl << std::endl;
158 std::cout <<
"\t --> fact = " << fact << std::endl;
159 std::cout <<
"\t --> l2.vec() = " << l2.
vec() << std::endl;
168 out <<
" ALILine point " << li.
_point << std::endl;
180 std::cout <<
"***** ALILine::intersect WITH PLANE" << std::endl;
188 std::cerr <<
" !!!! INTERSECTION NOT POSSIBLE: LightRay is perpendicular to plane " << std::endl;
204 std::cout <<
" lightray* plate normal" << dtemp << std::endl;
207 dtemp = (vtemp * plane.
normal()) / dtemp;
209 std::cout <<
" n_r*plate normal (dtemp) : " << dtemp << std::endl;
211 std::cout <<
" Old vtemp : " << vtemp << std::endl;
213 std::cerr <<
"!!! LightRay: Intersect With Plane: plane and light ray parallel: no intersection" << std::endl;
221 CLHEP::Hep3Vector inters = vtemp +
_point;
CLHEP::Hep3Vector intersect(const ALILine &l2, bool notParallel=false)
friend std::ostream & operator<<(std::ostream &, const ALILine &li)
const CLHEP::Hep3Vector & pt() const
Abs< T >::type abs(const T &t)
const CLHEP::Hep3Vector & point() const
CLHEP::Hep3Vector _direction
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
const CLHEP::Hep3Vector & normal() const
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
const CLHEP::Hep3Vector & vec() const