00001 // $Id: IPVolume_predicates.h,v 1.7 2007/01/17 12:10:12 cattanem Exp $ 00002 // ============================================================================ 00003 #ifndef DETDESC_IPVOLUME_PREDICATES_H 00004 #define DETDESC_IPVOLUME_PREDICATES_H 00005 // STD & STL 00006 #include <iostream> 00007 #include <functional> 00008 // Geometry definitions 00009 #include "GaudiKernel/Point3DTypes.h" 00010 #include "GaudiKernel/Transform3DTypes.h" 00011 // DetDesc 00012 #include "DetDesc/IPVolume.h" 00013 #include "DetDesc/ILVolume.h" 00014 00030 class IPVolume_isInside: 00031 public std::unary_function<const IPVolume*,bool> 00032 { 00033 public: 00037 explicit IPVolume_isInside( const Gaudi::XYZPoint& PointInMotherFrame ) 00038 : m_point( PointInMotherFrame ){}; 00043 inline bool operator() ( const IPVolume* pv ) const 00044 { return ( ( 0 == pv ) ? false : pv->isInside( m_point ) ) ; } 00045 private: 00047 const Gaudi::XYZPoint m_point; 00048 }; 00049 00050 00060 class IPVolume_byName: 00061 std::unary_function<const IPVolume*,bool> 00062 { 00063 public: 00067 explicit IPVolume_byName( const std::string& Name ) 00068 : m_name( Name ){}; 00073 inline bool operator() ( const IPVolume* pv ) const 00074 { return ( ( 0 == pv ) ? false : ( pv->name() == m_name) ) ; } 00075 private: 00077 std::string m_name; 00078 }; 00079 00087 class IPVolume_accumulateMatrix: 00088 public std::unary_function<const IPVolume*,Gaudi::Transform3D&> 00089 { 00090 public: 00091 // 00092 inline Gaudi::Transform3D& operator() 00093 ( Gaudi::Transform3D& mtrx , const IPVolume* pv ) 00094 { mtrx = pv->matrix()*mtrx; return mtrx; } 00095 // 00096 }; 00097 00098 00106 class IPVolume_fromReplica: 00107 public std::unary_function<ILVolume::ReplicaType,const IPVolume*> 00108 { 00109 public: 00113 IPVolume_fromReplica( const ILVolume* LV ) 00114 : m_lv ( LV ) {}; 00115 00120 inline const IPVolume* operator() 00121 ( const ILVolume::ReplicaType& replica ) const 00122 { 00123 if( 0 == m_lv ) { return 0 ; } 00124 const IPVolume* pv = (*m_lv)[replica]; 00125 if( 0 == pv ) { m_lv = 0 ; return 0 ; } 00126 m_lv = pv->lvolume(); 00127 return pv; 00128 } 00129 private: 00130 00131 mutable const ILVolume* m_lv; 00132 00133 }; 00134 00135 // ============================================================================ 00136 #endif 00137 // ============================================================================