diff --git a/compact/far_backward/beamline_extension_electron.xml b/compact/far_backward/beamline_extension_electron.xml index e1346df240..e70fa8574f 100644 --- a/compact/far_backward/beamline_extension_electron.xml +++ b/compact/far_backward/beamline_extension_electron.xml @@ -17,7 +17,7 @@ type="BeamPipeChain" wall_thickness="2*mm"> @@ -65,7 +65,7 @@ + vis="FFMagnetVis"> diff --git a/compact/far_backward/beamline_extension_hadron.xml b/compact/far_backward/beamline_extension_hadron.xml index 4727479a50..770524e14e 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 - + diff --git a/compact/far_backward/definitions.xml b/compact/far_backward/definitions.xml index c85aadb6d3..aea6197ed5 100644 --- a/compact/far_backward/definitions.xml +++ b/compact/far_backward/definitions.xml @@ -16,19 +16,21 @@ - + - + - + - + + + @@ -36,9 +38,9 @@ - + + - Note: Placements for Q4eR, B3eR, B4eR, B5eR, B6eR, B7eR are approximate (valid to within ~1 cm). @@ -174,7 +176,7 @@ - + diff --git a/compact/far_backward/magnets.xml b/compact/far_backward/magnets.xml index f4bc82bd45..7ef57011dd 100644 --- a/compact/far_backward/magnets.xml +++ b/compact/far_backward/magnets.xml @@ -14,31 +14,31 @@ wall_thickness="2*mm" vis="BeamPipeVis"> @@ -46,28 +46,28 @@ Electron side beam magnet volumes - + - + - + - + @@ -76,9 +76,9 @@ + vis="FFMagnetVis"> @@ -91,21 +91,21 @@ - + - + - + @@ -113,13 +113,13 @@ - + - + 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/beampipe_hadron_B0.xml b/compact/far_forward/beampipe_hadron_B0.xml index f23e72b590..7f3722c16a 100644 --- a/compact/far_forward/beampipe_hadron_B0.xml +++ b/compact/far_forward/beampipe_hadron_B0.xml @@ -11,13 +11,13 @@ - + - + diff --git a/compact/far_forward/definitions.xml b/compact/far_forward/definitions.xml index 1ad75fef5c..47cfb00b7d 100644 --- a/compact/far_forward/definitions.xml +++ b/compact/far_forward/definitions.xml @@ -66,31 +66,31 @@ - - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + 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/far_forward/ion_beamline.xml b/compact/far_forward/ion_beamline.xml index 17e27815c1..66148a43a9 100644 --- a/compact/far_forward/ion_beamline.xml +++ b/compact/far_forward/ion_beamline.xml @@ -22,49 +22,49 @@ - + - + - + - + - + - + - + - + diff --git a/compact/far_forward/magnets.xml b/compact/far_forward/magnets.xml index 048cc584ad..ec04713d20 100644 --- a/compact/far_forward/magnets.xml +++ b/compact/far_forward/magnets.xml @@ -4,56 +4,56 @@ - + - + - + - + - + - + - + - + diff --git a/compact/far_forward/offM_tracker.xml b/compact/far_forward/offM_tracker.xml index b3ba6d2f3f..4b6745cc61 100644 --- a/compact/far_forward/offM_tracker.xml +++ b/compact/far_forward/offM_tracker.xml @@ -8,8 +8,8 @@ Forward Off-Momentum Tracker Parameters ---------------------------------------- - - + + diff --git a/compact/far_forward/romanpots.xml b/compact/far_forward/romanpots.xml index f6e75532a3..a77050231e 100644 --- a/compact/far_forward/romanpots.xml +++ b/compact/far_forward/romanpots.xml @@ -8,10 +8,10 @@ Far Forward B0 Tracker Parameters --------------------------------- - - - - + + + + diff --git a/compact/far_forward/vacuum.xml b/compact/far_forward/vacuum.xml index ad5c8acab7..74c357f1db 100644 --- a/compact/far_forward/vacuum.xml +++ b/compact/far_forward/vacuum.xml @@ -12,49 +12,49 @@ - + - + - + - + - + - + - + - + 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/CylindricalMagnetChain_geo.cpp b/src/CylindricalMagnetChain_geo.cpp index 607a575f96..b8f678b5d8 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,11 @@ 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.setAttributes(description, x_det.regionStr(), x_det.limitsStr(), vis_name); - 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); } // 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. - +