////////////////////////////////////////////////////////////////////////////////////////// /// \class RAT::SNONCDAnchor /// /// \brief Geometry Class describing the NCD anchor subregions. /// /// \author Aksel Hallin aksel.hallin@ualberta.ca /// /// Revision History: \n /// 2014-06-30 Aksel Hallin /// ///\detail This class implements NCD anchors as subregions of the SNOAV class. /// ///////////////////////////////////////////////////////////////////////////////////////// #ifndef RAT__SNONCDAnchor__ #define RAT__SNONCDAnchor__ #include namespace RAT{ class SNONCDAnchor :public SphericalSubregion{ public: /// Constructor. The NCD anchor is defined by a position, and is modelled as a right circular cylindrical region /// bounded by concentric spherical faces. This is a slight approximation for the inner face, but the /// curvature is less than the machining accuracy. /// @param[in] rmin The distance from the center of the AV to the "top" of the NCD anchor. /// @param[in] rmax The distance from the center of the AV to the glue joint between NCD anchor and AV (the AV radius) /// @param[in] radius The radius of the NCD anchor (considering it to be a cylinder) /// @param[in] position The coordinates of the center of the NCD face at the radius rmax. SNONCDAnchor(G4double rmin, G4double rmax, G4double radius, const G4ThreeVector &position); /// Implements G4VSolid (SphericalSubregion) method G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &n, const G4double dInner[2], const G4double dOuter[2])const; /// Implements G4VSolid (SphericalSubregion) method G4double DistanceToIn(const G4ThreeVector &p)const; /// Implements G4VSolid (SphericalSubregion) method G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &n, const G4double dInner[2], const G4double dOuter[2])const; /// Implements G4VSolid (SphericalSubregion) method G4double DistanceToOut(const G4ThreeVector &p)const; /// Implements G4VSolid (SphericalSubregion) method EInside Inside(const G4ThreeVector &p)const; /// Calculates the 4 vectors corresponding to the corners of the region from which a particle can intersect the NCD anchor, /// without passing out of the volume between the concentric spheres at rmin and rmax. /// @param[out] corners[4] The vectors corresponding to the extent of the region. G4bool OverlapsRegion(const G4ThreeVector corners[4])const ; /// Calculates the perpendicular distance between the axis of the NCD anchor cylinder and the point p /// @param[in] p The point for which to calculate the distance. G4double Radius(const G4ThreeVector &p)const{ G4ThreeVector skew = (p - fPosition); skew = skew - (skew*fDirection)*fDirection; return skew.mag(); } /// Implements G4VSolid (SphericalSubregion) method G4ThreeVector SurfaceNormal(const G4ThreeVector &p, G4bool &IsValid)const; private: const G4ThreeVector fPosition; ///< The coordinates of the NCD anchor, corresponding to the center of the glued on face. G4ThreeVector fDirection; ///< The direction of the NCD axis G4double fRmin; ///< The distance between the center of the AV and the top of the NCD anchor G4double fRmax; ///< The distance between the center of the AV and the glued face of the ncd anchor G4double fRadius; ///< The cylindrical radius of the NCD anchor. G4double fThreshold; }; } //::RAT #endif