LDMX Software
Public Member Functions | Private Attributes | List of all members
framework::ConditionsIOV Class Reference

Class which defines the run/event/type range for which a given condition is valid, including for all time. More...

#include <ConditionsIOV.h>

Public Member Functions

 ConditionsIOV ()
 Constructor for null validity.
 
 ConditionsIOV (bool validForData, bool validForMC)
 Constructor for a unlimited validity.
 
 ConditionsIOV (int firstRun, int lastRun, bool validForData=true, bool validForMC=true)
 Constructor for a run-limited validity.
 
bool validForEvent (const ldmx::EventHeader &eh) const
 Checks to see if this condition is valid for the given event using information from the header.
 
bool overlaps (const ConditionsIOV &iov) const
 Checks to see if this IOV overlaps with the given IOV.
 
void Print () const
 Print the object to std::cout.
 
std::string ToString () const
 Print the object to a string.
 
void stream (std::ostream &) const
 Stream the object contents to an output stream.
 

Private Attributes

int firstRun_
 First run for which this condition is valid.
 
int lastRun_
 Last run for which this condition is valid or -1 for infinite validity.
 
bool validForData_
 Is this Condition valid for real data?
 
bool validForMC_
 Is this Condition valid for simulation?
 

Detailed Description

Class which defines the run/event/type range for which a given condition is valid, including for all time.

Definition at line 34 of file ConditionsIOV.h.

Constructor & Destructor Documentation

◆ ConditionsIOV() [1/3]

framework::ConditionsIOV::ConditionsIOV ( )
inline

Constructor for null validity.

Definition at line 39 of file ConditionsIOV.h.

40 : firstRun_{0}, lastRun_{0}, validForData_{false}, validForMC_{false} {}
int lastRun_
Last run for which this condition is valid or -1 for infinite validity.
bool validForMC_
Is this Condition valid for simulation?
bool validForData_
Is this Condition valid for real data?
int firstRun_
First run for which this condition is valid.

◆ ConditionsIOV() [2/3]

framework::ConditionsIOV::ConditionsIOV ( bool  validForData,
bool  validForMC 
)
inline

Constructor for a unlimited validity.

Definition at line 45 of file ConditionsIOV.h.

46 : firstRun_(-1),
47 lastRun_(-1),
48 validForData_{validForData},
49 validForMC_{validForMC} {}

◆ ConditionsIOV() [3/3]

framework::ConditionsIOV::ConditionsIOV ( int  firstRun,
int  lastRun,
bool  validForData = true,
bool  validForMC = true 
)
inline

Constructor for a run-limited validity.

  • firstRun should be -1 if valid from beginning of time
  • lastRun should be -1 if valid to end of time

Definition at line 56 of file ConditionsIOV.h.

58 : firstRun_(firstRun),
59 lastRun_(lastRun),
60 validForData_{validForData},
61 validForMC_{validForMC} {}

Member Function Documentation

◆ overlaps()

bool framework::ConditionsIOV::overlaps ( const ConditionsIOV iov) const

Checks to see if this IOV overlaps with the given IOV.

Definition at line 21 of file ConditionsIOV.cxx.

21 {
22 if (iov.validForData_ != validForData_ && iov.validForMC_ != validForMC_)
23 return false;
24 if (iov.firstRun_ < lastRun_) return false; // starts after this IOV
25 if (iov.lastRun_ < firstRun_) return false; // ends before this IOV
26 return true;
27}

References firstRun_, lastRun_, validForData_, and validForMC_.

◆ Print()

void framework::ConditionsIOV::Print ( ) const

Print the object to std::cout.

Definition at line 29 of file ConditionsIOV.cxx.

29 {
30 stream(std::cout);
31 std::cout << std::endl;
32}
void stream(std::ostream &) const
Stream the object contents to an output stream.

References stream().

◆ stream()

void framework::ConditionsIOV::stream ( std::ostream &  s) const

Stream the object contents to an output stream.

Definition at line 40 of file ConditionsIOV.cxx.

40 {
41 s << "IOV(" << firstRun_ << "->";
42 if (lastRun_ == -1)
43 s << "[all runs]";
44 else
45 s << lastRun_;
46 if (validForData_) s << ",Data";
47 if (validForMC_) s << ",MC";
48 s << ")";
49}

References firstRun_, lastRun_, validForData_, and validForMC_.

Referenced by Print(), and ToString().

◆ ToString()

std::string framework::ConditionsIOV::ToString ( ) const

Print the object to a string.

Definition at line 34 of file ConditionsIOV.cxx.

34 {
35 std::stringstream s;
36 stream(s);
37 return s.str();
38}

References stream().

◆ validForEvent()

bool framework::ConditionsIOV::validForEvent ( const ldmx::EventHeader eh) const

Checks to see if this condition is valid for the given event using information from the header.

Definition at line 15 of file ConditionsIOV.cxx.

15 {
16 return (eh.getRun() >= firstRun_ || firstRun_ == -1) &&
17 (eh.getRun() <= lastRun_ || lastRun_ == -1) &&
18 ((eh.isRealData()) ? (validForData_) : (validForMC_));
19}
int getRun() const
Return the run number.
Definition EventHeader.h:84
bool isRealData() const
Is this a real data event?

References firstRun_, ldmx::EventHeader::getRun(), ldmx::EventHeader::isRealData(), lastRun_, validForData_, and validForMC_.

Member Data Documentation

◆ firstRun_

int framework::ConditionsIOV::firstRun_
private

First run for which this condition is valid.

Definition at line 87 of file ConditionsIOV.h.

Referenced by overlaps(), stream(), and validForEvent().

◆ lastRun_

int framework::ConditionsIOV::lastRun_
private

Last run for which this condition is valid or -1 for infinite validity.

Definition at line 90 of file ConditionsIOV.h.

Referenced by overlaps(), stream(), and validForEvent().

◆ validForData_

bool framework::ConditionsIOV::validForData_
private

Is this Condition valid for real data?

Definition at line 93 of file ConditionsIOV.h.

Referenced by overlaps(), stream(), and validForEvent().

◆ validForMC_

bool framework::ConditionsIOV::validForMC_
private

Is this Condition valid for simulation?

Definition at line 96 of file ConditionsIOV.h.

Referenced by overlaps(), stream(), and validForEvent().


The documentation for this class was generated from the following files: