Skip to content
Snippets Groups Projects
Commit 1cd0af1a authored by Markus Frank's avatar Markus Frank
Browse files

Add default handle constructors to VolSurface and VolPlane

parent ae0a1e47
No related branches found
No related tags found
No related merge requests found
......@@ -73,14 +73,16 @@ namespace DD4hep {
double _th_i ;
double _th_o ;
SurfaceMaterial _innerMat ;
SurfaceMaterial _outerMat ;
SurfaceMaterial _outerMat ;
Geometry::Volume _vol ;
/// default c'tor.
SurfaceData();
/// Standard c'tor for initialization.
SurfaceData( SurfaceType type, double thickness_inner ,double thickness_outer,
Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o ) ;
Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o,
Geometry::Volume vol /*= Geometry::Volume() */);
/// Default destructor
virtual ~SurfaceData() {}
......@@ -96,6 +98,7 @@ namespace DD4hep {
_th_o = c._th_o ;
_innerMat = c._innerMat ;
_outerMat = c._innerMat ;
_vol = c._vol;
}
} ;
......@@ -110,8 +113,6 @@ namespace DD4hep {
protected:
Geometry::Volume _vol ;
/// setter for daughter classes
virtual void setU(const Vector3D& u) { object<SurfaceData>()._u = u ; }
......@@ -128,13 +129,26 @@ namespace DD4hep {
///default c'tor
VolSurface() { }
/// Constructor to be used with an existing object
VolSurface(SurfaceData* p)
: Geometry::Handle< SurfaceData >(p) {
}
/// Constructor to be used with an existing object
VolSurface(const VolSurface& e)
: Geometry::Handle< SurfaceData >(e) {
}
/// Constructor to be used with an existing object
template <typename Q> VolSurface(const Handle<Q>& e)
: Geometry::Handle< SurfaceData >(e) {
}
/// Standrad c'tor for initialization.
VolSurface( Geometry::Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer,
Vector3D u ,Vector3D v ,Vector3D n , Vector3D o = Vector3D(0.,0.,0.) ) ;
/// the volume to which this surface is attached.
Geometry::Volume volume() const { return _vol ; }
Geometry::Volume volume() const { return ptr()->_vol; }
/// The id of this surface - always 0 for VolSurfaces
virtual long64 id() const { return 0 ; }
......@@ -262,6 +276,16 @@ namespace DD4hep {
///default c'tor
VolPlane() : VolSurface() { }
/// Constructor to be used with an existing object
VolPlane(SurfaceData* p)
: VolSurface(p) {
}
/// Constructor to be used with an existing object
template <typename Q> VolPlane(const Handle<Q>& e)
: VolSurface(e) {
}
/// copy c'tor
VolPlane(const VolSurface& vs ) : VolSurface( vs ) { }
......
......@@ -38,12 +38,14 @@ namespace DD4hep {
_th_i( 0. ),
_th_o( 0. ),
_innerMat( MaterialData() ),
_outerMat( MaterialData() ) {
_outerMat( MaterialData() ),
_vol()
{
}
SurfaceData::SurfaceData( SurfaceType type , double thickness_inner ,double thickness_outer,
Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o ) : _type(type ) ,
Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o, Volume vol ) : _type(type ) ,
_u( u ) ,
_v( v ) ,
_n( n ) ,
......@@ -51,7 +53,9 @@ namespace DD4hep {
_th_i( thickness_inner ),
_th_o( thickness_outer ),
_innerMat( MaterialData() ),
_outerMat( MaterialData() ) {
_outerMat( MaterialData() ),
_vol(vol)
{
}
......@@ -60,9 +64,7 @@ namespace DD4hep {
VolSurface::VolSurface( Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer,
Vector3D u ,Vector3D v ,Vector3D n ,Vector3D o ) :
Geometry::Handle< SurfaceData >( new SurfaceData( type, thickness_inner ,thickness_outer, u,v,n,o) ) ,
_vol( vol ) {
Geometry::Handle< SurfaceData >( new SurfaceData(type, thickness_inner ,thickness_outer, u,v,n,o, vol) ) {
}
......@@ -238,7 +240,7 @@ namespace DD4hep {
list = det.extension< VolSurfaceList >() ;
} catch( std::runtime_error e){
} catch(const std::runtime_error& e){
list = det.addExtension<VolSurfaceList >( new VolSurfaceList ) ;
}
......@@ -421,8 +423,9 @@ namespace DD4hep {
Volume theVol = _volSurf.volume() ;
if( ! findVolume( pv, theVol , pVList ) ){
std::stringstream sst ; sst << " ***** ERROR: Volume " << theVol.name() << " not found for DetElement " << _det.name() << " with surface " ;
throw std::runtime_error( sst.str() ) ;
theVol = _volSurf.volume() ;
std::stringstream sst ; sst << " ***** ERROR: Volume " << theVol.name() << " not found for DetElement " << _det.name() << " with surface " ;
throw std::runtime_error( sst.str() ) ;
}
// std::cout << " **** Surface::initialize() # placements for surface = " << pVList.size()
......@@ -831,3 +834,8 @@ namespace DD4hep {
} // namespace
} // namespace
#include "DD4hep/Handle.inl"
typedef DD4hep::DDRec::SurfaceData SurfaceData;
DD4HEP_INSTANTIATE_HANDLE_UNNAMED(SurfaceData);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment