From 41ca68bdc0575aae4a3b1a060b934f09bab9b642 Mon Sep 17 00:00:00 2001 From: "jihee.kim" <jihee.kim@anl.gov> Date: Fri, 26 Mar 2021 17:11:30 -0500 Subject: [PATCH] Added position and rotation of volume --- compact/definitions.xml | 2 ++ compact/ffi_ZDC.xml | 4 ++-- src/ffi_ZDC.cpp | 10 +--------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/compact/definitions.xml b/compact/definitions.xml index 9a743bf..c03029a 100644 --- a/compact/definitions.xml +++ b/compact/definitions.xml @@ -425,6 +425,7 @@ </comment> <comment> BeamLines: IP6 </comment> <constant name="ffi_ZDC_x_pos" value="90.0 * cm"/> + <constant name="ffi_ZDC_y_pos" value="0.0 * cm"/> <constant name="ffi_ZDC_z_pos" value="3800.0 * cm"/> <constant name="ffi_ZDC_rotateX_angle" value="0.0 * rad"/> <constant name="ffi_ZDC_rotateY_angle" value="-0.0125 * rad"/> @@ -432,6 +433,7 @@ <comment> BeamLines: IP8 </comment> <!--<constant name="ffi_ZDC_x_pos" value="127.0 * cm"/> + <constant name="ffi_ZDC_y_pos" value="0.0 * cm"/> <constant name="ffi_ZDC_z_pos" value="3600.0 * cm"/> <constant name="ffi_ZDC_rotateX_angle" value="0.0 * rad"/> <constant name="ffi_ZDC_rotateY_angle" value="-0.025 * rad"/> diff --git a/compact/ffi_ZDC.xml b/compact/ffi_ZDC.xml index 2594f5f..d0992df 100644 --- a/compact/ffi_ZDC.xml +++ b/compact/ffi_ZDC.xml @@ -16,7 +16,7 @@ <detectors> <detector id="ffi_ZDC_ID" name="ffi_ZDC" type="ffi_ZDC" readout="ffi_ZDC_Hits" vis="ffi_ZDCVis"> - <position x="ffi_ZDC_x_pos" z="ffi_ZDC_z_pos"/> + <position x="ffi_ZDC_x_pos" y="ffi_ZDC_y_pos" z="ffi_ZDC_z_pos"/> <rotation x="ffi_ZDC_rotateX_angle" y="ffi_ZDC_rotateY_angle" z="ffi_ZDC_rotateZ_angle"/> <dimensions x="ffi_ZDC_width" z="ffi_ZDC_thickness"/> </detector> @@ -25,7 +25,7 @@ <readouts> <readout name="ffi_ZDC_Hits"> <segmentation type="CartesianGridXY" grid_size_x="1.0*mm" grid_size_y="1.0*mm" /> - <id>system:8,module:12,x:48:-8,y:-8</id> + <id>system:8,module:12,x:32:-16,y:-16</id> </readout> </readouts> diff --git a/src/ffi_ZDC.cpp b/src/ffi_ZDC.cpp index 27b3f42..82ce448 100644 --- a/src/ffi_ZDC.cpp +++ b/src/ffi_ZDC.cpp @@ -17,18 +17,10 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) double Thickness = dim.z(); xml_dim_t pos = x_det.position(); - double x_pos = dd4hep::getAttrOrDefault(pos, _Unicode(x),0.0); - double z_pos = dd4hep::getAttrOrDefault(pos, _Unicode(z),0.0); - xml_dim_t rot = x_det.rotation(); - double x_rot = dd4hep::getAttrOrDefault(rot, _Unicode(x),0.0); - double y_rot = dd4hep::getAttrOrDefault(rot, _Unicode(y),0.0); - double z_rot = dd4hep::getAttrOrDefault(rot, _Unicode(z),0.0); Material Vacuum = desc.material("Vacuum"); - std::cout << "positions: " << x_pos << " , " << z_pos << std::endl; - // Create Global Volume Box ffi_ZDC_GVol_Solid(Width * 0.5, Width * 0.5, Thickness * 0.5); Volume detVol("ffi_ZDC_GVol_Logic", ffi_ZDC_GVol_Solid, Vacuum); @@ -37,7 +29,7 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) DetElement det(detName, detID); Volume motherVol = desc.pickMotherVolume(det); - Transform3D tr(RotationZYX(z_rot, y_rot, x_rot), Position(x_pos, 0., z_pos)); + Transform3D tr(RotationZYX(rot.z(), rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z())); PlacedVolume detPV = motherVol.placeVolume(detVol, tr); det.setPlacement(detPV); return det; -- GitLab