Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance handling of transformations in VolumeBuilder #1263

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading