Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eic_tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EIC
tutorials
eic_tutorial
Commits
f26716d7
Commit
f26716d7
authored
3 years ago
by
Whitney Armstrong
Browse files
Options
Downloads
Patches
Plain Diff
modified: part1/simple_detector.md
parent
fee8f0c5
No related branches found
No related tags found
No related merge requests found
Pipeline
#10129
passed
3 years ago
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/docs/part1/simple_detector.md
+30
-26
30 additions, 26 deletions
src/docs/part1/simple_detector.md
with
30 additions
and
26 deletions
src/docs/part1/simple_detector.md
+
30
−
26
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/
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment