ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::RandomSurfaceBuilder Class Reference

The RandomSurfaceBuilder is a simple Tool that helps to construct randomly poisitioned surfaces - mainly for validation studies. More...

#include <RandomSurfaceBuilder.h>

Inheritance diagram for Trk::RandomSurfaceBuilder:
Collaboration diagram for Trk::RandomSurfaceBuilder:

Public Member Functions

 RandomSurfaceBuilder (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual ~RandomSurfaceBuilder ()
 Destructor.
StatusCode initialize ()
 AlgTool initialize method.
StatusCode finalize ()
 AlgTool finalize method.
const std::vector< const Surface * > * surfaces () const
 SurfaceBuilder interface method - provide a vector of surfaces -.
const Surfacesurface () const
 SurfaceBuilder interface method - provice a single surface.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
 DeclareInterfaceID (ISurfaceBuilder, 1, 0)
 Creates the InterfaceID and interfaceID() method.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SmartIF< IRndmGenSvc > m_rndmSvc
 random number engine used
Rndm::Numbers * m_flatDist = nullptr
Gaudi::Property< size_t > m_numberOfSurfaces {this, "NumberOfSurfaces", 100}
Gaudi::Property< std::vector< double > > m_worldDimensions {this, "WorldDimensions", {}, "the active dimensions"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

The RandomSurfaceBuilder is a simple Tool that helps to construct randomly poisitioned surfaces - mainly for validation studies.

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Definition at line 33 of file RandomSurfaceBuilder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ RandomSurfaceBuilder()

Trk::RandomSurfaceBuilder::RandomSurfaceBuilder ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor.

Definition at line 23 of file RandomSurfacesBuilder.cxx.

24: AthAlgTool(t,n,p)
25{
26 declareInterface<ISurfaceBuilder>(this);
27}
AthAlgTool()
Default constructor:

◆ ~RandomSurfaceBuilder()

Trk::RandomSurfaceBuilder::~RandomSurfaceBuilder ( )
virtual

Destructor.

Definition at line 30 of file RandomSurfacesBuilder.cxx.

31{
32 delete m_flatDist;
33}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

Trk::ISurfaceBuilder::DeclareInterfaceID ( ISurfaceBuilder ,
1 ,
0  )
inherited

Creates the InterfaceID and interfaceID() method.

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode Trk::RandomSurfaceBuilder::finalize ( )

AlgTool finalize method.

Definition at line 52 of file RandomSurfacesBuilder.cxx.

53{
54 ATH_MSG_INFO( "finalize() successful." );
55 return StatusCode::SUCCESS;
56}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode Trk::RandomSurfaceBuilder::initialize ( )

AlgTool initialize method.

Definition at line 38 of file RandomSurfacesBuilder.cxx.

39{
40
41 // Random number service
42 m_rndmSvc = service("RndmGenSvc");
43 ATH_CHECK( m_rndmSvc.isValid() );
44
45 // intialize the random number generators
46 m_flatDist = new Rndm::Numbers(m_rndmSvc, Rndm::Flat(0.,1.));
47
48 return StatusCode::SUCCESS;
49}
#define ATH_CHECK
Evaluate an expression and check for errors.
SmartIF< IRndmGenSvc > m_rndmSvc
random number engine used

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ surface()

const Trk::Surface * Trk::RandomSurfaceBuilder::surface ( ) const
virtual

SurfaceBuilder interface method - provice a single surface.

Implements Trk::ISurfaceBuilder.

Definition at line 76 of file RandomSurfacesBuilder.cxx.

77{
78 if (m_worldDimensions.size() < 3 ) return nullptr;
79
80 const Trk::Surface* surface = nullptr;
81 int sType = std::floor(m_flatDist->shoot()*6);
82
83 // neglect 0 if you don't do cones
84 if (!sType){
85 while (!sType)
86 sType = std::floor(m_flatDist->shoot()*6);
87 }
88
89 sType = sType == 6 ? 5 : sType;
90 // create the transform parameters
91 double tx = m_worldDimensions[0]*(2*m_flatDist->shoot()-1);
92 double ty = m_worldDimensions[1]*(2*m_flatDist->shoot()-1);
93 double tz = m_worldDimensions[2]*(2*m_flatDist->shoot()-1);
94 double dx = m_flatDist->shoot();
95 double dy = m_flatDist->shoot();
96 double dz = m_flatDist->shoot();
97
98 std::unique_ptr<Amg::Transform3D> transform( new Amg::Transform3D );
99 // the direciton and curvilinear UVT frame
100 Amg::Vector3D direction(dx,dy,dz);
101
102 Trk::CurvilinearUVT curvUVT(direction.normalized());
103 // translation
104 Amg::Translation3D translation(tx, ty, tz);
105
106 // create the rotation
108 rotation.col(0) = curvUVT.curvU();
109 rotation.col(1) = curvUVT.curvV();
110 rotation.col(2) = curvUVT.curvT();
111 // curvilinear surfaces are boundless
112 (*transform) = translation;
113 (*transform).rotate(rotation);
114 ATH_MSG_VERBOSE("Created transform is : " << Amg::toString(*transform));
115
116 // create the surface
117 switch (sType) {
118 // create a cone surface - cone does not exist for old EDM as Measured
119 case 0 : {
120 surface = new Trk::ConeSurface(*transform, m_flatDist->shoot()*0.7*M_PI);
121 } break;
122 case 1 : {
123 surface = new Trk::CylinderSurface(*transform, 50.+m_worldDimensions[0]*m_flatDist->shoot(), m_worldDimensions[2]);
124 } break;
125 // create a disc surface
126 case 2 : {
127 surface = new Trk::DiscSurface(*transform, 0., m_worldDimensions[1]);
128 } break;
129 // create a perigee surface
130 case 3 : {
131 surface = new Trk::PerigeeSurface(Amg::Vector3D(tx,ty,tz));
132 } break;
133 // create a plane surface
134 case 4 : {
135 surface = new Trk::PlaneSurface(*transform, m_worldDimensions[0], m_worldDimensions[0]);
136 } break;
137 // create a straight line surface
138 case 5 : {
139 surface = new Trk::StraightLineSurface(*transform, 50., m_worldDimensions[2]);
140 } break;
141 default : break;
142 }
143 return surface;
144}
#define M_PI
#define ATH_MSG_VERBOSE(x)
const Surface * surface() const
SurfaceBuilder interface method - provice a single surface.
Gaudi::Property< std::vector< double > > m_worldDimensions
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.

◆ surfaces()

const std::vector< const Trk::Surface * > * Trk::RandomSurfaceBuilder::surfaces ( ) const
virtual

SurfaceBuilder interface method - provide a vector of surfaces -.

Implements Trk::ISurfaceBuilder.

Definition at line 59 of file RandomSurfacesBuilder.cxx.

60{
61 std::vector<const Trk::Surface*>* cSurfaces = new std::vector<const Trk::Surface*>();
62 cSurfaces->reserve(m_numberOfSurfaces);
63 for ( size_t isf = 0; isf < m_numberOfSurfaces; ++isf ){
64 const Trk::Surface* csf = surface();
65 if (csf) cSurfaces->push_back(csf);
66 }
67 // check how many surfaces had been created
68 if ( cSurfaces->size() != m_numberOfSurfaces )
69 ATH_MSG_WARNING("Number of created surfaces (" << cSurfaces->size()
70 << ") does not correspond to chosen number (" << m_numberOfSurfaces << ")." );
71 return cSurfaces;
72
73}
#define ATH_MSG_WARNING(x)
Gaudi::Property< size_t > m_numberOfSurfaces

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_flatDist

Rndm::Numbers* Trk::RandomSurfaceBuilder::m_flatDist = nullptr
private

Definition at line 57 of file RandomSurfaceBuilder.h.

◆ m_numberOfSurfaces

Gaudi::Property<size_t> Trk::RandomSurfaceBuilder::m_numberOfSurfaces {this, "NumberOfSurfaces", 100}
private

Definition at line 59 of file RandomSurfaceBuilder.h.

59{this, "NumberOfSurfaces", 100};

◆ m_rndmSvc

SmartIF<IRndmGenSvc> Trk::RandomSurfaceBuilder::m_rndmSvc
private

random number engine used

Definition at line 56 of file RandomSurfaceBuilder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_worldDimensions

Gaudi::Property<std::vector<double> > Trk::RandomSurfaceBuilder::m_worldDimensions {this, "WorldDimensions", {}, "the active dimensions"}
private

Definition at line 60 of file RandomSurfaceBuilder.h.

61{this, "WorldDimensions", {}, "the active dimensions"};

The documentation for this class was generated from the following files: