#include <DetDescSvc/TransportSvc.h>
Inheritance diagram for TransportSvc:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
TransportSvc (const std::string &name, ISvcLocator *ServiceLocator) | |
constructor | |
virtual | ~TransportSvc () |
destructor | |
virtual StatusCode | initialize () |
Initialise the service. | |
virtual StatusCode | finalize () |
Finalise the service. | |
virtual StatusCode | queryInterface (const InterfaceID &iid, void **ppi) |
Query the interfaces. | |
virtual double | distanceInRadUnits (const Gaudi::XYZPoint &Point1, const Gaudi::XYZPoint &Point2, double Threshold, IGeometryInfo *AlternativeGeometry, IGeometryInfo *GeometryGuess) |
Estimate the distance between 2 points in units of radiation length units. | |
virtual unsigned long | intersections (const Gaudi::XYZPoint &Point, const Gaudi::XYZVector &Vector, const ISolid::Tick &TickMin, const ISolid::Tick &TickMax, ILVolume::Intersections &Intersept, double Threshold, IGeometryInfo *AlternativeGeometry, IGeometryInfo *GeometryGuess) |
general method ( returns the "full history" of the volume boundary intersections with different material properties between 2 points ) | |
virtual void | setCode (const StatusCode &sc, const ILVolume *volume) |
set/reset the current "status" of geometry erorrs | |
virtual void | inspect (const ILVolume *volume, const Gaudi::XYZPoint &pnt, const Gaudi::XYZVector &vect, const ILVolume::Intersections &cnt) |
inspect the potential error in intersections | |
virtual void | recovered (const ILVolume *volume, const Material *material1, const Material *material2, const double delta) |
report the recovered action in intersections | |
virtual void | skip (const ILVolume *volume, const Material *material, const double delta) |
report the skipped intersection | |
virtual const InterfaceID & | type () const =0 |
virtual StatusCode | sysInitialize ()=0 |
virtual StatusCode | sysStart ()=0 |
virtual StatusCode | sysStop ()=0 |
virtual StatusCode | sysFinalize ()=0 |
virtual StatusCode | sysReinitialize ()=0 |
virtual StatusCode | sysRestart ()=0 |
virtual StatusCode | configure ()=0 |
virtual StatusCode | start ()=0 |
virtual StatusCode | stop ()=0 |
virtual StatusCode | terminate ()=0 |
virtual StatusCode | reinitialize ()=0 |
virtual StatusCode | restart ()=0 |
virtual Gaudi::StateMachine::State | FSMState () const =0 |
virtual Gaudi::StateMachine::State | targetFSMState () const =0 |
virtual const std::string & | name () const =0 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
virtual const InterfaceID & | type () const =0 |
virtual StatusCode | sysInitialize ()=0 |
virtual StatusCode | sysStart ()=0 |
virtual StatusCode | sysStop ()=0 |
virtual StatusCode | sysFinalize ()=0 |
virtual StatusCode | sysReinitialize ()=0 |
virtual StatusCode | sysRestart ()=0 |
virtual StatusCode | configure ()=0 |
virtual StatusCode | start ()=0 |
virtual StatusCode | stop ()=0 |
virtual StatusCode | terminate ()=0 |
virtual StatusCode | reinitialize ()=0 |
virtual StatusCode | restart ()=0 |
virtual Gaudi::StateMachine::State | FSMState () const =0 |
virtual Gaudi::StateMachine::State | targetFSMState () const =0 |
virtual const std::string & | name () const =0 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
virtual unsigned long | addRef () |
virtual unsigned long | release () |
virtual const std::string & | name () const |
virtual const InterfaceID & | type () const |
virtual StatusCode | configure () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | terminate () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysStart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
ISvcLocator * | serviceLocator () const |
IMessageSvc * | msgSvc () |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () |
IMessageSvc * | messageService () const |
StatusCode | setProperties () |
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IAuditorSvc * | auditorSvc () const |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Member Functions | |
virtual void | setServiceManager (ISvcManager *)=0 |
virtual void | setServiceManager (ISvcManager *)=0 |
int | outputLevel () const |
Protected Attributes | |
IntegerProperty | m_outputLevel |
Gaudi::StateMachine::State | m_state |
Gaudi::StateMachine::State | m_targetState |
IMessageSvc * | m_messageSvc |
Private Types | |
typedef std::vector< IGeometryInfo * > | GeoContainer |
typedefs: (internal only!) | |
typedef GeoContainer::reverse_iterator | rGeoIt |
typedef std::map< std::string, std::pair< StatEntity, StatEntity > > | Map |
the actual type of the Map | |
typedef std::map< std::string, unsigned long > | Map1 |
Private Member Functions | |
IDataProviderSvc * | detSvc () const |
access to Detector Data Service | |
IGeometryInfo * | standardGeometry () const |
source of "standard" geometry information - "top of Detector Description tree" | |
IGeometryInfo * | previousGeometry () const |
previous geometry information | |
IGeometryInfo * | setPreviousGeometry (IGeometryInfo *previous) |
void | Assert (bool assertion, const std::string &message, const StatusCode &statusCode=StatusCode::FAILURE) const |
assertion! | |
void | Assert (bool assertion, const std::string &message, const GaudiException &Exception, const StatusCode &statusCode=StatusCode::FAILURE) const |
Assertion !!! | |
IGeometryInfo * | findGeometry (const std::string &address) const |
get the geometry info by name | |
bool | goodLocalGI (const Gaudi::XYZPoint &point1, const Gaudi::XYZPoint &point2, IGeometryInfo *gi) const |
check for "good" geometry info | |
IGeometryInfo * | findLocalGI (const Gaudi::XYZPoint &point1, const Gaudi::XYZPoint &point2, IGeometryInfo *gi, IGeometryInfo *topGi) const |
find good local geometry element | |
Private Attributes | |
std::string | m_detDataSvc_name |
Own private data members: names of used services:. | |
IDataProviderSvc * | m_detDataSvc |
Detector Data Service. | |
std::string | m_standardGeometry_address |
Name (address in Transient Store) for the top element of "standard" geometry source. | |
IGeometryInfo * | m_standardGeometry |
IGeometryInfo * | m_previousGeometry |
Gaudi::XYZPoint | m_prevPoint1 |
previous parameters | |
Gaudi::XYZPoint | m_prevPoint2 |
double | m_previousThreshold |
IGeometryInfo * | m_previousGuess |
IGeometryInfo * | m_previousTopGeometry |
ILVolume::Intersections | m_localIntersections |
ILVolume::Intersections | m_local_intersects |
some cache: | |
GeoContainer | m_vGi1 |
GeoContainer | m_vGi2 |
GeoContainer | m_vGi |
ISolid::Ticks | m_local_ticks |
Map | m_skip |
Map | m_recover |
the map of the skip-intervals | |
Map1 | m_codes |
the map of the recovered-intervals | |
bool | m_recovery |
property to allow the recovery | |
bool | m_protocol |
property to allow the protocol | |
Friends | |
friend class | ServiceManager |
Definition at line 42 of file TransportSvc.h.
typedef std::vector<IGeometryInfo*> TransportSvc::GeoContainer [private] |
typedef GeoContainer::reverse_iterator TransportSvc::rGeoIt [private] |
Definition at line 49 of file TransportSvc.h.
typedef std::map<std::string, std::pair<StatEntity,StatEntity> > TransportSvc::Map [private] |
typedef std::map<std::string,unsigned long> TransportSvc::Map1 [private] |
Definition at line 241 of file TransportSvc.h.
TransportSvc::TransportSvc | ( | const std::string & | name, | |
ISvcLocator * | ServiceLocator | |||
) |
constructor
properties
Definition at line 58 of file TransportSvc.cpp.
00060 : Service ( name , ServiceLocator ) 00061 00062 , m_detDataSvc_name ( "DetectorDataSvc" ) 00064 , m_detDataSvc ( 0 ) 00065 00066 , m_standardGeometry_address ( "/dd/Structure/LHCb" ) 00067 , m_standardGeometry ( 0 ) 00068 00069 , m_previousGeometry ( 0 ) 00071 , m_prevPoint1 ( ) 00072 , m_prevPoint2 ( ) 00073 , m_previousThreshold ( -10000 ) 00074 , m_previousGuess ( 0 ) 00075 , m_previousTopGeometry ( 0 ) 00076 , m_localIntersections ( ) 00078 , m_local_intersects ( ) 00080 , m_skip () 00081 , m_recover () 00082 , m_recovery ( true ) 00083 , m_protocol ( true ) 00085 { 00087 declareProperty ( "DetectorDataService" , m_detDataSvc_name ) ; 00088 declareProperty ( "StandardGeometryTop" , m_standardGeometry_address ) ; 00089 declareProperty 00090 ( "Recovery" , m_recovery , 00091 "The flag to allow the recovery of geometry errors" ) ; 00092 declareProperty 00093 ( "Protocol" , m_protocol , 00094 "The flag to allow protocol for the geometry problems" ) ; 00095 }
TransportSvc::~TransportSvc | ( | ) | [virtual] |
StatusCode TransportSvc::initialize | ( | ) | [virtual] |
Initialise the service.
initialise the base class
Locate Detector Data Service:
Reimplemented from Service.
Definition at line 122 of file TransportSvc.cpp.
00123 { 00125 StatusCode statusCode = Service::initialize(); 00126 if( statusCode.isFailure() ) return statusCode; // Propagate the error 00127 00128 MsgStream log( msgSvc() , name() ); 00129 00131 statusCode = serviceLocator()->service(m_detDataSvc_name, m_detDataSvc, true); 00132 if ( statusCode.isSuccess() && 0 != m_detDataSvc ) { 00133 detSvc() -> addRef(); 00134 } 00135 else { 00136 log << MSG::FATAL 00137 << " Unable to locate Detector Data Service=" 00138 << m_detDataSvc_name << endreq; 00139 m_detDataSvc = 0 ; 00140 return StatusCode::FAILURE ; 00141 } 00142 00143 if ( MSG::DEBUG >= outputLevel() && !m_protocol ) 00144 { 00145 log << MSG::WARNING 00146 << "Protocol property is always 'true' when in DEBUG" << endmsg ; 00147 m_protocol = true ; 00148 } 00149 00150 if ( 0 == DetDesc::IntersectionErrors::service() ) 00151 { 00152 log << MSG::INFO 00153 << "Initialize the static pointer to DetDesc::IGeometryErrorSvc" << endreq ; 00154 DetDesc::IntersectionErrors::setService ( this ) ; 00155 } 00156 00157 if ( !m_protocol ) 00158 { 00159 log << MSG::WARNING 00160 << "The protocol of geometry errors is DISABLED" << endmsg; 00161 DetDesc::IntersectionErrors::setService ( 0 ) ; 00162 } 00163 00164 // recover errors ? 00165 DetDesc::IntersectionErrors::setRecovery ( m_recovery ) ; 00166 if ( DetDesc::IntersectionErrors::recovery() ) { 00167 log << MSG::INFO << "Recovery of geometry errors is ENABLED" << endmsg; } 00168 else { 00169 log << MSG::INFO << "Recovery of geometry errors is DISABLED" << endmsg; } 00170 00171 return StatusCode::SUCCESS; 00172 }
StatusCode TransportSvc::finalize | ( | ) | [virtual] |
Finalise the service.
release all services
release Detector Data Service
Reimplemented from Service.
Definition at line 176 of file TransportSvc.cpp.
00177 { 00178 // 00179 MsgStream log ( msgSvc() , name() ); 00180 00181 { // skip map 00182 log << MSG::ALWAYS 00183 << " GEOMETRY ERRORS: 'Skip' map has the size " << m_skip.size() << std::endl ; 00184 if ( !m_skip.empty() ) 00185 { 00186 boost::format fmt1 ( " | %1$=55.55s | | %2$-65.65s |" ) ; 00187 fmt1 % " Logical Volume " ; 00188 fmt1 % " # mean RMS min max" ; 00189 log << fmt1.str() << std::endl ; 00190 for ( Map::const_iterator i = m_skip.begin() ; m_skip.end() != i ; ++i ) 00191 { 00192 { 00193 boost::format fmt2 ( " | %1$-55.55s | mm | %2$-65.65s |" ) ; 00194 fmt2 % logVol ( i->first , 55 ) ; 00195 fmt2 % Gaudi::Utils::formatAsTableRow 00196 ( i->second.first , false , 00197 "%1$-7d %3$-14.8g %4$14.8g %5$-14.8g %6$14.8g" ) ; 00198 log << fmt2.str() << std::endl ; 00199 } 00200 { 00201 boost::format fmt2 ( " | %1$-55.55s | X0 | %2$-65.65s |" ) ; 00202 fmt2 % logVol ( i->first , 55 ) ; 00203 fmt2 % Gaudi::Utils::formatAsTableRow 00204 ( i->second.second , false , 00205 "%1$-7d %3$-14.8g %4$14.8g %5$-14.8g %6$14.8g" ) ; 00206 log << fmt2.str() << std::endl ; 00207 } 00208 } 00209 } 00210 } 00211 log << endmsg; 00212 00213 // recovery map 00214 { 00215 log << MSG::ALWAYS 00216 << " GEOMETRY ERRORS: 'Recover' map has the size " << m_recover.size() << std::endl ; 00217 if ( !m_recover.empty() ) 00218 { 00219 boost::format fmt1 ( " | %1$=55.55s | | %2$-65.65s |" ) ; 00220 fmt1 % " Logical Volume " ; 00221 fmt1 % " # mean RMS min max" ; 00222 log << fmt1.str() << std::endl ; 00223 for ( Map::const_iterator i = m_recover.begin() ; m_recover.end() != i ; ++i ) 00224 { 00225 { 00226 boost::format fmt2 ( " | %1$-55.55s | mm | %2$-65.65s |" ) ; 00227 fmt2 % logVol ( i->first , 55 ) ; 00228 fmt2 % Gaudi::Utils::formatAsTableRow 00229 ( i->second.first , false , 00230 "%1$-7d %3$-14.8g %4$14.8g %5$-14.8g %6$14.8g" ) ; 00231 log << fmt2.str() << std::endl ; 00232 } 00233 { 00234 boost::format fmt2 ( " | %1$-55.55s | X0 | %2$-65.65s |" ) ; 00235 fmt2 % logVol ( i->first , 55 ) ; 00236 fmt2 % Gaudi::Utils::formatAsTableRow 00237 ( i->second.second , false , 00238 "%1$-7d %3$-14.8g %4$14.8g %5$-14.8g %6$14.8g" ) ; 00239 log << fmt2.str() << std::endl ; 00240 } 00241 } 00242 } 00243 } 00244 log << endmsg; 00245 00246 // codes: 00247 { 00248 log << MSG::ALWAYS 00249 << " GEOMETRY ERRORS: 'Codes' map has the size " << m_codes.size() << std::endl ; 00250 if ( !m_codes .empty() ) 00251 { 00252 boost::format fmt1 ( " | %1$=55.55s | %2$=10.10s |" ) ; 00253 fmt1 % " Logical Volume " ; 00254 fmt1 % "#errors" ; 00255 log << fmt1.str() << std::endl ; 00256 for ( Map1::const_iterator i = m_codes.begin() ; m_codes.end() != i ; ++i ) 00257 { 00258 { 00259 boost::format fmt2 ( " | %1$-55.55s | %2$=10d |" ) ; 00260 fmt2 % logVol ( i->first , 55 ) ; 00261 fmt2 % i->second ; 00262 log << fmt2.str() << std::endl ; 00263 } 00264 } 00265 } 00266 } 00267 log << endmsg; 00268 00269 if ( this == DetDesc::IntersectionErrors::service() ) 00270 { 00271 log << MSG::INFO 00272 << "Reset the static pointer to DetDesc::IGeometyrErrorSvc" << endreq ; 00273 DetDesc::IntersectionErrors::setService ( 0 ) ; 00274 } 00276 { // uncatched errors ? 00277 const unsigned long nErrors = DetDesc::IntersectionErrors::errors () ; 00278 if ( 0 != nErrors ) 00279 { 00280 log << MSG::ERROR 00281 << "DetDesc::IntersectionErrors has " 00282 << nErrors << " errors " << endreq ; 00283 log << MSG::ERROR 00284 << "Rerun the job with activated error handling!" << endreq ; 00285 } 00286 } 00288 { 00290 MsgStream log ( msgSvc() , name() ); 00292 if ( 0 != detSvc () ) 00293 { detSvc () -> release() ; m_detDataSvc = 0 ; } 00294 } 00296 log << MSG::DEBUG << "Service finalised successfully" << endreq; 00298 return Service::finalize(); 00300 }
StatusCode TransportSvc::queryInterface | ( | const InterfaceID & | iid, | |
void ** | ppi | |||
) | [virtual] |
Query the interfaces.
Reimplemented from Service.
Definition at line 104 of file TransportSvc.cpp.
00105 { 00107 if ( ITransportSvc ::interfaceID () == iid ) 00108 { *ppi = static_cast<ITransportSvc*> ( this ) ; } 00109 else if ( DetDesc::IGeometryErrorSvc::interfaceID () == iid ) 00110 { *ppi = static_cast<DetDesc::IGeometryErrorSvc*> ( this ) ; } 00111 else 00112 { return Service::queryInterface ( iid , ppi ) ; } 00114 addRef(); 00116 return StatusCode::SUCCESS; 00118 }
double TransportSvc::distanceInRadUnits | ( | const Gaudi::XYZPoint & | Point1, | |
const Gaudi::XYZPoint & | Point2, | |||
double | Threshold, | |||
IGeometryInfo * | AlternativeGeometry, | |||
IGeometryInfo * | GeometryGuess | |||
) | [inline, virtual] |
Estimate the distance between 2 points in units of radiation length units.
Point1 | first point | |
Point2 | second point | |
Threshold | threshold value | |
AlternativeGeometry | source ot alternative geomtry | |
GeometryGuess | guess foe geometry |
Implements ITransportSvc.
Definition at line 36 of file TransportSvcDistanceInRadUnits.h.
00041 { 00042 // check for the distance 00043 if( point1 == point2 ) { return 0 ;} 00044 00045 // retrieve the history 00046 Gaudi::XYZVector Vector( point2 - point1 ) ; 00047 // initial point on the line 00048 // direction vector of the line 00049 // minimal value of the parameter of the line 00050 // maximal value of the parameter of the line 00051 // (output) container of intersections 00052 // threshold value 00053 // source of the alternative geometry information 00054 // a guess for navigation 00055 intersections( point1 , 00056 Vector , 00057 0.0 , 00058 1.0 , 00059 m_local_intersects , 00060 threshold , 00061 alternativeGeometry , 00062 geometryGuess ); 00063 00064 // radiation length in tick units 00065 double RadLength = 00066 std::accumulate 00067 ( m_local_intersects.begin() , 00068 m_local_intersects.end () , 00069 0.0 , 00070 VolumeIntersectionIntervals::AccumulateIntersections() ); 00071 00072 // scale 00073 const ISolid::Tick TickLength = std::sqrt( Vector.mag2() ); 00074 00075 return RadLength * TickLength ; 00077 };
unsigned long TransportSvc::intersections | ( | const Gaudi::XYZPoint & | Point, | |
const Gaudi::XYZVector & | Vector, | |||
const ISolid::Tick & | TickMin, | |||
const ISolid::Tick & | TickMax, | |||
ILVolume::Intersections & | Intersept, | |||
double | Threshold, | |||
IGeometryInfo * | AlternativeGeometry, | |||
IGeometryInfo * | GeometryGuess | |||
) | [virtual] |
general method ( returns the "full history" of the volume boundary intersections with different material properties between 2 points )
Point | initial point on the line | |
Vector | direction vector of the line | |
TickMin | minimal value of line paramater | |
TickMax | maximal value of line parameter | |
Intersept | (output) container of intersections | |
Threshold | threshold value | |
AlternativeGeometry | source of alternative geometry information | |
GeometryGuess | a guess for navigation |
check the input parameters of the line
check - if the previous paramaters are the same
use cached container!!!
locate the both points inside one "good" DetectorElement/GeometryInfo objects
"Good" in this context means that
redefine previous geometry
delegate the calculation to the logical volume
make local copy of all parameters:
intersections
1) reset cache:
2) throw new exception:
1) reset cache:
2) throw new exception:
Implements ITransportSvc.
Definition at line 42 of file TransportSvcIntersections.h.
00050 { 00051 00052 try { 00053 00054 intersept.clear(); 00055 00057 if( tickMin >= tickMax && vect.mag2() <= 0 ) { return 0;} 00058 00059 // Set the top level geometry, because this is what is in the cache 00060 IGeometryInfo* topGeometry = alternativeGeometry ? alternativeGeometry : standardGeometry() ; 00061 00063 Gaudi::XYZPoint point1( point + vect * tickMin ) ; 00064 Gaudi::XYZPoint point2( point + vect * tickMax ) ; 00066 if( point1 == m_prevPoint1 && 00067 point2 == m_prevPoint2 && 00068 threshold == m_previousThreshold && 00069 topGeometry == m_previousTopGeometry && 00070 guessGeometry == m_previousGuess ) 00071 { 00073 intersept.reserve( m_localIntersections.size() ); 00074 intersept.insert(intersept.begin(), 00075 m_localIntersections.begin() , 00076 m_localIntersections.end()); 00078 return intersept.size(); 00079 } 00080 00093 IGeometryInfo* giLocal = 0 ; 00094 IGeometryInfo* gi = 00095 // try the guess geometry 00096 ( 0 != guessGeometry && 00097 0 != ( giLocal = findLocalGI( point1 , 00098 point2 , 00099 guessGeometry , 00100 alternativeGeometry ) ) ) ? 00101 guessGeometry : 00102 // try the previous geometry (only if top-geometry matches) 00103 ( previousGeometry() && topGeometry == m_previousTopGeometry && 00104 0 != ( giLocal = findLocalGI( point1 , 00105 point2 , 00106 previousGeometry() , 00107 topGeometry ) ) ) ? 00108 // just take the top geometry 00109 previousGeometry() : 00110 ( 0 != ( giLocal = findLocalGI( point1 , 00111 point2 , 00112 topGeometry, 00113 topGeometry ) ) ) ? 00114 00115 topGeometry : 0 ; 00116 00118 if( 0 == giLocal ) 00119 throw TransportSvcException( "TransportSvc::(1) unable to locate points", 00120 StatusCode::FAILURE ); 00121 if( 0 == gi ) 00122 throw TransportSvcException( "TransportSvc::(2) unable to locate points", 00123 StatusCode::FAILURE ); 00124 00126 setPreviousGeometry( giLocal ); 00127 00129 const ILVolume* lv = giLocal->lvolume(); 00130 lv->intersectLine 00131 ( giLocal->toLocalMatrix() * point , 00132 giLocal->toLocalMatrix() * vect , 00133 intersept , 00134 tickMin , 00135 tickMax , 00136 threshold ); 00137 00139 m_prevPoint1 = point1 ; 00140 m_prevPoint2 = point2 ; 00141 m_previousThreshold = threshold ; 00142 m_previousGuess = guessGeometry ; 00143 m_previousTopGeometry = topGeometry ; 00144 00146 m_localIntersections.clear(); 00147 m_localIntersections.reserve( intersept.size()); 00148 m_localIntersections.insert(m_localIntersections.begin(), 00149 intersept.begin() , 00150 intersept.end()); 00151 } 00152 catch ( const GaudiException& Exception ) 00153 { 00155 m_prevPoint1 = Gaudi::XYZPoint() ; 00156 m_prevPoint2 = Gaudi::XYZPoint() ; 00157 m_previousThreshold = -1000.0 ; 00158 m_previousGuess = 0 ; 00159 m_previousTopGeometry = 0 ; 00160 m_localIntersections.clear() ; 00161 00163 std::string message 00164 ("TransportSvc::intersection(...), exception caught; Params: "); 00165 { 00166 std::ostringstream ost; 00167 ost << "Point=" << point 00168 << ",Vect=" << vect 00169 << ",Tick=" << tickMin << "/" << tickMax 00170 << "Thrsh=" << threshold; 00171 if( 0 != alternativeGeometry ) { ost << "A.Geo!=NULL" ; } 00172 if( 0 != guessGeometry ) { ost << "G.Geo!=NULL" ; } 00173 message += ost.str(); 00174 Assert( false , message , Exception ); 00175 } 00176 } 00177 catch( ... ) 00178 { 00180 m_prevPoint1 = Gaudi::XYZPoint() ; 00181 m_prevPoint2 = Gaudi::XYZPoint() ; 00182 m_previousThreshold = -1000.0 ; 00183 m_previousGuess = 0 ; 00184 m_previousTopGeometry = 0 ; 00185 m_localIntersections.clear() ; 00186 00188 std::string message 00189 ("TransportSvc::intersection(...), unknown exception caught; Params: "); 00190 { 00191 std::ostringstream ost; 00192 ost << "Point=" << point 00193 << ",Vect=" << vect 00194 << ",Tick=" << tickMin << "/" << tickMax 00195 << "Thrsh=" << threshold; 00196 if( 0 != alternativeGeometry ) { ost << "A.Geo!=NULL" ; } 00197 if( 0 != guessGeometry ) { ost << "G.Geo!=NULL" ; } 00198 message += ost.str(); 00199 Assert( false , message ); 00200 } 00201 } 00202 00203 return intersept.size() ; 00205 };
void TransportSvc::setCode | ( | const StatusCode & | sc, | |
const ILVolume * | volume | |||
) | [virtual] |
set/reset the current "status" of geometry erorrs
sc | the status code | |
volume | the volume |
Implements DetDesc::IGeometryErrorSvc.
Definition at line 343 of file TransportSvc.cpp.
00345 { 00346 if ( sc.isSuccess() ) { return ; } // nothing to do 00347 if ( !m_protocol && MSG::DEBUG > outputLevel() ) { return ; } // 00348 00349 if ( 0 != volume ) { ++m_codes [ volume->name() ] ; } 00350 else { ++m_codes [ "" ] ; } 00351 }
void TransportSvc::inspect | ( | const ILVolume * | volume, | |
const Gaudi::XYZPoint & | pnt, | |||
const Gaudi::XYZVector & | vect, | |||
const ILVolume::Intersections & | cnt | |||
) | [virtual] |
inspect the potential error in intersections
volume | the problematic volume | |
pnt | 3D point | |
vect | 3D direction vector | |
cnt | the problematic container of intersections |
Implements DetDesc::IGeometryErrorSvc.
Definition at line 363 of file TransportSvc.cpp.
00367 { 00368 00369 MsgStream log ( msgSvc () , name () ); 00370 00371 log << MSG::ERROR 00372 << " DetDesc::IntersectionError for LV='" << volume->name() <<"'" << endreq ; 00373 log << MSG::ERROR 00374 << " Local Frame: " 00375 << " point=" << pnt 00376 << "/vector=" << vect 00377 << " Tick Length=" << vect.R() << endreq ; 00378 00379 boost::format fmt1 00380 ( "| %1$1.1s |%2$=15.15s %3$=15.15s|%4$=27.27s %5$=27.27s|%6$=3s %7$=16.16s | %8$=16.16s |" ) ; 00381 fmt1 % "?" ; // problems ? 00382 fmt1 % "tickMin" ; 00383 fmt1 % "tickMax" ; 00384 fmt1 % "point1" ; 00385 fmt1 % "point2" ; 00386 fmt1 % "#" ; 00387 fmt1 % "phys.volume" ; 00388 fmt1 % "material" ; 00389 log << MSG::ERROR << fmt1.str() << endreq ; 00390 00391 for ( ILVolume::Intersections::const_iterator i = 00392 cnt.begin() ; cnt.end() != i ; ++i ) 00393 { 00394 // check the intersections: 00395 bool ok = true ; 00396 for ( ILVolume::Intersections::const_iterator i2 = cnt.begin() ; 00397 ok && cnt.end() != i2 ; ++i2 ) 00398 { 00399 if ( i2 == i ) { continue ; } 00400 ok = ( 0 != VolumeIntersectionIntervals::intersect ( *i , *i2 ) ) ; 00401 } 00402 boost::format fmt 00403 ( "| %1$1.1s |%2$15.9g %3$-15.9g|%4$27.27s %5$-27.27s|%6$=3d %7$16.16s | %8$16.16s |" ) ; 00404 fmt % ( ok ? " " : "*" ) ; // (1) problems? 00405 fmt % i -> first.first ; // (2) tick min 00406 fmt % i -> first.second ; // (3) tick max 00407 fmt % ( pnt + i -> first.first * vect ) ; // (4) the first point 00408 fmt % ( pnt + i -> first.second * vect ) ; // (5) the second point 00409 00410 // get the central point: 00411 Gaudi::XYZPoint c = pnt + 0.5 * ( i -> first.first + i -> first.second ) * vect ; 00412 ILVolume::PVolumePath pvs ; 00413 volume -> belongsTo ( c , 1 , pvs ) ; 00414 if ( pvs.empty() || 0 == pvs.front() ) 00415 { 00416 fmt % -1 ; 00417 fmt % "<mother>" ; 00418 } 00419 else 00420 { 00421 const ILVolume::PVolumes& volumes = volume->pvolumes() ; 00422 ILVolume::PVolumes::const_iterator ipv = 00423 std::find ( volumes.begin() , volumes.end() , pvs.front() ) ; 00424 if ( volumes.end() == ipv ) { fmt % -1 ; } 00425 else { fmt % ( ipv - volumes.begin() ) ; } 00426 fmt % pvs.front()->name() ; 00427 } 00428 const std::string& n = i->second->name() ; 00429 if ( 16 >= n.size() ) { fmt % n ; } // (6) the material name 00430 else { fmt % std::string ( n , n.size() - 16 ) ; } // (6) the material name 00431 00432 // 00433 log << MSG::ERROR << fmt.str() << endreq ; 00434 } 00435 }
void TransportSvc::recovered | ( | const ILVolume * | volume, | |
const Material * | material1, | |||
const Material * | material2, | |||
const double | delta | |||
) | [virtual] |
report the recovered action in intersections
volume | the problematic volume | |
material1 | the affected material | |
material2 | the affected material | |
delta | the problematic delta (non-negative!) |
Implements DetDesc::IGeometryErrorSvc.
Definition at line 447 of file TransportSvc.cpp.
00451 { 00452 if ( !m_protocol && MSG::DEBUG > outputLevel() ) { return ; } // RETURN 00453 00454 Map::mapped_type& p = m_recover [ volume->name() ] ; 00455 00456 p.first += delta ; 00457 p.second += 00458 std::fabs 00459 ( delta / material1 -> radiationLength () - 00460 delta / material2 -> radiationLength () ) ; 00461 00462 return ; 00463 }
void TransportSvc::skip | ( | const ILVolume * | volume, | |
const Material * | material, | |||
const double | delta | |||
) | [virtual] |
report the skipped intersection
volume | the problematic volume | |
material | the affected material | |
delta | the problematic delta (non-negative!) |
Implements DetDesc::IGeometryErrorSvc.
Definition at line 474 of file TransportSvc.cpp.
00477 { 00478 if ( !m_protocol && MSG::DEBUG > outputLevel() ) { return ; } // RETURN 00479 00480 Map::mapped_type& p = m_skip [ volume->name() ] ; 00481 00482 p.first += delta ; 00483 p.second += delta / material->radiationLength() ; 00484 00485 return ; 00486 }
IDataProviderSvc * TransportSvc::detSvc | ( | ) | const [inline, private] |
access to Detector Data Service
Definition at line 253 of file TransportSvc.h.
00254 { return m_detDataSvc ; }
IGeometryInfo * TransportSvc::standardGeometry | ( | ) | const [inline, private] |
source of "standard" geometry information - "top of Detector Description tree"
Definition at line 257 of file TransportSvc.h.
00258 { 00259 return ( 0 != m_standardGeometry ) ? 00260 m_standardGeometry : m_standardGeometry = 00261 findGeometry( m_standardGeometry_address ) ; 00262 }
IGeometryInfo * TransportSvc::previousGeometry | ( | ) | const [inline, private] |
previous geometry information
Definition at line 265 of file TransportSvc.h.
00266 { return m_previousGeometry ; }
IGeometryInfo * TransportSvc::setPreviousGeometry | ( | IGeometryInfo * | previous | ) | [inline, private] |
Definition at line 270 of file TransportSvc.h.
00271 { m_previousGeometry = previous ; return previousGeometry() ; }
void TransportSvc::Assert | ( | bool | assertion, | |
const std::string & | message, | |||
const StatusCode & | statusCode = StatusCode::FAILURE | |||
) | const [inline, private] |
assertion!
Definition at line 275 of file TransportSvc.h.
00278 { if( !assertion ) { throw TransportSvcException( Message , statusCode ); } }
void TransportSvc::Assert | ( | bool | assertion, | |
const std::string & | message, | |||
const GaudiException & | Exception, | |||
const StatusCode & | statusCode = StatusCode::FAILURE | |||
) | const [inline, private] |
Assertion !!!
Definition at line 282 of file TransportSvc.h.
00286 { if( !assertion ) 00287 { throw TransportSvcException( Message , Exception , statusCode ); } }
IGeometryInfo * TransportSvc::findGeometry | ( | const std::string & | address | ) | const [private] |
get the geometry info by name
Definition at line 303 of file TransportSvc.cpp.
00304 { 00306 IGeometryInfo* gi = 0 ; 00308 try 00309 { 00310 SmartDataPtr<IDetectorElement> detelem( detSvc() , address ); 00311 if( 0 != detelem ) { gi = detelem->geometry() ; } 00312 } 00313 catch(...) 00314 { Assert( false , 00315 "TransportSvc::findGeometry(), unknown exception caught!" ); } 00317 if( 0 == gi ) 00318 throw TransportSvcException( 00319 "TransportSvc::unable to locate geometry address="+address, 00320 StatusCode::FAILURE ); 00322 return gi; 00323 }
bool TransportSvc::goodLocalGI | ( | const Gaudi::XYZPoint & | point1, | |
const Gaudi::XYZPoint & | point2, | |||
IGeometryInfo * | gi | |||
) | const [inline, private] |
check for "good" geometry info
Definition at line 17 of file TransportSvcGoodLocalGI.h.
00020 { 00021 bool debug = false; 00022 00024 if( 0 == gi ) { 00025 if ( debug ) std::cout << " goodLocalGI : no gi" << std::endl; 00026 return false ; } 00028 const ILVolume* lv = gi->lvolume(); 00030 if( 0 == lv ) { 00031 if ( debug ) std::cout << " goodLocalGI : gi has no lv" << std::endl; 00032 return false ; } 00034 if( lv->isAssembly() ) { 00035 if ( debug ) std::cout << " goodLocalGI : lv " << lv->name() 00036 << " is Assembly " << std::endl; 00037 return false ; 00038 } 00039 00041 ISolid::Tick tickMin = 0; 00042 ISolid::Tick tickMax = 1; 00044 unsigned int nInt = 00045 lv->solid()->intersectionTicks 00046 ( gi->toLocalMatrix() * point1 , 00047 gi->toLocalMatrix() * Gaudi::XYZVector( point2 - point1 ) , 00048 tickMin , tickMax , m_local_ticks ) ; 00050 if ( debug ) std::cout << " goodLocalGI : nInt " << nInt << std::endl; 00051 return ( 2 == nInt && tickMin == *(m_local_ticks.begin() ) 00052 && tickMax == *(m_local_ticks.rbegin()) ) ? true : false ; 00054 };
IGeometryInfo * TransportSvc::findLocalGI | ( | const Gaudi::XYZPoint & | point1, | |
const Gaudi::XYZPoint & | point2, | |||
IGeometryInfo * | gi, | |||
IGeometryInfo * | topGi | |||
) | const [private] |
find good local geometry element
output :-))
find the nearest "upper" volume, which contains the first point
find the nearest "upper" volume, which contains the second point
we have failed to find "good" element
RETURN !!!
throw new exception:
throw new exception:
Definition at line 22 of file TransportSvcFindLocalGI.h.
00025 { 00026 if( 0 == gi ) { return 0 ; } 00027 00028 00030 IGeometryInfo* goodGI = 0 ; 00031 00032 try { 00034 if ( !gi->isInside( point1 ) ) { 00035 return 0; 00036 } 00037 IGeometryInfo* gi1 = gi->belongsTo( point1, -1 ) ; 00038 00040 IGeometryInfo* gi2 = gi1 ; 00041 { 00042 bool loc = false ; 00043 for( loc = gi2->isInside( point2 ) ; !loc && 0 != gi2 ; 00044 gi2 = gi2->parentIGeometryInfo() ) { 00045 loc = gi2->isInside( point2 ); 00046 if ( loc ) break; 00047 } 00048 if( 0 == gi2 ) { 00049 return 0; 00050 } 00051 } 00052 00053 // Here both points are located, gi2 is a parent of gi1. Get the first 00054 // parent of gi2 which is a good GI. 00055 00056 for( IGeometryInfo* gl = gi2 ; 0 != gl ; 00057 gl = gl->parentIGeometryInfo() ) { 00058 if ( 0 == gl ) return 0; 00059 if( goodLocalGI( point1 , point2 , gl ) ) { 00060 return gl; 00061 } 00062 if ( topGi == gl ) return 0; 00063 } 00065 return 0; 00066 00067 } 00068 catch( const GaudiException& Exception ) 00069 { 00071 std::string message 00072 ("TransportSvc::findLocalGI(...), exception caught; Params: "); 00073 { 00074 std::ostringstream ost; 00075 ost << "Point1=" << point1 00076 << "Point2=" << point2 ; 00077 message += ost.str(); 00078 Assert( false , message , Exception ); 00079 } 00080 } 00081 catch( ... ) 00082 { 00084 std::string message 00085 ("TransportSvc::findLocalGI(...), unknown exception caught; Params: "); 00086 { 00087 std::ostringstream ost; 00088 ost << "Point1=" << point1 00089 << "Point2=" << point2 ; 00090 message += ost.str(); 00091 Assert( false , message ); 00092 } 00093 } 00094 00096 return goodGI; 00097 00098 };
std::string TransportSvc::m_detDataSvc_name [private] |
IDataProviderSvc* TransportSvc::m_detDataSvc [mutable, private] |
std::string TransportSvc::m_standardGeometry_address [private] |
Name (address in Transient Store) for the top element of "standard" geometry source.
Definition at line 220 of file TransportSvc.h.
IGeometryInfo* TransportSvc::m_standardGeometry [mutable, private] |
Definition at line 221 of file TransportSvc.h.
IGeometryInfo* TransportSvc::m_previousGeometry [mutable, private] |
Definition at line 223 of file TransportSvc.h.
Gaudi::XYZPoint TransportSvc::m_prevPoint1 [mutable, private] |
Gaudi::XYZPoint TransportSvc::m_prevPoint2 [mutable, private] |
Definition at line 226 of file TransportSvc.h.
double TransportSvc::m_previousThreshold [mutable, private] |
Definition at line 227 of file TransportSvc.h.
IGeometryInfo* TransportSvc::m_previousGuess [mutable, private] |
Definition at line 228 of file TransportSvc.h.
IGeometryInfo* TransportSvc::m_previousTopGeometry [mutable, private] |
Definition at line 229 of file TransportSvc.h.
ILVolume::Intersections TransportSvc::m_localIntersections [mutable, private] |
Definition at line 230 of file TransportSvc.h.
ILVolume::Intersections TransportSvc::m_local_intersects [mutable, private] |
GeoContainer TransportSvc::m_vGi1 [mutable, private] |
Definition at line 233 of file TransportSvc.h.
GeoContainer TransportSvc::m_vGi2 [mutable, private] |
Definition at line 234 of file TransportSvc.h.
GeoContainer TransportSvc::m_vGi [mutable, private] |
Definition at line 235 of file TransportSvc.h.
ISolid::Ticks TransportSvc::m_local_ticks [mutable, private] |
Definition at line 236 of file TransportSvc.h.
Map TransportSvc::m_skip [private] |
Definition at line 242 of file TransportSvc.h.
Map TransportSvc::m_recover [private] |
Map1 TransportSvc::m_codes [private] |
bool TransportSvc::m_recovery [private] |
bool TransportSvc::m_protocol [private] |