-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from rest-for-physics/wall_validation
Wall validation
- Loading branch information
Showing
3 changed files
with
40 additions
and
3 deletions.
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
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,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; | ||
} |