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_gaussDist
Rndm::Numbers * m_flatDist
size_t m_numberOfSurfaces
bool m_enableCones
std::vector< double > m_worldDimensions
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 m_gaussDist(nullptr),
26 m_flatDist(nullptr),
28 m_enableCones(false)
29{
30
31 declareInterface<ISurfaceBuilder>(this);
32
33 // the active dimensions
34 declareProperty("NumberOfSurfaces", m_numberOfSurfaces);
35 declareProperty("WorldDimensions", m_worldDimensions);
36}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< double > m_worldDimensions

◆ ~RandomSurfaceBuilder()

Trk::RandomSurfaceBuilder::~RandomSurfaceBuilder ( )
virtual

Destructor.

Definition at line 39 of file RandomSurfacesBuilder.cxx.

40{
41 delete m_gaussDist;
42 delete m_flatDist;
43}

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 }

◆ 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 63 of file RandomSurfacesBuilder.cxx.

64{
65 ATH_MSG_INFO( "finalize() successful." );
66 return StatusCode::SUCCESS;
67}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode Trk::RandomSurfaceBuilder::initialize ( )

AlgTool initialize method.

Definition at line 48 of file RandomSurfacesBuilder.cxx.

49{
50
51 // Random number service
52 m_rndmSvc = service("RndmGenSvc");
53 ATH_CHECK( m_rndmSvc.isValid() );
54
55 // intialize the random number generators
56 m_gaussDist = new Rndm::Numbers(m_rndmSvc, Rndm::Gauss(0.,1.));
57 m_flatDist = new Rndm::Numbers(m_rndmSvc, Rndm::Flat(0.,1.));
58
59 return StatusCode::SUCCESS;
60}
#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 87 of file RandomSurfacesBuilder.cxx.

88{
89 if (m_worldDimensions.size() < 3 ) return nullptr;
90
91 const Trk::Surface* surface = nullptr;
92 int sType = std::floor(m_flatDist->shoot()*6);
93
94 // neglect 0 if you don't do cones
95 if (!m_enableCones && !sType){
96 while (!sType)
97 sType = std::floor(m_flatDist->shoot()*6);
98 }
99
100 sType = sType == 6 ? 5 : sType;
101 // create the transform parameters
102 double tx = m_worldDimensions[0]*(2*m_flatDist->shoot()-1);
103 double ty = m_worldDimensions[1]*(2*m_flatDist->shoot()-1);
104 double tz = m_worldDimensions[2]*(2*m_flatDist->shoot()-1);
105 double dx = m_flatDist->shoot();
106 double dy = m_flatDist->shoot();
107 double dz = m_flatDist->shoot();
108
109 std::unique_ptr<Amg::Transform3D> transform( new Amg::Transform3D );
110 // the direciton and curvilinear UVT frame
111 Amg::Vector3D direction(dx,dy,dz);
112
113 Trk::CurvilinearUVT curvUVT(direction.normalized());
114 // translation
115 Amg::Translation3D translation(tx, ty, tz);
116
117 // create the rotation
119 rotation.col(0) = curvUVT.curvU();
120 rotation.col(1) = curvUVT.curvV();
121 rotation.col(2) = curvUVT.curvT();
122 // curvilinear surfaces are boundless
123 (*transform) = translation;
124 (*transform).rotate(rotation);
125 ATH_MSG_VERBOSE("Created transform is : " << Amg::toString(*transform));
126
127 // create the surface
128 switch (sType) {
129 // create a cone surface - cone does not exist for old EDM as Measured
130 case 0 : {
131 surface = new Trk::ConeSurface(*transform, m_flatDist->shoot()*0.7*M_PI);
132 } break;
133 case 1 : {
134 surface = new Trk::CylinderSurface(*transform, 50.+m_worldDimensions[0]*m_flatDist->shoot(), m_worldDimensions[2]);
135 } break;
136 // create a disc surface
137 case 2 : {
138 surface = new Trk::DiscSurface(*transform, 0., m_worldDimensions[1]);
139 } break;
140 // create a perigee surface
141 case 3 : {
142 surface = new Trk::PerigeeSurface(Amg::Vector3D(tx,ty,tz));
143 } break;
144 // create a plane surface
145 case 4 : {
146 surface = new Trk::PlaneSurface(*transform, m_worldDimensions[0], m_worldDimensions[0]);
147 } break;
148 // create a straight line surface
149 case 5 : {
150 surface = new Trk::StraightLineSurface(*transform, 50., m_worldDimensions[2]);
151 } break;
152 default : break;
153 }
154 return surface;
155}
#define M_PI
#define ATH_MSG_VERBOSE(x)
const Surface * surface() const
SurfaceBuilder interface method - provice a single surface.
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

◆ 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 70 of file RandomSurfacesBuilder.cxx.

71{
72 std::vector<const Trk::Surface*>* cSurfaces = new std::vector<const Trk::Surface*>();
73 cSurfaces->reserve(m_numberOfSurfaces);
74 for ( size_t isf = 0; isf < m_numberOfSurfaces; ++isf ){
75 const Trk::Surface* csf = surface();
76 if (csf) cSurfaces->push_back(csf);
77 }
78 // check how many surfaces had been created
79 if ( cSurfaces->size() != m_numberOfSurfaces )
80 ATH_MSG_WARNING("Number of created surfaces (" << cSurfaces->size()
81 << ") does not correspond to chosen number (" << m_numberOfSurfaces << ")." );
82 return cSurfaces;
83
84}
#define ATH_MSG_WARNING(x)

◆ 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 >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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_enableCones

bool Trk::RandomSurfaceBuilder::m_enableCones
private

Definition at line 61 of file RandomSurfaceBuilder.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
private

Definition at line 58 of file RandomSurfaceBuilder.h.

◆ m_gaussDist

Rndm::Numbers* Trk::RandomSurfaceBuilder::m_gaussDist
private

Definition at line 57 of file RandomSurfaceBuilder.h.

◆ m_numberOfSurfaces

size_t Trk::RandomSurfaceBuilder::m_numberOfSurfaces
private

Definition at line 60 of file RandomSurfaceBuilder.h.

◆ 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

std::vector<double> Trk::RandomSurfaceBuilder::m_worldDimensions
private

Definition at line 62 of file RandomSurfaceBuilder.h.


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