LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
IOVData

Files

file  ChannelStatus.h
 Class def header for a class ChannelStatus.
 
file  ChData.h
 Class def header for a class ChData.
 
file  DetPedestal.h
 Class def header for a class DetPedestal.
 
file  ElectronicsCalib.h
 Class def header for a class ElectronicsCalib.
 
file  IOVDataError.h
 Collection of exception classes for IOVData.
 
file  IOVTimeStamp.cxx
 Implementation for class IOVTimeStamp.
 
file  IOVTimeStamp.h
 Class def header for a class IOVTimeStamp.
 
file  PmtGain.h
 Class def header for a class PmtGain.
 

Namespaces

 lariov
 Filters for channels, events, etc.
 

Classes

class  lariov::IOVTimeStamp
 

Functions

 lariov::IOVTimeStamp::IOVTimeStamp (unsigned long stamp, unsigned int substamp=0)
 Constructor. More...
 
virtual lariov::IOVTimeStamp::~IOVTimeStamp ()
 Default destructor. More...
 
unsigned long lariov::IOVTimeStamp::Stamp () const
 
unsigned long lariov::IOVTimeStamp::SubStamp () const
 
const std::string & lariov::IOVTimeStamp::DBStamp () const
 
void lariov::IOVTimeStamp::SetStamp (unsigned long stamp, unsigned int substamp=0)
 
void lariov::IOVTimeStamp::CalcDBStamp ()
 
static IOVTimeStamp lariov::IOVTimeStamp::GetFromString (const std::string &ts)
 
static IOVTimeStamp lariov::IOVTimeStamp::MinTimeStamp ()
 
static IOVTimeStamp lariov::IOVTimeStamp::MaxTimeStamp ()
 
bool lariov::IOVTimeStamp::operator< (const IOVTimeStamp &ts) const
 comparison operators More...
 
bool lariov::IOVTimeStamp::operator<= (const IOVTimeStamp &ts) const
 
bool lariov::IOVTimeStamp::operator>= (const IOVTimeStamp &ts) const
 
bool lariov::IOVTimeStamp::operator> (const IOVTimeStamp &ts) const
 
bool lariov::IOVTimeStamp::operator== (const IOVTimeStamp &ts) const
 implementation of equality operator More...
 
bool lariov::IOVTimeStamp::operator!= (const IOVTimeStamp &ts) const
 remaining comparison operators implemented in terms of == and < More...
 
IOVTimeStamp & lariov::IOVTimeStamp::operator= (const IOVTimeStamp &ts)
 assignment operator More...
 

Variables

unsigned long lariov::IOVTimeStamp::fStamp
 
unsigned int lariov::IOVTimeStamp::fSubStamp
 
std::string lariov::IOVTimeStamp::fDBStamp
 

Detailed Description

Function Documentation

void lariov::IOVTimeStamp::CalcDBStamp ( )

This function combines the stamp and substamp into a unique string to be used as a database timestamp.

Create unique database timestamp of the form <fStamp>.<fSubStamp>, where fSubStamp is prepended with zeroes to ensure six digits

Definition at line 26 of file IOVTimeStamp.cxx.

References lariov::IOVTimeStamp::fDBStamp, lariov::IOVTimeStamp::fStamp, lariov::IOVTimeStamp::fSubStamp, lariov::kMAX_SUBSTAMP_LENGTH, and lariov::kMAX_SUBSTAMP_VALUE.

Referenced by lariov::IOVTimeStamp::IOVTimeStamp(), and lariov::IOVTimeStamp::SetStamp().

27  {
29  throw IOVDataError("SubStamp of an IOVTimeStamp cannot have more than six digits!");
30  }
31  std::stringstream stream;
32  stream << fStamp << "." << std::setfill('0') << std::setw(kMAX_SUBSTAMP_LENGTH) << fSubStamp;
33  fDBStamp = stream.str();
34  }
const unsigned int kMAX_SUBSTAMP_VALUE
unsigned int fSubStamp
Definition: IOVTimeStamp.h:72
unsigned long fStamp
Definition: IOVTimeStamp.h:71
const unsigned short kMAX_SUBSTAMP_LENGTH
std::string fDBStamp
Definition: IOVTimeStamp.h:74
const std::string& lariov::IOVTimeStamp::DBStamp ( ) const
inline
IOVTimeStamp lariov::IOVTimeStamp::GetFromString ( const std::string &  ts)
static

Definition at line 36 of file IOVTimeStamp.cxx.

References lariov::IOVTimeStamp::IOVTimeStamp(), and lariov::kMAX_SUBSTAMP_LENGTH.

Referenced by lariov::DBDataset::DBDataset(), lariov::TimeStampDecoder::DecodeTimeStamp(), and lariov::IOVTimeStamp::SetStamp().

37  {
38  unsigned long stamp;
39  std::string substamp_str;
40  if (ts.find_first_of(".") == std::string::npos) {
41  stamp = std::stoul(ts);
42  substamp_str = "0";
43  }
44  else {
45  stamp = std::stoul(ts.substr(0, ts.find_first_of(".")));
46  substamp_str = ts.substr(ts.find_first_of(".") + 1);
47  }
48 
49  if (substamp_str.length() > kMAX_SUBSTAMP_LENGTH) {
50  throw IOVDataError("SubStamp of an IOVTimeStamp cannot have more than six digits!");
51  }
52  while (substamp_str.length() < kMAX_SUBSTAMP_LENGTH)
53  substamp_str += "0";
54  unsigned int substamp = std::stoi(substamp_str);
55 
56  return IOVTimeStamp(stamp, substamp);
57  }
IOVTimeStamp(unsigned long stamp, unsigned int substamp=0)
Constructor.
Definition: IOVTimeStamp.h:28
const unsigned short kMAX_SUBSTAMP_LENGTH
lariov::IOVTimeStamp::IOVTimeStamp ( unsigned long  stamp,
unsigned int  substamp = 0 
)
inline

Constructor.

Definition at line 28 of file IOVTimeStamp.h.

References lariov::IOVTimeStamp::CalcDBStamp().

Referenced by lariov::IOVTimeStamp::GetFromString(), lariov::IOVTimeStamp::MaxTimeStamp(), and lariov::IOVTimeStamp::MinTimeStamp().

29  : fStamp(stamp), fSubStamp(substamp)
30  {
31  this->CalcDBStamp();
32  }
unsigned int fSubStamp
Definition: IOVTimeStamp.h:72
unsigned long fStamp
Definition: IOVTimeStamp.h:71
IOVTimeStamp lariov::IOVTimeStamp::MinTimeStamp ( )
static

Definition at line 59 of file IOVTimeStamp.cxx.

References lariov::IOVTimeStamp::IOVTimeStamp().

Referenced by lariov::IOVTimeStamp::SetStamp().

60  {
61  return IOVTimeStamp(0, 0);
62  }
IOVTimeStamp(unsigned long stamp, unsigned int substamp=0)
Constructor.
Definition: IOVTimeStamp.h:28
bool lariov::IOVTimeStamp::operator!= ( const IOVTimeStamp ts) const

remaining comparison operators implemented in terms of == and <

Definition at line 98 of file IOVTimeStamp.cxx.

Referenced by lariov::IOVTimeStamp::SetStamp().

99  {
100  return !(*this == ts);
101  }
bool lariov::IOVTimeStamp::operator< ( const IOVTimeStamp ts) const

comparison operators

implementation of operator<

Definition at line 80 of file IOVTimeStamp.cxx.

References lariov::IOVTimeStamp::Stamp(), and lariov::IOVTimeStamp::SubStamp().

Referenced by lariov::IOVTimeStamp::SetStamp().

81  {
82  if (this->Stamp() < ts.Stamp())
83  return true;
84  else if (this->Stamp() == ts.Stamp() && this->SubStamp() < ts.SubStamp())
85  return true;
86  else
87  return false;
88  }
unsigned long SubStamp() const
Definition: IOVTimeStamp.h:38
unsigned long Stamp() const
Definition: IOVTimeStamp.h:37
bool lariov::IOVTimeStamp::operator<= ( const IOVTimeStamp ts) const

Definition at line 103 of file IOVTimeStamp.cxx.

Referenced by lariov::IOVTimeStamp::SetStamp().

104  {
105  if (*this < ts || *this == ts)
106  return true;
107  else
108  return false;
109  }
IOVTimeStamp & lariov::IOVTimeStamp::operator= ( const IOVTimeStamp ts)

assignment operator

implementation of assignment operator

Definition at line 70 of file IOVTimeStamp.cxx.

References lariov::IOVTimeStamp::DBStamp(), lariov::IOVTimeStamp::fDBStamp, lariov::IOVTimeStamp::fStamp, lariov::IOVTimeStamp::fSubStamp, lariov::IOVTimeStamp::Stamp(), and lariov::IOVTimeStamp::SubStamp().

Referenced by lariov::IOVTimeStamp::SetStamp().

71  {
72  if (this == &ts) return *this;
73  fStamp = ts.Stamp();
74  fSubStamp = ts.SubStamp();
75  fDBStamp = ts.DBStamp();
76  return *this;
77  }
unsigned int fSubStamp
Definition: IOVTimeStamp.h:72
unsigned long fStamp
Definition: IOVTimeStamp.h:71
std::string fDBStamp
Definition: IOVTimeStamp.h:74
bool lariov::IOVTimeStamp::operator== ( const IOVTimeStamp ts) const

implementation of equality operator

Definition at line 91 of file IOVTimeStamp.cxx.

References lariov::IOVTimeStamp::fStamp, lariov::IOVTimeStamp::fSubStamp, lariov::IOVTimeStamp::Stamp(), and lariov::IOVTimeStamp::SubStamp().

Referenced by lariov::IOVTimeStamp::SetStamp().

92  {
93  if (fStamp == ts.Stamp() && fSubStamp == ts.SubStamp()) return true;
94  return false;
95  }
unsigned int fSubStamp
Definition: IOVTimeStamp.h:72
unsigned long fStamp
Definition: IOVTimeStamp.h:71
bool lariov::IOVTimeStamp::operator> ( const IOVTimeStamp ts) const

Definition at line 119 of file IOVTimeStamp.cxx.

Referenced by lariov::IOVTimeStamp::SetStamp().

120  {
121  if (!(*this <= ts))
122  return true;
123  else
124  return false;
125  }
bool lariov::IOVTimeStamp::operator>= ( const IOVTimeStamp ts) const

Definition at line 111 of file IOVTimeStamp.cxx.

Referenced by lariov::IOVTimeStamp::SetStamp().

112  {
113  if (!(*this < ts))
114  return true;
115  else
116  return false;
117  }
virtual lariov::IOVTimeStamp::~IOVTimeStamp ( )
inlinevirtual

Default destructor.

Definition at line 35 of file IOVTimeStamp.h.

35 {}

Variable Documentation

std::string lariov::IOVTimeStamp::fDBStamp
protected