From c3e94f46e5ad4776ff89b4e0f8977f20397d91ba Mon Sep 17 00:00:00 2001 From: Whitney Armstrong <warmstrong@anl.gov> Date: Fri, 3 Apr 2020 19:38:56 -0500 Subject: [PATCH] modified: adding_detectors.md --- src/docs/part2/adding_detectors.md | 62 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/docs/part2/adding_detectors.md b/src/docs/part2/adding_detectors.md index 1b6cdb4..87c8bde 100644 --- a/src/docs/part2/adding_detectors.md +++ b/src/docs/part2/adding_detectors.md @@ -175,10 +175,10 @@ have to map exactly to detector geometry. However, it typically will typically parallel the geometry (and probably should). ```cpp - string module_name = "RomanPot"; - Assembly assembly(det_name + "_assembly"); - DetElement sdet( det_name, det_id); - sens.setType("tracker"); +string module_name = "RomanPot"; +Assembly assembly(det_name + "_assembly"); +DetElement sdet( det_name, det_id); +sens.setType("tracker"); ``` The last line sets the `SensitiveDetector sens` argument to be the tracker type (which is a DD4hep built-in). We will soon assign this to sensitive volumes. @@ -186,8 +186,8 @@ The last line sets the `SensitiveDetector sens` argument to be the tracker type looks up the detector name (here "MyRomanPot"). ```cpp - double z_offset = (x_det.hasAttr(_Unicode(zoffset))) ? x_det.attr<double>(_Unicode(zoffset)) : 0.0; - double thickness = (x_det.hasAttr(_Unicode(thickness))) ? x_det.attr<double>(_Unicode(thickness)) : 0.01*dd4hep::cm; +double z_offset = (x_det.hasAttr(_Unicode(zoffset))) ? x_det.attr<double>(_Unicode(zoffset)) : 0.0; +double thickness = (x_det.hasAttr(_Unicode(thickness))) ? x_det.attr<double>(_Unicode(thickness)) : 0.01*dd4hep::cm; ``` Here we grab attributes and provide default values. We continue with default values that could also be define through attributes, however, we will want to @@ -195,31 +195,31 @@ add child elements of the detector tag (so the attributes does not grow too long). ```cpp - double rp_chamber_thickness = 5.0*dd4hep::mm; - double rp_chamber_radius = 5.0*dd4hep::cm; - double rp_chamber_length = 50.0*dd4hep::cm; - Tube rp_beam_pipe_tube(rp_chamber_radius, rp_chamber_radius+rp_chamber_thickness, rp_chamber_length/2.0); - Tube rp_beam_vacuum_tube(0.0, rp_chamber_radius+rp_chamber_thickness, rp_chamber_length/2.0); - Tube rp_beam_vacuum_tube2(0.0, rp_chamber_radius, rp_chamber_length/2.0); - - double rp_detector_tube_radius = 2.5*dd4hep::cm; - double rp_detector_tube_length = 20.0*dd4hep::cm; - Tube rp_detector_tube(rp_detector_tube_radius, rp_detector_tube_radius+rp_chamber_thickness, rp_detector_tube_length/2.0); - Tube rp_detector_vacuum_tube(0.0, rp_detector_tube_radius+rp_chamber_thickness, rp_detector_tube_length/2.0); - Tube rp_detector_vacuum_tube2(0.0, rp_detector_tube_radius, rp_detector_tube_length/2.0); - - ROOT::Math::Rotation3D rot_X( ROOT::Math::RotationX(M_PI/2.0) ); - ROOT::Math::Rotation3D rot_Y( ROOT::Math::RotationY(M_PI/2.0) ); - - UnionSolid rp_chamber_tee1(rp_beam_vacuum_tube, rp_detector_vacuum_tube, rot_X); - UnionSolid rp_chamber_tee12(rp_chamber_tee1, rp_detector_vacuum_tube, rot_Y); - - UnionSolid rp_chamber_tee2(rp_beam_vacuum_tube2, rp_detector_vacuum_tube2, rot_X); - UnionSolid rp_chamber_tee22(rp_chamber_tee2, rp_detector_vacuum_tube2, rot_Y); - - SubtractionSolid sub1(rp_chamber_tee12,rp_chamber_tee22); - Volume rp_chamber_vol("rp_chamber_walls_vol", sub1, aluminum); - Volume rp_vacuum_vol("rp_chamber_vacuum_vol", rp_chamber_tee22, vacuum); +double rp_chamber_thickness = 5.0*dd4hep::mm; +double rp_chamber_radius = 5.0*dd4hep::cm; +double rp_chamber_length = 50.0*dd4hep::cm; +Tube rp_beam_pipe_tube(rp_chamber_radius, rp_chamber_radius+rp_chamber_thickness, rp_chamber_length/2.0); +Tube rp_beam_vacuum_tube(0.0, rp_chamber_radius+rp_chamber_thickness, rp_chamber_length/2.0); +Tube rp_beam_vacuum_tube2(0.0, rp_chamber_radius, rp_chamber_length/2.0); + +double rp_detector_tube_radius = 2.5*dd4hep::cm; +double rp_detector_tube_length = 20.0*dd4hep::cm; +Tube rp_detector_tube(rp_detector_tube_radius, rp_detector_tube_radius+rp_chamber_thickness, rp_detector_tube_length/2.0); +Tube rp_detector_vacuum_tube(0.0, rp_detector_tube_radius+rp_chamber_thickness, rp_detector_tube_length/2.0); +Tube rp_detector_vacuum_tube2(0.0, rp_detector_tube_radius, rp_detector_tube_length/2.0); + +ROOT::Math::Rotation3D rot_X( ROOT::Math::RotationX(M_PI/2.0) ); +ROOT::Math::Rotation3D rot_Y( ROOT::Math::RotationY(M_PI/2.0) ); + +UnionSolid rp_chamber_tee1(rp_beam_vacuum_tube, rp_detector_vacuum_tube, rot_X); +UnionSolid rp_chamber_tee12(rp_chamber_tee1, rp_detector_vacuum_tube, rot_Y); + +UnionSolid rp_chamber_tee2(rp_beam_vacuum_tube2, rp_detector_vacuum_tube2, rot_X); +UnionSolid rp_chamber_tee22(rp_chamber_tee2, rp_detector_vacuum_tube2, rot_Y); + +SubtractionSolid sub1(rp_chamber_tee12,rp_chamber_tee22); +Volume rp_chamber_vol("rp_chamber_walls_vol", sub1, aluminum); +Volume rp_vacuum_vol("rp_chamber_vacuum_vol", rp_chamber_tee22, vacuum); ``` The above code builds the up the two solids associated with 3 tubes intersecting. One volume is the aluminum vacuum chamber walls and the other is -- GitLab