/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Private Attributes
PositionerTool Class Reference

Implementation of a IPositionerTool. More...

#include <PositionerTool.h>

Inheritance diagram for PositionerTool:
Inheritance graph
[legend]
Collaboration diagram for PositionerTool:
Collaboration graph
[legend]

List of all members.

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 ()
 IPositionerTool interface.

Static Public Member Functions

static const InterfaceID & interfaceID ()

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

Detailed Description

Implementation of a IPositionerTool.

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.


Constructor & Destructor Documentation

PositionerTool::PositionerTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 14 of file PositionerTool.cc.

  : GaudiTool(type, name, parent)
  , m_detSvc(0)
{
  declareProperty("PhysicalVolume",m_physVolName="",
                  "Name of the physical volume to add to geometry");
  declareProperty("LogicalVolume",m_logVolName="",
                  "Name of the logical volume to associate with the physical");
  declareProperty("MotherVolume",m_motherLVolName="",
                  "Name of the mother logical volume where the physical volume is placed");
  declareProperty("Position",m_position=std::vector<double>(3,0.),
                  "Position of the new volume in the parent coordinates");
  double identity[] = {1., 0., 0., 
                       0., 1., 0.,
                       0., 0., 1.};
  declareProperty("Rotation",m_rotation=std::vector<double>(identity,
                                                            identity+9),
                  "Rotation of the new volume in the parent coordinates");
  declareProperty("Element",m_detElemPath="",
                  "Name of the detector element to place in the TDS");
  declareProperty("Support",m_support="",
                  "Path+Name of the supporting detector element in the TDS");
}
PositionerTool::~PositionerTool ( )

Definition at line 40 of file PositionerTool.cc.

{
}

Member Function Documentation

StatusCode PositionerTool::initialize ( ) [virtual]

Definition at line 46 of file PositionerTool.cc.

{
    this->GaudiTool::initialize();

    debug() << "PositionerTool::initialize()" << endreq;
    StatusCode sc = service("DetectorDataSvc",m_detSvc,true);
    if (sc.isFailure()) return sc;

    return sc;
}
StatusCode PositionerTool::reinitialize ( ) [virtual]

Definition at line 57 of file PositionerTool.cc.

{
    return StatusCode::SUCCESS;
}
StatusCode PositionerTool::finalize ( ) [virtual]

Definition at line 62 of file PositionerTool.cc.

{
    m_detSvc->release();
    return this->GaudiTool::finalize();
}
StatusCode PositionerTool::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
) [virtual]

Definition at line 68 of file PositionerTool.cc.

{
  StatusCode sc = StatusCode::FAILURE;
  if (ppvInterface) {
    *ppvInterface = 0;
    
    if (IPositionerTool::interfaceID().versionMatch(riid)) {
      *ppvInterface = static_cast<IPositionerTool*>(this);
      sc = StatusCode::SUCCESS;
      addRef();
    }
    else sc = GaudiTool::queryInterface( riid, ppvInterface );    
  }
  return sc;
}
StatusCode PositionerTool::placeVolume ( ) [virtual]

IPositionerTool interface.

Place volume in the geometry.

Place a volume in the geometry

Implements IPositionerTool.

Definition at line 89 of file PositionerTool.cc.

{

  // Find parent logical volume for physical volume
  SmartDataPtr<LVolume> parentLogVol(m_detSvc, m_motherLVolName);
  if(!parentLogVol){
    error() << "PositionerTool::placeVolume(): "
            << "could not find parent volume of name: " << m_motherLVolName
            << endreq;
    return StatusCode::FAILURE;
  }

  // Check if physical volume already exists in parent logical volume
  ILVolume::PVolumes::const_iterator pvIter = parentLogVol->pvBegin();
  for(;pvIter != parentLogVol->pvEnd(); pvIter++){
    if((*pvIter)->name() == m_physVolName){
      warning() << "PositionerTool::placeVolume(): "
                << "physical volume " << m_physVolName
                << " already exists in mother volume " << m_motherLVolName
                << endreq;
      return StatusCode::SUCCESS;
    }
  }

  // Create the physical volume
  Gaudi::Rotation3D rotation(m_rotation.begin(), m_rotation.end());
  Gaudi::XYZVector position(m_position[0],m_position[1],m_position[2]);
  IPVolume* pv = 
    parentLogVol->createPVolume(m_physVolName, m_logVolName, 
                                Gaudi::Transform3D(rotation, 
                                                   Gaudi::XYZVector(position)));
  
  if( 0 == pv ) {
    error() << "PositionerTool::placeVolume(): "
            << "could not create volume: " << m_physVolName
            << endreq;
    return StatusCode::FAILURE;
  }

  StatusCode sc;
  
  if(m_detElemPath != ""){
    // Add the corresponding detector element
    DetectorElement* detElem = new DetectorElement;
    sc = m_detSvc->registerObject( m_support, m_detElemPath, detElem);
    if( sc.isFailure() ){
      error() << "Failed to register object with support / path: " 
              << m_support << " / " << m_detElemPath << endreq;
    }
    detElem->createGeometryInfo( m_logVolName, m_support, m_physVolName);
  }

  return sc;
}
const InterfaceID & IPositionerTool::interfaceID ( ) [static, inherited]

Definition at line 7 of file IPositionerTool.cc.

                                                {
  return IID_IPositionerTool;
}

Member Data Documentation

IDataProviderSvc* PositionerTool::m_detSvc [private]

Definition at line 48 of file PositionerTool.h.

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.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:56:27 for DetHelpers by doxygen 1.7.4