LDMX Software
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 first_run_
 First run for which this condition is valid.
 
int last_run_
 Last run for which this condition is valid or -1 for infinite validity.
 
bool valid_for_data_
 Is this Condition valid for real data?
 
bool valid_for_mc_
 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 : first_run_{0},
41 last_run_{0},
42 valid_for_data_{false},
43 valid_for_mc_{false} {}
int last_run_
Last run for which this condition is valid or -1 for infinite validity.
bool valid_for_data_
Is this Condition valid for real data?
int first_run_
First run for which this condition is valid.
bool valid_for_mc_
Is this Condition valid for simulation?

◆ ConditionsIOV() [2/3]

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

Constructor for a unlimited validity.

Definition at line 48 of file ConditionsIOV.h.

49 : first_run_(-1),
50 last_run_(-1),
51 valid_for_data_{validForData},
52 valid_for_mc_{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 59 of file ConditionsIOV.h.

61 : first_run_(firstRun),
62 last_run_(lastRun),
63 valid_for_data_{validForData},
64 valid_for_mc_{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.valid_for_data_ != valid_for_data_ &&
23 iov.valid_for_mc_ != valid_for_mc_)
24 return false;
25 if (iov.first_run_ < last_run_) return false; // starts after this IOV
26 if (iov.last_run_ < first_run_) return false; // ends before this IOV
27 return true;
28}

References first_run_, last_run_, valid_for_data_, and valid_for_mc_.

◆ print()

void framework::ConditionsIOV::print ( ) const

Print the object to std::cout.

Definition at line 30 of file ConditionsIOV.cxx.

30 {
31 stream(std::cout);
32 std::cout << std::endl;
33}
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 41 of file ConditionsIOV.cxx.

41 {
42 s << "IOV(" << first_run_ << "->";
43 if (last_run_ == -1)
44 s << "[all runs]";
45 else
46 s << last_run_;
47 if (valid_for_data_) s << ",Data";
48 if (valid_for_mc_) s << ",MC";
49 s << ")";
50}

References first_run_, last_run_, valid_for_data_, and valid_for_mc_.

Referenced by print(), and toString().

◆ toString()

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

Print the object to a string.

Definition at line 35 of file ConditionsIOV.cxx.

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

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() >= first_run_ || first_run_ == -1) &&
17 (eh.getRun() <= last_run_ || last_run_ == -1) &&
19}
int getRun() const
Return the run number.
Definition EventHeader.h:84
bool isRealData() const
Is this a real data event?

References first_run_, ldmx::EventHeader::getRun(), ldmx::EventHeader::isRealData(), last_run_, valid_for_data_, and valid_for_mc_.

Member Data Documentation

◆ first_run_

int framework::ConditionsIOV::first_run_
private

First run for which this condition is valid.

Definition at line 90 of file ConditionsIOV.h.

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

◆ last_run_

int framework::ConditionsIOV::last_run_
private

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

Definition at line 93 of file ConditionsIOV.h.

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

◆ valid_for_data_

bool framework::ConditionsIOV::valid_for_data_
private

Is this Condition valid for real data?

Definition at line 96 of file ConditionsIOV.h.

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

◆ valid_for_mc_

bool framework::ConditionsIOV::valid_for_mc_
private

Is this Condition valid for simulation?

Definition at line 99 of file ConditionsIOV.h.

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


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