Skip to content

Commit

Permalink
Merge branch 'master' into jgalan_macos_brew
Browse files Browse the repository at this point in the history
  • Loading branch information
jgalan authored Mar 12, 2024
2 parents ca31bec + 64169ca commit 3b54c8e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 7 additions & 1 deletion source/framework/core/src/TRestEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

#include "TRestEvent.h"

#include "TRestRun.h"

using namespace std;

ClassImp(TRestEvent);
Expand Down Expand Up @@ -170,7 +172,11 @@ void TRestEvent::RestartPad(Int_t nElements) {

void TRestEvent::InitializeWithMetadata(TRestRun* run) { Initialize(); }

void TRestEvent::InitializeReferences(TRestRun* run) { fRun = run; }
void TRestEvent::InitializeReferences(TRestRun* run) {
fRun = run;
SetRunOrigin(fRun->GetRunNumber());
SetSubRunOrigin(fRun->GetSubRunNumber());
}

//////////////////////////////////////////////////////////////////////////
/// Run to print event data info on console
Expand Down
2 changes: 1 addition & 1 deletion source/framework/core/src/TRestMetadata.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ void TRestMetadata::ExpandIncludeFile(TiXmlElement* e) {
url = _filename;
}

filename = TRestTools::DownloadRemoteFile(url);
filename = TRestTools::DownloadRemoteFile(url, true);
} else {
filename = SearchFile(_filename);
}
Expand Down
2 changes: 1 addition & 1 deletion source/framework/tools/inc/TRestTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class TRestTools {

static std::string Execute(std::string cmd);

static std::string DownloadRemoteFile(const std::string& remoteFile);
static std::string DownloadRemoteFile(const std::string& remoteFile, bool pidPrefix = false);
static int DownloadRemoteFile(std::string remoteFile, std::string localFile);
static int UploadToServer(std::string localFile, std::string remoteFile, std::string methodUrl = "");

Expand Down
6 changes: 3 additions & 3 deletions source/framework/tools/src/TRestTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,7 @@ std::istream& TRestTools::GetLine(std::istream& is, std::string& t) {
/// will be used, including scp, wget. Downloads to REST_USER_PATH + "/download/" + filename
/// by default.
///
std::string TRestTools::DownloadRemoteFile(const string& url) {
std::string TRestTools::DownloadRemoteFile(const string& url, bool pidPrefix) {
string pureName = TRestTools::GetPureFileName(url);
if (pureName.empty()) {
RESTWarning << "error! (TRestTools::DownloadRemoteFile): url is not a file!" << RESTendl;
Expand All @@ -1133,7 +1133,8 @@ std::string TRestTools::DownloadRemoteFile(const string& url) {
if (url.find("local:") == 0) {
return Replace(url, "local:", "");
} else {
string fullpath = REST_USER_PATH + "/download/" + pureName;
string fullpath =
REST_USER_PATH + "/download/" + (pidPrefix ? "PID_" + ToString(getpid()) + "_" : "") + pureName;
int out;
int attempts = 10;
do {
Expand All @@ -1153,7 +1154,6 @@ std::string TRestTools::DownloadRemoteFile(const string& url) {
return "";
}
}
return "";
}

///////////////////////////////////////////////
Expand Down

0 comments on commit 3b54c8e

Please sign in to comment.