Skip to content
Snippets Groups Projects
Commit c3e94f46 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

modified: adding_detectors.md

parent 1772b984
No related branches found
No related tags found
No related merge requests found
...@@ -175,10 +175,10 @@ have to map exactly to detector geometry. However, it typically will typically ...@@ -175,10 +175,10 @@ have to map exactly to detector geometry. However, it typically will typically
parallel the geometry (and probably should). parallel the geometry (and probably should).
```cpp ```cpp
string module_name = "RomanPot"; string module_name = "RomanPot";
Assembly assembly(det_name + "_assembly"); Assembly assembly(det_name + "_assembly");
DetElement sdet( det_name, det_id); DetElement sdet( det_name, det_id);
sens.setType("tracker"); sens.setType("tracker");
``` ```
The last line sets the `SensitiveDetector sens` argument to be the tracker type 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. (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 ...@@ -186,8 +186,8 @@ The last line sets the `SensitiveDetector sens` argument to be the tracker type
looks up the detector name (here "MyRomanPot"). looks up the detector name (here "MyRomanPot").
```cpp ```cpp
double z_offset = (x_det.hasAttr(_Unicode(zoffset))) ? x_det.attr<double>(_Unicode(zoffset)) : 0.0; 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 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 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 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 ...@@ -195,31 +195,31 @@ add child elements of the detector tag (so the attributes does not grow too
long). long).
```cpp ```cpp
double rp_chamber_thickness = 5.0*dd4hep::mm; double rp_chamber_thickness = 5.0*dd4hep::mm;
double rp_chamber_radius = 5.0*dd4hep::cm; double rp_chamber_radius = 5.0*dd4hep::cm;
double rp_chamber_length = 50.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_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_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); 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_radius = 2.5*dd4hep::cm;
double rp_detector_tube_length = 20.0*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_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_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); 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_X( ROOT::Math::RotationX(M_PI/2.0) );
ROOT::Math::Rotation3D rot_Y( ROOT::Math::RotationY(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_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_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_tee2(rp_beam_vacuum_tube2, rp_detector_vacuum_tube2, rot_X);
UnionSolid rp_chamber_tee22(rp_chamber_tee2, rp_detector_vacuum_tube2, rot_Y); UnionSolid rp_chamber_tee22(rp_chamber_tee2, rp_detector_vacuum_tube2, rot_Y);
SubtractionSolid sub1(rp_chamber_tee12,rp_chamber_tee22); SubtractionSolid sub1(rp_chamber_tee12,rp_chamber_tee22);
Volume rp_chamber_vol("rp_chamber_walls_vol", sub1, aluminum); Volume rp_chamber_vol("rp_chamber_walls_vol", sub1, aluminum);
Volume rp_vacuum_vol("rp_chamber_vacuum_vol", rp_chamber_tee22, vacuum); 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 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 intersecting. One volume is the aluminum vacuum chamber walls and the other is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment