#include <PositionerTool.h>
Inheritance diagram for PositionerTool:
Public Types | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
enum | Status |
Public Member Functions | |
PositionerTool (const std::string &type, const std::string &name, const IInterface *parent) | |
~PositionerTool () | |
virtual StatusCode | initialize () |
virtual StatusCode | reinitialize () |
virtual StatusCode | finalize () |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
StatusCode | placeVolume () |
Place a volume in the geometry. | |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | evtColSvc () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | evtSvc () const |
IIncidentSvc * | incSvc () const |
IChronoStatSvc * | chronoSvc () const |
IHistogramSvc * | histoSvc () const |
IAlgContextSvc * | contextSvc () const |
DataObject * | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
DataObject * | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
virtual unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual unsigned long | addRef () |
virtual const std::string & | name () const |
virtual const std::string & | type () const |
virtual const IInterface * | parent () const |
virtual StatusCode | configure () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | terminate () |
virtual StatusCode | restart () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
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 |
PropertyMgr * | getPropertyMgr () |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
IMessageSvc * | msgSvc () const |
IToolSvc * | toolSvc () const |
StatusCode | setProperties () |
StatusCode | service (const std::string &name, T *&svc, bool createIf=true) const |
StatusCode | service (const std::string &type, const std::string &name, T *&svc) const |
void | declInterface (const InterfaceID &, void *) |
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 |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
virtual const std::string & | type () const =0 |
virtual const IInterface * | parent () const =0 |
virtual StatusCode | configure ()=0 |
virtual StatusCode | start ()=0 |
virtual StatusCode | stop ()=0 |
virtual StatusCode | terminate ()=0 |
virtual StatusCode | restart ()=0 |
virtual Gaudi::StateMachine::State | FSMState () 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 unsigned long | refCount () const =0 |
virtual const std::string & | name () const =0 |
virtual unsigned long | addRef ()=0 |
virtual unsigned long | release ()=0 |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
int | outputLevel () const |
virtual unsigned long | refCount () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Attributes | |
IDataProviderSvc * | m_detSvc |
std::string | m_physVolName |
std::string | m_logVolName |
std::string | m_motherLVolName |
std::vector< double > | m_position |
std::vector< double > | m_rotation |
std::string | m_detElemPath |
std::string | m_support |
Example Use:
DiffBallPositioner.PhysicalVolume = "pvDiffuserBall" DiffBallPositioner.LogicalVolume = "/dd/Geometry/CalibrationSources/lvDiffuserBall" DiffBallPositioner.MotherVolume = "/dd/Geometry/AD/lvOIL" DiffBallPositioner.Position = [0., 0., 0.] DiffBallPositioner.Rotation = [0., 0., 0., 0., 0., 0., 0., 0., 0.] DiffBallPositioner.Element = "db-diffuserBallCenter1" DiffBallPositioner.Support = "/dd/Structure/DayaBay/db-rock/db-ows/db-curtain/db-iws/db-ade1/db-sst1/db-oil1"
dandwyer@caltech.edu 21/10/2008
Definition at line 28 of file PositionerTool.h.
PositionerTool::PositionerTool | ( | const std::string & | type, | |
const std::string & | name, | |||
const IInterface * | parent | |||
) |
Definition at line 14 of file PositionerTool.cc.
00017 : GaudiTool(type, name, parent) 00018 , m_detSvc(0) 00019 { 00020 declareProperty("PhysicalVolume",m_physVolName="", 00021 "Name of the physical volume to add to geometry"); 00022 declareProperty("LogicalVolume",m_logVolName="", 00023 "Name of the logical volume to associate with the physical"); 00024 declareProperty("MotherVolume",m_motherLVolName="", 00025 "Name of the mother logical volume where the physical volume is placed"); 00026 declareProperty("Position",m_position=std::vector<double>(3,0.), 00027 "Position of the new volume in the parent coordinates"); 00028 double identity[] = {1., 0., 0., 00029 0., 1., 0., 00030 0., 0., 1.}; 00031 declareProperty("Rotation",m_rotation=std::vector<double>(identity, 00032 identity+9), 00033 "Rotation of the new volume in the parent coordinates"); 00034 declareProperty("Element",m_detElemPath="", 00035 "Name of the detector element to place in the TDS"); 00036 declareProperty("Support",m_support="", 00037 "Path+Name of the supporting detector element in the TDS"); 00038 }
PositionerTool::~PositionerTool | ( | ) |
StatusCode PositionerTool::initialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 46 of file PositionerTool.cc.
00047 { 00048 this->GaudiTool::initialize(); 00049 00050 debug() << "PositionerTool::initialize()" << endreq; 00051 StatusCode sc = service("DetectorDataSvc",m_detSvc,true); 00052 if (sc.isFailure()) return sc; 00053 00054 return sc; 00055 }
StatusCode PositionerTool::reinitialize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 57 of file PositionerTool.cc.
00058 { 00059 return StatusCode::SUCCESS; 00060 }
StatusCode PositionerTool::finalize | ( | ) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 62 of file PositionerTool.cc.
00063 { 00064 m_detSvc->release(); 00065 return this->GaudiTool::finalize(); 00066 }
StatusCode PositionerTool::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvInterface | |||
) | [virtual] |
Reimplemented from GaudiTool.
Definition at line 68 of file PositionerTool.cc.
00070 { 00071 StatusCode sc = StatusCode::FAILURE; 00072 if (ppvInterface) { 00073 *ppvInterface = 0; 00074 00075 if (IPositionerTool::interfaceID().versionMatch(riid)) { 00076 *ppvInterface = static_cast<IPositionerTool*>(this); 00077 sc = StatusCode::SUCCESS; 00078 addRef(); 00079 } 00080 else sc = GaudiTool::queryInterface( riid, ppvInterface ); 00081 } 00082 return sc; 00083 }
StatusCode PositionerTool::placeVolume | ( | ) | [virtual] |
Place a volume in the geometry.
Implements IPositionerTool.
Definition at line 89 of file PositionerTool.cc.
00090 { 00091 00092 // Find parent logical volume for physical volume 00093 SmartDataPtr<LVolume> parentLogVol(m_detSvc, m_motherLVolName); 00094 if(!parentLogVol){ 00095 error() << "PositionerTool::placeVolume(): " 00096 << "could not find parent volume of name: " << m_motherLVolName 00097 << endreq; 00098 return StatusCode::FAILURE; 00099 } 00100 00101 // Check if physical volume already exists in parent logical volume 00102 ILVolume::PVolumes::const_iterator pvIter = parentLogVol->pvBegin(); 00103 for(;pvIter != parentLogVol->pvEnd(); pvIter++){ 00104 if((*pvIter)->name() == m_physVolName){ 00105 warning() << "PositionerTool::placeVolume(): " 00106 << "physical volume " << m_physVolName 00107 << " already exists in mother volume " << m_motherLVolName 00108 << endreq; 00109 return StatusCode::SUCCESS; 00110 } 00111 } 00112 00113 // Create the physical volume 00114 Gaudi::Rotation3D rotation(m_rotation.begin(), m_rotation.end()); 00115 Gaudi::XYZVector position(m_position[0],m_position[1],m_position[2]); 00116 IPVolume* pv = 00117 parentLogVol->createPVolume(m_physVolName, m_logVolName, 00118 Gaudi::Transform3D(rotation, 00119 Gaudi::XYZVector(position))); 00120 00121 if( 0 == pv ) { 00122 error() << "PositionerTool::placeVolume(): " 00123 << "could not create volume: " << m_physVolName 00124 << endreq; 00125 return StatusCode::FAILURE; 00126 } 00127 00128 StatusCode sc; 00129 00130 if(m_detElemPath != ""){ 00131 // Add the corresponding detector element 00132 DetectorElement* detElem = new DetectorElement; 00133 sc = m_detSvc->registerObject( m_support, m_detElemPath, detElem); 00134 if( sc.isFailure() ){ 00135 error() << "Failed to register object with support / path: " 00136 << m_support << " / " << m_detElemPath << endreq; 00137 } 00138 detElem->createGeometryInfo( m_logVolName, m_support, m_physVolName); 00139 } 00140 00141 return sc; 00142 }
const InterfaceID & IPositionerTool::interfaceID | ( | ) | [static, inherited] |
Reimplemented from IAlgTool.
Definition at line 7 of file IPositionerTool.cc.
00007 { 00008 return IID_IPositionerTool; 00009 }
IDataProviderSvc* PositionerTool::m_detSvc [private] |
std::string PositionerTool::m_physVolName [private] |
Definition at line 50 of file PositionerTool.h.
std::string PositionerTool::m_logVolName [private] |
Definition at line 51 of file PositionerTool.h.
std::string PositionerTool::m_motherLVolName [private] |
Definition at line 52 of file PositionerTool.h.
std::vector<double> PositionerTool::m_position [private] |
Definition at line 53 of file PositionerTool.h.
std::vector<double> PositionerTool::m_rotation [private] |
Definition at line 54 of file PositionerTool.h.
std::string PositionerTool::m_detElemPath [private] |
Definition at line 55 of file PositionerTool.h.
std::string PositionerTool::m_support [private] |
Definition at line 56 of file PositionerTool.h.