DD4hep
1.30.0
Detector Description Toolkit for High Energy Physics
|
Helper class to build volume and shapes according to ertain patterns in the XML tree. More...
#include <VolumeBuilder.h>
Public Types | |
typedef ::dd4hep::DetElement | DetElement |
typedef ::dd4hep::xml::DetElement | xml_det_h |
typedef std::map< std::string, std::pair< Handle_t, Solid > > | Shapes |
typedef std::map< std::string, std::pair< Handle_t, Volume > > | Volumes |
typedef std::map< std::string, Material > | Materials |
typedef std::map< std::string, std::pair< Handle_t, Transform3D > > | Transformations |
Public Member Functions | |
VolumeBuilder ()=delete | |
Inhibit default constructor. More... | |
VolumeBuilder (VolumeBuilder &©)=delete | |
Inhibit move constructor. More... | |
VolumeBuilder (const VolumeBuilder ©)=delete | |
Inhibit copy constructor. More... | |
VolumeBuilder (Detector &dsc, Handle_t x_parent, SensitiveDetector sd=SensitiveDetector()) | |
Initializing constructor. More... | |
virtual | ~VolumeBuilder () |
Default constructor. More... | |
VolumeBuilder & | operator= (VolumeBuilder &©)=delete |
Inhibit move assignment. More... | |
VolumeBuilder & | operator= (const VolumeBuilder ©)=delete |
Inhibit copy assignment. More... | |
size_t | collectMaterials (Handle_t element) |
Collect a set of materials from the leafs of an xml tag. More... | |
Transform3D | getTransform (const std::string &nam) const |
Access element from transformation cache by name. More... | |
Solid | getShape (const std::string &nam) const |
Access element from shape cache by name. Invalid returns means 'veto'. Otherwise exception. More... | |
Solid | makeShape (Handle_t handle) |
Create a new shape from the information given in the xml handle. More... | |
Volume | volume (const std::string &nam) const |
Access a registered volume by name. More... | |
void | registerShape (const std::string &nam, Solid shape) |
Register shape to map. More... | |
void | registerVolume (const std::string &nam, Volume volume) |
Register volume to map. More... | |
size_t | buildShapes (Handle_t handle) |
Build all <shape> identifiers in the passed parent xml element. More... | |
size_t | buildVolumes (Handle_t handle) |
Build all <volume> identifiers in the passed parent xml element. More... | |
size_t | buildTransformations (Handle_t handle) |
Build all <transformation> identifiers in the passed parent xml element. More... | |
size_t | load (Handle_t element, const std::string &tag) |
Load include tags contained in the passed XML handle. More... | |
VolumeBuilder & | placeDaughters (Volume vol, Handle_t handle) |
Build all <physvol> identifiers as PlaceVolume daughters. Ignores structure. More... | |
VolumeBuilder & | placeDaughters (DetElement parent, Volume vol, Handle_t handle) |
Build all <physvol> identifiers as PlaceVolume daughters. Also handles structure. More... | |
PlacedVolume | placeDetector (Volume vol) |
Place the detector object into the mother volume returned by the Detector instance. More... | |
PlacedVolume | placeDetector (Volume vol, Handle_t handle) |
Place the detector object into the mother volume returned by the Detector instance. More... | |
Public Attributes | |
std::map< std::string, std::unique_ptr< xml::DocumentHolder > > | included_docs |
Detector & | description |
xml_det_h | x_det |
int | id = -1 |
std::string | name |
DetElement | detector |
SensitiveDetector | sensitive |
DetectorBuildType | buildType |
Shapes | shapes |
Volumes | volumes |
Materials | materials |
Transformations | transformations |
std::set< std::string > | shape_veto |
std::set< std::string > | vol_veto |
bool | debug = false |
Protected Member Functions | |
void | _placeSingleVolume (DetElement de, Volume vol, Handle_t c) |
Place single volumes. More... | |
void | _placeParamVolumes (DetElement de, Volume vol, Handle_t c) |
Place parametrized volumes. More... | |
Helper class to build volume and shapes according to ertain patterns in the XML tree.
1) Shape builder pattern (buildShape):
<parent_element> <shape name="Shape1" type="Box" dx="Bls:ScintSSizeX" dy="Bls:ScintSSizeY" dz="Bls:ScintSSizeZ"/> <shape name="Shape2" type="Box" dx="Bls:ScintMSizeX" dy="Bls:ScintMSizeY" dz="Bls:ScintMSizeZ"/> <shape name="Shape3" type="Box" dx="Bls:ScintLSizeX" dy="Bls:ScintLSizeY" dz="Bls:ScintLSizeZ"/> .... <shape name="ShapeN" type="Trapezoid" z="Bls:FiberCoverH" x1="Bls:ScintLSizeX" y1="Bls:ScintSSizeZ" x2="Bls:ScintSSizeX" y2="Bls:ScintSSizeZ"/> <parent_element>
2) Volume builder pattern 2.a) Regular pattern using anonymouns shapes Call: size_t buildVolumes(xml_h handle); In the example handle references <detector>
<detector id="Bls:ID" name="Bls" type="LHCb_Bcm" parent="${Bls:Parent}" <volume name="lvBlsScintS" material="Bls/BlsSc" vis="Bls:ScintillatorVis"> <shape type="Box" dx="Bls:ScintSSizeX" dy="Bls:ScintSSizeY" dz="Bls:ScintSSizeZ"/> </volume> <volume name="lvBlsScintM" material="Bls/BlsSc" vis="Bls:ScintillatorVis"> <shape type="Box" dx="Bls:ScintMSizeX" dy="Bls:ScintMSizeY" dz="Bls:ScintMSizeZ"/> </volume> .... </detector>
2.b) Regular pattern referencing named shapes (created and registered by buildShapes) Call: size_t buildVolumes(xml_h handle); In the example handle references <detector>
<detector> <volume name="lvBlsScintS1" material="Bls/BlsSc" vis="Bls:ScintillatorVis" shape="Shape1"> <volume name="lvBlsScintS2" material="Bls/BlsSc" vis="Bls:ScintillatorVis" shape="Shape2"> <volume name="lvBlsScintS3" material="Bls/BlsSc" vis="Bls:ScintillatorVis" shape="Shape3"> .... <volume name="lvBlsScintSN" material="Bls/BlsSc" vis="Bls:ScintillatorVis" shape="ShapeN"> </detector>
2.c) Pattern to create named assembly volumes Call: size_t buildVolumes(xml_h handle); In the example handle references <detector>
<volume name="lvBlsScintS1" vis="Bls:ScintillatorVis" assemply="1"> <volume name="lvBlsScintS2" vis="Bls:ScintillatorVis" assemply="1"> <volume name="lvBlsScintS3" vis="Bls:ScintillatorVis" assemply="1"> .... <volume name="lvBlsScintSN" vis="Bls:ScintillatorVis" assemply="1"> </detector>
Alternative
<volume name="lvBlsScintS1" vis="Bls:ScintillatorVis"> <assembly/> </volume>
Volume placement patterns 3.c) Pattern to place daughter volumes into parent void VolumeBuilder::placeDaughters(DetElement parent, Volume vol, xml_h handle) In the example handle references <assembly>
<assembly name="lvBcmDownMount"> <physvol logvol="lvBcmDownMountFront"> <position/> </physvol> <physvol logvol="lvBcmDownMountBackSection"> <position z="Bcm:DownMountFrontLength/2 + Bcm:DownMountBackSectionLength/2 + 0.01*mm"/> <rotation z="45*degree"/> </physvol> <physvol logvol="lvBcmDownMountBackSection"> <position z="Bcm:DownMountFrontLength/2 + Bcm:DownMountBackSectionLength/2 + 0.01*mm"/> <rotation z="135*degree"/> </physvol> <physvol logvol="lvBcmDownMountBackSection"> <position z="Bcm:DownMountFrontLength/2 + Bcm:DownMountBackSectionLength/2 + 0.01*mm"/> <rotation z="225*degree"/> </physvol> <physvol logvol="lvBcmDownMountBackSection"> <position z="Bcm:DownMountFrontLength/2 + Bcm:DownMountBackSectionLength/2 + 0.01*mm"/> <rotation z="315*degree"/> </physvol> </assembly>
Please Note: It is the user's responsability to ensure all reated entities are properly registered to the detector description (and TGeo). No cleanup and referencing is done here!
Definition at line 140 of file VolumeBuilder.h.
Definition at line 142 of file VolumeBuilder.h.
typedef std::map<std::string,Material> dd4hep::xml::tools::VolumeBuilder::Materials |
Definition at line 146 of file VolumeBuilder.h.
typedef std::map<std::string,std::pair<Handle_t,Solid> > dd4hep::xml::tools::VolumeBuilder::Shapes |
Definition at line 144 of file VolumeBuilder.h.
typedef std::map<std::string,std::pair<Handle_t,Transform3D> > dd4hep::xml::tools::VolumeBuilder::Transformations |
Definition at line 147 of file VolumeBuilder.h.
typedef std::map<std::string,std::pair<Handle_t,Volume> > dd4hep::xml::tools::VolumeBuilder::Volumes |
Definition at line 145 of file VolumeBuilder.h.
typedef ::dd4hep::xml::DetElement dd4hep::xml::tools::VolumeBuilder::xml_det_h |
Definition at line 143 of file VolumeBuilder.h.
|
delete |
Inhibit default constructor.
|
delete |
Inhibit move constructor.
|
delete |
Inhibit copy constructor.
VolumeBuilder::VolumeBuilder | ( | Detector & | dsc, |
Handle_t | x_parent, | ||
SensitiveDetector | sd = SensitiveDetector() |
||
) |
Initializing constructor.
Definition at line 29 of file VolumeBuilder.cpp.
|
inlinevirtual |
Default constructor.
Definition at line 181 of file VolumeBuilder.h.
|
protected |
Place parametrized volumes.
Definition at line 361 of file VolumeBuilder.cpp.
|
protected |
Place single volumes.
Definition at line 296 of file VolumeBuilder.cpp.
std::size_t VolumeBuilder::buildShapes | ( | Handle_t | handle | ) |
Build all <shape> identifiers in the passed parent xml element.
Check if this volume is part of the volumes to be built for this description type
Definition at line 173 of file VolumeBuilder.cpp.
std::size_t VolumeBuilder::buildTransformations | ( | Handle_t | handle | ) |
Build all <transformation> identifiers in the passed parent xml element.
Definition at line 469 of file VolumeBuilder.cpp.
std::size_t VolumeBuilder::buildVolumes | ( | Handle_t | handle | ) |
Build all <volume> identifiers in the passed parent xml element.
Check if this volume is part of the volumes to be built for this description type
Check if the volume is implemented by a factory
Check if the volume is sensitive
Check if the volume has a shape attribute --> shape reference
Else use anonymous shape embedded in volume
We have a real volume here with a concrete shape:
Check if the volume is sensitive
Definition at line 210 of file VolumeBuilder.cpp.
std::size_t VolumeBuilder::collectMaterials | ( | Handle_t | element | ) |
Collect a set of materials from the leafs of an xml tag.
Definition at line 41 of file VolumeBuilder.cpp.
dd4hep::Solid VolumeBuilder::getShape | ( | const std::string & | nam | ) | const |
Access element from shape cache by name. Invalid returns means 'veto'. Otherwise exception.
Definition at line 107 of file VolumeBuilder.cpp.
dd4hep::Transform3D VolumeBuilder::getTransform | ( | const std::string & | nam | ) | const |
Access element from transformation cache by name.
Definition at line 98 of file VolumeBuilder.cpp.
std::size_t VolumeBuilder::load | ( | Handle_t | element, |
const std::string & | tag | ||
) |
Load include tags contained in the passed XML handle.
Definition at line 436 of file VolumeBuilder.cpp.
dd4hep::Solid VolumeBuilder::makeShape | ( | Handle_t | handle | ) |
Create a new shape from the information given in the xml handle.
Was it veto'ed before ?
Check if this volume is part of the volumes to be built for this description type
Now we create the shape....
And register it if it is not anonymous
Definition at line 125 of file VolumeBuilder.cpp.
|
delete |
Inhibit copy assignment.
|
delete |
Inhibit move assignment.
VolumeBuilder & VolumeBuilder::placeDaughters | ( | DetElement | parent, |
Volume | vol, | ||
Handle_t | handle | ||
) |
Build all <physvol> identifiers as PlaceVolume daughters. Also handles structure.
Definition at line 460 of file VolumeBuilder.cpp.
VolumeBuilder & VolumeBuilder::placeDaughters | ( | Volume | vol, |
Handle_t | handle | ||
) |
Build all <physvol> identifiers as PlaceVolume daughters. Ignores structure.
Definition at line 454 of file VolumeBuilder.cpp.
dd4hep::PlacedVolume VolumeBuilder::placeDetector | ( | Volume | vol | ) |
Place the detector object into the mother volume returned by the Detector instance.
Definition at line 479 of file VolumeBuilder.cpp.
dd4hep::PlacedVolume VolumeBuilder::placeDetector | ( | Volume | vol, |
Handle_t | handle | ||
) |
Place the detector object into the mother volume returned by the Detector instance.
Definition at line 484 of file VolumeBuilder.cpp.
void VolumeBuilder::registerShape | ( | const std::string & | nam, |
Solid | shape | ||
) |
Register shape to map.
Definition at line 54 of file VolumeBuilder.cpp.
void VolumeBuilder::registerVolume | ( | const std::string & | nam, |
Volume | volume | ||
) |
Register volume to map.
Definition at line 64 of file VolumeBuilder.cpp.
dd4hep::Volume VolumeBuilder::volume | ( | const std::string & | nam | ) | const |
Access a registered volume by name.
Definition at line 80 of file VolumeBuilder.cpp.
DetectorBuildType dd4hep::xml::tools::VolumeBuilder::buildType |
Definition at line 155 of file VolumeBuilder.h.
bool dd4hep::xml::tools::VolumeBuilder::debug = false |
Definition at line 161 of file VolumeBuilder.h.
Detector& dd4hep::xml::tools::VolumeBuilder::description |
Definition at line 149 of file VolumeBuilder.h.
DetElement dd4hep::xml::tools::VolumeBuilder::detector |
Definition at line 153 of file VolumeBuilder.h.
int dd4hep::xml::tools::VolumeBuilder::id = -1 |
Definition at line 151 of file VolumeBuilder.h.
std::map<std::string, std::unique_ptr<xml::DocumentHolder> > dd4hep::xml::tools::VolumeBuilder::included_docs |
Definition at line 148 of file VolumeBuilder.h.
Materials dd4hep::xml::tools::VolumeBuilder::materials |
Definition at line 158 of file VolumeBuilder.h.
std::string dd4hep::xml::tools::VolumeBuilder::name |
Definition at line 152 of file VolumeBuilder.h.
SensitiveDetector dd4hep::xml::tools::VolumeBuilder::sensitive |
Definition at line 154 of file VolumeBuilder.h.
std::set<std::string> dd4hep::xml::tools::VolumeBuilder::shape_veto |
Definition at line 160 of file VolumeBuilder.h.
Shapes dd4hep::xml::tools::VolumeBuilder::shapes |
Definition at line 156 of file VolumeBuilder.h.
Transformations dd4hep::xml::tools::VolumeBuilder::transformations |
Definition at line 159 of file VolumeBuilder.h.
std::set<std::string> dd4hep::xml::tools::VolumeBuilder::vol_veto |
Definition at line 160 of file VolumeBuilder.h.
Volumes dd4hep::xml::tools::VolumeBuilder::volumes |
Definition at line 157 of file VolumeBuilder.h.
xml_det_h dd4hep::xml::tools::VolumeBuilder::x_det |
Definition at line 150 of file VolumeBuilder.h.