Skip to content

feat: add DIRC to Acts geometry for truth hits and projection surfaces #900

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 4 additions & 1 deletion compact/definitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,15 @@ The unused IDs below are saved for future use.
- DIRC subsystem ID: 90
- Barrel TRD subsystem ID: 91
- Barrel TOF subsystem ID: 92
- Unused IDs: 93-99
- Barrel TOF subassembly ID: 93
- Barrel DIRC subassembly ID: 94
- Unused IDs: 95-99
</documentation>
<constant name="BarrelDIRC_ID" value="90"/>
<constant name="BarrelTRD_ID" value="91"/>
<constant name="BarrelTOF_ID" value="92"/>
<constant name="TOFSubAssembly_ID" value="93"/>
<constant name="DIRCSubAssembly_ID" value="94"/>

<documentation>
#### (100-109) Electromagnetic Calorimeter
Expand Down
20 changes: 20 additions & 0 deletions compact/pid/dirc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,25 @@
</display>

<detectors>
<detector id="DIRCSubAssembly_ID"
name="DIRCTrackerSubAssembly"
type="DD4hep_SubdetectorAssembly"
vis="TrackerSubAssemblyVis">
<composite name="cb_DIRC"/>
</detector>

<detector id="BarrelDIRC_ID" name="cb_DIRC" type="epic_DIRC" readout="DIRCBarHits" vis="DIRCTube">
<type_flags type="DetType_TRACKER + DetType_CHERENKOV + DetType_BARREL"/>
<dimensions rmin="DIRCBar_center - DIRCBar_height/2" rmax="DIRCBar_center + DIRCBar_height/2" length="DIRC_length"/>
<position x="0" y="0" z="DIRC_offset"/>

<envelope vis="BarrelDIRC_envelope"
rmin="DIRC_rmin"
rmax="DIRC_rmax"
length="DIRC_length"
zstart="-DIRCBackward_zmax"
/>

<module name="DIRCBox" repeat="DIRCBox_count" width="DIRCPrism_width + 1*mm" height="DIRCPrism_height*2" length="DIRCBarAssm_length + 550*mm" vis="DIRCBox">
<!-- Mirror (at the end of the module) -->
<mirror
Expand Down Expand Up @@ -173,6 +189,10 @@
</readouts>

<plugins>
<plugin name="DD4hep_ParametersPlugin">
<argument value="cb_DIRC"/>
<argument value="layer_pattern: str=envelope"/>
</plugin>
</plugins>

<fields>
Expand Down
30 changes: 30 additions & 0 deletions src/DIRC_geo.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2022 Wouter Deconinck, Dmitry Romanov

#include "DD4hepDetectorHelper.h"
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/OpticalSurfaces.h"
#include "DD4hep/Printout.h"
#include "DDRec/DetectorData.h"
#include "DDRec/Surface.h"
#include <XML/Helper.h>
#include <XML/Utilities.h>

//////////////////////////////////
// Central Barrel DIRC
Expand Down Expand Up @@ -36,13 +38,41 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) {
// Detector type
sens.setType("tracker");

// Set detector type flagAdd commentMore actions
dd4hep::xml::setDetectorTypeFlag(xml_det, det);

// Entire DIRC assembly
Assembly det_volume("DIRC");
det_volume.setVisAttributes(desc.visAttributes(xml_det.visStr()));
Transform3D det_tr(RotationY(0), Position(0.0, 0.0, dirc_pos.z()));
det.setPlacement(
desc.pickMotherVolume(det).placeVolume(det_volume, det_tr).addPhysVolID("system", det_id));

// ACTS support
auto& envelope_params =
DD4hepDetectorHelper::ensureExtension<dd4hep::rec::VariantParameters>(det);
if (xml_det.hasChild(_Unicode(envelope))) {
xml_comp_t x_envelope = xml_det.child(_Unicode(envelope));
envelope_params.set<double>("envelope_r_min", getAttrOrDefault(x_envelope, _U(rmin), 0.));
envelope_params.set<double>("envelope_r_max", getAttrOrDefault(x_envelope, _U(rmax), 0.));
envelope_params.set<double>("envelope_z_min", getAttrOrDefault(x_envelope, _U(zmin), 0.));
envelope_params.set<double>("envelope_z_max", getAttrOrDefault(x_envelope, _U(zmax), 0.));
}
// Add the volume boundary material if configured
for (xml_coll_t boundary_material(xml_det, _Unicode(boundary_material)); boundary_material;
++boundary_material) {
xml_comp_t x_boundary_material = boundary_material;
DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_boundary_material, envelope_params,
"boundary_material");
}
// Add the volume layer material if configured
for (xml_coll_t layer_material(xml_det, _Unicode(layer_material)); layer_material;
++layer_material) {
xml_comp_t x_layer_material = layer_material;
DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, envelope_params,
"layer_material");
}

// Construct module
xml_comp_t xml_module = xml_det.child(_U(module));

Expand Down
Loading