| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

SolidTubs.h

Go to the documentation of this file.
00001 // $Id: SolidTubs.h,v 1.20 2008/10/28 12:04:37 cattanem Exp $
00002 // ===========================================================================
00003 #ifndef     DETDESC_SOLIDTUBS_H
00004 #define     DETDESC_SOLIDTUBS_H 1  
00005 // STD and STL includes 
00006 #include <cmath>
00007 #include <iostream>
00008 // Units
00009 #include "GaudiKernel/SystemOfUnits.h" 
00010 // Geometry Definitions includes 
00011 #include "GaudiKernel/Point3DTypes.h" 
00012 #include "GaudiKernel/Vector3DTypes.h"
00013 // DetDesc 
00014 #include "DetDesc/SolidBase.h" 
00015 // forward declarations
00016 template <class TYPE>
00017 class SolidFactory;
00018 class MsgStream;
00019 //
00020 
00028 class SolidTubs: public virtual SolidBase
00029 {
00031   friend class SolidFactory<SolidTubs>;
00032   
00033 public:
00034   
00045   SolidTubs( const std::string& name                             ,
00046              const double       ZHalfLength                      , 
00047              const double       OuterRadius                      ,
00048              const double       InnerRadius   =   0.0            , 
00049              const double       StartPhiAngle =   0.0 * Gaudi::Units::degree, 
00050              const double       DeltaPhiAngle = 360.0 * Gaudi::Units::degree,
00051              const int          CoverModel    =   0              );     
00052 
00054   virtual ~SolidTubs();
00055 
00061   inline std::string typeName () const { return "SolidTubs"; };
00062 
00071   bool isInside ( const Gaudi::XYZPoint& point ) const; 
00072   bool isInside ( const Gaudi::Polar3DPoint& point ) const ;
00073   bool isInside ( const Gaudi::RhoZPhiPoint& point ) const ;
00074   
00088   const ISolid* cover () const;
00089   
00098   virtual std::ostream& printOut ( std::ostream& os = std::cout ) const;
00099   
00108   virtual MsgStream&    printOut ( MsgStream&    os             ) const;
00109   
00129   virtual unsigned int intersectionTicks( const Gaudi::XYZPoint & Point,
00130                                           const Gaudi::XYZVector& Vector,
00131                                           ISolid::Ticks& ticks  ) const ;
00132 
00133   virtual unsigned int intersectionTicks( const Gaudi::Polar3DPoint  & Point,
00134                                           const Gaudi::Polar3DVector & Vector,
00135                                           ISolid::Ticks     & ticks) const ; 
00136 
00137   virtual unsigned int intersectionTicks( const Gaudi::RhoZPhiPoint  & Point,
00138                                           const Gaudi::RhoZPhiVector & Vector,
00139                                           ISolid::Ticks     & ticks) const ;   
00140 
00163   virtual unsigned int intersectionTicks( const Gaudi::XYZPoint& Point,
00164                                           const Gaudi::XYZVector & Vector,
00165                                           const ISolid::Tick& tickMin,
00166                                           const ISolid::Tick& tickMax,
00167                                           ISolid::Ticks& ticks   ) const ; 
00168 
00169   virtual unsigned int intersectionTicks( const Gaudi::Polar3DPoint& Point,
00170                                           const Gaudi::Polar3DVector & Vector,
00171                                           const ISolid::Tick& tickMin,
00172                                           const ISolid::Tick& tickMax,
00173                                           ISolid::Ticks& ticks   ) const ; 
00174 
00175   virtual unsigned int intersectionTicks( const Gaudi::RhoZPhiPoint& Point,
00176                                           const Gaudi::RhoZPhiVector & Vector,
00177                                           const ISolid::Tick& tickMin,
00178                                           const ISolid::Tick& tickMax,
00179                                           ISolid::Ticks& ticks   ) const ; 
00180     
00182 
00183   inline double innerRadius     () const 
00184   { return m_tubs_innerRadius   ; };
00185   inline double outerRadius     () const 
00186   { return m_tubs_outerRadius   ; };
00187   inline double zHalfLength     () const 
00188   { return m_tubs_zHalfLength   ; };
00189   inline double startPhiAngle   () const 
00190   { return m_tubs_startPhiAngle ; }; 
00191   inline double deltaPhiAngle   () const 
00192   { return m_tubs_deltaPhiAngle ; }; 
00193   inline double innerDiameter   () const 
00194   { return m_tubs_innerRadius   * 2 ; };
00195   inline double outerDiameter   () const 
00196   { return m_tubs_outerRadius   * 2 ; };
00197   inline double zLength         () const 
00198   { return m_tubs_zHalfLength   * 2 ; };
00199   inline double endPhiAngle     () const 
00200   { return m_tubs_startPhiAngle + m_tubs_deltaPhiAngle ; }; 
00202 
00207   Ticks::size_type maxNumberOfTicks() const { return 4 ; }
00208 
00209 protected:
00210   
00215   template <class aPoint>
00216   inline bool insideRho ( const aPoint& point ) const ;
00217   
00219   inline bool insidePhi ( const double phi /* [-pi,pi] */ ) const ;
00220 
00225   template <class aPoint>
00226   inline bool insidePhi ( const aPoint& point ) const ;  
00227   
00229   inline bool noPhiGap() const { return m_noPhiGap ; }
00230   
00231 protected:
00232   
00236   SolidTubs( const std::string& name = "Anonymous Tubs");
00237 
00240   void setBP();
00241   
00242 private:
00243   
00244   SolidTubs           ( const SolidTubs & );  
00245   SolidTubs& operator=( const SolidTubs & );  
00246 
00252   template <class aPoint>
00253   bool isInsideImpl(const aPoint& point) const;  
00254 
00255   template<class aPoint, class aVector>
00256   unsigned int intersectionTicksImpl( const aPoint  & Point,
00257                                       const aVector & Vector,
00258                                       const ISolid::Tick& tickMin,
00259                                       const ISolid::Tick& tickMax,
00260                                       ISolid::Ticks&  ticks) const;
00261 
00262   template<class aPoint, class aVector>
00263   unsigned int intersectionTicksImpl( const aPoint  & Point,
00264                                       const aVector & Vector,
00265                                       ISolid::Ticks& ticks ) const;
00266 
00267 private:
00268 
00269   // parameters of tube segment 
00270   double                  m_tubs_zHalfLength   ;
00271   double                  m_tubs_outerRadius   ;
00272   double                  m_tubs_innerRadius   ;
00273   double                  m_tubs_startPhiAngle ;
00274   double                  m_tubs_deltaPhiAngle ;
00275   // model for constructing the cover solid 
00276   int                     m_tubs_coverModel    ;  
00277   //
00278   bool                    m_noPhiGap           ;
00279 };
00280 
00281   
00282 // ===========================================================================
00287 // ===========================================================================
00288 template<class aPoint>
00289 inline bool SolidTubs::insideRho ( const aPoint& point ) const 
00290 {
00291   const double rho2 = point.perp2();
00292   if( rho2 > outerRadius() * outerRadius() ) { return false ; }
00293   if( 0    < innerRadius() && 
00294       rho2 < innerRadius() * innerRadius() ) { return false ; }
00295   // inside! 
00296   return true ;
00297 };
00298 // ===========================================================================
00299 
00300 
00301 // ===========================================================================
00306 // ===========================================================================
00307 inline bool SolidTubs::insidePhi ( const double phi /* [-pi,pi] */ ) const
00308 {
00309   return 
00310     noPhiGap() ||
00311     ( startPhiAngle ()                   <= phi &&
00312       startPhiAngle () + deltaPhiAngle() >= phi     ) ||
00313     ( startPhiAngle ()                   <= phi + 2*M_PI &&
00314       startPhiAngle () + deltaPhiAngle() >= phi + 2*M_PI ) ;
00315 };
00316 
00317 // ===========================================================================
00322 // ===========================================================================
00323 template< class aPoint>
00324 inline bool SolidTubs::insidePhi ( const aPoint& point ) const 
00325 {
00326   return noPhiGap() || insidePhi( point.phi() ) ;
00327 };
00328 // ===========================================================================
00329 // The END 
00330 // ===========================================================================
00331 #endif 
00332 // ===========================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:00:13 2011 for DetDesc by doxygen 1.4.7