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

In This Package:

LogVolBase.h

Go to the documentation of this file.
00001 // $Id: LogVolBase.h,v 1.16 2007/01/17 12:10:13 cattanem Exp $ 
00002 #ifndef     DETDESC_LOGVOLBASE_H
00003 #define     DETDESC_LOGVOLBASE_H
00005 #include <functional>
00006 #include <algorithm> 
00008 #include "GaudiKernel/IValidity.h"
00009 #include "GaudiKernel/IRegistry.h"
00010 #include "GaudiKernel/Transform3DTypes.h"
00012 #include "DetDesc/ISolid.h" 
00013 #include "DetDesc/Services.h" 
00014 #include "DetDesc/IPVolume.h"
00015 #include "DetDesc/IPVolume_predicates.h" 
00016 #include "DetDesc/LogVolumeException.h"
00017 #include "DetDesc/Surface.h"
00018 #include "DetDesc/ValidDataObject.h"
00019 
00021 class IDataProviderSvc;
00022 class IMessageSvc;
00023 
00035 class LogVolBase: 
00036   public virtual ILVolume   , 
00037   public         ValidDataObject 
00038 {
00039   
00040 protected:
00041   
00048   LogVolBase( const std::string& name        = "" , 
00049               const std::string& sensitivity = "" ,
00050               const std::string& magnetic    = "" );
00051   
00053   virtual ~LogVolBase();
00054   
00055 public:
00056   
00061   inline virtual const std::string&  name () const 
00062   {
00063     static std::string s_empty = "";
00064     IRegistry* pReg = registry();
00065     return (0!=pReg) ? pReg->identifier() : s_empty;;
00066   }
00067   
00072   inline virtual        PVolumes& pvolumes ()      { return m_pvolumes ; } 
00073   
00078   inline virtual const PVolumes& pvolumes () const { return m_pvolumes ; }
00079   
00084   inline virtual ILVolume::ReplicaType noPVolumes () const
00085   { return m_pvolumes.size() ; }
00086   
00092   inline virtual const IPVolume* operator[]
00093   ( const ILVolume::ReplicaType& index ) const
00094   {
00095     return m_pvolumes.size() > index ? 
00096       *(m_pvolumes.begin()+index) : 0 ;
00097   };
00098   
00104   inline virtual const IPVolume* operator[]
00105   ( const std::string&           name  ) const
00106   { 
00107     ILVolume::PVolumes::const_iterator pvi = 
00108       std::find_if( m_pvolumes.begin  () , 
00109                     m_pvolumes.end    () , 
00110                     IPVolume_byName( name ) ) ;
00111     return m_pvolumes.end() != pvi ? *pvi : 0 ;
00112   };
00113   
00118   virtual const IPVolume* pvolume   
00119   ( const ILVolume::ReplicaType& index ) const
00120   {
00121     return m_pvolumes.size() > index ? 
00122       *(m_pvolumes.begin()+index) : 0 ;
00123   };
00124   
00129   virtual const IPVolume* pvolume   
00130   ( const std::string&           name  ) const 
00131   { 
00132     ILVolume::PVolumes::const_iterator pvi = 
00133       std::find_if( m_pvolumes.begin  () , 
00134                     m_pvolumes.end    () , 
00135                     IPVolume_byName( name ) ) ;
00136     return m_pvolumes.end() != pvi ? *pvi : 0 ;
00137   };
00138   
00143   inline virtual ILVolume::PVolumes::iterator       pvBegin     ()
00144   { return m_pvolumes.begin () ;}
00145   
00150   inline virtual ILVolume::PVolumes::const_iterator pvBegin     () const
00151   { return m_pvolumes.begin () ;}
00152   
00157   inline virtual ILVolume::PVolumes::iterator       pvEnd       ()
00158   { return m_pvolumes.end ()  ;}
00159   
00164   inline virtual ILVolume::PVolumes::const_iterator pvEnd       () const 
00165   { return m_pvolumes.end () ;}
00166   
00175   virtual StatusCode traverse 
00176   ( ILVolume::ReplicaPath::const_iterator pathBegin,
00177     ILVolume::ReplicaPath::const_iterator pathEnd  ,
00178     ILVolume::PVolumePath&                pVolumePath ) const ;
00179   
00187   inline virtual StatusCode traverse 
00188   ( const ILVolume::ReplicaPath&  path,
00189     ILVolume::PVolumePath&        pVolumePath ) const
00190   { return traverse( path.begin() , path.end() , pVolumePath ); }
00191   
00196   inline virtual const std::string& sdName () const { return m_sdName; } ;
00197   
00202   inline virtual const std::string& mfName () const { return m_mfName; } ;
00203   
00208   inline virtual        Surfaces& surfaces()       { return m_surfaces ; }
00209   
00214   inline virtual  const Surfaces& surfaces() const { return m_surfaces ; }
00215   
00221   virtual std::ostream& printOut( std::ostream & os = std::cout ) const ;
00222   
00228   virtual MsgStream&    printOut( MsgStream    & os             ) const;
00229   
00234   inline virtual ILVolume* reset () 
00235   {
00237     std::for_each( m_pvolumes.begin ()         , 
00238                    m_pvolumes.end   ()         ,
00239                    std::mem_fun(&IPVolume::reset) ) ;
00241     return this;
00242   };
00243   
00250   virtual StatusCode 
00251   queryInterface( const InterfaceID& ID , void** ppI ) ;
00252 
00257   virtual unsigned long addRef  ();
00258 
00263   virtual unsigned long release ();
00264 
00272   IPVolume* createPVolume
00273   ( const std::string&    PVname                    , 
00274     const std::string&    LVnameForPV               ,
00275     const Gaudi::XYZPoint&     position = Gaudi::XYZPoint  () ,  
00276     const Gaudi::Rotation3D&    rotation = Gaudi::Rotation3D () ); 
00277   
00284   IPVolume* createPVolume
00285   ( const std::string&    PVname                    , 
00286     const std::string&    LVnameForPV               ,
00287     const Gaudi::Transform3D& Transform                 );
00288   
00289 protected: 
00290   
00294   IPVolume* createPVolume();
00295   
00301   inline void Assert
00302   ( bool               assertion                       , 
00303     const std::string& name                            ,
00304     const StatusCode&  sc        = StatusCode::FAILURE ) const
00305   { if( !assertion ) { throw LogVolumeException( name, this , sc ); } };
00306   
00313   inline void Assert
00314   ( bool                  assertion , 
00315     const std::string&    name      ,
00316     const GaudiException& Exception , 
00317     const StatusCode&     sc        = StatusCode::FAILURE ) const  
00318   { 
00319     if( !assertion ) 
00320       { throw LogVolumeException( name, Exception , this , sc ); }
00321   };
00322   
00333   unsigned int intersectDaughters
00334   ( const Gaudi::XYZPoint&        Point              , 
00335     const Gaudi::XYZVector&       Vector             , 
00336     ILVolume::Intersections& childIntersections , 
00337     const ISolid::Tick     & tickMin            , 
00338     const ISolid::Tick     & tickMax            , 
00339     const double             Threshold          ) const ;  
00340   
00349   unsigned int  intersectDaughters
00350   ( const Gaudi::XYZPoint&        Point              , 
00351     const Gaudi::XYZVector&       Vector             , 
00352     ILVolume::Intersections& childIntersections , 
00353     const double             Threshold          ) const ;
00354   
00361   inline bool isInsideDaughter
00362   ( const Gaudi::XYZPoint& LocalPoint ) const
00363   { 
00364     return  
00365       m_pvolumes.end() != insideDaughter( LocalPoint );
00366   };
00367   
00374   inline ILVolume::PVolumes::const_iterator insideDaughter
00375   ( const Gaudi::XYZPoint& LocalPoint ) const
00376   { 
00377     return  
00378       std::find_if( m_pvolumes.begin () , 
00379                     m_pvolumes.end   () , 
00380                     IPVolume_isInside( LocalPoint ) ) ;
00381   };
00382 
00383 protected: 
00384   
00385   // deduce the copy number of physical volume from its name 
00386   //  size_t   copyNumber ( const std::string& pvName ) const ;
00387   //  bool     copyExist  ( const size_t       copy   ) const ;
00388 
00389 protected:
00390   
00395   IDataProviderSvc* dataSvc() const;
00396 
00401   IMessageSvc* msgSvc() const;
00402 
00403 private: 
00404   
00406   LogVolBase            ( const LogVolBase& lvb );
00408   LogVolBase& operator= ( const LogVolBase& lvb );
00409   
00410 private:
00411   
00413   PVolumes              m_pvolumes      ; 
00415   Surfaces              m_surfaces      ; 
00417   std::string           m_sdName        ;
00419   std::string           m_mfName        ;
00421   static  unsigned long s_volumeCounter ;
00423   DetDesc::Services* m_services;
00424 };
00425 
00426 // ============================================================================
00427 // The End 
00428 // ============================================================================
00429 #endif  
00430 // ============================================================================
| 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