00001
00002
00003 #ifndef _DETDESCSVC_TRANSPORTSVC_H
00004 #define _DETDESCSVC_TRANSPORTSVC_H
00005
00006
00007
00008
00009
00010 #include <iostream>
00011 #include <string>
00012 #include <map>
00013
00014
00015
00016 #include "GaudiKernel/Kernel.h"
00017 #include "GaudiKernel/Service.h"
00018 #include "GaudiKernel/StatusCode.h"
00019 #include "GaudiKernel/StatEntity.h"
00020
00021
00022
00023 #include "DetDesc/ITransportSvc.h"
00024 #include "DetDesc/IGeometryErrorSvc.h"
00025 #include "DetDesc/TransportSvcException.h"
00026
00027
00028
00029 class IDataProviderSvc;
00030 class IMessageSvc;
00031 class IDetectorElement;
00032 class ISvcLocator;
00033 class GaudiException;
00034
00042 class TransportSvc
00043 : virtual public ITransportSvc
00044 , virtual public DetDesc::IGeometryErrorSvc
00045 , public Service
00046 {
00048 typedef std::vector<IGeometryInfo*> GeoContainer;
00049 typedef GeoContainer::reverse_iterator rGeoIt ;
00051 public:
00053 TransportSvc
00054 ( const std::string& name, ISvcLocator* ServiceLocator );
00056 virtual ~TransportSvc();
00058 public:
00059
00060
00061
00063 virtual StatusCode initialize ();
00065 virtual StatusCode finalize ();
00067 virtual StatusCode queryInterface
00068 ( const InterfaceID& iid ,
00069 void** ppi ) ;
00070
00071 public:
00072
00073
00074
00085 virtual double distanceInRadUnits
00086 ( const Gaudi::XYZPoint& Point1 ,
00087 const Gaudi::XYZPoint& Point2 ,
00088 double Threshold ,
00089 IGeometryInfo* AlternativeGeometry ,
00090 IGeometryInfo* GeometryGuess ) ;
00091
00107 virtual unsigned long intersections
00108 ( const Gaudi::XYZPoint& Point ,
00109 const Gaudi::XYZVector& Vector ,
00110 const ISolid::Tick& TickMin ,
00111 const ISolid::Tick& TickMax ,
00112 ILVolume::Intersections& Intersept ,
00113 double Threshold ,
00114 IGeometryInfo* AlternativeGeometry ,
00115 IGeometryInfo* GeometryGuess ) ;
00116
00117 public:
00118
00119
00120
00127 virtual void setCode
00128 ( const StatusCode& sc ,
00129 const ILVolume* volume ) ;
00130
00139 virtual void inspect
00140 ( const ILVolume* volume ,
00141 const Gaudi::XYZPoint& pnt ,
00142 const Gaudi::XYZVector& vect ,
00143 const ILVolume::Intersections& cnt ) ;
00144
00153 virtual void recovered
00154 ( const ILVolume* volume ,
00155 const Material* material1 ,
00156 const Material* material2 ,
00157 const double delta ) ;
00158
00166 virtual void skip
00167 ( const ILVolume* volume ,
00168 const Material* material ,
00169 const double delta ) ;
00170
00171 private:
00172
00173
00174
00176 inline IDataProviderSvc* detSvc () const ;
00180 inline IGeometryInfo* standardGeometry () const ;
00182 inline IGeometryInfo* previousGeometry () const ;
00183 inline IGeometryInfo* setPreviousGeometry
00184 ( IGeometryInfo* previous ) ;
00186 inline void Assert
00187 ( bool assertion ,
00188 const std::string& message ,
00189 const StatusCode& statusCode = StatusCode::FAILURE ) const;
00191 inline void Assert
00192 ( bool assertion ,
00193 const std::string& message ,
00194 const GaudiException& Exception ,
00195 const StatusCode& statusCode = StatusCode::FAILURE ) const;
00197 IGeometryInfo* findGeometry( const std::string& address ) const ;
00199 bool goodLocalGI
00200 ( const Gaudi::XYZPoint& point1,
00201 const Gaudi::XYZPoint& point2,
00202 IGeometryInfo* gi ) const;
00204 IGeometryInfo* findLocalGI
00205 ( const Gaudi::XYZPoint& point1,
00206 const Gaudi::XYZPoint& point2,
00207 IGeometryInfo* gi ,
00208 IGeometryInfo* topGi ) const;
00209
00210 private:
00211
00214 std::string m_detDataSvc_name ;
00216 mutable IDataProviderSvc* m_detDataSvc ;
00220 std::string m_standardGeometry_address ;
00221 mutable IGeometryInfo* m_standardGeometry ;
00223 mutable IGeometryInfo* m_previousGeometry ;
00225 mutable Gaudi::XYZPoint m_prevPoint1 ;
00226 mutable Gaudi::XYZPoint m_prevPoint2 ;
00227 mutable double m_previousThreshold ;
00228 mutable IGeometryInfo* m_previousGuess ;
00229 mutable IGeometryInfo* m_previousTopGeometry ;
00230 mutable ILVolume::Intersections m_localIntersections ;
00232 mutable ILVolume::Intersections m_local_intersects ;
00233 mutable GeoContainer m_vGi1 ;
00234 mutable GeoContainer m_vGi2 ;
00235 mutable GeoContainer m_vGi ;
00236 mutable ISolid::Ticks m_local_ticks ;
00238 private:
00240 typedef std::map<std::string, std::pair<StatEntity,StatEntity> > Map ;
00241 typedef std::map<std::string,unsigned long> Map1 ;
00242 Map m_skip ;
00243 Map m_recover ;
00244 Map1 m_codes ;
00245
00246 bool m_recovery ;
00248 bool m_protocol ;
00249
00250 };
00251
00253 inline IDataProviderSvc* TransportSvc::detSvc () const
00254 { return m_detDataSvc ; }
00255
00257 inline IGeometryInfo* TransportSvc::standardGeometry () const
00258 {
00259 return ( 0 != m_standardGeometry ) ?
00260 m_standardGeometry : m_standardGeometry =
00261 findGeometry( m_standardGeometry_address ) ;
00262 }
00263
00265 inline IGeometryInfo* TransportSvc::previousGeometry () const
00266 { return m_previousGeometry ; }
00267
00269 inline IGeometryInfo* TransportSvc::setPreviousGeometry
00270 ( IGeometryInfo* previous )
00271 { m_previousGeometry = previous ; return previousGeometry() ; }
00272
00274 inline void TransportSvc::Assert
00275 ( bool assertion ,
00276 const std::string& Message ,
00277 const StatusCode& statusCode ) const
00278 { if( !assertion ) { throw TransportSvcException( Message , statusCode ); } }
00279
00281 inline void TransportSvc::Assert
00282 ( bool assertion ,
00283 const std::string& Message ,
00284 const GaudiException& Exception ,
00285 const StatusCode& statusCode ) const
00286 { if( !assertion )
00287 { throw TransportSvcException( Message , Exception , statusCode ); } }
00288
00289
00290
00291 #endif // DETDESCSVC__TRANSPORTSVC_H
00292