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

modified: part1/simple_detector.md

	modified:   part2/adding_detectors.md
parent 4a4e0697
No related branches found
No related tags found
No related merge requests found
Pipeline #10110 passed with stage
in 1 minute and 33 seconds
......@@ -100,9 +100,17 @@ This
Later on you can see its use:
```cpp
auto pos1 = cellid_converter.position(h.cellID);
auto pos1 = cellid_converter.position(h.cellID);
```
### Cell size
You will see this:
```bash
...
Segmentation-Cell Position : 39,102,-100
dim 1, 3,
```
......@@ -43,19 +43,17 @@ Building a new (generic) detector using dd4hep is rather straight forward if we
make the following assumptions.
1. We will use the built-in sensitive detectors
2. We will use the built-in data model (hits) associated with these detectors
2. We will use the dd4pod data model (i.e. use `npsim`)
These items can be customized by using the DD4hep plugin mechanism. This will
be covered in another tutorial.
### Compiling a new detector
For this tutorial we will build a simplified Roman Pot detector.
We will discuss the detector built in the source file
`src/GenericDetectors/src/SimpleRomanPot_geo.cpp`.
`src/MyDetector.cpp`.
To compile this detector into the GenericDetectors library the detector needs
to be added to the list of sources in the cmake file
`src/GenericDetectors/CMakeLists.txt`.
`CMakeLists.txt`.
```bash
dd4hep_add_plugin(${a_lib_name} SOURCES
......@@ -89,7 +87,7 @@ The argument signature of the `build_detector` is:
- `SensitiveDetector sens`: The sensitive detector to be assigned to the
sensitive volumes/elements of the detector.
The DD4hep plugin macro `DECLARE_DETELEMENT(SimpleRomanPot, build_detector)`
The DD4hep plugin macro `DECLARE_DETELEMENT(MyDetector, build_detector)`
stamps out the necessary boiler plate code to register a new detector called
`SimpleRomanPot` which is build by calling `build_detector`.
......@@ -99,15 +97,15 @@ The `<detector>` tag defines a new instance of a detector and requires the
attributes "id", "name", and "type". For example:
```xml
<detector id="1" name="MyRomanPot" type="SimpleRomanPot"
vis="RedVis" readout="RomanPotHits" zoffset="1.0*m">
<detector id="1" name="aNeatDetector" type="MyDetector"
vis="RedVis" readout="MyDetectorHits" zoffset="1.0*m">
</detector>
````
This defines an instance of the detector named "MyRomanPot" of type
"SimpleRomanPot" (i.e. the type-name given in the first argument of the DD4hep
`DECLARE_DETELEMENT` macro) and with id=1. The additional attributes (vis,
readout, zoffset) will are optional.
This defines an instance of the detector named "aNeatDetector" of type
"MyDetector" (i.e. the type-name given in the first argument of the DD4hep
`DECLARE_DETELEMENT` macro) and with id=1. Each `<detector>` must have a unique id.
The additional attributes (vis, readout, zoffset) are optional.
The detector tag is provided as the second argument in the `build_detector`
function. It can be parsed *how ever you want* in order to extract detector
......@@ -115,7 +113,6 @@ information. The allowed attributes are listed in
[`UnicodeValues.h`](http://test-dd4hep.web.cern.ch/test-dd4hep/doxygen/html/_unicode_values_8h_source.html)
where it is clear how to add new attributes.
#### Geometry Construction
If you are familiar with Geant4 or TGeo geometry construction then this will be
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment