DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
VolumeBuilder.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 #ifndef XML_VOLUMEBUILDER_H
14 #define XML_VOLUMEBUILDER_H
15 
16 // Framework include files
17 #include <XML/XMLElements.h>
18 #include <XML/XMLDetector.h>
19 #include <DD4hep/Detector.h>
20 
21 // C/C++ include files
22 #include <set>
23 #include <map>
24 #include <memory>
25 
27 namespace dd4hep {
28 
30  namespace xml {
31 
33  namespace tools {
34 
36 
141  public:
142  typedef ::dd4hep::DetElement DetElement;
143  typedef ::dd4hep::xml::DetElement xml_det_h;
144  typedef std::map<std::string,std::pair<Handle_t,Solid> > Shapes;
145  typedef std::map<std::string,std::pair<Handle_t,Volume> > Volumes;
146  typedef std::map<std::string,Material> Materials;
147  typedef std::map<std::string,std::pair<Handle_t,Transform3D> > Transformations;
148  std::map<std::string, std::unique_ptr<xml::DocumentHolder> > included_docs;
151  int id = -1;
152  std::string name;
160  std::set<std::string> shape_veto, vol_veto;
161  bool debug = false;
162 
163  protected:
165  void _placeSingleVolume(DetElement de, Volume vol, Handle_t c);
167  void _placeParamVolumes(DetElement de, Volume vol, Handle_t c);
168 
169  public:
171  VolumeBuilder() = delete;
175  VolumeBuilder(const VolumeBuilder& copy) = delete;
177  VolumeBuilder(Detector& dsc,
178  Handle_t x_parent,
181  virtual ~VolumeBuilder() {}
186 
188  size_t collectMaterials(Handle_t element);
189 
191  Transform3D getTransform(const std::string& nam) const;
193  Solid getShape(const std::string& nam) const;
197  Volume volume(const std::string& nam) const;
199  void registerShape(const std::string& nam, Solid shape);
201  void registerVolume(const std::string& nam, Volume volume);
203  size_t buildShapes(Handle_t handle);
205  size_t buildVolumes(Handle_t handle);
209  size_t load(Handle_t element, const std::string& tag);
217  };
218  } /* End namespace tools */
219  } /* End namespace xml */
220 } /* End namespace dd4hep */
221 #endif // XML_VOLUMEBUILDER_H
dd4hep::xml::tools::VolumeBuilder::Shapes
std::map< std::string, std::pair< Handle_t, Solid > > Shapes
Definition: VolumeBuilder.h:144
dd4hep::xml::tools::VolumeBuilder::description
Detector & description
Definition: VolumeBuilder.h:149
dd4hep::xml::tools::VolumeBuilder::vol_veto
std::set< std::string > vol_veto
Definition: VolumeBuilder.h:160
dd4hep::xml::tools::VolumeBuilder::Volumes
std::map< std::string, std::pair< Handle_t, Volume > > Volumes
Definition: VolumeBuilder.h:145
dd4hep::xml::tools::VolumeBuilder::VolumeBuilder
VolumeBuilder(VolumeBuilder &&copy)=delete
Inhibit move constructor.
dd4hep::xml::tools::VolumeBuilder
Helper class to build volume and shapes according to ertain patterns in the XML tree.
Definition: VolumeBuilder.h:140
dd4hep::xml::tools::VolumeBuilder::volume
Volume volume(const std::string &nam) const
Access a registered volume by name.
Definition: VolumeBuilder.cpp:80
dd4hep::SensitiveDetector
Handle class to hold the information of a sensitive detector.
Definition: DetElement.h:44
dd4hep::xml::tools::VolumeBuilder::operator=
VolumeBuilder & operator=(const VolumeBuilder &copy)=delete
Inhibit copy assignment.
Detector.h
dd4hep::xml::tools::VolumeBuilder::~VolumeBuilder
virtual ~VolumeBuilder()
Default constructor.
Definition: VolumeBuilder.h:181
XMLDetector.h
dd4hep::xml::tools::VolumeBuilder::shape_veto
std::set< std::string > shape_veto
Definition: VolumeBuilder.h:160
dd4hep::PlacedVolume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:163
dd4hep::xml::tools::VolumeBuilder::volumes
Volumes volumes
Definition: VolumeBuilder.h:157
dd4hep::xml::tools::VolumeBuilder::x_det
xml_det_h x_det
Definition: VolumeBuilder.h:150
dd4hep::xml::tools::VolumeBuilder::buildVolumes
size_t buildVolumes(Handle_t handle)
Build all <volume> identifiers in the passed parent xml element.
Definition: VolumeBuilder.cpp:210
dd4hep::xml::tools::VolumeBuilder::name
std::string name
Definition: VolumeBuilder.h:152
dd4hep::Solid_type< TGeoShape >
dd4hep::xml::tools::VolumeBuilder::buildType
DetectorBuildType buildType
Definition: VolumeBuilder.h:155
dd4hep::xml::Handle_t
Class to easily access the properties of single XmlElements.
Definition: XMLElements.h:380
dd4hep::xml::tools::VolumeBuilder::makeShape
Solid makeShape(Handle_t handle)
Create a new shape from the information given in the xml handle.
Definition: VolumeBuilder.cpp:125
dd4hep::xml::tools::VolumeBuilder::shapes
Shapes shapes
Definition: VolumeBuilder.h:156
dd4hep::xml::tools::VolumeBuilder::detector
DetElement detector
Definition: VolumeBuilder.h:153
dd4hep::xml::tools::VolumeBuilder::xml_det_h
::dd4hep::xml::DetElement xml_det_h
Definition: VolumeBuilder.h:143
dd4hep::xml::tools::VolumeBuilder::placeDetector
PlacedVolume placeDetector(Volume vol)
Place the detector object into the mother volume returned by the Detector instance.
Definition: VolumeBuilder.cpp:479
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::Volume
Handle class holding a placed volume (also called physical volume)
Definition: Volumes.h:370
dd4hep::xml::tools::VolumeBuilder::collectMaterials
size_t collectMaterials(Handle_t element)
Collect a set of materials from the leafs of an xml tag.
Definition: VolumeBuilder.cpp:41
dd4hep::xml::tools::VolumeBuilder::_placeParamVolumes
void _placeParamVolumes(DetElement de, Volume vol, Handle_t c)
Place parametrized volumes.
Definition: VolumeBuilder.cpp:361
dd4hep::xml::tools::VolumeBuilder::VolumeBuilder
VolumeBuilder()=delete
Inhibit default constructor.
dd4hep::xml::tools::VolumeBuilder::registerVolume
void registerVolume(const std::string &nam, Volume volume)
Register volume to map.
Definition: VolumeBuilder.cpp:64
dd4hep::xml
Namespace for the AIDA detector description toolkit supporting XML utilities.
Definition: ConditionsTags.h:27
dd4hep::xml::tools::VolumeBuilder::placeDaughters
VolumeBuilder & placeDaughters(Volume vol, Handle_t handle)
Build all <physvol> identifiers as PlaceVolume daughters. Ignores structure.
Definition: VolumeBuilder.cpp:454
dd4hep::xml::tools::VolumeBuilder::included_docs
std::map< std::string, std::unique_ptr< xml::DocumentHolder > > included_docs
Definition: VolumeBuilder.h:148
dd4hep::xml::tools::VolumeBuilder::sensitive
SensitiveDetector sensitive
Definition: VolumeBuilder.h:154
dd4hep::xml::tools::VolumeBuilder::_placeSingleVolume
void _placeSingleVolume(DetElement de, Volume vol, Handle_t c)
Place single volumes.
Definition: VolumeBuilder.cpp:296
dd4hep::xml::tools::VolumeBuilder::operator=
VolumeBuilder & operator=(VolumeBuilder &&copy)=delete
Inhibit move assignment.
dd4hep::xml::tools::VolumeBuilder::debug
bool debug
Definition: VolumeBuilder.h:161
dd4hep::xml::tools::VolumeBuilder::Transformations
std::map< std::string, std::pair< Handle_t, Transform3D > > Transformations
Definition: VolumeBuilder.h:147
dd4hep::Transform3D
ROOT::Math::Transform3D Transform3D
Definition: Objects.h:117
dd4hep::xml::tools::VolumeBuilder::load
size_t load(Handle_t element, const std::string &tag)
Load include tags contained in the passed XML handle.
Definition: VolumeBuilder.cpp:436
dd4hep::xml::tools::VolumeBuilder::getShape
Solid getShape(const std::string &nam) const
Access element from shape cache by name. Invalid returns means 'veto'. Otherwise exception.
Definition: VolumeBuilder.cpp:107
dd4hep::xml::tools::VolumeBuilder::transformations
Transformations transformations
Definition: VolumeBuilder.h:159
dd4hep::xml::tools::VolumeBuilder::getTransform
Transform3D getTransform(const std::string &nam) const
Access element from transformation cache by name.
Definition: VolumeBuilder.cpp:98
XMLElements.h
dd4hep::DetectorBuildType
DetectorBuildType
Detector description build types.
Definition: BuildType.h:34
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::xml::tools::VolumeBuilder::materials
Materials materials
Definition: VolumeBuilder.h:158
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::xml::tools::VolumeBuilder::buildShapes
size_t buildShapes(Handle_t handle)
Build all <shape> identifiers in the passed parent xml element.
Definition: VolumeBuilder.cpp:173
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::xml::tools::VolumeBuilder::VolumeBuilder
VolumeBuilder(const VolumeBuilder &copy)=delete
Inhibit copy constructor.
dd4hep::xml::tools::VolumeBuilder::DetElement
::dd4hep::DetElement DetElement
Definition: VolumeBuilder.h:142
dd4hep::xml::tools::VolumeBuilder::Materials
std::map< std::string, Material > Materials
Definition: VolumeBuilder.h:146
dd4hep::xml::tools::VolumeBuilder::registerShape
void registerShape(const std::string &nam, Solid shape)
Register shape to map.
Definition: VolumeBuilder.cpp:54
dd4hep::xml::tools::VolumeBuilder::buildTransformations
size_t buildTransformations(Handle_t handle)
Build all <transformation> identifiers in the passed parent xml element.
Definition: VolumeBuilder.cpp:469
handle
void handle(const O *o, const C &c, F pmf)
Definition: LCDDConverter.cpp:1105