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

Enable detectors with a mixture of active and passive layers #54

Merged
merged 1 commit into from
Aug 4, 2023
Merged
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
13 changes: 9 additions & 4 deletions Detector/DetCommon/src/SimpleLayeredCylinder_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@

namespace det {
/**
Factory for a shape from multiple cylinders. Meant for material approximations.
Expected xml structure:
Factory for a shape from multiple cylinders.
Expected xml structure (the 'sensitive' keyword is optional and default to false):
<detector type="SimpleLayeredCylinder" ...>
<dimensions rmin="..." rmax="..." dz="..." z_offset="..."> <!-- envelope -->
<layer rmin="..." rmax="..." dz="..." z_offset="..." material="...">
...
<layer rmin="..." rmax="..." dz="..." z_offset="..." material="...">
<layer rmin="..." rmax="..." dz="..." z_offset="..." material="..." sensitive="true">
</detector>
@author: Joschka Lingemann
*/
static dd4hep::Ref_t createSimpleLayeredCylinder(dd4hep::Detector& lcdd,
dd4hep::xml::Handle_t xmlElement,
dd4hep::SensitiveDetector /*sensDet*/) {
dd4hep::SensitiveDetector sensDet) {
dd4hep::xml::DetElement xmlDet = static_cast<dd4hep::xml::DetElement>(xmlElement);
std::string name = xmlDet.nameStr();
dd4hep::DetElement detElement(name, xmlDet.id());
Expand All @@ -39,6 +39,11 @@ static dd4hep::Ref_t createSimpleLayeredCylinder(dd4hep::Detector& lcdd,
if (layer.hasAttr("vis")) {
layerVolume.setVisAttributes(lcdd, layerDet.visStr());
}
if (layer.hasAttr("sensitive") && layerDet.isSensitive()) {
dd4hep::xml::Dimension sdType(xmlElement.child(_U(sensitive)));// if called outside of the loop it breaks existing configs without sensitive layers
sensDet.setType(sdType.typeStr());
layerVolume.setSensitiveDetector(sensDet);
}
layer.m_node = layers.next();
}

Expand Down
Loading