Skip to content
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

Use latest dependencies in pipeline image #51

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
674dfac
restG4/examples/01.NLDBD - increased number of events from 10 to 100 …
lobis Jun 6, 2022
89e47e3
restG4/examples/01.NLDBD/Validate.C - more semantic variable names
lobis Jun 6, 2022
df984bc
restG4.cxx - normalized variable name
lobis Jun 6, 2022
0e2dd76
Updated validation macro
lobis Jun 6, 2022
5707768
restG4.cxx - removed `REST_Display_CompatibilityMode` to fix pipeline
lobis Jun 6, 2022
096cfa2
.gitlab-ci.yml - using `test` pipeline temporarily
lobis Jun 6, 2022
31c6d13
examples/01 - using double for average number of _
lobis Jun 6, 2022
274505e
.gitlab-ci.yml - updated pipeline stage names
lobis Jun 6, 2022
16918d9
examples/01 - updated validation script to check average position
lobis Jun 6, 2022
2d249cd
examples/04 - collapsed physics lists tags
lobis Jun 6, 2022
980ecff
examples - using decimal numbers correctly in validation
lobis Jun 6, 2022
a49fa35
examples/04 - finished updating validaiton
lobis Jun 6, 2022
c3c165b
.gitlab-ci.yml - removed wrong check in example 11 (why wasn't it fai…
lobis Jun 6, 2022
837692f
examples/11 - collapsed tags
lobis Jun 6, 2022
19d9a2a
examples/08 - formatted rmls and collapsed some tags
lobis Jun 7, 2022
026933b
EventAction - added root timer, renamed some variables
lobis Jun 7, 2022
b3e006c
Event/RunAction - added better messages, reformatting
lobis Jun 7, 2022
9a64b2b
EventAction.cxx - speed up in case storage change is 100%
lobis Jun 7, 2022
a1ababb
examples/08 - using 10000 events as before
lobis Jun 7, 2022
bad46fa
examples/08 - Simplified and updated validation macro
lobis Jun 7, 2022
a24b13a
examples - updated decay example
lobis Jun 7, 2022
1de8527
updated examples with reference values for validation
lobis Jun 7, 2022
e0efdd2
examples/09 - updated shielding example
lobis Jun 7, 2022
e506403
Using TRestTools to check input rml exists and give proper error message
lobis Jun 7, 2022
7827b52
updated names on pipelines to follow repository naming convention
lobis Jun 7, 2022
505992f
examples/04 - validation
lobis Jun 7, 2022
40d0adc
examples/08 - updated validation ref value
lobis Jun 7, 2022
665fc8a
examples/04 - updated validation
lobis Jun 7, 2022
f1ac161
examples/04 - updated reference values
lobis Jun 7, 2022
9f024a4
updated pipeline image to `ghcr.io/lobis/root-geant4-garfield:rest-fo…
lobis Jun 7, 2022
1446230
using dev pipeline
lobis Jun 7, 2022
517d38f
Added back `REST_Display_CompatibilityMode`
lobis Jun 7, 2022
7acef6c
Validation - reduced tolerance to 0.5%
lobis Jun 8, 2022
21f2628
pipeline - updated tolerances to 0.1%
lobis Jun 8, 2022
931d4f8
Merge branch 'master' into 238-update-pipeline-image-to-use-latest-ve…
lobis Jun 9, 2022
c81ed79
github actions - updated to use dev image
lobis Jun 9, 2022
a5979ef
github actions - fixed not pulling corresponding branch of framework
lobis Jun 9, 2022
c4b8120
Update validation.yml
lobis Jun 9, 2022
398e4fb
github actions - using different cache key to fix
lobis Jun 10, 2022
cb6f83e
github actions - more debug
lobis Jun 10, 2022
b91267b
github actions - using rest-for-physics-reference-jun2022 for frozen …
lobis Jun 10, 2022
f2d5ea0
Using default in actions
lobis Jun 10, 2022
2771fa2
GitHub actions - removed invalid defaults
lobis Jun 10, 2022
94b5152
actions - removed env image variable
lobis Jun 10, 2022
9ab8909
actions - added more complete key to cache
lobis Jun 10, 2022
5be9442
actions removed cache of old
lobis Jun 10, 2022
3f9d744
actions - added back cache for old G4
lobis Jun 10, 2022
6be76c1
actions - using regular bash
lobis Jun 10, 2022
a7329ae
actions debug cache
lobis Jun 10, 2022
257e327
updated action
lobis Jun 10, 2022
f465f6d
debug action
lobis Jun 10, 2022
3cff58b
github actions - debug
lobis Jun 10, 2022
c669726
github actions - debug
lobis Jun 10, 2022
9664ee4
github actions - debug
lobis Jun 10, 2022
e5cf1d2
actions - sourcing root manually
lobis Jun 10, 2022
265de88
Added better sourcing of root
lobis Jun 11, 2022
3175777
actions - check
lobis Jun 11, 2022
a0f5c0f
actions - updated examples
lobis Jun 11, 2022
d8d4e87
actions - removed sourcing root manually
lobis Jun 11, 2022
39405cd
Fixed validation for example 11
lobis Jun 11, 2022
30ca8f3
attempt to fix pipeline
lobis Jun 11, 2022
7ecfbea
thisREST.sh - removed condition preventing from loading geant4.sh
lobis Jun 11, 2022
e6d9de5
Attempt to fix pipeline
lobis Jun 11, 2022
338fbcc
fixed example
lobis Jun 11, 2022
c3c08c0
removed patch from validation
lobis Jun 11, 2022
789c4ae
updated example 11 validation
lobis Jun 11, 2022
a13f8df
attempt to fix pipeline
lobis Jun 11, 2022
35c34c1
attempt to fix pipeline
lobis Jun 12, 2022
5c97c45
updated actions
lobis Jun 13, 2022
a8e81df
updated actions to include reference Geant4 version check
lobis Jun 13, 2022
da59128
updated actions
lobis Jun 13, 2022
955a36f
attempt to fix pipeline
lobis Jun 13, 2022
e60bf9d
actions - reduced cache key size
lobis Jun 13, 2022
df3a5e3
updated action
lobis Jun 13, 2022
5a01421
restG4 - fix bad Geant4 version print
lobis Jun 13, 2022
ac44c33
removed test path from cache
lobis Jun 13, 2022
56b137e
actions - added example 01 with ref
lobis Jun 13, 2022
ad10afd
fixed bug in validation
lobis Jun 13, 2022
94c018c
attempt to fix action
lobis Jun 13, 2022
ad80a60
actions - updated validation for example 01
lobis Jun 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
309 changes: 197 additions & 112 deletions .github/workflows/validation.yml

Large diffs are not rendered by default.

59 changes: 29 additions & 30 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics
image: ghcr.io/lobis/root-geant4-garfield:rest-for-physics-dev

stages:
- build
- build-standalone
- loadRESTLibs
- examples
- Build
- Build Standalone
- Load REST Libraries
- Run Examples

before_script:
- export USER="rest"
Expand All @@ -18,7 +18,7 @@ before_script:

# This is the one we use to run validations tests. We save the installation as an artifact.
Build and Install:
stage: build
stage: Build
script:
- echo "**${CI_PROJECT_DIR}**"
- git clone https://github.com/rest-for-physics/framework.git framework
Expand Down Expand Up @@ -50,7 +50,7 @@ Build and Install:
expire_in: 1 day

Build Standalone:
stage: build-standalone
stage: Build Standalone
script:
- echo "**${CI_PROJECT_DIR}**"
- cd ${CI_PROJECT_DIR}/
Expand All @@ -64,22 +64,22 @@ Build Standalone:
- rm -rf ${CI_PROJECT_DIR}/install-standalone

Load REST Libraries:
stage: loadRESTLibs
stage: Load REST Libraries
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- restRoot -b -q

01_NLDBD:
stage: examples
01.NLDBD:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/01.NLDBD/
- restG4 NLDBD.rml
- geant4-config --version
- restRoot -b -q Validate.C'("Run00001_NLDBD_Test.root")'

03_Fluorescence:
stage: examples
03.Fluorescence:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/03.Fluorescence/
Expand All @@ -88,8 +88,8 @@ Load REST Libraries:
- geant4-config --version
- restRoot -b -q Validate.C'("Run00111_g4Analysis_Gamma_rest.root")'

04_MuonScan:
stage: examples
04.MuonScan:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/04.MuonScan/
Expand All @@ -101,37 +101,37 @@ Load REST Libraries:
- restG4 CosmicMuonsFromCircle.rml
- restRoot -b -q ValidateCircle.C'("Run00111_restG4_MuonsFromCircle_rest.root")'

05_PandaXIII:
stage: examples
05.PandaXIII:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/05.PandaXIII/
- restG4 Xe136bb0n.rml
- restRoot -b -q ValidateG4.C'("Xe136bb0n_n2E06.root")'

06_IonRecoils:
stage: examples
06.IonRecoils:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/06.IonRecoils/
- restG4 recoils.rml
- restRoot -b -q Validate.C'("Run00001_F20_Recoils.root")'

07_FullChainDecay:
stage: examples
07.FullChainDecay:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/07.FullChainDecay/
- restG4 fullChain.rml
- restG4 singleDecay.rml
- restRoot -b -q Validate.C'("Run00001_U238_FullChainDecay.root", 14)'
- restRoot -b -q Validate.C'("Run00001_U238_FullChainDecay.root", 16)'
- restRoot -b -q Validate.C'("Run00002_U238_SingleChainDecay.root", 1)'
- export REST_ISOTOPE="Be7"
- restG4 singleDecay.rml
- restRoot -b -q Validate.C'("Run00002_Be7_SingleChainDecay.root", 1)'

08_Alphas:
stage: examples
08.Alphas:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/08.Alphas/
Expand All @@ -151,28 +151,27 @@ Load REST Libraries:
- restManager --c plots.rml --f "data/*g4Ana*root" --batch
- restRoot -b -q Validate.C

09_Pb210_Shielding:
stage: examples
09.Pb210_Shielding:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/09.Pb210_Shield/
- restG4 Pb210.rml
- restRoot -b -q Validate.C'("Run00001_Pb210_Shielding.root")'

10_Geometries:
stage: examples
10.Geometries:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/10.Geometries/
- restG4 Assembly.rml
- restRoot -b -q Validate.C'("Run00001_Assembly_Assembly.root")'

11_Xrays:
stage: examples
11.Xrays:
stage: Run Examples
script:
- . ${CI_PROJECT_DIR}/install/thisREST.sh
- cd ${CI_PROJECT_DIR}/install/examples/restG4/11.Xrays/
- restG4 xrays.rml
- restRoot -b -q Validate.C'("Run00001_Assembly_Assembly.root")'
- restManager --c analysis.rml --f RestG4_xrays_00001_ArgonISO.root
- restRoot -b -q GetQE.C'("Run_g4Analysis_00001_xrays.root")'
2 changes: 1 addition & 1 deletion examples/01.NLDBD/NLDBD.rml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ By default REST units are mm, keV and degrees
<parameter name="seed" value="17021981"/>

<!-- The number of events to be simulated is now defined in TRestGeant4Metadata -->
<parameter name="nEvents" value="10"/>
<parameter name="nEvents" value="100"/>

///three types of source definition supported:
<generator type="volume" from="gas">
Expand Down
125 changes: 79 additions & 46 deletions examples/01.NLDBD/Validate.C
Original file line number Diff line number Diff line change
@@ -1,93 +1,126 @@

Int_t Validate(string fname) {
TRestRun* run = new TRestRun(fname);
#include <TRestGeant4Event.h>

if (run->GetParentRunNumber() != 0) {
cout << "Parent run number value : " << run->GetParentRunNumber() << endl;
Int_t Validate(const char* filename) {
cout << "Starting validation for '" << filename << "'" << endl;

TRestRun run(filename);

if (run.GetParentRunNumber() != 0) {
cout << "Parent run number value : " << run.GetParentRunNumber() << endl;
cout << "The parent run number from restG4 generated file should be 0" << endl;
return 1;
}

if (run->GetRunNumber() != 1) {
cout << "Run number value : " << run->GetRunNumber() << endl;
if (run.GetRunNumber() != 1) {
cout << "Run number value : " << run.GetRunNumber() << endl;
cout << "The run number on the validation chain should be 1 by default!" << endl;
return 2;
}

if (run->GetRunType() != "restG4") {
cout << "Run type : " << run->GetRunType() << endl;
if (run.GetRunType() != "restG4") {
cout << "Run type : " << run.GetRunType() << endl;
cout << "The run type of restG4 generated data should be 'restG4'!" << endl;
return 3;
}

if (run->GetRunTag() != "NLDBD") {
cout << "Run tag : " << run->GetRunTag() << endl;
if (run.GetRunTag() != "NLDBD") {
cout << "Run tag : " << run.GetRunTag() << endl;
cout << "The run tag of the basic validation test should be 'NLDBD'!" << endl;
return 4;
}

if (run->GetEntries() != 10) {
cout << "Run entries : " << run->GetEntries() << endl;
cout << "The NLDBD simulation is launched from gas. It should always generate 10 events." << endl;
if (run.GetEntries() != 100) {
cout << "Run entries : " << run.GetEntries() << endl;
cout << "The number of stored events should match the reference value of 100" << endl;
return 5;
}

cout << "Testing reading of Geant4 metadata class" << endl;
TRestGeant4Metadata* g4Md = (TRestGeant4Metadata*)run->GetMetadataClass("TRestGeant4Metadata");
if (!g4Md) {
TRestGeant4Metadata* geant4Metadata = (TRestGeant4Metadata*)run.GetMetadataClass("TRestGeant4Metadata");
if (!geant4Metadata) {
cout << "Problem reading Geant4 metadata class!" << endl;
return 6;
}
g4Md->PrintMetadata();
geant4Metadata->PrintMetadata();

if (g4Md->GetNumberOfActiveVolumes() != 1) {
cout << "The number of registered volumes is not 1!" << endl;
const bool isReferenceGeant4Version = geant4Metadata->GetGeant4Version() == "10.4.3";

if (geant4Metadata->GetNumberOfActiveVolumes() != 1) {
cout << "The number of registered does not match the reference value of 1" << endl;
return 7;
}

TRestGeant4Event* ev = (TRestGeant4Event*)run->GetInputEvent();
run->GetEntry(9);
TRestGeant4Event* event = run.GetInputEvent<TRestGeant4Event>();

double nEvents = run.GetEntries();

double averageTotalEnergy = 0;
const double averageTotalEnergyRef = (!isReferenceGeant4Version) ? 2280.96 : 2221.55;

double averageSensitiveEnergy = 0;
const double averageSensitiveEnergyRef = (!isReferenceGeant4Version) ? 2280.96 : 2221.55;

double averageNumberOfHits = 0;
const double averageNumberOfHitsRef = (!isReferenceGeant4Version) ? 3071.17 : 342.37;

cout << "Total energy : " << ev->GetTotalDepositedEnergy() << endl;
Int_t en = (Int_t)(100 * ev->GetTotalDepositedEnergy());
cout << "Energy integer : " << en << endl;
cout << "Sensitive volume energy : " << ev->GetSensitiveVolumeEnergy() << endl;
cout << "Number of hits : " << ev->GetNumberOfHits() << endl;
cout << "Number of tracks : " << ev->GetNumberOfTracks() << endl;
double averageNumberOfTracks = 0;
const double averageNumberOfTracksRef = (!isReferenceGeant4Version) ? 2161.43 : 10.11;

Int_t X = (Int_t)(100 * ev->GetMeanPositionInVolume(0).X());
Int_t Y = (Int_t)(100 * ev->GetMeanPositionInVolume(0).Y());
Int_t Z = (Int_t)(100 * ev->GetMeanPositionInVolume(0).Z());
TVector3 averagePosition = {};
const TVector3 averagePositionRef = (!isReferenceGeant4Version) ? TVector3(-38.8987, 27.5536, 91.3969)
: TVector3(-17.8046, -32.5019, -31.8353);

cout << "x: " << X << " y: " << Y << " z: " << Z << endl;
const double tolerance = 0.001;

if (en != 245700) {
cout << "Error in total energy" << endl;
for (size_t i = 0; i < run.GetEntries(); i++) {
run.GetEntry(i);

averageTotalEnergy += event->GetTotalDepositedEnergy() / nEvents;
averageSensitiveEnergy += event->GetSensitiveVolumeEnergy() / nEvents;
averageNumberOfHits += event->GetNumberOfHits() / nEvents;
averageNumberOfTracks += event->GetNumberOfTracks() / nEvents;
averagePosition += event->GetMeanPositionInVolume(0) * (1.0 / nEvents);
}

cout << "Average total energy: " << averageTotalEnergy << " keV" << endl;
cout << "Average sensitive energy: " << averageSensitiveEnergy << " keV" << endl;
cout << "Average number of hits: " << averageNumberOfHits << endl;
cout << "Average number of tracks: " << averageNumberOfTracks << endl;
cout << "Average position: (" << averagePosition.x() << ", " << averagePosition.y() << ", "
<< averagePosition.z() << ") mm" << endl;

if (TMath::Abs(averageNumberOfHits - averageNumberOfHitsRef) / averageNumberOfHitsRef > tolerance) {
cout << "The average number of hits does not match the reference value of " << averageNumberOfHitsRef
<< endl;
return 8;
}

//en = (Int_t)(100 * ev->GetSensitiveVolumeEnergy());
//if (en != 245699) {
// cout << "Error in total energy" << endl;
// return 9;
//}
if (TMath::Abs(averageNumberOfTracks - averageNumberOfTracksRef) / averageNumberOfTracksRef > tolerance) {
cout << "The average number of tracks does not match the reference value of "
<< averageNumberOfTracksRef << endl;
return 9;
}

if (ev->GetNumberOfHits() != 401) {
cout << "Error in the number of hits" << endl;
if (TMath::Abs(averageSensitiveEnergy - averageSensitiveEnergyRef) / averageSensitiveEnergyRef >
tolerance) {
cout << "The average sensitive volume energy does not match the reference value of "
<< averageSensitiveEnergyRef << endl;
return 10;
}

if (ev->GetNumberOfTracks() != 11) {
cout << "Error in the number of tracks" << endl;
if (TMath::Abs(averageTotalEnergy - averageTotalEnergyRef) / averageTotalEnergyRef > tolerance) {
cout << "The average total energy does not match the reference value of " << averageTotalEnergyRef
<< endl;
return 11;
}
if (X != -52709 || Y != 37592 || Z != 59585) {
cout << "Error in the event mean position" << endl;

if (TMath::Abs(averagePosition.Mag() - averagePositionRef.Mag()) / averagePositionRef.Mag() > tolerance) {
cout << "The average position does not match the reference value of "
<< "(" << averagePositionRef.x() << ", " << averagePositionRef.y() << ", "
<< averagePositionRef.z() << ") mm" << endl;
return 12;
}

cout << "All tests passed! [\033[32mOK\033[0m]\n";
// Other tests like opening other metadata classes. Detector TGeoManager, etc.

return 0;
}
1 change: 0 additions & 1 deletion examples/04.MuonScan/CosmicMuonsFromCircle.rml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
</physicsList>

<!-- Hadron physics lists -->

<physicsList name="G4HadronElasticPhysicsHP"/>
<physicsList name="G4IonBinaryCascadePhysics"/>
<physicsList name="G4HadronPhysicsQGSP_BIC_HP"/>
Expand Down
15 changes: 7 additions & 8 deletions examples/04.MuonScan/CosmicMuonsFromWall.rml
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,23 @@ First concept author G. Luzón (16-11-2020) -->
<parameter name="maxEnergyRangeProductionCuts" value="1" units="GeV"/>

<!-- EM Physics lists -->
<physicsList name="G4EmLivermorePhysics"></physicsList>
<physicsList name="G4EmLivermorePhysics"/>
<!-- <physicsList name="G4EmPenelopePhysics"> </physicsList> -->
<!-- <physicsList name="G4EmStandardPhysics_option3"> </physicsList> -->

<!-- Decay physics lists -->
<physicsList name="G4DecayPhysics"></physicsList>
<physicsList name="G4RadioactiveDecayPhysics"></physicsList>
<physicsList name="G4DecayPhysics"/>
<physicsList name="G4RadioactiveDecayPhysics"/>
<physicsList name="G4RadioactiveDecay">
<option name="ICM" value="true"/>
<option name="ARM" value="true"/>
</physicsList>

<!-- Hadron physics lists -->

<physicsList name="G4HadronElasticPhysicsHP"></physicsList>
<physicsList name="G4IonBinaryCascadePhysics"></physicsList>
<physicsList name="G4HadronPhysicsQGSP_BIC_HP"></physicsList>
<physicsList name="G4EmExtraPhysics"></physicsList>
<physicsList name="G4HadronElasticPhysicsHP"/>
<physicsList name="G4IonBinaryCascadePhysics"/>
<physicsList name="G4HadronPhysicsQGSP_BIC_HP"/>
<physicsList name="G4EmExtraPhysics"/>

</TRestGeant4PhysicsLists>

Expand Down
Loading