diff --git a/source/framework/core/inc/TRestRun.h b/source/framework/core/inc/TRestRun.h index 41c03c977..8dfcda041 100644 --- a/source/framework/core/inc/TRestRun.h +++ b/source/framework/core/inc/TRestRun.h @@ -17,26 +17,49 @@ class TRestEventProcess; /// Data provider and manager in REST class TRestRun : public TRestMetadata { protected: - // run info - Int_t fRunNumber; //< first identification number - Int_t fParentRunNumber; - TString fRunClassName; - TString fRunType; //< Stores bit by bit the type of run. e.g. calibration, background, pedestal, - // simulation, data taking - TString fRunUser; //< To identify the author it has created the run. It might be also a word describing - // the origin of the run (I.e. REST_Prototype, T-REX, etc) - TString fRunTag; //< A tag to be written to the output file - TString fRunDescription; //< A word or sentence describing the run (I.e. Fe55 calibration, cosmics, etc) + /// The primary run identification number + Int_t fRunNumber; //< + + /// Parent run number of subrun number + Int_t fParentRunNumber; //< + + /// A string to define the run type to the user convenience: restG4, data, calibration, background, etc + TString fRunType; + + /// It identifies the user that produced the file + TString fRunUser; //< + + /// A run tag or keyword describing the data that contains this run: Co60_Neon_1bar, Pb210_Argon_10bar + TString fRunTag; //< + + /// A more detailed description of the contents of this run + TString fRunDescription; //< + + /// The name of the project or experiment this run belongs to: IAXO, TREX-DM, PandaX-III, R&D-micromegas TString fExperimentName; - // program data - TString fInputFileName; + /// The input filename in the case that the run contains already processed data + TString fInputFileName; //< + + /// The output filename. It should match the name of the file where this run is stored TString fOutputFileName; - Double_t fStartTime; ///< Event absolute starting time/date (unix timestamp) - Double_t fEndTime; ///< Event absolute ending time/date (unix timestamp) + + /// Event absolute starting time/date (unix timestamp) + Double_t fStartTime; //< + + /// Event absolute ending time/date (unix timestamp) + Double_t fEndTime; //< + + /// Number of entries found inside the event and analysis tree + Int_t fEntriesSaved; //< + + /// The effective run duration in seconds + Double_t fRunDuration = 0; //< + Int_t fEntriesSaved; Int_t fNFilesSplit; // Number of files being split. Used when retrieving + // data-like metadata objects std::vector fMetadata; //! std::vector fInputMetadata; //! @@ -245,7 +268,8 @@ class TRestRun : public TRestMetadata { TRestRun(const std::string& filename); ~TRestRun(); - ClassDefOverride(TRestRun, 6); + + ClassDefOverride(TRestRun, 7); }; #endif diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index f0ade8380..0616da9bc 100644 --- a/source/framework/core/src/TRestRun.cxx +++ b/source/framework/core/src/TRestRun.cxx @@ -162,6 +162,10 @@ void TRestRun::InitFromConfigFile() { if (ToUpper(runNstr) != "AUTO") { fRunNumber = atoi(runNstr.c_str()); + + fStartTime = gDataBase->query_run(fRunNumber).tstart; + fEndTime = gDataBase->query_run(fRunNumber).tend; + fRunDuration = fEndTime - fStartTime; } if (ToUpper(inputname) == "AUTO") { @@ -680,6 +684,7 @@ void TRestRun::ReadFileInfo(const string& filename) { fclose(fp); if (fEndTime == 0) { fEndTime = buf.st_mtime; + fRunDuration = fEndTime - fStartTime; } if (TRestTools::isRootFile((string)filename)) { @@ -1103,6 +1108,7 @@ void TRestRun::WriteWithDataBase() { time_t timev; time(&timev); fEndTime = (Double_t)timev; + fRunDuration = fEndTime - fStartTime; } fRunUser = REST_USER; @@ -1345,7 +1351,7 @@ Double_t TRestRun::GetRunLength() const { if (fEndTime - fStartTime == -1) { cout << "Run time is not set\n"; } - return fEndTime - fStartTime; + return fRunDuration; } Long64_t TRestRun::GetTotalBytes() {