13 #ifndef DD4HEP_DDREC_SURFACEINSTALLER_H
14 #define DD4HEP_DDREC_SURFACEINSTALLER_H 1
26 namespace DDSurfaces {
62 typedef std::map<TGeoVolume*, SurfaceData* >
Surfaces;
92 template <
typename T>
static long run(
LCDD& lcdd,
int argc,
char** argv);
97 T installer(lcdd, argc, argv);
102 #define DECLARE_SURFACE_INSTALLER(name,class) \
104 template long SurfaceInstaller::run< class >(Geometry::LCDD& lcdd,int argc,char** argv); \
106 DECLARE_APPLY(name,SurfaceInstaller::run< class >)
111 #if defined(DD4HEP_USE_SURFACEINSTALL_HELPER)
116 #ifndef SURFACEINSTALLER_DATA
149 void handle_arguments(
int argc,
char** argv);
152 Installer(LCDD& lcdd,
int argc,
char** argv);
154 virtual ~Installer() {}
158 bool handleUsingCache(
DetElement comp, Volume vol)
const;
161 template <
typename T>
bool checkShape(
const T& shape)
const {
162 if ( shape.isValid() )
return true;
169 template <
typename UserData>
170 Installer<UserData>::Installer(LCDD& lcdd,
int argc,
char** argv)
171 : DD4hep::SurfaceInstaller(lcdd, argc, argv)
173 handle_arguments(argc, argv);
177 template <
typename UserData>
178 bool Installer<UserData>::handleUsingCache(
DetElement comp, Volume vol)
const {
179 Surfaces::const_iterator is = m_surfaces.find(vol.ptr());
180 if ( is != m_surfaces.end() ) {
181 VolSurface surf((*is).second);
189 template <
typename UserData>
191 m_surfaces.insert(std::make_pair(surf.
volume().
ptr(),surf.
ptr()));
196 template <
typename UserData>
void Installer<UserData>::handle_arguments(
int,
char**) {}
197 #ifndef SURFACEINSTALLER_DATA
198 template <>
void Installer<SURFACEINSTALLER_DATA>::handle_arguments(
int,
char**) {}
202 typedef Installer<SURFACEINSTALLER_DATA> InstallerClass;
const double * placementTranslation(DetElement component) const
Shortcut to access the translation vector of a given component.
DDSurfaces::SurfaceType SurfaceType
DetElement m_det
Reference to the detector element of the subdetector.
Handle class holding a placed volume (also called physical volume)
void stopScanning()
Set flag to stop scanning volumes and detector elements.
Volume parentVolume(DetElement component) const
Shortcut to access the parent detectorelement's volume.
void invalidInstaller(const std::string &msg) const
Indicate error message and throw exception.
Geometry::DetectorTools::PlacementPath PlacementPath
std::string typeName(const std::type_info &type)
ABI information about type names.
LCDD & m_lcdd
Reference to the LCDD instance.
SurfaceInstaller(LCDD &lcdd, int argc, char **argv)
Initializing constructor.
#define SURFACEINSTALLER_DATA
T * ptr() const
Access to the held object.
bool m_stopScanning
Flag to inhibit useless further scans.
DD4hep::Geometry::DetElement DetElement
Handle class holding a placed volume (also called physical volume)
void scan()
Scan through tree of detector elements.
#define DECLARE_SURFACE_INSTALLER(name, class)
virtual ~SurfaceInstaller()
Default destructor.
#define DD4HEP_USE_SURFACEINSTALL_HELPER
Geometry::DetElement DetElement
DDRec::VolSurfaceBase SurfaceData
static ComponentCast * component(void *p)
Geometry::PlacedVolume PlacedVolume
VolSurfaceHandle< VolPlaneImpl > VolPlane
virtual void install(DetElement e, PlacedVolume pv)
Install volume information. Default implementation only prints!
VolSurfaceBase * ptr() const
pointer to underlying object
static long run(LCDD &lcdd, int argc, char **argv)
Executor.
Geometry::Volume volume() const
the volume to which this surface is attached.
Handle class describing a detector element.
VolSurfaceList * volSurfaceList(DetElement &det)
Geometry::DetectorTools::ElementPath ElementPath
std::map< TGeoVolume *, SurfaceData * > Surfaces
The main interface to the DD4hep detector description package.
Surfaces m_surfaces
Map of surface instances keyed by the logical volume.