Skip to content

Commit

Permalink
output directory fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Aug 18, 2024
1 parent f8db155 commit 9e79aa4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/mclient/cmdfetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ as 4th or 5th argument in any command
#include "cmdfetcher.h"
#include "evbuilder.h"
#include "femarray.h"
#include "storage.h"

#include <cstdio>
#include <cstdlib>
Expand Down Expand Up @@ -365,17 +366,18 @@ int CmdFetcher_Main(CmdFetcher* cf) {
fprintf(fRunInfo, "%s\n", detectorStr);
fclose(fRunInfo);

const auto output_directory = mclient_storage::StorageManager::Instance().GetOutputDirectory();
if (savePed) {
sprintf(tmpStr, "cp ped %s/R%05d_%s_Vm_%s_Vd_%s_Pr_%s_Gain_%s_Shape_%s_Clock_%s.ped",
getenv("RAWDATA_PATH"), runNumber, runTagStr, meshVoltageStr, driftFieldStr,
output_directory.c_str(), runNumber, runTagStr, meshVoltageStr, driftFieldStr,
detectorPressureStr, gainStr, shapingStr, clockStr);
system(tmpStr);
savePed = 0;
}

sprintf(tmpStr, "cp %s %s/R%05d_%s_Vm_%s_Vd_%s_Pr_%s_Gain_%s_Shape_%s_Clock_%s.run",
cf->cmd_file,
getenv("RAWDATA_PATH"), runNumber, runTagStr, meshVoltageStr, driftFieldStr,
output_directory.c_str(), runNumber, runTagStr, meshVoltageStr, driftFieldStr,
detectorPressureStr, gainStr, shapingStr, clockStr);
system(tmpStr);
savePed = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/mclient/evbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,8 @@ int EventBuilder_FileAction(EventBuilder* eb,
eb->subrun_ix++;
}

sprintf(&(eb->file_path[0]), "%s", getenv("RAWDATA_PATH"));
const auto output_directory = mclient_storage::StorageManager::Instance().GetOutputDirectory();
sprintf(&(eb->file_path[0]), "%s", output_directory.c_str());

char filename_root[120] = {};
sprintf(filename_root, "%s/%s.%s", &(eb->file_path[0]),
Expand Down
3 changes: 3 additions & 0 deletions src/root/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class StorageManager {
}

void SetOutputDirectory(const std::string& directory);
std::string GetOutputDirectory() const {
return output_directory;
}

private:
// make it a point in the past to force a checkpoint on the first event
Expand Down

0 comments on commit 9e79aa4

Please sign in to comment.