#ifndef __DOMCROSSING__ #define __DOMCROSSING__ #include #include "JGeometry3D/JVector3D.hh" /** * \author mdejong */ /** * Class to check whether a photon emitted from a position along the * z-axis crosses a DOM (approximated by a disc) * first, inefficient version */ class DomCrossing { private: double __Rdom; public: DomCrossing(const double Rdom):__Rdom(Rdom) {} ~DomCrossing() {} bool operator()(const double theta, const double phi, const double z, const double R, const double dscat) { using namespace JGEOMETRY3D; const JVector3D p0(R,0,0); const JVector3D n(sin(theta),0,cos(theta)); const JVector3D l0(0,0,z); const JVector3D l(sin(theta)*cos(phi),sin(theta)*sin(phi),cos(theta)); const double d = JVector3D(p0-l0).getDot(n)/l.getDot(n); if(d<0) return false; const JVector3D crossing = l0+JVector3D(l.getX()*d,l.getY()*d,l.getZ()*d); const double hitdist = (p0-crossing).getLength(); const double dist = sqrt(z*z+R*R); if(hitdist<__Rdom&&dscat>=dist) return true; else return false; } }; // DomCrossing shadow; #endif