diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 303e365a1b..bcac3a67b2 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -110,7 +110,6 @@ jobs: source install/bin/thisepic.sh sed -i 's%\(\1%g; s%\(/fiber>\|/lens>\)%\1%g' \ ${DETECTOR_PATH}/compact/ecal/bic_default.xml \ - ${DETECTOR_PATH}/compact/ecal/forward_scfi.xml \ ${DETECTOR_PATH}/compact/far_forward/ZDC_Ecal_WSciFi.xml \ ${DETECTOR_PATH}/compact/pid/mrich.xml - uses: actions/upload-artifact@v4 diff --git a/compact/definitions.xml b/compact/definitions.xml index f48fc25fcf..8047e9639c 100644 --- a/compact/definitions.xml +++ b/compact/definitions.xml @@ -545,7 +545,7 @@ Examples: Service gaps in FW direction (before endcapP ECAL) and BW direction (before endcapN HCAL) - + @@ -564,11 +564,11 @@ Service gaps in FW direction (before endcapP ECAL) and BW direction (before endc - + extra 50cm rmax that "protrudes" into the HCAL - + diff --git a/compact/ecal/forward_ScFi.xml b/compact/ecal/forward_ScFi.xml new file mode 100644 index 0000000000..aeca26bf9a --- /dev/null +++ b/compact/ecal/forward_ScFi.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + - Forward Ecal Homogeneous(1) or ScFi(2) Model + + + + + - Forward Ecal Slice Thickness + + + + + + + + + + - Forward Ecal computed total Thickness + + + + + + + + + + + + + + + + + ### Forward (Positive Z) Endcap ScFi Electromagnetic Calorimeter + Implementation of 2025 design + Insert shape is cut out from middle of detector + + + + + + + + + + + + + + + + + + + system:8,northsouth:1,blockrow:6,blockcol:5,towerx:2,towery:2,fiberx:5,fibery:5,x:1,y:1 + + + + + + + diff --git a/compact/ecal/forward_averaged_homogeneous.xml b/compact/ecal/forward_averaged_homogeneous.xml new file mode 100644 index 0000000000..496c88f990 --- /dev/null +++ b/compact/ecal/forward_averaged_homogeneous.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + - Forward Ecal Homogeneous(1) or ScFi(2) Model + + + + + - Forward Ecal Slice Thickness + + + + + + + + + + - Forward Ecal computed total Thickness + + + + + + + + + + + + + + + + + ### Forward (Positive Z) Endcap ScFi Electromagnetic Calorimeter + Implementation of 2025 design + Insert shape is cut out from middle of detector + + + + + + + + + + + + + + + + + + system:8,northsouth:1,blockrow:6,blockcol:5,x:2,y:2 + + + + + + + diff --git a/compact/ecal/forward_homogeneous.xml b/compact/ecal/forward_homogeneous.xml deleted file mode 100644 index e19b8faa69..0000000000 --- a/compact/ecal/forward_homogeneous.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - #### Material Thickness - - - - - - - - - - Ecal Endcap N Layers and computed Thickness - - - - - - - - - - - - - - - - - - ### Forward (Positive Z) Endcap Electromagnetic Calorimeter - - Simplified homogeneous implementation of the forward ScFi calorimeter - Each layer contains an aluminum cover, an air gap, PCB, light guides, and scintillating material - - Insert shape is cut out from middle of detector - - - - - - - - - - - - - - - - - - - - - - - system:8,barrel:3,module:4,layer:8,slice:5,fiber_x:1,fiber_y:1,x:32:-16,y:-16 - - - - - - - diff --git a/compact/ecal/forward_scfi.xml b/compact/ecal/forward_scfi.xml deleted file mode 100644 index 1a26aa97c5..0000000000 --- a/compact/ecal/forward_scfi.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Common Generic visualization attributes - - - - - - - ------------------------------------------ - Forward (Positive Z) Endcap EM Calorimeter - ------------------------------------------ - An EM calorimeter with ScFi modules - - - - - - - - - - - - - - - - system:8,ring:8,module:20,fiber_x:8,fiber_y:8 - - - - - - - diff --git a/compact/materials.xml b/compact/materials.xml index 1eaa7a9368..7cafe677ea 100644 --- a/compact/materials.xml +++ b/compact/materials.xml @@ -283,7 +283,7 @@ - + diff --git a/configurations/becal.yml b/configurations/becal.yml new file mode 100644 index 0000000000..58dc0ef00d --- /dev/null +++ b/configurations/becal.yml @@ -0,0 +1,3 @@ +features: + ecal: + bic_default: diff --git a/configurations/calorimeters.yml b/configurations/calorimeters.yml index 8b995c2b2d..cbb7a0dab0 100644 --- a/configurations/calorimeters.yml +++ b/configurations/calorimeters.yml @@ -2,8 +2,7 @@ features: beampipe: solenoid: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: hcal: diff --git a/configurations/craterlake.yml b/configurations/craterlake.yml index e676a456fe..4774119335 100644 --- a/configurations/craterlake.yml +++ b/configurations/craterlake.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x100.yml b/configurations/craterlake_10x100.yml index 0189ef5b03..18af614953 100644 --- a/configurations/craterlake_10x100.yml +++ b/configurations/craterlake_10x100.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x100_Au197.yml b/configurations/craterlake_10x100_Au197.yml index f391123a72..36cbfb4263 100644 --- a/configurations/craterlake_10x100_Au197.yml +++ b/configurations/craterlake_10x100_Au197.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x110_He3.yml b/configurations/craterlake_10x110_He3.yml index b36310935e..cc60709198 100644 --- a/configurations/craterlake_10x110_He3.yml +++ b/configurations/craterlake_10x110_He3.yml @@ -20,7 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: + forward_averaged_homogeneous: forward_insert_homogeneous: bic_default: backward_PbWO4: diff --git a/configurations/craterlake_10x115_Cu63.yml b/configurations/craterlake_10x115_Cu63.yml index e750a64d63..743b69ae73 100644 --- a/configurations/craterlake_10x115_Cu63.yml +++ b/configurations/craterlake_10x115_Cu63.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x115_Ru96.yml b/configurations/craterlake_10x115_Ru96.yml index 8ee4c7c9ab..68b885e61f 100644 --- a/configurations/craterlake_10x115_Ru96.yml +++ b/configurations/craterlake_10x115_Ru96.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x130.yml b/configurations/craterlake_10x130.yml index a5f1a377b0..bae6a3071d 100644 --- a/configurations/craterlake_10x130.yml +++ b/configurations/craterlake_10x130.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x130_H2.yml b/configurations/craterlake_10x130_H2.yml index 4ca7c7f286..225b877365 100644 --- a/configurations/craterlake_10x130_H2.yml +++ b/configurations/craterlake_10x130_H2.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x166_He3.yml b/configurations/craterlake_10x166_He3.yml index 983f87520e..b8c30f79b1 100644 --- a/configurations/craterlake_10x166_He3.yml +++ b/configurations/craterlake_10x166_He3.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x250.yml b/configurations/craterlake_10x250.yml index 38cf1196a6..d12632d734 100644 --- a/configurations/craterlake_10x250.yml +++ b/configurations/craterlake_10x250.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_10x275.yml b/configurations/craterlake_10x275.yml index b3463712c1..6c5c607f2a 100644 --- a/configurations/craterlake_10x275.yml +++ b/configurations/craterlake_10x275.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_18x110_Au.yml b/configurations/craterlake_18x110_Au.yml index 25ef440f8b..eaa2409606 100644 --- a/configurations/craterlake_18x110_Au.yml +++ b/configurations/craterlake_18x110_Au.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_18x110_He3.yml b/configurations/craterlake_18x110_He3.yml index f1947edc10..99524560dd 100644 --- a/configurations/craterlake_18x110_He3.yml +++ b/configurations/craterlake_18x110_He3.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_18x275.yml b/configurations/craterlake_18x275.yml index aa5fafa7ed..488ae06644 100644 --- a/configurations/craterlake_18x275.yml +++ b/configurations/craterlake_18x275.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_5x100.yml b/configurations/craterlake_5x100.yml index af683ee9ac..d19d890e4e 100644 --- a/configurations/craterlake_5x100.yml +++ b/configurations/craterlake_5x100.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_5x41.yml b/configurations/craterlake_5x41.yml index 8168b26b74..036b1ca328 100644 --- a/configurations/craterlake_5x41.yml +++ b/configurations/craterlake_5x41.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_5x41_He3.yml b/configurations/craterlake_5x41_He3.yml index b788ac84c2..2cea66c20e 100644 --- a/configurations/craterlake_5x41_He3.yml +++ b/configurations/craterlake_5x41_He3.yml @@ -20,7 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: + forward_averaged_homogeneous: forward_insert_homogeneous: bic_default: backward_PbWO4: diff --git a/configurations/craterlake_bic_6layers.yml b/configurations/craterlake_bic_6layers.yml index 18dc8e22ef..d307464911 100644 --- a/configurations/craterlake_bic_6layers.yml +++ b/configurations/craterlake_bic_6layers.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_6layers: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_bic_layer1_only.yml b/configurations/craterlake_bic_layer1_only.yml index 970898d4d4..afd7584eca 100644 --- a/configurations/craterlake_bic_layer1_only.yml +++ b/configurations/craterlake_bic_layer1_only.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_layer1_only: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_no_bhcal.yml b/configurations/craterlake_no_bhcal.yml index 19a67e6ed5..c6e01c50d7 100644 --- a/configurations/craterlake_no_bhcal.yml +++ b/configurations/craterlake_no_bhcal.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_no_zdc_lyso.yml b/configurations/craterlake_no_zdc_lyso.yml index 363b2f357c..a7776dc229 100644 --- a/configurations/craterlake_no_zdc_lyso.yml +++ b/configurations/craterlake_no_zdc_lyso.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/craterlake_without_zdc_10x100_Au197.yml b/configurations/craterlake_without_zdc_10x100_Au197.yml index d79713b3a2..a75d87137c 100644 --- a/configurations/craterlake_without_zdc_10x100_Au197.yml +++ b/configurations/craterlake_without_zdc_10x100_Au197.yml @@ -20,7 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: + forward_averaged_homogeneous: forward_insert_homogeneous: bic_default: backward_PbWO4: diff --git a/configurations/craterlake_without_zdc_5x41_Au197.yml b/configurations/craterlake_without_zdc_5x41_Au197.yml index 93d5f63176..ed1220e006 100644 --- a/configurations/craterlake_without_zdc_5x41_Au197.yml +++ b/configurations/craterlake_without_zdc_5x41_Au197.yml @@ -20,7 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: + forward_averaged_homogeneous: forward_insert_homogeneous: bic_default: backward_PbWO4: diff --git a/configurations/femcal_averaged_homogeneous.yml b/configurations/femcal_averaged_homogeneous.yml new file mode 100644 index 0000000000..362591e4c7 --- /dev/null +++ b/configurations/femcal_averaged_homogeneous.yml @@ -0,0 +1,6 @@ +features: + beampipe: + fields: + marco: + ecal: + forward_averaged_homogeneous: diff --git a/configurations/femcal_scfi.yml b/configurations/femcal_scfi.yml new file mode 100644 index 0000000000..70feb2cd89 --- /dev/null +++ b/configurations/femcal_scfi.yml @@ -0,0 +1,6 @@ +features: + beampipe: + fields: + marco: + ecal: + forward_ScFi: diff --git a/configurations/fhcal.yml b/configurations/fhcal.yml new file mode 100644 index 0000000000..9947710072 --- /dev/null +++ b/configurations/fhcal.yml @@ -0,0 +1,6 @@ +features: + fields: + marco: + hcal: + lfhcal: + forward_insert: diff --git a/configurations/forward_calorimeters.yml b/configurations/forward_calorimeters.yml new file mode 100644 index 0000000000..136e16d6ab --- /dev/null +++ b/configurations/forward_calorimeters.yml @@ -0,0 +1,8 @@ +features: + fields: + marco: + ecal: + forward_averaged_homogeneous: + hcal: + lfhcal: + forward_insert: diff --git a/configurations/forward_detectors.yml b/configurations/forward_detectors.yml index e9ccbb099c..810182a0bd 100644 --- a/configurations/forward_detectors.yml +++ b/configurations/forward_detectors.yml @@ -16,7 +16,6 @@ features: dirc: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: hcal: lfhcal: diff --git a/configurations/forward_detectors_with_inserts.yml b/configurations/forward_detectors_with_inserts.yml index e7e43ab46d..36f7644b6e 100644 --- a/configurations/forward_detectors_with_inserts.yml +++ b/configurations/forward_detectors_with_inserts.yml @@ -16,8 +16,7 @@ features: dirc: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: hcal: lfhcal: forward_insert: diff --git a/configurations/full.yml b/configurations/full.yml index 8168b26b74..036b1ca328 100644 --- a/configurations/full.yml +++ b/configurations/full.yml @@ -20,8 +20,7 @@ features: pfrich: drich: ecal: - forward_homogeneous: - forward_insert_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: solenoid: diff --git a/configurations/inner_detector.yml b/configurations/inner_detector.yml index f5f3a427ff..6829ff8c56 100644 --- a/configurations/inner_detector.yml +++ b/configurations/inner_detector.yml @@ -16,7 +16,7 @@ features: tof_barrel: tof_endcap: ecal: - forward_homogeneous: + forward_averaged_homogeneous: bic_default: backward_PbWO4: pid: diff --git a/src/EndcapCalorimeterWithInsertCutout_geo.cpp b/src/EndcapCalorimeterWithInsertCutout_geo.cpp deleted file mode 100644 index 93e3849e72..0000000000 --- a/src/EndcapCalorimeterWithInsertCutout_geo.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -// Copyright (C) 2022 Ryan Milton - -//========================================================================== -// Implementation of forward calorimeter with the insert shape cut out -//-------------------------------------------------------------------------- -// Author: Ryan Milton (UCR) -//========================================================================== - -#include "DD4hep/DetFactoryHelper.h" -#include -#include - -using namespace dd4hep; - -static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens) { - xml_det_t detElem = handle; - std::string detName = detElem.nameStr(); - int detID = detElem.id(); - - xml_dim_t dim = detElem.dimensions(); - double rmin = dim.rmin(); // Dummy variable. Set to 0 since cutting out insert - double rmax = dim.rmax(); // Max radius of endcap - double length = dim.z(); // Size along z-axis - - xml_dim_t pos = detElem.position(); - - Material air = desc.material("Air"); - - // Getting insert dimensions - const xml::Component& insert_xml = detElem.child(_Unicode(insert)); - xml_dim_t insert_dim = insert_xml.dimensions(); - xml_dim_t insert_local_pos = insert_xml.position(); - - // Defining envelope - Tube envelope(rmin, rmax, length / 2.0); - - // Removing insert shape from envelope - Box insert(insert_dim.x() / 2., insert_dim.y() / 2., length / 2.); - SubtractionSolid envelope_with_inserthole( - envelope, insert, Position(insert_local_pos.x(), insert_local_pos.y(), 0.)); - Volume envelopeVol(detName, envelope_with_inserthole, air); - // Setting envelope attributes - envelopeVol.setAttributes(desc, detElem.regionStr(), detElem.limitsStr(), detElem.visStr()); - PlacedVolume pv; - - int layer_num = 1; - double layer_z = -length / 2.; // Keeps track of layers' local z locations - // Looping through all the different layer sections - for (xml_coll_t c(detElem, _U(layer)); c; ++c) { - xml_comp_t x_layer = c; - int repeat = x_layer.repeat(); - double layer_thickness = x_layer.thickness(); - - // Looping through the number of repeated layers in each section - for (int i = 0; i < repeat; i++) { - layer_z += layer_thickness / 2.; // Going to halfway point in layer - - std::string layer_name = detName + _toString(layer_num, "_layer%d"); - Tube layer(rmin, rmax, layer_thickness / 2.); - - // Removing insert shape from each layer - Box layer_insert(insert_dim.x() / 2., insert_dim.y() / 2., layer_thickness / 2.); - SubtractionSolid layer_with_inserthole( - layer, layer_insert, Position(insert_local_pos.x(), insert_local_pos.y(), 0.)); - Volume layer_vol(layer_name, layer_with_inserthole, air); - - int slice_num = 1; - double slice_z = -layer_thickness / 2.; // Keeps track of slices' z locations in each layer - - // Looping over each layer's slices - for (xml_coll_t l(x_layer, _U(slice)); l; ++l) { - xml_comp_t x_slice = l; - double slice_thickness = x_slice.thickness(); - std::string slice_name = layer_name + _toString(slice_num, "slice%d"); - Material slice_mat = desc.material(x_slice.materialStr()); - slice_z += slice_thickness / 2.; // Going to slice halfway point - - Tube slice(rmin, rmax, slice_thickness / 2.); - - // Removing insert shape from each slice - Box slice_insert(insert_dim.x() / 2., insert_dim.y() / 2., slice_thickness / 2.0); - SubtractionSolid slice_with_inserthole( - slice, slice_insert, Position(insert_local_pos.x(), insert_local_pos.y(), 0.)); - Volume slice_vol(slice_name, slice_with_inserthole, slice_mat); - - // Setting appropriate slices as sensitive - if (x_slice.isSensitive()) { - sens.setType("calorimeter"); - slice_vol.setSensitiveDetector(sens); - } - - // Setting slice attributes - slice_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); - - // Placing slice within layer - pv = layer_vol.placeVolume(slice_vol, - Transform3D(RotationZYX(0, 0, 0), Position(0., 0., slice_z))); - pv.addPhysVolID("slice", slice_num); - slice_z += slice_thickness / 2.; // Going to end of slice - ++slice_num; - } - - // Setting layer attributes - layer_vol.setAttributes(desc, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr()); - - // Placing each layer inside the envelope volume - // layer_z starts as -length/2 (front of endcap) - // layer_z is increased by layer_thickness/2 at the start of the layer loop - // This moves to the middle of the layer (location of placement) - // It's then increased by layer_thickness/2 again to move to end of layer - pv = envelopeVol.placeVolume(layer_vol, - Transform3D(RotationZYX(0, 0, 0), Position(0., 0., layer_z))); - pv.addPhysVolID("layer", layer_num); - layer_num++; - layer_z += layer_thickness / 2.; - } - } - - DetElement det(detName, detID); - Volume motherVol = desc.pickMotherVolume(det); - - // Placing endcap in world volume - auto tr = Transform3D(Position(pos.x(), pos.y(), pos.z() + length / 2.)); - - PlacedVolume phv = motherVol.placeVolume(envelopeVol, tr); - phv.addPhysVolID("system", detID); - det.setPlacement(phv); - - return det; -} -DECLARE_DETELEMENT(epic_EndcapCalorimeterWithInsertCutout, createDetector) diff --git a/src/forwardEcalMap.h b/src/forwardEcalMap.h new file mode 100644 index 0000000000..b4cfede564 --- /dev/null +++ b/src/forwardEcalMap.h @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2025 Akio Ogawa +//========================================================================== +// Implementation of forward calorimeter Mapping and numbering +//========================================================================== +// Author: Akio Ogawa (BNL) +//========================================================================== + +static const int mMaxNS = 2; +static const int mMaxBlockId = 1145; +static const int mMaxRowBlock = 39; +static const int mMaxColBlock = 19; + +static const int mMaxTowerId = 18320; +static const int mMaxRowTower = mMaxRowBlock * 4; +static const int mMaxColTower = mMaxColBlock * 4; + +static const int mMaxFeebdId = 594; +static const int mMaxRowFeebd = 39; //=mMaxRowBlock; +static const int mMaxColFeebd = 10; //=(mMaxColBlock+1)/2; + +static const int mNColBlock[mMaxNS][mMaxRowBlock] = { + {3, 6, 9, 11, 12, 13, 14, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 18, 18, + 18, 19, 19, 19, 18, 18, 18, 17, 17, 16, 16, 15, 14, 13, 12, 11, 9, 6, 3}, + {3, 6, 9, 11, 12, 13, 14, 15, 16, 16, 17, 17, 18, 18, 18, 19, 19, 19, 17, 17, + 17, 19, 19, 19, 18, 18, 18, 17, 17, 16, 16, 15, 14, 13, 12, 11, 9, 6, 3}}; + +static const int mNTowerInBlock = 4; //a block contains 4x4 towers +static const double mBlockSize = 10.0; //size of block +static const double mBlockLength = 17.0; //size of block +static const double mSpaceBetweenBlock = 0.1; //gap between blocks +static const double mBackPlateZ = 362.0; //Global Z of backplate = start of Hcal +static const double mOffsetX[mMaxNS] = {0.685 / 2.0, + 0.685 / 2.0}; //gap between north and south halves +static const double mOffsetY[mMaxNS] = { + 0.0, 0.0}; //height offset between beamline and middle of detector +static const double mOffsetZ[mMaxNS] = {mBackPlateZ - mBlockLength, mBackPlateZ - mBlockLength}; +//z position of front face of detector +static const double mOffsetXBeamPipe[mMaxNS] = { + 7.5, 20.05}; //3 rows at beamline height is shifted, also = insert width diff --git a/src/forwardEcal_geo.cpp b/src/forwardEcal_geo.cpp new file mode 100644 index 0000000000..552f2ad5f7 --- /dev/null +++ b/src/forwardEcal_geo.cpp @@ -0,0 +1,303 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2025 Akio Ogawa + +//========================================================================== +// Implementation of forward calorimeter with 2025 design and +// the insert shape cut out, with ScFi +//-------------------------------------------------------------------------- +// Author: Akio Ogawa (BNL) +//========================================================================== + +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" +#include +#include +#include "forwardEcalMap.h" + +double xBlock(int ns, int row, int col) { + if (row >= 18 && row <= 20) { + return (1 - 2 * ns) * + (mOffsetX[ns] + mOffsetXBeamPipe[ns] + (mBlockSize + mSpaceBetweenBlock) * (col + 0.5)); + } else { + return (1 - 2 * ns) * (mOffsetX[ns] + (mBlockSize + mSpaceBetweenBlock) * (col + 0.5)); + } +} + +double yBlock(int ns, int row) { + return mOffsetY[ns] + (mBlockSize + mSpaceBetweenBlock) * (mMaxRowBlock / 2.0 - row - 0.5); +} + +using namespace dd4hep; + +static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens) { + + //forwardEcalMap* map = new forwardEcalMap(); + //double blocksize = map->blockSize(); // X,Y size of block + //double blockgap = map->spaceBetweenBlock(); // Gap between blocks + double blocksize = mBlockSize; + double blockgap = mSpaceBetweenBlock; + double nsgap = mOffsetX[0] + mOffsetX[1]; // North-South gap + double rmin = 0.0; // Dummy variable. Set to 0 since cutting out insert + double rmax = 81 * 2.54; // Max radius of endcap + double rmaxWithGap = rmax + nsgap / 2.0; // Max radius with NS gap included + //double zmax = map->backPlateZ(); // Face of back plate fEcal mount to = Hcal start z + double zmax = mBackPlateZ; // Face of back plate fEcal mount to = Hcal start z + double length = 27.0; // Total length + double zmin = zmax - length; // minimum z where detector starts + //double insert_dx[2] = {map->offsetXBeamPipe(0), map->offsetXBeamPipe(1)}; + double insert_dx[2] = {mOffsetXBeamPipe[0], mOffsetXBeamPipe[1]}; + // Insert x width for north and south halves + double insert_dy = 30.05; // Insert y height + double insert_dz = 27.0; // Insert (=Al beam pipe protector) z depth + double insert_thickness = 0.25 * 2.54; // Insert (=Al beam pipe protector) thickness + double insert_x = (insert_dx[0] - insert_dx[1]) / 2.0; //Insert center x + int nx = 26; //number of fibers in a row + int ny = 30; //numbers of row of fibers + double rFiber = 0.0235; //fiber radius (PMMA outside) + double rScfi = 0.02209; //Scintillating fiber core radius + + const double phi1[2] = {-M_PI / 2.0, M_PI / 2.0}; + const double phi2[2] = {M_PI / 2.0, 3.0 * M_PI / 2.0}; + const char* nsName[2] = {"N", "S"}; + const double pm[2] = {1.0, -1.0}; //positive x for north, and negative for south + + //from compact files + xml_det_t detElem = handle; + std::string detName = detElem.nameStr(); + int detID = detElem.id(); + + int Homogeneous_Scfi = 0; + Homogeneous_Scfi = desc.constant("ForwardEcal_Homogeneous_Scfi"); + if (Homogeneous_Scfi <= 1) + printout(INFO, "FEMC", "Making Homogeneous geometry model\n"); + else + printout(INFO, "FEMC", "Making ScFi geometry model\n"); + + xml_dim_t dim = detElem.dimensions(); + xml_dim_t pos = detElem.position(); + if (dim.z() != length) + printf("WARNING!!! forwardEcal_geo.cpp detect inconsistent Z len %f(compact) %f(map)\n", + dim.z(), length); + if (pos.z() != zmin) + printf("WARNING!!! forwardEcal_geo.cpp detect inconsistent Z pos %f(compact) %f(map)\n", + pos.z(), zmin); + //printf("forwardEcal_geo : dz=%f %f zmin=%f %f\n",dim.z(),length,pos.z(),zmin); + + PlacedVolume pv; + Material air = desc.material("Air"); + Material alumi = desc.material("Aluminum5083"); //actually using 6061... does it matter? + Material Wpowder = desc.material("WPowderplusEpoxy"); + Material PMMA = desc.material("Plexiglass"); + Material ScFi = desc.material("Polystyrene"); + + // Defining envelope with full phi,with slightly increased radius for NS gap + Tube envelope(rmin, rmaxWithGap, length / 2.0); + + // Removing insert shape from envelope + Box insert((insert_dx[0] + insert_dx[1] - insert_thickness * 2 + nsgap) / 2.0, + (insert_dy - insert_thickness * 2) / 2.0, length / 2.); + SubtractionSolid envelope_with_inserthole(envelope, insert, Position(insert_x, 0.0, 0.0)); + Volume envelopeVol(detName, envelope_with_inserthole, air); + envelopeVol.setAttributes(desc, detElem.regionStr(), detElem.limitsStr(), detElem.visStr()); + + //double thickness=0.0; + //int slice_num = 1; + double slice_z = -length / 2.0; // Keeps track of slices' z locations in each layer + // Looping over each layer's slices + for (xml_coll_t sl(detElem, _U(slice)); sl; ++sl) { + xml_comp_t x_slice = sl; + double slice_thickness = x_slice.thickness(); + //thickness+=slice_thickness; + //printf("forwardEcal slice=%1d %8.4f %s \n",slice_num,slice_thickness,x_slice.materialStr().c_str()); + std::string slice_name = "fEcal" + x_slice.nameStr(); + Material slice_mat = desc.material(x_slice.materialStr()); + slice_z += slice_thickness / 2.; // Going to slice halfway point + Tube slice(rmin, rmaxWithGap, slice_thickness / 2.); + + // Removing insert shape from each slice + Box slice_insert((insert_dx[0] + insert_dx[1] + nsgap) / 2.0, insert_dy / 2.0, + slice_thickness / 2.0); + SubtractionSolid slice_with_inserthole(slice, slice_insert, Position(insert_x, 0.0, 0.0)); + Volume slice_vol(slice_name, slice_with_inserthole, air); //Still air + slice_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = envelopeVol.placeVolume(slice_vol, + Transform3D(RotationZYX(0, 0, 0), Position(0., 0., slice_z))); + + //Loop over north and south halves + for (int ns = 0; ns < 2; ns++) { + Tube half(rmin, rmax, slice_thickness / 2.0, phi1[ns], phi2[ns]); + std::string half_name = slice_name + "_" + nsName[ns]; + + // Removing insert shape from each slice & halves + Box half_insert(insert_dx[ns] / 2.0, insert_dy / 2.0, slice_thickness / 2.0); + SubtractionSolid half_with_inserthole(half, half_insert, + Position(pm[ns] * insert_dx[ns] / 2.0, 0.0, 0.0)); + + Material mat = slice_mat; + if (x_slice.isSensitive()) + mat = air; //for calorimeter itself, still air to place blocks inside + Volume half_vol(half_name, half_with_inserthole, mat); + half_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = slice_vol.placeVolume( + half_vol, Transform3D(RotationZYX(0, 0, 0), Position(pm[ns] * nsgap / 2.0, 0.0, 0.0))); + pv.addPhysVolID("northsouth", ns); + + // For detector (sensitive) slice, placing detector blocks in col and row + double bsize = blocksize + blockgap; + if (x_slice.isSensitive()) { + + //Define WSiFi block (4x4 towers) + if (Homogeneous_Scfi <= 1) + mat = slice_mat; + Box block(blocksize / 2.0, blocksize / 2.0, slice_thickness / 2.0); + Volume block_vol("FEMCBlock", block, mat); + block_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + if (Homogeneous_Scfi <= 1) { + sens.setType("calorimeter"); + block_vol.setSensitiveDetector(sens); + } // end if Homogeneous_Scfi<=1 + + if (Homogeneous_Scfi == 2) { + //4 rows of towers + Box trow(blocksize / 2.0, blocksize / 8.0, slice_thickness / 2.0); + Volume trow_vol("FEMCTowerRow", trow, air); + trow_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + for (int tr = 0; tr < 4; tr++) { + pv = block_vol.placeVolume( + trow_vol, + Transform3D(RotationZYX(0, 0, 0), Position(0.0, (tr - 1.5) * blocksize / 4, 0))); + pv.addPhysVolID("towery", tr); + } + + //4 towers in a row - finally a W powder volume, not air + Box tower(blocksize / 8.0, blocksize / 8.0, slice_thickness / 2.0); + Volume tower_vol("FEMCTower", tower, Wpowder); + tower_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + for (int tc = 0; tc < 4; tc++) { + pv = trow_vol.placeVolume( + tower_vol, + Transform3D(RotationZYX(0, 0, 0), Position((tc - 1.5) * blocksize / 4, 0, 0))); + pv.addPhysVolID("towerx", tc); + } + + //rows of fibers + double fiberDistanceX = + blocksize / 4.0 / (nx + 0.5); //exrea 0.5 for even/odd rows shifted by 1/2 + Box frow(blocksize / 8.0 - fiberDistanceX / 2.0, blocksize / 8.0 / ny, + slice_thickness / 2.0); + Volume frow_vol("FEMCFiberRow", frow, Wpowder); + frow_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + for (int iy = 0; iy < ny; iy++) { + double xx = 0; + if (iy % 2 == 1) + xx += fiberDistanceX / 2.0; + pv = tower_vol.placeVolume( + frow_vol, + Transform3D(RotationZYX(0, 0, 0), + Position(xx, (iy - ny / 2.0 + 0.5) * blocksize / 4.0 / ny, 0))); + //printf("iy=%2d dy=%8.4f fiberRx2=%8.4f xx=%8.4f\n",iy,blocksize/4.0/ny,rFiber*2,xx); + pv.addPhysVolID("fibery", iy); + } + + //columns of fibers, with 1/2 fiber distance shifted each row + Box fcol(fiberDistanceX / 2.0, blocksize / 8.0 / ny, slice_thickness / 2.0); + Volume fcol_vol("FEMCFiberCol", fcol, Wpowder); + fcol_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + for (int ix = 0; ix < nx; ix++) { + double xx = (ix - nx / 2.0 + 0.5) * fiberDistanceX; + pv = frow_vol.placeVolume(fcol_vol, + Transform3D(RotationZYX(0, 0, 0), Position(xx, 0, 0))); + //printf("ix=%2d dx=%8.4f xx=%8.4f x0=%8.4f x1=%8.4f\n",ix,fiberDistanceX,xx,xx-fiberDistanceX/2,xx+fiberDistanceX/2); + pv.addPhysVolID("fiberx", ix); + } + + //a fiber (with coating material, not sensitive yet) + Tube fiber(0, rFiber, slice_thickness / 2.0); + Volume fiber_vol("FEMCFiber", fiber, PMMA); + fiber_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = + fcol_vol.placeVolume(fiber_vol, Transform3D(RotationZYX(0, 0, 0), Position(0, 0, 0))); + + //scintillating fiber core - and finally a sensitive volume + Tube scfi(0, rScfi, slice_thickness / 2.0); + Volume scfi_vol("FEMCScFi", scfi, ScFi); + scfi_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = + fiber_vol.placeVolume(scfi_vol, Transform3D(RotationZYX(0, 0, 0), Position(0, 0, 0))); + sens.setType("calorimeter"); + scfi_vol.setSensitiveDetector(sens); + } //end if Homogeneous_Scfi==2 + + //rows of blocks + //int nRowBlock = map->maxRowBlock(); //# of rows + int nRowBlock = mMaxRowBlock; + for (int r = 0; r < nRowBlock; r++) { + //int nColBlock = map->nColBlock(ns, r); + int nColBlock = mNColBlock[ns][r]; + double dxrow = bsize * nColBlock; + Box row(dxrow / 2.0, bsize / 2.0, slice_thickness / 2.0); + std::string row_name = half_name + _toString(r, "_R%02d"); + Volume row_vol(row_name, row, air); + row_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + //double xrow = (map->xBlock(ns, r, 0) + map->xBlock(ns, r, nColBlock - 1)) / 2.0 - + // pm[ns] * nsgap / 2.0; + //double yrow = map->yBlock(ns, r); + double xrow = + (xBlock(ns, r, 0) + xBlock(ns, r, nColBlock - 1)) / 2.0 - pm[ns] * nsgap / 2.0; + double yrow = yBlock(ns, r); + pv = half_vol.placeVolume(row_vol, + Transform3D(RotationZYX(0, 0, 0), Position(xrow, yrow, 0))); + pv.addPhysVolID("blockrow", r); + + //column of blocks + double xcol = -pm[ns] * (dxrow / 2.0 - bsize / 2.0); + for (int c = 0; c < nColBlock; c++) { + Box col(bsize / 2.0, bsize / 2.0, slice_thickness / 2.0); + std::string col_name = row_name + _toString(c, "C%02d"); + Volume col_vol(col_name, col, air); + col_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr()); + pv = row_vol.placeVolume(col_vol, + Transform3D(RotationZYX(0, 0, 0), Position(xcol, 0, 0))); + pv.addPhysVolID("blockcol", c); + //printf("r=%2d dx=%8.3f x=%8.3f y=%8.3f c=%2d %8.3f mapx=%8.3f\n",r,dxrow,xrow,yrow,c,xcol,map->xBlock(ns,r,c)); + xcol += pm[ns] * bsize; + + //a block inside with air gap + pv = col_vol.placeVolume(block_vol, + Transform3D(RotationZYX(0, 0, 0), Position(0, 0, 0))); + } //end loop block col + } //end loop block raw + } //end if isSensitive + } //end loop over ns + slice_z += slice_thickness / 2.; // Going to end of slice + //++slice_num; + } //end loop over slice + //printf("forwardEcal Total thickness=%f Slice end at %f\n",thickness,slice_z); + + //Al Beampipe Protector placed in envelope volume outside slices + for (int ns = 0; ns < 2; ns++) { + Box bpp(insert_dx[ns] / 2.0, insert_dy / 2.0, insert_dz / 2.0); + std::string bpp_name = detName + "_BeamPipeProtector_" + nsName[ns]; + Box bpp_hole((insert_dx[ns] - insert_thickness) / 2.0, insert_dy / 2.0 - insert_thickness, + insert_dz / 2.0); + SubtractionSolid bpp_with_hole(bpp, bpp_hole, + Position(-pm[ns] * insert_thickness / 2.0, 0.0, 0.0)); + Volume bpp_vol(bpp_name, bpp_with_hole, alumi); + bpp_vol.setAttributes(desc, detElem.regionStr(), detElem.limitsStr(), detElem.visStr()); + pv = envelopeVol.placeVolume( + bpp_vol, Transform3D(RotationZYX(0, 0, 0), Position(pm[ns] * (insert_dx[ns] + nsgap) / 2.0, + 0.0, (length - insert_dz) / 2.0))); + } + + // Placing in the world volume + DetElement det(detName, detID); + Volume motherVol = desc.pickMotherVolume(det); + auto tr = Transform3D(Position(0.0, 0.0, zmin + length / 2.0)); + pv = motherVol.placeVolume(envelopeVol, tr); + pv.addPhysVolID("system", detID); + det.setPlacement(pv); + + //printf("forwardEcal_geo Done\n"); + return det; +} +DECLARE_DETELEMENT(epic_ForwardEcal, createDetector)