#include using std::cout; using std::cerr; using std::cin; using std::endl; #include using std::valarray; #include using std::fstream; #include using std::string; #include using std::list; #include using std::vector; #include "TVector3.h" #include "TRotation.h" #include "TRandom.h" #include "TMatrixD.h" #include "TVectorD.h" #include "TDecompSVD.h" #include "Math/Vector3D.h" using ROOT::Math::XYZVector; #include "Math/Point3D.h" using ROOT::Math::XYZPoint; #include "Math/Transform3D.h" using ROOT::Math::Transform3D; #include "Math/RotationX.h" using ROOT::Math::RotationX; #include "Math/RotationY.h" using ROOT::Math::RotationY; #include "Math/RotationZ.h" using ROOT::Math::RotationZ; #include "Math/Rotation3D.h" using ROOT::Math::Rotation3D; #include "PndDrcPhoton.h" #include "PndDrcOptReflAbs.h" #include "PndDrcSurfAbs.h" #include "PndDrcSurfPolyFlat.h" #include "PndDrcSurfPolySphere.h" #include "PndDrcSurfPolyPara.h" #include "PndDrcOptMatAbs.h" #include "PndDrcOptDev.h" //---------------------------------------------------------------------- PndDrcSurfPolyPara::PndDrcSurfPolyPara() { m_radius = -999; m_checked = false; } //---------------------------------------------------------------------- PndDrcSurfPolyPara* PndDrcSurfPolyPara::clone() const { return new PndDrcSurfPolyPara(*this); } //---------------------------------------------------------------------- void PndDrcSurfPolyPara::copy(const PndDrcSurfPolyPara& s) { m_radius = s.m_radius; m_checked = s.m_checked; m_trans = s.m_trans; m_transInv = s.m_transInv; } //---------------------------------------------------------------------- PndDrcSurfPolyPara::PndDrcSurfPolyPara(const PndDrcSurfPolyPara& s) : PndDrcSurfPolyFlat(s) { if (s.m_verbosity>=1) cout<<" PndDrcSurfPolyPara::PndDrcSurfPolyPara" <<"(const PndDrcSurfPolyPara&) name,copy: " <=1) cout<<" PndDrcSurfPolyPara::operator=" <<"(const PndDrcSurfPolyPara&) name,copy: " <((*this)) = s; // assignment of base class part. copy(s); } return *this; } //---------------------------------------------------------------------- XYZVector PndDrcSurfPolyPara::normal(const XYZPoint& point) const { if (!m_checked) m_checked = check();// check dimensions // transform point back, where paraboloid was defined. XYZPoint p1(m_transInv*point); // unit vector from focal point to point XYZVector v1 = (p1 - XYZPoint(0,0,m_radius/2)).Unit(); // unit vector parallel to z-axis hitting point XYZVector v2 = XYZVector(0,0,fabs(p1.Z())).Unit(); XYZVector pn(v1+v2); return (m_trans*pn).Unit(); } //---------------------------------------------------------------------- bool PndDrcSurfPolyPara::surfaceHit(PndDrcPhoton& ph, XYZPoint& pos_new, double& path_length) const { //cout<<" PndDrcSurfPolyPara::surfaceHit"<eps && lambda2>eps) { // check both solutions XYZPoint pos_new1 = pos + lambda1*dir; XYZPoint pos_check(pos_new); pos_check.SetZ(0); bool hit1 = withinSurface(pos_check); XYZPoint pos_new2 = pos + lambda2*dir; pos_check = pos_new2; pos_check.SetZ(0); bool hit2 = withinSurface(pos_check); if (hit1 && hit2) { // take closest lambda = (lambda1eps && lambda2<=eps) { lambda = lambda1; } else if (lambda1<=eps && lambda2>eps) { lambda = lambda2; } else { //cout<<" both lambdas <0"<=3) cout<<" PndDrcSurfPolyPara::addTransform() name="<(m_p.size()-1) || i<0) { cerr<<" *** PndDrcSurfPolyPara::limitingPoint: index out of range, i="<SetPoint("<<(icnt++)<<"," <SetPoint("<<(icnt++)<<"," <SetLineColor("<Draw();"<