-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add distance to surface tests #224
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# collect auxiliary files | ||
file( | ||
GLOB _aux | ||
RELATIVE ${PROJECT_SOURCE_DIR} | ||
macros/*.mac macros/*.json gdml/*.gdml gdml/*.xml *.py) | ||
|
||
# copy them to the build area | ||
|
||
foreach(_file ${_aux}) | ||
configure_file(${PROJECT_SOURCE_DIR}/${_file} ${PROJECT_BINARY_DIR}/${_file} COPYONLY) | ||
endforeach() | ||
|
||
# generate the GDML file | ||
add_test(NAME distances-ge/gen-gdml COMMAND ${PYTHONPATH} make_ge_gdml.py) | ||
set_tests_properties(distances-ge/gen-gdml PROPERTIES LABELS extra FIXTURES_SETUP | ||
distance-gdml-fixture) | ||
|
||
# test on HPGe containment | ||
add_test(NAME distances-ge/gen-output COMMAND ${REMAGE_PYEXE} -g gdml/ge-array.gdml -w -o | ||
test-distance.lh5 -- macros/test-ge-distance.mac) | ||
set_tests_properties( | ||
distances-ge/gen-output PROPERTIES LABELS extra FIXTURES_SETUP distance-output-fixture | ||
FIXTURES_REQUIRED distance-gdml-fixture) | ||
|
||
add_test(NAME distances-ge/distance COMMAND ${PYTHONPATH} ./test_ge_distance.py) | ||
|
||
set_tests_properties(distances-ge/distance PROPERTIES LABELS extra FIXTURES_REQUIRED | ||
distance-output-fixture) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "B99000A", | ||
"type": "bege", | ||
"production": { | ||
"manufacturer": "Test", | ||
"enrichment": { | ||
"val": 0.75, | ||
"unc": 0.05 | ||
} | ||
}, | ||
"geometry": { | ||
"height_in_mm": 40.0, | ||
"radius_in_mm": 35.0, | ||
"groove": { | ||
"depth_in_mm": 2.0, | ||
"radius_in_mm": { | ||
"outer": 12.0, | ||
"inner": 10.0 | ||
} | ||
}, | ||
"pp_contact": { | ||
"radius_in_mm": 7.5, | ||
"depth_in_mm": 0 | ||
}, | ||
"taper": { | ||
"top": { | ||
"angle_in_deg": 0.0, | ||
"height_in_mm": 0.0 | ||
}, | ||
"bottom": { | ||
"angle_in_deg": 0.0, | ||
"height_in_mm": 0.0 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "C99000A", | ||
"type": "coax", | ||
"production": { | ||
"manufacturer": "Test", | ||
"enrichment": { | ||
"val": 0.75, | ||
"unc": 0.05 | ||
} | ||
}, | ||
"geometry": { | ||
"height_in_mm": 80, | ||
"radius_in_mm": 40, | ||
"borehole": { | ||
"radius_in_mm": 7, | ||
"depth_in_mm": 70 | ||
}, | ||
"groove": { | ||
"depth_in_mm": 2, | ||
"radius_in_mm": { | ||
"outer": 20, | ||
"inner": 17 | ||
} | ||
}, | ||
"pp_contact": { | ||
"radius_in_mm": 17, | ||
"depth_in_mm": 0 | ||
}, | ||
"taper": { | ||
"top": { | ||
"angle_in_deg": 45, | ||
"height_in_mm": 5 | ||
}, | ||
"bottom": { | ||
"angle_in_deg": 45, | ||
"height_in_mm": 2 | ||
}, | ||
"borehole": { | ||
"angle_in_deg": 0, | ||
"height_in_mm": 0 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "P99000A", | ||
"type": "ppc", | ||
"production": { | ||
"manufacturer": "Test", | ||
"enrichment": { | ||
"val": 0.75, | ||
"unc": 0.05 | ||
} | ||
}, | ||
"geometry": { | ||
"height_in_mm": 45.0, | ||
"radius_in_mm": 35.0, | ||
"pp_contact": { | ||
"radius_in_mm": 2, | ||
"depth_in_mm": 2 | ||
}, | ||
"taper": { | ||
"top": { | ||
"angle_in_deg": 0, | ||
"height_in_mm": 0 | ||
}, | ||
"bottom": { | ||
"angle_in_deg": 30, | ||
"height_in_mm": 10 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "V99000A", | ||
"type": "icpc", | ||
"production": { | ||
"manufacturer": "Test", | ||
"enrichment": { | ||
"val": 0.75, | ||
"unc": 0.05 | ||
} | ||
}, | ||
"geometry": { | ||
"height_in_mm": 70, | ||
"radius_in_mm": 35, | ||
"borehole": { | ||
"radius_in_mm": 5, | ||
"depth_in_mm": 55 | ||
}, | ||
"groove": { | ||
"depth_in_mm": 1, | ||
"radius_in_mm": { | ||
"outer": 10, | ||
"inner": 9 | ||
} | ||
}, | ||
"pp_contact": { | ||
"radius_in_mm": 3, | ||
"depth_in_mm": 2 | ||
}, | ||
"taper": { | ||
"top": { | ||
"angle_in_deg": 10, | ||
"height_in_mm": 10 | ||
}, | ||
"bottom": { | ||
"angle_in_deg": 0, | ||
"height_in_mm": 0 | ||
}, | ||
"borehole": { | ||
"angle_in_deg": 0, | ||
"height_in_mm": 0 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/control/execute macros/detectors-fake.mac | ||
/RMG/Output/NtuplePerDetector false | ||
|
||
/run/initialize | ||
|
||
/RMG/Generator/Confine Volume | ||
/RMG/Generator/Confinement/Physical/AddVolume B.* | ||
/RMG/Generator/Confinement/Physical/AddVolume C.* | ||
/RMG/Generator/Confinement/Physical/AddVolume P.* | ||
/RMG/Generator/Confinement/Physical/AddVolume V.* | ||
|
||
|
||
/RMG/Generator/Select GPS | ||
/gps/particle e- | ||
/gps/energy 1 eV | ||
|
||
/run/beamOn 100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from __future__ import annotations | ||
|
||
import json | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
import pyg4ometry as pg4 | ||
import pygeomtools as pytools | ||
from legendhpges import make_hpge | ||
|
||
# read the configs | ||
out_gdml = "gdml/ge-array.gdml" | ||
det_macro = "macros/detectors-fake.mac" | ||
config_dict = {} | ||
for det_type in ["B", "P", "V", "C"]: | ||
with Path.open(Path(f"macros/{det_type}99000A.json")) as file: | ||
config_dict[det_type] = json.load(file) | ||
|
||
|
||
def add_hpge(lar, reg, angle, radius, z, idx, dtype): | ||
x = radius * np.sin(np.deg2rad(angle)) | ||
y = radius * np.cos(np.deg2rad(angle)) | ||
logical_detector = make_hpge(config_dict[dtype], name=f"{dtype}{idx}", registry=reg) | ||
logical_detector.pygeom_color_rgba = (0, 1, 1, 0.2) | ||
physical_detector = pg4.geant4.PhysicalVolume( | ||
[0, 0, 0], [x, y, z], logical_detector, f"{dtype}{idx}", lar, reg | ||
) | ||
|
||
physical_detector.pygeom_active_dector = pytools.RemageDetectorInfo( | ||
"germanium", | ||
idx, | ||
config_dict[dtype], | ||
) | ||
return idx + 1 | ||
|
||
|
||
# construct geometry | ||
reg = pg4.geant4.Registry() | ||
ws = pg4.geant4.solid.Box("ws", 300, 300, 300, reg, lunit="mm") | ||
wl = pg4.geant4.LogicalVolume(ws, "G4_Galactic", "wl", reg) | ||
wl.pygeom_color_rgba = (0.1, 1, 0.1, 0.5) | ||
|
||
reg.setWorld(wl) | ||
|
||
|
||
# hpge strings | ||
string_radius = 85 | ||
string_angles = [0, 90, 180, 270] | ||
|
||
n = 0 | ||
for i, det in enumerate(["V", "P", "B", "C"]): | ||
angle = string_angles[i] | ||
n = add_hpge(wl, reg, angle, string_radius, -20, n, det) | ||
|
||
pytools.detectors.write_detector_auxvals(reg) | ||
pytools.geometry.check_registry_sanity(reg, reg) | ||
|
||
|
||
w = pg4.gdml.Writer() | ||
w.addDetector(reg) | ||
w.write(out_gdml) | ||
pytools.detectors.generate_detector_macro(reg, det_macro) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these lines are not needed in this case. They only create a macro to simulate in the LAr cylinders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do kinda need both lines. The list of detectors is so i can just loop through all 4 types (although i can omit the detectors variable by just directly inserting the list into the enumerator).
And i need the n to keep track of the unique detector IDs to also create the
detectors-fake.mac
to register the detectors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I selected the wrong lines. I meant 70-77 where we create the LAr cylinder information (
lines
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, you are right. I dont know how i deleted the write statements below but not that^^