Skip to content

Commit

Permalink
Merge pull request #115 from rest-for-physics/lobis-remote-file
Browse files Browse the repository at this point in the history
Remote geometry file
  • Loading branch information
lobis authored Sep 21, 2023
2 parents d4c4d95 + 09e50f0 commit 5c51ec5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/TRestGeant4Metadata.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,14 @@ void TRestGeant4Metadata::InitFromConfigFile() {
cout << "\"gdmlFile\" parameter is not defined!" << endl;
exit(1);
}
if (TRestTools::isURL(fGdmlFilename.Data())) {
fGeometryPath = "";
fGdmlFilename = TRestTools::DownloadRemoteFile(fGdmlFilename.Data());
if (fGdmlFilename == "") {
cout << "Error downloading geometry file from URL: " << fGdmlFilename << endl;
exit(1);
}
}

fGeometryPath = GetParameter("geometryPath", "");

Expand All @@ -818,7 +826,7 @@ void TRestGeant4Metadata::InitFromConfigFile() {
// if "gdmlFile" is purely a file (without any path) and "geometryPath" is
// defined, we recombine them together
if ((((string)fGdmlFilename).find_first_not_of("./~") == 0 ||
((string)fGdmlFilename).find("/") == string::npos) &&
((string)fGdmlFilename).find('/') == string::npos) &&
fGeometryPath != "") {
if (fGeometryPath[fGeometryPath.Length() - 1] == '/') {
fGdmlFilename = fGeometryPath + GetParameter("gdmlFile");
Expand Down Expand Up @@ -945,7 +953,7 @@ Double_t TRestGeant4Metadata::GetCosmicIntensityInCountsPerSecond() const {

Double_t TRestGeant4Metadata::GetEquivalentSimulatedTime() const {
const auto countsPerSecond = GetCosmicIntensityInCountsPerSecond();
const auto seconds = fNEvents / countsPerSecond;
const auto seconds = double(fNEvents) / countsPerSecond;
return seconds;
}

Expand Down

0 comments on commit 5c51ec5

Please sign in to comment.