diff --git a/compact/far_backward/beamline_extension_electron.xml b/compact/far_backward/beamline_extension_electron.xml index e1346df240..34a1f5476d 100644 --- a/compact/far_backward/beamline_extension_electron.xml +++ b/compact/far_backward/beamline_extension_electron.xml @@ -11,52 +11,93 @@ Electron side extended beam pipe volumes - + - + + + - - + + + + + rout1="Q4eR_InnerRadius" rout2="Q4eR_InnerRadius"> + + + + + + - - + - - + + + + + + + + + + + - - + + - - + + - - + + @@ -65,31 +106,56 @@ - + + + - + + + + - + + + - + - + - + + + + + + diff --git a/compact/far_backward/beamline_extension_hadron.xml b/compact/far_backward/beamline_extension_hadron.xml index 4727479a50..265aec86c7 100644 --- a/compact/far_backward/beamline_extension_hadron.xml +++ b/compact/far_backward/beamline_extension_hadron.xml @@ -13,7 +13,7 @@ Hadron side beam magnet volumes - + @@ -58,8 +58,8 @@ type="BeamPipeChain" wall_thickness="2*mm"> @@ -62,8 +62,8 @@ diff --git a/compact/far_backward/definitions.xml b/compact/far_backward/definitions.xml index c85aadb6d3..23ed2fe30d 100644 --- a/compact/far_backward/definitions.xml +++ b/compact/far_backward/definitions.xml @@ -14,78 +14,126 @@ Electron magnet dimensions and positions - - + + - + - + - - - - - + + + + + + + + + + + + + + + + + Electron Beamline Extension + + + - - - - - - - - - Note: Placements for Q4eR, B3eR, B4eR, B5eR, B6eR, B7eR - are approximate (valid to within ~1 cm). - Should be updated with detailed input from the accelerator group - - - - + + + + + + + + + + + + + - + - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hadron magnet dimensions and positions @@ -175,7 +223,7 @@ - + @@ -184,18 +232,18 @@ Dipole focal point in global coordinates - + Central pipe dimensions - - - - + + + + Entry box joining magnets, lumi and tagger systems - + Timepix4 ASIC dimensions @@ -209,9 +257,9 @@ - - - + + + @@ -220,9 +268,9 @@ - + - + @@ -231,7 +279,7 @@ - + @@ -240,7 +288,7 @@ - + diff --git a/compact/far_backward/magnets.xml b/compact/far_backward/magnets.xml index f4bc82bd45..ab1451c23f 100644 --- a/compact/far_backward/magnets.xml +++ b/compact/far_backward/magnets.xml @@ -37,8 +37,8 @@ @@ -59,28 +59,25 @@ - - - - - - - - + - - - + + + + + + + + + + + + @@ -105,7 +102,7 @@ - + @@ -119,7 +116,8 @@ - + + diff --git a/compact/far_backward/taggers.xml b/compact/far_backward/taggers.xml index 7c16fa727e..429dbff786 100644 --- a/compact/far_backward/taggers.xml +++ b/compact/far_backward/taggers.xml @@ -17,6 +17,7 @@ diff --git a/compact/far_forward/electron_beamline.xml b/compact/far_forward/electron_beamline.xml index 6dbac133dc..2a835e43d4 100644 --- a/compact/far_forward/electron_beamline.xml +++ b/compact/far_forward/electron_beamline.xml @@ -56,7 +56,7 @@ - + @@ -72,7 +72,7 @@ - + diff --git a/compact/fields/beamline_10x100.xml b/compact/fields/beamline_10x100.xml index 174e6cbeac..5595738402 100644 --- a/compact/fields/beamline_10x100.xml +++ b/compact/fields/beamline_10x100.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_10x100_Au197.xml b/compact/fields/beamline_10x100_Au197.xml index 2bc72f37d8..05b0f6fe75 100644 --- a/compact/fields/beamline_10x100_Au197.xml +++ b/compact/fields/beamline_10x100_Au197.xml @@ -16,14 +16,19 @@ - - - + + + + + + - - + + + + - + diff --git a/compact/fields/beamline_10x110_H2.xml b/compact/fields/beamline_10x110_H2.xml index 47f6eee522..14da3d1f3e 100644 --- a/compact/fields/beamline_10x110_H2.xml +++ b/compact/fields/beamline_10x110_H2.xml @@ -14,14 +14,18 @@ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_10x115_Cu63.xml b/compact/fields/beamline_10x115_Cu63.xml index a142fed400..53ece55e73 100644 --- a/compact/fields/beamline_10x115_Cu63.xml +++ b/compact/fields/beamline_10x115_Cu63.xml @@ -16,12 +16,17 @@ - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_10x115_Ru96.xml b/compact/fields/beamline_10x115_Ru96.xml index a142fed400..53ece55e73 100644 --- a/compact/fields/beamline_10x115_Ru96.xml +++ b/compact/fields/beamline_10x115_Ru96.xml @@ -16,12 +16,17 @@ - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_10x130.xml b/compact/fields/beamline_10x130.xml index fd0e7df86f..43a452dc8d 100644 --- a/compact/fields/beamline_10x130.xml +++ b/compact/fields/beamline_10x130.xml @@ -16,12 +16,17 @@ - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_10x130_H2.xml b/compact/fields/beamline_10x130_H2.xml index 7f84e076e1..b976009613 100644 --- a/compact/fields/beamline_10x130_H2.xml +++ b/compact/fields/beamline_10x130_H2.xml @@ -16,12 +16,17 @@ - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_10x166_He3.xml b/compact/fields/beamline_10x166_He3.xml index 33b21fc60c..3cf217f5bb 100644 --- a/compact/fields/beamline_10x166_He3.xml +++ b/compact/fields/beamline_10x166_He3.xml @@ -16,12 +16,17 @@ - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_10x250.xml b/compact/fields/beamline_10x250.xml index 5375f076da..1992d409cd 100644 --- a/compact/fields/beamline_10x250.xml +++ b/compact/fields/beamline_10x250.xml @@ -16,12 +16,17 @@ - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_10x275.xml b/compact/fields/beamline_10x275.xml index e8a790ecbf..7cca64be79 100644 --- a/compact/fields/beamline_10x275.xml +++ b/compact/fields/beamline_10x275.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_18x110_Au.xml b/compact/fields/beamline_18x110_Au.xml index 78800577e8..efbb80d563 100644 --- a/compact/fields/beamline_18x110_Au.xml +++ b/compact/fields/beamline_18x110_Au.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_18x110_H2.xml b/compact/fields/beamline_18x110_H2.xml index 23c5b4c90c..3bf2825aae 100644 --- a/compact/fields/beamline_18x110_H2.xml +++ b/compact/fields/beamline_18x110_H2.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_18x110_He3.xml b/compact/fields/beamline_18x110_He3.xml index 899b830eb3..781ed0a469 100644 --- a/compact/fields/beamline_18x110_He3.xml +++ b/compact/fields/beamline_18x110_He3.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_18x110_Pb.xml b/compact/fields/beamline_18x110_Pb.xml index eee1d8ea46..cd8dedaf2b 100644 --- a/compact/fields/beamline_18x110_Pb.xml +++ b/compact/fields/beamline_18x110_Pb.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_18x275.xml b/compact/fields/beamline_18x275.xml index 3e1f2c6347..8429ff91a1 100644 --- a/compact/fields/beamline_18x275.xml +++ b/compact/fields/beamline_18x275.xml @@ -10,24 +10,28 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - + - - - - - - + + + + + + + + + + + - Forward Fields All magnet values are input by hand and represent the implementation in EICRoot used for the Yellow Report. diff --git a/compact/fields/beamline_5x100.xml b/compact/fields/beamline_5x100.xml index 0a35ef845b..fa93caf323 100644 --- a/compact/fields/beamline_5x100.xml +++ b/compact/fields/beamline_5x100.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_5x110_H2.xml b/compact/fields/beamline_5x110_H2.xml index 7669f7f119..f6a794e5a3 100644 --- a/compact/fields/beamline_5x110_H2.xml +++ b/compact/fields/beamline_5x110_H2.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_5x41.xml b/compact/fields/beamline_5x41.xml index 1b8a4f0d1b..56f4692551 100644 --- a/compact/fields/beamline_5x41.xml +++ b/compact/fields/beamline_5x41.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - + + + + + + - - + + + + diff --git a/compact/fields/beamline_5x41_H2.xml b/compact/fields/beamline_5x41_H2.xml index 101fb0ac42..cf390e75d2 100644 --- a/compact/fields/beamline_5x41_H2.xml +++ b/compact/fields/beamline_5x41_H2.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_5x41_He3.xml b/compact/fields/beamline_5x41_He3.xml index b7ada81616..88bfdb23f0 100644 --- a/compact/fields/beamline_5x41_He3.xml +++ b/compact/fields/beamline_5x41_He3.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/compact/fields/beamline_5x41_He4.xml b/compact/fields/beamline_5x41_He4.xml index 21e8abf834..fc17e01655 100644 --- a/compact/fields/beamline_5x41_He4.xml +++ b/compact/fields/beamline_5x41_He4.xml @@ -10,18 +10,22 @@ Backwards Fields - Values taken from: https://indico.bnl.gov/event/10974/contributions/51260/ + Values taken from: https://brookhavenlab.sharepoint.com/:f:/r/sites/eRHIC/bnl%26slac/Shared%20Documents/Version-6.3/ Relevent values in the tables scale linearly with beam energy - - - - - - - + + + + + + + + + + + diff --git a/src/BackwardsTaggers_geo.cpp b/src/BackwardsTaggers_geo.cpp index befa6b03e1..ff39e3d50f 100644 --- a/src/BackwardsTaggers_geo.cpp +++ b/src/BackwardsTaggers_geo.cpp @@ -48,7 +48,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) { double off = pos.z(); // Beamline rotation - xml_dim_t rot = x_det.rotation(); + double out_theta = x_det.rotation().theta(); // Beampipe thickness double wall = dd4hep::getAttrOrDefault(x_det, _Unicode(wall), 1 * mm); @@ -61,6 +61,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) { double BB_MaxX = BB.xmax(); double BB_MaxY = BB.ymax(); double BB_MaxZ = BB.zmax(); + double in_theta = BB.theta(); double BB_X = abs(BB_MaxX - BB_MinX); double BB_Y = abs(BB_MaxY - BB_MinY); @@ -76,7 +77,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) { double Lumi_R = EB.attr(_Unicode(lumiR)); // Maximum theta to exit the dipole from - double exitTheta = EB.attr(_Unicode(maxTheta)); + double maxTheta = EB.attr(_Unicode(maxTheta)); // Generic box for making intersection solid with double xbox = 10 * m; @@ -117,9 +118,9 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) { // Theta coverage expected double thetamin = - dd4hep::getAttrOrDefault(mod, _Unicode(theta_min), 0.030 * rad) - rot.theta(); + dd4hep::getAttrOrDefault(mod, _Unicode(theta_min), 0.030 * rad) - out_theta; double thetamax = - dd4hep::getAttrOrDefault(mod, _Unicode(theta_max), 0.030 * rad) - rot.theta(); + dd4hep::getAttrOrDefault(mod, _Unicode(theta_max), 0.030 * rad) - out_theta; // Align box to max or minimum theta expected at the tagger from focal point bool max_align = dd4hep::getAttrOrDefault(mod, _Unicode(max_align), false); @@ -223,33 +224,32 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) { // CutTube Lumi_Exit (0, Lumi_R, ED_Z, 0,2*pi, sin(angle),0,cos(angle), 0,0,1); // Add entry boxes to main beamline volume - Wall_Box = UnionSolid(Wall_Box, Entry_Beam_Box, Transform3D(RotationY(-rot.theta()))); - Vacuum_Box = UnionSolid(Vacuum_Box, Entry_Vacuum_Box, Transform3D(RotationY(-rot.theta()))); - Vacuum_Box = UnionSolid(Vacuum_Box, Lumi_Exit, Transform3D(RotationY(-rot.theta()))); + Wall_Box = UnionSolid(Wall_Box, Entry_Beam_Box, Transform3D(RotationY(-out_theta))); + Vacuum_Box = UnionSolid(Vacuum_Box, Entry_Vacuum_Box, Transform3D(RotationY(-out_theta))); + Vacuum_Box = UnionSolid(Vacuum_Box, Lumi_Exit, Transform3D(RotationY(-out_theta))); } //----------------------------------------------------------------- - // Restrict tagger boxes into region defined by exitTheta from the dipole magnet + // Restrict tagger boxes into region defined by maxTheta from the dipole magnet //----------------------------------------------------------------- double exitDist = BB_MinZ - off; - double cutX = (ED_X - exitDist * tan(-rot.theta())) * cos(rot.theta()); - double cutZ = - (ED_X - exitDist * tan(-rot.theta())) * sin(rot.theta()) + exitDist * cos(rot.theta()); - double cutXwall = (ED_X - wall - exitDist * tan(-rot.theta())) * cos(rot.theta()); + double cutX = (ED_X - exitDist * tan(-out_theta)) * cos(out_theta); + double cutZ = (ED_X - exitDist * tan(-out_theta)) * sin(out_theta) + exitDist * cos(out_theta); + double cutXwall = (ED_X - wall - exitDist * tan(-out_theta)) * cos(out_theta); double cutZwall = - (ED_X - wall - exitDist * tan(-rot.theta())) * sin(rot.theta()) + exitDist * cos(rot.theta()); + (ED_X - wall - exitDist * tan(-out_theta)) * sin(out_theta) + exitDist * cos(out_theta); Wall_Box = IntersectionSolid(Wall_Box, Cut_Box, - Transform3D(RotationY(exitTheta), Position(xbox - cutX, 0, cutZ))); + Transform3D(RotationY(maxTheta), Position(xbox - cutX, 0, cutZ))); Vacuum_Box = IntersectionSolid(Vacuum_Box, Cut_Box, - Transform3D(RotationY(exitTheta), Position(xbox - cutXwall, 0, cutZwall))); + Transform3D(RotationY(maxTheta), Position(xbox - cutXwall, 0, cutZwall))); //----------------------------------------------------------------- // Cut solids so they are only in the far backwards box //----------------------------------------------------------------- - RotationY rotate2(-rot.theta()); - Position position(0, 0, (exitDist - BB_Z) / cos(rot.theta())); + RotationY rotate2(in_theta - out_theta); + Position position(0, 0, (exitDist - BB_Z) / cos(out_theta - in_theta)); IntersectionSolid Wall_Box_Sub(Wall_Box, Far_Backwards_Box, Transform3D(rotate2, position)); IntersectionSolid Vacuum_Box_Sub(Vacuum_Box, Far_Backwards_Box, Transform3D(rotate2, position)); @@ -271,7 +271,7 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) { backAssembly.placeVolume(DetAssemblyAir); // placement in mother volume - Transform3D tr(RotationY(rot.theta()), Position(pos.x(), pos.y(), pos.z())); + Transform3D tr(RotationY(out_theta), Position(pos.x(), pos.y(), pos.z())); PlacedVolume detPV = desc.pickMotherVolume(det).placeVolume(backAssembly, tr); detPV.addPhysVolID("system", detID); diff --git a/src/BeamPipeChain_geo.cpp b/src/BeamPipeChain_geo.cpp index 2b5f8a3699..be29a8ecb2 100644 --- a/src/BeamPipeChain_geo.cpp +++ b/src/BeamPipeChain_geo.cpp @@ -94,12 +94,13 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / // If there is an bend in the pipe, calculate the length reduction of the pipe and joint length for (uint i = 1; i < thetas.size(); i++) { + // Start at the join between the first two pipes ending at the join between the last two pipes N-1 - if (thetas[i - 1] == thetas[i]) { + double bendAngle = thetas[i] - thetas[i - 1]; + if (std::abs(bendAngle) < 0.00001) { bendLengths.push_back(0); } else // Correct for tubes, not yet cones so imperfect { - double bendAngle = thetas[i] - thetas[i - 1]; double bendLength = abs(rOuters1[i] * tan(bendAngle / 2)); bendLengths.push_back(bendLength + bendRadius); } diff --git a/src/CylindricalMagnetChain_geo.cpp b/src/CylindricalMagnetChain_geo.cpp index 607a575f96..b12497ecac 100644 --- a/src/CylindricalMagnetChain_geo.cpp +++ b/src/CylindricalMagnetChain_geo.cpp @@ -33,6 +33,7 @@ static Ref_t create_magnet(Detector& description, xml_h e, SensitiveDetector /* xml_comp_t magnet(magnet_coll); string name = getAttrOrDefault(magnet, _Unicode(name), ""); + int id = getAttrOrDefault(magnet, _Unicode(id), 0); double x = getAttrOrDefault(magnet, _Unicode(x), 0); double y = getAttrOrDefault(magnet, _Unicode(y), 0); double z = getAttrOrDefault(magnet, _Unicode(z), 0); @@ -45,9 +46,14 @@ static Ref_t create_magnet(Detector& description, xml_h e, SensitiveDetector /* Tube yoke_tube(rin, rout, 0.5 * length); Volume v_yoke("v_yoke_" + name, yoke_tube, m_Iron); - v_yoke.setVisAttributes(description.visAttributes(vis_name)); + v_yoke.setVisAttributes(x_det.visStr()); - assembly.placeVolume(v_yoke, Transform3D(RotationY(theta), Position(x, y, z))); + auto yoke_pv = assembly.placeVolume(v_yoke, Transform3D(RotationY(theta), Position(x, y, z))); + + yoke_pv.addPhysVolID("element", id); + DetElement yoke_de(sdet, name, id); + yoke_de.setPlacement(yoke_pv); + yoke_de.setAttributes(description, v_yoke, x_det.regionStr(), x_det.limitsStr(), vis_name); } // Final placement diff --git a/templates/epic.xml.jinja2 b/templates/epic.xml.jinja2 index 687347a0e4..1253a6f3b5 100644 --- a/templates/epic.xml.jinja2 +++ b/templates/epic.xml.jinja2 @@ -44,10 +44,10 @@ The ip6 (or other ip) defines should be included first. These files have only a define tags. - +