Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DD4hep
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cepc
externals
mirroring
DD4hep
Commits
ef9d2170
Commit
ef9d2170
authored
2 years ago
by
Christopher Dilks
Committed by
Andre Sailer
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
feat: add energy deposition test for OpticalTracker example
parent
a77cd07d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/OpticalTracker/CMakeLists.txt
+10
-0
10 additions, 0 deletions
examples/OpticalTracker/CMakeLists.txt
examples/OpticalTracker/scripts/test_energy_deposition.C
+22
-0
22 additions, 0 deletions
examples/OpticalTracker/scripts/test_energy_deposition.C
with
32 additions
and
0 deletions
examples/OpticalTracker/CMakeLists.txt
+
10
−
0
View file @
ef9d2170
...
...
@@ -57,3 +57,13 @@ dd4hep_add_test_reg( OpticalTracker_number_of_hits
REGEX_FAIL
"TEST: failed"
DEPENDS OpticalTracker_simulation
)
# ---Test: Energy deposition
dd4hep_add_test_reg
(
OpticalTracker_energy_deposition
COMMAND
"
${
CMAKE_INSTALL_PREFIX
}
/bin/run_test_OpticalTracker.sh"
EXEC_ARGS root.exe -b -x -n -q -l
"
${
OpticalTracker_INSTALL
}
/scripts/test_energy_deposition.C(
\"
${
OpticalTracker_INSTALL
}
/sim.root
\"
)"
REGEX_PASS
"TEST: passed"
REGEX_FAIL
"TEST: failed"
DEPENDS OpticalTracker_simulation
)
This diff is collapsed.
Click to expand it.
examples/OpticalTracker/scripts/test_energy_deposition.C
0 → 100644
+
22
−
0
View file @
ef9d2170
#include
"CLHEP/Units/SystemOfUnits.h"
void
test_energy_deposition
(
TString
sim_file_name
=
"sim.root"
)
{
// test requirements
const
Double_t
min_edep
=
2
*
CLHEP
::
eV
;
const
Double_t
max_edep
=
5
*
CLHEP
::
eV
;
// get average energy deposition
auto
sim_file
=
new
TFile
(
sim_file_name
);
auto
t
=
(
TTree
*
)
sim_file
->
Get
(
"EVENT"
);
auto
h
=
new
TH1D
(
"h"
,
"energy deposition"
,
100
,
-
1
,
20
);
t
->
Project
(
"h"
,
"PFRICHHits.energyDeposit"
);
auto
ave_edep
=
h
->
GetMean
();
// check if the average energy deposition is within expected range
bool
pass_test
=
ave_edep
>
min_edep
&&
ave_edep
<
max_edep
;
std
::
cout
<<
"TEST: "
<<
(
pass_test
?
"passed"
:
"failed"
)
<<
" with average energy deposition = "
<<
ave_edep
/
CLHEP
::
eV
<<
" eV"
<<
" (expected in range ("
<<
min_edep
/
CLHEP
::
eV
<<
","
<<
max_edep
/
CLHEP
::
eV
<<
") eV)"
<<
std
::
endl
;
}
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