diff --git a/compact/definitions.xml b/compact/definitions.xml
index cbb47ee99..8bd39f669 100644
--- a/compact/definitions.xml
+++ b/compact/definitions.xml
@@ -314,8 +314,10 @@ The unused IDs below are saved for future use.
-
-
+
+
+
+
## Detector Definition Parameters
diff --git a/compact/far_backward/taggers.xml b/compact/far_backward/taggers.xml
index 7c16fa727..b3df7ff36 100644
--- a/compact/far_backward/taggers.xml
+++ b/compact/far_backward/taggers.xml
@@ -10,9 +10,20 @@
+
+
+
+
Main beamline vacuum volume spanning between B2BeR and Q3eR magnets
+
+
+
+
-
-
-
-
+
+
+
+
+
+
@@ -63,12 +78,6 @@
-
-
-
-
-
-
diff --git a/compact/tracking/definitions_craterlake.xml b/compact/tracking/definitions_craterlake.xml
index e0403f9c6..fa8127243 100644
--- a/compact/tracking/definitions_craterlake.xml
+++ b/compact/tracking/definitions_craterlake.xml
@@ -186,6 +186,13 @@
+
+
+
+
diff --git a/src/BackwardsTaggers_geo.cpp b/src/BackwardsTaggers_geo.cpp
index f10f53886..7fb432f2d 100644
--- a/src/BackwardsTaggers_geo.cpp
+++ b/src/BackwardsTaggers_geo.cpp
@@ -2,10 +2,11 @@
// Copyright (C) 2022 Simon Gardner
#include "DD4hep/DetFactoryHelper.h"
-#include "DD4hep/OpticalSurfaces.h"
#include "DD4hep/Printout.h"
#include "DDRec/DetectorData.h"
#include "DDRec/Surface.h"
+#include "XML/Utilities.h"
+#include "DD4hepDetectorHelper.h"
//////////////////////////////////////////////////
@@ -29,6 +30,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
int detID = x_det.id();
DetElement det(detName, detID);
+ dd4hep::xml::setDetectorTypeFlag(x_det, det);
string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BackwardsBox");
@@ -181,7 +183,8 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
nAir++;
}
- Assembly TaggerAssembly("Tagger_module_assembly");
+ //Assembly TaggerAssembly("Tagger_module_assembly");
+ Assembly TaggerAssembly(moduleName);
PlacedVolume pv_mod2 = mother.placeVolume(
TaggerAssembly,
@@ -191,6 +194,9 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens)
pv_mod2.addPhysVolID("module", moduleID);
moddet.setPlacement(pv_mod2);
+ auto &moduleParams = DD4hepDetectorHelper::ensureExtension(moddet);
+ moduleParams.set("layer_pattern", "Tagger_tracker_layer\\d");
+
Make_Tagger(desc, mod, TaggerAssembly, moddet, sens);
}
@@ -367,6 +373,11 @@ static void Make_Tagger(Detector& desc, xml_coll_t& mod, Assembly& env, DetEleme
double layerZ = dd4hep::getAttrOrDefault(lay, _Unicode(z), 0 * mm);
double layerThickness = dd4hep::getAttrOrDefault(lay, _Unicode(sensor_thickness), 200 * um);
+ double envelope_r_min = dd4hep::getAttrOrDefault(lay, _Unicode(envelope_r_min), -10.0*mm);
+ double envelope_r_max = dd4hep::getAttrOrDefault(lay, _Unicode(envelope_r_max), 10.0*mm);
+ double envelope_z_min = dd4hep::getAttrOrDefault(lay, _Unicode(envelope_z_min), -10.0*mm);
+ double envelope_z_max = dd4hep::getAttrOrDefault(lay, _Unicode(envelope_z_max), 10.0*mm);
+
Volume mother = env;
double MotherThickness = tagboxL;
@@ -379,17 +390,49 @@ static void Make_Tagger(Detector& desc, xml_coll_t& mod, Assembly& env, DetEleme
}
Box Layer_Box(tag_w, tag_h, layerThickness / 2);
- Volume layVol("Tagger_tracker_layer", Layer_Box, Silicon);
+
+ std::string layerName = "Tagger_tracker_layer" + std::to_string(layerID);
+ Volume layVol(layerName, Layer_Box, Silicon);
layVol.setSensitiveDetector(sens);
layVol.setVisAttributes(desc.visAttributes(layerVis));
- PlacedVolume pv_layer = mother.placeVolume(layVol, Transform3D(rotate, Position(0, 0, MotherThickness - layerZ + layerThickness / 2)));
- pv_layer.addPhysVolID("layer", layerID);
+ Assembly layer_vol(layerName);
+ PlacedVolume pv_layer = mother.placeVolume(layer_vol, Transform3D(rotate, Position(0, 0, MotherThickness - layerZ + layerThickness / 2)));
+ PlacedVolume pv_layerdet = layer_vol.placeVolume(layVol);
+ pv_layerdet.addPhysVolID("layer", layerID);
- DetElement laydet(modElement,"layerName"+std::to_string(layerID), layerID);
- laydet.setPlacement(pv_layer);
+ DetElement laydet(modElement,pv_layer.volume().name(), layerID);
+ DetElement laydetdet(laydet,layerName+"DET", layerID);
+
+ laydetdet.setPlacement(pv_layerdet);
+
+ // -------- create a measurement plane for the tracking surface attched to the sensitive volume -----
+ Vector3D u(-1., 0., 0.);
+ Vector3D v( 0.,-1., 0.);
+ Vector3D n( 0., 0., 1.);
+
+ // Add surface to layer for acts reconstruction
+ SurfaceType type(SurfaceType::Sensitive);
+ layer_vol->GetShape()->ComputeBBox();
+ auto &layerParams = DD4hepDetectorHelper::ensureExtension(laydet);
+ layerParams.set("axis_definitions", "XZY");
+ layerParams.set("envelope_r_min", envelope_r_min);
+ layerParams.set("envelope_r_max", envelope_r_max);
+ layerParams.set("envelope_z_min", envelope_z_min);
+ layerParams.set("envelope_z_max", envelope_z_max);
+
+ for (xml_coll_t lmat(mod, _Unicode(layer_material)); lmat; ++lmat) {
+ xml_comp_t x_layer_material = lmat;
+ DD4hepDetectorHelper::xmlToProtoSurfaceMaterial(x_layer_material, layerParams, "layer_material");
+ }
+
+
+ VolPlane surf(layVol, type, 2.0, 1.0, u, v, n); //,o ) ;
+ volSurfaceList(laydet)->push_back(surf);
+
+ laydet.setPlacement(pv_layer);
}
}