Skip to content

Commit

Permalink
Merge pull request #534 from rest-for-physics/run-methods
Browse files Browse the repository at this point in the history
TRestRun methods and cleanup
  • Loading branch information
lobis authored Jul 31, 2024
2 parents f90dfa2 + 83c59f7 commit 225f32c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
17 changes: 11 additions & 6 deletions source/framework/core/inc/TRestRun.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class TRestRun : public TRestMetadata {
GetEntry(fCurrentEvent + 1);
}

TString FormFormat(const TString& FilenameFormat);
TFile* MergeToOutputFile(std::vector<std::string> filefullnames, std::string outputfilename = "");
TString FormFormat(const TString& filenameFormat);
TFile* MergeToOutputFile(std::vector<std::string> fileFullNames, std::string outputFileName = "");
TFile* FormOutputFile();
TFile* UpdateOutputFile();

Expand Down Expand Up @@ -143,7 +143,7 @@ class TRestRun : public TRestMetadata {
inline TFile* GetInputFile() const { return fInputFile; }
inline TFile* GetOutputFile() const { return fOutputFile; }
inline int GetCurrentEntry() const { return fCurrentEvent; }
inline Long64_t GetBytesReaded() const { return fBytesRead; }
inline Long64_t GetBytesRead() const { return fBytesRead; }
Long64_t GetTotalBytes();
Long64_t GetEntries() const;

Expand Down Expand Up @@ -176,6 +176,7 @@ class TRestRun : public TRestMetadata {
std::vector<std::string> GetMetadataNames();
std::vector<std::string> GetMetadataTitles();
inline int GetNumberOfMetadata() const { return fMetadata.size(); }
Double_t GetElapsedTimeSeconds() const { return fEndTime - fStartTime; }

inline std::string GetMetadataMember(const std::string& instr) { return ReplaceMetadataMember(instr); }
std::string ReplaceMetadataMembers(const std::string& instr, Int_t precision = 8);
Expand All @@ -191,7 +192,6 @@ class TRestRun : public TRestMetadata {
inline void SetOutputFileName(const std::string& s) { fOutputFileName = s; }
void SetExtProcess(TRestEventProcess* p);
inline void SetCurrentEntry(int i) { fCurrentEvent = i; }
// void AddFileTask(TRestFileTask* t) { fFileTasks.push_back(t); }
void SetInputEvent(TRestEvent* event);
inline void SetRunNumber(Int_t number) { fRunNumber = number; }
inline void SetParentRunNumber(Int_t number) { fParentRunNumber = number; }
Expand All @@ -215,14 +215,17 @@ class TRestRun : public TRestMetadata {
inline void SetNFilesSplit(int n) { fNFilesSplit = n; }
inline void HangUpEndFile() { fHangUpEndFile = true; }
inline void ReleaseEndFile() { fHangUpEndFile = false; }

// Printers
void PrintStartDate();
void PrintEndDate();

void PrintMetadata() override;
inline void PrintAllMetadata() {
PrintMetadata();
for (unsigned int i = 0; i < fMetadata.size(); i++) fMetadata[i]->PrintMetadata();
for (unsigned int i = 0; i < fMetadata.size(); i++) {
fMetadata[i]->PrintMetadata();
}
}
inline void PrintTrees() const {
if (fEventTree != nullptr) {
Expand All @@ -237,7 +240,9 @@ class TRestRun : public TRestMetadata {
}
}
void PrintObservables() {
if (fAnalysisTree != nullptr) fAnalysisTree->PrintObservables();
if (fAnalysisTree != nullptr) {
fAnalysisTree->PrintObservables();
}
}

inline void PrintEvent() const { fInputEvent->PrintEvent(); }
Expand Down
6 changes: 3 additions & 3 deletions source/framework/core/src/TRestProcessRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ void TRestProcessRunner::PrintProcessedEvents(Int_t rateE) {
if (fEventsToProcess == REST_MAXIMUM_EVENTS && fRunInfo->GetFileProcess() != nullptr)
// Nevents is unknown, reading external data file
{
prog = fRunInfo->GetBytesReaded() / (double)fRunInfo->GetTotalBytes() * 100;
prog = fRunInfo->GetBytesRead() / (double)fRunInfo->GetTotalBytes() * 100;
} else if (fRunInfo->GetFileProcess() != nullptr)
// Nevents is known, reading external data file
{
Expand Down Expand Up @@ -1140,8 +1140,8 @@ void TRestProcessRunner::PrintProcessedEvents(Int_t rateE) {
fflush(stdout);
}

bytesAdded[poscalculated] = fRunInfo->GetBytesReaded() - bytesReaded_last;
bytesReaded_last = fRunInfo->GetBytesReaded();
bytesAdded[poscalculated] = fRunInfo->GetBytesRead() - bytesReaded_last;
bytesReaded_last = fRunInfo->GetBytesRead();
progAdded[poscalculated] = prog - prog_last;
prog_last = prog;

Expand Down

0 comments on commit 225f32c

Please sign in to comment.