diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index 8ee4adaf328d347b885e27f0caeb8abc3cf5bbc6..7a564373f5784e17e1332a3aa8a6b5ead5cf082e 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -611,70 +611,70 @@ std::ostream& DD4hep::Geometry::operator<<(std::ostream& os, const VolumeManager return os; } -#if 0 - -It was wishful thinking, the implementation of the reverse lookups would be as simple. -Hence the folling calls are removed for the time being. - -Markus Frank - -/** This set of functions is required when reading/analyzing - * already created hits which have a VolumeID attached. - */ -/// Lookup the context, which belongs to a registered physical volume. -Context* lookupContext(PlacedVolume vol) const throw(); -/// Access the physical volume identifier from the placed volume -VolumeID lookupID(PlacedVolume vol) const; -/// Lookup a top level subdetector detector element according to a contained 64 bit hit ID -DetElement lookupDetector(PlacedVolume vol) const; -/// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID -DetElement lookupDetElement(PlacedVolume vol) const; -/// Access the transformation of a physical volume to the world coordinate system -const TGeoMatrix& worldTransformation(PlacedVolume vol) const; - -/// Lookup the context, which belongs to a registered physical volume. -VolumeManager::Context* VolumeManager::lookupContext(PlacedVolume pv) const throw() { - if ( isValid() ) { - Context* c = 0; - const Object& o = _data(); - if ( o.top != ptr() && (o.flags&ONE) == ONE ) { - return VolumeManager(Ref_t(o.top)).lookupContext(pv); - } - /// First look in our own volume cache if the entry is found. - c = o.search(pv); - if ( c ) return c; - /// Second: look in the subdetector volume cache if the entry is found. - for(Detectors::const_iterator j=o.subdetectors.begin(); j != o.subdetectors.end(); ++j) { - if ( (c=(*j).second._data().search(pv)) != 0 ) - return c; - } - throw runtime_error("VolumeManager::lookupContext: Failed to search Volume context [Unknown identifier]"); - } - throw runtime_error("VolumeManager::lookupContext: Failed to search Volume context [Invalid Manager Handle]"); -} - -/// Access the physical volume identifier from the placed volume -VolumeManager::VolumeID VolumeManager::lookupID(PlacedVolume vol) const { - Context* c = lookupContext(vol); - return c->identifier; -} - -/// Lookup a top level subdetector detector element according to a contained 64 bit hit ID -DetElement VolumeManager::lookupDetector(PlacedVolume vol) const { - Context* c = lookupContext(vol); - return c->detector; -} - -/// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID -DetElement VolumeManager::lookupDetElement(PlacedVolume vol) const { - Context* c = lookupContext(vol); - return c->element; -} - -/// Access the transformation of a physical volume to the world coordinate system -const TGeoMatrix& VolumeManager::worldTransformation(PlacedVolume vol) const { - Context* c = lookupContext(vol); - return c->toWorld; -} - -#endif +// #if 0 + +// It was wishful thinking, the implementation of the reverse lookups would be as simple. +// Hence the folling calls are removed for the time being. + +// Markus Frank + +// /** This set of functions is required when reading/analyzing +// * already created hits which have a VolumeID attached. +// */ +// /// Lookup the context, which belongs to a registered physical volume. +// Context* lookupContext(PlacedVolume vol) const throw(); +// /// Access the physical volume identifier from the placed volume +// VolumeID lookupID(PlacedVolume vol) const; +// /// Lookup a top level subdetector detector element according to a contained 64 bit hit ID +// DetElement lookupDetector(PlacedVolume vol) const; +// /// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID +// DetElement lookupDetElement(PlacedVolume vol) const; +// /// Access the transformation of a physical volume to the world coordinate system +// const TGeoMatrix& worldTransformation(PlacedVolume vol) const; + +// /// Lookup the context, which belongs to a registered physical volume. +// VolumeManager::Context* VolumeManager::lookupContext(PlacedVolume pv) const throw() { +// if ( isValid() ) { +// Context* c = 0; +// const Object& o = _data(); +// if ( o.top != ptr() && (o.flags&ONE) == ONE ) { +// return VolumeManager(Ref_t(o.top)).lookupContext(pv); +// } +// /// First look in our own volume cache if the entry is found. +// c = o.search(pv); +// if ( c ) return c; +// /// Second: look in the subdetector volume cache if the entry is found. +// for(Detectors::const_iterator j=o.subdetectors.begin(); j != o.subdetectors.end(); ++j) { +// if ( (c=(*j).second._data().search(pv)) != 0 ) +// return c; +// } +// throw runtime_error("VolumeManager::lookupContext: Failed to search Volume context [Unknown identifier]"); +// } +// throw runtime_error("VolumeManager::lookupContext: Failed to search Volume context [Invalid Manager Handle]"); +// } + +// /// Access the physical volume identifier from the placed volume +// VolumeManager::VolumeID VolumeManager::lookupID(PlacedVolume vol) const { +// Context* c = lookupContext(vol); +// return c->identifier; +// } + +// /// Lookup a top level subdetector detector element according to a contained 64 bit hit ID +// DetElement VolumeManager::lookupDetector(PlacedVolume vol) const { +// Context* c = lookupContext(vol); +// return c->detector; +// } + +// /// Lookup the closest subdetector detector element in the hierarchy according to a contained 64 bit hit ID +// DetElement VolumeManager::lookupDetElement(PlacedVolume vol) const { +// Context* c = lookupContext(vol); +// return c->element; +// } + +// /// Access the transformation of a physical volume to the world coordinate system +// const TGeoMatrix& VolumeManager::worldTransformation(PlacedVolume vol) const { +// Context* c = lookupContext(vol); +// return c->toWorld; +// } + +// #endif diff --git a/DDRec/include/DDRec/Surface.h b/DDRec/include/DDRec/Surface.h index 3e1864e2adc3488ad298c35a5f48b2a50415ed82..cca6e2e2ded439f8efa09abfe054308a48365ad4 100644 --- a/DDRec/include/DDRec/Surface.h +++ b/DDRec/include/DDRec/Surface.h @@ -26,8 +26,18 @@ namespace DD4hep { struct SurfaceMaterial : public virtual Geometry::Material , public IMaterial{ /** Copy c'tor - copies handle */ - SurfaceMaterial( Geometry::Material m ) : Geometry::Material( m ) {} - + SurfaceMaterial( Geometry::Material m ) ; // : Geometry::Material( m ) {} + + SurfaceMaterial( const SurfaceMaterial& sm ) ; + // { + // (*this).Geometry::Material::m_element = sm.Geometry::Material::m_element ; + // } + + virtual ~SurfaceMaterial() ; //{} + + /// material name + virtual std::string name() const { return m_element->GetMaterial()->GetName() ; } + /// averaged proton number virtual double Z() const { return m_element->GetMaterial()->GetZ() ; } @@ -59,8 +69,8 @@ namespace DD4hep { Vector3D _o ; double _th_i ; double _th_o ; - Geometry::Material _innerMat ; - Geometry::Material _outerMat ; + SurfaceMaterial _innerMat ; + SurfaceMaterial _outerMat ; SurfaceData(); @@ -130,10 +140,10 @@ namespace DD4hep { virtual const Vector3D& origin() const { return object<SurfaceData>()._o ;} /// Access to the material in opposite direction of the normal - virtual IMaterial innerMaterial() const{ return SurfaceMaterial( object<SurfaceData>()._innerMat ) ; } - + virtual const IMaterial& innerMaterial() const{ return object<SurfaceData>()._innerMat ; } + /// Access to the material in direction of the normal - virtual IMaterial outerMaterial() const { return SurfaceMaterial( object<SurfaceData>()._outerMat ) ; } + virtual const IMaterial& outerMaterial() const { return object<SurfaceData>()._outerMat ; } /** Thickness of inner material */ virtual double innerThickness() const { return object<SurfaceData>()._th_i ; } @@ -148,7 +158,16 @@ namespace DD4hep { virtual double distance(const Vector3D& point ) const { return 0. ; } /// Checks if the given point lies within the surface - virtual bool insideBounds(const Vector3D& point, double epsilon ) const { return false ; } + virtual bool insideBounds(const Vector3D& point, double epsilon=1e-4 ) const { return false ; } + + + //fixme: protected: + friend declaration ? + + /// set the inner Material + void setInnerMaterial( Geometry::Material mat ){ object<SurfaceData>()._innerMat = mat ; } + /// set the outer Materal + void setOuterMaterial( Geometry::Material mat ){ object<SurfaceData>()._outerMat = mat ; } + }; @@ -259,19 +278,20 @@ namespace DD4hep { protected: - VolSurface _volSurf ; Geometry::DetElement _det ; + VolSurface _volSurf ; + TGeoMatrix* _wtM ; // matrix for world transformation of surface + + long64 _id ; - // this surface SurfaceType _type ; Vector3D _u ; Vector3D _v ; Vector3D _n ; Vector3D _o ; - TGeoMatrix* _wtM ; // matrix for world transformation of surface - Surface() { } + Surface() :_det( Geometry::DetElement() ), _volSurf( VolSurface() ), _wtM( 0 ) , _id( 0) { } public: @@ -279,6 +299,9 @@ namespace DD4hep { Surface( Geometry::DetElement det, VolSurface volSurf ) ; + /// The id of this surface - corresponds to DetElement id ( or'ed with the placement ids ) + virtual long64 id() { return _id ; } + /** properties of the surface encoded in Type. * @see SurfaceType */ @@ -305,10 +328,10 @@ namespace DD4hep { virtual double outerThickness() const { return _volSurf.outerThickness() ; } /// Access to the material in opposite direction of the normal - virtual IMaterial innerMaterial() const ; - + virtual const IMaterial& innerMaterial() const ; + /// Access to the material in direction of the normal - virtual IMaterial outerMaterial() const ; + virtual const IMaterial& outerMaterial() const ; /** Distance to surface */ virtual double distance(const Vector3D& point ) const ; diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp index a132a8414e097f1b6cf774db5344e286da91ec5d..77b36487ed27553c27c3bb8a7e72be105516b786 100644 --- a/DDRec/src/Surface.cpp +++ b/DDRec/src/Surface.cpp @@ -1,6 +1,9 @@ #include "DDRec/Surface.h" #include "DD4hep/Detector.h" +// #include "DD4hep/LCDD.h" +// #include "DD4hep/VolumeManager.h" + #include <math.h> #include <exception> @@ -11,6 +14,20 @@ namespace DD4hep { using namespace Geometry ; + //-------------------------------------------------------- + + /** Copy c'tor - copies handle */ + SurfaceMaterial::SurfaceMaterial( Geometry::Material m ) : Geometry::Material( m ) {} + + SurfaceMaterial::SurfaceMaterial( const SurfaceMaterial& sm ) { + (*this).Geometry::Material::m_element = sm.Geometry::Material::m_element ; + } + + SurfaceMaterial:: ~SurfaceMaterial() {} + + //-------------------------------------------------------- + + SurfaceData::SurfaceData() : _type( SurfaceType() ) , _u( Vector3D() ) , _v( Vector3D() ) , @@ -123,7 +140,7 @@ namespace DD4hep { } - //==================== + //====================================================================================================================== bool findVolume( PlacedVolume pv, Volume theVol, std::list< PlacedVolume >& volList ) { @@ -188,28 +205,65 @@ namespace DD4hep { } - Surface::Surface( Geometry::DetElement det, VolSurface volSurf ) : _det( det) , _volSurf( volSurf ), _wtM(0){ + Surface::Surface( Geometry::DetElement det, VolSurface volSurf ) : _det( det) , _volSurf( volSurf ), _wtM(0) , _id( 0) , _type( _volSurf.type() ) { initialize() ; } - IMaterial Surface::innerMaterial() const { + const IMaterial& Surface::innerMaterial() const { + + SurfaceMaterial& mat = _volSurf->_innerMat ; + + if( ! mat.isValid() ) { + + // fixme: for now just set the material of the volume holding the surface + // neeed averaged material in case of several volumes... + // _volSurf.setInnerMaterial( _volSurf.volume().material() ) ; + + mat = _volSurf.volume().material() ; + // std::cout << " **** Surface::innerMaterial() - assigning volume material to surface : " << mat.name() << std::endl ; + } + return _volSurf.innerMaterial() ; } - IMaterial Surface::outerMaterial() const { + const IMaterial& Surface::outerMaterial() const { + + SurfaceMaterial& mat = _volSurf->_outerMat ; + + if( ! mat.isValid() ) { + + // fixme: for now just set the material of the volume holding the surface + // neeed averaged material in case of several volumes... + // _volSurf.setOuterMaterial( _volSurf.volume().material() ) ; + + mat = _volSurf.volume().material() ; + //std::cout << " **** Surface::outerMaterial() - assigning volume material to surface : " << mat.name() << std::endl ; + } + + return _volSurf.outerMaterial() ; } double Surface::distance(const Vector3D& point ) const { + double pa[3] ; + _wtM->MasterToLocal( point , pa ) ; + Vector3D localPoint( pa ) ; + + return _volSurf.distance( localPoint ) ; } bool Surface::insideBounds(const Vector3D& point, double epsilon) const { - } + double pa[3] ; + _wtM->MasterToLocal( point , pa ) ; + Vector3D localPoint( pa ) ; + + return _volSurf.insideBounds( localPoint ) ; + } void Surface::initialize() { @@ -223,33 +277,16 @@ namespace DD4hep { throw std::runtime_error( " ***** ERROR: No Volume found for DetElement with surface " ) ; } - // //----------------------------------- - // if (nodes.size() < 2) { - // return new TGeoHMatrix(*gGeoIdentity); - // } - // auto_ptr<TGeoHMatrix> mat(new TGeoHMatrix(*gGeoIdentity)); - // for (size_t i = 0, n=nodes.size(); n>0 && i < n-1; ++i) { - // const PlacedVolume& p = nodes[i]; - // TGeoMatrix* m = p->GetMatrix(); - // mat->MultiplyLeft(m); - // } - // if ( inverse ) { - // auto_ptr<TGeoHMatrix> inv(new TGeoHMatrix(mat->Inverse())); - // mat = inv; - // } - // return mat.release(); - //-------------------------------------- - - std::cout << " **** Surface::initialize() # placements for surface = " << pVList.size() - << " worldTransform : " - << std::endl ; + // std::cout << " **** Surface::initialize() # placements for surface = " << pVList.size() + // << " worldTransform : " + // << std::endl ; //=========== compute and cache world transform for surface ========== TGeoMatrix* wm = _det.object<DetElement::Object>().worldTransformation() ; -#if 1 // debug +#if 0 // debug wm->Print() ; for( std::list<PlacedVolume>::iterator it= pVList.begin(), n = pVList.end() ; it != n ; ++it ){ PlacedVolume pv = *it ; @@ -262,63 +299,86 @@ namespace DD4hep { // need to get the inverse transformation ( see Detector.cpp ) std::auto_ptr<TGeoHMatrix> wtI( new TGeoHMatrix( wm->Inverse() ) ) ; - //---- if the volSurface is not in the DetElement's volume, we left mutliply the path to the volume to the world transform + //---- if the volSurface is not in the DetElement's volume, we need to mutliply the path to the volume to the + // DetElements world transform for( std::list<PlacedVolume>::iterator it = ++( pVList.begin() ) , n = pVList.end() ; it != n ; ++it ){ PlacedVolume pv = *it ; TGeoMatrix* m = pv->GetMatrix(); // std::cout << " +++ matrix for placed volume : " << std::endl ; // m->Print() ; + // wtI->MultiplyLeft( m ); - wtI->MultiplyLeft( m ); + wtI->Multiply( m ); } - std::auto_ptr<TGeoHMatrix> wt( new TGeoHMatrix( wtI->Inverse() ) ) ; - std::cout << " +++ new world transform matrix : " << std::endl ; - wt->Print() ; + // std::cout << " +++ new world transform matrix : " << std::endl ; +#if 0 //fixme: which convention to use here - the correct should be wtI, however it is the inverse of what is stored in DetElement ??? + std::auto_ptr<TGeoHMatrix> wt( new TGeoHMatrix( wtI->Inverse() ) ) ; + wt->Print() ; // cache the world transform for the surface _wtM = wt.release() ; +#else + // wtI->Print() ; + // cache the world transform for the surface + _wtM = wtI.release() ; +#endif // ============ now fill the global surface vectors ========================== - // void TGeoMatrix::MasterToLocal(const Double_t *master, Double_t *local) - // void TGeoMatrix::LocalToMaster(const Double_t *local, Double_t *master) - // void TGeoMatrix::MasterToLocalVect(const Double_t *master, Double_t *local) - // void TGeoMatrix::LocalToMasterVect(const Double_t *local, Double_t *master) - double ua[3], va[3], na[3], oa[3] ; - // double um[3], vm[3], nm[3], om[3] ; - // double ul[3], vl[3], nl[3], ol[3] ; - - const Vector3D& u = _volSurf.u() ; - const Vector3D& v = _volSurf.v() ; - const Vector3D& n = _volSurf.normal() ; - const Vector3D& o = _volSurf.origin() ; - - _wtM->LocalToMasterVect( u , ua ) ; - _wtM->LocalToMasterVect( v , va ) ; - _wtM->LocalToMasterVect( n , na ) ; - _wtM->LocalToMaster( o , oa ) ; + _wtM->LocalToMasterVect( _volSurf.u() , ua ) ; + _wtM->LocalToMasterVect( _volSurf.v() , va ) ; + _wtM->LocalToMasterVect( _volSurf.normal() , na ) ; + _wtM->LocalToMaster ( _volSurf.origin() , oa ) ; + + _u.fill( ua ) ; + _v.fill( va ) ; + _n.fill( na ) ; + _o.fill( oa ) ; + + // std::cout << " --- global surface vectors : ------- " << std::endl + // << " u : " << _u << std::endl + // << " v : " << _v << std::endl + // << " n : " << _n << std::endl + // << " o : " << _o << std::endl ; - - _u = Vector3D( ua ) ; - _v = Vector3D( va ) ; - _n = Vector3D( na ) ; - _o = Vector3D( oa ) ; - - std::cout << " --- global surface vectors : ------- " << std::endl - << " u : " << _u << std::endl - << " v : " << _v << std::endl - << " n : " << _n << std::endl - << " o : " << _o << std::endl ; + + // =========== check parallel and orthogonal to Z =================== + _type.checkParallelToZ( *this ) ; + _type.checkOrthogonalToZ( *this ) ; + - } + // LCDD& lcdd = LCDD::getInstance(); + // VolumeManager volMgr( lcdd , "volMan" , lcdd.world() ) ; + + //======== set the unique surface ID from the DetElement ( and placements below ? ) + + //FIXME: - no method found - to be done ... + //_id = _det.volumeID() ; + typedef PlacedVolume::VolIDs IDV ; + DetElement d = _det ; + while( d.isValid() && d.parent().isValid() ){ + PlacedVolume pv = d.placement() ; + if( pv.isValid() ){ + const IDV& idV = pv.volIDs() ; + std::cout << " VolIDs : " << d.name() << std::endl ; + for( unsigned i=0, n=idV.size() ; i<n ; ++i){ + std::cout << " " << idV[i].first << " - " << idV[i].second << std::endl ; + } + } + d = d.parent() ; + } + + } + //=================================================================================================================== + } // namespace } // namespace diff --git a/DDSurfaces/include/DDSurfaces/IMaterial.h b/DDSurfaces/include/DDSurfaces/IMaterial.h index a0b3095a879f72605c700451f2f68e69bd2793ed..dcae15e1520dfb8af9a1567e87a826dd0853576b 100644 --- a/DDSurfaces/include/DDSurfaces/IMaterial.h +++ b/DDSurfaces/include/DDSurfaces/IMaterial.h @@ -17,6 +17,9 @@ namespace DDSurfaces { /// Destructor virtual ~IMaterial() {} + /// material name + virtual std::string name() const =0 ; + /// averaged proton number virtual double Z() const =0 ; @@ -34,6 +37,15 @@ namespace DDSurfaces { }; + /// dump IMaterial operator + std::ostream& operator<<( std::ostream& os , const IMaterial& m ) { + + os << " " << m.name() << ", Z: " << m.Z() << ", A: " << m.A() << ", densitiy: " << m.density() << ", radiationLength: " << m.radiationLength() + << ", interactionLength: " << m.interactionLength() ; + + return os ; + } + } /* namespace DDSurfaces */ #endif /* DDSurfaces_MATERIAL_H_ */ diff --git a/DDSurfaces/include/DDSurfaces/ISurface.h b/DDSurfaces/include/DDSurfaces/ISurface.h index 263310fe462ac86d5f178ca11026205d5b3673c5..68f9c482f77c9aab26d03b50c415ab87836c53e9 100644 --- a/DDSurfaces/include/DDSurfaces/ISurface.h +++ b/DDSurfaces/include/DDSurfaces/ISurface.h @@ -44,10 +44,10 @@ namespace DDSurfaces { virtual const Vector3D& origin() const =0 ; /// Access to the material in opposite direction of the normal - virtual IMaterial innerMaterial() const =0 ; + virtual const IMaterial& innerMaterial() const =0 ; /// Access to the material in direction of the normal - virtual IMaterial outerMaterial() const =0 ; + virtual const IMaterial& outerMaterial() const =0 ; /** Thickness of inner material */ virtual double innerThickness() const =0 ; @@ -177,8 +177,28 @@ namespace DDSurfaces { mutable std::bitset<32> _bits ; } ; + /// dump SurfaceType operator + std::ostream& operator<<( std::ostream& os , const SurfaceType& t ) { + os << "sensitive[" << t.isSensitive() << "] helper[" << t.isHelper() << "] plane[" << t.isPlane() << "] cylinder[" << t.isCylinder() + << "] parallelToZ[" << t.isParallelToZ() << "] orthogonalToZ[" << t. isOrthogonalToZ() << "] zCylinder[" << t.isZCylinder() + << "] zPlane[" << t.isZPlane() << "]" ; + return os ; + } + + + + /// dump ISurface operator + std::ostream& operator<<( std::ostream& os , const ISurface& s ) { + + os << " type : " << s.type() << std::endl + << " u : " << s.u() << " v : " << s.v() << " normal : " << s.normal() << " origin : " << s.origin() << std::endl ; + os << " inner material : " << s.innerMaterial() << std::endl + << " outerMaterial : " << s.outerMaterial() << std::endl ; + + return os ; + } } /* namespace DDSurfaces */ diff --git a/DDSurfaces/include/DDSurfaces/Vector3D.h b/DDSurfaces/include/DDSurfaces/Vector3D.h index 31f08064c4404b3c28396d80f5a85a7a0e9d6778..cd4f8bf25471ac3d89a5e63985013304e933d99e 100644 --- a/DDSurfaces/include/DDSurfaces/Vector3D.h +++ b/DDSurfaces/include/DDSurfaces/Vector3D.h @@ -54,6 +54,14 @@ namespace DDSurfaces { // _z( t.z() ){ // } + + inline const Vector3D& fill( const double* v) { + + _x = v[0] ; _y = v[1] ; _z = v[2] ; + return *this ; + } + + /** Cartesian x coordinate */ inline double x() const { return _x ; } diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index fa7ade6328a31d7d65bcde151d01649e8dc8572c..e9c0cc3bfb10c23775dfdd2898b4f508de158a19 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -26,11 +26,11 @@ endif(BUILD_TESTING) # add_subdirectory(ILDExDet) -add_subdirectory(ILDExSimu) +#add_subdirectory(ILDExSimu) -add_subdirectory(CLICSiD) +#add_subdirectory(CLICSiD) -add_subdirectory(noviceN04) +#add_subdirectory(noviceN04) #---- does not build on mac or ubuntu ... #add_subdirectory(Segmentation) diff --git a/examples/ILDExDet/compact/ILDEx.xml b/examples/ILDExDet/compact/ILDEx.xml index ab3e2a11e33781c7e4e9679e0c6ff4ee88f0e6f9..6d4c1a54eea222cc00069b568e8ed377b640eaaf 100644 --- a/examples/ILDExDet/compact/ILDEx.xml +++ b/examples/ILDExDet/compact/ILDEx.xml @@ -119,7 +119,7 @@ <layer id="0" vis="VXDLayerVis" phi0="-1.570796327e+00"> <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> <ladder zhalf="65*mm" radius="1.595000000e+01*mm" width="1.100000000e+01*mm" offset="-1.874869853e+00*mm" thickness="0.05*mm" material="Silicon" number="10"/> - </layer> + </layer> <layer id="1" vis="VXDLayerVis" phi0="-1.570796327e+00"> <support thickness=".1*mm" material="Carbon" vis="VXDSupportVis"/> <ladder zhalf="65*mm" radius="18*mm" width="1.100000000e+01*mm" offset="-1.874869853e+00*mm" thickness="0.05*mm" material="Silicon" number="10"/> diff --git a/examples/ILDExDet/src/ILDExVXD_geo.cpp b/examples/ILDExDet/src/ILDExVXD_geo.cpp index 8910ef583c655548f72404485eb8b2edd35883a5..8939905d66edb60660623cb3e9ebc1e9d374068e 100644 --- a/examples/ILDExDet/src/ILDExVXD_geo.cpp +++ b/examples/ILDExDet/src/ILDExVXD_geo.cpp @@ -194,8 +194,11 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { DetElement ladderDEposZ( vxd , laddername+"_posZ" , x_det.id() ); ladderDEposZ.setPlacement( pv ) ; + + // if( j == 0 || j == 1 ) volSurfaceList( ladderDEposZ)->push_back( surf ) ; + pv = layer_assembly.placeVolume( laddervol, Transform3D( rot , Position( (radius + lthick/2.)*cos(phi) - offset * sin( phi ) , (radius + lthick/2.)*sin(phi) + offset * cos( phi ) , -zhalf ) ) ); @@ -206,6 +209,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { DetElement ladderDEnegZ( vxd , laddername+"_negZ" , x_det.id() ); ladderDEnegZ.setPlacement( pv ) ; + volSurfaceList( ladderDEnegZ)->push_back( surf ) ; diff --git a/examples/ILDExDet/src/test_surfaces.cc b/examples/ILDExDet/src/test_surfaces.cc index c9251ac9c8fc985b0ca0a2b5119886acd02f70e0..f72deb0d89df9d1eeab9dbe90ae5702d229ba970 100644 --- a/examples/ILDExDet/src/test_surfaces.cc +++ b/examples/ILDExDet/src/test_surfaces.cc @@ -1,6 +1,7 @@ #include "DD4hep/LCDD.h" #include "DD4hep/TGeoUnits.h" #include "DD4hep/Detector.h" +#include "DD4hep/Volumes.h" #include "DDRec/Surface.h" @@ -77,14 +78,24 @@ int main(int argc, char** argv ){ DetElement det = (*li) ; if( ! volSurfaceList(det)->empty() ) { - std::cout << " detector " << det.name() << " has " << volSurfaceList(det)->size() << " surfaces " << std::endl ; - + + std::cout << " detector " << det.name() << " id: " << det.id() << " has " << volSurfaceList(det)->size() << " surfaces " << std::endl ; + + // take first surface for now : VolSurface volSurf = volSurfaceList(det)->front() ; Surface* surf = new Surface( det, volSurf ) ; + std::cout << " ------------------------- " + << " surface: " << *surf << std::endl + << " ------------------------- " << std::endl ; + + + + } + }