Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRestRun methods and cleanup #534

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading