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

Fixing examples pipeline due to changes in GDML material files #70

Merged
merged 43 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6d50562
Updating materials file
jgalan Sep 30, 2022
fe6612a
04.MuonScan/setup.gdml the entity must be named materials to be prope…
jgalan Sep 30, 2022
1aa9000
Validate.C validation values updated due to changes in Argon composition
jgalan Sep 30, 2022
0cf65c6
04.MuonScan updating geometry name
jgalan Sep 30, 2022
3b4afb6
Updating materials file and validation values to fulfill with G4_Xe p…
jgalan Sep 30, 2022
e5e95b6
03.Fluorescence updating materials file
jgalan Sep 30, 2022
3eeb353
04.MuonScan. Fixing material version validation
jgalan Sep 30, 2022
687015f
06.IonRecoils Updating validation values due to gas composition update
jgalan Sep 30, 2022
fc491bd
07.FullChainDecay updating validation
jgalan Oct 1, 2022
c88166e
01.NLDBD updating validation value
jgalan Oct 1, 2022
a348d63
01.NLDBD Updating validation values
jgalan Oct 1, 2022
1fbf0f8
04.MuonScan validating values
jgalan Oct 1, 2022
1f934b7
06.IonRecoils fixing validation value
jgalan Oct 1, 2022
15e9890
08.Alphas. Changing material to gases.rml
jgalan Oct 1, 2022
61a26f3
08.Alphas. Fixing validation values due to change of materials file
jgalan Oct 2, 2022
6852ce0
12.Generators updating materials file
jgalan Oct 2, 2022
511f92d
test/examples.cxx Updating full chain validation
jgalan Oct 2, 2022
73e7454
09.Pb210_Shield. Updating materials file
jgalan Oct 2, 2022
9bbf903
11.Xrays Updating materials file
jgalan Oct 2, 2022
7a86aa2
01.NLDBD Adding both gases.xml and materials.xml
jgalan Oct 3, 2022
d66252b
using new url for materials
lobis Oct 3, 2022
acf7e44
Updating material geometry to rest.xml
jgalan Oct 3, 2022
636e5f7
Merge branch 'fixing_examples' of github.com:rest-for-physics/restG4 …
jgalan Oct 3, 2022
d4ac05f
01.NLDBD trying to fix reference
jgalan Oct 4, 2022
9dd15cd
01.NLDBD adding an older materials file for reference validation
jgalan Oct 4, 2022
6825827
01.NLDBD/geometry/rest.xml removing Lithium from local materials file
jgalan Oct 4, 2022
a71ea8a
.github/validation.yml 01.NLDBD overwritting rest.xml
jgalan Oct 4, 2022
c0a5744
Trying to fix reference examples
jgalan Oct 4, 2022
fa9a088
Moving local rest.xml from 06 example to 04.
jgalan Oct 4, 2022
2b9bb44
Removing empty rest.xml
jgalan Oct 4, 2022
2091f4e
Updating corrupt local materials file
jgalan Oct 4, 2022
52d6157
Removing malformed Lithium from local materials file
jgalan Oct 4, 2022
b395175
Fixing ctests 01.NLDBD example
jgalan Oct 4, 2022
e08abc8
Fixing Gitlab pipeline
jgalan Oct 4, 2022
21b6f8f
Updating 01.NLDBD/README.md
jgalan Oct 4, 2022
42a8a36
08.alphas. Adding old material files inside alphas example
jgalan Oct 4, 2022
fcc45fa
Uploading rest.xml into 08.aplhas
jgalan Oct 4, 2022
599a803
08.Alphas using sed strategy to update materials file
jgalan Oct 4, 2022
74b9312
08.alphas/setup.gdml now uses official updated materials file
jgalan Oct 4, 2022
e6b8b5c
Updating 01.NLDBD materials file
jgalan Oct 4, 2022
ffa1a6b
prepare for merge
lobis Oct 4, 2022
af3c5ba
remove redundant files
lobis Oct 4, 2022
050f678
attempt to fix sed pipeline
lobis Oct 4, 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
19 changes: 18 additions & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,25 @@ jobs:
mkdir -p ${{ env.REST_FRAMEWORK_SOURCE_DIR }}/build && cd ${{ env.REST_FRAMEWORK_SOURCE_DIR }}/build
cmake ../ -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -DREST_WELCOME=ON -DREST_G4=ON -DCMAKE_INSTALL_PREFIX=${{ env.REST_PATH }}
make -j4 install
- name: Test before
run: |
cat ${{ env.REST_PATH }}/examples/restG4/01.NLDBD/geometry/mySetupTemplate.gdml
find . -name "*.gdml"
- name: Use old materials for reference Geant4 version
run: |
cd ${{ env.REST_PATH }}
pwd
cat ${{ env.REST_PATH }}/examples/restG4/01.NLDBD/geometry/mySetupTemplate.gdml
find . -name "*.gdml" | xargs sed -i 's/https:\/\/rest-for-physics.github.io\/materials\/rest.xml/https:\/\/rest-for-physics.github.io\/materials\/legacy\/v1.4\/rest.xml/g'
cat ${{ env.REST_PATH }}/examples/restG4/01.NLDBD/geometry/mySetupTemplate.gdml
sed -i 's/https:\/\/rest-for-physics.github.io\/materials\/rest.xml/https:\/\/rest-for-physics.github.io\/materials\/legacy\/v1.4\/rest.xml/g' ${{ env.REST_PATH }}/examples/restG4/01.NLDBD/geometry/mySetupTemplate.gdml
cat ${{ env.REST_PATH }}/examples/restG4/01.NLDBD/geometry/mySetupTemplate.gdml
- name: Test after
run: |
cat ${{ env.REST_PATH }}/examples/restG4/01.NLDBD/geometry/mySetupTemplate.gdml
find . -name "*.gdml"
- name: Cache framework installation
id: framework-install-restG4-cache-old-Geant4
id: framework-install-restG4-cache-reference
uses: actions/cache@v3
with:
path: ${{ env.REST_PATH }}
Expand Down
10 changes: 5 additions & 5 deletions examples/01.NLDBD/Validate.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ Int_t Validate(const char* filename) {
double nEvents = run.GetEntries();

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

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

double averageNumberOfHits = 0;
const double averageNumberOfHitsRef = (!isReferenceGeant4Version) ? 5371.17 : 353.2;
const double averageNumberOfHitsRef = (!isReferenceGeant4Version) ? 5281.31 : 353.2;

double averageNumberOfTracks = 0;
const double averageNumberOfTracksRef = (!isReferenceGeant4Version) ? 2300 : 10.83;
const double averageNumberOfTracksRef = (!isReferenceGeant4Version) ? 2277.62 : 10.83;

TVector3 averagePosition = {};
const TVector3 averagePositionRef = (!isReferenceGeant4Version) ? TVector3(-38.8987, 27.5536, 91.3969)
const TVector3 averagePositionRef = (!isReferenceGeant4Version) ? TVector3(-17.4834, -15.4111, -31.5935)
: TVector3(-17.8046, -32.5019, -31.8353);

const double tolerance = 0.001;
Expand Down
2 changes: 1 addition & 1 deletion examples/01.NLDBD/geometry/mySetupTemplate.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "myGeometryTemplate.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/03.Fluorescence/geometry/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
29 changes: 17 additions & 12 deletions examples/04.MuonScan/Validate.C
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,32 @@ Int_t Validate(const char* filename) {
return 7;
}

if (geant4Metadata->GetMaterialsReference() == "0.0") {
cout << "Materials version was not defined!" << endl;
return 8;
}

TRestGeant4Event* event = run.GetInputEvent<TRestGeant4Event>();

double nEvents = run.GetEntries();

double averageTotalEnergy = 0;
constexpr double averageTotalEnergyRef = 18.074;
constexpr double averageTotalEnergyRef = 18.3461;

double averageSensitiveEnergy = 0;
constexpr double averageSensitiveEnergyRef = 8.99048;
constexpr double averageSensitiveEnergyRef = 8.59475;

double averageNumberOfTracks = 0;
constexpr double averageNumberOfTracksRef = 432.763;
constexpr double averageNumberOfTracksRef = 394.381;

double averageNumberOfHitsVolume0 = 0;
constexpr double averageNumberOfHitsVolume0Ref = 66.317;
constexpr double averageNumberOfHitsVolume0Ref = 69.092;

double averageNumberOfHitsVolume1 = 0;
constexpr double averageNumberOfHitsVolume1Ref = 61.555;
constexpr double averageNumberOfHitsVolume1Ref = 58.31;

TVector3 averagePosition = {};
const TVector3 averagePositionRef = {-0.59902, 0.0256995, 300.385};
const TVector3 averagePositionRef = {0.338143, -0.291832, 300.517};

constexpr double tolerance = 0.001;

Expand All @@ -97,43 +102,43 @@ Int_t Validate(const char* filename) {
if (TMath::Abs(averageNumberOfTracks - averageNumberOfTracksRef) / averageNumberOfTracksRef > tolerance) {
cout << "The average number of tracks does not match the reference value of "
<< averageNumberOfTracksRef << endl;
return 8;
return 9;
}

if (TMath::Abs(averageNumberOfHitsVolume0 - averageNumberOfHitsVolume0Ref) /
averageNumberOfHitsVolume0Ref >
tolerance) {
cout << "The average number of hits in volume 0 does not match the reference value of "
<< averageNumberOfHitsVolume0Ref << endl;
return 9;
return 10;
}

if (TMath::Abs(averageNumberOfHitsVolume1 - averageNumberOfHitsVolume1Ref) /
averageNumberOfHitsVolume1Ref >
tolerance) {
cout << "The average number of hits in volume 1 does not match the reference value of "
<< averageNumberOfHitsVolume1Ref << endl;
return 10;
return 11;
}

if (TMath::Abs(averageSensitiveEnergy - averageSensitiveEnergyRef) / averageSensitiveEnergyRef >
tolerance) {
cout << "The average sensitive volume energy does not match the reference value of "
<< averageSensitiveEnergyRef << endl;
return 11;
return 12;
}

if (TMath::Abs(averageTotalEnergy - averageTotalEnergyRef) / averageTotalEnergyRef > tolerance) {
cout << "The average total energy does not match the reference value of " << averageTotalEnergyRef
<< endl;
return 12;
return 13;
}

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 13;
return 14;
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/04.MuonScan/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/06.IonRecoils/Validate.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Int_t Validate(const char* filename) {
const bool isReferenceGeant4Version = geant4Metadata->GetGeant4Version() == "10.4.3";

double averageNumberOfHits = 0;
const double averageNumberOfHitsRef = (!isReferenceGeant4Version) ? 14413.5 : 11223.0;
const double averageNumberOfHitsRef = (!isReferenceGeant4Version) ? 14417.5 : 11223.0;
const double tolerance = 0.001;

for (int i = 0; i < run.GetEntries(); i++) {
Expand Down
2 changes: 1 addition & 1 deletion examples/06.IonRecoils/geometry/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/07.FullChainDecay/geometry/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
23 changes: 12 additions & 11 deletions examples/08.Alphas/Validate.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,50 +24,51 @@ Int_t Validate() {
constexpr Double_t thetaAverageRef = 1.5767;

Double_t phiAverage = analysisTree->GetObservableAverage("g4Ana_phiPrimary");
constexpr Double_t phiAverageRef = 0.069711;
constexpr Double_t phiAverageRef = 0.0719113;

cout << "entry 100, theta: " << thetaSample << ", phi: " << phiSample << endl;
cout << "average theta: " << thetaAverage << ", average phi: " << phiAverage << endl;

if (h1->Integral() != 1989) {
cout << "Wrong number of alphas produced at 1MeV_5um!" << endl;
if (h1->Integral() != 1984) {
cout << "Wrong number of alphas produced at (h1) 1MeV_5um!" << endl;
cout << "Histogram contains : " << h1->Integral() << endl;
return 10;
}

if (h2->Integral() != 7422) {
cout << "Wrong number of alphas produced at 5MeV_5um!" << endl;
if (h2->Integral() != 7432) {
cout << "Wrong number of alphas produced at (h2) 5MeV_5um!" << endl;
cout << "Histogram contains : " << h2->Integral() << endl;
return 20;
}

if (h3->Integral() != 9417) {
cout << "Wrong number of alphas produced at 5MeV_1um!" << endl;
if (h3->Integral() != 9430) {
cout << "Wrong number of alphas produced at (h3) 5MeV_1um!" << endl;
cout << "Histogram contains : " << h3->Integral() << endl;
return 30;
}

if (TMath::Abs(thetaSample - thetaSampleRef) / thetaSampleRef >= 0.01) {
cout << "Wrong theta angle value for entry 100!" << endl;
cout << "Theta value is : " << thetaSample << endl;
cout << "Theta value is : " << thetaSample << " while it should be : " << thetaSampleRef << endl;
return 60;
}

if (TMath::Abs(phiSample - phiSampleRef) / phiSampleRef >= 0.01) {
cout << "Wrong phi angle value for entry 100!" << endl;
cout << "Phi value is : " << phiSample << endl;
cout << "Phi value is : " << phiSample << " while it should be : " << phiSampleRef << endl;
return 60;
}

if (TMath::Abs(thetaAverage - thetaAverageRef) / thetaAverageRef >= 0.01) {
cout << "Wrong theta angle average!" << endl;
cout << "Theta angle average : " << thetaAverage << " while it should be : " << 1.589 << endl;
cout << "Theta angle average : " << thetaAverage << " while it should be : " << thetaAverageRef
<< endl;
return 80;
}

if (TMath::Abs(phiAverage - phiAverageRef) / phiAverageRef >= 0.01) {
cout << "Wrong phi angle average!" << endl;
cout << "Phi angle average : " << phiAverage << " while it should be : " << 0.027 << endl;
cout << "Phi angle average : " << phiAverage << " while it should be : " << phiAverageRef << endl;
return 90;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/08.Alphas/geometry/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/09.Pb210_Shield/geometry/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/10.Geometries/geometry/noAssembly/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/11.Xrays/geometry/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
2 changes: 1 addition & 1 deletion examples/12.Generators/geometry/setup.gdml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!DOCTYPE gdml [
<!ENTITY geometry SYSTEM "geometry.gdml">
<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">
<!ENTITY materials SYSTEM "https://rest-for-physics.github.io/materials/rest.xml">
]>

<gdml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down