Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
EIC
tutorials
eic_tutorial
Commits
f26716d7
Commit
f26716d7
authored
May 21, 2021
by
Whitney Armstrong
Browse files
modified: part1/simple_detector.md
parent
fee8f0c5
Pipeline
#10129
passed with stage
in 1 minute and 33 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/docs/part1/simple_detector.md
View file @
f26716d7
...
...
@@ -162,9 +162,9 @@ This is the local position in the segmentation cell (i.e. pixel, strip, readout
At the top of the script you can see these lines:
```
cpp
dd4hep
::
Detector
&
detector
=
dd4hep
::
Detector
::
getInstance
();
detector
.
fromCompact
(
"gem_tracker.xml"
);
dd4hep
::
rec
::
CellIDPositionConverter
cellid_converter
(
detector
);
dd4hep
::
Detector
&
detector
=
dd4hep
::
Detector
::
getInstance
();
detector
.
fromCompact
(
"gem_tracker.xml"
);
dd4hep
::
rec
::
CellIDPositionConverter
cellid_converter
(
detector
);
```
This
...
...
@@ -215,14 +215,14 @@ Here `cell_dim` is a `std::vector<double>` passed by the specific segmentation i
Look at the
`readouts`
tag of
`gem_tracker.xml`
and you will see this:
```
xml
<readout
name=
"GEMTrackerHits"
>
<segmentation
type=
"CartesianGridXY"
grid_size_x=
"1*cm"
grid_size_y=
"3*cm"
/>
<id>
system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,y:-16
</id>
<!--
<segmentation type="PolarGridRPhi" grid_size_phi="3.0*degree" grid_size_r="5.0*cm"/>
<id>system:5,barrel:3,layer:4,module:5,r:32:-16,phi:-16</id>
-->
</readout>
<readout
name=
"GEMTrackerHits"
>
<segmentation
type=
"CartesianGridXY"
grid_size_x=
"1*cm"
grid_size_y=
"3*cm"
/>
<id>
system:8,barrel:2,layer:4,module:12,sensor:2,x:32:-16,y:-16
</id>
<!--
<segmentation type="PolarGridRPhi" grid_size_phi="3.0*degree" grid_size_r="5.0*cm"/>
<id>system:5,barrel:3,layer:4,module:5,r:32:-16,phi:-16</id>
-->
</readout>
```
Note the
`grid_size_x`
and
`grid_size_y`
attributes with values corresponding to the sizes above.
...
...
@@ -232,10 +232,10 @@ In the `CartesianGridXY` case, the cell sizes are always the same.
1.
Swap in the comment on segmentation and id to create the
`PolarGridRPhi`
segmentation. Should look like this:
```
xml
<readout
name=
"GEMTrackerHits"
>
<segmentation
type=
"PolarGridRPhi"
grid_size_phi=
"3.0*degree"
grid_size_r=
"5.0*cm"
/>
<id>
system:5,barrel:3,layer:4,module:5,r:32:-16,phi:-16
</id>
</readout>
<readout
name=
"GEMTrackerHits"
>
<segmentation
type=
"PolarGridRPhi"
grid_size_phi=
"3.0*degree"
grid_size_r=
"5.0*cm"
/>
<id>
system:5,barrel:3,layer:4,module:5,r:32:-16,phi:-16
</id>
</readout>
```
2.
Re-run npsim command above.
3.
Re-run the root script:
...
...
@@ -268,8 +268,8 @@ For example, a tracking covariance matrix could be computed using this method, a
The cell ID is a 64bit integer with field names assigned to a few bits.
Looking at the id specification we see the following:
```
xml
<segmentation
type=
"PolarGridRPhi"
grid_size_phi=
"3.0*degree"
grid_size_r=
"5.0*cm"
/>
<id>
system:5,barrel:3,layer:4,module:5,r:32:-16,phi:-16
</id>
<segmentation
type=
"PolarGridRPhi"
grid_size_phi=
"3.0*degree"
grid_size_r=
"5.0*cm"
/>
<id>
system:5,barrel:3,layer:4,module:5,r:32:-16,phi:-16
</id>
```
This means there are 5 bits associated with system (this is the
`<detector>`
's
`id`
) this field is mandatory but can differ from 5 bits.
The subsequent fields are arbitrary but should result in a unique 64 bit integer.
...
...
@@ -303,11 +303,11 @@ system:0:8,barrel:8:2,layer:10:4,module:14:12,sensor:26:2,x:32:-16,y:48:-16
This comes from the snippet at the initialization stage:
```
cpp
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
);
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
);
```
This gets an index for the named field "layer" and initializes a decoder.
...
...
@@ -315,10 +315,10 @@ See [BitFieldCoder documentation](https://dd4hep.web.cern.ch/dd4hep/reference/cl
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
;
}
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.
...
...
@@ -328,6 +328,10 @@ Look at the generated plot in `results`:

### Homework
Can you adjust the compact description so that layers 4 and 5 have similar number of hits as the other layers?
## References
-
[
NPdet
](
https://eic.phy.anl.gov/npdet/
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment