Skip to content

Commit

Permalink
Merge pull request #14 from rest-for-physics/wall_validation
Browse files Browse the repository at this point in the history
Wall validation
  • Loading branch information
jgalan authored Jul 9, 2021
2 parents 47123ab + a6f04e6 commit 18b62f2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build:
type: build
script:
- echo "**${CI_PROJECT_DIR}**"
- git clone --single-branch --branch master https://github.com/rest-for-physics/framework.git framework
- git clone https://github.com/rest-for-physics/framework.git framework
- cd framework
- ./scripts/checkoutRemoteBranch.sh ${CI_COMMIT_BRANCH}
- if [ -d ${CI_PROJECT_DIR}/install ]; then rm -rf ${CI_PROJECT_DIR}/install; fi
Expand Down Expand Up @@ -106,6 +106,8 @@ loadRESTLibs:
- restG4 Muon.rml
- geant4-config --version
- restRoot -b -q Validate.C'("Run00111_restG4_MuonsFromPoint_rest.root")'
- restG4 CosmicMuons.rml
- restRoot -b -q ValidateWall.C'("Run00111_restG4_MuonsFromWall_rest.root")'

05_PandaXIII:
type: examples
Expand Down
4 changes: 2 additions & 2 deletions examples/04.MuonScan/CosmicMuons.rml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ First concept author G. Luzón (16-11-2020) -->
<parameter name="outputFileName" value="Run[fRunNumber]_[fRunType]_[fRunTag]_[fRunUser].root" />
</TRestRun>

<TRestGeant4Metadata name="restG4 run" title="Simulation_cosmic_muons_from_wall">
<TRestGeant4Metadata name="restG4 run" title="MuonsFromWall">

<parameter name="gdml_file" value="setup.gdml"/>
<parameter name="subEventTimeDelay" value="100us" />
Expand All @@ -26,7 +26,7 @@ First concept author G. Luzón (16-11-2020) -->
<parameter name="saveAllEvents" value="false" />
<parameter name="printProgress" value="true" />

<generator type="virtualWall" position="(0,0,-50)cm" lenX="30cm" lenY="30cm" rotation="(90,0,0)" >
<generator type="surface" shape="wall" position="(0,0,-50)cm" size="(30,30,0)cm" rotation="(90,0,0)" >
<source particle="mu-" excitedLevel="0.0" fullChain="on">
<energyDist type="TH1D" file="Muons.root" spctName="cosmicmuon" />
<angularDist type="TH1D" file="CosmicAngles.root" spctName="Theta2" />
Expand Down
35 changes: 35 additions & 0 deletions examples/04.MuonScan/ValidateWall.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

Int_t ValidateWall(string fname) {
gSystem->Load("libRestFramework.so");
gSystem->Load("libRestGeant4.so");

TRestRun* run = new TRestRun(fname);
TRestGeant4Event* ev = (TRestGeant4Event*)run->GetInputEvent();

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

Double_t r = 0;
for (Int_t n = 0; n < run->GetEntries(); n++) {
run->GetEntry(n);
Double_t x = ev->GetPrimaryEventOrigin().X();
Double_t y = ev->GetPrimaryEventOrigin().Y();

r += x * x + y * y;
}
r /= run->GetEntries();

if ((Int_t)(1000. * r) / 1000 < 10000 || (Int_t)(1000. * r) / 1000 > 20000) {
cout << "The average radius of the distribution is wrong!" << endl;
cout << "R: " << (Int_t)(1000. * r) / 1000 << endl;
return 5;
}

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

return 0;
}

0 comments on commit 18b62f2

Please sign in to comment.