diff --git a/compact/definitions.xml b/compact/definitions.xml index a6f0d5567..2bee4296f 100644 --- a/compact/definitions.xml +++ b/compact/definitions.xml @@ -314,6 +314,7 @@ The unused IDs below are saved for future use. + diff --git a/compact/display.xml b/compact/display.xml index ea4b367e4..daf1d4898 100644 --- a/compact/display.xml +++ b/compact/display.xml @@ -50,14 +50,14 @@ - - - + + + For shielded modules by default just display to module instead of 6 layers - + Luminosity Visualisation diff --git a/compact/far_backward/beamline_extension_electron.xml b/compact/far_backward/beamline_extension_electron.xml index 9a47d3f38..e1346df24 100644 --- a/compact/far_backward/beamline_extension_electron.xml +++ b/compact/far_backward/beamline_extension_electron.xml @@ -25,7 +25,8 @@ + rout1="Q4eR_InnerRadius" rout2="Q4eR_InnerRadius" + limits="kill_limits"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + system:8,pipe:8,end:2 + + + + + diff --git a/compact/far_backward/extended.xml b/compact/far_backward/extended.xml index bcbb157de..dbd48fc5b 100644 --- a/compact/far_backward/extended.xml +++ b/compact/far_backward/extended.xml @@ -13,4 +13,6 @@ + + diff --git a/compact/far_forward/roman_pots_eRD24_design.xml b/compact/far_forward/roman_pots_eRD24_design.xml index f3a393c62..ea301ec34 100644 --- a/compact/far_forward/roman_pots_eRD24_design.xml +++ b/compact/far_forward/roman_pots_eRD24_design.xml @@ -5,9 +5,10 @@ --------------------------------- - Roman Pots Implementation from eRD24 RD Effort + Roman Pots Implementation updated strawman layout (only layer materials) Author: Alex Jentsch Date of first commit: June 15th, 2021 + Last update: Oct 8th, 2024 --------------------------------- @@ -21,45 +22,31 @@ - - - - - - + - - + - + + - - + + - - + + + + - - - - - - - - - - - - + - - + + @@ -88,49 +75,60 @@ reflect="false" vis="FFTrackerVis"> - + - - - + + - - + + - + - - - - - - - - - - - - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -163,7 +161,7 @@ vis="FFTrackerVis"> - + @@ -172,38 +170,50 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -232,7 +242,7 @@ - system:8,assembly:3,layer:4,module:4,sensor:4,x:32:-16,y:-16 + system:8,assembly:3,layer:4,module:8,sensor:8,x:32:-16,y:-16 diff --git a/compact/fields/beamline_10x100.xml b/compact/fields/beamline_10x100.xml index 8d9ce5c11..174e6cbea 100644 --- a/compact/fields/beamline_10x100.xml +++ b/compact/fields/beamline_10x100.xml @@ -54,4 +54,14 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + + + + + + diff --git a/compact/fields/beamline_10x110_H2.xml b/compact/fields/beamline_10x110_H2.xml index e1fbea347..47f6eee52 100644 --- a/compact/fields/beamline_10x110_H2.xml +++ b/compact/fields/beamline_10x110_H2.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_10x275.xml b/compact/fields/beamline_10x275.xml index a2d0e47f0..e8a790ecb 100644 --- a/compact/fields/beamline_10x275.xml +++ b/compact/fields/beamline_10x275.xml @@ -54,4 +54,14 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + + + + + + diff --git a/compact/fields/beamline_18x110_Au.xml b/compact/fields/beamline_18x110_Au.xml index 44725ebc8..78800577e 100644 --- a/compact/fields/beamline_18x110_Au.xml +++ b/compact/fields/beamline_18x110_Au.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_18x110_H2.xml b/compact/fields/beamline_18x110_H2.xml index 7ab918a99..23c5b4c90 100644 --- a/compact/fields/beamline_18x110_H2.xml +++ b/compact/fields/beamline_18x110_H2.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_18x110_He3.xml b/compact/fields/beamline_18x110_He3.xml index d1bf496f1..899b830eb 100644 --- a/compact/fields/beamline_18x110_He3.xml +++ b/compact/fields/beamline_18x110_He3.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_18x110_Pb.xml b/compact/fields/beamline_18x110_Pb.xml index 9801622be..eee1d8ea4 100644 --- a/compact/fields/beamline_18x110_Pb.xml +++ b/compact/fields/beamline_18x110_Pb.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_18x275.xml b/compact/fields/beamline_18x275.xml index 713ae0b2b..3e1f2c634 100644 --- a/compact/fields/beamline_18x275.xml +++ b/compact/fields/beamline_18x275.xml @@ -55,4 +55,15 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + + + + + + + diff --git a/compact/fields/beamline_5x100.xml b/compact/fields/beamline_5x100.xml index 9d8624b6e..0a35ef845 100644 --- a/compact/fields/beamline_5x100.xml +++ b/compact/fields/beamline_5x100.xml @@ -54,4 +54,14 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + + + + + + diff --git a/compact/fields/beamline_5x110_H2.xml b/compact/fields/beamline_5x110_H2.xml index 7a65b2ee3..7669f7f11 100644 --- a/compact/fields/beamline_5x110_H2.xml +++ b/compact/fields/beamline_5x110_H2.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_5x41.xml b/compact/fields/beamline_5x41.xml index ca787e71b..1b8a4f0d1 100644 --- a/compact/fields/beamline_5x41.xml +++ b/compact/fields/beamline_5x41.xml @@ -54,4 +54,14 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + + + + + + diff --git a/compact/fields/beamline_5x41_H2.xml b/compact/fields/beamline_5x41_H2.xml index 7a1f415cc..101fb0ac4 100644 --- a/compact/fields/beamline_5x41_H2.xml +++ b/compact/fields/beamline_5x41_H2.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_5x41_He3.xml b/compact/fields/beamline_5x41_He3.xml index d474b021f..b7ada8161 100644 --- a/compact/fields/beamline_5x41_He3.xml +++ b/compact/fields/beamline_5x41_He3.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/compact/fields/beamline_5x41_He4.xml b/compact/fields/beamline_5x41_He4.xml index 1a2561621..21e8abf83 100644 --- a/compact/fields/beamline_5x41_He4.xml +++ b/compact/fields/beamline_5x41_He4.xml @@ -55,4 +55,16 @@ + + These are the ten-sigma cuts for the Roman pots, translated to the physical layout we currently have. + They are not perfectly ten-sigma for reasons of physical geometry. + + Nuclei currently based on nearest per-nucleon proton energy (needs eventual update from machine). + + + + + + + diff --git a/configurations/inner_detector.yml b/configurations/inner_detector.yml index 597019b24..1f8281e04 100644 --- a/configurations/inner_detector.yml +++ b/configurations/inner_detector.yml @@ -15,6 +15,7 @@ features: tof_barrel: tof_endcap: ecal: + forward_homogeneous: bic_default: backward_PbWO4: pid: diff --git a/src/BeamPipeChain_geo.cpp b/src/BeamPipeChain_geo.cpp index 8da51d510..706c7e810 100644 --- a/src/BeamPipeChain_geo.cpp +++ b/src/BeamPipeChain_geo.cpp @@ -31,6 +31,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / double thickness = getAttrOrDefault(x_det, _Unicode(wall_thickness), 0); vector names; + vector ids; vector xCenters; vector zCenters; vector lengths; @@ -44,6 +45,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / xml_comp_t pipe(pipe_coll); names.push_back(getAttrOrDefault(pipe, _Unicode(name), "")); + ids.push_back(getAttrOrDefault(pipe, _Unicode(id), 0)); // Vectors momentarily filled with zeros for pipes in between magnets xCenters.push_back(getAttrOrDefault(pipe, _Unicode(xcenter), 0)); @@ -108,8 +110,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / assembly.placeVolume(v_tube, Transform3D(RotationY(thetas[pipeN]), Position(xCenters[pipeN], 0, zCenters[pipeN]))); - assembly.placeVolume(v_vacuum, Transform3D(RotationY(thetas[pipeN]), - Position(xCenters[pipeN], 0, zCenters[pipeN]))); + auto placed_vacuum = + assembly.placeVolume(v_vacuum, Transform3D(RotationY(thetas[pipeN]), + Position(xCenters[pipeN], 0, zCenters[pipeN]))); + + DetElement vacuum_element(sdet, names[pipeN] + "_vacuum", ids[pipeN]); + vacuum_element.setPlacement(placed_vacuum); } // Final placement diff --git a/src/BeamPipeStop_geo.cpp b/src/BeamPipeStop_geo.cpp new file mode 100644 index 000000000..5b42e33d9 --- /dev/null +++ b/src/BeamPipeStop_geo.cpp @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Simon Gardner + +//========================================================================== +// +// Places a small sensitive disk of vacuum at the end of beam pipes +// +//========================================================================== + +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" +#include "TMath.h" +#include + +using namespace std; +using namespace dd4hep; + +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector /* sens */) { + + using namespace ROOT::Math; + xml_det_t x_det = e; + string det_name = x_det.nameStr(); + int det_id = x_det.id(); + Material m_Vacuum = description.material("Vacuum"); + string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BeamPipeVis"); + + string grandmotherName = x_det.attr(_Unicode(grandmother)); + string motherName = x_det.attr(_Unicode(mother)); + bool detStart = getAttrOrDefault(x_det, _Unicode(end), true); + DetElement mother = description.detector(grandmotherName).child(motherName); + + DetElement sdet(det_name, det_id); + + // Get the mother volume + Volume mother_vol = mother.volume(); + + // Get mother volume shape as cone segment + ConeSegment mother_shape = mother_vol.solid(); + + // Get the parameters of the mother volume + double rOuter1 = mother_shape.rMax1(); + double rOuter2 = mother_shape.rMax2(); + double length = 2 * mother_shape.dZ(); + + double sensitive_thickness = 100 * mm; + + //Calculate R or cone after sensitive layer + double rEnd = rOuter2 - (rOuter2 - rOuter1) * sensitive_thickness / length; + double zPos = length / 2.0 - sensitive_thickness / 2.0; + if (detStart) { + rEnd = rOuter1 - (rOuter1 - rOuter2) * sensitive_thickness / length; + zPos = -length / 2.0 + sensitive_thickness / 2.0; + } + + ConeSegment s_start_disk(sensitive_thickness / 2, 0.0, rOuter2, 0.0, rEnd); + Volume v_start_disk("stop_disk_" + motherName, s_start_disk, m_Vacuum); + + v_start_disk.setLimitSet(description, "kill_limits"); + + auto disk_placement = mother_vol.placeVolume(v_start_disk, Position(0.0, 0.0, zPos)); + + sdet.setPlacement(disk_placement); + description.declareParent(det_name, mother); + + return sdet; +} + +DECLARE_DETELEMENT(BeamPipeStop, create_detector) diff --git a/src/BeamPipeTracking_geo.cpp b/src/BeamPipeTracking_geo.cpp new file mode 100644 index 000000000..d8f4d2953 --- /dev/null +++ b/src/BeamPipeTracking_geo.cpp @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2024 Simon Gardner + +//========================================================================== +// +// Places a small sensitive disk of vacuum at the end of beam pipes +// +//========================================================================== + +#include "DD4hep/DetFactoryHelper.h" +#include "DD4hep/Printout.h" +#include "TMath.h" +#include + +using namespace std; +using namespace dd4hep; + +static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector sens) { + + using namespace ROOT::Math; + xml_det_t x_det = e; + string det_name = x_det.nameStr(); + int det_id = x_det.id(); + Material m_Vacuum = description.material("Vacuum"); + string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BeamPipeVis"); + + sens.setType("tracker"); + + DetElement sdet(det_name, det_id); + Assembly assembly(det_name + "_assembly"); + + // Grab info for beamline magnets + for (xml_coll_t slice_coll(x_det, _Unicode(slice)); slice_coll; slice_coll++) { // pipes + + string grandmotherName = slice_coll.attr(_Unicode(grandmother)); + string motherName = slice_coll.attr(_Unicode(mother)); + bool detStart = getAttrOrDefault(slice_coll, _Unicode(end), true); + int pipe_id = getAttrOrDefault(slice_coll, _Unicode(pipe_id), 0); + string slice_name = slice_coll.attr(_Unicode(name)); + DetElement mother = description.detector(grandmotherName).child(motherName); + + // Get the mother volume + Volume mother_vol = mother.volume(); + + // Get mother volume shape as cone segment + ConeSegment mother_shape = mother_vol.solid(); + + // Get the parameters of the mother volume + double rOuter1 = mother_shape.rMax1(); + double rOuter2 = mother_shape.rMax2(); + double length = 2 * mother_shape.dZ(); + + double sensitive_thickness = 0.1 * mm; + + //Calculate R or cone after sensitive layer + + double rEnd = rOuter2 - (rOuter2 - rOuter1) * sensitive_thickness / length; + double zPos = length / 2.0 - sensitive_thickness / 2.0; + if (detStart) { + rEnd = rOuter1 - (rOuter1 - rOuter2) * sensitive_thickness / length; + zPos = -length / 2.0 + sensitive_thickness / 2.0; + } + + ConeSegment s_start_disk(sensitive_thickness / 2, 0.0, rOuter2, 0.0, rEnd); + Volume v_start_disk("v_start_disk_" + motherName, s_start_disk, m_Vacuum); + v_start_disk.setSensitiveDetector(sens); + + auto disk_placement = mother_vol.placeVolume(v_start_disk, Position(0.0, 0.0, zPos)); + disk_placement.addPhysVolID("end", detStart); + disk_placement.addPhysVolID("pipe", pipe_id); + disk_placement.addPhysVolID("system", det_id); + + DetElement slice_element(sdet, slice_name, pipe_id); + + slice_element.setPlacement(disk_placement); + description.declareParent(slice_name, mother); + } + + auto pv_assembly = description.worldVolume().placeVolume(assembly, Position(0.0, 0.0, 0.0)); + pv_assembly.addPhysVolID("system", det_id); + sdet.setPlacement(pv_assembly); + + return sdet; +} + +DECLARE_DETELEMENT(BeamPipeTracking, create_detector) diff --git a/src/ForwardRomanPot_geo.cpp b/src/ForwardRomanPot_geo.cpp index f3e9e2b50..052178b3d 100644 --- a/src/ForwardRomanPot_geo.cpp +++ b/src/ForwardRomanPot_geo.cpp @@ -32,8 +32,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s for (xml_coll_t mi(x_det, _U(module)); mi; ++mi, ++m_id) { xml_comp_t x_mod = mi; string m_nam = x_mod.nameStr(); - double mod_width = getAttrOrDefault(x_mod, _U(width), 3.2 * cm); - double mod_height = getAttrOrDefault(x_mod, _U(height), 3.2 * cm); + double mod_width = getAttrOrDefault(x_mod, _U(width), 1.6 * cm); + double mod_height = getAttrOrDefault(x_mod, _U(height), 1.6 * cm); double mod_total_thickness = 0.; xml_coll_t ci(x_mod, _U(module_component)); @@ -42,9 +42,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s Box m_solid(mod_width / 2.0, mod_height / 2.0, mod_total_thickness / 2.0); Volume m_volume(m_nam, m_solid, vacuum); - //set to AnlGold temporarily for future RP troubleshooting - //m_volume.setVisAttributes(description.visAttributes(x_mod.visStr())); - m_volume.setVisAttributes(description.visAttributes("AnlGold")); + m_volume.setVisAttributes(description.visAttributes(x_mod.visStr())); double comp_z_pos = -mod_total_thickness / 2.0; int n_sensor = 1; @@ -99,8 +97,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s double nx = getAttrOrDefault(x_array, _Unicode(nx), 1); double ny = getAttrOrDefault(x_array, _Unicode(ny), 1); double dz = getAttrOrDefault(x_array, _Unicode(dz), 0 * mm); - double arr_width = getAttrOrDefault(x_array, _Unicode(width), 3.2 * cm); - double arr_height = getAttrOrDefault(x_array, _Unicode(height), 3.2 * cm); + double arr_width = getAttrOrDefault(x_array, _Unicode(width), 1.6 * cm); + double arr_height = getAttrOrDefault(x_array, _Unicode(height), 1.6 * cm); std::string arr_module = getAttrOrDefault(x_array, _Unicode(module), ""); // TODO: add check here auto arr_vol = modules[arr_module]; @@ -120,6 +118,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s if (x_pos) { arr_pos += Position(x_pos.x(0), x_pos.y(0), x_pos.z(0)); } + DetElement mod_de(ma_de, ma_name + std::string("_mod") + std::to_string(i_mod), i_mod); pv = ma_vol.placeVolume(arr_vol, arr_pos); pv.addPhysVolID("module", i_mod); @@ -128,12 +127,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s PlacedVolume sens_pv = sensVols[ic]; DetElement comp_de(mod_de, std::string("de_") + sens_pv.volume().name(), ic + 1); comp_de.setPlacement(sens_pv); - // Acts::ActsExtension* sensorExtension = new Acts::ActsExtension(); - //// sensorExtension->addType("sensor", "detector"); - // comp_de.addExtension(sensorExtension); - //// comp_de.setAttributes(description, sens_pv.volume(), - /// x_layer.regionStr(), / x_layer.limitsStr(), / - /// xml_det_t(xmleles[m_nam]).visStr()); } } } @@ -159,11 +152,9 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s xml_comp_t x_comp = ci; xml_comp_t c_pos = x_comp.position(false); - // string ma_name = x_comp.nameStr(); string comp_assembly = getAttrOrDefault(x_comp, _Unicode(assembly), ""); auto comp_vol = module_assemblies[comp_assembly]; - // auto de = ; auto comp_de = module_assembly_delements[comp_assembly].clone(comp_assembly + std::to_string(l_num)); if (c_pos) { @@ -175,25 +166,13 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s comp_de.setPlacement(pv); layer.add(comp_de); i_assembly++; - // DetElement det = module > 1 ? stave.clone(_toString(module,"stave%d")) - // : stave; Transform3D trafo(RotationZYX(0, rotY, rotX), - // Translation3D(-posX, -posY, 0)); PlacedVolume pv = - // envelopeVolume.placeVolume(sectVolume,trafo); - //// Not a valid volID: pv.addPhysVolID("stave", 0); - // pv.addPhysVolID("module", module); - // det.setPlacement(pv); - // parent.add(det); } pv = assembly.placeVolume(l_vol, l_pos); pv.addPhysVolID("layer", l_num); } - // pv = description.pickMotherVolume(sdet).placeVolume(assembly, - // Position(pos.x(), pos.y(), pos.z())); Transform3D posAndRot(RotationZYX(rot.z(), rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z())); - // pv = description.pickMotherVolume(sdet).placeVolume(assembly, - // Position(pos.x(), pos.y(), pos.z())); pv = description.pickMotherVolume(sdet).placeVolume(assembly, posAndRot); pv.addPhysVolID("system", x_det.id()); // Set the subdetector system ID. sdet.setPlacement(pv); diff --git a/templates/epic.xml.jinja2 b/templates/epic.xml.jinja2 index 0472526f2..c3729f8f5 100644 --- a/templates/epic.xml.jinja2 +++ b/templates/epic.xml.jinja2 @@ -71,6 +71,9 @@ + + +