Skip to content

Commit

Permalink
Enhance handling of transformations in VolumeBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlatham authored and MarkusFrankATcernch committed May 16, 2024
1 parent da374ac commit d5a4b3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DDCore/include/XML/VolumeBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ namespace dd4hep {
/// Collect a set of materials from the leafs of an xml tag
size_t collectMaterials(Handle_t element);

/// Access element from transformation cache by name
Transform3D getTransform(const std::string& nam) const;
/// Access element from shape cache by name. Invalid returns means 'veto'. Otherwise exception
Solid getShape(const std::string& nam) const;
/// Create a new shape from the information given in the xml handle
Expand Down
10 changes: 10 additions & 0 deletions DDCore/src/XML/VolumeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ dd4hep::Volume VolumeBuilder::volume(const std::string& nam) const {
return vol;
}

/// Access element from transformation cache by name
dd4hep::Transform3D VolumeBuilder::getTransform(const std::string& nam) const {
auto it = transformations.find(nam);
if ( it == transformations.end() ) {
except("VolumeBuilder","+++ Tranformation %s is not known to this builder unit. ",nam.c_str());
}
return (*it).second.second;
}

/// Access element from shape cache by name. Invalid returns means 'veto'. Otherwise exception
dd4hep::Solid VolumeBuilder::getShape(const std::string& nam) const {
auto is = shapes.find(nam);
Expand Down Expand Up @@ -434,6 +443,7 @@ std::size_t VolumeBuilder::load(xml_h element, const std::string& tag) {
"++ Processing xml document %s.", doc->uri().c_str());
included_docs[ref] = std::unique_ptr<xml::DocumentHolder>(doc.release());
buildShapes(vols);
buildTransformations(vols);
buildVolumes(vols);
++count;
}
Expand Down

0 comments on commit d5a4b3c

Please sign in to comment.