// ---------------------------------------------------- // This file belongs to the ray tracing framework // for the use with Cherenkov detectors // // created 2007 //----------------------------------------------------- #include "PndDrcEffiAbs.h" #include "PndDrcSurfPolyPara.h" #include "PndDrcPhoton.h" //#include "PndDrcOptReflAbs.h" //#include "PndDrcSurfAbs.h" //#include "PndDrcSurfPolyFlat.h" //#include "PndDrcSurfPolySphere.h" //#include "PndDrcOptMatAbs.h" //#include "PndDrcOptDev.h" // //#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 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 "TPolyLine3D.h" //---------------------------------------------------------------------- PndDrcSurfPolyPara::PndDrcSurfPolyPara() { fRadius = -999; fChecked = false; } //---------------------------------------------------------------------- PndDrcSurfPolyPara* PndDrcSurfPolyPara::Clone() const { return new PndDrcSurfPolyPara(*this); } //---------------------------------------------------------------------- void PndDrcSurfPolyPara::Copy(const PndDrcSurfPolyPara& s) { fRadius = s.fRadius; fChecked = s.fChecked; fTrans = s.fTrans; fTransInv = s.fTransInv; } //---------------------------------------------------------------------- PndDrcSurfPolyPara::PndDrcSurfPolyPara(const PndDrcSurfPolyPara& s) : PndDrcSurfPolyFlat(s) { if (s.fVerbosity>=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 (!fChecked) fChecked = Check1();// check dimensions // transform point back, where paraboloid was defined. XYZPoint p1(fTransInv*point); // unit vector from focal point to point XYZVector v1 = (p1 - XYZPoint(0,0,fRadius/2)).Unit(); // unit vector parallel to z-axis hitting point XYZVector v2 = XYZVector(0,0,fabs(p1.Z())).Unit(); XYZVector pn(v1+v2); return (fTrans*pn).Unit(); } //---------------------------------------------------------------------- bool PndDrcSurfPolyPara::SurfaceHit(PndDrcPhoton& ph, XYZPoint& pos_new, double& path_length) const { //cout<<" PndDrcSurfPolyPara::surfaceHit"<kEps && lambda2>kEps) { // 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 = (lambda1EffiFlag(ph.Wavelength(), ph.Direction().Dot(Normal(pos_new)))) { ph.SetFate(Drc::kPhotMeasured); if (fPixelCorr) ph.SetPosition(fPixelPoint); } else { ph.SetFate(Drc::kPhotAbsorbed); } } //if (fPixel) ph.SetFate(Drc::kPhotMeasured); return true; } else if (hit1) { pos_new = pos + lambda1*dir; path_length = lambda1; pos_new = fTrans * pos_new; if (fPixel){ if (fEffiCathode ->EffiFlag(ph.Wavelength(), ph.Direction().Dot(Normal(pos_new)))) { ph.SetFate(Drc::kPhotMeasured); if (fPixelCorr) ph.SetPosition(fPixelPoint); } else { ph.SetFate(Drc::kPhotAbsorbed); } } //if (fPixel) ph.SetFate(Drc::kPhotMeasured); return true; } else if (hit2) { pos_new = pos + lambda2*dir; path_length = lambda2; pos_new = fTrans * pos_new; if (fPixel){ if (fEffiCathode ->EffiFlag(ph.Wavelength(), ph.Direction().Dot(Normal(pos_new)))) { ph.SetFate(Drc::kPhotMeasured); if (fPixelCorr) ph.SetPosition(fPixelPoint); } else { ph.SetFate(Drc::kPhotAbsorbed); } } //if (fPixel) ph.SetFate(Drc::kPhotMeasured); return true; } else { return false; } } else if (lambda1>kEps && lambda2<=kEps) { lambda = lambda1; } else if (lambda1<=kEps && lambda2>kEps) { lambda = lambda2; } else { //cout<<" both lambdas <0"<EffiFlag(ph.Wavelength(), ph.Direction().Dot(Normal(pos_new)))) { ph.SetFate(Drc::kPhotMeasured); if (fPixelCorr) ph.SetPosition(fPixelPoint); } else { ph.SetFate(Drc::kPhotAbsorbed); } } //if (fPixel) ph.SetFate(Drc::kPhotMeasured); return true; } return false; } //---------------------------------------------------------------------- bool PndDrcSurfPolyPara::Check1() const { if (fRadius<=0) { cerr<<" *** PndDrcSurfPolyPara::check: " <=3) cout<<" PndDrcSurfPolyPara::addTransform() name="<(fP.size()-1) || i<0) { cerr<<" *** PndDrcSurfPolyPara::limitingPoint: index out of range, i="<SetPoint("<SetPoint( icnt, fP1.X(), fP1.Y(), fP1.Z() ); // for an opened canvas icnt++; } } fP1 = fP[0]*frac; double z = fRadius - fP1.Mag2()/(2*fRadius); // z comp = 0 fP1.SetZ(z); fP1 = fTrans * fP1; stream<<" l->SetPoint("<SetLineColor("<Draw();"<SetPoint( icnt, fP1.X(), fP1.Y(), fP1.Z()); l->SetLineColor(fPrintColor); l->Draw(); icnt++; } } //---------------------------------------------------------------------- void PndDrcSurfPolyPara::Print() const { cout<<" Coordinates of PndDrcSurfPolyPara "<((*this)).Print(); cout<<" r = "<