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

modified: part1/simple_detector.md

	modified:   part2/adding_detectors.md
parent 1f8f7fdc
No related branches found
No related tags found
No related merge requests found
...@@ -79,8 +79,7 @@ https://eic.phy.anl.gov/eicd/ ...@@ -79,8 +79,7 @@ https://eic.phy.anl.gov/eicd/
## Hit position ## Hit position
```bash ```bash
root -b -q scripts/tutorial1_hit_position.cxx root -b -q scripts/tutorial2_cell_size.cxx+
# note if this fails because of ACLiC, run it again. This is a root bug.
``` ```
Look at the generated file in results: Look at the generated file in results:
![local hit position](../hit_position.png) ![local hit position](../hit_position.png)
...@@ -89,6 +88,7 @@ This is the local position in the segmentation (i.e. pixel, strip, readout pad, ...@@ -89,6 +88,7 @@ This is the local position in the segmentation (i.e. pixel, strip, readout pad,
### Cell ID (channel) to Position ### Cell ID (channel) to Position
At the top of the script you can see these lines: At the top of the script you can see these lines:
```cpp ```cpp
dd4hep::Detector& detector = dd4hep::Detector::getInstance(); dd4hep::Detector& detector = dd4hep::Detector::getInstance();
...@@ -115,4 +115,43 @@ Segmentation-Cell Position : 39,102,-100 ...@@ -115,4 +115,43 @@ Segmentation-Cell Position : 39,102,-100
``` ```
### Id Specification
```bash
root -b -q scripts/tutorial3_id_spec.cxx+
```
```cpp
fmt::print("--------------------------\n");
fmt::print("ID specification:\n");
auto decoder = detector.readout("GEMTrackerHits").idSpec().decoder();
fmt::print("{}\n", decoder->fieldDescription());
auto layer_index = decoder->index("layer");
fmt::print(" \"layer\" index is {}.\n", layer_index);
```
Later in the loop over event hits.
```cpp
auto detector_layer = decoder->get(h.cellID, layer_index);
if ((detector_layer !=4 ) && (detector_layer !=5 )) {
continue;
}
```
Note the `layer_index` is computed once in the beginning when the decoder is also initialized.
This means it will be fast because it only parses the ID specification string once.
```bash
ID specification:
system:0:5,barrel:5:3,layer:8:4,module:12:5,r:32:-16,phi:48:-16
"layer" index is 2.
```
or
```bash
ID specification:
system:0:8,barrel:8:2,layer:10:4,module:14:12,sensor:26:2,x:32:-16,y:48:-16
"layer" index is 2.
```
For more information, see the [BitFieldCoder documentation](https://dd4hep.web.cern.ch/dd4hep/reference/classdd4hep_1_1DDSegmentation_1_1BitFieldCoder.html).
...@@ -160,6 +160,14 @@ static Ref_t build_detector(Detector& dtor, xml_h e, SensitiveDetector sens) ...@@ -160,6 +160,14 @@ static Ref_t build_detector(Detector& dtor, xml_h e, SensitiveDetector sens)
string det_name = x_det.nameStr(); // "MyRomanPot" string det_name = x_det.nameStr(); // "MyRomanPot"
``` ```
### What materials exist
To browse the list of materials and elements (other than looking in the compact files), go to
[geo viewer](https://eic.phy.anl.gov/geoviewer/index.htm?file=https://eicweb.phy.anl.gov/api/v4/projects/473/jobs/artifacts/master/raw/geo/detector_geo_full.root?job=report)
and scroll through the materials.
![browse_materials](../browse_materials.png)
Here we are grabbing the materials that are assumed to be already defined. Also Here we are grabbing the materials that are assumed to be already defined. Also
we are getting the detector id and name defined in the `detector` tag. we are getting the detector id and name defined in the `detector` tag.
......
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