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

Updating TRestRun metadata members #193

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
54 changes: 39 additions & 15 deletions source/framework/core/inc/TRestRun.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<TRestMetadata*> fMetadata; //!
std::vector<TRestMetadata*> fInputMetadata; //!
Expand Down Expand Up @@ -245,7 +268,8 @@ class TRestRun : public TRestMetadata {
TRestRun(const std::string& filename);
~TRestRun();

ClassDefOverride(TRestRun, 6);

ClassDefOverride(TRestRun, 7);
};

#endif
8 changes: 7 additions & 1 deletion source/framework/core/src/TRestRun.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -1103,6 +1108,7 @@ void TRestRun::WriteWithDataBase() {
time_t timev;
time(&timev);
fEndTime = (Double_t)timev;
fRunDuration = fEndTime - fStartTime;
}

fRunUser = REST_USER;
Expand Down Expand Up @@ -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() {
Expand Down