From 173619f456b24cb6ffa7819671d21924e790ccfb Mon Sep 17 00:00:00 2001
From: Victor Schwan <162138084+Victor-Schwan@users.noreply.github.com>
Date: Thu, 22 Aug 2024 11:21:01 +0200
Subject: [PATCH 001/133] ILD_l5_v11: fix a barrel layer ID (#378)
* 2nd SIT barrel layer ID corrected; error stemed from outcommenting previous 2nd layer
* removed commented layer to avoid any potential issue in the future
---
ILD/compact/ILD_l5_v11/InnerTrackerILD_o1_v01_00.xml | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/ILD/compact/ILD_l5_v11/InnerTrackerILD_o1_v01_00.xml b/ILD/compact/ILD_l5_v11/InnerTrackerILD_o1_v01_00.xml
index 1d5142850..8f1df743f 100644
--- a/ILD/compact/ILD_l5_v11/InnerTrackerILD_o1_v01_00.xml
+++ b/ILD/compact/ILD_l5_v11/InnerTrackerILD_o1_v01_00.xml
@@ -120,13 +120,8 @@ adapted by DJeans to fit into ILD model at FCCee
-
-
From e7cc12336bdfa00e92d24335f2173943fe98d7f9 Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Mon, 5 Aug 2024 08:58:08 +0200
Subject: [PATCH 002/133] copy TrackerBarrel_o1_v06
---
detector/tracker/TrackerBarrel_o1_v06_geo.cpp | 327 ++++++++++++++++++
1 file changed, 327 insertions(+)
create mode 100644 detector/tracker/TrackerBarrel_o1_v06_geo.cpp
diff --git a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
new file mode 100644
index 000000000..92b82cf00
--- /dev/null
+++ b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
@@ -0,0 +1,327 @@
+// Silicon Tracker Barrel implementation for the CLIC detector
+//====================================================================
+//--------------------------------------------------------------------
+//
+// Author : N. Nikiforou (forked from SiTrackerBarrel_geo.cpp
+//
+// Comment: Here each slice of the module has the same transversal
+// dimensions (x,y). Suitable for Surfaces.
+//
+// Comment: You have to use
+#include
+#include "UTIL/LCTrackerConf.h"
+#include
+
+using namespace std;
+
+using dd4hep::Assembly;
+using dd4hep::BUILD_ENVELOPE;
+using dd4hep::Box;
+using dd4hep::DetElement;
+using dd4hep::Detector;
+using dd4hep::ERROR;
+using dd4hep::Material;
+using dd4hep::PlacedVolume;
+using dd4hep::Position;
+using dd4hep::Ref_t;
+using dd4hep::RotationZYX;
+using dd4hep::SensitiveDetector;
+using dd4hep::Transform3D;
+using dd4hep::Tube;
+using dd4hep::Volume;
+using dd4hep::_toString;
+using dd4hep::rec::NeighbourSurfacesData;
+using dd4hep::rec::ZPlanarData;
+
+
+static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector sens) {
+ typedef vector Placements;
+ xml_det_t x_det = e;
+ Material air = theDetector.air();
+ int det_id = x_det.id();
+ string det_name = x_det.nameStr();
+ DetElement sdet (det_name,det_id);
+ // Assembly assembly (det_name);
+ map volumes;
+ map sensitives;
+ PlacedVolume pv;
+
+
+ // for encoding
+ std::string cellIDEncoding = sens.readout().idSpec().fieldDescription();
+ UTIL::BitField64 encoder( cellIDEncoding );
+ encoder.reset();
+ encoder[lcio::LCTrackerCellID::subdet()] = det_id;
+ encoder[lcio::LCTrackerCellID::side()] = lcio::ILDDetID::barrel;
+
+
+ // --- create an envelope volume and position it into the world ---------------------
+
+ Volume envelope = dd4hep::xml::createPlacedEnvelope( theDetector, e , sdet ) ;
+ dd4hep::xml::setDetectorTypeFlag( e, sdet ) ;
+
+ if( theDetector.buildType() == BUILD_ENVELOPE ) return sdet ;
+
+ //-----------------------------------------------------------------------------------
+ ZPlanarData* zPlanarData = new ZPlanarData() ;
+ NeighbourSurfacesData* neighbourSurfacesData = new NeighbourSurfacesData() ;
+
+ sens.setType("tracker");
+
+ //NOTE modules are what is defined in compact. Later we call a "module" as a "sensor".
+ for(xml_coll_t mi(x_det,_U(module)); mi; ++mi) {
+ xml_comp_t x_mod = mi;
+ xml_comp_t m_env = x_mod.child(_U(module_envelope));
+ string m_nam = x_mod.nameStr();
+
+
+ if ( volumes.find(m_nam) != volumes.end() ) {
+ printout(ERROR,"TrackerBarrel","Logics error in building modules.");
+ throw runtime_error("Logic error in building modules.");
+ }
+
+ double module_thickness = 0;
+ for(xml_coll_t incl(x_mod,_U(include)); incl; ++incl) {
+ dd4hep::xml::DocumentHolder doc(dd4hep::xml::DocumentHandler().load(incl, incl.attr_value(_U(ref))));
+ xml_h includes = doc.root();
+ xml_det_t incl_stack = includes;
+ for (xml_coll_t ci(incl_stack, _U(module_component)); ci; ++ci) {
+ xml_comp_t x_comp = ci;
+ module_thickness = module_thickness + x_comp.thickness();
+ }
+ }
+
+ Volume m_vol(m_nam,Box(m_env.width()/2.,m_env.length()/2.,module_thickness/2.),air);
+ volumes[m_nam] = m_vol;
+ m_vol.setVisAttributes(theDetector.visAttributes(x_mod.visStr()));
+
+
+ int ncomponents = 0;
+
+ //First component on top of the list is the innermost one.
+ double position_z= -module_thickness/2.;
+ for(xml_coll_t incl(x_mod,_U(include)); incl; ++incl) {
+ dd4hep::xml::DocumentHolder doc(dd4hep::xml::DocumentHandler().load(incl, incl.attr_value(_U(ref))));
+ xml_h includes = doc.root();
+ xml_det_t incl_stack = includes;
+ for (xml_coll_t ci(incl_stack, _U(module_component)); ci; ++ci, ++ncomponents) {
+ xml_comp_t x_comp = ci;
+ string c_nam = _toString(ncomponents, "component%d");
+ Box c_box(m_env.width() / 2.0, m_env.length() / 2.0, x_comp.thickness() / 2.0);
+ Volume c_vol(c_nam, c_box, theDetector.material(x_comp.materialStr()));
+
+
+ pv = m_vol.placeVolume(c_vol, Position(0, 0, position_z + x_comp.thickness() / 2.0));
+
+ c_vol.setRegion(theDetector, x_comp.regionStr());
+ c_vol.setLimitSet(theDetector, x_comp.limitsStr());
+ c_vol.setVisAttributes(theDetector, x_comp.visStr());
+ if (x_comp.isSensitive()) {
+ // pv.addPhysVolID("wafer",wafer_number++);
+ c_vol.setSensitiveDetector(sens);
+ sensitives[m_nam].push_back(pv);
+ }
+
+ position_z += x_comp.thickness();
+ }
+ }
+ }
+ for(xml_coll_t li(x_det,_U(layer)); li; ++li) {
+ xml_comp_t x_layer = li;
+ 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();
+ // int type = x_layer.type();
+ string m_nam = x_layer.moduleStr();
+ string lay_nam = _toString(x_layer.id(),"layer%d");
+ Assembly lay_vol (lay_nam); // Create the layer envelope volume.
+ double phi0 = x_layout.phi0(); // Starting phi of first sensor.
+ double phi_tilt = x_layout.phi_tilt(); // Phi tilt of a sensor.
+ double rc = x_layout.rc(); // Radius of the sensor center.
+ int nphi = x_layout.nphi(); // Number of sensors in phi.
+ double rphi_dr = x_layout.dr(); // The delta radius of every other sensor.
+
+ double phi_incr = (M_PI * 2) / nphi; // Phi increment for one sensor.
+ double phic = phi0; // Phi of the sensor center.
+ double z0 = z_layout.z0(); // Z position of first sensor in phi.
+ double nz = z_layout.nz(); // Number of sensors to place in z.
+ double z_dr = z_layout.dr(); // Radial displacement parameter, of every other sensor.
+ Volume m_env = volumes[m_nam];
+ DetElement lay_elt(sdet,_toString(x_layer.id(),"layer%d"),lay_id);
+ Placements& waferVols = sensitives[m_nam];
+
+ // Z increment for sensor placement along Z axis.
+ // Adjust for z0 at center of sensor rather than
+ // the end of cylindrical envelope.
+ double z_incr = nz > 1 ? (2.0 * z0) / (nz - 1) : 0.0;
+ // Starting z for sensor placement along Z axis.
+ double sensor_z = -z0;
+ int module_idx =0;
+
+
+ ZPlanarData::LayerLayout thisLayer ;
+
+
+ // Loop over the number of sensors in phi.
+ for (int ii = 0; ii < nphi; ii++) {
+ double dx = z_dr * std::cos(phic + phi_tilt); // Delta x of sensor position.
+ double dy = z_dr * std::sin(phic + phi_tilt); // Delta y of sensor position.
+ double x = rc * std::cos(phic); // Basic x sensor position.
+ double y = rc * std::sin(phic); // Basic y sensor position.
+
+ // Loop over the number of sensors in z.
+ //Create stave FIXME disable for now
+ string module_name = _toString(module_idx,"module%d");
+ // DetElement module_elt(lay_elt,module_name,module_idx);
+ int sensor_idx = 0;
+
+ for (int j = 0; j < nz; j++) {
+ string sensor_name = _toString(sensor_idx,"sensor%d");
+
+ ///////////////////
+
+ //get cellID and fill map< cellID of surface, vector of cellID of neighbouring surfaces >
+
+ //encoding
+
+ encoder[lcio::LCTrackerCellID::layer()] = lay_id;
+ encoder[lcio::LCTrackerCellID::module()] = module_idx;
+ encoder[lcio::LCTrackerCellID::sensor()] = sensor_idx;
+
+ const dd4hep::CellID cellID = encoder.lowWord(); // 32 bits
+
+ //compute neighbours
+
+ int n_neighbours_module = 1; // 1 gives the adjacent modules (i do not think we would like to change this)
+ int n_neighbours_sensor = 1;
+
+ int newmodule=0, newsensor=0;
+
+ for(int imodule=-n_neighbours_module; imodule<=n_neighbours_module; imodule++){ // neighbouring modules
+ for(int isensor=-n_neighbours_sensor; isensor<=n_neighbours_sensor; isensor++){ // neighbouring sensors
+
+ if (imodule==0 && isensor==0) continue; // cellID we started with
+ newmodule = module_idx + imodule;
+ newsensor = sensor_idx + isensor;
+
+ //compute special case at the boundary
+ //general computation to allow (if necessary) more then adjacent neighbours (ie: +-2)
+
+ if (newmodule < 0) newmodule = nphi + newmodule;
+ if (newmodule >= nphi) newmodule = newmodule - nphi;
+
+ if (newsensor < 0 || newsensor >= nz) continue; //out of the stave
+
+ //encoding
+ encoder[lcio::LCTrackerCellID::module()] = newmodule;
+ encoder[lcio::LCTrackerCellID::sensor()] = newsensor;
+
+ neighbourSurfacesData->sameLayer[cellID].push_back(encoder.lowWord());
+
+ }
+ }
+
+ ///////////////////
+
+
+ //FIXME
+ sensor_name = module_name + sensor_name;
+
+ DetElement sens_elt(lay_elt,sensor_name,sensor_idx);
+ // Module PhysicalVolume.
+ Transform3D tr(RotationZYX(0,((M_PI/2)-phic-phi_tilt),-M_PI/2),Position(x,y,sensor_z));
+
+ //FIXME
+ pv = lay_vol.placeVolume(m_env,tr);
+ pv.addPhysVolID(_U(module), module_idx);
+ pv.addPhysVolID(_U(sensor), sensor_idx);
+ sens_elt.setPlacement(pv);
+ for(size_t ic=0; icGetMatrix()->GetTranslation();
+ double half_module_thickness = mod_shape->GetDZ();
+ double half_silicon_thickness = comp_shape->GetDZ();
+
+ double sensitive_z_position = trans[2];
+
+ double inner_thickness = half_module_thickness - sensitive_z_position;
+
+ thisLayer.distanceSupport = rc ;
+
+ thisLayer.offsetSupport = 0;
+ thisLayer.thicknessSupport = inner_thickness- half_silicon_thickness;
+ thisLayer.zHalfSupport = z0 + mod_shape->GetDY();
+ thisLayer.widthSupport = 2*mod_shape->GetDX();
+
+ thisLayer.distanceSensitive = rc+sensitive_z_position;
+ thisLayer.offsetSensitive = 0. ;
+ thisLayer.thicknessSensitive = 2*half_silicon_thickness;//Assembled along Z
+ //Changed by Thorben Quast (same applies to zHalfSupport)
+ //z0 = center of most right sensor, comp_shape-GetDY() = half length of one sensitive are of the module
+ thisLayer.zHalfSensitive = z0 + comp_shape->GetDY();
+ thisLayer.widthSensitive = 2*comp_shape->GetDX();
+ thisLayer.ladderNumber = (int) nphi ;
+ thisLayer.phi0 = phic;
+ }
+
+ }
+
+
+ /// Increase counters etc.
+ sensor_idx++;
+ // Adjust the x and y coordinates of the sensor.
+ x += dx;
+ y += dy;
+ // Flip sign of x and y adjustments.
+ dx *= -1;
+ dy *= -1;
+ // Add z increment to get next z placement pos.
+ sensor_z += z_incr;
+ }
+ module_idx++;
+ phic += phi_incr; // Increment the phi placement of sensor.
+ rc += rphi_dr; // Increment the center radius according to dr parameter.
+ rphi_dr *= -1; // Flip sign of dr parameter.
+ sensor_z = -z0; // Reset the Z placement parameter for sensor.
+ }
+ // Create the PhysicalVolume for the layer.
+ pv = envelope.placeVolume(lay_vol); // Place layer in mother
+ pv.addPhysVolID("layer", lay_id); // Set the layer ID.
+ lay_elt.setAttributes(theDetector,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr());
+ lay_elt.setPlacement(pv);
+
+ zPlanarData->layers.push_back( thisLayer ) ;
+
+ }
+ sdet.setAttributes(theDetector,envelope,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
+ sdet.addExtension< ZPlanarData >( zPlanarData ) ;
+ sdet.addExtension< NeighbourSurfacesData >( neighbourSurfacesData ) ;
+
+ //envelope.setVisAttributes(theDetector.invisible());
+ /*pv = theDetector.pickMotherVolume(sdet).placeVolume(assembly);
+ pv.addPhysVolID("system", det_id); // Set the subdetector system ID.
+ pv.addPhysVolID("barrel", 0); // Flag this as a barrel subdetector.
+ sdet.setPlacement(pv);*/
+ return sdet;
+}
+
+DECLARE_DETELEMENT(TrackerBarrel_o1_v06, create_detector)
From e55d30ecf9bfad1a548fe883c09cbdc391176216 Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Thu, 8 Aug 2024 16:10:22 +0200
Subject: [PATCH 003/133] copy CLD_o2_v06 to CLD_o2_v07
---
.../BeamInstrumentation_o3_v02_fitShield.xml | 26 +
.../compact/CLD_o2_v07/Beampipe_o4_v05.xml | 158 ++++
FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml | 439 +++++++++
.../CLD_o2_v07/ECalBarrel_o2_v01_03.xml | 66 ++
.../CLD_o2_v07/ECalEndcap_o2_v01_03.xml | 57 ++
.../CLD_o2_v07/HCalBarrel_o1_v01_01.xml | 58 ++
.../CLD_o2_v07/HCalEndcap_o1_v01_01.xml | 131 +++
.../InnerTrackerBarrelModuleDown.xml | 25 +
.../CLD_o2_v07/InnerTrackerBarrelModuleUp.xml | 25 +
.../CLD_o2_v07/InnerTracker_o2_v07.xml | 582 ++++++++++++
.../compact/CLD_o2_v07/LumiCal_o3_v02_04.xml | 188 ++++
.../OuterTrackerBarrelModuleDown.xml | 27 +
.../CLD_o2_v07/OuterTrackerBarrelModuleUp.xml | 27 +
.../CLD_o2_v07/OuterTracker_o2_v07.xml | 226 +++++
.../compact/CLD_o2_v07/Solenoid_o1_v01_02.xml | 54 ++
.../CLD_o2_v07/TrackerDiskModuleIn.xml | 27 +
.../CLD_o2_v07/TrackerDiskModuleOut.xml | 27 +
.../CLD_o2_v07/Vertex_o4_v07_smallBP.xml | 225 +++++
.../CLD_o2_v07/YokeBarrel_o1_v01_02.xml | 68 ++
.../CLD_o2_v07/YokeEndcap_o1_v01_02.xml | 67 ++
FCCee/CLD/compact/CLD_o2_v07/elements.xml | 884 ++++++++++++++++++
FCCee/CLD/compact/CLD_o2_v07/materials.xml | 230 +++++
22 files changed, 3617 insertions(+)
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/BeamInstrumentation_o3_v02_fitShield.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/Beampipe_o4_v05.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/ECalBarrel_o2_v01_03.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/ECalEndcap_o2_v01_03.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/HCalBarrel_o1_v01_01.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/HCalEndcap_o1_v01_01.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleDown.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleUp.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v07.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleDown.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleUp.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v07.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/Solenoid_o1_v01_02.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleIn.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleOut.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/Vertex_o4_v07_smallBP.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/YokeBarrel_o1_v01_02.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/YokeEndcap_o1_v01_02.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/elements.xml
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/materials.xml
diff --git a/FCCee/CLD/compact/CLD_o2_v07/BeamInstrumentation_o3_v02_fitShield.xml b/FCCee/CLD/compact/CLD_o2_v07/BeamInstrumentation_o3_v02_fitShield.xml
new file mode 100644
index 000000000..dba09d325
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/BeamInstrumentation_o3_v02_fitShield.xml
@@ -0,0 +1,26 @@
+
+
+
+ Beampipe Instrumentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/Beampipe_o4_v05.xml b/FCCee/CLD/compact/CLD_o2_v07/Beampipe_o4_v05.xml
new file mode 100644
index 000000000..5610b7225
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/Beampipe_o4_v05.xml
@@ -0,0 +1,158 @@
+
+
+
+ A beampipe for FCCee detector based on CLD
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Part of beampipe made of AlBeMet162 and Paraffin flow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Golden foil in the inner part of the Be beampipe
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Synch Radiation mask inside the beam-pipe, at z = 2.1 m
+
+
+
+
+
+
+
+
+
+
+
+Full Cone Tungsten Shield
+
+
+
+ Beampipe Shield (APS: WHAT????? +18 cm (??plus??) as solenoid is now closer to IP)
+
+
+
+
+
+Asymmetric Tungsten Shield no Rotation
+
+
+
+
+
+
+ was 370. Add 0.1*mm so that rmax1 is larger than rmin1
+
+
+ one degree less, to fit lumical window
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml
new file mode 100644
index 000000000..853cd02d4
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml
@@ -0,0 +1,439 @@
+
+
+
+ The compact format for the FCCee Detector design
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ suggested naming convention:
+
+ main parameters:
+
+ DET_inner_radius : inner radius of tube like envelope ( inscribed cylinder )
+ DET_outer_radius : outer radius of tube like envelope ( circumscribed cylinder )
+ DET_half_length : half length along z axis
+ DET_min_z : smallest absolute value on z-axis
+ DET_max_z : largest absolute value on z-axis
+ DET_inner_symmetry : number of sides on the inside ( 0 for tube )
+ DET_outer_symmetry : number of sides on the inside ( 0 for tube )
+ DET_inner_phi0 : optional rotation of the inner polygon ( in r-phi plane )
+ DET_outer_phi0 : optional rotation of the outer polygon ( in r-phi plane )
+
+ additional parameters for cutting away volumes/shapes use one of the above with a number
+ appended and/or an extra specifiaction such as cone ( for a cut away cone )
+
+ DET_inner_radius_1
+ DET_outer_radius_2
+ DET_cone_min_z
+ DET_cone_max_z
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/ECalBarrel_o2_v01_03.xml b/FCCee/CLD/compact/CLD_o2_v07/ECalBarrel_o2_v01_03.xml
new file mode 100644
index 000000000..abe72e0fa
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/ECalBarrel_o2_v01_03.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+ system:5,side:2,module:8,stave:4,layer:9,submodule:4,x:32:-16,y:-16
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ EM Calorimeter Barrel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/ECalEndcap_o2_v01_03.xml b/FCCee/CLD/compact/CLD_o2_v07/ECalEndcap_o2_v01_03.xml
new file mode 100644
index 000000000..dd84c505f
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/ECalEndcap_o2_v01_03.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+ system:5,side:2,module:8,stave:4,layer:9,submodule:4,x:32:-16,y:-16
+
+
+
+
+
+
+
+
+ Electromagnetic Calorimeter Endcap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/HCalBarrel_o1_v01_01.xml b/FCCee/CLD/compact/CLD_o2_v07/HCalBarrel_o1_v01_01.xml
new file mode 100644
index 000000000..d0ade5fc2
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/HCalBarrel_o1_v01_01.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ system:5,side:2,module:8,stave:4,layer:9,submodule:4,x:32:-16,y:-16
+
+
+
+
+
+
+ Hadron Calorimeter Barrel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/HCalEndcap_o1_v01_01.xml b/FCCee/CLD/compact/CLD_o2_v07/HCalEndcap_o1_v01_01.xml
new file mode 100644
index 000000000..ef70e41e8
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/HCalEndcap_o1_v01_01.xml
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ HCalEndcap Assembly
+
+
+
+
+
+
+
+
+
+
+
+
+ system:5,side:2,module:8,stave:4,layer:9,submodule:4,x:32:-16,y:-16
+
+
+
+ system:5,side:2,module:8,stave:4,layer:9,submodule:4,x:32:-16,y:-16
+
+
+
+
+
+
+
+
+ Hadronic Calorimeter Endcap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Hadronic Calorimeter Endcap
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleDown.xml b/FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleDown.xml
new file mode 100644
index 000000000..12d5d7485
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleDown.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleUp.xml b/FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleUp.xml
new file mode 100644
index 000000000..a81418293
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/InnerTrackerBarrelModuleUp.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v07.xml
new file mode 100644
index 000000000..8406b1115
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v07.xml
@@ -0,0 +1,582 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tracking detectors
+
+
+
+
+
+
+
+
+
+
+
+
+ Inner Tracker Assembly
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${GlobalTrackerReadoutID}
+
+
+ ${GlobalTrackerReadoutID}
+
+
+
+
+
+
+
+
+
+ Silicon Inner Tracker Barrel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Silicon Inner Tracker Endcaps
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3.5959*cm = X0 for Carbon fibre
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The next section is the cable for the vertex
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml
new file mode 100644
index 000000000..cbc708e20
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+
+
+ system:8,barrel:3,layer:8,slice:8,r:32:-16,phi:-16
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleDown.xml b/FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleDown.xml
new file mode 100644
index 000000000..8c0303810
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleDown.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleUp.xml b/FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleUp.xml
new file mode 100644
index 000000000..12a1efe2e
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/OuterTrackerBarrelModuleUp.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v07.xml
new file mode 100644
index 000000000..fb8e27d9b
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v07.xml
@@ -0,0 +1,226 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tracking detectors
+
+
+
+
+ Outer Tracker Assembly
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${GlobalTrackerReadoutID}
+
+
+ ${GlobalTrackerReadoutID}
+
+
+
+
+
+
+
+
+
+
+ Silicon Outer Tracker Barrel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Silicon Outer Tracker Endcaps
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/Solenoid_o1_v01_02.xml b/FCCee/CLD/compact/CLD_o2_v07/Solenoid_o1_v01_02.xml
new file mode 100644
index 000000000..634f3cab3
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/Solenoid_o1_v01_02.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Solenoid
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleIn.xml b/FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleIn.xml
new file mode 100644
index 000000000..12a1efe2e
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleIn.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleOut.xml b/FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleOut.xml
new file mode 100644
index 000000000..8c0303810
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/TrackerDiskModuleOut.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FCCee/CLD/compact/CLD_o2_v07/Vertex_o4_v07_smallBP.xml b/FCCee/CLD/compact/CLD_o2_v07/Vertex_o4_v07_smallBP.xml
new file mode 100644
index 000000000..8082039f9
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/Vertex_o4_v07_smallBP.xml
@@ -0,0 +1,225 @@
+
+
+
+
+ Tracking detectors
+
+
+
+
+
+
+
+
+
+
+ Vertex Assembly
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${GlobalTrackerReadoutID}
+
+
+ ${GlobalTrackerReadoutID}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Vertex Detector Endcaps
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/YokeBarrel_o1_v01_02.xml b/FCCee/CLD/compact/CLD_o2_v07/YokeBarrel_o1_v01_02.xml
new file mode 100644
index 000000000..5d4e62d73
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/YokeBarrel_o1_v01_02.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ system:5,side:2,layer:9,module:8,stave:4,submodule:4,x:32:-16,y:-16
+
+
+
+
+
+
+
+ Yoke Calorimeter Barrel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/YokeEndcap_o1_v01_02.xml b/FCCee/CLD/compact/CLD_o2_v07/YokeEndcap_o1_v01_02.xml
new file mode 100644
index 000000000..e4503843b
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/YokeEndcap_o1_v01_02.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+ system:5,side:2,module:8,stave:4,layer:9,submodule:4,x:32:-16,y:-16
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Encap Yoke
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/elements.xml b/FCCee/CLD/compact/CLD_o2_v07/elements.xml
new file mode 100644
index 000000000..8358bac36
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/elements.xml
@@ -0,0 +1,884 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FCCee/CLD/compact/CLD_o2_v07/materials.xml b/FCCee/CLD/compact/CLD_o2_v07/materials.xml
new file mode 100644
index 000000000..acdb4a66a
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/materials.xml
@@ -0,0 +1,230 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 9adea87a73b7814dcc694ae1b96f95834680bb9c Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Thu, 8 Aug 2024 16:22:21 +0200
Subject: [PATCH 004/133] update version
---
.../CLD_o2_v07/{CLD_o2_v06.xml => CLD_o2_v07.xml} | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
rename FCCee/CLD/compact/CLD_o2_v07/{CLD_o2_v06.xml => CLD_o2_v07.xml} (98%)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
similarity index 98%
rename from FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml
rename to FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
index 853cd02d4..3f30e801d 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v06.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
@@ -2,12 +2,12 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/compact/1.0/compact.xsd">
-
+ version="7">
The compact format for the FCCee Detector design
@@ -297,8 +297,6 @@
-
-
From 0db37600f87a3e034263358aade395e5c48a706b Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Thu, 8 Aug 2024 16:22:50 +0200
Subject: [PATCH 005/133] Use new TrackerBarrel
---
FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml | 2 ++
.../{InnerTracker_o2_v07.xml => InnerTracker_o2_v08.xml} | 2 +-
.../{OuterTracker_o2_v07.xml => OuterTracker_o2_v08.xml} | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
rename FCCee/CLD/compact/CLD_o2_v07/{InnerTracker_o2_v07.xml => InnerTracker_o2_v08.xml} (99%)
rename FCCee/CLD/compact/CLD_o2_v07/{OuterTracker_o2_v07.xml => OuterTracker_o2_v08.xml} (99%)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
index 3f30e801d..10954f514 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
@@ -297,6 +297,8 @@
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml
similarity index 99%
rename from FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v07.xml
rename to FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml
index 8406b1115..e31978c98 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v07.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml
@@ -80,7 +80,7 @@
-
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v08.xml
similarity index 99%
rename from FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v07.xml
rename to FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v08.xml
index fb8e27d9b..073799501 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v07.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/OuterTracker_o2_v08.xml
@@ -57,7 +57,7 @@
-
+
From c8a5694609d00cbbac8e70447cc176f3c0f6e69a Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Fri, 9 Aug 2024 13:29:43 +0200
Subject: [PATCH 006/133] TrackerBarrel_o1_v06 remove using namespace std
---
detector/tracker/TrackerBarrel_o1_v06_geo.cpp | 24 +++++++++----------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
index 92b82cf00..e09c79836 100644
--- a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
+++ b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
@@ -21,8 +21,6 @@
#include "UTIL/LCTrackerConf.h"
#include
-using namespace std;
-
using dd4hep::Assembly;
using dd4hep::BUILD_ENVELOPE;
using dd4hep::Box;
@@ -44,15 +42,15 @@ using dd4hep::rec::ZPlanarData;
static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector sens) {
- typedef vector Placements;
+ typedef std::vector Placements;
xml_det_t x_det = e;
Material air = theDetector.air();
int det_id = x_det.id();
- string det_name = x_det.nameStr();
+ std::string det_name = x_det.nameStr();
DetElement sdet (det_name,det_id);
// Assembly assembly (det_name);
- map volumes;
- map sensitives;
+ std::map volumes;
+ std::map sensitives;
PlacedVolume pv;
@@ -81,12 +79,12 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
for(xml_coll_t mi(x_det,_U(module)); mi; ++mi) {
xml_comp_t x_mod = mi;
xml_comp_t m_env = x_mod.child(_U(module_envelope));
- string m_nam = x_mod.nameStr();
+ std::string m_nam = x_mod.nameStr();
if ( volumes.find(m_nam) != volumes.end() ) {
printout(ERROR,"TrackerBarrel","Logics error in building modules.");
- throw runtime_error("Logic error in building modules.");
+ throw std::runtime_error("Logic error in building modules.");
}
double module_thickness = 0;
@@ -115,7 +113,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
xml_det_t incl_stack = includes;
for (xml_coll_t ci(incl_stack, _U(module_component)); ci; ++ci, ++ncomponents) {
xml_comp_t x_comp = ci;
- string c_nam = _toString(ncomponents, "component%d");
+ std::string c_nam = _toString(ncomponents, "component%d");
Box c_box(m_env.width() / 2.0, m_env.length() / 2.0, x_comp.thickness() / 2.0);
Volume c_vol(c_nam, c_box, theDetector.material(x_comp.materialStr()));
@@ -141,8 +139,8 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
xml_comp_t z_layout = x_layer.child(_U(z_layout)); // Get the element.
int lay_id = x_layer.id();
// int type = x_layer.type();
- string m_nam = x_layer.moduleStr();
- string lay_nam = _toString(x_layer.id(),"layer%d");
+ std::string m_nam = x_layer.moduleStr();
+ std::string lay_nam = _toString(x_layer.id(),"layer%d");
Assembly lay_vol (lay_nam); // Create the layer envelope volume.
double phi0 = x_layout.phi0(); // Starting phi of first sensor.
double phi_tilt = x_layout.phi_tilt(); // Phi tilt of a sensor.
@@ -180,12 +178,12 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
// Loop over the number of sensors in z.
//Create stave FIXME disable for now
- string module_name = _toString(module_idx,"module%d");
+ std::string module_name = _toString(module_idx,"module%d");
// DetElement module_elt(lay_elt,module_name,module_idx);
int sensor_idx = 0;
for (int j = 0; j < nz; j++) {
- string sensor_name = _toString(sensor_idx,"sensor%d");
+ std::string sensor_name = _toString(sensor_idx,"sensor%d");
///////////////////
From 1281fc673c27b04916df4321613059aa0f1ed5ea Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Fri, 9 Aug 2024 14:12:26 +0200
Subject: [PATCH 007/133] move NeighbourSurfacesData population into a function
---
detector/tracker/TrackerBarrel_o1_v06_geo.cpp | 80 ++++++++++---------
1 file changed, 42 insertions(+), 38 deletions(-)
diff --git a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
index e09c79836..7df9479fc 100644
--- a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
+++ b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
@@ -40,6 +40,40 @@ using dd4hep::_toString;
using dd4hep::rec::NeighbourSurfacesData;
using dd4hep::rec::ZPlanarData;
+void populateNeighbourData(NeighbourSurfacesData* neighbourSurfacesData, UTIL::BitField64& encoder, int module_idx, int sensor_idx, int nphi, int nz) {
+ const dd4hep::CellID cellID = encoder.lowWord(); // 32 bits
+
+ //compute neighbours
+ int n_neighbours_module = 1; // 1 gives the adjacent modules (i do not think we would like to change this)
+ int n_neighbours_sensor = 1;
+
+ int newmodule=0, newsensor=0;
+
+ for(int imodule=-n_neighbours_module; imodule<=n_neighbours_module; imodule++){ // neighbouring modules
+ for(int isensor=-n_neighbours_sensor; isensor<=n_neighbours_sensor; isensor++){ // neighbouring sensors
+
+ if (imodule==0 && isensor==0) continue; // cellID we started with
+ newmodule = module_idx + imodule;
+ newsensor = sensor_idx + isensor;
+
+ //compute special case at the boundary
+ //general computation to allow (if necessary) more then adjacent neighbours (ie: +-2)
+
+ if (newmodule < 0) newmodule = nphi + newmodule;
+ if (newmodule >= nphi) newmodule = newmodule - nphi;
+
+ if (newsensor < 0 || newsensor >= nz) continue; //out of the stave
+
+ //encoding
+ encoder[lcio::LCTrackerCellID::module()] = newmodule;
+ encoder[lcio::LCTrackerCellID::sensor()] = newsensor;
+
+ neighbourSurfacesData->sameLayer[cellID].push_back(encoder.lowWord());
+
+ }
+ }
+
+}
static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector sens) {
typedef std::vector Placements;
@@ -185,50 +219,20 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
for (int j = 0; j < nz; j++) {
std::string sensor_name = _toString(sensor_idx,"sensor%d");
- ///////////////////
-
- //get cellID and fill map< cellID of surface, vector of cellID of neighbouring surfaces >
-
- //encoding
-
- encoder[lcio::LCTrackerCellID::layer()] = lay_id;
- encoder[lcio::LCTrackerCellID::module()] = module_idx;
- encoder[lcio::LCTrackerCellID::sensor()] = sensor_idx;
-
- const dd4hep::CellID cellID = encoder.lowWord(); // 32 bits
-
- //compute neighbours
-
- int n_neighbours_module = 1; // 1 gives the adjacent modules (i do not think we would like to change this)
- int n_neighbours_sensor = 1;
-
- int newmodule=0, newsensor=0;
+ ///////////////////
- for(int imodule=-n_neighbours_module; imodule<=n_neighbours_module; imodule++){ // neighbouring modules
- for(int isensor=-n_neighbours_sensor; isensor<=n_neighbours_sensor; isensor++){ // neighbouring sensors
-
- if (imodule==0 && isensor==0) continue; // cellID we started with
- newmodule = module_idx + imodule;
- newsensor = sensor_idx + isensor;
+ //get cellID and fill map< cellID of surface, vector of cellID of neighbouring surfaces >
- //compute special case at the boundary
- //general computation to allow (if necessary) more then adjacent neighbours (ie: +-2)
-
- if (newmodule < 0) newmodule = nphi + newmodule;
- if (newmodule >= nphi) newmodule = newmodule - nphi;
+ //encoding
- if (newsensor < 0 || newsensor >= nz) continue; //out of the stave
+ encoder[lcio::LCTrackerCellID::layer()] = lay_id;
+ encoder[lcio::LCTrackerCellID::module()] = module_idx;
+ encoder[lcio::LCTrackerCellID::sensor()] = sensor_idx;
- //encoding
- encoder[lcio::LCTrackerCellID::module()] = newmodule;
- encoder[lcio::LCTrackerCellID::sensor()] = newsensor;
-
- neighbourSurfacesData->sameLayer[cellID].push_back(encoder.lowWord());
+ populateNeighbourData(neighbourSurfacesData, encoder, module_idx, sensor_idx, nphi, nz);
- }
- }
- ///////////////////
+ ///////////////////
//FIXME
From acbbcd380b5a4e47356dea7eeae0f4d35c82e3a9 Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Fri, 9 Aug 2024 15:02:16 +0200
Subject: [PATCH 008/133] Move LayerLayout population out of the sensor loop
---
detector/tracker/TrackerBarrel_o1_v06_geo.cpp | 67 +++++++++----------
1 file changed, 30 insertions(+), 37 deletions(-)
diff --git a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
index 7df9479fc..341aa8704 100644
--- a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
+++ b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
@@ -201,7 +201,36 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
ZPlanarData::LayerLayout thisLayer ;
-
+ /// GET GEAR INFORMATION
+ /// NOTE WORKS ONLY FOR ONE WAFER
+ Box mod_shape(m_env.solid()), comp_shape(waferVols[0].volume().solid());
+
+ const double* trans = waferVols[0]->GetMatrix()->GetTranslation();
+ double half_module_thickness = mod_shape->GetDZ();
+ double half_silicon_thickness = comp_shape->GetDZ();
+
+ double sensitive_z_position = trans[2];
+
+ double inner_thickness = half_module_thickness - sensitive_z_position;
+
+ thisLayer.distanceSupport = rc ;
+
+ thisLayer.offsetSupport = 0;
+ thisLayer.thicknessSupport = inner_thickness- half_silicon_thickness;
+ thisLayer.zHalfSupport = z0 + mod_shape->GetDY();
+ thisLayer.widthSupport = 2*mod_shape->GetDX();
+
+ thisLayer.distanceSensitive = rc+sensitive_z_position;
+ thisLayer.offsetSensitive = 0. ;
+ thisLayer.thicknessSensitive = 2*half_silicon_thickness;//Assembled along Z
+ //Changed by Thorben Quast (same applies to zHalfSupport)
+ //z0 = center of most right sensor, comp_shape-GetDY() = half length of one sensitive are of the module
+ thisLayer.zHalfSensitive = z0 + comp_shape->GetDY();
+ thisLayer.widthSensitive = 2*comp_shape->GetDX();
+ thisLayer.ladderNumber = nphi;
+ thisLayer.phi0 = phic;
+ zPlanarData->layers.push_back(thisLayer);
+
// Loop over the number of sensors in phi.
for (int ii = 0; ii < nphi; ii++) {
@@ -252,39 +281,6 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
PlacedVolume wafer_pv = waferVols[ic];
DetElement comp_elt(sens_elt,wafer_pv.volume().name(),sensor_idx);
comp_elt.setPlacement(wafer_pv);
-
- ///GET GEAR INFORMATION FROM FIRST "MODULE" IN Z AND phi
- ///NOTE WORKS ONLY FOR ONE WAFER
- if (ii==0 && j==0 && ic==0){
-
- Box mod_shape(m_env.solid()), comp_shape(wafer_pv.volume().solid());
-
- const double* trans = comp_elt.placement()->GetMatrix()->GetTranslation();
- double half_module_thickness = mod_shape->GetDZ();
- double half_silicon_thickness = comp_shape->GetDZ();
-
- double sensitive_z_position = trans[2];
-
- double inner_thickness = half_module_thickness - sensitive_z_position;
-
- thisLayer.distanceSupport = rc ;
-
- thisLayer.offsetSupport = 0;
- thisLayer.thicknessSupport = inner_thickness- half_silicon_thickness;
- thisLayer.zHalfSupport = z0 + mod_shape->GetDY();
- thisLayer.widthSupport = 2*mod_shape->GetDX();
-
- thisLayer.distanceSensitive = rc+sensitive_z_position;
- thisLayer.offsetSensitive = 0. ;
- thisLayer.thicknessSensitive = 2*half_silicon_thickness;//Assembled along Z
- //Changed by Thorben Quast (same applies to zHalfSupport)
- //z0 = center of most right sensor, comp_shape-GetDY() = half length of one sensitive are of the module
- thisLayer.zHalfSensitive = z0 + comp_shape->GetDY();
- thisLayer.widthSensitive = 2*comp_shape->GetDX();
- thisLayer.ladderNumber = (int) nphi ;
- thisLayer.phi0 = phic;
- }
-
}
@@ -310,9 +306,6 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
pv.addPhysVolID("layer", lay_id); // Set the layer ID.
lay_elt.setAttributes(theDetector,lay_vol,x_layer.regionStr(),x_layer.limitsStr(),x_layer.visStr());
lay_elt.setPlacement(pv);
-
- zPlanarData->layers.push_back( thisLayer ) ;
-
}
sdet.setAttributes(theDetector,envelope,x_det.regionStr(),x_det.limitsStr(),x_det.visStr());
sdet.addExtension< ZPlanarData >( zPlanarData ) ;
From 86199ad3bdbbb68f99eafaaeaa5f267636300b2a Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Mon, 12 Aug 2024 10:41:58 +0200
Subject: [PATCH 009/133] refactor LayerLayout population into function
---
detector/tracker/TrackerBarrel_o1_v06_geo.cpp | 65 ++++++++++---------
1 file changed, 36 insertions(+), 29 deletions(-)
diff --git a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
index 341aa8704..8051d0f53 100644
--- a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
+++ b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
@@ -75,6 +75,41 @@ void populateNeighbourData(NeighbourSurfacesData* neighbourSurfacesData, UTIL::B
}
+ZPlanarData::LayerLayout buildLayerLayout(double radius, int staves, double phi0, double z0, Volume module, PlacedVolume sensor) {
+ ZPlanarData::LayerLayout thisLayer ;
+ /// GET GEAR INFORMATION
+ /// NOTE WORKS ONLY FOR ONE WAFER
+ /// FIXME: does not take phi_dr and z_dr into account.
+ Box mod_shape(module.solid()), comp_shape(sensor.volume().solid());
+
+ const double* trans = sensor->GetMatrix()->GetTranslation();
+ double half_module_thickness = mod_shape->GetDZ();
+ double half_silicon_thickness = comp_shape->GetDZ();
+
+ double sensitive_z_position = trans[2];
+
+ double inner_thickness = half_module_thickness - sensitive_z_position;
+
+ thisLayer.distanceSupport = radius;
+
+ thisLayer.offsetSupport = 0;
+ thisLayer.thicknessSupport = inner_thickness- half_silicon_thickness;
+ thisLayer.zHalfSupport = z0 + mod_shape->GetDY();
+ thisLayer.widthSupport = 2*mod_shape->GetDX();
+
+ thisLayer.distanceSensitive = radius + sensitive_z_position;
+ thisLayer.offsetSensitive = 0. ;
+ thisLayer.thicknessSensitive = 2*half_silicon_thickness;//Assembled along Z
+ //Changed by Thorben Quast (same applies to zHalfSupport)
+ //z0 = center of most right sensor, comp_shape-GetDY() = half length of one sensitive are of the module
+ thisLayer.zHalfSensitive = z0 + comp_shape->GetDY();
+ thisLayer.widthSensitive = 2*comp_shape->GetDX();
+ thisLayer.ladderNumber = staves;
+ thisLayer.phi0 = phi0;
+
+ return thisLayer;
+}
+
static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector sens) {
typedef std::vector Placements;
xml_det_t x_det = e;
@@ -200,35 +235,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
int module_idx =0;
- ZPlanarData::LayerLayout thisLayer ;
- /// GET GEAR INFORMATION
- /// NOTE WORKS ONLY FOR ONE WAFER
- Box mod_shape(m_env.solid()), comp_shape(waferVols[0].volume().solid());
-
- const double* trans = waferVols[0]->GetMatrix()->GetTranslation();
- double half_module_thickness = mod_shape->GetDZ();
- double half_silicon_thickness = comp_shape->GetDZ();
-
- double sensitive_z_position = trans[2];
-
- double inner_thickness = half_module_thickness - sensitive_z_position;
-
- thisLayer.distanceSupport = rc ;
-
- thisLayer.offsetSupport = 0;
- thisLayer.thicknessSupport = inner_thickness- half_silicon_thickness;
- thisLayer.zHalfSupport = z0 + mod_shape->GetDY();
- thisLayer.widthSupport = 2*mod_shape->GetDX();
-
- thisLayer.distanceSensitive = rc+sensitive_z_position;
- thisLayer.offsetSensitive = 0. ;
- thisLayer.thicknessSensitive = 2*half_silicon_thickness;//Assembled along Z
- //Changed by Thorben Quast (same applies to zHalfSupport)
- //z0 = center of most right sensor, comp_shape-GetDY() = half length of one sensitive are of the module
- thisLayer.zHalfSensitive = z0 + comp_shape->GetDY();
- thisLayer.widthSensitive = 2*comp_shape->GetDX();
- thisLayer.ladderNumber = nphi;
- thisLayer.phi0 = phic;
+ ZPlanarData::LayerLayout thisLayer = buildLayerLayout(rc, nphi, phi0, z0, m_env, waferVols[0]);
zPlanarData->layers.push_back(thisLayer);
From 6135d1f03f7e060a1292ef977d53ae42c6930828 Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Wed, 14 Aug 2024 09:34:25 +0200
Subject: [PATCH 010/133] TrackerBarrel_o1_v06 add assembly stave
---
detector/tracker/TrackerBarrel_o1_v06_geo.cpp | 129 +++++++++---------
1 file changed, 62 insertions(+), 67 deletions(-)
diff --git a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
index 8051d0f53..9ba5c30f0 100644
--- a/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
+++ b/detector/tracker/TrackerBarrel_o1_v06_geo.cpp
@@ -31,7 +31,9 @@ using dd4hep::Material;
using dd4hep::PlacedVolume;
using dd4hep::Position;
using dd4hep::Ref_t;
-using dd4hep::RotationZYX;
+using dd4hep::Rotation3D;
+using dd4hep::RotationX;
+using dd4hep::RotationZ;
using dd4hep::SensitiveDetector;
using dd4hep::Transform3D;
using dd4hep::Tube;
@@ -144,6 +146,7 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
sens.setType("tracker");
+ // TODO: refactor module creation code into a function...
//NOTE modules are what is defined in compact. Later we call a "module" as a "sensor".
for(xml_coll_t mi(x_det,_U(module)); mi; ++mi) {
xml_comp_t x_mod = mi;
@@ -218,42 +221,70 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
double rphi_dr = x_layout.dr(); // The delta radius of every other sensor.
double phi_incr = (M_PI * 2) / nphi; // Phi increment for one sensor.
- double phic = phi0; // Phi of the sensor center.
double z0 = z_layout.z0(); // Z position of first sensor in phi.
double nz = z_layout.nz(); // Number of sensors to place in z.
double z_dr = z_layout.dr(); // Radial displacement parameter, of every other sensor.
- Volume m_env = volumes[m_nam];
+ Volume sensorVol = volumes[m_nam];
DetElement lay_elt(sdet,_toString(x_layer.id(),"layer%d"),lay_id);
Placements& waferVols = sensitives[m_nam];
-
+
+ ZPlanarData::LayerLayout thisLayer = buildLayerLayout(rc, nphi, phi0, z0, sensorVol, waferVols[0]);
+ zPlanarData->layers.push_back(thisLayer);
+
+ Assembly stave("stave");
// Z increment for sensor placement along Z axis.
// Adjust for z0 at center of sensor rather than
// the end of cylindrical envelope.
- double z_incr = nz > 1 ? (2.0 * z0) / (nz - 1) : 0.0;
- // Starting z for sensor placement along Z axis.
- double sensor_z = -z0;
- int module_idx =0;
-
-
- ZPlanarData::LayerLayout thisLayer = buildLayerLayout(rc, nphi, phi0, z0, m_env, waferVols[0]);
- zPlanarData->layers.push_back(thisLayer);
+ DetElement staveElementTemplate("staveElementTemplate", 0);
+ double z_incr = nz > 1 ? (2.0 * z0) / (nz - 1) : 0.0;
+ for (int i = 0; i < nz; i++)
+ {
+ // sensor/module still lives in a world where:
+ // x: width, y: length, z: thickness
+ // we construct the stave in the same way,
+ // i.e. the modules are placed along y from z0 to -z0
+ // and dr is applied along z
+ double y = z0 - i * z_incr;
+ double z = i % 2 == 0 ? 0 : z_dr;
+ Position pos(0., y, z);
+ auto sensorPv = stave.placeVolume(sensorVol, pos);
+ sensorPv.addPhysVolID("sensor", i);
+ std::string sensorName = _toString(i, "sensor%d");
+ DetElement sensorElement(sensorName, i);
+ staveElementTemplate.add(sensorElement);
+ sensorElement.setPlacement(sensorPv);
+
+ // also add a DetElement for the sensitive component
+ for (const PlacedVolume& wafer_pv : waferVols) {
+ DetElement comp_elt(sensorElement, wafer_pv.volume().name(), i);
+ comp_elt.setPlacement(wafer_pv);
+ }
+ }
-
- // Loop over the number of sensors in phi.
- for (int ii = 0; ii < nphi; ii++) {
- double dx = z_dr * std::cos(phic + phi_tilt); // Delta x of sensor position.
- double dy = z_dr * std::sin(phic + phi_tilt); // Delta y of sensor position.
- double x = rc * std::cos(phic); // Basic x sensor position.
- double y = rc * std::sin(phic); // Basic y sensor position.
-
- // Loop over the number of sensors in z.
- //Create stave FIXME disable for now
- std::string module_name = _toString(module_idx,"module%d");
- // DetElement module_elt(lay_elt,module_name,module_idx);
- int sensor_idx = 0;
-
- for (int j = 0; j < nz; j++) {
- std::string sensor_name = _toString(sensor_idx,"sensor%d");
+ // Loop over the number of staves in phi.
+ for (int i = 0; i < nphi; i++)
+ {
+ double dr = i % 2 == 0 ? 0 : rphi_dr;
+ double r = rc + dr;
+ double phi = phi0 + i * phi_incr;
+ double x = r * std::cos(phi); // Basic x stave position.
+ double y = r * std::sin(phi); // Basic y stave position.
+
+ // module: stave
+ std::string moduleName = _toString(i, "module%d");
+ // stave has x: width, y: length, z: thickness (pointing outwards)
+ // rotate -pi/2 around x to align length with z
+ // rotate -p/2 * phi around z to point outwards again
+ Rotation3D rotation = RotationZ(-M_PI/2 + phi + phi_tilt) * RotationX(-M_PI/2);
+ Transform3D transform(rotation, Position(x, y, 0.));
+ auto stavePv = lay_vol.placeVolume(stave, transform);
+ stavePv.addPhysVolID("module", i);
+ DetElement staveElement = staveElementTemplate.clone(moduleName, i);
+ staveElement.setPlacement(stavePv);
+ lay_elt.add(staveElement);
+
+ for (int j = 0; j < nz; j++)
+ {
///////////////////
@@ -262,51 +293,15 @@ static Ref_t create_detector(Detector& theDetector, xml_h e, SensitiveDetector s
//encoding
encoder[lcio::LCTrackerCellID::layer()] = lay_id;
- encoder[lcio::LCTrackerCellID::module()] = module_idx;
- encoder[lcio::LCTrackerCellID::sensor()] = sensor_idx;
+ encoder[lcio::LCTrackerCellID::module()] = i;
+ encoder[lcio::LCTrackerCellID::sensor()] = j;
- populateNeighbourData(neighbourSurfacesData, encoder, module_idx, sensor_idx, nphi, nz);
+ populateNeighbourData(neighbourSurfacesData, encoder, i, j, nphi, nz);
///////////////////
-
- //FIXME
- sensor_name = module_name + sensor_name;
-
- DetElement sens_elt(lay_elt,sensor_name,sensor_idx);
- // Module PhysicalVolume.
- Transform3D tr(RotationZYX(0,((M_PI/2)-phic-phi_tilt),-M_PI/2),Position(x,y,sensor_z));
-
- //FIXME
- pv = lay_vol.placeVolume(m_env,tr);
- pv.addPhysVolID(_U(module), module_idx);
- pv.addPhysVolID(_U(sensor), sensor_idx);
- sens_elt.setPlacement(pv);
- for(size_t ic=0; ic
Date: Thu, 22 Aug 2024 16:08:18 +0200
Subject: [PATCH 011/133] add tracking volume
---
FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
index 10954f514..c45519d6e 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
@@ -254,6 +254,22 @@
+
+
+
+
+
+
+
+
+
+
+
From 0e922ed9d3d28123728a4b9bc30b6b7852225ccf Mon Sep 17 00:00:00 2001
From: Leonhard Reichenbach
Date: Mon, 19 Aug 2024 09:03:03 +0200
Subject: [PATCH 012/133] update README
---
FCCee/CLD/compact/README.md | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/FCCee/CLD/compact/README.md b/FCCee/CLD/compact/README.md
index bcd254a15..c53c2223e 100644
--- a/FCCee/CLD/compact/README.md
+++ b/FCCee/CLD/compact/README.md
@@ -39,6 +39,13 @@ CLD_o2_v06
This model is based on `CLD_o2_v05` with the following changes: LumiCal outer radius from 112 mm to 115 mm, remove
unused nose shield parameters, place LumiCal at 1074*mm along the beam-axis, instead of at 1074*mm in Z, moves LumiCal by 100*micron.
+CLD_o2_v07
+----------
+
+This model is based on `CLD_o2_v06` with the following changes: reduced loading time by adding stave assemblies in the tracker barrel.
+Additionally, a non-cylindrical (polycone) tracking volume was added that excludes the LumiCal. To profit from this feature the `Geant4TVUserParticleHandler`
+needs to be used in `ddsim`. The definitions for the cylindrical volume were kept to be backwards compatible to the `Geant4TCUserParticleHandler`.
+
CLD_o3_v01
----------
From f8b5a1592b6d6e2ccf62aa861fb3ca3f74f0ed89 Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Thu, 4 Jul 2024 19:40:29 +0200
Subject: [PATCH 013/133] addExtensionsToHCalAllegro
---
.../HCalEndcaps_ThreeParts_TileCal.xml | 31 +-
.../HCalThreePartsEndcap_o1_v01_geo.cpp | 896 +++++++++---------
.../calorimeter/HCalTileBarrel_o1_v01_geo.cpp | 92 +-
3 files changed, 535 insertions(+), 484 deletions(-)
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
index c5cbe72a7..cc1e2190f 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
@@ -44,20 +44,23 @@
-
- system:4,type:2,layer:5,row:9,eta:11,phi:10
+
+ system:4,type:2,layer:5,row:9,theta:11,phi:10
-
-
- system:4,type:2,layer:4,eta:11,phi:10
+
+
+ system:4,type:2,layer:5,theta:11,phi:10
-
-
- system:4,type:2,layer:5,row:9,eta:10,phi:10
+
+ system:4,type:2,layer:5,row:9,theta:0,phi:10
+
+
@@ -70,7 +73,7 @@
@@ -78,17 +81,17 @@
diff --git a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
index 34544c2e2..1baccf00c 100644
--- a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
@@ -1,467 +1,487 @@
// DD4hep
#include "DD4hep/DetFactoryHelper.h"
+#include
// todo: remove gaudi logging and properly capture output
#define endmsg std::endl
#define lLog std::cout
namespace MSG {
-const std::string DEBUG = " Debug: ";
-const std::string INFO = " Info: ";
+const std::string ERROR = "createHCalThrePartsEndcap ERROR ";
+const std::string DEBUG = "createHCalThrePartsEndcap DEBUG ";
+const std::string INFO = "createHCalThrePartsEndcap INFO ";
}
using dd4hep::Volume;
using dd4hep::DetElement;
using dd4hep::xml::Dimension;
using dd4hep::PlacedVolume;
+using xml_comp_t = dd4hep::xml::Component;
+using xml_det_t = dd4hep::xml::DetElement;
+using xml_h = dd4hep::xml::Handle_t;
namespace det {
-void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4hep::Volume& aEnvelope,
- dd4hep::DetElement& aHCal, xml_det_t aXmlElement, int sign) {
-
- dd4hep::SensitiveDetector sensDet = aSensDet;
- Dimension sensDetType = aXmlElement.child(_Unicode(sensitive));
- sensDet.setType(sensDetType.typeStr());
-
- Dimension dimensions(aXmlElement.child(_Unicode(dimensions)));
- xml_comp_t xEndPlate = aXmlElement.child(_Unicode(end_plate));
- double dZEndPlate = xEndPlate.thickness() / 2.;
- xml_comp_t xFacePlate = aXmlElement.child(_Unicode(face_plate));
- double dRhoFacePlate = xFacePlate.thickness() / 2.;
- xml_comp_t xSpace = aXmlElement.child(_Unicode(plate_space)); // to avoid overlaps
- double space = xSpace.thickness();
- xml_comp_t xSteelSupport = aXmlElement.child(_Unicode(steel_support));
- double dSteelSupport = xSteelSupport.thickness();
- lLog << MSG::DEBUG << "steel support thickness " << dSteelSupport << endmsg;
- lLog << MSG::DEBUG << "steel support material " << xSteelSupport.materialStr() << endmsg;
-
- double sensitiveBarrel1Rmin = dimensions.rmin1() + 2 * dRhoFacePlate + space;
- double sensitiveBarrel2Rmin = dimensions.rmin2() + 2 * dRhoFacePlate + space;
- double sensitiveBarrel3Rmin = dimensions.rmin() + 2 * dRhoFacePlate + space;
-
- // Offset in z is given as distance from 0 to the middle of the Calorimeter volume
- double extBarrelOffset1 = dimensions.offset();
- double extBarrelOffset2 = dimensions.z_offset();
- double extBarrelOffset3 = dimensions.v_offset();
-
- // Hard-coded assumption that we have two different sequences for the modules
- std::vector sequences = {aXmlElement.child(_Unicode(sequence_a)), aXmlElement.child(_Unicode(sequence_b))};
- // NOTE: This assumes that both have the same dimensions!
- Dimension sequenceDimensions(sequences[1].dimensions());
- double dzSequence = sequenceDimensions.dz();
- lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
-
- // calculate the number of modules fitting in Z
- unsigned int numSequencesZ1 = static_cast((2 * dimensions.width() - 2 * dZEndPlate - space) / dzSequence);
- unsigned int numSequencesZ2 = static_cast((2 * dimensions.dz() - 2 * dZEndPlate - space) / dzSequence);
- unsigned int numSequencesZ3 = static_cast((2 * dimensions.z_length() - 2 * dZEndPlate - space) / dzSequence);
-
- unsigned int numSequencesR1 = 0;
- unsigned int numSequencesR2 = 0;
- unsigned int numSequencesR3 = 0;
- double moduleDepth1 = 0.;
- double moduleDepth2 = 0.;
- double moduleDepth3 = 0.;
- std::vector layerDepths1 = std::vector();
- std::vector layerDepths2 = std::vector();
- std::vector layerDepths3 = std::vector();
-
- // get all 'layer' children of the 'layers' tag
- std::vector Layers;
- for (xml_coll_t xCompColl(aXmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl;
- ++xCompColl) {
- Layers.push_back(xCompColl);
- }
-
- for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it) {
- xml_comp_t layer = *it;
- Dimension layerDimension(layer.dimensions());
- numSequencesR1 += layerDimension.nmodules();
- numSequencesR2 += layerDimension.nModules();
- numSequencesR3 += layerDimension.nPads();
- for (int nLayer = 0; nLayer < layerDimension.nmodules(); nLayer++) {
- moduleDepth1 += layerDimension.dr();
- layerDepths1.push_back(layerDimension.dr());
- }
- for (int nLayer = 0; nLayer < layerDimension.nModules(); nLayer++) {
- moduleDepth2 += layerDimension.dr();
- layerDepths2.push_back(layerDimension.dr());
- }
- for (int nLayer = 0; nLayer < layerDimension.nPads(); nLayer++) {
- moduleDepth3 += layerDimension.dr();
- layerDepths3.push_back(layerDimension.dr());
+static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4hep::SensitiveDetector sensDet){
+ xml_det_t xmlDet = xmlElement;
+ std::string detName = xmlDet.nameStr();
+
+ // Make DetElement
+ dd4hep::DetElement caloDetElem(detName, xmlDet.id());
+
+ // Make volume that envelopes the whole barrel; set material to air
+ Dimension dimensions(xmlDet.dimensions());
+
+ dd4hep::Tube envelope(dimensions.rmin(), dimensions.rmax1(), (dimensions.v_offset() + dimensions.z_length()));
+ dd4hep::Tube negative1(dimensions.rmin(), dimensions.rmax1(), (dimensions.offset() - dimensions.width()));
+ dd4hep::Tube negative2(dimensions.rmin(), dimensions.rmin1(), (dimensions.z_offset() - dimensions.dz()));
+ dd4hep::Tube negative3(dimensions.rmin(), dimensions.rmin2(), (dimensions.v_offset() - dimensions.z_length()));
+
+ dd4hep::SubtractionSolid envelopeShapeTmp1(envelope, negative1);
+ dd4hep::SubtractionSolid envelopeShapeTmp2(envelopeShapeTmp1, negative2);
+ dd4hep::SubtractionSolid envelopeShape(envelopeShapeTmp2, negative3);
+
+ Volume envelopeVolume(detName + "_volume", envelopeShape, lcdd.air());
+ envelopeVolume.setVisAttributes(lcdd, dimensions.visStr());
+
+ // Set sensitive detector type
+ Dimension sensDetType = xmlElement.child(_Unicode(sensitive));
+ sensDet.setType(sensDetType.typeStr());
+
+ // Dimension dimensions(xmlElement.child(_Unicode(dimensions)));
+ xml_comp_t xEndPlate = xmlElement.child(_Unicode(end_plate));
+ double dZEndPlate = xEndPlate.thickness() / 2.;
+ xml_comp_t xFacePlate = xmlElement.child(_Unicode(face_plate));
+ double dRhoFacePlate = xFacePlate.thickness() / 2.;
+ xml_comp_t xSpace = xmlElement.child(_Unicode(plate_space)); // to avoid overlaps
+ double space = xSpace.thickness();
+ xml_comp_t xSteelSupport = xmlElement.child(_Unicode(steel_support));
+ double dSteelSupport = xSteelSupport.thickness();
+ lLog << MSG::DEBUG << "steel support thickness " << dSteelSupport << endmsg;
+ lLog << MSG::DEBUG << "steel support material " << xSteelSupport.materialStr() << endmsg;
+
+ // Calculate sensitive barrel dimensions
+ double sensitiveBarrel1Rmin = dimensions.rmin1() + 2 * dRhoFacePlate + space;
+ double sensitiveBarrel2Rmin = dimensions.rmin2() + 2 * dRhoFacePlate + space;
+ double sensitiveBarrel3Rmin = dimensions.rmin() + 2 * dRhoFacePlate + space;
+
+ // Offset in z is given as distance from 0 to the middle of the Calorimeter volume
+ double extBarrelOffset1 = dimensions.offset();
+ double extBarrelOffset2 = dimensions.z_offset();
+ double extBarrelOffset3 = dimensions.v_offset();
+
+ // Hard-coded assumption that we have two different sequences for the modules
+ std::vector sequences = {xmlElement.child(_Unicode(sequence_a)), xmlElement.child(_Unicode(sequence_b))};
+ // NOTE: This assumes that both have the same dimensions!
+ Dimension sequenceDimensions(sequences[1].dimensions());
+ double dzSequence = sequenceDimensions.dz();
+ lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
+
+ // calculate the number of modules fitting in Z
+ unsigned int numSequencesZ1 = static_cast((2 * dimensions.width() - 2 * dZEndPlate - space) / dzSequence);
+ unsigned int numSequencesZ2 = static_cast((2 * dimensions.dz() - 2 * dZEndPlate - space) / dzSequence);
+ unsigned int numSequencesZ3 = static_cast((2 * dimensions.z_length() - 2 * dZEndPlate - space) / dzSequence);
+
+ unsigned int numSequencesR1 = 0;
+ unsigned int numSequencesR2 = 0;
+ unsigned int numSequencesR3 = 0;
+ double moduleDepth1 = 0.;
+ double moduleDepth2 = 0.;
+ double moduleDepth3 = 0.;
+
+ // MM: using layers and Layers is not very fortunate
+ std::vector layerDepths1 = std::vector();
+ std::vector layerDepths2 = std::vector();
+ std::vector layerDepths3 = std::vector();
+
+ // get all 'layer' children of the 'layers' tag
+ std::vector Layers;
+ for (xml_coll_t xCompColl(xmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl){
+ Layers.push_back(xCompColl);
}
- }
-
- lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << numSequencesR1
- << " , which end up to a full module depth in rho of " << moduleDepth1 << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << layerDepths1.size() << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << numSequencesR2
- << " , which end up to a full module depth in rho of " << moduleDepth2 << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << layerDepths2.size() << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << numSequencesR3
- << " , which end up to a full module depth in rho of " << moduleDepth3 << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << layerDepths3.size() << endmsg;
-
- lLog << MSG::INFO << "constructing first part EC: with offset " << extBarrelOffset1 << ": "<< numSequencesZ1
- << " rings in Z, " << numSequencesR1 << " layers in Rho, " << numSequencesR1 * numSequencesZ1
- << " tiles" << endmsg;
-
- lLog << MSG::INFO << "constructing second part EC: with offset " << extBarrelOffset2 << ": " << numSequencesZ2
- << " rings in Z, " << numSequencesR2 << " layers in Rho, "
- << layerDepths2.size() * numSequencesZ2 << " tiles" << endmsg;
-
- lLog << MSG::INFO << "constructing third part EC: with offset " << extBarrelOffset3 << ": " << numSequencesZ3
- << " rings in Z, " << numSequencesR3 << " layers in Rho, "
- << layerDepths3.size() * numSequencesZ3 << " tiles" << endmsg;
-
- lLog << MSG::INFO << "number of channels: "
- << (numSequencesR1 * numSequencesZ1) + (numSequencesR2 * numSequencesZ2) + (numSequencesR3 * numSequencesZ3)
- << endmsg;
-
- // Calculate correction along z based on the module size (can only have natural number of modules)
- double dzDetector1 = (numSequencesZ1 * dzSequence) / 2 + 2 * dZEndPlate + space;
- lLog << MSG::INFO
- << "correction of dz (negative = size reduced) first part EC :" << dzDetector1*2 - dimensions.width()*2
- << endmsg;
- double dzDetector2 = (numSequencesZ2 * dzSequence) / 2;
- lLog << MSG::INFO << "dz second part EC:" << dzDetector2 * 2
- << endmsg;
- lLog << MSG::INFO << "width second part EC:" << dimensions.dz() * 2
- << endmsg;
- lLog << MSG::INFO << "correction of dz (negative = size reduced) second part EB:" << dzDetector2*2 - dimensions.dz()*2
- << endmsg;
-
- double dzDetector3 = (numSequencesZ3 * dzSequence) / 2 + 2 * dZEndPlate + space;
- lLog << MSG::INFO << "dz third part EC:" << dzDetector2 * 2
- << endmsg;
-
- // Add structural support made of steel inside of HCal
- DetElement facePlate1(aHCal, "FacePlate_" + std::to_string(1 * sign), 0);
- dd4hep::Tube facePlateShape1(dimensions.rmin1(), (sensitiveBarrel1Rmin - space),
- (dzDetector1 - 2 * dZEndPlate - space));
- Volume facePlateVol1("facePlateVol1", facePlateShape1, aLcdd.material(xFacePlate.materialStr()));
- facePlateVol1.setVisAttributes(aLcdd, xFacePlate.visStr());
- dd4hep::Position offsetFace1(0, 0, sign * extBarrelOffset1);
-
- // Faceplate for 2nd part of extended Barrel
- DetElement facePlate2(aHCal, "FacePlate_" + std::to_string(2 * sign), 0);
- dd4hep::Tube facePlateShape2(dimensions.rmin2(), (sensitiveBarrel2Rmin - space),
- dzDetector2);
- Volume facePlateVol2("facePlateVol2", facePlateShape2, aLcdd.material(xFacePlate.materialStr()));
- facePlateVol2.setVisAttributes(aLcdd, xFacePlate.visStr());
- dd4hep::Position offsetFace2(0, 0, sign * extBarrelOffset2);
-
- // Faceplate for 3rd part of extended Barrel
- DetElement facePlate3(aHCal, "FacePlate_" + std::to_string(3 * sign), 0);
- dd4hep::Tube facePlateShape3(dimensions.rmin(), (sensitiveBarrel3Rmin - space),
- (dzDetector3 - 2 * dZEndPlate - space));
- Volume facePlateVol3("facePlateVol3", facePlateShape3, aLcdd.material(xFacePlate.materialStr()));
- facePlateVol3.setVisAttributes(aLcdd, xFacePlate.visStr());
- dd4hep::Position offsetFace3(0, 0, sign * extBarrelOffset3);
-
- PlacedVolume placedFacePlate1 = aEnvelope.placeVolume(facePlateVol1, offsetFace1);
- facePlate1.setPlacement(placedFacePlate1);
- PlacedVolume placedFacePlate2 = aEnvelope.placeVolume(facePlateVol2, offsetFace2);
- facePlate2.setPlacement(placedFacePlate2);
- PlacedVolume placedFacePlate3 = aEnvelope.placeVolume(facePlateVol3, offsetFace3);
- facePlate3.setPlacement(placedFacePlate3);
-
- // Add structural support made of steel at both ends of extHCal
- dd4hep::Tube endPlateShape1(dimensions.rmin1(), (dimensions.rmax1() - dSteelSupport), dZEndPlate);
- Volume endPlateVol1("endPlateVol1", endPlateShape1, aLcdd.material(xEndPlate.materialStr()));
- endPlateVol1.setVisAttributes(aLcdd, xEndPlate.visStr());
- dd4hep::Tube endPlateShape3(dimensions.rmin(), (dimensions.rmax() - dSteelSupport), dZEndPlate);
- Volume endPlateVol3("endPlateVol3", endPlateShape3, aLcdd.material(xEndPlate.materialStr()));
- endPlateVol3.setVisAttributes(aLcdd, xEndPlate.visStr());
-
- // Endplates placed for the extended Barrels in front and in the back to the central Barrel
- DetElement endPlatePos(aHCal, "endPlate_" + std::to_string(1 * sign), 0);
- dd4hep::Position posOffset(0, 0, sign * (extBarrelOffset3 + dzDetector3 - dZEndPlate));
- PlacedVolume placedEndPlatePos = aEnvelope.placeVolume(endPlateVol3, posOffset);
- endPlatePos.setPlacement(placedEndPlatePos);
-
- DetElement endPlateNeg(aHCal, "endPlate_" + std::to_string(2 * sign), 0);
- dd4hep::Position negOffset(0, 0, sign * (extBarrelOffset1 - dzDetector1 + dZEndPlate));
- PlacedVolume placedEndPlateNeg = aEnvelope.placeVolume(endPlateVol1, negOffset);
- endPlateNeg.setPlacement(placedEndPlateNeg);
-
- std::vector layers;
- layers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
- std::vector > seqInLayers;
- seqInLayers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
- std::vector tilesPerLayer;
- tilesPerLayer.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
-
- // loop over R ("layers")
- double layerR = 0.;
- for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer) {
- // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
- double rminLayer = sensitiveBarrel1Rmin + layerR;
- double rmaxLayer = sensitiveBarrel1Rmin + layerR + layerDepths1.at(idxLayer);
- layerR += layerDepths1.at(idxLayer);
-
- //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
- unsigned int sequenceIdx = (idxLayer+1) % 2;
-
- dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalECTileSequenceVol1", tileSequenceShape, aLcdd.air());
-
- lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
-
- dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector1 );
- Volume layerVolume("HCalECLayerVol1", layerShape, aLcdd.air());
-
- layerVolume.setVisAttributes(aLcdd.invisible());
- unsigned int idxSubMod = 0;
-
- dd4hep::Position moduleOffset1 (0,0,sign * extBarrelOffset1);
-
- dd4hep::PlacedVolume placedLayerVolume = aEnvelope.placeVolume(layerVolume, moduleOffset1);
- unsigned int type1 = 0;
- if (sign<0) {
- type1 = 3;
- }
- placedLayerVolume.addPhysVolID("type", type1); // First module type=0,3 in front of second +/-
- placedLayerVolume.addPhysVolID("layer", idxLayer);
- layers.push_back(placedLayerVolume);
-
- double tileZOffset = - 0.5* dzSequence;
-
- // first Z loop (tiles that make up a sequence)
- for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
- ++xCompColl, ++idxSubMod) {
- xml_comp_t xComp = xCompColl;
- dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
-
- Volume tileVol("HCalECTileVol_"+ xComp.materialStr()
- , tileShape,
- aLcdd.material(xComp.materialStr()));
- tileVol.setVisAttributes(aLcdd, xComp.visStr());
-
- dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
- dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
-
- if (xComp.isSensitive()) {
- tileVol.setSensitiveDetector(sensDet);
- tilesPerLayer.push_back(placedTileVol);
- }
- tileZOffset += xComp.thickness();
+ for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it){
+ xml_comp_t layer = *it;
+ Dimension layerDimension(layer.dimensions());
+ numSequencesR1 += layerDimension.nmodules();
+ numSequencesR2 += layerDimension.nModules();
+ numSequencesR3 += layerDimension.nPads();
+
+ for (int nLayer = 0; nLayer < layerDimension.nmodules(); nLayer++){
+ moduleDepth1 += layerDimension.dr();
+ layerDepths1.push_back(layerDimension.dr());
+ }
+ for (int nLayer = 0; nLayer < layerDimension.nModules(); nLayer++){
+ moduleDepth2 += layerDimension.dr();
+ layerDepths2.push_back(layerDimension.dr());
+ }
+ for (int nLayer = 0; nLayer < layerDimension.nPads(); nLayer++){
+ moduleDepth3 += layerDimension.dr();
+ layerDepths3.push_back(layerDimension.dr());
+ }
}
- // second z loop (place sequences in layer)
- std::vector seqs;
- double zOffset = - dzDetector1 + 0.5 * dzSequence; //2*dZEndPlate + space + 0.5 * dzSequence;
-
- for (uint numSeq=0; numSeq < numSequencesZ1; numSeq++){
- dd4hep::Position tileSequencePosition(0, 0, zOffset);
- dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
- placedTileSequenceVolume.addPhysVolID("row", numSeq);
- seqs.push_back(placedTileSequenceVolume);
- zOffset += dzSequence;
+ lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << numSequencesR1 << " , which end up to a full module depth in rho of " << moduleDepth1 << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << numSequencesR2 << " , which end up to a full module depth in rho of " << moduleDepth2 << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << numSequencesR3 << " , which end up to a full module depth in rho of " << moduleDepth3 << " cm" << endmsg;
+
+ lLog << MSG::INFO << "constructing first part EC: with z offset " << extBarrelOffset1 << " cm: "<< numSequencesZ1 << " sequences in Z, " << numSequencesR1 << " layers in Rho, " << numSequencesR1 * numSequencesZ1 << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing second part EC: with offset " << extBarrelOffset2 << " cm: " << numSequencesZ2 << " sequences in Z, " << numSequencesR2 << " layers in Rho, " << layerDepths2.size() * numSequencesZ2 << " tiles" << endmsg;
+
+ lLog << MSG::INFO << "constructing third part EC: with offset " << extBarrelOffset3 << " cm: " << numSequencesZ3 << " sequences in Z, " << numSequencesR3 << " layers in Rho, " << layerDepths3.size() * numSequencesZ3 << " tiles" << endmsg;
+
+ lLog << MSG::INFO << "number of channels: " << (numSequencesR1 * numSequencesZ1) + (numSequencesR2 * numSequencesZ2) + (numSequencesR3 * numSequencesZ3) << endmsg;
+
+ // Calculate correction along z based on the module size (can only have natural number of modules)
+ double dzDetector1 = (numSequencesZ1 * dzSequence) / 2 + 2 * dZEndPlate + space;
+ double dzDetector2 = (numSequencesZ2 * dzSequence) / 2;
+ double dzDetector3 = (numSequencesZ3 * dzSequence) / 2 + 2 * dZEndPlate + space;
+
+ lLog << MSG::INFO << "correction of dz (negative = size reduced) first part EC :" << dzDetector1*2 - dimensions.width()*2 << endmsg;
+ lLog << MSG::INFO << "dz second part EC:" << dzDetector2 * 2 << endmsg;
+ lLog << MSG::INFO << "width second part EC:" << dimensions.dz() * 2 << endmsg;
+ lLog << MSG::INFO << "correction of dz (negative = size reduced) second part EB:" << dzDetector2*2 - dimensions.dz()*2 << endmsg;
+
+ lLog << MSG::INFO << "dz third part EC:" << dzDetector2 * 2 << endmsg;
+
+
+ for (int iSign = 0; iSign < 2; iSign++){
+ int sign;
+ if(iSign == 0){
+ sign = +1;
+ lLog << MSG::DEBUG << "Placing detector on the positive side: (cm) " << (dimensions.offset() + dimensions.dz()) << endmsg;
+ }
+ else{
+ sign = -1;
+ lLog << MSG::DEBUG << "Placing detector on the negative side: (cm) " << -(dimensions.offset() + dimensions.dz()) << endmsg;
+ }
+ // Add structural support made of steel inside of HCal
+ DetElement facePlate1(caloDetElem, "FacePlate_" + std::to_string(1 * sign), 0);
+ dd4hep::Tube facePlateShape1(dimensions.rmin1(), (sensitiveBarrel1Rmin - space), (dzDetector1 - 2 * dZEndPlate - space));
+ Volume facePlateVol1("facePlateVol1", facePlateShape1, lcdd.material(xFacePlate.materialStr()));
+ facePlateVol1.setVisAttributes(lcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace1(0, 0, sign * extBarrelOffset1);
+
+ // Faceplate for 2nd part of extended Barrel
+ DetElement facePlate2(caloDetElem, "FacePlate_" + std::to_string(2 * sign), 0);
+ dd4hep::Tube facePlateShape2(dimensions.rmin2(), (sensitiveBarrel2Rmin - space),
+ dzDetector2);
+ Volume facePlateVol2("facePlateVol2", facePlateShape2, lcdd.material(xFacePlate.materialStr()));
+ facePlateVol2.setVisAttributes(lcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace2(0, 0, sign * extBarrelOffset2);
+
+ // Faceplate for 3rd part of extended Barrel
+ DetElement facePlate3(caloDetElem, "FacePlate_" + std::to_string(3 * sign), 0);
+ dd4hep::Tube facePlateShape3(dimensions.rmin(), (sensitiveBarrel3Rmin - space),
+ (dzDetector3 - 2 * dZEndPlate - space));
+ Volume facePlateVol3("facePlateVol3", facePlateShape3, lcdd.material(xFacePlate.materialStr()));
+ facePlateVol3.setVisAttributes(lcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace3(0, 0, sign * extBarrelOffset3);
+
+ PlacedVolume placedFacePlate1 = envelopeVolume.placeVolume(facePlateVol1, offsetFace1);
+ facePlate1.setPlacement(placedFacePlate1);
+ PlacedVolume placedFacePlate2 = envelopeVolume.placeVolume(facePlateVol2, offsetFace2);
+ facePlate2.setPlacement(placedFacePlate2);
+ PlacedVolume placedFacePlate3 = envelopeVolume.placeVolume(facePlateVol3, offsetFace3);
+ facePlate3.setPlacement(placedFacePlate3);
+
+ // Add structural support made of steel at both ends of extHCal
+ dd4hep::Tube endPlateShape1(dimensions.rmin1(), (dimensions.rmax1() - dSteelSupport), dZEndPlate);
+ Volume endPlateVol1("endPlateVol1", endPlateShape1, lcdd.material(xEndPlate.materialStr()));
+ endPlateVol1.setVisAttributes(lcdd, xEndPlate.visStr());
+ dd4hep::Tube endPlateShape3(dimensions.rmin(), (dimensions.rmax() - dSteelSupport), dZEndPlate);
+ Volume endPlateVol3("endPlateVol3", endPlateShape3, lcdd.material(xEndPlate.materialStr()));
+ endPlateVol3.setVisAttributes(lcdd, xEndPlate.visStr());
+
+ // Endplates placed for the extended Barrels in front and in the back to the central Barrel
+ DetElement endPlatePos(caloDetElem, "endPlate_" + std::to_string(1 * sign), 0);
+ dd4hep::Position posOffset(0, 0, sign * (extBarrelOffset3 + dzDetector3 - dZEndPlate));
+ PlacedVolume placedEndPlatePos = envelopeVolume.placeVolume(endPlateVol3, posOffset);
+ endPlatePos.setPlacement(placedEndPlatePos);
+
+ DetElement endPlateNeg(caloDetElem, "endPlate_" + std::to_string(2 * sign), 0);
+ dd4hep::Position negOffset(0, 0, sign * (extBarrelOffset1 - dzDetector1 + dZEndPlate));
+ PlacedVolume placedEndPlateNeg = envelopeVolume.placeVolume(endPlateVol1, negOffset);
+ endPlateNeg.setPlacement(placedEndPlateNeg);
+
+ std::vector layers;
+ layers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+ std::vector > seqInLayers;
+ seqInLayers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+ std::vector tilesPerLayer;
+ tilesPerLayer.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+
+ // loop over R ("layers")
+ double layerR = 0.;
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer){
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel1Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel1Rmin + layerR + layerDepths1.at(idxLayer);
+ layerR += layerDepths1.at(idxLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol1", tileSequenceShape, lcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector1 );
+ Volume layerVolume("HCalECLayerVol1", layerShape, lcdd.air());
+
+ layerVolume.setVisAttributes(lcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ dd4hep::Position moduleOffset1 (0,0,sign * extBarrelOffset1);
+
+ dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset1);
+ unsigned int type1 = 0;
+ if (sign<0){
+ type1 = 3;
+ }
+ placedLayerVolume.addPhysVolID("type", type1); // First module type=0,3 in front of second +/-
+ placedLayerVolume.addPhysVolID("layer", idxLayer);
+
+ layers.push_back(placedLayerVolume);
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_"+ xComp.materialStr(), tileShape, lcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(lcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()){
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ }
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector1 + 0.5 * dzSequence; //2*dZEndPlate + space + 0.5 * dzSequence;
+
+ for (uint numSeq=0; numSeq < numSequencesZ1; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
+ } // layers loop
+
+
+ layerR = 0.;
+ // Placement of subWedges in Wedge, 2nd part
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer){
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel2Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel2Rmin + layerR + layerDepths2.at(idxLayer);
+ layerR += layerDepths2.at(idxLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol2", tileSequenceShape, lcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector2);
+ Volume layerVolume("HCalECLayerVol2", layerShape, lcdd.air());
+
+ layerVolume.setVisAttributes(lcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_", tileShape, lcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(lcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()){
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ } // close first Z loop
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector2 + 0.5 * dzSequence; //(dzSequence * 0.5);
+
+ for (uint numSeq=0; numSeq < numSequencesZ2; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
+
+ dd4hep::Position moduleOffset2 (0, 0, sign * extBarrelOffset2);
+ dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset2);
+ unsigned int type2 = 1;
+ if (sign<0){
+ type2 = 4;
+ }
+ placedLayerVolume.addPhysVolID("type", type2); // Second module type=1,4 behind the first +/-
+ placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + idxLayer);
+ layers.push_back(placedLayerVolume);
+ }
+
+ layerR = 0.;
+ // Placement of subWedges in Wedge, 3th part
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer){
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel3Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel3Rmin + layerR + layerDepths3.at(idxLayer);
+ layerR += layerDepths3.at(idxLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol3", tileSequenceShape, lcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector3);
+ Volume layerVolume("HCalECLayerVol3", layerShape, lcdd.air());
+
+ layerVolume.setVisAttributes(lcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_" , tileShape, lcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(lcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()){
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ }
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector3 + 0.5 * dzSequence; //2*dZEndPlate + space + (dzSequence * 0.5);
+
+ for (uint numSeq=0; numSeq < numSequencesZ3; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
+
+ dd4hep::Position moduleOffset3 (0, 0, sign * extBarrelOffset3);
+ dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset3);
+ unsigned int type3 = 2;
+ if (sign<0){
+ type3 = 5;
+ }
+ placedLayerVolume.addPhysVolID("type", type3); // Second module type=2,5 behind the first +/-
+ placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + layerDepths2.size() + idxLayer);
+ layers.push_back(placedLayerVolume);
+ } // end loop placement of subwedges
+
+ // Placement of DetElements
+ lLog << MSG::DEBUG << "Layers in r : " << layers.size() << std::endl;
+ lLog << MSG::DEBUG << "Tiles in layers :" << tilesPerLayer.size() << std::endl;
+
+ // Place det elements wihtin each other to recover volume positions later via cellID
+ for (uint iLayer = 0; iLayer < (layerDepths1.size()+layerDepths2.size()+layerDepths3.size()); iLayer++){
+ DetElement layerDet(caloDetElem, dd4hep::xml::_toString(sign*(iLayer+1), "layer%d"), sign*(iLayer+1));
+ layerDet.setPlacement(layers[iLayer]);
+
+ for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
+ DetElement seqDet(layerDet, dd4hep::xml::_toString(iSeq, "seq%d"), sign*(iSeq+1));
+ seqDet.setPlacement(seqInLayers[iLayer][iSeq]);
+
+ DetElement tileDet(seqDet, dd4hep::xml::_toString(iSeq, "tile%d"), sign*(iSeq+1));
+ tileDet.setPlacement(tilesPerLayer[iLayer]);
+ }
+ }
+ } // for signs loop
+
+ // Place envelope volume
+ Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
+
+ PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
+ placedHCal.addPhysVolID("system", xmlDet.id());
+ caloDetElem.setPlacement(placedHCal);
+
+
+ // Create caloData object
+ auto caloData = new dd4hep::rec::LayeredCalorimeterData;
+ caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::EndcapLayout;
+ caloDetElem.addExtension(caloData);
+
+ caloData->extent[0] = sensitiveBarrel3Rmin;
+ caloData->extent[1] = sensitiveBarrel3Rmin + moduleDepth3; //
+ caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
+ caloData->extent[3] = dzDetector1 + dzDetector2 + dzDetector3;
+
+ dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
+
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths1.at(idxLayer);
+
+ caloLayer.distance = sensitiveBarrel1Rmin; // should this be always the radius of the first layer as it is now?
+ caloLayer.sensitive_thickness = difference_bet_r1r2; // not really sure what is this variable
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
+
+ caloData->layers.push_back(caloLayer);
}
- seqInLayers.push_back(seqs);
- }
-
- layerR = 0.;
- // Placement of subWedges in Wedge, 2nd part
- for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer) {
- // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
- double rminLayer = sensitiveBarrel2Rmin + layerR;
- double rmaxLayer = sensitiveBarrel2Rmin + layerR + layerDepths2.at(idxLayer);
- layerR += layerDepths2.at(idxLayer);
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths2.at(idxLayer);
- //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
- unsigned int sequenceIdx = (idxLayer+1) % 2;
+ caloLayer.distance = sensitiveBarrel2Rmin;
+ caloLayer.sensitive_thickness = difference_bet_r1r2;
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
- dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalECTileSequenceVol2", tileSequenceShape, aLcdd.air());
-
- lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
-
- dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector2);
- Volume layerVolume("HCalECLayerVol2", layerShape, aLcdd.air());
-
- layerVolume.setVisAttributes(aLcdd.invisible());
- unsigned int idxSubMod = 0;
-
- double tileZOffset = - 0.5* dzSequence;
-
- // first Z loop (tiles that make up a sequence)
- for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
- ++xCompColl, ++idxSubMod) {
- xml_comp_t xComp = xCompColl;
- dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
-
- Volume tileVol("HCalECTileVol_"
- , tileShape,
- aLcdd.material(xComp.materialStr()));
- tileVol.setVisAttributes(aLcdd, xComp.visStr());
-
- dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
- dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
-
- if (xComp.isSensitive()) {
- tileVol.setSensitiveDetector(sensDet);
- tilesPerLayer.push_back(placedTileVol);
- }
- tileZOffset += xComp.thickness();
+ caloData->layers.push_back(caloLayer);
}
- // second z loop (place sequences in layer)
- std::vector seqs;
- double zOffset = - dzDetector2 + 0.5 * dzSequence; //(dzSequence * 0.5);
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths3.at(idxLayer);
- for (uint numSeq=0; numSeq < numSequencesZ2; numSeq++){
- dd4hep::Position tileSequencePosition(0, 0, zOffset);
- dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
- placedTileSequenceVolume.addPhysVolID("row", numSeq);
- seqs.push_back(placedTileSequenceVolume);
- zOffset += dzSequence;
- }
- seqInLayers.push_back(seqs);
+ caloLayer.distance = sensitiveBarrel3Rmin;
+ caloLayer.sensitive_thickness = difference_bet_r1r2;
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
- dd4hep::Position moduleOffset2 (0, 0, sign * extBarrelOffset2);
- dd4hep::PlacedVolume placedLayerVolume = aEnvelope.placeVolume(layerVolume, moduleOffset2);
- unsigned int type2 = 1;
- if (sign<0) {
- type2 = 4;
- }
- placedLayerVolume.addPhysVolID("type", type2); // Second module type=1,4 behind the first +/-
- placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + idxLayer);
- layers.push_back(placedLayerVolume);
- }
-
- layerR = 0.;
- // Placement of subWedges in Wedge, 3th part
- for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer) {
- // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
- double rminLayer = sensitiveBarrel3Rmin + layerR;
- double rmaxLayer = sensitiveBarrel3Rmin + layerR + layerDepths3.at(idxLayer);
- layerR += layerDepths3.at(idxLayer);
-
- //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
- unsigned int sequenceIdx = (idxLayer+1) % 2;
-
- dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalECTileSequenceVol3", tileSequenceShape, aLcdd.air());
-
- lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
- dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector3);
- Volume layerVolume("HCalECLayerVol3", layerShape, aLcdd.air());
-
- layerVolume.setVisAttributes(aLcdd.invisible());
- unsigned int idxSubMod = 0;
-
- double tileZOffset = - 0.5* dzSequence;
-
- // first Z loop (tiles that make up a sequence)
- for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
- ++xCompColl, ++idxSubMod) {
- xml_comp_t xComp = xCompColl;
- dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
-
- Volume tileVol("HCalECTileVol_"
- , tileShape,
- aLcdd.material(xComp.materialStr()));
- tileVol.setVisAttributes(aLcdd, xComp.visStr());
-
- dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
- dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
-
- if (xComp.isSensitive()) {
- tileVol.setSensitiveDetector(sensDet);
- tilesPerLayer.push_back(placedTileVol);
- }
- tileZOffset += xComp.thickness();
+ caloData->layers.push_back(caloLayer);
}
-
- // second z loop (place sequences in layer)
- std::vector seqs;
- double zOffset = - dzDetector3 + 0.5 * dzSequence; //2*dZEndPlate + space + (dzSequence * 0.5);
-
- for (uint numSeq=0; numSeq < numSequencesZ3; numSeq++){
- dd4hep::Position tileSequencePosition(0, 0, zOffset);
- dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
- placedTileSequenceVolume.addPhysVolID("row", numSeq);
- seqs.push_back(placedTileSequenceVolume);
- zOffset += dzSequence;
- }
- seqInLayers.push_back(seqs);
-
- dd4hep::Position moduleOffset3 (0, 0, sign * extBarrelOffset3);
- dd4hep::PlacedVolume placedLayerVolume = aEnvelope.placeVolume(layerVolume, moduleOffset3);
- unsigned int type3 = 2;
- if (sign<0) {
- type3 = 5;
- }
- placedLayerVolume.addPhysVolID("type", type3); // Second module type=2,5 behind the first +/-
- placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + layerDepths2.size() + idxLayer);
- layers.push_back(placedLayerVolume);
- }
-
- // Placement of DetElements
- lLog << MSG::DEBUG << "Layers in r : " << layers.size() << std::endl;
- lLog << MSG::DEBUG << "Tiles in layers :" << tilesPerLayer.size() << std::endl;
-
- for (uint iLayer = 0; iLayer < (layerDepths1.size()+layerDepths2.size()+layerDepths3.size()); iLayer++) {
- DetElement layerDet(aHCal, dd4hep::xml::_toString(sign*(iLayer+1), "layer%d"), sign*(iLayer+1));
- layerDet.setPlacement(layers[iLayer]);
-
- for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
- DetElement seqDet(layerDet, dd4hep::xml::_toString(iSeq, "seq%d"), sign*(iSeq+1));
- seqDet.setPlacement(seqInLayers[iLayer][iSeq]);
-
- DetElement tileDet(seqDet, dd4hep::xml::_toString(iSeq, "tile%d"), sign*(iSeq+1));
- tileDet.setPlacement(tilesPerLayer[iLayer]);
- }
- }
-
-}
-
-static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4hep::SensitiveDetector sensDet) {
-
-
- xml_det_t xmlDet = xmlElement;
- std::string detName = xmlDet.nameStr();
-
- // Make DetElement
- dd4hep::DetElement hCalEC(detName, xmlDet.id());
-
- // Make volume that envelopes the whole barrel; set material to air
- Dimension dimensions(xmlDet.dimensions());
-
- dd4hep::Tube envelope(dimensions.rmin(), dimensions.rmax1(), (dimensions.v_offset() + dimensions.z_length()));
- dd4hep::Tube negative1(dimensions.rmin(), dimensions.rmax1(), (dimensions.offset() - dimensions.width()));
- dd4hep::Tube negative2(dimensions.rmin(), dimensions.rmin1(), (dimensions.z_offset() - dimensions.dz()));
- dd4hep::Tube negative3(dimensions.rmin(), dimensions.rmin2(), (dimensions.v_offset() - dimensions.z_length()));
- dd4hep::SubtractionSolid envelopeShapeTmp1(envelope, negative1);
- dd4hep::SubtractionSolid envelopeShapeTmp2(envelopeShapeTmp1, negative2);
- dd4hep::SubtractionSolid envelopeShape(envelopeShapeTmp2, negative3);
-
- Volume envelopeVolume(detName + "_volume", envelopeShape, lcdd.air());
- envelopeVolume.setVisAttributes(lcdd, dimensions.visStr());
-
- lLog << MSG::DEBUG << "Placing detector on the positive side: (cm) " << (dimensions.offset() + dimensions.dz())
- << endmsg;
- buildEC(lcdd, sensDet, envelopeVolume, hCalEC, xmlElement, 1);
- lLog << MSG::DEBUG << "Placing detector on the negative side: (cm) " << -(dimensions.offset() + dimensions.dz())
- << endmsg;
- buildEC(lcdd, sensDet, envelopeVolume, hCalEC, xmlElement, -1);
-
- // Place envelope volume
- Volume motherVol = lcdd.pickMotherVolume(hCalEC);
-
- PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
- placedHCal.addPhysVolID("system", xmlDet.id());
- hCalEC.setPlacement(placedHCal);
-
- return hCalEC;
-}
-} // namespace hcal
-
+ return caloDetElem;
+}
+}// namespace det
DECLARE_DETELEMENT(CaloThreePartsEndcap_o1_v01, det::createHCalEC)
diff --git a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
index 89be7154d..2084146b8 100644
--- a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
@@ -1,6 +1,7 @@
// DD4hep
#include "DD4hep/DetFactoryHelper.h"
+#include
using dd4hep::Volume;
using dd4hep::DetElement;
@@ -12,11 +13,11 @@ using dd4hep::PlacedVolume;
#define endmsg std::endl
#define lLog std::cout
namespace MSG {
-const std::string DEBUG = " Debug: ";
-const std::string INFO = " Info: ";
+const std::string ERROR = "createHCalTileBarrel ERROR ";
+const std::string DEBUG = "createHCalTileBarrel DEBUG ";
+const std::string INFO = "createHCalTileBarrel INFO ";
}
-
namespace det {
static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep::SensitiveDetector sensDet) {
@@ -40,7 +41,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
xml_comp_t xSteelSupport = xmlDet.child(_Unicode(steel_support));
double dSteelSupport = xSteelSupport.thickness();
- lLog << MSG::DEBUG << "steel support thickness: " << dSteelSupport << " [cm]" << endmsg;
+ lLog << MSG::DEBUG << "steel support thickness (cm): " << dSteelSupport << endmsg;
lLog << MSG::DEBUG << "steel support material: " << xSteelSupport.materialStr() << endmsg;
double sensitiveBarrelRmin = xDimensions.rmin() + xFacePlate.thickness() + space;
@@ -50,17 +51,15 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
// NOTE: This assumes that both have the same dimensions!
Dimension sequenceDimensions(sequences[1].dimensions());
double dzSequence = sequenceDimensions.dz();
- lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
+ lLog << MSG::DEBUG << "sequence thickness (cm) " << dzSequence << endmsg;
- // calculate the number of modules fitting in Z
+ // calculate the number of sequences fitting in Z
unsigned int numSequencesZ = static_cast((2 * xDimensions.dz() - 2 * dZEndPlate - 2 * space) / dzSequence);
-
// get all 'layer' children of the 'layers' tag
std::vector Layers;
- for (xml_coll_t xCompColl(xmlDet.child(_Unicode(layers)), _Unicode(layer)); xCompColl;
- ++xCompColl) {
- Layers.push_back(xCompColl);
+ for (xml_coll_t xCompColl(xmlDet.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl) {
+ Layers.push_back(xCompColl);
}
unsigned int numSequencesR = 0;
double moduleDepth = 0.;
@@ -74,21 +73,23 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
layerDepths.push_back(layerDimension.dr());
}
}
- lLog << MSG::DEBUG << "retrieved number of layers: " << numSequencesR
- << " , which end up to a full module depth in rho of " << moduleDepth << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers: " << layerDepths.size() << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of radial layers: " << numSequencesR
+ << " , which end up to a full module depth in rho of " << moduleDepth << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of radial layers: " << layerDepths.size() << endmsg;
- lLog << MSG::INFO << "constructing: " << numSequencesZ << " rings in Z, " << numSequencesR
- << " layers in Rho, " << numSequencesR * numSequencesZ << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing: " << numSequencesZ << " sequences in Z, " << numSequencesR
+ << " radial layers, in total " << numSequencesR * numSequencesZ << " tiles" << endmsg;
// Calculate correction along z based on the module size (can only have natural number of modules)
double dzDetector = (numSequencesZ * dzSequence) / 2 + dZEndPlate + space;
- lLog << MSG::DEBUG << "dzDetector: " << dzDetector << endmsg;
- lLog << MSG::INFO << "correction of dz (negative = size reduced):" << dzDetector - xDimensions.dz() << endmsg;
+ lLog << MSG::DEBUG << "dzDetector (cm): " << dzDetector << endmsg;
+ lLog << MSG::INFO << "correction of dz in cm (negative = size reduced):" << dzDetector - xDimensions.dz() << endmsg;
double rminSupport = sensitiveBarrelRmin + moduleDepth;
double rmaxSupport = sensitiveBarrelRmin + moduleDepth + dSteelSupport;
+ double sensitiveBarrelRmax = sensitiveBarrelRmin + moduleDepth;
+
////////////////////// detector building //////////////////////
@@ -102,10 +103,11 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
// top level det element representing whole hcal barrel
- DetElement hCal(xmlDet.nameStr(), xmlDet.id());
+ DetElement caloDetElem(xmlDet.nameStr(), xmlDet.id());
/// envelope shape
dd4hep::Tube envelopeShape(xDimensions.rmin(), xDimensions.rmax(), xDimensions.dz());
+
Volume envelopeVolume("HCalEnvelopeVolume", envelopeShape, lcdd.air());
envelopeVolume.setVisAttributes(lcdd, xDimensions.visStr());
@@ -114,7 +116,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
Volume facePlateVol("HCalFacePlateVol", facePlateShape, lcdd.material(xFacePlate.materialStr()));
facePlateVol.setVisAttributes(lcdd, xFacePlate.visStr());
PlacedVolume placedFacePlate = envelopeVolume.placeVolume(facePlateVol);
- DetElement facePlate_det(hCal, "HCalFacePlate", 0);
+ DetElement facePlate_det(caloDetElem, "HCalFacePlate", 0);
facePlate_det.setPlacement(placedFacePlate);
// Add structural support made of steel at both ends of HCal
@@ -122,22 +124,21 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
Volume endPlateVol("HCalEndPlateVol", endPlateShape, lcdd.material(xEndPlate.materialStr()));
endPlateVol.setVisAttributes(lcdd, xEndPlate.visStr());
- DetElement endPlatePos(hCal, "HCalEndPlatePos", 0);
+ DetElement endPlatePos(caloDetElem, "HCalEndPlatePos", 0);
dd4hep::Position posOffset(0, 0, dzDetector - (dZEndPlate / 2));
PlacedVolume placedEndPlatePos = envelopeVolume.placeVolume(endPlateVol, posOffset);
endPlatePos.setPlacement(placedEndPlatePos);
- DetElement endPlateNeg(hCal, "HCalEndPlateNeg", 1);
+ DetElement endPlateNeg(caloDetElem, "HCalEndPlateNeg", 1);
dd4hep::Position negOffset(0, 0, -dzDetector + (dZEndPlate / 2));
PlacedVolume placedEndPlateNeg = envelopeVolume.placeVolume(endPlateVol, negOffset);
endPlateNeg.setPlacement(placedEndPlateNeg);
dd4hep::Tube supportShape(rminSupport, rmaxSupport, (dzDetector - dZEndPlate - space));
- Volume steelSupportVolume("HCalSteelSupportVol", supportShape,
- lcdd.material(xSteelSupport.materialStr()));
+ Volume steelSupportVolume("HCalSteelSupportVol", supportShape, lcdd.material(xSteelSupport.materialStr()));
steelSupportVolume.setVisAttributes(lcdd.invisible());
PlacedVolume placedSupport = envelopeVolume.placeVolume(steelSupportVolume);
- DetElement support(hCal, "HCalSteelSupport", 0);
+ DetElement support(caloDetElem, "HCalSteelSupport", 0);
support.setPlacement(placedSupport);
// double sensitiveBarrelDz = dzDetector - dZEndPlate;
@@ -158,7 +159,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
Volume tileSequenceVolume("HCalTileSequenceVol", tileSequenceShape, lcdd.air());
- lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+ lLog << MSG::INFO << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector - dZEndPlate - space );
@@ -176,7 +177,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
double tileZOffset = - 0.5* dzSequence;
// first Z loop (tiles that make up a sequence)
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
- ++xCompColl, ++idxSubMod) {
+ ++xCompColl, ++idxSubMod) {
xml_comp_t xComp = xCompColl;
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
@@ -210,7 +211,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
// Place det elements wihtin each other to recover volume positions later via cellID
for (uint iLayer = 0; iLayer < numSequencesR; iLayer++) {
- DetElement layerDet(hCal, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer);
+ DetElement layerDet(caloDetElem, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer);
layerDet.setPlacement(layers[iLayer]);
for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
@@ -223,12 +224,39 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
}
// Place envelope (or barrel) volume
- Volume motherVol = lcdd.pickMotherVolume(hCal);
+ Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
motherVol.setVisAttributes(lcdd.invisible());
- PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
- placedHCal.addPhysVolID("system", hCal.id());
- hCal.setPlacement(placedHCal);
- return hCal;
+ PlacedVolume envelopePhysVol = motherVol.placeVolume(envelopeVolume);
+ envelopePhysVol.addPhysVolID("system", xmlDet.id());
+ caloDetElem.setPlacement(envelopePhysVol);
+
+
+ // Create caloData object
+ auto caloData = new dd4hep::rec::LayeredCalorimeterData;
+ caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::BarrelLayout;
+ caloDetElem.addExtension(caloData);
+
+ caloData->extent[0] = sensitiveBarrelRmin;
+ caloData->extent[1] = sensitiveBarrelRmax; // or r_max ?
+ caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
+ caloData->extent[3] = dzDetector;
+
+ dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
+
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths.at(idxLayer);
+
+ caloLayer.distance = sensitiveBarrelRmin; // should this be always the radius of the first layer as it is now?
+ caloLayer.sensitive_thickness = difference_bet_r1r2; // not really sure what is this variable
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
+
+ caloData->layers.push_back(caloLayer);
+ }
+
+
+ return caloDetElem;
+
}
} // namespace hcal
From acff9945ee964d78a339ad7065af466f064e3c42 Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Thu, 11 Jul 2024 16:26:30 +0200
Subject: [PATCH 014/133] implemented suggestions from discussion
---
.../HCalThreePartsEndcap_o1_v01_geo.cpp | 17 +++++++++++++----
.../calorimeter/HCalTileBarrel_o1_v01_geo.cpp | 17 ++++++++---------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
index 1baccf00c..e447069f4 100644
--- a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
@@ -92,6 +92,10 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
std::vector layerDepths2 = std::vector();
std::vector layerDepths3 = std::vector();
+ std::vector layerInnerRadii1 = std::vector();
+ std::vector layerInnerRadii2 = std::vector();
+ std::vector layerInnerRadii3 = std::vector();
+
// get all 'layer' children of the 'layers' tag
std::vector Layers;
for (xml_coll_t xCompColl(xmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl){
@@ -216,6 +220,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
double rminLayer = sensitiveBarrel1Rmin + layerR;
double rmaxLayer = sensitiveBarrel1Rmin + layerR + layerDepths1.at(idxLayer);
layerR += layerDepths1.at(idxLayer);
+ layerInnerRadii1.push_back(rminLayer);
//alternate: even layers consist of tile sequence b, odd layer of tile sequence a
unsigned int sequenceIdx = (idxLayer+1) % 2;
@@ -285,6 +290,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
double rminLayer = sensitiveBarrel2Rmin + layerR;
double rmaxLayer = sensitiveBarrel2Rmin + layerR + layerDepths2.at(idxLayer);
layerR += layerDepths2.at(idxLayer);
+ layerInnerRadii2.push_back(rminLayer);
//alternate: even layers consist of tile sequence b, odd layer of tile sequence a
unsigned int sequenceIdx = (idxLayer+1) % 2;
@@ -351,6 +357,8 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
double rminLayer = sensitiveBarrel3Rmin + layerR;
double rmaxLayer = sensitiveBarrel3Rmin + layerR + layerDepths3.at(idxLayer);
layerR += layerDepths3.at(idxLayer);
+ layerInnerRadii3.push_back(rminLayer);
+
//alternate: even layers consist of tile sequence b, odd layer of tile sequence a
unsigned int sequenceIdx = (idxLayer+1) % 2;
@@ -449,11 +457,12 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
+
for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer) {
const double difference_bet_r1r2 = layerDepths1.at(idxLayer);
- caloLayer.distance = sensitiveBarrel1Rmin; // should this be always the radius of the first layer as it is now?
- caloLayer.sensitive_thickness = difference_bet_r1r2; // not really sure what is this variable
+ caloLayer.distance = layerInnerRadii1.at(idxLayer); // radius of the current layer
+ caloLayer.sensitive_thickness = difference_bet_r1r2; // radial dimension of the current layer
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
@@ -463,7 +472,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer) {
const double difference_bet_r1r2 = layerDepths2.at(idxLayer);
- caloLayer.distance = sensitiveBarrel2Rmin;
+ caloLayer.distance = layerInnerRadii2.at(idxLayer);
caloLayer.sensitive_thickness = difference_bet_r1r2;
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
@@ -474,7 +483,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer) {
const double difference_bet_r1r2 = layerDepths3.at(idxLayer);
- caloLayer.distance = sensitiveBarrel3Rmin;
+ caloLayer.distance = layerInnerRadii3.at(idxLayer);
caloLayer.sensitive_thickness = difference_bet_r1r2;
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
diff --git a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
index 2084146b8..98573707a 100644
--- a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
@@ -41,7 +41,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
xml_comp_t xSteelSupport = xmlDet.child(_Unicode(steel_support));
double dSteelSupport = xSteelSupport.thickness();
- lLog << MSG::DEBUG << "steel support thickness (cm): " << dSteelSupport << endmsg;
+ lLog << MSG::DEBUG << "steel support thickness (cm): " << dSteelSupport / dd4hep::cm << endmsg;
lLog << MSG::DEBUG << "steel support material: " << xSteelSupport.materialStr() << endmsg;
double sensitiveBarrelRmin = xDimensions.rmin() + xFacePlate.thickness() + space;
@@ -51,7 +51,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
// NOTE: This assumes that both have the same dimensions!
Dimension sequenceDimensions(sequences[1].dimensions());
double dzSequence = sequenceDimensions.dz();
- lLog << MSG::DEBUG << "sequence thickness (cm) " << dzSequence << endmsg;
+ lLog << MSG::DEBUG << "sequence thickness (cm) " << dzSequence / dd4hep::cm << endmsg;
// calculate the number of sequences fitting in Z
unsigned int numSequencesZ = static_cast((2 * xDimensions.dz() - 2 * dZEndPlate - 2 * space) / dzSequence);
@@ -64,6 +64,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
unsigned int numSequencesR = 0;
double moduleDepth = 0.;
std::vector layerDepths = std::vector();
+ std::vector layerInnerRadii = std::vector();
for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it) {
xml_comp_t layer = *it;
Dimension layerDimension(layer.dimensions());
@@ -82,7 +83,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
// Calculate correction along z based on the module size (can only have natural number of modules)
double dzDetector = (numSequencesZ * dzSequence) / 2 + dZEndPlate + space;
- lLog << MSG::DEBUG << "dzDetector (cm): " << dzDetector << endmsg;
+ lLog << MSG::DEBUG << "dzDetector (cm): " << dzDetector / dd4hep::cm << endmsg;
lLog << MSG::INFO << "correction of dz in cm (negative = size reduced):" << dzDetector - xDimensions.dz() << endmsg;
double rminSupport = sensitiveBarrelRmin + moduleDepth;
@@ -152,15 +153,13 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
double rminLayer = sensitiveBarrelRmin + layerR;
double rmaxLayer = sensitiveBarrelRmin + layerR + layerDepths.at(idxLayer);
layerR += layerDepths.at(idxLayer);
+ layerInnerRadii.push_back(rminLayer);
//alternate: even layers consist of tile sequence b, odd layer of tile sequence a
unsigned int sequenceIdx = idxLayer % 2;
dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalTileSequenceVol", tileSequenceShape, lcdd.air());
-
- lLog << MSG::INFO << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
+ Volume tileSequenceVolume("HCalTileSequenceVol", tileSequenceShape, lcdd.air());
dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector - dZEndPlate - space );
Volume layerVolume("HCalLayerVol", layerShape, lcdd.air());
@@ -246,8 +245,8 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
for (unsigned int idxLayer = 0; idxLayer < layerDepths.size(); ++idxLayer) {
const double difference_bet_r1r2 = layerDepths.at(idxLayer);
- caloLayer.distance = sensitiveBarrelRmin; // should this be always the radius of the first layer as it is now?
- caloLayer.sensitive_thickness = difference_bet_r1r2; // not really sure what is this variable
+ caloLayer.distance = layerInnerRadii.at(idxLayer); // radius of the current layer
+ caloLayer.sensitive_thickness = difference_bet_r1r2; // radial dimension of the current layer
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
From 43b7380e6543114acd3700dfbc4b3190d769813c Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Wed, 31 Jul 2024 17:30:17 +0200
Subject: [PATCH 015/133] implement comments and improve code readibility
---
.../HCalEndcaps_ThreeParts_TileCal.xml | 10 ++--
.../HCalThreePartsEndcap_o1_v01_geo.cpp | 49 ++++++++++---------
.../calorimeter/HCalTileBarrel_o1_v01_geo.cpp | 22 ++++++---
3 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
index cc1e2190f..971b613a2 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
@@ -57,8 +57,8 @@
-
@@ -74,7 +74,7 @@
@@ -82,7 +82,7 @@
@@ -90,7 +90,7 @@
diff --git a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
index e447069f4..05d428801 100644
--- a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
@@ -27,7 +27,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
// Make DetElement
dd4hep::DetElement caloDetElem(detName, xmlDet.id());
- // Make volume that envelopes the whole barrel; set material to air
+ // Make volume that envelopes the whole endcap; set material to air
Dimension dimensions(xmlDet.dimensions());
dd4hep::Tube envelope(dimensions.rmin(), dimensions.rmax1(), (dimensions.v_offset() + dimensions.z_length()));
@@ -46,7 +46,6 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
Dimension sensDetType = xmlElement.child(_Unicode(sensitive));
sensDet.setType(sensDetType.typeStr());
- // Dimension dimensions(xmlElement.child(_Unicode(dimensions)));
xml_comp_t xEndPlate = xmlElement.child(_Unicode(end_plate));
double dZEndPlate = xEndPlate.thickness() / 2.;
xml_comp_t xFacePlate = xmlElement.child(_Unicode(face_plate));
@@ -70,9 +69,19 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
// Hard-coded assumption that we have two different sequences for the modules
std::vector sequences = {xmlElement.child(_Unicode(sequence_a)), xmlElement.child(_Unicode(sequence_b))};
- // NOTE: This assumes that both have the same dimensions!
- Dimension sequenceDimensions(sequences[1].dimensions());
- double dzSequence = sequenceDimensions.dz();
+ // Check if both sequences are present
+ if (!sequences[0] || !sequences[1]) {
+ lLog << MSG::ERROR << "The two sequences sequence_a and sequence_b must be present in the xml file." << endmsg;
+ throw std::runtime_error("Missing sequence_a or sequence_b in the xml file.");
+ }
+ // Check if both sequences have the same dimensions
+ Dimension dimensionsA(sequences[0].dimensions());
+ Dimension dimensionsB(sequences[1].dimensions());
+ if (dimensionsA.dz() != dimensionsB.dz()) {
+ lLog << MSG::ERROR << "The dimensions of sequence_a and sequence_b do not match." << endmsg;
+ throw std::runtime_error("The dimensions of the sequence_a and sequence_b do not match.");
+ }
+ double dzSequence = dimensionsB.dz();
lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
// calculate the number of modules fitting in Z
@@ -87,7 +96,6 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
double moduleDepth2 = 0.;
double moduleDepth3 = 0.;
- // MM: using layers and Layers is not very fortunate
std::vector layerDepths1 = std::vector();
std::vector layerDepths2 = std::vector();
std::vector layerDepths3 = std::vector();
@@ -96,24 +104,19 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
std::vector layerInnerRadii2 = std::vector();
std::vector layerInnerRadii3 = std::vector();
- // get all 'layer' children of the 'layers' tag
- std::vector Layers;
+ // iterating over XML elements to retrieve all child elements of 'layers'
for (xml_coll_t xCompColl(xmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl){
- Layers.push_back(xCompColl);
- }
-
- for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it){
- xml_comp_t layer = *it;
- Dimension layerDimension(layer.dimensions());
+ xml_comp_t currentLayer = xCompColl;
+ Dimension layerDimension(currentLayer.dimensions());
numSequencesR1 += layerDimension.nmodules();
- numSequencesR2 += layerDimension.nModules();
+ numSequencesR2 += layerDimension.nsegments();
numSequencesR3 += layerDimension.nPads();
for (int nLayer = 0; nLayer < layerDimension.nmodules(); nLayer++){
moduleDepth1 += layerDimension.dr();
layerDepths1.push_back(layerDimension.dr());
}
- for (int nLayer = 0; nLayer < layerDimension.nModules(); nLayer++){
+ for (int nLayer = 0; nLayer < layerDimension.nsegments(); nLayer++){
moduleDepth2 += layerDimension.dr();
layerDepths2.push_back(layerDimension.dr());
}
@@ -147,15 +150,15 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
lLog << MSG::INFO << "dz third part EC:" << dzDetector2 * 2 << endmsg;
- for (int iSign = 0; iSign < 2; iSign++){
+ for (int iSign = -1; iSign < 2; iSign+=2){
int sign;
- if(iSign == 0){
- sign = +1;
- lLog << MSG::DEBUG << "Placing detector on the positive side: (cm) " << (dimensions.offset() + dimensions.dz()) << endmsg;
+ if(iSign < 0){
+ sign = -1;
+ lLog << MSG::DEBUG << "Placing detector on the negative side: (cm) " << -(dimensions.offset() + dimensions.dz()) << endmsg;
}
else{
- sign = -1;
- lLog << MSG::DEBUG << "Placing detector on the negative side: (cm) " << -(dimensions.offset() + dimensions.dz()) << endmsg;
+ sign = +1;
+ lLog << MSG::DEBUG << "Placing detector on the positive side: (cm) " << (dimensions.offset() + dimensions.dz()) << endmsg;
}
// Add structural support made of steel inside of HCal
DetElement facePlate1(caloDetElem, "FacePlate_" + std::to_string(1 * sign), 0);
@@ -441,7 +444,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
- placedHCal.addPhysVolID("system", xmlDet.id());
+ placedHCal.addPhysVolID("system", caloDetElem.id());
caloDetElem.setPlacement(placedHCal);
diff --git a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
index 98573707a..2a8815251 100644
--- a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
@@ -48,10 +48,20 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
// Hard-coded assumption that we have two different sequences for the modules
std::vector sequences = {xmlDet.child(_Unicode(sequence_a)), xmlDet.child(_Unicode(sequence_b))};
- // NOTE: This assumes that both have the same dimensions!
- Dimension sequenceDimensions(sequences[1].dimensions());
- double dzSequence = sequenceDimensions.dz();
- lLog << MSG::DEBUG << "sequence thickness (cm) " << dzSequence / dd4hep::cm << endmsg;
+ // Check if both sequences are present
+ if (!sequences[0] || !sequences[1]) {
+ lLog << MSG::ERROR << "The two sequences 'sequence_a' and 'sequence_b' must be present in the xml file." << endmsg;
+ throw std::runtime_error("Missing sequence_a or sequence_b in the xml file.");
+ }
+ // Check if both sequences have the same dimensions
+ Dimension dimensionsA(sequences[0].dimensions());
+ Dimension dimensionsB(sequences[1].dimensions());
+ if (dimensionsA.dz() != dimensionsB.dz()) {
+ lLog << MSG::ERROR << "The dimensions of sequence_a and sequence_b do not match." << endmsg;
+ throw std::runtime_error("The dimensions of the sequence_a and sequence_b do not match.");
+ }
+ double dzSequence = dimensionsB.dz();
+ lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
// calculate the number of sequences fitting in Z
unsigned int numSequencesZ = static_cast((2 * xDimensions.dz() - 2 * dZEndPlate - 2 * space) / dzSequence);
@@ -226,7 +236,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
motherVol.setVisAttributes(lcdd.invisible());
PlacedVolume envelopePhysVol = motherVol.placeVolume(envelopeVolume);
- envelopePhysVol.addPhysVolID("system", xmlDet.id());
+ envelopePhysVol.addPhysVolID("system", caloDetElem.id());
caloDetElem.setPlacement(envelopePhysVol);
@@ -236,7 +246,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
caloDetElem.addExtension(caloData);
caloData->extent[0] = sensitiveBarrelRmin;
- caloData->extent[1] = sensitiveBarrelRmax; // or r_max ?
+ caloData->extent[1] = sensitiveBarrelRmax;
caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
caloData->extent[3] = dzDetector;
From 9fe397e6262162cc096904ac4c8579b940664a9f Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Fri, 2 Aug 2024 20:46:43 +0200
Subject: [PATCH 016/133] fix failing test and remove unused phi segmentation
---
.../ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml | 6 +++---
.../ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml | 6 +++---
FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml | 5 -----
.../ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml | 4 ----
detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp | 6 +++---
5 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml
index c5cbe72a7..5531d85db 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml
@@ -71,7 +71,7 @@
@@ -79,7 +79,7 @@
@@ -87,7 +87,7 @@
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml
index c5cbe72a7..5531d85db 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml
@@ -71,7 +71,7 @@
@@ -79,7 +79,7 @@
@@ -87,7 +87,7 @@
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
index 714fffbe1..0c051c39b 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
@@ -52,11 +52,6 @@
system:4,layer:5,theta:9,phi:10
-
-
-
- system:4,layer:5,row:9,theta:0,phi:10
-
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
index 971b613a2..b63d439bd 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
@@ -51,10 +51,6 @@
system:4,type:2,layer:5,theta:11,phi:10
-
-
- system:4,type:2,layer:5,row:9,theta:0,phi:10
-
-
- system:4,type:2,layer:5,row:9,theta:11,phi:10
+
+ system:4,type:3,layer:6,row:11,theta:11,phi:10
-
- system:4,type:2,layer:5,theta:11,phi:10
+
+ system:4,type:3,layer:6,theta:11,phi:10
diff --git a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
index 416570235..88af1f401 100644
--- a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
@@ -89,9 +89,9 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
unsigned int numSequencesZ2 = static_cast((2 * dimensions.dz() - 2 * dZEndPlate - space) / dzSequence);
unsigned int numSequencesZ3 = static_cast((2 * dimensions.z_length() - 2 * dZEndPlate - space) / dzSequence);
- unsigned int numSequencesR1 = 0;
- unsigned int numSequencesR2 = 0;
- unsigned int numSequencesR3 = 0;
+ unsigned int numLayersR1 = 0;
+ unsigned int numLayersR2 = 0;
+ unsigned int numLayersR3 = 0;
double moduleDepth1 = 0.;
double moduleDepth2 = 0.;
double moduleDepth3 = 0.;
@@ -108,9 +108,9 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
for (xml_coll_t xCompColl(xmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl){
xml_comp_t currentLayer = xCompColl;
Dimension layerDimension(currentLayer.dimensions());
- numSequencesR1 += layerDimension.nmodules();
- numSequencesR2 += layerDimension.nsegments();
- numSequencesR3 += layerDimension.nPads();
+ numLayersR1 += layerDimension.nmodules();
+ numLayersR2 += layerDimension.nsegments();
+ numLayersR3 += layerDimension.nPads();
for (int nLayer = 0; nLayer < layerDimension.nmodules(); nLayer++){
moduleDepth1 += layerDimension.dr();
@@ -126,16 +126,16 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
}
}
- lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << numSequencesR1 << " , which end up to a full module depth in rho of " << moduleDepth1 << " cm" << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << numSequencesR2 << " , which end up to a full module depth in rho of " << moduleDepth2 << " cm" << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << numSequencesR3 << " , which end up to a full module depth in rho of " << moduleDepth3 << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << numLayersR1 << " , which end up to a full module depth in rho of " << moduleDepth1 << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << numLayersR2 << " , which end up to a full module depth in rho of " << moduleDepth2 << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << numLayersR3 << " , which end up to a full module depth in rho of " << moduleDepth3 << " cm" << endmsg;
- lLog << MSG::INFO << "constructing first part EC: with z offset " << extBarrelOffset1 << " cm: "<< numSequencesZ1 << " sequences in Z, " << numSequencesR1 << " layers in Rho, " << numSequencesR1 * numSequencesZ1 << " tiles" << endmsg;
- lLog << MSG::INFO << "constructing second part EC: with offset " << extBarrelOffset2 << " cm: " << numSequencesZ2 << " sequences in Z, " << numSequencesR2 << " layers in Rho, " << layerDepths2.size() * numSequencesZ2 << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing first part EC: with z offset " << extBarrelOffset1 << " cm: "<< numSequencesZ1 << " sequences in Z, " << numLayersR1 << " layers in Rho, " << numLayersR1 * numSequencesZ1 << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing second part EC: with offset " << extBarrelOffset2 << " cm: " << numSequencesZ2 << " sequences in Z, " << numLayersR2 << " layers in Rho, " << layerDepths2.size() * numSequencesZ2 << " tiles" << endmsg;
- lLog << MSG::INFO << "constructing third part EC: with offset " << extBarrelOffset3 << " cm: " << numSequencesZ3 << " sequences in Z, " << numSequencesR3 << " layers in Rho, " << layerDepths3.size() * numSequencesZ3 << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing third part EC: with offset " << extBarrelOffset3 << " cm: " << numSequencesZ3 << " sequences in Z, " << numLayersR3 << " layers in Rho, " << layerDepths3.size() * numSequencesZ3 << " tiles" << endmsg;
- lLog << MSG::INFO << "number of channels: " << (numSequencesR1 * numSequencesZ1) + (numSequencesR2 * numSequencesZ2) + (numSequencesR3 * numSequencesZ3) << endmsg;
+ lLog << MSG::INFO << "number of channels: " << (numLayersR1 * numSequencesZ1) + (numLayersR2 * numSequencesZ2) + (numLayersR3 * numSequencesZ3) << endmsg;
// Calculate correction along z based on the module size (can only have natural number of modules)
double dzDetector1 = (numSequencesZ1 * dzSequence) / 2 + 2 * dZEndPlate + space;
@@ -147,7 +147,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
lLog << MSG::INFO << "width second part EC:" << dimensions.dz() * 2 << endmsg;
lLog << MSG::INFO << "correction of dz (negative = size reduced) second part EB:" << dzDetector2*2 - dimensions.dz()*2 << endmsg;
- lLog << MSG::INFO << "dz third part EC:" << dzDetector2 * 2 << endmsg;
+ lLog << MSG::INFO << "dz third part EC:" << dzDetector3 * 2 << endmsg;
for (int iSign = -1; iSign < 2; iSign+=2){
@@ -232,7 +232,7 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
Volume tileSequenceVolume("HCalECTileSequenceVol1", tileSequenceShape, lcdd.air());
lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
+
dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector1 );
Volume layerVolume("HCalECLayerVol1", layerShape, lcdd.air());
@@ -474,7 +474,6 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer) {
const double difference_bet_r1r2 = layerDepths2.at(idxLayer);
-
caloLayer.distance = layerInnerRadii2.at(idxLayer);
caloLayer.sensitive_thickness = difference_bet_r1r2;
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
@@ -485,7 +484,6 @@ static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4h
for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer) {
const double difference_bet_r1r2 = layerDepths3.at(idxLayer);
-
caloLayer.distance = layerInnerRadii3.at(idxLayer);
caloLayer.sensitive_thickness = difference_bet_r1r2;
caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
diff --git a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
index 2a8815251..c6f359dd3 100644
--- a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
@@ -71,25 +71,25 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
for (xml_coll_t xCompColl(xmlDet.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl) {
Layers.push_back(xCompColl);
}
- unsigned int numSequencesR = 0;
+ unsigned int numLayersR = 0;
double moduleDepth = 0.;
std::vector layerDepths = std::vector();
std::vector layerInnerRadii = std::vector();
for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it) {
xml_comp_t layer = *it;
Dimension layerDimension(layer.dimensions());
- numSequencesR += layerDimension.nModules();
+ numLayersR += layerDimension.nModules();
for (int nLayer = 0; nLayer < layerDimension.nModules(); nLayer++) {
moduleDepth += layerDimension.dr();
layerDepths.push_back(layerDimension.dr());
}
}
- lLog << MSG::DEBUG << "retrieved number of radial layers: " << numSequencesR
+ lLog << MSG::DEBUG << "retrieved number of radial layers: " << numLayersR
<< " , which end up to a full module depth in rho of " << moduleDepth << " cm" << endmsg;
lLog << MSG::DEBUG << "retrieved number of radial layers: " << layerDepths.size() << endmsg;
- lLog << MSG::INFO << "constructing: " << numSequencesZ << " sequences in Z, " << numSequencesR
- << " radial layers, in total " << numSequencesR * numSequencesZ << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing: " << numSequencesZ << " sequences in Z, " << numLayersR
+ << " radial layers, in total " << numLayersR * numSequencesZ << " tiles" << endmsg;
// Calculate correction along z based on the module size (can only have natural number of modules)
double dzDetector = (numSequencesZ * dzSequence) / 2 + dZEndPlate + space;
@@ -219,7 +219,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
}
// Place det elements wihtin each other to recover volume positions later via cellID
- for (uint iLayer = 0; iLayer < numSequencesR; iLayer++) {
+ for (uint iLayer = 0; iLayer < numLayersR; iLayer++) {
DetElement layerDet(caloDetElem, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer);
layerDet.setPlacement(layers[iLayer]);
From 4650a4bb6e7206d845cfaab2bac7410026a2a7e3 Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Wed, 7 Aug 2024 17:31:59 +0200
Subject: [PATCH 018/133] keep ALLEGRO v03 xml file unchanged
---
.../FCCee_HCalEndcaps_ThreeParts_TileCal.xml | 6 +-
.../HCalEndcaps_ThreeParts_TileCal.xml | 6 +-
.../compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml | 2 +-
.../HCalEndcaps_ThreeParts_TileCal.xml | 33 +-
.../HCalEndcaps_ThreeParts_TileCal_v02.xml | 140 +++
.../HCalThreePartsEndcap_o1_v01_geo.cpp | 910 +++++++++---------
.../HCalThreePartsEndcap_o1_v02_geo.cpp | 497 ++++++++++
7 files changed, 1101 insertions(+), 493 deletions(-)
create mode 100644 FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal_v02.xml
create mode 100644 detector/calorimeter/HCalThreePartsEndcap_o1_v02_geo.cpp
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml
index 5531d85db..c5cbe72a7 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v01/FCCee_HCalEndcaps_ThreeParts_TileCal.xml
@@ -71,7 +71,7 @@
@@ -79,7 +79,7 @@
@@ -87,7 +87,7 @@
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml
index 5531d85db..c5cbe72a7 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v02/HCalEndcaps_ThreeParts_TileCal.xml
@@ -71,7 +71,7 @@
@@ -79,7 +79,7 @@
@@ -87,7 +87,7 @@
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
index 7606b7f23..190b83188 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
index 45069ec3b..c5cbe72a7 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
@@ -44,19 +44,20 @@
-
- system:4,type:3,layer:6,row:11,theta:11,phi:10
+
+ system:4,type:2,layer:5,row:9,eta:11,phi:10
-
-
- system:4,type:3,layer:6,theta:11,phi:10
+
+
+ system:4,type:2,layer:4,eta:11,phi:10
+
+
+
+
+ system:4,type:2,layer:5,row:9,eta:10,phi:10
-
-
@@ -69,25 +70,25 @@
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal_v02.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal_v02.xml
new file mode 100644
index 000000000..06fa8d510
--- /dev/null
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal_v02.xml
@@ -0,0 +1,140 @@
+
+
+
+ HCal layout based on ATLAS HCal, with realistic longitudinal segmentation and steel support
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ system:4,type:3,layer:6,row:11,theta:11,phi:10
+
+
+
+ system:4,type:3,layer:6,theta:11,phi:10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
index 88af1f401..34544c2e2 100644
--- a/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalThreePartsEndcap_o1_v01_geo.cpp
@@ -1,497 +1,467 @@
// DD4hep
#include "DD4hep/DetFactoryHelper.h"
-#include
// todo: remove gaudi logging and properly capture output
#define endmsg std::endl
#define lLog std::cout
namespace MSG {
-const std::string ERROR = "createHCalThrePartsEndcap ERROR ";
-const std::string DEBUG = "createHCalThrePartsEndcap DEBUG ";
-const std::string INFO = "createHCalThrePartsEndcap INFO ";
+const std::string DEBUG = " Debug: ";
+const std::string INFO = " Info: ";
}
using dd4hep::Volume;
using dd4hep::DetElement;
using dd4hep::xml::Dimension;
using dd4hep::PlacedVolume;
-using xml_comp_t = dd4hep::xml::Component;
-using xml_det_t = dd4hep::xml::DetElement;
-using xml_h = dd4hep::xml::Handle_t;
namespace det {
-static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4hep::SensitiveDetector sensDet){
- xml_det_t xmlDet = xmlElement;
- std::string detName = xmlDet.nameStr();
-
- // Make DetElement
- dd4hep::DetElement caloDetElem(detName, xmlDet.id());
-
- // Make volume that envelopes the whole endcap; set material to air
- Dimension dimensions(xmlDet.dimensions());
-
- dd4hep::Tube envelope(dimensions.rmin(), dimensions.rmax1(), (dimensions.v_offset() + dimensions.z_length()));
- dd4hep::Tube negative1(dimensions.rmin(), dimensions.rmax1(), (dimensions.offset() - dimensions.width()));
- dd4hep::Tube negative2(dimensions.rmin(), dimensions.rmin1(), (dimensions.z_offset() - dimensions.dz()));
- dd4hep::Tube negative3(dimensions.rmin(), dimensions.rmin2(), (dimensions.v_offset() - dimensions.z_length()));
-
- dd4hep::SubtractionSolid envelopeShapeTmp1(envelope, negative1);
- dd4hep::SubtractionSolid envelopeShapeTmp2(envelopeShapeTmp1, negative2);
- dd4hep::SubtractionSolid envelopeShape(envelopeShapeTmp2, negative3);
-
- Volume envelopeVolume(detName + "_volume", envelopeShape, lcdd.air());
- envelopeVolume.setVisAttributes(lcdd, dimensions.visStr());
-
- // Set sensitive detector type
- Dimension sensDetType = xmlElement.child(_Unicode(sensitive));
- sensDet.setType(sensDetType.typeStr());
-
- xml_comp_t xEndPlate = xmlElement.child(_Unicode(end_plate));
- double dZEndPlate = xEndPlate.thickness() / 2.;
- xml_comp_t xFacePlate = xmlElement.child(_Unicode(face_plate));
- double dRhoFacePlate = xFacePlate.thickness() / 2.;
- xml_comp_t xSpace = xmlElement.child(_Unicode(plate_space)); // to avoid overlaps
- double space = xSpace.thickness();
- xml_comp_t xSteelSupport = xmlElement.child(_Unicode(steel_support));
- double dSteelSupport = xSteelSupport.thickness();
- lLog << MSG::DEBUG << "steel support thickness " << dSteelSupport << endmsg;
- lLog << MSG::DEBUG << "steel support material " << xSteelSupport.materialStr() << endmsg;
-
- // Calculate sensitive barrel dimensions
- double sensitiveBarrel1Rmin = dimensions.rmin1() + 2 * dRhoFacePlate + space;
- double sensitiveBarrel2Rmin = dimensions.rmin2() + 2 * dRhoFacePlate + space;
- double sensitiveBarrel3Rmin = dimensions.rmin() + 2 * dRhoFacePlate + space;
-
- // Offset in z is given as distance from 0 to the middle of the Calorimeter volume
- double extBarrelOffset1 = dimensions.offset();
- double extBarrelOffset2 = dimensions.z_offset();
- double extBarrelOffset3 = dimensions.v_offset();
-
- // Hard-coded assumption that we have two different sequences for the modules
- std::vector sequences = {xmlElement.child(_Unicode(sequence_a)), xmlElement.child(_Unicode(sequence_b))};
- // Check if both sequences are present
- if (!sequences[0] || !sequences[1]) {
- lLog << MSG::ERROR << "The two sequences sequence_a and sequence_b must be present in the xml file." << endmsg;
- throw std::runtime_error("Missing sequence_a or sequence_b in the xml file.");
+void buildEC(dd4hep::Detector& aLcdd, dd4hep::SensitiveDetector& aSensDet, dd4hep::Volume& aEnvelope,
+ dd4hep::DetElement& aHCal, xml_det_t aXmlElement, int sign) {
+
+ dd4hep::SensitiveDetector sensDet = aSensDet;
+ Dimension sensDetType = aXmlElement.child(_Unicode(sensitive));
+ sensDet.setType(sensDetType.typeStr());
+
+ Dimension dimensions(aXmlElement.child(_Unicode(dimensions)));
+ xml_comp_t xEndPlate = aXmlElement.child(_Unicode(end_plate));
+ double dZEndPlate = xEndPlate.thickness() / 2.;
+ xml_comp_t xFacePlate = aXmlElement.child(_Unicode(face_plate));
+ double dRhoFacePlate = xFacePlate.thickness() / 2.;
+ xml_comp_t xSpace = aXmlElement.child(_Unicode(plate_space)); // to avoid overlaps
+ double space = xSpace.thickness();
+ xml_comp_t xSteelSupport = aXmlElement.child(_Unicode(steel_support));
+ double dSteelSupport = xSteelSupport.thickness();
+ lLog << MSG::DEBUG << "steel support thickness " << dSteelSupport << endmsg;
+ lLog << MSG::DEBUG << "steel support material " << xSteelSupport.materialStr() << endmsg;
+
+ double sensitiveBarrel1Rmin = dimensions.rmin1() + 2 * dRhoFacePlate + space;
+ double sensitiveBarrel2Rmin = dimensions.rmin2() + 2 * dRhoFacePlate + space;
+ double sensitiveBarrel3Rmin = dimensions.rmin() + 2 * dRhoFacePlate + space;
+
+ // Offset in z is given as distance from 0 to the middle of the Calorimeter volume
+ double extBarrelOffset1 = dimensions.offset();
+ double extBarrelOffset2 = dimensions.z_offset();
+ double extBarrelOffset3 = dimensions.v_offset();
+
+ // Hard-coded assumption that we have two different sequences for the modules
+ std::vector sequences = {aXmlElement.child(_Unicode(sequence_a)), aXmlElement.child(_Unicode(sequence_b))};
+ // NOTE: This assumes that both have the same dimensions!
+ Dimension sequenceDimensions(sequences[1].dimensions());
+ double dzSequence = sequenceDimensions.dz();
+ lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
+
+ // calculate the number of modules fitting in Z
+ unsigned int numSequencesZ1 = static_cast((2 * dimensions.width() - 2 * dZEndPlate - space) / dzSequence);
+ unsigned int numSequencesZ2 = static_cast((2 * dimensions.dz() - 2 * dZEndPlate - space) / dzSequence);
+ unsigned int numSequencesZ3 = static_cast((2 * dimensions.z_length() - 2 * dZEndPlate - space) / dzSequence);
+
+ unsigned int numSequencesR1 = 0;
+ unsigned int numSequencesR2 = 0;
+ unsigned int numSequencesR3 = 0;
+ double moduleDepth1 = 0.;
+ double moduleDepth2 = 0.;
+ double moduleDepth3 = 0.;
+ std::vector layerDepths1 = std::vector();
+ std::vector layerDepths2 = std::vector();
+ std::vector layerDepths3 = std::vector();
+
+ // get all 'layer' children of the 'layers' tag
+ std::vector Layers;
+ for (xml_coll_t xCompColl(aXmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl;
+ ++xCompColl) {
+ Layers.push_back(xCompColl);
+ }
+
+ for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it) {
+ xml_comp_t layer = *it;
+ Dimension layerDimension(layer.dimensions());
+ numSequencesR1 += layerDimension.nmodules();
+ numSequencesR2 += layerDimension.nModules();
+ numSequencesR3 += layerDimension.nPads();
+ for (int nLayer = 0; nLayer < layerDimension.nmodules(); nLayer++) {
+ moduleDepth1 += layerDimension.dr();
+ layerDepths1.push_back(layerDimension.dr());
}
- // Check if both sequences have the same dimensions
- Dimension dimensionsA(sequences[0].dimensions());
- Dimension dimensionsB(sequences[1].dimensions());
- if (dimensionsA.dz() != dimensionsB.dz()) {
- lLog << MSG::ERROR << "The dimensions of sequence_a and sequence_b do not match." << endmsg;
- throw std::runtime_error("The dimensions of the sequence_a and sequence_b do not match.");
+ for (int nLayer = 0; nLayer < layerDimension.nModules(); nLayer++) {
+ moduleDepth2 += layerDimension.dr();
+ layerDepths2.push_back(layerDimension.dr());
}
- double dzSequence = dimensionsB.dz();
- lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
-
- // calculate the number of modules fitting in Z
- unsigned int numSequencesZ1 = static_cast((2 * dimensions.width() - 2 * dZEndPlate - space) / dzSequence);
- unsigned int numSequencesZ2 = static_cast((2 * dimensions.dz() - 2 * dZEndPlate - space) / dzSequence);
- unsigned int numSequencesZ3 = static_cast((2 * dimensions.z_length() - 2 * dZEndPlate - space) / dzSequence);
-
- unsigned int numLayersR1 = 0;
- unsigned int numLayersR2 = 0;
- unsigned int numLayersR3 = 0;
- double moduleDepth1 = 0.;
- double moduleDepth2 = 0.;
- double moduleDepth3 = 0.;
-
- std::vector layerDepths1 = std::vector();
- std::vector layerDepths2 = std::vector();
- std::vector layerDepths3 = std::vector();
-
- std::vector layerInnerRadii1 = std::vector();
- std::vector layerInnerRadii2 = std::vector();
- std::vector layerInnerRadii3 = std::vector();
-
- // iterating over XML elements to retrieve all child elements of 'layers'
- for (xml_coll_t xCompColl(xmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl){
- xml_comp_t currentLayer = xCompColl;
- Dimension layerDimension(currentLayer.dimensions());
- numLayersR1 += layerDimension.nmodules();
- numLayersR2 += layerDimension.nsegments();
- numLayersR3 += layerDimension.nPads();
-
- for (int nLayer = 0; nLayer < layerDimension.nmodules(); nLayer++){
- moduleDepth1 += layerDimension.dr();
- layerDepths1.push_back(layerDimension.dr());
- }
- for (int nLayer = 0; nLayer < layerDimension.nsegments(); nLayer++){
- moduleDepth2 += layerDimension.dr();
- layerDepths2.push_back(layerDimension.dr());
- }
- for (int nLayer = 0; nLayer < layerDimension.nPads(); nLayer++){
- moduleDepth3 += layerDimension.dr();
- layerDepths3.push_back(layerDimension.dr());
- }
+ for (int nLayer = 0; nLayer < layerDimension.nPads(); nLayer++) {
+ moduleDepth3 += layerDimension.dr();
+ layerDepths3.push_back(layerDimension.dr());
}
-
- lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << numLayersR1 << " , which end up to a full module depth in rho of " << moduleDepth1 << " cm" << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << numLayersR2 << " , which end up to a full module depth in rho of " << moduleDepth2 << " cm" << endmsg;
- lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << numLayersR3 << " , which end up to a full module depth in rho of " << moduleDepth3 << " cm" << endmsg;
-
- lLog << MSG::INFO << "constructing first part EC: with z offset " << extBarrelOffset1 << " cm: "<< numSequencesZ1 << " sequences in Z, " << numLayersR1 << " layers in Rho, " << numLayersR1 * numSequencesZ1 << " tiles" << endmsg;
- lLog << MSG::INFO << "constructing second part EC: with offset " << extBarrelOffset2 << " cm: " << numSequencesZ2 << " sequences in Z, " << numLayersR2 << " layers in Rho, " << layerDepths2.size() * numSequencesZ2 << " tiles" << endmsg;
-
- lLog << MSG::INFO << "constructing third part EC: with offset " << extBarrelOffset3 << " cm: " << numSequencesZ3 << " sequences in Z, " << numLayersR3 << " layers in Rho, " << layerDepths3.size() * numSequencesZ3 << " tiles" << endmsg;
-
- lLog << MSG::INFO << "number of channels: " << (numLayersR1 * numSequencesZ1) + (numLayersR2 * numSequencesZ2) + (numLayersR3 * numSequencesZ3) << endmsg;
-
- // Calculate correction along z based on the module size (can only have natural number of modules)
- double dzDetector1 = (numSequencesZ1 * dzSequence) / 2 + 2 * dZEndPlate + space;
- double dzDetector2 = (numSequencesZ2 * dzSequence) / 2;
- double dzDetector3 = (numSequencesZ3 * dzSequence) / 2 + 2 * dZEndPlate + space;
-
- lLog << MSG::INFO << "correction of dz (negative = size reduced) first part EC :" << dzDetector1*2 - dimensions.width()*2 << endmsg;
- lLog << MSG::INFO << "dz second part EC:" << dzDetector2 * 2 << endmsg;
- lLog << MSG::INFO << "width second part EC:" << dimensions.dz() * 2 << endmsg;
- lLog << MSG::INFO << "correction of dz (negative = size reduced) second part EB:" << dzDetector2*2 - dimensions.dz()*2 << endmsg;
-
- lLog << MSG::INFO << "dz third part EC:" << dzDetector3 * 2 << endmsg;
-
-
- for (int iSign = -1; iSign < 2; iSign+=2){
- int sign;
- if(iSign < 0){
- sign = -1;
- lLog << MSG::DEBUG << "Placing detector on the negative side: (cm) " << -(dimensions.offset() + dimensions.dz()) << endmsg;
- }
- else{
- sign = +1;
- lLog << MSG::DEBUG << "Placing detector on the positive side: (cm) " << (dimensions.offset() + dimensions.dz()) << endmsg;
- }
- // Add structural support made of steel inside of HCal
- DetElement facePlate1(caloDetElem, "FacePlate_" + std::to_string(1 * sign), 0);
- dd4hep::Tube facePlateShape1(dimensions.rmin1(), (sensitiveBarrel1Rmin - space), (dzDetector1 - 2 * dZEndPlate - space));
- Volume facePlateVol1("facePlateVol1", facePlateShape1, lcdd.material(xFacePlate.materialStr()));
- facePlateVol1.setVisAttributes(lcdd, xFacePlate.visStr());
- dd4hep::Position offsetFace1(0, 0, sign * extBarrelOffset1);
-
- // Faceplate for 2nd part of extended Barrel
- DetElement facePlate2(caloDetElem, "FacePlate_" + std::to_string(2 * sign), 0);
- dd4hep::Tube facePlateShape2(dimensions.rmin2(), (sensitiveBarrel2Rmin - space),
- dzDetector2);
- Volume facePlateVol2("facePlateVol2", facePlateShape2, lcdd.material(xFacePlate.materialStr()));
- facePlateVol2.setVisAttributes(lcdd, xFacePlate.visStr());
- dd4hep::Position offsetFace2(0, 0, sign * extBarrelOffset2);
-
- // Faceplate for 3rd part of extended Barrel
- DetElement facePlate3(caloDetElem, "FacePlate_" + std::to_string(3 * sign), 0);
- dd4hep::Tube facePlateShape3(dimensions.rmin(), (sensitiveBarrel3Rmin - space),
- (dzDetector3 - 2 * dZEndPlate - space));
- Volume facePlateVol3("facePlateVol3", facePlateShape3, lcdd.material(xFacePlate.materialStr()));
- facePlateVol3.setVisAttributes(lcdd, xFacePlate.visStr());
- dd4hep::Position offsetFace3(0, 0, sign * extBarrelOffset3);
-
- PlacedVolume placedFacePlate1 = envelopeVolume.placeVolume(facePlateVol1, offsetFace1);
- facePlate1.setPlacement(placedFacePlate1);
- PlacedVolume placedFacePlate2 = envelopeVolume.placeVolume(facePlateVol2, offsetFace2);
- facePlate2.setPlacement(placedFacePlate2);
- PlacedVolume placedFacePlate3 = envelopeVolume.placeVolume(facePlateVol3, offsetFace3);
- facePlate3.setPlacement(placedFacePlate3);
-
- // Add structural support made of steel at both ends of extHCal
- dd4hep::Tube endPlateShape1(dimensions.rmin1(), (dimensions.rmax1() - dSteelSupport), dZEndPlate);
- Volume endPlateVol1("endPlateVol1", endPlateShape1, lcdd.material(xEndPlate.materialStr()));
- endPlateVol1.setVisAttributes(lcdd, xEndPlate.visStr());
- dd4hep::Tube endPlateShape3(dimensions.rmin(), (dimensions.rmax() - dSteelSupport), dZEndPlate);
- Volume endPlateVol3("endPlateVol3", endPlateShape3, lcdd.material(xEndPlate.materialStr()));
- endPlateVol3.setVisAttributes(lcdd, xEndPlate.visStr());
-
- // Endplates placed for the extended Barrels in front and in the back to the central Barrel
- DetElement endPlatePos(caloDetElem, "endPlate_" + std::to_string(1 * sign), 0);
- dd4hep::Position posOffset(0, 0, sign * (extBarrelOffset3 + dzDetector3 - dZEndPlate));
- PlacedVolume placedEndPlatePos = envelopeVolume.placeVolume(endPlateVol3, posOffset);
- endPlatePos.setPlacement(placedEndPlatePos);
-
- DetElement endPlateNeg(caloDetElem, "endPlate_" + std::to_string(2 * sign), 0);
- dd4hep::Position negOffset(0, 0, sign * (extBarrelOffset1 - dzDetector1 + dZEndPlate));
- PlacedVolume placedEndPlateNeg = envelopeVolume.placeVolume(endPlateVol1, negOffset);
- endPlateNeg.setPlacement(placedEndPlateNeg);
-
- std::vector layers;
- layers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
- std::vector > seqInLayers;
- seqInLayers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
- std::vector tilesPerLayer;
- tilesPerLayer.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
-
- // loop over R ("layers")
- double layerR = 0.;
- for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer){
- // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
- double rminLayer = sensitiveBarrel1Rmin + layerR;
- double rmaxLayer = sensitiveBarrel1Rmin + layerR + layerDepths1.at(idxLayer);
- layerR += layerDepths1.at(idxLayer);
- layerInnerRadii1.push_back(rminLayer);
-
- //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
- unsigned int sequenceIdx = (idxLayer+1) % 2;
-
- dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalECTileSequenceVol1", tileSequenceShape, lcdd.air());
-
- lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
- dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector1 );
- Volume layerVolume("HCalECLayerVol1", layerShape, lcdd.air());
-
- layerVolume.setVisAttributes(lcdd.invisible());
- unsigned int idxSubMod = 0;
-
- dd4hep::Position moduleOffset1 (0,0,sign * extBarrelOffset1);
-
- dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset1);
- unsigned int type1 = 0;
- if (sign<0){
- type1 = 3;
- }
- placedLayerVolume.addPhysVolID("type", type1); // First module type=0,3 in front of second +/-
- placedLayerVolume.addPhysVolID("layer", idxLayer);
-
- layers.push_back(placedLayerVolume);
+ }
+
+ lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << numSequencesR1
+ << " , which end up to a full module depth in rho of " << moduleDepth1 << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << layerDepths1.size() << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << numSequencesR2
+ << " , which end up to a full module depth in rho of " << moduleDepth2 << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << layerDepths2.size() << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << numSequencesR3
+ << " , which end up to a full module depth in rho of " << moduleDepth3 << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << layerDepths3.size() << endmsg;
+
+ lLog << MSG::INFO << "constructing first part EC: with offset " << extBarrelOffset1 << ": "<< numSequencesZ1
+ << " rings in Z, " << numSequencesR1 << " layers in Rho, " << numSequencesR1 * numSequencesZ1
+ << " tiles" << endmsg;
+
+ lLog << MSG::INFO << "constructing second part EC: with offset " << extBarrelOffset2 << ": " << numSequencesZ2
+ << " rings in Z, " << numSequencesR2 << " layers in Rho, "
+ << layerDepths2.size() * numSequencesZ2 << " tiles" << endmsg;
+
+ lLog << MSG::INFO << "constructing third part EC: with offset " << extBarrelOffset3 << ": " << numSequencesZ3
+ << " rings in Z, " << numSequencesR3 << " layers in Rho, "
+ << layerDepths3.size() * numSequencesZ3 << " tiles" << endmsg;
+
+ lLog << MSG::INFO << "number of channels: "
+ << (numSequencesR1 * numSequencesZ1) + (numSequencesR2 * numSequencesZ2) + (numSequencesR3 * numSequencesZ3)
+ << endmsg;
+
+ // Calculate correction along z based on the module size (can only have natural number of modules)
+ double dzDetector1 = (numSequencesZ1 * dzSequence) / 2 + 2 * dZEndPlate + space;
+ lLog << MSG::INFO
+ << "correction of dz (negative = size reduced) first part EC :" << dzDetector1*2 - dimensions.width()*2
+ << endmsg;
+ double dzDetector2 = (numSequencesZ2 * dzSequence) / 2;
+ lLog << MSG::INFO << "dz second part EC:" << dzDetector2 * 2
+ << endmsg;
+ lLog << MSG::INFO << "width second part EC:" << dimensions.dz() * 2
+ << endmsg;
+ lLog << MSG::INFO << "correction of dz (negative = size reduced) second part EB:" << dzDetector2*2 - dimensions.dz()*2
+ << endmsg;
+
+ double dzDetector3 = (numSequencesZ3 * dzSequence) / 2 + 2 * dZEndPlate + space;
+ lLog << MSG::INFO << "dz third part EC:" << dzDetector2 * 2
+ << endmsg;
+
+ // Add structural support made of steel inside of HCal
+ DetElement facePlate1(aHCal, "FacePlate_" + std::to_string(1 * sign), 0);
+ dd4hep::Tube facePlateShape1(dimensions.rmin1(), (sensitiveBarrel1Rmin - space),
+ (dzDetector1 - 2 * dZEndPlate - space));
+ Volume facePlateVol1("facePlateVol1", facePlateShape1, aLcdd.material(xFacePlate.materialStr()));
+ facePlateVol1.setVisAttributes(aLcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace1(0, 0, sign * extBarrelOffset1);
+
+ // Faceplate for 2nd part of extended Barrel
+ DetElement facePlate2(aHCal, "FacePlate_" + std::to_string(2 * sign), 0);
+ dd4hep::Tube facePlateShape2(dimensions.rmin2(), (sensitiveBarrel2Rmin - space),
+ dzDetector2);
+ Volume facePlateVol2("facePlateVol2", facePlateShape2, aLcdd.material(xFacePlate.materialStr()));
+ facePlateVol2.setVisAttributes(aLcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace2(0, 0, sign * extBarrelOffset2);
+
+ // Faceplate for 3rd part of extended Barrel
+ DetElement facePlate3(aHCal, "FacePlate_" + std::to_string(3 * sign), 0);
+ dd4hep::Tube facePlateShape3(dimensions.rmin(), (sensitiveBarrel3Rmin - space),
+ (dzDetector3 - 2 * dZEndPlate - space));
+ Volume facePlateVol3("facePlateVol3", facePlateShape3, aLcdd.material(xFacePlate.materialStr()));
+ facePlateVol3.setVisAttributes(aLcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace3(0, 0, sign * extBarrelOffset3);
+
+ PlacedVolume placedFacePlate1 = aEnvelope.placeVolume(facePlateVol1, offsetFace1);
+ facePlate1.setPlacement(placedFacePlate1);
+ PlacedVolume placedFacePlate2 = aEnvelope.placeVolume(facePlateVol2, offsetFace2);
+ facePlate2.setPlacement(placedFacePlate2);
+ PlacedVolume placedFacePlate3 = aEnvelope.placeVolume(facePlateVol3, offsetFace3);
+ facePlate3.setPlacement(placedFacePlate3);
+
+ // Add structural support made of steel at both ends of extHCal
+ dd4hep::Tube endPlateShape1(dimensions.rmin1(), (dimensions.rmax1() - dSteelSupport), dZEndPlate);
+ Volume endPlateVol1("endPlateVol1", endPlateShape1, aLcdd.material(xEndPlate.materialStr()));
+ endPlateVol1.setVisAttributes(aLcdd, xEndPlate.visStr());
+ dd4hep::Tube endPlateShape3(dimensions.rmin(), (dimensions.rmax() - dSteelSupport), dZEndPlate);
+ Volume endPlateVol3("endPlateVol3", endPlateShape3, aLcdd.material(xEndPlate.materialStr()));
+ endPlateVol3.setVisAttributes(aLcdd, xEndPlate.visStr());
+
+ // Endplates placed for the extended Barrels in front and in the back to the central Barrel
+ DetElement endPlatePos(aHCal, "endPlate_" + std::to_string(1 * sign), 0);
+ dd4hep::Position posOffset(0, 0, sign * (extBarrelOffset3 + dzDetector3 - dZEndPlate));
+ PlacedVolume placedEndPlatePos = aEnvelope.placeVolume(endPlateVol3, posOffset);
+ endPlatePos.setPlacement(placedEndPlatePos);
+
+ DetElement endPlateNeg(aHCal, "endPlate_" + std::to_string(2 * sign), 0);
+ dd4hep::Position negOffset(0, 0, sign * (extBarrelOffset1 - dzDetector1 + dZEndPlate));
+ PlacedVolume placedEndPlateNeg = aEnvelope.placeVolume(endPlateVol1, negOffset);
+ endPlateNeg.setPlacement(placedEndPlateNeg);
+
+ std::vector layers;
+ layers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+ std::vector > seqInLayers;
+ seqInLayers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+ std::vector tilesPerLayer;
+ tilesPerLayer.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+
+ // loop over R ("layers")
+ double layerR = 0.;
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer) {
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel1Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel1Rmin + layerR + layerDepths1.at(idxLayer);
+ layerR += layerDepths1.at(idxLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol1", tileSequenceShape, aLcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector1 );
+ Volume layerVolume("HCalECLayerVol1", layerShape, aLcdd.air());
+
+
+ layerVolume.setVisAttributes(aLcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ dd4hep::Position moduleOffset1 (0,0,sign * extBarrelOffset1);
+
+ dd4hep::PlacedVolume placedLayerVolume = aEnvelope.placeVolume(layerVolume, moduleOffset1);
+ unsigned int type1 = 0;
+ if (sign<0) {
+ type1 = 3;
+ }
+ placedLayerVolume.addPhysVolID("type", type1); // First module type=0,3 in front of second +/-
+ placedLayerVolume.addPhysVolID("layer", idxLayer);
+ layers.push_back(placedLayerVolume);
- double tileZOffset = - 0.5* dzSequence;
-
- // first Z loop (tiles that make up a sequence)
- for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
- xml_comp_t xComp = xCompColl;
- dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
-
- Volume tileVol("HCalECTileVol_"+ xComp.materialStr(), tileShape, lcdd.material(xComp.materialStr()));
- tileVol.setVisAttributes(lcdd, xComp.visStr());
-
- dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
- dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
-
- if (xComp.isSensitive()){
- tileVol.setSensitiveDetector(sensDet);
- tilesPerLayer.push_back(placedTileVol);
- }
- tileZOffset += xComp.thickness();
- }
-
- // second z loop (place sequences in layer)
- std::vector seqs;
- double zOffset = - dzDetector1 + 0.5 * dzSequence; //2*dZEndPlate + space + 0.5 * dzSequence;
-
- for (uint numSeq=0; numSeq < numSequencesZ1; numSeq++){
- dd4hep::Position tileSequencePosition(0, 0, zOffset);
- dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
- placedTileSequenceVolume.addPhysVolID("row", numSeq);
- seqs.push_back(placedTileSequenceVolume);
- zOffset += dzSequence;
- }
- seqInLayers.push_back(seqs);
- } // layers loop
-
-
- layerR = 0.;
- // Placement of subWedges in Wedge, 2nd part
- for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer){
- // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
- double rminLayer = sensitiveBarrel2Rmin + layerR;
- double rmaxLayer = sensitiveBarrel2Rmin + layerR + layerDepths2.at(idxLayer);
- layerR += layerDepths2.at(idxLayer);
- layerInnerRadii2.push_back(rminLayer);
-
- //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
- unsigned int sequenceIdx = (idxLayer+1) % 2;
-
- dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalECTileSequenceVol2", tileSequenceShape, lcdd.air());
-
- lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
- dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector2);
- Volume layerVolume("HCalECLayerVol2", layerShape, lcdd.air());
-
- layerVolume.setVisAttributes(lcdd.invisible());
- unsigned int idxSubMod = 0;
-
- double tileZOffset = - 0.5* dzSequence;
-
- // first Z loop (tiles that make up a sequence)
- for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
- xml_comp_t xComp = xCompColl;
- dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
-
- Volume tileVol("HCalECTileVol_", tileShape, lcdd.material(xComp.materialStr()));
- tileVol.setVisAttributes(lcdd, xComp.visStr());
-
- dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
- dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
-
- if (xComp.isSensitive()){
- tileVol.setSensitiveDetector(sensDet);
- tilesPerLayer.push_back(placedTileVol);
- }
- tileZOffset += xComp.thickness();
- } // close first Z loop
-
- // second z loop (place sequences in layer)
- std::vector seqs;
- double zOffset = - dzDetector2 + 0.5 * dzSequence; //(dzSequence * 0.5);
-
- for (uint numSeq=0; numSeq < numSequencesZ2; numSeq++){
- dd4hep::Position tileSequencePosition(0, 0, zOffset);
- dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
- placedTileSequenceVolume.addPhysVolID("row", numSeq);
- seqs.push_back(placedTileSequenceVolume);
- zOffset += dzSequence;
- }
- seqInLayers.push_back(seqs);
-
- dd4hep::Position moduleOffset2 (0, 0, sign * extBarrelOffset2);
- dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset2);
- unsigned int type2 = 1;
- if (sign<0){
- type2 = 4;
- }
- placedLayerVolume.addPhysVolID("type", type2); // Second module type=1,4 behind the first +/-
- placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + idxLayer);
- layers.push_back(placedLayerVolume);
- }
-
- layerR = 0.;
- // Placement of subWedges in Wedge, 3th part
- for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer){
- // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
- double rminLayer = sensitiveBarrel3Rmin + layerR;
- double rmaxLayer = sensitiveBarrel3Rmin + layerR + layerDepths3.at(idxLayer);
- layerR += layerDepths3.at(idxLayer);
- layerInnerRadii3.push_back(rminLayer);
-
-
- //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
- unsigned int sequenceIdx = (idxLayer+1) % 2;
-
- dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalECTileSequenceVol3", tileSequenceShape, lcdd.air());
-
- lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
-
- dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector3);
- Volume layerVolume("HCalECLayerVol3", layerShape, lcdd.air());
-
- layerVolume.setVisAttributes(lcdd.invisible());
- unsigned int idxSubMod = 0;
-
- double tileZOffset = - 0.5* dzSequence;
-
- // first Z loop (tiles that make up a sequence)
- for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
- xml_comp_t xComp = xCompColl;
- dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
-
- Volume tileVol("HCalECTileVol_" , tileShape, lcdd.material(xComp.materialStr()));
- tileVol.setVisAttributes(lcdd, xComp.visStr());
-
- dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
- dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
-
- if (xComp.isSensitive()){
- tileVol.setSensitiveDetector(sensDet);
- tilesPerLayer.push_back(placedTileVol);
- }
- tileZOffset += xComp.thickness();
- }
-
- // second z loop (place sequences in layer)
- std::vector seqs;
- double zOffset = - dzDetector3 + 0.5 * dzSequence; //2*dZEndPlate + space + (dzSequence * 0.5);
-
- for (uint numSeq=0; numSeq < numSequencesZ3; numSeq++){
- dd4hep::Position tileSequencePosition(0, 0, zOffset);
- dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
- placedTileSequenceVolume.addPhysVolID("row", numSeq);
- seqs.push_back(placedTileSequenceVolume);
- zOffset += dzSequence;
- }
- seqInLayers.push_back(seqs);
-
- dd4hep::Position moduleOffset3 (0, 0, sign * extBarrelOffset3);
- dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset3);
- unsigned int type3 = 2;
- if (sign<0){
- type3 = 5;
- }
- placedLayerVolume.addPhysVolID("type", type3); // Second module type=2,5 behind the first +/-
- placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + layerDepths2.size() + idxLayer);
- layers.push_back(placedLayerVolume);
- } // end loop placement of subwedges
-
- // Placement of DetElements
- lLog << MSG::DEBUG << "Layers in r : " << layers.size() << std::endl;
- lLog << MSG::DEBUG << "Tiles in layers :" << tilesPerLayer.size() << std::endl;
-
- // Place det elements wihtin each other to recover volume positions later via cellID
- for (uint iLayer = 0; iLayer < (layerDepths1.size()+layerDepths2.size()+layerDepths3.size()); iLayer++){
- DetElement layerDet(caloDetElem, dd4hep::xml::_toString(sign*(iLayer+1), "layer%d"), sign*(iLayer+1));
- layerDet.setPlacement(layers[iLayer]);
-
- for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
- DetElement seqDet(layerDet, dd4hep::xml::_toString(iSeq, "seq%d"), sign*(iSeq+1));
- seqDet.setPlacement(seqInLayers[iLayer][iSeq]);
-
- DetElement tileDet(seqDet, dd4hep::xml::_toString(iSeq, "tile%d"), sign*(iSeq+1));
- tileDet.setPlacement(tilesPerLayer[iLayer]);
- }
- }
- } // for signs loop
-
- // Place envelope volume
- Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
-
- PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
- placedHCal.addPhysVolID("system", caloDetElem.id());
- caloDetElem.setPlacement(placedHCal);
-
-
- // Create caloData object
- auto caloData = new dd4hep::rec::LayeredCalorimeterData;
- caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::EndcapLayout;
- caloDetElem.addExtension(caloData);
-
- caloData->extent[0] = sensitiveBarrel3Rmin;
- caloData->extent[1] = sensitiveBarrel3Rmin + moduleDepth3; //
- caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
- caloData->extent[3] = dzDetector1 + dzDetector2 + dzDetector3;
-
- dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
-
- // IMPORTANT: the information below is used to calculate the cell position in CellPositionsHCalPhiThetaSegTool in k4RecCalorimeter
- // if the definition distance or sensitive_thickness is modified, one also needs to modify CellPositionsHCalPhiThetaSegTool
- for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer) {
- const double difference_bet_r1r2 = layerDepths1.at(idxLayer);
- caloLayer.distance = layerInnerRadii1.at(idxLayer); // radius of the current layer
- caloLayer.sensitive_thickness = difference_bet_r1r2; // radial dimension of the current layer
- caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
- caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
-
- caloData->layers.push_back(caloLayer);
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
+ ++xCompColl, ++idxSubMod) {
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_"+ xComp.materialStr()
+ , tileShape,
+ aLcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(aLcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()) {
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ }
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector1 + 0.5 * dzSequence; //2*dZEndPlate + space + 0.5 * dzSequence;
+
+ for (uint numSeq=0; numSeq < numSequencesZ1; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
}
+ seqInLayers.push_back(seqs);
+ }
+
+
+ layerR = 0.;
+ // Placement of subWedges in Wedge, 2nd part
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer) {
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel2Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel2Rmin + layerR + layerDepths2.at(idxLayer);
+ layerR += layerDepths2.at(idxLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol2", tileSequenceShape, aLcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
- for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer) {
- const double difference_bet_r1r2 = layerDepths2.at(idxLayer);
- caloLayer.distance = layerInnerRadii2.at(idxLayer);
- caloLayer.sensitive_thickness = difference_bet_r1r2;
- caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
- caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
- caloData->layers.push_back(caloLayer);
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector2);
+ Volume layerVolume("HCalECLayerVol2", layerShape, aLcdd.air());
+
+ layerVolume.setVisAttributes(aLcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
+ ++xCompColl, ++idxSubMod) {
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_"
+ , tileShape,
+ aLcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(aLcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()) {
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
}
- for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer) {
- const double difference_bet_r1r2 = layerDepths3.at(idxLayer);
- caloLayer.distance = layerInnerRadii3.at(idxLayer);
- caloLayer.sensitive_thickness = difference_bet_r1r2;
- caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
- caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector2 + 0.5 * dzSequence; //(dzSequence * 0.5);
+
+ for (uint numSeq=0; numSeq < numSequencesZ2; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
- caloData->layers.push_back(caloLayer);
+ dd4hep::Position moduleOffset2 (0, 0, sign * extBarrelOffset2);
+ dd4hep::PlacedVolume placedLayerVolume = aEnvelope.placeVolume(layerVolume, moduleOffset2);
+ unsigned int type2 = 1;
+ if (sign<0) {
+ type2 = 4;
}
- return caloDetElem;
-}
-}// namespace det
+ placedLayerVolume.addPhysVolID("type", type2); // Second module type=1,4 behind the first +/-
+ placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + idxLayer);
+ layers.push_back(placedLayerVolume);
+ }
+
+ layerR = 0.;
+ // Placement of subWedges in Wedge, 3th part
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer) {
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel3Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel3Rmin + layerR + layerDepths3.at(idxLayer);
+ layerR += layerDepths3.at(idxLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol3", tileSequenceShape, aLcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector3);
+ Volume layerVolume("HCalECLayerVol3", layerShape, aLcdd.air());
+
+ layerVolume.setVisAttributes(aLcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
+ ++xCompColl, ++idxSubMod) {
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_"
+ , tileShape,
+ aLcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(aLcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()) {
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ }
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector3 + 0.5 * dzSequence; //2*dZEndPlate + space + (dzSequence * 0.5);
+
+ for (uint numSeq=0; numSeq < numSequencesZ3; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
+
+ dd4hep::Position moduleOffset3 (0, 0, sign * extBarrelOffset3);
+ dd4hep::PlacedVolume placedLayerVolume = aEnvelope.placeVolume(layerVolume, moduleOffset3);
+ unsigned int type3 = 2;
+ if (sign<0) {
+ type3 = 5;
+ }
+ placedLayerVolume.addPhysVolID("type", type3); // Second module type=2,5 behind the first +/-
+ placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + layerDepths2.size() + idxLayer);
+ layers.push_back(placedLayerVolume);
+ }
+
+ // Placement of DetElements
+ lLog << MSG::DEBUG << "Layers in r : " << layers.size() << std::endl;
+ lLog << MSG::DEBUG << "Tiles in layers :" << tilesPerLayer.size() << std::endl;
+
+ for (uint iLayer = 0; iLayer < (layerDepths1.size()+layerDepths2.size()+layerDepths3.size()); iLayer++) {
+ DetElement layerDet(aHCal, dd4hep::xml::_toString(sign*(iLayer+1), "layer%d"), sign*(iLayer+1));
+ layerDet.setPlacement(layers[iLayer]);
+
+ for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
+ DetElement seqDet(layerDet, dd4hep::xml::_toString(iSeq, "seq%d"), sign*(iSeq+1));
+ seqDet.setPlacement(seqInLayers[iLayer][iSeq]);
+
+ DetElement tileDet(seqDet, dd4hep::xml::_toString(iSeq, "tile%d"), sign*(iSeq+1));
+ tileDet.setPlacement(tilesPerLayer[iLayer]);
+ }
+ }
+
+}
+
+static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4hep::SensitiveDetector sensDet) {
+
+
+ xml_det_t xmlDet = xmlElement;
+ std::string detName = xmlDet.nameStr();
+
+ // Make DetElement
+ dd4hep::DetElement hCalEC(detName, xmlDet.id());
+
+ // Make volume that envelopes the whole barrel; set material to air
+ Dimension dimensions(xmlDet.dimensions());
+
+ dd4hep::Tube envelope(dimensions.rmin(), dimensions.rmax1(), (dimensions.v_offset() + dimensions.z_length()));
+ dd4hep::Tube negative1(dimensions.rmin(), dimensions.rmax1(), (dimensions.offset() - dimensions.width()));
+ dd4hep::Tube negative2(dimensions.rmin(), dimensions.rmin1(), (dimensions.z_offset() - dimensions.dz()));
+ dd4hep::Tube negative3(dimensions.rmin(), dimensions.rmin2(), (dimensions.v_offset() - dimensions.z_length()));
+ dd4hep::SubtractionSolid envelopeShapeTmp1(envelope, negative1);
+ dd4hep::SubtractionSolid envelopeShapeTmp2(envelopeShapeTmp1, negative2);
+ dd4hep::SubtractionSolid envelopeShape(envelopeShapeTmp2, negative3);
+
+ Volume envelopeVolume(detName + "_volume", envelopeShape, lcdd.air());
+ envelopeVolume.setVisAttributes(lcdd, dimensions.visStr());
+
+ lLog << MSG::DEBUG << "Placing detector on the positive side: (cm) " << (dimensions.offset() + dimensions.dz())
+ << endmsg;
+ buildEC(lcdd, sensDet, envelopeVolume, hCalEC, xmlElement, 1);
+ lLog << MSG::DEBUG << "Placing detector on the negative side: (cm) " << -(dimensions.offset() + dimensions.dz())
+ << endmsg;
+ buildEC(lcdd, sensDet, envelopeVolume, hCalEC, xmlElement, -1);
+
+ // Place envelope volume
+ Volume motherVol = lcdd.pickMotherVolume(hCalEC);
+
+ PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
+ placedHCal.addPhysVolID("system", xmlDet.id());
+ hCalEC.setPlacement(placedHCal);
+
+ return hCalEC;
+}
+} // namespace hcal
+
DECLARE_DETELEMENT(CaloThreePartsEndcap_o1_v01, det::createHCalEC)
diff --git a/detector/calorimeter/HCalThreePartsEndcap_o1_v02_geo.cpp b/detector/calorimeter/HCalThreePartsEndcap_o1_v02_geo.cpp
new file mode 100644
index 000000000..da2ec6af9
--- /dev/null
+++ b/detector/calorimeter/HCalThreePartsEndcap_o1_v02_geo.cpp
@@ -0,0 +1,497 @@
+// DD4hep
+#include "DD4hep/DetFactoryHelper.h"
+#include
+
+// todo: remove gaudi logging and properly capture output
+#define endmsg std::endl
+#define lLog std::cout
+namespace MSG {
+const std::string ERROR = "createHCalThrePartsEndcap ERROR ";
+const std::string DEBUG = "createHCalThrePartsEndcap DEBUG ";
+const std::string INFO = "createHCalThrePartsEndcap INFO ";
+}
+
+using dd4hep::Volume;
+using dd4hep::DetElement;
+using dd4hep::xml::Dimension;
+using dd4hep::PlacedVolume;
+using xml_comp_t = dd4hep::xml::Component;
+using xml_det_t = dd4hep::xml::DetElement;
+using xml_h = dd4hep::xml::Handle_t;
+
+namespace det {
+static dd4hep::Ref_t createHCalEC(dd4hep::Detector& lcdd, xml_h xmlElement, dd4hep::SensitiveDetector sensDet){
+ xml_det_t xmlDet = xmlElement;
+ std::string detName = xmlDet.nameStr();
+
+ // Make DetElement
+ dd4hep::DetElement caloDetElem(detName, xmlDet.id());
+
+ // Make volume that envelopes the whole endcap; set material to air
+ Dimension dimensions(xmlDet.dimensions());
+
+ dd4hep::Tube envelope(dimensions.rmin(), dimensions.rmax1(), (dimensions.v_offset() + dimensions.z_length()));
+ dd4hep::Tube negative1(dimensions.rmin(), dimensions.rmax1(), (dimensions.offset() - dimensions.width()));
+ dd4hep::Tube negative2(dimensions.rmin(), dimensions.rmin1(), (dimensions.z_offset() - dimensions.dz()));
+ dd4hep::Tube negative3(dimensions.rmin(), dimensions.rmin2(), (dimensions.v_offset() - dimensions.z_length()));
+
+ dd4hep::SubtractionSolid envelopeShapeTmp1(envelope, negative1);
+ dd4hep::SubtractionSolid envelopeShapeTmp2(envelopeShapeTmp1, negative2);
+ dd4hep::SubtractionSolid envelopeShape(envelopeShapeTmp2, negative3);
+
+ Volume envelopeVolume(detName + "_volume", envelopeShape, lcdd.air());
+ envelopeVolume.setVisAttributes(lcdd, dimensions.visStr());
+
+ // Set sensitive detector type
+ Dimension sensDetType = xmlElement.child(_Unicode(sensitive));
+ sensDet.setType(sensDetType.typeStr());
+
+ xml_comp_t xEndPlate = xmlElement.child(_Unicode(end_plate));
+ double dZEndPlate = xEndPlate.thickness() / 2.;
+ xml_comp_t xFacePlate = xmlElement.child(_Unicode(face_plate));
+ double dRhoFacePlate = xFacePlate.thickness() / 2.;
+ xml_comp_t xSpace = xmlElement.child(_Unicode(plate_space)); // to avoid overlaps
+ double space = xSpace.thickness();
+ xml_comp_t xSteelSupport = xmlElement.child(_Unicode(steel_support));
+ double dSteelSupport = xSteelSupport.thickness();
+ lLog << MSG::DEBUG << "steel support thickness " << dSteelSupport << endmsg;
+ lLog << MSG::DEBUG << "steel support material " << xSteelSupport.materialStr() << endmsg;
+
+ // Calculate sensitive barrel dimensions
+ double sensitiveBarrel1Rmin = dimensions.rmin1() + 2 * dRhoFacePlate + space;
+ double sensitiveBarrel2Rmin = dimensions.rmin2() + 2 * dRhoFacePlate + space;
+ double sensitiveBarrel3Rmin = dimensions.rmin() + 2 * dRhoFacePlate + space;
+
+ // Offset in z is given as distance from 0 to the middle of the Calorimeter volume
+ double extBarrelOffset1 = dimensions.offset();
+ double extBarrelOffset2 = dimensions.z_offset();
+ double extBarrelOffset3 = dimensions.v_offset();
+
+ // Hard-coded assumption that we have two different sequences for the modules
+ std::vector sequences = {xmlElement.child(_Unicode(sequence_a)), xmlElement.child(_Unicode(sequence_b))};
+ // Check if both sequences are present
+ if (!sequences[0] || !sequences[1]) {
+ lLog << MSG::ERROR << "The two sequences sequence_a and sequence_b must be present in the xml file." << endmsg;
+ throw std::runtime_error("Missing sequence_a or sequence_b in the xml file.");
+ }
+ // Check if both sequences have the same dimensions
+ Dimension dimensionsA(sequences[0].dimensions());
+ Dimension dimensionsB(sequences[1].dimensions());
+ if (dimensionsA.dz() != dimensionsB.dz()) {
+ lLog << MSG::ERROR << "The dimensions of sequence_a and sequence_b do not match." << endmsg;
+ throw std::runtime_error("The dimensions of the sequence_a and sequence_b do not match.");
+ }
+ double dzSequence = dimensionsB.dz();
+ lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
+
+ // calculate the number of modules fitting in Z
+ unsigned int numSequencesZ1 = static_cast((2 * dimensions.width() - 2 * dZEndPlate - space) / dzSequence);
+ unsigned int numSequencesZ2 = static_cast((2 * dimensions.dz() - 2 * dZEndPlate - space) / dzSequence);
+ unsigned int numSequencesZ3 = static_cast((2 * dimensions.z_length() - 2 * dZEndPlate - space) / dzSequence);
+
+ unsigned int numLayersR1 = 0;
+ unsigned int numLayersR2 = 0;
+ unsigned int numLayersR3 = 0;
+ double moduleDepth1 = 0.;
+ double moduleDepth2 = 0.;
+ double moduleDepth3 = 0.;
+
+ std::vector layerDepths1 = std::vector();
+ std::vector layerDepths2 = std::vector();
+ std::vector layerDepths3 = std::vector();
+
+ std::vector layerInnerRadii1 = std::vector();
+ std::vector layerInnerRadii2 = std::vector();
+ std::vector layerInnerRadii3 = std::vector();
+
+ // iterating over XML elements to retrieve all child elements of 'layers'
+ for (xml_coll_t xCompColl(xmlElement.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl){
+ xml_comp_t currentLayer = xCompColl;
+ Dimension layerDimension(currentLayer.dimensions());
+ numLayersR1 += layerDimension.nmodules();
+ numLayersR2 += layerDimension.nsegments();
+ numLayersR3 += layerDimension.nPads();
+
+ for (int nLayer = 0; nLayer < layerDimension.nmodules(); nLayer++){
+ moduleDepth1 += layerDimension.dr();
+ layerDepths1.push_back(layerDimension.dr());
+ }
+ for (int nLayer = 0; nLayer < layerDimension.nsegments(); nLayer++){
+ moduleDepth2 += layerDimension.dr();
+ layerDepths2.push_back(layerDimension.dr());
+ }
+ for (int nLayer = 0; nLayer < layerDimension.nPads(); nLayer++){
+ moduleDepth3 += layerDimension.dr();
+ layerDepths3.push_back(layerDimension.dr());
+ }
+ }
+
+ lLog << MSG::DEBUG << "retrieved number of layers in first Endcap part: " << numLayersR1 << " , which end up to a full module depth in rho of " << moduleDepth1 << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in second Endcap part: " << numLayersR2 << " , which end up to a full module depth in rho of " << moduleDepth2 << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers in third Endcap part: " << numLayersR3 << " , which end up to a full module depth in rho of " << moduleDepth3 << " cm" << endmsg;
+
+ lLog << MSG::INFO << "constructing first part EC: with z offset " << extBarrelOffset1 << " cm: "<< numSequencesZ1 << " sequences in Z, " << numLayersR1 << " layers in Rho, " << numLayersR1 * numSequencesZ1 << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing second part EC: with offset " << extBarrelOffset2 << " cm: " << numSequencesZ2 << " sequences in Z, " << numLayersR2 << " layers in Rho, " << layerDepths2.size() * numSequencesZ2 << " tiles" << endmsg;
+
+ lLog << MSG::INFO << "constructing third part EC: with offset " << extBarrelOffset3 << " cm: " << numSequencesZ3 << " sequences in Z, " << numLayersR3 << " layers in Rho, " << layerDepths3.size() * numSequencesZ3 << " tiles" << endmsg;
+
+ lLog << MSG::INFO << "number of channels: " << (numLayersR1 * numSequencesZ1) + (numLayersR2 * numSequencesZ2) + (numLayersR3 * numSequencesZ3) << endmsg;
+
+ // Calculate correction along z based on the module size (can only have natural number of modules)
+ double dzDetector1 = (numSequencesZ1 * dzSequence) / 2 + 2 * dZEndPlate + space;
+ double dzDetector2 = (numSequencesZ2 * dzSequence) / 2;
+ double dzDetector3 = (numSequencesZ3 * dzSequence) / 2 + 2 * dZEndPlate + space;
+
+ lLog << MSG::INFO << "correction of dz (negative = size reduced) first part EC :" << dzDetector1*2 - dimensions.width()*2 << endmsg;
+ lLog << MSG::INFO << "dz second part EC:" << dzDetector2 * 2 << endmsg;
+ lLog << MSG::INFO << "width second part EC:" << dimensions.dz() * 2 << endmsg;
+ lLog << MSG::INFO << "correction of dz (negative = size reduced) second part EB:" << dzDetector2*2 - dimensions.dz()*2 << endmsg;
+
+ lLog << MSG::INFO << "dz third part EC:" << dzDetector3 * 2 << endmsg;
+
+
+ for (int iSign = -1; iSign < 2; iSign+=2){
+ int sign;
+ if(iSign < 0){
+ sign = -1;
+ lLog << MSG::DEBUG << "Placing detector on the negative side: (cm) " << -(dimensions.offset() + dimensions.dz()) << endmsg;
+ }
+ else{
+ sign = +1;
+ lLog << MSG::DEBUG << "Placing detector on the positive side: (cm) " << (dimensions.offset() + dimensions.dz()) << endmsg;
+ }
+ // Add structural support made of steel inside of HCal
+ DetElement facePlate1(caloDetElem, "FacePlate_" + std::to_string(1 * sign), 0);
+ dd4hep::Tube facePlateShape1(dimensions.rmin1(), (sensitiveBarrel1Rmin - space), (dzDetector1 - 2 * dZEndPlate - space));
+ Volume facePlateVol1("facePlateVol1", facePlateShape1, lcdd.material(xFacePlate.materialStr()));
+ facePlateVol1.setVisAttributes(lcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace1(0, 0, sign * extBarrelOffset1);
+
+ // Faceplate for 2nd part of extended Barrel
+ DetElement facePlate2(caloDetElem, "FacePlate_" + std::to_string(2 * sign), 0);
+ dd4hep::Tube facePlateShape2(dimensions.rmin2(), (sensitiveBarrel2Rmin - space),
+ dzDetector2);
+ Volume facePlateVol2("facePlateVol2", facePlateShape2, lcdd.material(xFacePlate.materialStr()));
+ facePlateVol2.setVisAttributes(lcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace2(0, 0, sign * extBarrelOffset2);
+
+ // Faceplate for 3rd part of extended Barrel
+ DetElement facePlate3(caloDetElem, "FacePlate_" + std::to_string(3 * sign), 0);
+ dd4hep::Tube facePlateShape3(dimensions.rmin(), (sensitiveBarrel3Rmin - space),
+ (dzDetector3 - 2 * dZEndPlate - space));
+ Volume facePlateVol3("facePlateVol3", facePlateShape3, lcdd.material(xFacePlate.materialStr()));
+ facePlateVol3.setVisAttributes(lcdd, xFacePlate.visStr());
+ dd4hep::Position offsetFace3(0, 0, sign * extBarrelOffset3);
+
+ PlacedVolume placedFacePlate1 = envelopeVolume.placeVolume(facePlateVol1, offsetFace1);
+ facePlate1.setPlacement(placedFacePlate1);
+ PlacedVolume placedFacePlate2 = envelopeVolume.placeVolume(facePlateVol2, offsetFace2);
+ facePlate2.setPlacement(placedFacePlate2);
+ PlacedVolume placedFacePlate3 = envelopeVolume.placeVolume(facePlateVol3, offsetFace3);
+ facePlate3.setPlacement(placedFacePlate3);
+
+ // Add structural support made of steel at both ends of extHCal
+ dd4hep::Tube endPlateShape1(dimensions.rmin1(), (dimensions.rmax1() - dSteelSupport), dZEndPlate);
+ Volume endPlateVol1("endPlateVol1", endPlateShape1, lcdd.material(xEndPlate.materialStr()));
+ endPlateVol1.setVisAttributes(lcdd, xEndPlate.visStr());
+ dd4hep::Tube endPlateShape3(dimensions.rmin(), (dimensions.rmax() - dSteelSupport), dZEndPlate);
+ Volume endPlateVol3("endPlateVol3", endPlateShape3, lcdd.material(xEndPlate.materialStr()));
+ endPlateVol3.setVisAttributes(lcdd, xEndPlate.visStr());
+
+ // Endplates placed for the extended Barrels in front and in the back to the central Barrel
+ DetElement endPlatePos(caloDetElem, "endPlate_" + std::to_string(1 * sign), 0);
+ dd4hep::Position posOffset(0, 0, sign * (extBarrelOffset3 + dzDetector3 - dZEndPlate));
+ PlacedVolume placedEndPlatePos = envelopeVolume.placeVolume(endPlateVol3, posOffset);
+ endPlatePos.setPlacement(placedEndPlatePos);
+
+ DetElement endPlateNeg(caloDetElem, "endPlate_" + std::to_string(2 * sign), 0);
+ dd4hep::Position negOffset(0, 0, sign * (extBarrelOffset1 - dzDetector1 + dZEndPlate));
+ PlacedVolume placedEndPlateNeg = envelopeVolume.placeVolume(endPlateVol1, negOffset);
+ endPlateNeg.setPlacement(placedEndPlateNeg);
+
+ std::vector layers;
+ layers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+ std::vector > seqInLayers;
+ seqInLayers.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+ std::vector tilesPerLayer;
+ tilesPerLayer.reserve(layerDepths1.size()+layerDepths2.size()+layerDepths3.size());
+
+ // loop over R ("layers")
+ double layerR = 0.;
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer){
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel1Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel1Rmin + layerR + layerDepths1.at(idxLayer);
+ layerR += layerDepths1.at(idxLayer);
+ layerInnerRadii1.push_back(rminLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol1", tileSequenceShape, lcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector1 );
+ Volume layerVolume("HCalECLayerVol1", layerShape, lcdd.air());
+
+ layerVolume.setVisAttributes(lcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ dd4hep::Position moduleOffset1 (0,0,sign * extBarrelOffset1);
+
+ dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset1);
+ unsigned int type1 = 0;
+ if (sign<0){
+ type1 = 3;
+ }
+ placedLayerVolume.addPhysVolID("type", type1); // First module type=0,3 in front of second +/-
+ placedLayerVolume.addPhysVolID("layer", idxLayer);
+
+ layers.push_back(placedLayerVolume);
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_"+ xComp.materialStr(), tileShape, lcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(lcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()){
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ }
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector1 + 0.5 * dzSequence; //2*dZEndPlate + space + 0.5 * dzSequence;
+
+ for (uint numSeq=0; numSeq < numSequencesZ1; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
+ } // layers loop
+
+
+ layerR = 0.;
+ // Placement of subWedges in Wedge, 2nd part
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer){
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel2Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel2Rmin + layerR + layerDepths2.at(idxLayer);
+ layerR += layerDepths2.at(idxLayer);
+ layerInnerRadii2.push_back(rminLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol2", tileSequenceShape, lcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector2);
+ Volume layerVolume("HCalECLayerVol2", layerShape, lcdd.air());
+
+ layerVolume.setVisAttributes(lcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_", tileShape, lcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(lcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()){
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ } // close first Z loop
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector2 + 0.5 * dzSequence; //(dzSequence * 0.5);
+
+ for (uint numSeq=0; numSeq < numSequencesZ2; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
+
+ dd4hep::Position moduleOffset2 (0, 0, sign * extBarrelOffset2);
+ dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset2);
+ unsigned int type2 = 1;
+ if (sign<0){
+ type2 = 4;
+ }
+ placedLayerVolume.addPhysVolID("type", type2); // Second module type=1,4 behind the first +/-
+ placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + idxLayer);
+ layers.push_back(placedLayerVolume);
+ }
+
+ layerR = 0.;
+ // Placement of subWedges in Wedge, 3th part
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer){
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrel3Rmin + layerR;
+ double rmaxLayer = sensitiveBarrel3Rmin + layerR + layerDepths3.at(idxLayer);
+ layerR += layerDepths3.at(idxLayer);
+ layerInnerRadii3.push_back(rminLayer);
+
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = (idxLayer+1) % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalECTileSequenceVol3", tileSequenceShape, lcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector3);
+ Volume layerVolume("HCalECLayerVol3", layerShape, lcdd.air());
+
+ layerVolume.setVisAttributes(lcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+ double tileZOffset = - 0.5* dzSequence;
+
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl; ++xCompColl, ++idxSubMod){
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalECTileVol_" , tileShape, lcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(lcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()){
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ }
+
+ // second z loop (place sequences in layer)
+ std::vector seqs;
+ double zOffset = - dzDetector3 + 0.5 * dzSequence; //2*dZEndPlate + space + (dzSequence * 0.5);
+
+ for (uint numSeq=0; numSeq < numSequencesZ3; numSeq++){
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ seqs.push_back(placedTileSequenceVolume);
+ zOffset += dzSequence;
+ }
+ seqInLayers.push_back(seqs);
+
+ dd4hep::Position moduleOffset3 (0, 0, sign * extBarrelOffset3);
+ dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume, moduleOffset3);
+ unsigned int type3 = 2;
+ if (sign<0){
+ type3 = 5;
+ }
+ placedLayerVolume.addPhysVolID("type", type3); // Second module type=2,5 behind the first +/-
+ placedLayerVolume.addPhysVolID("layer", layerDepths1.size() + layerDepths2.size() + idxLayer);
+ layers.push_back(placedLayerVolume);
+ } // end loop placement of subwedges
+
+ // Placement of DetElements
+ lLog << MSG::DEBUG << "Layers in r : " << layers.size() << std::endl;
+ lLog << MSG::DEBUG << "Tiles in layers :" << tilesPerLayer.size() << std::endl;
+
+ // Place det elements wihtin each other to recover volume positions later via cellID
+ for (uint iLayer = 0; iLayer < (layerDepths1.size()+layerDepths2.size()+layerDepths3.size()); iLayer++){
+ DetElement layerDet(caloDetElem, dd4hep::xml::_toString(sign*(iLayer+1), "layer%d"), sign*(iLayer+1));
+ layerDet.setPlacement(layers[iLayer]);
+
+ for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
+ DetElement seqDet(layerDet, dd4hep::xml::_toString(iSeq, "seq%d"), sign*(iSeq+1));
+ seqDet.setPlacement(seqInLayers[iLayer][iSeq]);
+
+ DetElement tileDet(seqDet, dd4hep::xml::_toString(iSeq, "tile%d"), sign*(iSeq+1));
+ tileDet.setPlacement(tilesPerLayer[iLayer]);
+ }
+ }
+ } // for signs loop
+
+ // Place envelope volume
+ Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
+
+ PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
+ placedHCal.addPhysVolID("system", caloDetElem.id());
+ caloDetElem.setPlacement(placedHCal);
+
+
+ // Create caloData object
+ auto caloData = new dd4hep::rec::LayeredCalorimeterData;
+ caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::EndcapLayout;
+ caloDetElem.addExtension(caloData);
+
+ caloData->extent[0] = sensitiveBarrel3Rmin;
+ caloData->extent[1] = sensitiveBarrel3Rmin + moduleDepth3; //
+ caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
+ caloData->extent[3] = dzDetector1 + dzDetector2 + dzDetector3;
+
+ dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
+
+ // IMPORTANT: the information below is used to calculate the cell position in CellPositionsHCalPhiThetaSegTool in k4RecCalorimeter
+ // if the definition distance or sensitive_thickness is modified, one also needs to modify CellPositionsHCalPhiThetaSegTool
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths1.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths1.at(idxLayer);
+ caloLayer.distance = layerInnerRadii1.at(idxLayer); // radius of the current layer
+ caloLayer.sensitive_thickness = difference_bet_r1r2; // radial dimension of the current layer
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
+
+ caloData->layers.push_back(caloLayer);
+ }
+
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths2.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths2.at(idxLayer);
+ caloLayer.distance = layerInnerRadii2.at(idxLayer);
+ caloLayer.sensitive_thickness = difference_bet_r1r2;
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
+
+ caloData->layers.push_back(caloLayer);
+ }
+
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths3.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths3.at(idxLayer);
+ caloLayer.distance = layerInnerRadii3.at(idxLayer);
+ caloLayer.sensitive_thickness = difference_bet_r1r2;
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
+
+ caloData->layers.push_back(caloLayer);
+ }
+ return caloDetElem;
+}
+}// namespace det
+DECLARE_DETELEMENT(CaloThreePartsEndcap_o1_v02, det::createHCalEC)
From d705b1b9e1b16d1a15de7f2951e5adfd31719dd2 Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Thu, 8 Aug 2024 15:13:12 +0200
Subject: [PATCH 019/133] adding version nr also for the barrel xml
---
.../ALLEGRO_o1_v03/HCalBarrel_TileCal.xml | 5 +
.../ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml | 128 ++++++++++++++++++
2 files changed, 133 insertions(+)
create mode 100644 FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
index 0c051c39b..714fffbe1 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
@@ -52,6 +52,11 @@
system:4,layer:5,theta:9,phi:10
+
+
+
+ system:4,layer:5,row:9,theta:0,phi:10
+
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml
new file mode 100644
index 000000000..0c051c39b
--- /dev/null
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml
@@ -0,0 +1,128 @@
+
+
+
+ The first FCCee HCal layout based on ATLAS HCal, not optimised yet
+ 1. Nov 2022, J. Faltova: update material and radial segmentation for FCCee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ system:4,layer:5,row:9,theta:9,phi:10
+
+
+
+ system:4,layer:5,theta:9,phi:10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From a07d7a6745f8eb0f64dfecef381f5d9c3457ee3f Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Thu, 8 Aug 2024 17:11:06 +0200
Subject: [PATCH 020/133] update hcal xml files to v02
---
FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
index 190b83188..2e0343104 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
@@ -44,9 +44,9 @@
-
+
-
+
From 102813e7bb1f9d79dd066860789b966f1b33f60f Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Sat, 10 Aug 2024 12:02:11 +0200
Subject: [PATCH 021/133] add back ECalEndcaps_Turbine
---
FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
index 2e0343104..7f2b2fb3f 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ALLEGRO_o1_v03.xml
@@ -45,7 +45,7 @@
-
+
From c9535c8baae3ea0439d1045c4fcc2ef5b0362689 Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Tue, 13 Aug 2024 13:16:45 +0200
Subject: [PATCH 022/133] remove unused hcal v01 xml files
---
.../ALLEGRO_o1_v03/HCalBarrel_TileCal.xml | 133 -----------------
.../HCalEndcaps_ThreeParts_TileCal.xml | 141 ------------------
2 files changed, 274 deletions(-)
delete mode 100644 FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
delete mode 100644 FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
deleted file mode 100644
index 714fffbe1..000000000
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
- The first FCCee HCal layout based on ATLAS HCal, not optimised yet
- 1. Nov 2022, J. Faltova: update material and radial segmentation for FCCee
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:4,layer:5,row:9,theta:9,phi:10
-
-
-
- system:4,layer:5,theta:9,phi:10
-
-
-
-
- system:4,layer:5,row:9,theta:0,phi:10
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
deleted file mode 100644
index c5cbe72a7..000000000
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalEndcaps_ThreeParts_TileCal.xml
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
- HCal layout based on ATLAS HCal, with realistic longitudinal segmentation and steel support
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- system:4,type:2,layer:5,row:9,eta:11,phi:10
-
-
-
- system:4,type:2,layer:4,eta:11,phi:10
-
-
-
-
- system:4,type:2,layer:5,row:9,eta:10,phi:10
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 18d66e50d838007279023b4e96808d1502d2d3f8 Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Tue, 13 Aug 2024 13:50:41 +0200
Subject: [PATCH 023/133] update READMEs
---
FCCee/ALLEGRO/compact/README.md | 3 +++
detector/calorimeter/README.md | 3 +++
2 files changed, 6 insertions(+)
diff --git a/FCCee/ALLEGRO/compact/README.md b/FCCee/ALLEGRO/compact/README.md
index 6225008c8..b30399a46 100644
--- a/FCCee/ALLEGRO/compact/README.md
+++ b/FCCee/ALLEGRO/compact/README.md
@@ -10,3 +10,6 @@ ALLEGRO_o1_v03: with respect to v02 it features an ECal barrel with 11 layers an
The vertex detector and drift chamber are now taken directly from IDEA_o1_v03, this effectively updates both the vertex detector (which was taken from an old CLD version) and the drift chamber (which was corresponding to IDEA_o1_v02/DriftChamber_o1_v01.xml). The z-extent of the drift chamber is now unchanged w.r.t. the IDEA detector (2 m) since it requires optimization anyway.
Magnetic fields (solenoid + MDI) have been added.
Added "turbine-style" endcap ecal, and invoke this in the top-level xml (replacing the coneCyro geometry).
+Added HCalBarrel_TileCal_v02.xml where unused readout BarHCal_Readout_phi is removed.
+Added HCalEndcaps_ThreeParts_TileCal_v02.xml, which was migrated to the theta-phi segmentation; unused readout *Readout_phi was removed;
+fixed radial dimensions, so the outer radius of all three cylinders is the same; moved to use updated geometry CaloThreePartsEndcap_o1_v02.
diff --git a/detector/calorimeter/README.md b/detector/calorimeter/README.md
index ddb6a0b1b..ddcafd117 100644
--- a/detector/calorimeter/README.md
+++ b/detector/calorimeter/README.md
@@ -34,6 +34,7 @@ This sub-detector makes calorimeter barrel. It is used in ALLEGRO detector conce
### o1_v01
Original version taken from [FCCDetectors](https://github.com/HEP-FCC/FCCDetectors/blob/70a989a6fc333610e3b1b979c3596da9c41543d8/Detector/DetFCChhHCalTile/src/HCalBarrel_geo.cpp).
+In August 2024, added extension (LayeredCalorimeterData) to store radial layer radii and dimensions; made small updates of the code to improve readibility, while the functionality remains the same.
## HCalThreePartsEndcap
This sub-detector makes calorimeter endcaps. Each endcap is made up by three cylindrical pieces with different thickness and inner radius, but same outer radius. It is used in ALLEGRO detector concept.
@@ -41,6 +42,8 @@ This sub-detector makes calorimeter endcaps. Each endcap is made up by three cyl
### o1_v01
Original version taken from [FCCDetectors](https://github.com/HEP-FCC/FCCDetectors/blob/70a989a6fc333610e3b1b979c3596da9c41543d8/Detector/DetFCCeeHCalTile/src/HCalThreePartsEndcap_geo.cpp#L4).
+### o1_v02
+Changes wrt o1_v01: Added extension (LayeredCalorimeterData) to store radial layer radii and dimensions. To make this work, the whole code had to be rewritten, but its functionality remains the same.
## dual-readout
From 3e7117c9da91853291acd991c5b80b49fae3f40b Mon Sep 17 00:00:00 2001
From: michaela mlynarikova
Date: Tue, 13 Aug 2024 23:31:28 +0200
Subject: [PATCH 024/133] add HCalTileBarrel_o1_v02_geo.cpp
---
.../ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml | 2 +-
FCCee/ALLEGRO/compact/README.md | 5 +-
.../calorimeter/HCalTileBarrel_o1_v01_geo.cpp | 117 +++-----
.../calorimeter/HCalTileBarrel_o1_v02_geo.cpp | 272 ++++++++++++++++++
detector/calorimeter/README.md | 6 +-
5 files changed, 319 insertions(+), 83 deletions(-)
create mode 100644 detector/calorimeter/HCalTileBarrel_o1_v02_geo.cpp
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml
index 0c051c39b..cd012cdf4 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/HCalBarrel_TileCal_v02.xml
@@ -55,7 +55,7 @@
-
+
diff --git a/FCCee/ALLEGRO/compact/README.md b/FCCee/ALLEGRO/compact/README.md
index b30399a46..9da75a3de 100644
--- a/FCCee/ALLEGRO/compact/README.md
+++ b/FCCee/ALLEGRO/compact/README.md
@@ -10,6 +10,5 @@ ALLEGRO_o1_v03: with respect to v02 it features an ECal barrel with 11 layers an
The vertex detector and drift chamber are now taken directly from IDEA_o1_v03, this effectively updates both the vertex detector (which was taken from an old CLD version) and the drift chamber (which was corresponding to IDEA_o1_v02/DriftChamber_o1_v01.xml). The z-extent of the drift chamber is now unchanged w.r.t. the IDEA detector (2 m) since it requires optimization anyway.
Magnetic fields (solenoid + MDI) have been added.
Added "turbine-style" endcap ecal, and invoke this in the top-level xml (replacing the coneCyro geometry).
-Added HCalBarrel_TileCal_v02.xml where unused readout BarHCal_Readout_phi is removed.
-Added HCalEndcaps_ThreeParts_TileCal_v02.xml, which was migrated to the theta-phi segmentation; unused readout *Readout_phi was removed;
-fixed radial dimensions, so the outer radius of all three cylinders is the same; moved to use updated geometry CaloThreePartsEndcap_o1_v02.
+Added HCalBarrel_TileCal_v02.xml which uses HCalTileBarrel_o1_v02_geo.cpp and removed unused readout BarHCal_Readout_phi.
+Added HCalEndcaps_ThreeParts_TileCal_v02.xml which uses HCalThreePartsEndcap_o1_v02_geo.cpp. Additionally, wrt v02 the readout was migrated to the theta-phi segmentation; unused readout *Readout_phi was removed; radial dimensions of layers were modified, so the outer radius of all three cylinders is the same.
diff --git a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
index c6f359dd3..89be7154d 100644
--- a/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
+++ b/detector/calorimeter/HCalTileBarrel_o1_v01_geo.cpp
@@ -1,7 +1,6 @@
// DD4hep
#include "DD4hep/DetFactoryHelper.h"
-#include
using dd4hep::Volume;
using dd4hep::DetElement;
@@ -13,11 +12,11 @@ using dd4hep::PlacedVolume;
#define endmsg std::endl
#define lLog std::cout
namespace MSG {
-const std::string ERROR = "createHCalTileBarrel ERROR ";
-const std::string DEBUG = "createHCalTileBarrel DEBUG ";
-const std::string INFO = "createHCalTileBarrel INFO ";
+const std::string DEBUG = " Debug: ";
+const std::string INFO = " Info: ";
}
+
namespace det {
static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep::SensitiveDetector sensDet) {
@@ -41,66 +40,55 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
xml_comp_t xSteelSupport = xmlDet.child(_Unicode(steel_support));
double dSteelSupport = xSteelSupport.thickness();
- lLog << MSG::DEBUG << "steel support thickness (cm): " << dSteelSupport / dd4hep::cm << endmsg;
+ lLog << MSG::DEBUG << "steel support thickness: " << dSteelSupport << " [cm]" << endmsg;
lLog << MSG::DEBUG << "steel support material: " << xSteelSupport.materialStr() << endmsg;
double sensitiveBarrelRmin = xDimensions.rmin() + xFacePlate.thickness() + space;
// Hard-coded assumption that we have two different sequences for the modules
std::vector sequences = {xmlDet.child(_Unicode(sequence_a)), xmlDet.child(_Unicode(sequence_b))};
- // Check if both sequences are present
- if (!sequences[0] || !sequences[1]) {
- lLog << MSG::ERROR << "The two sequences 'sequence_a' and 'sequence_b' must be present in the xml file." << endmsg;
- throw std::runtime_error("Missing sequence_a or sequence_b in the xml file.");
- }
- // Check if both sequences have the same dimensions
- Dimension dimensionsA(sequences[0].dimensions());
- Dimension dimensionsB(sequences[1].dimensions());
- if (dimensionsA.dz() != dimensionsB.dz()) {
- lLog << MSG::ERROR << "The dimensions of sequence_a and sequence_b do not match." << endmsg;
- throw std::runtime_error("The dimensions of the sequence_a and sequence_b do not match.");
- }
- double dzSequence = dimensionsB.dz();
+ // NOTE: This assumes that both have the same dimensions!
+ Dimension sequenceDimensions(sequences[1].dimensions());
+ double dzSequence = sequenceDimensions.dz();
lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
- // calculate the number of sequences fitting in Z
+ // calculate the number of modules fitting in Z
unsigned int numSequencesZ = static_cast((2 * xDimensions.dz() - 2 * dZEndPlate - 2 * space) / dzSequence);
+
// get all 'layer' children of the 'layers' tag
std::vector Layers;
- for (xml_coll_t xCompColl(xmlDet.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl) {
- Layers.push_back(xCompColl);
+ for (xml_coll_t xCompColl(xmlDet.child(_Unicode(layers)), _Unicode(layer)); xCompColl;
+ ++xCompColl) {
+ Layers.push_back(xCompColl);
}
- unsigned int numLayersR = 0;
+ unsigned int numSequencesR = 0;
double moduleDepth = 0.;
std::vector layerDepths = std::vector();
- std::vector layerInnerRadii = std::vector();
for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it) {
xml_comp_t layer = *it;
Dimension layerDimension(layer.dimensions());
- numLayersR += layerDimension.nModules();
+ numSequencesR += layerDimension.nModules();
for (int nLayer = 0; nLayer < layerDimension.nModules(); nLayer++) {
moduleDepth += layerDimension.dr();
layerDepths.push_back(layerDimension.dr());
}
}
- lLog << MSG::DEBUG << "retrieved number of radial layers: " << numLayersR
- << " , which end up to a full module depth in rho of " << moduleDepth << " cm" << endmsg;
- lLog << MSG::DEBUG << "retrieved number of radial layers: " << layerDepths.size() << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers: " << numSequencesR
+ << " , which end up to a full module depth in rho of " << moduleDepth << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of layers: " << layerDepths.size() << endmsg;
- lLog << MSG::INFO << "constructing: " << numSequencesZ << " sequences in Z, " << numLayersR
- << " radial layers, in total " << numLayersR * numSequencesZ << " tiles" << endmsg;
+ lLog << MSG::INFO << "constructing: " << numSequencesZ << " rings in Z, " << numSequencesR
+ << " layers in Rho, " << numSequencesR * numSequencesZ << " tiles" << endmsg;
// Calculate correction along z based on the module size (can only have natural number of modules)
double dzDetector = (numSequencesZ * dzSequence) / 2 + dZEndPlate + space;
- lLog << MSG::DEBUG << "dzDetector (cm): " << dzDetector / dd4hep::cm << endmsg;
- lLog << MSG::INFO << "correction of dz in cm (negative = size reduced):" << dzDetector - xDimensions.dz() << endmsg;
+ lLog << MSG::DEBUG << "dzDetector: " << dzDetector << endmsg;
+ lLog << MSG::INFO << "correction of dz (negative = size reduced):" << dzDetector - xDimensions.dz() << endmsg;
double rminSupport = sensitiveBarrelRmin + moduleDepth;
double rmaxSupport = sensitiveBarrelRmin + moduleDepth + dSteelSupport;
- double sensitiveBarrelRmax = sensitiveBarrelRmin + moduleDepth;
-
////////////////////// detector building //////////////////////
@@ -114,11 +102,10 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
// top level det element representing whole hcal barrel
- DetElement caloDetElem(xmlDet.nameStr(), xmlDet.id());
+ DetElement hCal(xmlDet.nameStr(), xmlDet.id());
/// envelope shape
dd4hep::Tube envelopeShape(xDimensions.rmin(), xDimensions.rmax(), xDimensions.dz());
-
Volume envelopeVolume("HCalEnvelopeVolume", envelopeShape, lcdd.air());
envelopeVolume.setVisAttributes(lcdd, xDimensions.visStr());
@@ -127,7 +114,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
Volume facePlateVol("HCalFacePlateVol", facePlateShape, lcdd.material(xFacePlate.materialStr()));
facePlateVol.setVisAttributes(lcdd, xFacePlate.visStr());
PlacedVolume placedFacePlate = envelopeVolume.placeVolume(facePlateVol);
- DetElement facePlate_det(caloDetElem, "HCalFacePlate", 0);
+ DetElement facePlate_det(hCal, "HCalFacePlate", 0);
facePlate_det.setPlacement(placedFacePlate);
// Add structural support made of steel at both ends of HCal
@@ -135,21 +122,22 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
Volume endPlateVol("HCalEndPlateVol", endPlateShape, lcdd.material(xEndPlate.materialStr()));
endPlateVol.setVisAttributes(lcdd, xEndPlate.visStr());
- DetElement endPlatePos(caloDetElem, "HCalEndPlatePos", 0);
+ DetElement endPlatePos(hCal, "HCalEndPlatePos", 0);
dd4hep::Position posOffset(0, 0, dzDetector - (dZEndPlate / 2));
PlacedVolume placedEndPlatePos = envelopeVolume.placeVolume(endPlateVol, posOffset);
endPlatePos.setPlacement(placedEndPlatePos);
- DetElement endPlateNeg(caloDetElem, "HCalEndPlateNeg", 1);
+ DetElement endPlateNeg(hCal, "HCalEndPlateNeg", 1);
dd4hep::Position negOffset(0, 0, -dzDetector + (dZEndPlate / 2));
PlacedVolume placedEndPlateNeg = envelopeVolume.placeVolume(endPlateVol, negOffset);
endPlateNeg.setPlacement(placedEndPlateNeg);
dd4hep::Tube supportShape(rminSupport, rmaxSupport, (dzDetector - dZEndPlate - space));
- Volume steelSupportVolume("HCalSteelSupportVol", supportShape, lcdd.material(xSteelSupport.materialStr()));
+ Volume steelSupportVolume("HCalSteelSupportVol", supportShape,
+ lcdd.material(xSteelSupport.materialStr()));
steelSupportVolume.setVisAttributes(lcdd.invisible());
PlacedVolume placedSupport = envelopeVolume.placeVolume(steelSupportVolume);
- DetElement support(caloDetElem, "HCalSteelSupport", 0);
+ DetElement support(hCal, "HCalSteelSupport", 0);
support.setPlacement(placedSupport);
// double sensitiveBarrelDz = dzDetector - dZEndPlate;
@@ -163,13 +151,15 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
double rminLayer = sensitiveBarrelRmin + layerR;
double rmaxLayer = sensitiveBarrelRmin + layerR + layerDepths.at(idxLayer);
layerR += layerDepths.at(idxLayer);
- layerInnerRadii.push_back(rminLayer);
//alternate: even layers consist of tile sequence b, odd layer of tile sequence a
unsigned int sequenceIdx = idxLayer % 2;
dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
- Volume tileSequenceVolume("HCalTileSequenceVol", tileSequenceShape, lcdd.air());
+ Volume tileSequenceVolume("HCalTileSequenceVol", tileSequenceShape, lcdd.air());
+
+ lLog << MSG::DEBUG << "layer radii: " << rminLayer << " - " << rmaxLayer << " [cm]" << endmsg;
+
dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector - dZEndPlate - space );
Volume layerVolume("HCalLayerVol", layerShape, lcdd.air());
@@ -186,7 +176,7 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
double tileZOffset = - 0.5* dzSequence;
// first Z loop (tiles that make up a sequence)
for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
- ++xCompColl, ++idxSubMod) {
+ ++xCompColl, ++idxSubMod) {
xml_comp_t xComp = xCompColl;
dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
@@ -219,8 +209,8 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
}
// Place det elements wihtin each other to recover volume positions later via cellID
- for (uint iLayer = 0; iLayer < numLayersR; iLayer++) {
- DetElement layerDet(caloDetElem, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer);
+ for (uint iLayer = 0; iLayer < numSequencesR; iLayer++) {
+ DetElement layerDet(hCal, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer);
layerDet.setPlacement(layers[iLayer]);
for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
@@ -233,39 +223,12 @@ static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep
}
// Place envelope (or barrel) volume
- Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
+ Volume motherVol = lcdd.pickMotherVolume(hCal);
motherVol.setVisAttributes(lcdd.invisible());
- PlacedVolume envelopePhysVol = motherVol.placeVolume(envelopeVolume);
- envelopePhysVol.addPhysVolID("system", caloDetElem.id());
- caloDetElem.setPlacement(envelopePhysVol);
-
-
- // Create caloData object
- auto caloData = new dd4hep::rec::LayeredCalorimeterData;
- caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::BarrelLayout;
- caloDetElem.addExtension(caloData);
-
- caloData->extent[0] = sensitiveBarrelRmin;
- caloData->extent[1] = sensitiveBarrelRmax;
- caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
- caloData->extent[3] = dzDetector;
-
- dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
-
- for (unsigned int idxLayer = 0; idxLayer < layerDepths.size(); ++idxLayer) {
- const double difference_bet_r1r2 = layerDepths.at(idxLayer);
-
- caloLayer.distance = layerInnerRadii.at(idxLayer); // radius of the current layer
- caloLayer.sensitive_thickness = difference_bet_r1r2; // radial dimension of the current layer
- caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
- caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
-
- caloData->layers.push_back(caloLayer);
- }
-
-
- return caloDetElem;
-
+ PlacedVolume placedHCal = motherVol.placeVolume(envelopeVolume);
+ placedHCal.addPhysVolID("system", hCal.id());
+ hCal.setPlacement(placedHCal);
+ return hCal;
}
} // namespace hcal
diff --git a/detector/calorimeter/HCalTileBarrel_o1_v02_geo.cpp b/detector/calorimeter/HCalTileBarrel_o1_v02_geo.cpp
new file mode 100644
index 000000000..4e1796c94
--- /dev/null
+++ b/detector/calorimeter/HCalTileBarrel_o1_v02_geo.cpp
@@ -0,0 +1,272 @@
+// DD4hep
+#include "DD4hep/DetFactoryHelper.h"
+
+#include
+
+using dd4hep::Volume;
+using dd4hep::DetElement;
+using dd4hep::xml::Dimension;
+using dd4hep::PlacedVolume;
+
+
+// todo: remove gaudi logging and properly capture output
+#define endmsg std::endl
+#define lLog std::cout
+namespace MSG {
+const std::string ERROR = "createHCalTileBarrel ERROR ";
+const std::string DEBUG = "createHCalTileBarrel DEBUG ";
+const std::string INFO = "createHCalTileBarrel INFO ";
+}
+
+namespace det {
+
+static dd4hep::Ref_t createHCal(dd4hep::Detector& lcdd, xml_det_t xmlDet, dd4hep::SensitiveDetector sensDet) {
+
+ /////////////////// config parsing ///////////////////////////////////
+
+ // Make volume that envelopes the whole barrel; set material to air
+ Dimension xDimensions(xmlDet.dimensions());
+
+
+ // sensitive detector type read from xml (for example "SimpleCalorimeterSD")
+ Dimension xSensitive = xmlDet.child(_U(sensitive));
+ sensDet.setType(xSensitive.typeStr());
+
+
+ xml_comp_t xEndPlate = xmlDet.child(_Unicode(end_plate));
+ double dZEndPlate = xEndPlate.thickness();
+ xml_comp_t xFacePlate = xmlDet.child(_Unicode(face_plate));
+ xml_comp_t xSpace = xmlDet.child(_Unicode(plate_space)); // to avoid overlaps
+ double space = xSpace.thickness();
+ xml_comp_t xSteelSupport = xmlDet.child(_Unicode(steel_support));
+ double dSteelSupport = xSteelSupport.thickness();
+
+ lLog << MSG::DEBUG << "steel support thickness (cm): " << dSteelSupport / dd4hep::cm << endmsg;
+ lLog << MSG::DEBUG << "steel support material: " << xSteelSupport.materialStr() << endmsg;
+
+ double sensitiveBarrelRmin = xDimensions.rmin() + xFacePlate.thickness() + space;
+
+ // Hard-coded assumption that we have two different sequences for the modules
+ std::vector sequences = {xmlDet.child(_Unicode(sequence_a)), xmlDet.child(_Unicode(sequence_b))};
+ // Check if both sequences are present
+ if (!sequences[0] || !sequences[1]) {
+ lLog << MSG::ERROR << "The two sequences 'sequence_a' and 'sequence_b' must be present in the xml file." << endmsg;
+ throw std::runtime_error("Missing sequence_a or sequence_b in the xml file.");
+ }
+ // Check if both sequences have the same dimensions
+ Dimension dimensionsA(sequences[0].dimensions());
+ Dimension dimensionsB(sequences[1].dimensions());
+ if (dimensionsA.dz() != dimensionsB.dz()) {
+ lLog << MSG::ERROR << "The dimensions of sequence_a and sequence_b do not match." << endmsg;
+ throw std::runtime_error("The dimensions of the sequence_a and sequence_b do not match.");
+ }
+ double dzSequence = dimensionsB.dz();
+ lLog << MSG::DEBUG << "sequence thickness " << dzSequence << endmsg;
+
+ // calculate the number of sequences fitting in Z
+ unsigned int numSequencesZ = static_cast((2 * xDimensions.dz() - 2 * dZEndPlate - 2 * space) / dzSequence);
+
+ // get all 'layer' children of the 'layers' tag
+ std::vector Layers;
+ for (xml_coll_t xCompColl(xmlDet.child(_Unicode(layers)), _Unicode(layer)); xCompColl; ++xCompColl) {
+ Layers.push_back(xCompColl);
+ }
+ unsigned int numLayersR = 0;
+ double moduleDepth = 0.;
+ std::vector layerDepths = std::vector();
+ std::vector layerInnerRadii = std::vector();
+ for (std::vector::iterator it = Layers.begin(); it != Layers.end(); ++it) {
+ xml_comp_t layer = *it;
+ Dimension layerDimension(layer.dimensions());
+ numLayersR += layerDimension.nModules();
+ for (int nLayer = 0; nLayer < layerDimension.nModules(); nLayer++) {
+ moduleDepth += layerDimension.dr();
+ layerDepths.push_back(layerDimension.dr());
+ }
+ }
+ lLog << MSG::DEBUG << "retrieved number of radial layers: " << numLayersR
+ << " , which end up to a full module depth in rho of " << moduleDepth << " cm" << endmsg;
+ lLog << MSG::DEBUG << "retrieved number of radial layers: " << layerDepths.size() << endmsg;
+
+ lLog << MSG::INFO << "constructing: " << numSequencesZ << " sequences in Z, " << numLayersR
+ << " radial layers, in total " << numLayersR * numSequencesZ << " tiles" << endmsg;
+
+ // Calculate correction along z based on the module size (can only have natural number of modules)
+ double dzDetector = (numSequencesZ * dzSequence) / 2 + dZEndPlate + space;
+ lLog << MSG::DEBUG << "dzDetector (cm): " << dzDetector / dd4hep::cm << endmsg;
+ lLog << MSG::INFO << "correction of dz in cm (negative = size reduced):" << dzDetector - xDimensions.dz() << endmsg;
+
+ double rminSupport = sensitiveBarrelRmin + moduleDepth;
+ double rmaxSupport = sensitiveBarrelRmin + moduleDepth + dSteelSupport;
+
+ double sensitiveBarrelRmax = sensitiveBarrelRmin + moduleDepth;
+
+
+ ////////////////////// detector building //////////////////////
+
+
+ std::vector layers;
+ layers.reserve(layerDepths.size());
+ std::vector > seqInLayers;
+ seqInLayers.reserve(layerDepths.size());
+ std::vector tilesPerLayer;
+ tilesPerLayer.reserve(layerDepths.size());
+
+
+ // top level det element representing whole hcal barrel
+ DetElement caloDetElem(xmlDet.nameStr(), xmlDet.id());
+
+ /// envelope shape
+ dd4hep::Tube envelopeShape(xDimensions.rmin(), xDimensions.rmax(), xDimensions.dz());
+
+ Volume envelopeVolume("HCalEnvelopeVolume", envelopeShape, lcdd.air());
+ envelopeVolume.setVisAttributes(lcdd, xDimensions.visStr());
+
+ // Add structural support made of steel inside of HCal
+ dd4hep::Tube facePlateShape(xDimensions.rmin(), sensitiveBarrelRmin, (dzDetector - dZEndPlate - space));
+ Volume facePlateVol("HCalFacePlateVol", facePlateShape, lcdd.material(xFacePlate.materialStr()));
+ facePlateVol.setVisAttributes(lcdd, xFacePlate.visStr());
+ PlacedVolume placedFacePlate = envelopeVolume.placeVolume(facePlateVol);
+ DetElement facePlate_det(caloDetElem, "HCalFacePlate", 0);
+ facePlate_det.setPlacement(placedFacePlate);
+
+ // Add structural support made of steel at both ends of HCal
+ dd4hep::Tube endPlateShape(xDimensions.rmin(), (xDimensions.rmax() - dSteelSupport), dZEndPlate / 2);
+ Volume endPlateVol("HCalEndPlateVol", endPlateShape, lcdd.material(xEndPlate.materialStr()));
+ endPlateVol.setVisAttributes(lcdd, xEndPlate.visStr());
+
+ DetElement endPlatePos(caloDetElem, "HCalEndPlatePos", 0);
+ dd4hep::Position posOffset(0, 0, dzDetector - (dZEndPlate / 2));
+ PlacedVolume placedEndPlatePos = envelopeVolume.placeVolume(endPlateVol, posOffset);
+ endPlatePos.setPlacement(placedEndPlatePos);
+
+ DetElement endPlateNeg(caloDetElem, "HCalEndPlateNeg", 1);
+ dd4hep::Position negOffset(0, 0, -dzDetector + (dZEndPlate / 2));
+ PlacedVolume placedEndPlateNeg = envelopeVolume.placeVolume(endPlateVol, negOffset);
+ endPlateNeg.setPlacement(placedEndPlateNeg);
+
+ dd4hep::Tube supportShape(rminSupport, rmaxSupport, (dzDetector - dZEndPlate - space));
+ Volume steelSupportVolume("HCalSteelSupportVol", supportShape, lcdd.material(xSteelSupport.materialStr()));
+ steelSupportVolume.setVisAttributes(lcdd.invisible());
+ PlacedVolume placedSupport = envelopeVolume.placeVolume(steelSupportVolume);
+ DetElement support(caloDetElem, "HCalSteelSupport", 0);
+ support.setPlacement(placedSupport);
+
+ // double sensitiveBarrelDz = dzDetector - dZEndPlate;
+
+ // loop over R ("layers")
+ double layerR = 0.;
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths.size(); ++idxLayer) {
+ std::string layerName = "HCalLayer" + std::to_string(idxLayer);
+
+ // in Module rmin = 0 for first wedge, changed radius to the full radius starting at (0,0,0)
+ double rminLayer = sensitiveBarrelRmin + layerR;
+ double rmaxLayer = sensitiveBarrelRmin + layerR + layerDepths.at(idxLayer);
+ layerR += layerDepths.at(idxLayer);
+ layerInnerRadii.push_back(rminLayer);
+
+ //alternate: even layers consist of tile sequence b, odd layer of tile sequence a
+ unsigned int sequenceIdx = idxLayer % 2;
+
+ dd4hep::Tube tileSequenceShape(rminLayer, rmaxLayer, 0.5*dzSequence);
+ Volume tileSequenceVolume("HCalTileSequenceVol", tileSequenceShape, lcdd.air());
+
+ dd4hep::Tube layerShape(rminLayer, rmaxLayer, dzDetector - dZEndPlate - space );
+ Volume layerVolume("HCalLayerVol", layerShape, lcdd.air());
+
+
+ layerVolume.setVisAttributes(lcdd.invisible());
+ unsigned int idxSubMod = 0;
+
+
+ dd4hep::PlacedVolume placedLayerVolume = envelopeVolume.placeVolume(layerVolume);
+ placedLayerVolume.addPhysVolID("layer", idxLayer);
+ layers.push_back(placedLayerVolume);
+
+ double tileZOffset = - 0.5* dzSequence;
+ // first Z loop (tiles that make up a sequence)
+ for (xml_coll_t xCompColl(sequences[sequenceIdx], _Unicode(module_component)); xCompColl;
+ ++xCompColl, ++idxSubMod) {
+ xml_comp_t xComp = xCompColl;
+ dd4hep::Tube tileShape(rminLayer, rmaxLayer, 0.5 * xComp.thickness());
+
+ Volume tileVol("HCalTileVol_"+xComp.nameStr(), tileShape,
+ lcdd.material(xComp.materialStr()));
+ tileVol.setVisAttributes(lcdd, xComp.visStr());
+
+ dd4hep::Position tileOffset(0, 0, tileZOffset + 0.5 * xComp.thickness() );
+ dd4hep::PlacedVolume placedTileVol = tileSequenceVolume.placeVolume(tileVol, tileOffset);
+
+ if (xComp.isSensitive()) {
+ tileVol.setSensitiveDetector(sensDet);
+ tilesPerLayer.push_back(placedTileVol);
+ }
+ tileZOffset += xComp.thickness();
+ }
+
+ // second z loop (place sequences in layer)
+ std::vector sq_vector;
+
+ for (uint numSeq=0; numSeq < numSequencesZ; numSeq++){
+ double zOffset = - dzDetector + (2 * numSeq + 1) * (dzSequence * 0.5);
+ dd4hep::Position tileSequencePosition(0, 0, zOffset);
+ dd4hep::PlacedVolume placedTileSequenceVolume = layerVolume.placeVolume(tileSequenceVolume, tileSequencePosition);
+ placedTileSequenceVolume.addPhysVolID("row", numSeq);
+ sq_vector.push_back(placedTileSequenceVolume);
+ }
+ seqInLayers.push_back(sq_vector);
+
+ }
+
+ // Place det elements wihtin each other to recover volume positions later via cellID
+ for (uint iLayer = 0; iLayer < numLayersR; iLayer++) {
+ DetElement layerDet(caloDetElem, dd4hep::xml::_toString(iLayer, "layer%d"), iLayer);
+ layerDet.setPlacement(layers[iLayer]);
+
+ for (uint iSeq = 0; iSeq < seqInLayers[iLayer].size(); iSeq++){
+ DetElement seqDet(layerDet, dd4hep::xml::_toString(iSeq, "seq%d"), iSeq);
+ seqDet.setPlacement(seqInLayers[iLayer][iSeq]);
+
+ DetElement tileDet(seqDet, dd4hep::xml::_toString(iSeq, "tile%d"), iSeq);
+ tileDet.setPlacement(tilesPerLayer[iLayer]);
+ }
+ }
+
+ // Place envelope (or barrel) volume
+ Volume motherVol = lcdd.pickMotherVolume(caloDetElem);
+ motherVol.setVisAttributes(lcdd.invisible());
+ PlacedVolume envelopePhysVol = motherVol.placeVolume(envelopeVolume);
+ envelopePhysVol.addPhysVolID("system", caloDetElem.id());
+ caloDetElem.setPlacement(envelopePhysVol);
+
+
+ // Create caloData object
+ auto caloData = new dd4hep::rec::LayeredCalorimeterData;
+ caloData->layoutType = dd4hep::rec::LayeredCalorimeterData::BarrelLayout;
+ caloDetElem.addExtension(caloData);
+
+ caloData->extent[0] = sensitiveBarrelRmin;
+ caloData->extent[1] = sensitiveBarrelRmax;
+ caloData->extent[2] = 0.; // NN: for barrel detectors this is 0
+ caloData->extent[3] = dzDetector;
+
+ dd4hep::rec::LayeredCalorimeterData::Layer caloLayer;
+
+ for (unsigned int idxLayer = 0; idxLayer < layerDepths.size(); ++idxLayer) {
+ const double difference_bet_r1r2 = layerDepths.at(idxLayer);
+
+ caloLayer.distance = layerInnerRadii.at(idxLayer); // radius of the current layer
+ caloLayer.sensitive_thickness = difference_bet_r1r2; // radial dimension of the current layer
+ caloLayer.inner_thickness = difference_bet_r1r2 / 2.0;
+ caloLayer.outer_thickness = difference_bet_r1r2 / 2.0;
+
+ caloData->layers.push_back(caloLayer);
+ }
+
+
+ return caloDetElem;
+
+}
+} // namespace hcal
+
+DECLARE_DETELEMENT(HCalTileBarrel_o1_v02, det::createHCal)
diff --git a/detector/calorimeter/README.md b/detector/calorimeter/README.md
index ddcafd117..ce9c3b869 100644
--- a/detector/calorimeter/README.md
+++ b/detector/calorimeter/README.md
@@ -34,7 +34,9 @@ This sub-detector makes calorimeter barrel. It is used in ALLEGRO detector conce
### o1_v01
Original version taken from [FCCDetectors](https://github.com/HEP-FCC/FCCDetectors/blob/70a989a6fc333610e3b1b979c3596da9c41543d8/Detector/DetFCChhHCalTile/src/HCalBarrel_geo.cpp).
-In August 2024, added extension (LayeredCalorimeterData) to store radial layer radii and dimensions; made small updates of the code to improve readibility, while the functionality remains the same.
+
+### o1_v02
+Changes wrt o1_v01: Added extension (LayeredCalorimeterData) to store radial layer radii and dimensions. Added several checks for the geometry building and made small changes in the code to improve readibility.
## HCalThreePartsEndcap
This sub-detector makes calorimeter endcaps. Each endcap is made up by three cylindrical pieces with different thickness and inner radius, but same outer radius. It is used in ALLEGRO detector concept.
@@ -43,7 +45,7 @@ This sub-detector makes calorimeter endcaps. Each endcap is made up by three cyl
Original version taken from [FCCDetectors](https://github.com/HEP-FCC/FCCDetectors/blob/70a989a6fc333610e3b1b979c3596da9c41543d8/Detector/DetFCCeeHCalTile/src/HCalThreePartsEndcap_geo.cpp#L4).
### o1_v02
-Changes wrt o1_v01: Added extension (LayeredCalorimeterData) to store radial layer radii and dimensions. To make this work, the whole code had to be rewritten, but its functionality remains the same.
+Changes wrt o1_v01: Added extension (LayeredCalorimeterData) to store radial layer radii and dimensions. To make this work, the whole code had to be reshuffled, but the way how the geometry and individual volumes are built remains the same as in o1_v01.
## dual-readout
From 585378a9cbb5223c28596568d977098e1e9fb4f9 Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Tue, 27 Aug 2024 16:20:07 +0200
Subject: [PATCH 025/133] CLD_o2_v07: start with new lumical to fix overlaps
---
.../compact/CLD_o2_v07/LumiCal_o3_v02_05.xml | 188 ++++++++++++++++++
1 file changed, 188 insertions(+)
create mode 100644 FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
diff --git a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
new file mode 100644
index 000000000..cbc708e20
--- /dev/null
+++ b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+
+
+ system:8,barrel:3,layer:8,slice:8,r:32:-16,phi:-16
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 213fde1c66a34c8fbf4e8898f451d6e9971d001c Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Tue, 27 Aug 2024 16:18:13 +0200
Subject: [PATCH 026/133] CLD_o2_v07: fix overlaps in the LumiCal itself
Add a lumical_max_z_prime parameter to get the actual end place of the lumical
add 7 micron meter to the envelopes.
Fix the location and rotation to use the max_z_prime values
---
FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml | 6 +++--
.../compact/CLD_o2_v07/LumiCal_o3_v02_05.xml | 22 +++++++++----------
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
index c45519d6e..f63eed8bb 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
@@ -198,12 +198,14 @@
+
+
+
-
@@ -309,7 +311,7 @@
-
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
index cbc708e20..0340746aa 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
@@ -24,14 +24,14 @@
-
+
-
+
@@ -67,14 +67,14 @@
-
+
-
+
@@ -109,14 +109,14 @@
-
+
-
+
@@ -150,16 +150,16 @@
-
+
-
+
-
+
-
+
@@ -173,7 +173,7 @@
+ inner_z = "LumiCal_max_z+0.009*mm"/>
From 5869debb94fb9793789d3fea4abd90168d230f4a Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Tue, 27 Aug 2024 16:23:52 +0200
Subject: [PATCH 027/133] CLD_o2_v07: remove old lumical xml
---
.../compact/CLD_o2_v07/LumiCal_o3_v02_04.xml | 188 ------------------
1 file changed, 188 deletions(-)
delete mode 100644 FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml
diff --git a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml
deleted file mode 100644
index cbc708e20..000000000
--- a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_04.xml
+++ /dev/null
@@ -1,188 +0,0 @@
-
-
-
-
-
-
-
-
-
- system:8,barrel:3,layer:8,slice:8,r:32:-16,phi:-16
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 7480cfde05667bc425532b5204449d27fc372ac5 Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Wed, 28 Aug 2024 13:59:36 +0200
Subject: [PATCH 028/133] CLD_o2_v07: InnerTracker: fix envelope overlap
between lumical and innertracker
---
FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml b/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml
index e31978c98..1b7a8fa30 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/InnerTracker_o2_v08.xml
@@ -39,10 +39,14 @@
+
+
+
+
From efe5c02b9cfc59b7d451d6fe4db15c7f094cb83c Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Wed, 28 Aug 2024 14:09:35 +0200
Subject: [PATCH 029/133] Tests: move CLD test to latest model
---
FCCee/CLD/compact/README.md | 1 +
test/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/FCCee/CLD/compact/README.md b/FCCee/CLD/compact/README.md
index c53c2223e..9477865e3 100644
--- a/FCCee/CLD/compact/README.md
+++ b/FCCee/CLD/compact/README.md
@@ -45,6 +45,7 @@ CLD_o2_v07
This model is based on `CLD_o2_v06` with the following changes: reduced loading time by adding stave assemblies in the tracker barrel.
Additionally, a non-cylindrical (polycone) tracking volume was added that excludes the LumiCal. To profit from this feature the `Geant4TVUserParticleHandler`
needs to be used in `ddsim`. The definitions for the cylindrical volume were kept to be backwards compatible to the `Geant4TCUserParticleHandler`.
+Overlaps related to the LumiCal were fixed that were present in the v06 model
CLD_o3_v01
----------
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 5ba8150b8..a7592f011 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -69,7 +69,7 @@ ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh
ddsim --compactFile=${CMAKE_CURRENT_SOURCE_DIR}/../FCCee/CLD/compact/FCCee_o1_v05/FCCee_o1_v05.xml --runType=batch -G -N=1 --outputFile=testFCCee_o1_v05.slcio )
SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "Exception;EXCEPTION;ERROR;Error" )
-SET( det_name "CLD_o2_v06" )
+SET( det_name "CLD_o2_v07" )
ADD_TEST( t_test_${det_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh"
ddsim --compactFile=${CMAKE_CURRENT_SOURCE_DIR}/../FCCee/CLD/compact/${det_name}/${det_name}.xml --runType=batch -G -N=1 --outputFile=test${det_name}.slcio )
SET_TESTS_PROPERTIES( t_test_${det_name} PROPERTIES FAIL_REGULAR_EXPRESSION "Exception;EXCEPTION;ERROR;Error" )
From 7f49ac942e45c820c175c21a41de49ae4360ea75 Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Thu, 29 Aug 2024 09:47:25 +0200
Subject: [PATCH 030/133] CLD_o2_v07: account for lumical positioning with
difference between primed and unprimed
---
FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml | 3 +-
.../compact/CLD_o2_v07/LumiCal_o3_v02_05.xml | 29 +++++++++----------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
index f63eed8bb..ec7c9bc21 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/CLD_o2_v07.xml
@@ -225,7 +225,8 @@
-
+
+
diff --git a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
index 0340746aa..3c3f7bf64 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
@@ -24,14 +24,14 @@
-
+
-
+
@@ -42,7 +42,7 @@
-
+
-
+
@@ -85,7 +85,7 @@
-
+
-
+
@@ -127,7 +127,7 @@
-
+
-
+
-
+
-
+
@@ -172,8 +172,7 @@
+ inner_z = "LumiCal_max_z - LumiCal_shield_dz_prime + LumiCal_shield_dz"/>
From 53ae8d9c0a25a67880b6378150c59700e14ca0c0 Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Fri, 30 Aug 2024 16:36:54 +0200
Subject: [PATCH 031/133] Fields: correct type to field_type, changed variable
name in DD4hep, type still exists as part of handle
---
detector/other/FieldMapBrBz.cpp | 1 +
detector/other/FieldMapXYZ.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/detector/other/FieldMapBrBz.cpp b/detector/other/FieldMapBrBz.cpp
index e14b92519..0978959a9 100644
--- a/detector/other/FieldMapBrBz.cpp
+++ b/detector/other/FieldMapBrBz.cpp
@@ -38,6 +38,7 @@ namespace {
}
FieldMapBrBz::FieldMapBrBz() {
+ field_type = CartesianField::MAGNETIC;
type = CartesianField::MAGNETIC;
} //ctor
diff --git a/detector/other/FieldMapXYZ.cpp b/detector/other/FieldMapXYZ.cpp
index 8857cff18..e9e7c2309 100644
--- a/detector/other/FieldMapXYZ.cpp
+++ b/detector/other/FieldMapXYZ.cpp
@@ -40,6 +40,7 @@ namespace {
}
FieldMapXYZ::FieldMapXYZ() {
+ field_type = CartesianField::MAGNETIC;
type = CartesianField::MAGNETIC;
} //ctor
From a3b130311a6929ef7a053e9dbe1cc2a9a4c9f668 Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Fri, 30 Aug 2024 16:38:47 +0200
Subject: [PATCH 032/133] Tests: move one test to something with fieldmaps
---
test/CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a7592f011..91c3febaa 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -15,9 +15,9 @@ ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh
ddsim --compactFile=${CMAKE_CURRENT_SOURCE_DIR}/../ILD/compact/ILD_l5_v02/ILD_l5_v02.xml --runType=batch -G -N=1 --outputFile=testILD_l5_v02.slcio )
SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "Exception;EXCEPTION;ERROR;Error" )
-SET( test_name "test_ILD_s5_v02" )
+SET( test_name "test_ILD_s5_v08" )
ADD_TEST( t_${test_name} "${CMAKE_INSTALL_PREFIX}/bin/run_test_${PackageName}.sh"
- ddsim --compactFile=${CMAKE_CURRENT_SOURCE_DIR}/../ILD/compact/ILD_s5_v02/ILD_s5_v02.xml --runType=batch -G -N=1 --outputFile=testILD_s5_v02.slcio )
+ ddsim --compactFile=${CMAKE_CURRENT_SOURCE_DIR}/../ILD/compact/ILD_s5_v08/ILD_s5_v08.xml --runType=batch -G -N=1 --outputFile=testILD_s5_v08.slcio )
SET_TESTS_PROPERTIES( t_${test_name} PROPERTIES FAIL_REGULAR_EXPRESSION "Exception;EXCEPTION;ERROR;Error" )
SET( test_name "test_ILD_l5_v09" )
From be633b899b72a6d40d855e3400b554401e8d645f Mon Sep 17 00:00:00 2001
From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com>
Date: Tue, 3 Sep 2024 19:18:48 +0200
Subject: [PATCH 033/133] Do not link against podio and EDM4hep dictionaries
(#386)
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08c8bf3d3..a484b4291 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,7 +137,7 @@ target_include_directories(${PackageName} PRIVATE ${PROJECT_SOURCE_DIR}/detect
target_include_directories(${PackageName}G4 PRIVATE ${PROJECT_SOURCE_DIR}/detector/calorimeter/dual-readout/include )
target_link_libraries(${PackageName} DD4hep::DDCore DD4hep::DDRec DD4hep::DDParsers ROOT::Core detectorSegmentations)
-target_link_libraries(${PackageName}G4 DD4hep::DDCore DD4hep::DDRec DD4hep::DDParsers DD4hep::DDG4 ROOT::Core EDM4HEP::edm4hep EDM4HEP::edm4hepDict podio::podio podio::podioDict podio::podioRootIO ${Geant4_LIBRARIES})
+target_link_libraries(${PackageName}G4 DD4hep::DDCore DD4hep::DDRec DD4hep::DDParsers DD4hep::DDG4 ROOT::Core podio::podioRootIO EDM4HEP::edm4hep ${Geant4_LIBRARIES})
if(K4GEO_USE_LCIO)
target_link_libraries(${PackageName} LCIO::lcio)
From b464a1fb0b954d689f44760f607e3925ba78021f Mon Sep 17 00:00:00 2001
From: jmcarcell
Date: Fri, 6 Sep 2024 22:14:05 +0200
Subject: [PATCH 034/133] Add a Key4hepConfig file
---
cmake/Key4hepConfig.cmake | 84 +++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 cmake/Key4hepConfig.cmake
diff --git a/cmake/Key4hepConfig.cmake b/cmake/Key4hepConfig.cmake
new file mode 100644
index 000000000..1309ed9f8
--- /dev/null
+++ b/cmake/Key4hepConfig.cmake
@@ -0,0 +1,84 @@
+macro(key4hep_set_compiler_flags)
+ if (DEFINED KEY4HEP_SET_COMPILER_FLAGS AND NOT KEY4HEP_SET_COMPILER_FLAGS)
+ return()
+ endif()
+
+ set(COMPILER_FLAGS "-fPIC -Wall -Wextra -Wpedantic -Wshadow -Wdeprecated")
+
+ if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
+ set(COMPILER_FLAGS "${COMPILER_FLAGS} -Winconsistent-missing-override -Wheader-hygiene -fcolor-diagnostics")
+ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdiagnostics-color=always")
+ endif()
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}")
+
+endmacro()
+
+macro(key4hep_set_build_type)
+
+ # For ccmake and cmake-gui
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
+ "None" "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
+
+ if(NOT CMAKE_CONFIGURATION_TYPES)
+ if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE RelWithDebInfo
+ CACHE STRING "Choose the type of build, options are: None, Release, MinSizeRel, Debug, RelWithDebInfo (default)"
+ FORCE
+ )
+ else()
+ set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}"
+ CACHE STRING "Choose the type of build, options are: None, Release, MinSizeRel, Debug, RelWithDebInfo (default)"
+ FORCE
+ )
+ endif()
+ endif()
+endmacro()
+
+macro(key4hep_set_cxx_standard_and_extensions)
+ set(CMAKE_CXX_STANDARD 20 CACHE STRING "")
+
+ if(NOT CMAKE_CXX_STANDARD MATCHES "20|23")
+ message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}, supported values are 20 and 23")
+ endif()
+
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+
+endmacro()
+
+macro(key4hep_set_rpath)
+ # When building, don't use the install RPATH already (but later on when installing)
+ set(CMAKE_SKIP_BUILD_RPATH FALSE) # don't skip the full RPATH for the build tree
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # use always the build RPATH for the build tree
+ set(CMAKE_MACOSX_RPATH TRUE) # use RPATH for MacOSX
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # point to directories outside the build tree to the install RPATH
+
+ # Check whether to add RPATH to the installation (the build tree always has the RPATH enabled)
+ if(APPLE)
+ set(CMAKE_INSTALL_NAME_DIR "@rpath")
+ set(CMAKE_INSTALL_RPATH "@loader_path/../lib") # self relative LIBDIR
+ # the RPATH to be used when installing, but only if it's not a system directory
+ list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ if("${isSystemDir}" STREQUAL "-1")
+ set(CMAKE_INSTALL_RPATH "@loader_path/../lib")
+ endif()
+ elseif(DEFINED KEY4HEP_SET_RPATH AND NOT KEY4HEP_SET_RPATH)
+ set(CMAKE_SKIP_INSTALL_RPATH TRUE) # skip the full RPATH for the install tree
+ else()
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}") # install LIBDIR
+ # the RPATH to be used when installing, but only if it's not a system directory
+ list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ if("${isSystemDir}" STREQUAL "-1")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIBDIR}")
+ endif()
+ endif()
+endmacro()
+
+###################################################
+
+key4hep_set_compiler_flags()
+key4hep_set_build_type()
+key4hep_set_cxx_standard_and_extensions()
+key4hep_set_rpath()
From b80c7c8b0020941755f747919f61f5209be9059a Mon Sep 17 00:00:00 2001
From: jmcarcell
Date: Mon, 9 Sep 2024 21:57:23 +0200
Subject: [PATCH 035/133] Update Key4hepConfig.cmake with fixes from
https://github.com/key4hep/key4hep-dev-utils/pull/7
---
cmake/Key4hepConfig.cmake | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/cmake/Key4hepConfig.cmake b/cmake/Key4hepConfig.cmake
index 1309ed9f8..6dd524abe 100644
--- a/cmake/Key4hepConfig.cmake
+++ b/cmake/Key4hepConfig.cmake
@@ -1,7 +1,8 @@
+# Do not edit this file, it will be overwritten!
+# The template file can be found in
+# https://github.com/key4hep/key4hep-dev-utils/blob/main/defaults/cmake/Key4hepConfig.cmake
+
macro(key4hep_set_compiler_flags)
- if (DEFINED KEY4HEP_SET_COMPILER_FLAGS AND NOT KEY4HEP_SET_COMPILER_FLAGS)
- return()
- endif()
set(COMPILER_FLAGS "-fPIC -Wall -Wextra -Wpedantic -Wshadow -Wdeprecated")
@@ -11,7 +12,10 @@ macro(key4hep_set_compiler_flags)
set(COMPILER_FLAGS "${COMPILER_FLAGS} -fdiagnostics-color=always")
endif()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS}")
+ if (DEFINED KEY4HEP_SET_COMPILER_FLAGS AND NOT KEY4HEP_SET_COMPILER_FLAGS)
+ else()
+ set(CMAKE_CXX_FLAGS "${COMPILER_FLAGS} ${CMAKE_CXX_FLAGS}")
+ endif()
endmacro()
From 9e9c87f54addd5149616c5ad1e6974dac2b2ca60 Mon Sep 17 00:00:00 2001
From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com>
Date: Tue, 10 Sep 2024 20:45:51 +0200
Subject: [PATCH 036/133] Use the Key4hepConfig flag to set the standard,
compiler flags (#387)
---
CMakeLists.txt | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a484b4291..35697ba60 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake )
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+include(cmake/Key4hepConfig.cmake)
+
include(GNUInstallDirs)
set(CMAKE_INSTALL_LIBDIR lib)
set(CMAKE_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
@@ -43,10 +45,6 @@ option(INSTALL_BEAMPIPE_STL_FILES "Download CAD files for building the detailed
find_package(DD4hep REQUIRED COMPONENTS DDRec DDG4 DDParsers)
-# dd4hep_set_compiler_flags() expects DD4hep_SET_RPATH to be set to ON
-# otherwise it will not set the rpath when installing
-set(DD4HEP_SET_RPATH ON)
-dd4hep_set_compiler_flags()
find_package ( ROOT REQUIRED COMPONENTS Geom GenVector)
message ( STATUS "ROOT_VERSION: ${ROOT_VERSION}" )
From 76b676e7677b463ea60e1b53e0a4a897a52cff2f Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Thu, 12 Sep 2024 11:19:20 +0200
Subject: [PATCH 037/133] CLD_o2_v07: LumiCalBackShield: change envelope to an
assembly instead of algobal union of intersections... No overlaps detected
and the finding points on surface does not complain any more
---
.../compact/CLD_o2_v07/LumiCal_o3_v02_05.xml | 23 ++++++++-----------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
index 3c3f7bf64..ccb19b7bc 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
@@ -146,21 +146,16 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
From baa438aafc2d8387108014207c28209f69344c4e Mon Sep 17 00:00:00 2001
From: Andre Sailer
Date: Thu, 12 Sep 2024 11:29:00 +0200
Subject: [PATCH 038/133] CLD_o2_v07: LumiCal: replace all envelopes with
assemblies
at least the lumical specific overlap check with /geometry/test/resolution 300000 is much faster now as well???
---
.../compact/CLD_o2_v07/LumiCal_o3_v02_05.xml | 30 ++++++-------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
index ccb19b7bc..54c8af2f4 100644
--- a/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
+++ b/FCCee/CLD/compact/CLD_o2_v07/LumiCal_o3_v02_05.xml
@@ -21,17 +21,13 @@
-
-
-
-
+
+
-
-
-
+
@@ -64,17 +60,13 @@
-
-
-
-
+
+
-
-
-
+
@@ -106,17 +98,13 @@
-
-
-
-
+
+
-
-
-
+
From 5a426489a7e362fec7b322769a49b34743085c29 Mon Sep 17 00:00:00 2001
From: Daniel Jeans
Date: Mon, 16 Sep 2024 16:51:21 +0900
Subject: [PATCH 039/133] ILD models: apply Tracker_limits to the volume inside
of beampipe and MDI (#388)
* apply Tracker_limits to the volume inside of beampipe and related MDI elements
---------
Co-authored-by: JEANS Daniel Thomelin Dietrich
---
ILD/compact/ILD_common_v02/Beampipe_o1_v01_01.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ILD/compact/ILD_common_v02/Beampipe_o1_v01_01.xml b/ILD/compact/ILD_common_v02/Beampipe_o1_v01_01.xml
index 6cfc55ff9..217e2e575 100644
--- a/ILD/compact/ILD_common_v02/Beampipe_o1_v01_01.xml
+++ b/ILD/compact/ILD_common_v02/Beampipe_o1_v01_01.xml
@@ -3,7 +3,7 @@
-
+
@@ -151,7 +151,7 @@
-
+
@@ -183,7 +183,7 @@
-
+
From 8a7c23281446e8c9f2d99fa8ed5dbd0219e94ed2 Mon Sep 17 00:00:00 2001
From: varnes <150390087+varnes@users.noreply.github.com>
Date: Wed, 18 Sep 2024 00:21:25 -0700
Subject: [PATCH 040/133] Fix printout issues in turbine endcap geometry; also
add v02 of the geometry (#379)
* Fix bug in cell y position for -z endcap
* Add v02 of turbine endcal ecal
* Fix up some printouts
* Fix printouts
* Fix printouts
* Fix printouts
* Resolve conflicts
* update for v2 geometry
* Fix printouts
* Fix printouts
* Update to be compatible with v2 segmentation
* Fix printout
* comment include of DRC in IDEA o1 v3
* IDEA with DRC dedicated test added
* fix IDEA with DRC test
* apply other SD action to DRC
* update IDEA README
* still not working...
* replace absolute path by cmake variables in ctest
* fix test_IDEA_o1_v03 by removing DRC steering file
* IDEA+DRC test is now working
* Fix a few compiler warnings (#374)
* [FCCeeMDI] Use absolute path to import CAD files
* ILD_l5_v11: fix a barrel layer ID (#378)
* 2nd SIT barrel layer ID corrected; error stemed from outcommenting previous 2nd layer
* removed commented layer to avoid any potential issue in the future
* copy TrackerBarrel_o1_v06
* copy CLD_o2_v06 to CLD_o2_v07
* update version
* Use new TrackerBarrel
* TrackerBarrel_o1_v06 remove using namespace std
* move NeighbourSurfacesData population into a function
* Move LayerLayout population out of the sensor loop
* refactor LayerLayout population into function
* TrackerBarrel_o1_v06 add assembly stave
* add tracking volume
* update README
* addExtensionsToHCalAllegro
* implemented suggestions from discussion
* implement comments and improve code readibility
* fix failing test and remove unused phi segmentation
* fix endcap bitfields and improve readibility
* keep ALLEGRO v03 xml file unchanged
* adding version nr also for the barrel xml
* update hcal xml files to v02
* add back ECalEndcaps_Turbine
* remove unused hcal v01 xml files
* update READMEs
* add HCalTileBarrel_o1_v02_geo.cpp
* CLD_o2_v07: start with new lumical to fix overlaps
* CLD_o2_v07: fix overlaps in the LumiCal itself
Add a lumical_max_z_prime parameter to get the actual end place of the lumical
add 7 micron meter to the envelopes.
Fix the location and rotation to use the max_z_prime values
* CLD_o2_v07: remove old lumical xml
* CLD_o2_v07: InnerTracker: fix envelope overlap between lumical and innertracker
* Tests: move CLD test to latest model
* CLD_o2_v07: account for lumical positioning with difference between primed and unprimed
* Fields: correct type to field_type, changed variable name in DD4hep, type still exists as part of handle
* Tests: move one test to something with fieldmaps
* Do not link against podio and EDM4hep dictionaries (#386)
* Add a Key4hepConfig file
* Update Key4hepConfig.cmake with fixes from https://github.com/key4hep/key4hep-dev-utils/pull/7
* Use the Key4hepConfig flag to set the standard, compiler flags (#387)
* CLD_o2_v07: LumiCalBackShield: change envelope to an assembly instead of algobal union of intersections...
No overlaps detected and the finding points on surface does not complain any more
* CLD_o2_v07: LumiCal: replace all envelopes with assemblies
at least the lumical specific overlap check with /geometry/test/resolution 300000 is much faster now as well???
* ILD models: apply Tracker_limits to the volume inside of beampipe and MDI (#388)
* apply Tracker_limits to the volume inside of beampipe and related MDI elements
---------
Co-authored-by: JEANS Daniel Thomelin Dietrich
* Remove unused variable, and add information about o1_v02 to the README file
* Initialize all variables
* Initialize all variables
---------
Co-authored-by: Erich Varnes
Co-authored-by: Brieuc Francois
Co-authored-by: Alvaro Tolosa Delgado
Co-authored-by: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com>
Co-authored-by: BrieucF
Co-authored-by: Victor Schwan <162138084+Victor-Schwan@users.noreply.github.com>
Co-authored-by: Leonhard Reichenbach
Co-authored-by: michaela mlynarikova
Co-authored-by: Andre Sailer
Co-authored-by: jmcarcell
Co-authored-by: Daniel Jeans
Co-authored-by: JEANS Daniel Thomelin Dietrich
---
.../ALLEGRO_o1_v03/ECalEndcaps_Turbine.xml | 8 +-
.../ECalEndcaps_Turbine_calibration.xml | 8 +-
.../ECalEndcap_Turbine_o1_v01_geo.cpp | 66 +-
.../ECalEndcap_Turbine_o1_v02_geo.cpp | 671 ++++++++++++++++++
detector/calorimeter/README.md | 5 +-
.../FCCSWEndcapTurbine_k4geo.h | 4 +-
.../src/FCCSWEndcapTurbine_k4geo.cpp | 73 +-
7 files changed, 787 insertions(+), 48 deletions(-)
create mode 100644 detector/calorimeter/ECalEndcap_Turbine_o1_v02_geo.cpp
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine.xml
index 547053962..ac5b7f2ef 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine.xml
@@ -43,6 +43,11 @@
+
+
+
+
+
@@ -51,6 +56,7 @@
+
@@ -108,7 +114,7 @@
-
+
diff --git a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine_calibration.xml b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine_calibration.xml
index 3d07d3671..1df7dd3af 100644
--- a/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine_calibration.xml
+++ b/FCCee/ALLEGRO/compact/ALLEGRO_o1_v03/ECalEndcaps_Turbine_calibration.xml
@@ -35,6 +35,11 @@
+
+
+
+
+
@@ -43,6 +48,7 @@
+
@@ -100,7 +106,7 @@
-
+
diff --git a/detector/calorimeter/ECalEndcap_Turbine_o1_v01_geo.cpp b/detector/calorimeter/ECalEndcap_Turbine_o1_v01_geo.cpp
index 51d79a656..4a4c43822 100644
--- a/detector/calorimeter/ECalEndcap_Turbine_o1_v01_geo.cpp
+++ b/detector/calorimeter/ECalEndcap_Turbine_o1_v01_geo.cpp
@@ -1,4 +1,5 @@
#include "DD4hep/DetFactoryHelper.h"
+#include "DD4hep/Printout.h"
#include "TMatrixT.h"
// todo: remove gaudi logging and properly capture output
@@ -83,18 +84,18 @@ namespace det {
float BladeAngle = genericBladeElem.attr(_Unicode(angle));
bool decreaseAnglePerWheel = genericBladeElem.attr(_Unicode(decreaseAnglePerWheel));
- lLog << MSG::DEBUG << "Making wheel with inner, outer radii " << ri << ", " << ro << std:: endl;
- lLog << MSG::DEBUG << "Blade angle is " << BladeAngle << "; decrease angle per wheel? " << decreaseAnglePerWheel << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "Making wheel with inner, outer radii %f, %f", ri, ro);
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "Blade angle is %f; decrease angle per wheel? ", BladeAngle, decreaseAnglePerWheel);
dd4hep::xml::Dimension dim(aXmlElement.child(_Unicode(dimensions)));
double grmin = dim.rmin1();
- lLog << MSG::DEBUG << "delZ is " << delZ << endmsg;
+ dd4hep::printout( dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "delZ is %f", delZ);
if (decreaseAnglePerWheel) {
float tubeFracCovered = delZ/(2*grmin*TMath::Tan(BladeAngle));
BladeAngle = TMath::ATan(delZ/(2*ri*tubeFracCovered));
}
if (TMath::Abs(TMath::Tan(BladeAngle)) < delZ/(2.*ri)) {
- lLog << MSG::ERROR << "The requested blade angle is too small for the given delZ and ri values. Please adjust to at least " << TMath::ATan(delZ/(2.*ri))*180./TMath::Pi() << " degrees!" << endmsg;
+ dd4hep::printout(dd4hep::ERROR, "ECalEndcap_Turbine_o1_v01", "The requested blade angle is too small for the given delZ and ri values. Please adjust to at least %f degrees!", TMath::ATan(delZ/(2.*ri))*180./TMath::Pi() );
return;
}
@@ -106,7 +107,7 @@ namespace det {
float CladdingThick = claddingElem.attr(_Unicode(thickness));
float AbsThickMin = absBladeElem.attr(_Unicode(thickness))-(GlueThick+CladdingThick);
if (AbsThickMin < 0.) {
- lLog << MSG::ERROR << "Error: requested absorber thickness is negative after accounting for glue and cladding thickness" << endmsg;
+ dd4hep::printout(dd4hep::ERROR, "ECalEndcap_Turbine_o1_v01", "Error: requested absorber thickness is negative after accounting for glue and cladding thickness");
}
float ElectrodeThick = electrodeBladeElem.attr(_Unicode(thickness));
float LArgapi = nobleLiquidElem.attr(_Unicode(gap));
@@ -127,7 +128,7 @@ namespace det {
bool scaleBladeThickness = absBladeElem.attr(_Unicode(scaleThickness));
float bladeThicknessScaleFactor = absBladeElem.attr(_Unicode(thicknessScaleFactor));
- lLog << MSG::DEBUG << "nUnitCells: " << nUnitCells << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "nUnitCells: %d", nUnitCells);
float AbsThicki = AbsThickMin;
// make volumes for the noble liquid, electrode, and absorber blades
@@ -148,7 +149,7 @@ namespace det {
double leftoverS = (circ - nUnitCells*delrPhiNoGap);
double delrPhiGapOnly = leftoverS/(2*nUnitCells);
LArgapi = delrPhiGapOnly*TMath::Sin(BladeAngle);
- lLog << MSG::DEBUG << "LArGap at inner radius is " << LArgapi << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "LArGap at inner radius is %f", LArgapi);
// now find gap at outer radius
circ = 2*TMath::Pi()*ro;
@@ -193,7 +194,7 @@ namespace det {
} else if (allNonActiveNotSensitive) {
numNonActiveLayers = 1;
} else {
- lLog << MSG::ERROR << "Some non-active layers are sensitive and others are not -- this is likely a misconfiguration";
+ dd4hep::printout(dd4hep::ERROR, "ECalEndcap_Turbine_o1_v01", "Some non-active layers are sensitive and others are not -- this is likely a misconfiguration");
}
float delrNonActive = (ro-ri)/numNonActiveLayers;
@@ -201,14 +202,14 @@ namespace det {
for (unsigned iLayer = 0; iLayer < numNonActiveLayers; iLayer++) {
float roLayer = riLayer + delrNonActive;
- lLog << MSG::INFO << "Making layer in inner, outer radii " << riLayer << " " << roLayer << endmsg;
+ dd4hep::printout(dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Making layer with inner, outer radii %f, %f", riLayer, roLayer);
if (scaleBladeThickness) {
AbsThicko = AbsThicki + bladeThicknessScaleFactor*((roLayer/riLayer)-1.)*AbsThicki;
} else {
AbsThicko = AbsThicki;
}
- lLog << MSG::DEBUG << "Inner and outer absorber thicknesses " << AbsThicki << " " << AbsThicko << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "Inner and outer absorber thicknesses %f, %f ", AbsThicki, AbsThicko);
dd4hep::Solid claddingLayer = buildOneBlade(AbsThicki+GlueThick+CladdingThick, AbsThicko+GlueThick+CladdingThick, xRange, roLayer, riLayer, BladeAngle, delZ );
dd4hep::Solid glueLayer = buildOneBlade(AbsThicki+GlueThick, AbsThicko+GlueThick, xRange, roLayer, riLayer, BladeAngle, delZ );
@@ -264,8 +265,8 @@ namespace det {
leftoverS = (circ - nUnitCells*delrPhiNoGap);
delrPhiGapOnly = leftoverS/(2*nUnitCells);
LArgapo = delrPhiGapOnly*TMath::Sin(BladeAngle);
- lLog << MSG::DEBUG << "Outer LAr gap is " << LArgapo << endmsg ;
- lLog << MSG::INFO << "Inner and outer thicknesses of noble liquid volume " << ElectrodeThick+LArgapi*2 << " " << ElectrodeThick+LArgapo*2 << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "Outer LAr gap is %f", LArgapo) ;
+ dd4hep::printout(dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Inner and outer thicknesses of noble liquid volume %f, %f", ElectrodeThick+LArgapi*2, ElectrodeThick+LArgapo*2);
dd4hep::Solid electrodeBladeAndGapLayer = buildOneBlade(ElectrodeThick+LArgapi*2, ElectrodeThick+LArgapo*2, xRange, roLayer, riLayer, BladeAngle, delZ);
@@ -289,12 +290,12 @@ namespace det {
LArgapi = LArgapo;
AbsThicki = AbsThicko;
}
- lLog << MSG::INFO << "ECal endcap materials: nobleLiquid: " << nobleLiquidElem.materialStr() << " absorber: " << absBladeElem.materialStr() << " electrode: " << electrodeBladeElem.materialStr() << endmsg;
+ dd4hep::printout(dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "ECal endcap materials: nobleLiquid: %s absorber %s electrode %s", nobleLiquidElem.materialStr().c_str(), absBladeElem.materialStr().c_str(), electrodeBladeElem.materialStr().c_str() );
int nUnitCellsToDraw = nUnitCells;
// nUnitCellsToDraw = 2;
- lLog << MSG::INFO << "Number of unit cells "<< nUnitCells << endmsg;
+ dd4hep::printout(dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Number of unit cells %d", nUnitCells);
// place all components of the absorber blade inside passive volume
@@ -310,7 +311,7 @@ namespace det {
dd4hep::PlacedVolume absBladeVol_pv = glueLayerVols[iLayer].placeVolume(absBladeLayerVol, posLayer);
absBladeVol_pv.addPhysVolID("subtype", 0); // 0 = absorber, 1 = glue, 2 = cladding
- lLog << MSG::DEBUG << "Blade layer, rho is " << iLayer << " " << absBladeVol_pv.position().Rho() << " " << roLayer/2. << endmsg;
+ dd4hep::printout( dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01_geo", "Blade layer, rho is %d, %f, %f", iLayer, absBladeVol_pv.position().Rho(), roLayer/2.);
absBladeVol_pv.addPhysVolID("layer", iWheel*numNonActiveLayers+iLayer);
riLayer = roLayer;
@@ -387,10 +388,9 @@ namespace det {
double zminLayer = getZmin(riLayer, BladeAngle, delZ);
dd4hep::Position posLayer(0,0,(zminLayer-zminri+roLayer-ro)/2.);
- std::cout << "for active, riLayer, ri, roLayer, ro = " << riLayer << " " << ri << " " << roLayer << " " << ro << std::endl;
dd4hep::PlacedVolume LArVol_pv(activeVol.placeVolume(LArTotalLayerVol, posLayer));
- lLog << MSG::DEBUG << "LAr layer: " << iLayer << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "LAr layer: %d", iLayer );
LArVol_pv.addPhysVolID("layer", iWheel*ECalEndcapNumCalibLayers+iLayer);
riLayer = roLayer;
@@ -404,7 +404,7 @@ namespace det {
float phi = (iUnitCell-nUnitCellsToDraw/2)*2*TMath::Pi()/nUnitCells;
float delPhi = 2*TMath::Pi()/nUnitCells;
- lLog << MSG::DEBUG << "Placing blade, ro, ri = " << ro << " " << ri << endmsg;
+ dd4hep::printout( dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "Placing blade, ro, ri = %f %f", ro, ri);
TGeoRotation tgr;
tgr.RotateZ(BladeAngle*180/TMath::Pi());
tgr.RotateX(-phi*180/TMath::Pi());
@@ -466,7 +466,7 @@ namespace det {
- lLog << MSG::DEBUG << "LArTotalLayerVols.size = " << LArTotalLayerVols.size() << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "LArTotalLayerVols.size = %d", LArTotalLayerVols.size());
}
@@ -510,17 +510,17 @@ namespace det {
dd4hep::Tube bathOuterShape(bathRmin, bathRmax, bathDelZ); // make it 4 volumes + 5th for detector envelope
dd4hep::Tube bathAndServicesOuterShape(cryoDim.rmin2(), cryoDim.rmax1(), caloDim.dz()); // make it 4 volumes + 5th for detector envelope
- lLog << MSG::INFO << "Cryostat front thickness is " << cryoDim.rmin2() << endmsg;
+ dd4hep::printout( dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Cryostat front thickness is %f", cryoDim.rmin2() );
if (cryoThicknessFront > 0) {
// 1. Create cryostat
dd4hep::Tube cryoFrontShape(cryoDim.rmin1(), cryoDim.rmin2(), cryoDim.dz());
dd4hep::Tube cryoBackShape(cryoDim.rmax1(), cryoDim.rmax2(), cryoDim.dz());
dd4hep::Tube cryoSideOuterShape(cryoDim.rmin2(), cryoDim.rmax1(), cryoDim.dz());
dd4hep::SubtractionSolid cryoSideShape(cryoSideOuterShape, bathAndServicesOuterShape);
- lLog << MSG::INFO << "ECAL endcap cryostat: front: rmin (cm) = " << cryoDim.rmin1() << " rmax (cm) = " << cryoDim.rmin2() << " dz (cm) = " << cryoDim.dz() << endmsg;
- lLog << MSG::INFO << "ECAL encdap cryostat: back: rmin (cm) = " << cryoDim.rmax1() << " rmax (cm) = " << cryoDim.rmax2() << " dz (cm) = " << cryoDim.dz() << endmsg;
- lLog << MSG::INFO << "ECAL endcap cryostat: side: rmin (cm) = " << cryoDim.rmin2() << " rmax (cm) = " << cryoDim.rmax1() << " dz (cm) = " << cryoDim.dz() - caloDim.dz() << endmsg;
- lLog << MSG::INFO << "Cryostat is made out of " << cryostat.materialStr() << endmsg;
+ dd4hep::printout(dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "ECAL endcap cryostat: front: rmin (cm) = %f rmax (cm) = %f dz (cm) = %f ", cryoDim.rmin1(), cryoDim.rmin2(), cryoDim.dz());
+ dd4hep::printout(dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "ECAL encdap cryostat: back: rmin (cm) = %f rmax (cm) = %f dz (cm) = %f", cryoDim.rmax1(), cryoDim.rmax2(), cryoDim.dz());
+ dd4hep::printout( dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "ECAL endcap cryostat: side: rmin (cm) = %f rmax (cm) = %f dz (cm) = %f", cryoDim.rmin2(), cryoDim.rmax1(), cryoDim.dz() - caloDim.dz());
+ dd4hep::printout( dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Cryostat is made out of %s", cryostat.materialStr().c_str() );
dd4hep::Volume cryoFrontVol(cryostat.nameStr()+"_front", cryoFrontShape, aLcdd.material(cryostat.materialStr()));
dd4hep::Volume cryoBackVol(cryostat.nameStr()+"_back", cryoBackShape, aLcdd.material(cryostat.materialStr()));
@@ -533,19 +533,19 @@ namespace det {
cryoFrontVol.setSensitiveDetector(aSensDet);
cryoFrontPhysVol.addPhysVolID("cryo", 1);
cryoFrontPhysVol.addPhysVolID("type", sidetype+1);
- lLog << MSG::INFO << "Cryostat front volume set as sensitive" << endmsg;
+ dd4hep::printout( dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Cryostat front volume set as sensitive");
}
if (cryoBackSensitive) {
cryoBackVol.setSensitiveDetector(aSensDet);
cryoBackPhysVol.addPhysVolID("cryo", 1);
cryoBackPhysVol.addPhysVolID("type", sidetype+2);
- lLog << MSG::INFO << "Cryostat back volume set as sensitive" << endmsg;
+ dd4hep::printout( dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Cryostat back volume set as sensitive" );
}
if (cryoSideSensitive) {
cryoSideVol.setSensitiveDetector(aSensDet);
cryoSidePhysVol.addPhysVolID("cryo", 1);
cryoSidePhysVol.addPhysVolID("type", sidetype+3);
- lLog << MSG::INFO << "Cryostat front volume set as sensitive" << endmsg;
+ dd4hep::printout( dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Cryostat front volume set as sensitive");
}
dd4hep::DetElement cryoFrontDetElem(caloDetElem, "cryo_front", 0);
cryoFrontDetElem.setPlacement(cryoFrontPhysVol);
@@ -558,9 +558,7 @@ namespace det {
// 2. Create noble liquid bath
std::string nobleLiquidMaterial = nobleLiquid.materialStr();
dd4hep::Volume bathVol(nobleLiquidMaterial + "_bath", bathOuterShape, aLcdd.material(nobleLiquidMaterial));
- lLog << MSG::INFO << "ECAL endcap bath: material = " << nobleLiquidMaterial << " rmin (cm) = " << bathRmin
- << " rmax (cm) = " << bathRmax << " dz (cm) = " << caloDim.dz() << " thickness in front of ECal (cm) = " << caloDim.rmin() - cryoDim.rmin2()
- << " thickness behind ECal (cm) = " << cryoDim.rmax1() - caloDim.rmax() << endmsg;
+ dd4hep::printout( dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "ECAL endcap bath: material = %s rmin (cm) = %f rmax (cm) = %f, dz (cm) = %f, thickness in front of ECal (cm) = %f, thickness behind ECal (cm) = %f", nobleLiquidMaterial.c_str(), bathRmin, bathRmax, caloDim.dz(), caloDim.rmin() - cryoDim.rmin2(), cryoDim.rmax1() - caloDim.rmax());
dd4hep::DetElement bathDetElem(caloDetElem, "bath", 1);
// 3. Create detector structure
@@ -569,7 +567,7 @@ namespace det {
dd4hep::xml::DetElement supportTubeElem = calo.child(_Unicode(supportTube));
unsigned nWheels = supportTubeElem.attr(_Unicode(nWheels));
- lLog << MSG::INFO << "Will build " << nWheels << " wheels" << endmsg;
+ dd4hep::printout(dd4hep::INFO, "ECalEndcap_Turbine_o1_v01", "Will build %d wheels", nWheels);
double rmin = bathRmin;
double rmax = bathRmax;
float radiusRatio = pow(rmax/rmin, 1./nWheels);
@@ -604,7 +602,7 @@ namespace det {
dd4hep::PlacedVolume bathPhysVol = aEnvelope.placeVolume(bathVol);
bathDetElem.setPlacement(bathPhysVol);
- lLog << MSG::DEBUG << "Total number of modules: " << iModule << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "Total number of modules: %d", iModule);
return;
}
@@ -634,11 +632,9 @@ createECalEndcapTurbine(dd4hep::Detector& aLcdd, dd4hep::xml::Handle_t aXmlEleme
// dd4hep::DetElement caloPositiveDetElem(caloDetElem, "positive", 0);
// dd4hep::DetElement caloNegativeDetElem(caloDetElem, "negative", 0);
- lLog << MSG::DEBUG << "Placing dector on the positive side: (cm) " << dim.z_offset() << " with min, max radii " << dim.rmin1() << " " << dim.rmax1() << endmsg;
+ dd4hep::printout(dd4hep::DEBUG, "ECalEndcap_Turbine_o1_v01", "Placing detector on the positive side: (cm) %f with min, max radii %f %f",dim.z_offset(), dim.rmin1(), dim.rmax1() );
unsigned iModule = 0;
buildOneSide_Turbine(aLcdd, aSensDet, envelopeVol, aXmlElement, iModule);
- // lLog << MSG::DEBUG << "Placing dector on the negative side: (cm) " << -dim.z_offset() << " with min, max radii " << dim.rmin1() << " " << dim.rmax() << endmsg;
- // buildOneSide_Turbine(aLcdd, aSensDet, envelopeNegativeVol, aXmlElement, -1, iModule);
dd4hep::Assembly endcapsAssembly("ECalEndcaps_turbine");
diff --git a/detector/calorimeter/ECalEndcap_Turbine_o1_v02_geo.cpp b/detector/calorimeter/ECalEndcap_Turbine_o1_v02_geo.cpp
new file mode 100644
index 000000000..a8fcafdc5
--- /dev/null
+++ b/detector/calorimeter/ECalEndcap_Turbine_o1_v02_geo.cpp
@@ -0,0 +1,671 @@
+#include "DD4hep/DetFactoryHelper.h"
+#include "DD4hep/Printout.h"
+#include "TMatrixT.h"
+
+// todo: remove gaudi logging and properly capture output
+#define endmsg std::endl
+#define lLog std::cout
+namespace MSG {
+ const std::string ERROR = " Error: ";
+ const std::string DEBUG = " Debug: ";
+ const std::string INFO = " Info: ";
+}
+
+namespace det {
+
+ namespace ECalEndcap_Turbine_o1_v02 {
+ unsigned ECalEndCapElementCounter = 0;
+
+ unsigned ECalEndcapNumCalibLayers;
+
+ double tForArcLength(double s, double bladeangle, double delZ, double r) {
+
+ // some intermediate constants
+ double zpos = delZ/2.;
+ double zp = zpos/TMath::Tan(bladeangle);
+ double b = zp/(TMath::Sqrt(r*r-zp*zp));
+ double c = (TMath::Tan(s/r) +b)/(1.-b*TMath::Tan(s/r));
+ double d = c*c*r*r/(1+c*c);
+ return (TMath::Sqrt(d)-zp)*TMath::Sin(bladeangle);
+
+ // try approximating the arclength as dx. Less accurate, but that
+ // approximation is used in calculating the LAr gap, so maybe this
+ // will make it more consistent?
+ //return s*TMath::Sin(bladeangle);
+
+ }
+
+ // return position of the inner edge of a blade
+ double getZmin(double r, double bladeangle, double delZ) {
+ // r: distance from the beamline
+ // bladeangle: angle of turbine blades wrt xy plane, in radians
+ // delZ: z extent of the blades
+ return TMath::Sqrt(r*r - ((delZ/2)/TMath::Tan(bladeangle))*((delZ/2)/TMath::Tan(bladeangle)));
+ }
+
+ dd4hep::Solid buildOneBlade(double thickness_inner,
+ double thickness_outer,
+ double width,
+ double ro, double ri,
+ double bladeangle,
+ double delZ)
+ {
+
+ dd4hep::Solid shapeBeforeSubtraction;
+
+ // set max and min extent of the blade (along the z axis in the body frame)
+ double zmax = ro;
+ double zmin = getZmin(ri, bladeangle, delZ);
+
+ dd4hep::Trd2 tmp1(thickness_inner/2., thickness_outer/2., width/2., width/2., (zmax-zmin)/2. );
+ shapeBeforeSubtraction = tmp1;
+
+ dd4hep::Tube allowedTube(ri, ro, delZ);
+
+ return dd4hep::IntersectionSolid (shapeBeforeSubtraction, allowedTube, dd4hep::Transform3D(dd4hep::RotationZYX( 0, TMath::Pi()/2.-bladeangle, TMath::Pi()/2.),dd4hep::Position(0,0, -(zmin+zmax)/2.)));
+
+ }
+
+ void buildWheel(dd4hep::Detector& aLcdd,
+ dd4hep::SensitiveDetector& aSensDet,
+ dd4hep::Volume& aEnvelope,
+ dd4hep::xml::Handle_t& aXmlElement,
+ dd4hep::DetElement& bathDetElem,
+ float ri, float ro, float delZ,
+ unsigned iWheel) {
+
+
+ dd4hep::xml::DetElement calorimeterElem = aXmlElement.child(_Unicode(calorimeter));
+ dd4hep::xml::DetElement genericBladeElem = calorimeterElem.child(_Unicode(turbineBlade));
+ dd4hep::xml::DetElement absBladeElem = genericBladeElem.child(_Unicode(absorberBlade));
+ dd4hep::xml::DetElement claddingElem = genericBladeElem.child(_Unicode(cladding));
+ dd4hep::xml::DetElement glueElem = genericBladeElem.child(_Unicode(glue));
+ dd4hep::xml::DetElement electrodeBladeElem = genericBladeElem.child(_Unicode(electrodeBlade));
+ dd4hep::xml::DetElement nobleLiquidElem = genericBladeElem.child(_Unicode(nobleLiquidGap));
+
+ float BladeAngle = 0.0, AbsThickMin = 0.0, BladeThicknessScaleFactor=0.0;
+ // hardcode for three wheels
+ if (iWheel == 0) {
+ BladeAngle = genericBladeElem.attr