Commit 38446f42 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

modified: part1/

	modified:   part2/
parent 1f8f7fdc
......@@ -79,8 +79,7 @@
## Hit position
root -b -q scripts/tutorial1_hit_position.cxx
# note if this fails because of ACLiC, run it again. This is a root bug.
root -b -q scripts/tutorial2_cell_size.cxx+
Look at the generated file in results:
![local hit position](../hit_position.png)
......@@ -89,6 +88,7 @@ This is the local position in the segmentation (i.e. pixel, strip, readout pad,
### Cell ID (channel) to Position
At the top of the script you can see these lines:
dd4hep::Detector& detector = dd4hep::Detector::getInstance();
......@@ -115,4 +115,43 @@ Segmentation-Cell Position : 39,102,-100
### Id Specification
root -b -q scripts/tutorial3_id_spec.cxx+
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.
auto detector_layer = decoder->get(h.cellID, layer_index);
if ((detector_layer !=4 ) && (detector_layer !=5 )) {
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.
ID specification:
"layer" index is 2.
ID specification:
"layer" index is 2.
For more information, see the [BitFieldCoder documentation](
......@@ -160,6 +160,14 @@ static Ref_t build_detector(Detector& dtor, xml_h e, SensitiveDetector sens)
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](
and scroll through the materials.
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.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment