added run duration

This commit is contained in:
nemu 2011-09-08 15:18:18 +00:00
parent 628b15fb96
commit fc31214dec
2 changed files with 25 additions and 0 deletions

View File

@ -397,6 +397,18 @@ Bool_t TPsiRunHeader::IsValid(Bool_t strict)
return true;
}
//--------------------------------------------------------------------------
// GetHistoName (public)
//--------------------------------------------------------------------------
/**
* <p>returns the run duration, i.e. run stop - run start time in seconds.
*/
Int_t TPsiRunHeader::GetRunDuration() const
{
return fStopTime.Convert() - fStartTime.Convert();
}
//--------------------------------------------------------------------------
// GetHistoName (public)
//--------------------------------------------------------------------------
@ -628,6 +640,11 @@ TObjArray* TPsiRunHeader::GetHeader(UInt_t &count)
tostr = new TObjString(str);
fHeader.AddLast(tostr);
// add run duration
str.Form("%03d - Run Duration: %d", count++, GetRunDuration());
tostr = new TObjString(str);
fHeader.AddLast(tostr);
// add laboratory
str.Form("%03d - Laboratory: %s", count++, fLaboratory.Data());
tostr = new TObjString(str);
@ -1063,6 +1080,10 @@ Bool_t TPsiRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString pa
idx = str.Index(":");
str.Remove(0, idx+2);
fSampleCryoInsert = str;
} else if (str.Contains("- Magnet Name: ")) {
idx = str.Index(":");
str.Remove(0, idx+2);
fMagnetName = str;
} else if (str.Contains("- No of Histos: ")) {
tokens = str.Tokenize(":");
if (tokens->GetEntries() < 2) {
@ -1528,6 +1549,9 @@ void TPsiRunHeader::DumpHeader() const
// write stop time
cout << endl << setw(name_width) << left << "Run Stop Time" << setw(old_width) << ": " << GetStopTimeString();
// write run duration
cout << endl << setw(name_width) << left << "Run Duration" << setw(old_width) << ": " << GetRunDuration();
// write laboratory
cout << endl << setw(name_width) << left << "Laboratory" << setw(old_width) << ": " << GetLaboratory().Data();

View File

@ -93,6 +93,7 @@ public:
virtual const char* GetStartTimeString() const { return fStartTime.AsSQLString(); }
virtual TDatime GetStopTime() const { return fStopTime; }
virtual const char* GetStopTimeString() const { return fStopTime.AsSQLString(); }
virtual Int_t GetRunDuration() const;
virtual TString GetLaboratory() const { return fLaboratory; }
virtual TString GetArea() const { return fArea; }
virtual TString GetInstrument() const { return fInstrument; }