Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:18:06

0001 #pragma once
0002 
0003 #include "ParametricSurface.h"
0004 
0005 namespace IRT2 {
0006 
0007 // In fact a rectangle in space;
0008 class FlatSurface: public ParametricSurface, public LocalCoordinatesXY {
0009  public:
0010   FlatSurface() {};
0011  FlatSurface(const TVector3 &x0, const TVector3 &nx, const TVector3 &ny, double sx = 0.0, double sy = 0.0):
0012   // FIXME: no orthogonality and / or normalization check?;
0013   ParametricSurface(x0, -sx/2, sx/2, -sy/2, sy/2), m_Nx(nx.Unit()), m_Ny(ny.Unit()) {
0014     m_Nz = nx.Cross(ny).Unit();
0015   };
0016   ~FlatSurface() {};
0017 
0018   TVector3 GetSpacePoint(double x, double y) const {
0019     return GetCenter() + x*m_Nx + y*m_Ny;
0020   };
0021   TVector3 GetNormal(const TVector3 &xx) const {
0022     // Make compiler happy, use 'xx' variable;
0023     return m_Nz + 0.0*xx;
0024   };
0025   TVector3 GetNormal( void ) const {
0026     return m_Nz;
0027   };
0028   // FIXME: well, this calculation assumes orthogonal X&Y vectors were provided;
0029   inline double GetLocalX(const TVector3 &xx) const {
0030     return (xx - GetCenter()).Dot(m_Nx);
0031   };
0032   inline double GetLocalY(const TVector3 &xx) const {
0033     return (xx - GetCenter()).Dot(m_Ny);
0034   };
0035 
0036   bool GetCrossing(const TVector3 &x0, const TVector3 &n0, TVector3 *crs, bool check_normal = true) const;
0037   double GetDistance(const TVector3 &xx) const;
0038   ParametricSurface *_Clone(double angle, const TVector3 &axis) const {
0039     auto copy = new FlatSurface(*this);
0040 
0041     copy->m_Center.Rotate(angle, axis);
0042 
0043     copy->m_Nx.Rotate(angle, axis);
0044     copy->m_Ny.Rotate(angle, axis);
0045     copy->m_Nz.Rotate(angle, axis);
0046 
0047     return copy;
0048   };
0049 
0050   double GetU(const TVector3 &xx) const { return GetLocalX(xx); };
0051   double GetV(const TVector3 &xx) const { return GetLocalY(xx); };
0052 
0053  private:
0054   TVector3 m_Nx, m_Ny, m_Nz;
0055 
0056 #ifndef DISABLE_ROOT_IO
0057   ClassDef(FlatSurface, 1);
0058 #endif
0059 };
0060 
0061 } // namespace IRT2