diff --git a/compact/unused/ecal_backward_crystal_glass.xml b/compact/unused/ecal_backward_crystal_glass.xml
deleted file mode 100644
index 9fdf26b1e..000000000
--- a/compact/unused/ecal_backward_crystal_glass.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #### Backwards Endcap EM Calorimeter
-
- Backwards Endcap EM Calorimeter, placements generated by script
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Effectively no segmentation, the segmentation is used to provide cell dimension info
-
-
-
-
-
- system:8,sector:4,module:20,x:32:-16,y:-16
-
-
-
diff --git a/compact/unused/ecal_barrel_hybrid.xml b/compact/unused/ecal_barrel_hybrid.xml
deleted file mode 100644
index bd90de65b..000000000
--- a/compact/unused/ecal_barrel_hybrid.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- ---------------------------------------
- EM Calorimeter Parameters with AstroPix
- ---------------------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- For Pb/SiFi (GlueX): X0 ~ 1.45 cm
- For W/SiFi (sPHENIX): X0 ~ 0.7 cm (but different fiber orientation)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ---------------------
- Barrel EM Calorimeter
- ---------------------
- A layered EM calorimeter with tungsten and silicon (AstroPix)
-
-
-
-
-
-
-
-
- ---------------------------
- Imaging layers with silicon
- ---------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ---------------------------
- Last imiging layer with thick scint fiber layer
- ---------------------------
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:8,module:5,layer:4,slice:4,grid:9,fiber:9,x:39:-11,y:-14
-
-
-
-
-
-
diff --git a/compact/unused/ecal_forward_homogenous.xml b/compact/unused/ecal_forward_homogenous.xml
deleted file mode 100644
index 4d88d1a6c..000000000
--- a/compact/unused/ecal_forward_homogenous.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
- Simplified homogenous implementation of the forward ScFi calorimeter
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Common Generic visualization attributes
-
-
-
-
-
-
- ------------------------------------------
- Forward (Positive Z) Endcap EM Calorimeter
- ------------------------------------------
- An EM calorimeter with ScFi modules
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:8,ring:8,module:20,fiber_x:8,fiber_y:8
-
-
-
-
-
-
-
diff --git a/compact/unused/ecal_forward_shashlik.xml b/compact/unused/ecal_forward_shashlik.xml
deleted file mode 100644
index b28af9a76..000000000
--- a/compact/unused/ecal_forward_shashlik.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Common Generic visualization attributes
-
-
-
-
-
-
- ------------------------------------------
- Forward (Positive Z) Endcap EM Calorimeter
- ------------------------------------------
- An EM calorimeter with shashlik hexagon modules
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:8,sector:4,module:24,layer:8,slice:8
-
-
-
-
-
-
-
-
diff --git a/compact/unused/gaseous_rich.xml b/compact/unused/gaseous_rich.xml
deleted file mode 100644
index db3b2bc17..000000000
--- a/compact/unused/gaseous_rich.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- A thin optical material to accept optical photon in simulation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:8,sector:8,module:16,x:32:-16,y:-16
-
-
-
-
diff --git a/compact/unused/mm_tracker_barrel.xml b/compact/unused/mm_tracker_barrel.xml
deleted file mode 100644
index 22d0e3870..000000000
--- a/compact/unused/mm_tracker_barrel.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
-
- Micromegas tracker barrel
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- phi0 : Starting phi of first module.
- phi_tilt : Phi tilt of a module.
- rc : Radius of the module center.
- nphi : Number of modules in phi.
- rphi_dr : The delta radius of every other module.
- z0 : Z position of first module in phi.
- nz : Number of modules to place in z.
- dr : Radial displacement parameter, of every other module.
-
-
-
-
-
-
-
-
-
-
-
- system:8,sector:8,module:14,x:32:-16,y:-16
-
-
-
-
-
-
-
-
-
diff --git a/compact/unused/rwell_tracker_barrel.xml b/compact/unused/rwell_tracker_barrel.xml
deleted file mode 100644
index 664d1eba4..000000000
--- a/compact/unused/rwell_tracker_barrel.xml
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-
-
-
- RWell tracker barrel based on Fun4All implementation https://www.dropbox.com/sh/j4n4g5h80g9tai6/AAAzmXSHRGQCShoSiewe6HCDa?dl=0 Where the detector is constructed in the G4_RWell.C and Build_G4_RWell_Sup01.C files
- original R=(78.67, 90.0)cm,
- DirftGap=(0.4, 0.4)cm,
- Length=(200, 200)cm
- kapton_thickness = 0.0175; //cm
- cu_thickness = 0.002; //cm
- prepreg_thickness = 0.005; //cm
- pcb_thickness = 0.010; //cm
- //inner tube
- support_01_thickness = 0.50;
- support_01_length = 7.2;
- //inner ring
- support_02_thickness = 1.6;
- support_02_length = 1.2;
- //outer ring
- support_03_thickness = 0.50;
- support_03_length = 1.2;
-
- Length=TrackerBarrelOuter_length=(160, 160) cm // to avoid conflict with GEM tracker
- TODO: fix GEM geometry and restore length
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:8,barrel:3,layer:4,module:7,sensor:2,x:32:-16,y:-16
-
-
-
-
-
-
-
-
-
diff --git a/compact/unused/tracking_config_mgpds.xml b/compact/unused/tracking_config_mgpds.xml
deleted file mode 100644
index b2c65ab2d..000000000
--- a/compact/unused/tracking_config_mgpds.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- ### Mixed tracking configuration
-
- This configuration needs attention!
-
-
-
-
-
-
-
-
-
diff --git a/src/CylinderTrackerBarrel_geo.cpp b/src/CylinderTrackerBarrel_geo.cpp
deleted file mode 100644
index 9e1105fae..000000000
--- a/src/CylinderTrackerBarrel_geo.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright (C) 2022 Whitney Armstrong
-
-//==========================================================================
-// Specialized generic detector constructor
-//==========================================================================
-
-#include "DD4hep/DetFactoryHelper.h"
-#include "DD4hep/Printout.h"
-
-using namespace std;
-using namespace dd4hep;
-using namespace dd4hep::detail;
-
-/** A barrel tracker with a module that is curved (not flat).
- *
- * \ingroup tracking
- */
-static Ref_t CylinderTrackerBarrel_create_detector(Detector& description, xml_h e, SensitiveDetector sens)
-{
- typedef vector Placements;
- xml_det_t x_det = e;
- Material air = description.air();
-
- int det_id = x_det.id();
- string det_name = x_det.nameStr();
- DetElement sdet(det_name, det_id);
-
-
- Assembly assembly(det_name);
- map mod_volumes;
- map sensitives;
- PlacedVolume pv;
-
- sens.setType("tracker");
- int n_modules = 0;
- for (xml_coll_t mi(x_det, _U(module)); mi; ++mi) {
- n_modules++;
- xml_comp_t x_mod = mi;
- xml_comp_t m_env = x_mod.child(_U(module_envelope));
- string m_nam = x_mod.nameStr();
-
- Assembly module_assembly(_toString(n_modules, "mod_assembly_%d"));
- auto module_rmin = m_env.rmin();
- auto module_thickness = m_env.thickness();
- auto module_length = m_env.length();
- auto module_phi = getAttrOrDefault(m_env, _Unicode(phi), 90.0);
-
- Volume m_vol(
- m_nam,
- Tube(module_rmin, module_rmin + module_thickness, module_length / 2, -module_phi / 2.0, module_phi / 2.0), air);
- int ncomponents = 0, sensor_number = 1;
- module_assembly.placeVolume(m_vol, Position(-module_rmin, 0, 0));
- mod_volumes[m_nam] = module_assembly;
- m_vol.setVisAttributes(description.visAttributes(x_mod.visStr()));
-
- auto comp_rmin = module_rmin;
- for (xml_coll_t ci(x_mod, _U(module_component)); ci; ++ci, ++ncomponents) {
- xml_comp_t x_comp = ci;
- xml_comp_t x_pos = x_comp.position(false);
- xml_comp_t x_rot = x_comp.rotation(false);
- string c_nam = _toString(ncomponents, "component%d");
-
- auto comp_thickness = x_comp.thickness();
- comp_rmin = getAttrOrDefault(x_comp, _Unicode(rmin), comp_rmin);
- auto comp_phi = getAttrOrDefault(x_comp, _Unicode(phi), module_phi);
- auto comp_phi0 = getAttrOrDefault(x_comp, _Unicode(phi0), 0.0);
- auto comp_length = getAttrOrDefault(x_comp, _Unicode(length), module_length);
-
- Tube c_tube(comp_rmin, comp_rmin + comp_thickness, comp_length / 2, -comp_phi / 2.0 + comp_phi0,
- comp_phi / 2.0 + comp_phi0);
- Volume c_vol(c_nam, c_tube, description.material(x_comp.materialStr()));
- PlacedVolume c_pv;
-
- if (x_pos && x_rot) {
- Position c_pos(x_pos.x(0), x_pos.y(0), x_pos.z(0));
- RotationZYX c_rot(x_rot.z(0), x_rot.y(0), x_rot.x(0));
- c_pv = m_vol.placeVolume(c_vol, Transform3D(c_rot, c_pos));
- } else if (x_rot) {
- c_pv = m_vol.placeVolume(c_vol, RotationZYX(x_rot.z(0), x_rot.y(0), x_rot.x(0)));
- } else if (x_pos) {
- c_pv = m_vol.placeVolume(c_vol, Position(x_pos.x(0), x_pos.y(0), x_pos.z(0)));
- } else {
- c_pv = m_vol.placeVolume(c_vol);
- }
- c_vol.setRegion(description, x_comp.regionStr());
- c_vol.setLimitSet(description, x_comp.limitsStr());
- c_vol.setVisAttributes(description, x_comp.visStr());
- if (x_comp.isSensitive()) {
- c_pv.addPhysVolID(_U(sensor), sensor_number++);
- c_vol.setSensitiveDetector(sens);
- sensitives[m_nam].push_back(c_pv);
- }
- comp_rmin = comp_rmin + comp_thickness;
- }
- }
- for (xml_coll_t li(x_det, _U(layer)); li; ++li) {
- xml_comp_t x_layer = li;
- xml_comp_t x_barrel = x_layer.child(_U(barrel_envelope));
- xml_comp_t x_layout = x_layer.child(_U(rphi_layout));
- xml_comp_t z_layout = x_layer.child(_U(z_layout)); // Get the element.
- int lay_id = x_layer.id();
- string m_nam = x_layer.moduleStr();
- string lay_nam = _toString(x_layer.id(), "layer%d");
- Tube lay_tub(x_barrel.inner_r(), x_barrel.outer_r(), x_barrel.z_length() / 2);
- Volume lay_vol(lay_nam, lay_tub, air); // Create the layer envelope volume.
- lay_vol.setVisAttributes(description.visAttributes(x_layer.visStr()));
- double phi0 = x_layout.phi0(); // Starting phi of first module.
- double phi_tilt = x_layout.phi_tilt(); // Phi tilt of a module.
- double rc = x_layout.rc(); // Radius of the module center.
- int nphi = x_layout.nphi(); // Number of modules in phi.
- double rphi_dr = x_layout.dr(); // The delta radius of every other module.
- double phi_incr = (M_PI * 2) / nphi; // Phi increment for one module.
- double phic = phi0; // Phi of the module center.
- double z0 = z_layout.z0(); // Z position of first module in phi.
- double nz = z_layout.nz(); // Number of modules to place in z.
- double z_dr = z_layout.dr(); // Radial displacement parameter, of every other module.
- Volume m_env = mod_volumes[m_nam];
- DetElement lay_elt(sdet, _toString(x_layer.id(), "layer%d"), lay_id);
-
- Placements& sensVols = sensitives[m_nam];
-
- // Z increment for module placement along Z axis.
- // Adjust for z0 at center of module rather than
- // the end of cylindrical envelope.
- double z_incr = nz > 1 ? (2.0 * z0) / (nz - 1) : 0.0;
- // Starting z for module placement along Z axis.
- double module_z = -z0;
- int module = 1;
-
- // Loop over the number of modules in phi.
- for (int ii = 0; ii < nphi; ii++) {
- double dx = z_dr * std::cos(phic + phi_tilt); // Delta x of module position.
- double dy = z_dr * std::sin(phic + phi_tilt); // Delta y of module position.
- double x = rc * std::cos(phic); // Basic x module position.
- double y = rc * std::sin(phic); // Basic y module position.
-
- // Loop over the number of modules in z.
- for (int j = 0; j < nz; j++) {
- string module_name = _toString(module, "module%d");
- DetElement mod_elt(lay_elt, module_name, module);
- // Module PhysicalVolume.
- // Transform3D
- // tr(RotationZYX(0,-((M_PI/2)-phic-phi_tilt),M_PI/2),Position(x,y,module_z));
- // NOTE (Nikiforos, 26/08 Rotations needed to be fixed so that component1 (silicon) is on the
- // outside
- Transform3D tr(RotationZYX(phic - phi_tilt, 0, 0), Position(x, y, module_z));
-
- pv = lay_vol.placeVolume(m_env, tr);
- pv.addPhysVolID("module", module);
- mod_elt.setPlacement(pv);
- for (size_t ic = 0; ic < sensVols.size(); ++ic) {
- PlacedVolume sens_pv = sensVols[ic];
- DetElement comp_elt(mod_elt, sens_pv.volume().name(), module);
- comp_elt.setPlacement(sens_pv);
-
- }
-
- /// Increase counters etc.
- module++;
- // Adjust the x and y coordinates of the module.
- x += dx;
- y += dy;
- // Flip sign of x and y adjustments.
- dx *= -1;
- dy *= -1;
- // Add z increment to get next z placement pos.
- module_z += z_incr;
- }
- phic += phi_incr; // Increment the phi placement of module.
- rc += rphi_dr; // Increment the center radius according to dr parameter.
- rphi_dr *= -1; // Flip sign of dr parameter.
- module_z = -z0; // Reset the Z placement parameter for module.
- }
- // Create the PhysicalVolume for the layer.
- pv = assembly.placeVolume(lay_vol); // Place layer in mother
- pv.addPhysVolID("layer", lay_id); // Set the layer ID.
- lay_elt.setAttributes(description, lay_vol, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr());
- lay_elt.setPlacement(pv);
- }
- sdet.setAttributes(description, assembly, x_det.regionStr(), x_det.limitsStr(), x_det.visStr());
- // assembly.setVisAttributes(description.invisible());
- pv = description.pickMotherVolume(sdet).placeVolume(assembly);
- pv.addPhysVolID("system", det_id); // Set the subdetector system ID.
- pv.addPhysVolID("barrel", 1); // Flag this as a barrel subdetector.
- sdet.setPlacement(pv);
- return sdet;
-}
-
-// clang-format off
-DECLARE_DETELEMENT(epic_CylinderTrackerBarrel, CylinderTrackerBarrel_create_detector)
-DECLARE_DETELEMENT(epic_MMTrackerBarrel, CylinderTrackerBarrel_create_detector)
-DECLARE_DETELEMENT(epic_RWellTrackerBarrel, CylinderTrackerBarrel_create_detector)
-DECLARE_DETELEMENT(epic_CylinderVertexBarrel, CylinderTrackerBarrel_create_detector)
diff --git a/src/GaseousRICH_geo.cpp b/src/GaseousRICH_geo.cpp
deleted file mode 100644
index 698afbd64..000000000
--- a/src/GaseousRICH_geo.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright (C) 2022 Chao Peng, Whitney Armstrong
-
-//==========================================================================
-// Gaseous Ring Imaging Cherenkov Detector
-//--------------------------------------------------------------------------
-//
-// Author: C. Peng (ANL)
-// Date: 09/30/2020
-//
-//==========================================================================
-
-#include "DD4hep/DetFactoryHelper.h"
-#include "DD4hep/OpticalSurfaces.h"
-#include "DD4hep/Printout.h"
-#include "DDRec/DetectorData.h"
-#include "DDRec/Surface.h"
-#include "GeometryHelpers.h"
-#include "Math/Point2D.h"
-#include "TMath.h"
-#include "TString.h"
-#include
-
-using namespace std;
-using namespace dd4hep;
-using namespace dd4hep::rec;
-
-// headers
-void build_radiator(Detector& desc, Volume& env, xml::Component plm, const Position& offset);
-void build_mirrors(Detector& desc, DetElement& sdet, Volume& env, xml::Component plm, const Position& offset);
-void build_sensors(Detector& desc, Volume& env, xml::Component plm, const Position& offset, SensitiveDetector& sens);
-
-// helper function to get x, y, z if defined in a xml component
-template
-Position get_xml_xyz(XmlComp& comp, dd4hep::xml::Strng_t name)
-{
- Position pos(0., 0., 0.);
- if (comp.hasChild(name)) {
- auto child = comp.child(name);
- pos.SetX(dd4hep::getAttrOrDefault(child, _Unicode(x), 0.));
- pos.SetY(dd4hep::getAttrOrDefault(child, _Unicode(y), 0.));
- pos.SetZ(dd4hep::getAttrOrDefault(child, _Unicode(z), 0.));
- }
- return pos;
-}
-
-// create the detector
-static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetector sens)
-{
- xml::DetElement detElem = handle;
- std::string detName = detElem.nameStr();
- int detID = detElem.id();
-
- DetElement det(detName, detID);
- xml::Component dims = detElem.dimensions();
-
- // build a big envelope for all the components, filled with optical material to ensure transport of optical photons
- double z0 = dims.z0();
- double length = dims.length();
- double rmin = dims.rmin();
- double rmax0 = dims.attr(_Unicode(rmax0));
- double rmax1 = dims.attr(_Unicode(rmax1));
- double rmax2 = dims.attr(_Unicode(rmax2));
- double snout_length = dims.attr(_Unicode(snout_length));
- // fill envelope with radiator materials (need optical property for optical photons)
- auto gasMat = desc.material(dd4hep::getAttrOrDefault(detElem, _Unicode(gas), "AirOptical"));
-
- Cone snout(snout_length / 2.0, rmin, rmax0, rmin, rmax1);
- Tube tank(rmin, rmax2, (length - snout_length) / 2., 0., 2 * M_PI);
- // shift the snout to the left side of tank
- UnionSolid envShape(tank, snout, Position(0., 0., -length / 2.));
- // some reference points
- auto snout_front = Position(0., 0., -(length + snout_length) / 2.);
- // auto snout_end = Position(0., 0., -(length - snout_length)/2.); // tank_front
- // auto tank_end = Position(0., 0., (length - snout_length)/2.);
-
- Volume envVol(detName + "_envelope", envShape, gasMat);
- envVol.setVisAttributes(desc.visAttributes(detElem.visStr()));
-
- // sensitive detector type
- sens.setType("tracker");
-
- // @TODO: place a radiator
- // build_radiator(desc, envVol, detElement.child(_Unicode(radiator)), snout_front);
-
- // place mirrors
- build_mirrors(desc, det, envVol, detElem.child(_Unicode(mirrors)), snout_front);
-
- // place photo-sensors
- build_sensors(desc, envVol, detElem.child(_Unicode(sensors)), snout_front, sens);
-
- Volume motherVol = desc.pickMotherVolume(det);
- PlacedVolume envPV = motherVol.placeVolume(envVol, Position(0, 0, z0) - snout_front);
- envPV.addPhysVolID("system", detID);
- det.setPlacement(envPV);
-
- return det;
-}
-
-// @TODO: implement a radiator, now the envelope serves as the radiator
-void build_radiator(Detector& /* desc */, Volume& /* env */, xml::Component /* plm */, const Position& /* offset */)
-{
- // place holder
-}
-
-// place mirrors
-void build_mirrors(Detector& desc, DetElement& sdet, Volume& env, xml::Component plm, const Position& offset)
-{
- double thickness = dd4hep::getAttrOrDefault(plm, _Unicode(dz), 1. * dd4hep::mm);
- auto mat = desc.material(plm.attr(_Unicode(material)));
- auto vis = desc.visAttributes(plm.attr(_Unicode(vis)));
-
- // optical surface
- OpticalSurfaceManager surfMgr = desc.surfaceManager();
- auto surf =
- surfMgr.opticalSurface(dd4hep::getAttrOrDefault(plm, _Unicode(surface), "MirrorOpticalSurface"));
-
- // placements
- auto gpos = get_xml_xyz(plm, _Unicode(position)) + offset;
- auto grot = get_xml_xyz(plm, _Unicode(position));
- int imod = 1;
- for (xml::Collection_t mir(plm, _Unicode(mirror)); mir; ++mir, ++imod) {
- double rmin = mir.attr(_Unicode(rmin));
- double rmax = mir.attr(_Unicode(rmax));
- double phiw = dd4hep::getAttrOrDefault(mir, _Unicode(phiw), 2. * M_PI);
- double rotz = dd4hep::getAttrOrDefault(mir, _Unicode(rotz), 0.);
- double roty = dd4hep::getAttrOrDefault(mir, _Unicode(roty), 0.);
- double rotx = dd4hep::getAttrOrDefault(mir, _Unicode(rotx), 0.);
-
- Volume vol(Form("mirror_v_dummy%d", imod));
- vol.setMaterial(mat);
- vol.setVisAttributes(vis);
- // mirror curvature
- double curve = dd4hep::getAttrOrDefault(mir, _Unicode(curve), 0.);
- // spherical mirror
- if (curve > 0.) {
- double th1 = std::asin(rmin / curve);
- double th2 = std::asin(rmax / curve);
- vol.setSolid(Sphere(curve, curve + thickness, th1, th2, 0., phiw));
- // plane mirror
- } else {
- vol.setSolid(Tube(rmin, rmax, thickness / 2., 0., phiw));
- }
- // transforms are in a reverse order
- Transform3D tr = Translation3D(gpos.x(), gpos.y(), gpos.z()) * RotationZYX(grot.z(), grot.y(), grot.x()) *
- RotationZ(rotz) // rotation of the piece
- * RotationY(roty) // rotation of the piece
- * RotationX(rotx) // rotation of the piece
- * Translation3D(0., 0., -curve) // move spherical shell to origin (no move for planes)
- * RotationZ(-phiw / 2.); // center phi angle to 0. (-phiw/2., phiw/2.)
- auto pv = env.placeVolume(vol, tr);
- DetElement de(sdet, Form("mirror_de%d", imod), imod);
- de.setPlacement(pv);
- SkinSurface skin(desc, de, Form("mirror_optical_surface%d", imod), surf, vol);
- skin.isValid();
- }
-}
-
-// place photo-sensors
-void build_sensors(Detector& desc, Volume& env, xml::Component plm, const Position& offset, SensitiveDetector& sens)
-{
- // build sensor unit geometry
- auto mod = plm.child(_Unicode(module));
- double sx = mod.attr(_Unicode(sx));
- double sy = mod.attr(_Unicode(sy));
- double sz = mod.attr(_Unicode(sz));
- double gap = mod.attr(_Unicode(gap));
- auto mat = desc.material(mod.attr(_Unicode(material)));
- auto vis = desc.visAttributes(mod.attr(_Unicode(vis)));
-
- Box sensor(sx / 2., sy / 2., sz / 2.);
- Volume svol("sensor_v", sensor, mat);
- svol.setVisAttributes(vis);
-
- // a thin layer of cherenkov gas for accepting optical photons
- auto opt = plm.child(_Unicode(optical));
- double opthick = opt.attr(_Unicode(thickness));
- auto opmat = desc.material(opt.attr(_Unicode(material)));
-
- Box opshape(sx / 2., sy / 2., sz / 2. + opthick / 2.);
- Volume opvol("sensor_v_optical", opshape, opmat);
- opvol.placeVolume(svol, Position(0., 0., 0.));
- opvol.setSensitiveDetector(sens);
-
- // photo-detector plane envelope
- auto gpos = get_xml_xyz(plm, _Unicode(position)) + offset;
- auto grot = get_xml_xyz(plm, _Unicode(position));
- int isec = 1;
- for (xml::Collection_t sec(plm, _Unicode(sector)); sec; ++sec, ++isec) {
- double rmin = sec.attr(_Unicode(rmin));
- double rmax = sec.attr(_Unicode(rmax));
- double phiw = dd4hep::getAttrOrDefault(sec, _Unicode(phiw), 2. * M_PI);
- double rotz = dd4hep::getAttrOrDefault(sec, _Unicode(rotz), 0.);
- double roty = dd4hep::getAttrOrDefault(sec, _Unicode(roty), 0.);
- double rotx = dd4hep::getAttrOrDefault(sec, _Unicode(rotx), 0.);
-
- // fill sensors to the piece
- auto points =
- epic::geo::fillRectangles({0., 0.}, sx + gap, sy + gap, rmin - gap, rmax + gap, -phiw / 2., phiw / 2.);
- int imod = 1;
- for (auto& p : points) {
- // transofrms are in a reversed order
- Transform3D tr = Translation3D(gpos.x(), gpos.y(), gpos.z()) * RotationZYX(grot.z(), grot.y(), grot.x()) *
- RotationZ(rotz) // rotation of the sector
- * RotationY(roty) // rotation of the sector
- * RotationX(rotx) // rotation of the sector
- * Translation3D(p.x(), p.y(), 0.); // place modules in each sector
- auto pv = env.placeVolume(opvol, tr);
- pv.addPhysVolID("sector", isec).addPhysVolID("module", imod++);
- }
- }
-}
-
-//@}
-
-// clang-format off
-DECLARE_DETELEMENT(epic_GaseousRICH, createDetector)
diff --git a/src/ShashlikCalorimeter_geo.cpp b/src/ShashlikCalorimeter_geo.cpp
deleted file mode 100644
index 4b42da901..000000000
--- a/src/ShashlikCalorimeter_geo.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-// SPDX-License-Identifier: LGPL-3.0-or-later
-// Copyright (C) 2022 Chao Peng
-
-//==========================================================================
-// Implementation for shashlik calorimeter modules
-// it supports disk placements with (rmin, rmax), and (phimin, phimax)
-//--------------------------------------------------------------------------
-// Author: Chao Peng (ANL)
-// Date: 06/22/2021
-//==========================================================================
-
-#include "DD4hep/DetFactoryHelper.h"
-#include "GeometryHelpers.h"
-#include
-#include
-#include
-#include
-#include
-#include
-
-using namespace dd4hep;
-
-static void add_disk_shashlik(Detector& desc, Assembly& env, xml::Collection_t& plm, SensitiveDetector& sens, int id);
-
-// helper function to get x, y, z if defined in a xml component
-template
-Position get_xml_xyz(XmlComp& comp, dd4hep::xml::Strng_t name)
-{
- Position pos(0., 0., 0.);
- if (comp.hasChild(name)) {
- auto child = comp.child(name);
- pos.SetX(dd4hep::getAttrOrDefault(child, _Unicode(x), 0.));
- pos.SetY(dd4hep::getAttrOrDefault(child, _Unicode(y), 0.));
- pos.SetZ(dd4hep::getAttrOrDefault(child, _Unicode(z), 0.));
- }
- return pos;
-}
-
-static Ref_t create_detector(Detector& desc, xml::Handle_t handle, SensitiveDetector sens)
-{
- static const std::string func = "ShashlikCalorimeter";
- xml::DetElement detElem = handle;
- std::string detName = detElem.nameStr();
- int detID = detElem.id();
- DetElement det(detName, detID);
- sens.setType("calorimeter");
- // envelope
- Assembly assembly(detName);
-
- // module placement
- xml::Component plm = detElem.child(_Unicode(placements));
- int sector = 1;
- for (xml::Collection_t mod(plm, _Unicode(disk)); mod; ++mod) {
- add_disk_shashlik(desc, assembly, mod, sens, sector++);
- }
-
- // detector position and rotation
- auto pos = get_xml_xyz(detElem, _Unicode(position));
- auto rot = get_xml_xyz(detElem, _Unicode(rotation));
- Volume motherVol = desc.pickMotherVolume(det);
- Transform3D tr = Translation3D(pos.x(), pos.y(), pos.z()) * RotationZYX(rot.z(), rot.y(), rot.x());
- PlacedVolume envPV = motherVol.placeVolume(assembly, tr);
- envPV.addPhysVolID("system", detID);
- det.setPlacement(envPV);
- return det;
-}
-
-// helper function to build module with or w/o wrapper
-std::tuple build_shashlik(Detector& desc, xml::Collection_t& plm, SensitiveDetector& sens)
-{
- auto mod = plm.child(_Unicode(module));
- // a modular volume
- std::string shape = dd4hep::getAttrOrDefault(mod, _Unicode(shape), "square");
- std::transform(shape.begin(), shape.end(), shape.begin(), [](char c) { return std::tolower(c); });
- int nsides = 4;
- if (shape == "hexagon") {
- nsides = 6;
- } else if (shape != "square") {
- std::cerr << "ShashlikCalorimeter Error: Unsupported shape of module " << shape
- << ". Please choose from (square, hexagon). Proceed with square shape." << std::endl;
- }
- double slen = mod.attr(_Unicode(side_length));
- double rmax = slen / 2. / std::sin(M_PI / nsides);
- Layering layering(mod);
- auto len = layering.totalThickness();
-
- // wrapper info
- PolyhedraRegular mpoly(nsides, 0., rmax, len);
- Volume mvol("shashlik_module_vol", mpoly, desc.air());
- mvol.setVisAttributes(desc.visAttributes(dd4hep::getAttrOrDefault(mod, _Unicode(vis), "GreenVis")));
-
- double gap = 0.;
- Volume wvol("shashlik_wrapper_vol");
- if (plm.hasChild(_Unicode(wrapper))) {
- auto wrap = plm.child(_Unicode(wrapper));
- gap = wrap.attr(_Unicode(thickness));
- if (gap > 1e-6 * mm) {
- wvol.setSolid(PolyhedraRegular(nsides, 0., rmax + gap, len));
- wvol.setMaterial(desc.material(wrap.attr(_Unicode(material))));
- wvol.setVisAttributes(desc.visAttributes(dd4hep::getAttrOrDefault(wrap, _Unicode(vis), "WhiteVis")));
- wvol.placeVolume(mvol, Position{0., 0., 0.});
- }
- }
-
- // layer start point
- double lz = -len / 2.;
- int lnum = 1;
- // Loop over the sets of layer elements in the detector.
- for (xml_coll_t li(mod, _U(layer)); li; ++li) {
- int repeat = li.attr(_Unicode(repeat));
- // Loop over number of repeats for this layer.
- for (int j = 0; j < repeat; j++) {
- std::string lname = Form("layer%d", lnum);
- double lthick = layering.layer(lnum - 1)->thickness(); // Layer's thickness.
- PolyhedraRegular lpoly(nsides, 0., rmax, lthick);
- Volume lvol(lname, lpoly, desc.air());
-
- // Loop over the sublayers or slices for this layer.
- int snum = 1;
- double sz = -lthick / 2.;
- for (xml_coll_t si(li, _U(slice)); si; ++si) {
- std::string sname = Form("slice%d", snum);
- double sthick = si.attr(_Unicode(thickness));
- PolyhedraRegular spoly(nsides, 0., rmax, sthick);
- Volume svol(sname, spoly, desc.material(si.attr(_Unicode(material))));
-
- std::string issens = dd4hep::getAttrOrDefault(si, _Unicode(sensitive), "no");
- std::transform(issens.begin(), issens.end(), issens.begin(), [](char c) { return std::tolower(c); });
- if ((issens == "yes") || (issens == "y") || (issens == "true")) {
- svol.setSensitiveDetector(sens);
- }
- svol.setAttributes(desc, dd4hep::getAttrOrDefault(si, _Unicode(region), ""),
- dd4hep::getAttrOrDefault(si, _Unicode(limits), ""),
- dd4hep::getAttrOrDefault(si, _Unicode(vis), "InvisibleNoDaughters"));
-
- // Slice placement.
- auto slicePV = lvol.placeVolume(svol, Position(0, 0, sz + sthick / 2.));
- slicePV.addPhysVolID("slice", snum++);
- // Increment Z position of slice.
- sz += sthick;
- }
-
- // Set region, limitset, and vis of layer.
- lvol.setAttributes(desc, dd4hep::getAttrOrDefault(li, _Unicode(region), ""),
- dd4hep::getAttrOrDefault(li, _Unicode(limits), ""),
- dd4hep::getAttrOrDefault(li, _Unicode(vis), "InvisibleNoDaughters"));
-
- auto layerPV = mvol.placeVolume(lvol, Position(0, 0, lz + lthick / 2));
- layerPV.addPhysVolID("layer", lnum++);
- // Increment to next layer Z position.
- lz += lthick;
- }
- }
-
- if (gap > 1e-6 * mm) {
- return std::make_tuple(wvol, nsides, 2. * std::sin(M_PI / nsides) * (rmax + gap), len);
- } else {
- return std::make_tuple(mvol, nsides, slen, len);
- }
-}
-
-// place disk of modules
-static void add_disk_shashlik(Detector& desc, Assembly& env, xml::Collection_t& plm, SensitiveDetector& sens, int sid)
-{
- auto [mvol, nsides, sidelen, len] = build_shashlik(desc, plm, sens);
- int sector_id = dd4hep::getAttrOrDefault(plm, _Unicode(sector), sid);
- int id_begin = dd4hep::getAttrOrDefault(plm, _Unicode(id_begin), 1);
- double rmin = plm.attr(_Unicode(rmin));
- double rmax = plm.attr(_Unicode(rmax));
- double phimin = dd4hep::getAttrOrDefault(plm, _Unicode(phimin), 0.);
- double phimax = dd4hep::getAttrOrDefault(plm, _Unicode(phimax), 2. * M_PI);
-
- auto points = (nsides == 6) ? epic::geo::fillHexagons({0., 0.}, sidelen, rmin, rmax, phimin, phimax)
- : epic::geo::fillSquares({0., 0.}, sidelen * 1.414, rmin, rmax, phimin, phimax);
- // placement to mother
- auto pos = get_xml_xyz(plm, _Unicode(position));
- auto rot = get_xml_xyz(plm, _Unicode(rotation));
- int mid = 0;
- for (auto& p : points) {
- Transform3D tr = RotationZYX(rot.z(), rot.y(), rot.x()) *
- Translation3D(pos.x() + p.x(), pos.y() + p.y(), pos.z() + len / 2.) *
- RotationZ((nsides == 4) ? 45 * degree : 0);
- auto modPV = env.placeVolume(mvol, tr);
- modPV.addPhysVolID("sector", sector_id).addPhysVolID("module", id_begin + mid++);
- }
-}
-
-DECLARE_DETELEMENT(epic_ShashlikCalorimeter, create_detector)