#ifndef __JLINE1Z__ #define __JLINE1Z__ #include "JGeometry3D/JVertex3D.hh" #include "JGeometry3D/JVersor3D.hh" #include "JGeometry3D/JAxis3D.hh" #include "JPhysics/JConstants.hh" /** * \author mdejong */ namespace JFIT {} namespace JPP { using namespace JFIT; } namespace JFIT { using JGEOMETRY3D::JVertex3D; using JGEOMETRY3D::JVersor3D; using JGEOMETRY3D::JAxis3D; /** * Data structure for fit of straight line paralel to z-axis. */ class JLine1Z : public JVertex3D { public: using JVertex3D::getZ; using JVertex3D::getT; /** * Default constructor. */ JLine1Z() : JVertex3D() {} /** * Constructor. * * \param pos position * \param t time at position */ JLine1Z(const JVector3D& pos, const double t) : JVertex3D(pos, t) {} /** * Move vertex along this line with given velocity. * * \param step step * \param velocity velocity */ void move(const double step, const double velocity) { __z += step; __t += step / velocity; } /** * Set z-position of vertex. * * \param z z-position * \param velocity velocity */ void setZ(const double z, const double velocity) { move(z - getZ(), velocity); } /** * Get distance squared. * * \param pos position * \return square of distance */ inline double getDistanceSquared(const JVector3D& pos) const { const double dx = pos.getX() - this->getX(); const double dy = pos.getY() - this->getY(); return dx*dx + dy*dy; } /** * Get distance. * * \param pos position * \return distance */ inline double getDistance(const JVector3D& pos) const { return sqrt(this->getDistanceSquared(pos)); } /** * Get arrival time of Cherenkov light at given position. * * \param pos position [m] * \return time [ns] */ inline double getT(const JVector3D& pos) const { using namespace JPP; const double dx = pos.getX() - this->getX(); const double dy = pos.getY() - this->getY(); const double dz = pos.getZ() - this->getZ(); const double R = sqrt(dx*dx + dy*dy); return this->getT() + (dz + R * getKappaC()) * getInverseSpeedOfLight(); } /** * Get point of emission of Cherenkov light along muon path. * * \param pos position * \return position along muon path */ double getZ(const JPosition3D& pos) const { using namespace JPP; return pos.getZ() - this->getDistance(pos) / getTanThetaC(); } /** * Get photon direction of Cherenkov light on PMT. * * \param pos PMT position * \return direction */ inline JVersor3D getDirection(const JVector3D& pos) const { using namespace JPP; double dx = pos.getX() - this->getX(); double dy = pos.getY() - this->getY(); const double R = sqrt(dx*dx + dy*dy); dx *= getSinThetaC() / R; dy *= getSinThetaC() / R; const double dz = getCosThetaC(); return JVersor3D(dx,dy,dz); } /** * Get cosine angle of impact of Cherenkov light on PMT. * * \param axis PMT axis * \return cosine angle of impact */ inline double getDot(const JAxis3D& axis) const { return getDirection(axis.getPosition()).getDot(axis.getDirection()); } typedef double JLine1Z::*parameter_type; static parameter_type pX() { return &JLine1Z::__x; } static parameter_type pY() { return &JLine1Z::__y; } static parameter_type pT() { return &JLine1Z::__t; } }; } #endif