Belle II Software  release-08-01-10
IntervalOfValidity Class Referencefinal

A class that describes the interval of experiments/runs for which an object in the database is valid. More...

#include <IntervalOfValidity.h>

Public Member Functions

 IntervalOfValidity ()
 Default constructor which will create an empty iov.
 
 IntervalOfValidity (int experimentLow, int runLow, int experimentHigh, int runHigh)
 Construct a new iov. More...
 
 ~IntervalOfValidity ()=default
 Destructor.
 
bool contains (const EventMetaData &event) const
 Function that checks whether the event is inside the validity interval. More...
 
bool empty () const
 Function that checks whether the validity interval is empty. More...
 
bool operator== (const IntervalOfValidity &other) const
 Check whether two intervals of validity are identical.
 
bool operator!= (const IntervalOfValidity &other) const
 Check whether two intervals of validity are different.
 
bool contains (const IntervalOfValidity &iov) const
 Function that checks the validity interval contains another interval of validity. More...
 
bool overlaps (const IntervalOfValidity &iov) const
 Function that checks the validity interval overlaps with another interval of validity. More...
 
IntervalOfValidity overlap (const IntervalOfValidity &iov) const
 Function that determines the overlap of the validity interval with another interval of validity. More...
 
bool trimOverlap (IntervalOfValidity &iov, bool trimOlder=true)
 Remove the overlap between two intervals of validity by shortening one of them. More...
 
int getExperimentLow () const
 Getter for lowest experiment number. More...
 
int getRunLow () const
 Getter for lowest run number. More...
 
int getExperimentHigh () const
 Getter for highest experiment number. More...
 
int getRunHigh () const
 Getter for highest run number. More...
 

Static Public Member Functions

static IntervalOfValidity always ()
 Function that returns an interval of validity that is always valid, c.f. More...
 

Private Member Functions

int checkLowerBound (int experiment, int run) const
 Helper function to check whether a given experiment/run number is above or below the lower bound of the interval of validity. More...
 
int checkUpperBound (int experiment, int run) const
 Helper function to check whether a given experiment/run number is above or below the upper bound of the interval of validity. More...
 
void makeValid ()
 Helper function to set the interval to empty if the upper bound is below the lower one.
 
 ClassDefNV (IntervalOfValidity, 2)
 describes the interval of experiments/runs for which an object in the database is valid.
 

Private Attributes

int m_experimentLow
 Lowest experiment number. More...
 
int m_runLow
 Lowest run number. More...
 
int m_experimentHigh
 Highest experiment number. More...
 
int m_runHigh
 Highest run number. More...
 

Friends

std::istream & operator>> (std::istream &input, IntervalOfValidity &iov)
 Input stream operator for reading IoV data from a text file. More...
 
std::ostream & operator<< (std::ostream &output, const IntervalOfValidity &iov)
 Output stream operator for writing IoV data to a text file. More...
 

Detailed Description

A class that describes the interval of experiments/runs for which an object in the database is valid.

Definition at line 25 of file IntervalOfValidity.h.

Constructor & Destructor Documentation

◆ IntervalOfValidity()

IntervalOfValidity ( int  experimentLow,
int  runLow,
int  experimentHigh,
int  runHigh 
)

Construct a new iov.

Parameters
experimentLowlowest experiment number of the validity range, -1 means no bound
runLowlowest run number in the experiment with number experimentLow of the validity range, -1 means no bound
experimentHighhighest experiment number of the validity range, -1 means no bound
runHighhighest run number in the experiment with number experimentHigh of the validity range, -1 means no bound

Definition at line 17 of file IntervalOfValidity.cc.

Member Function Documentation

◆ always()

static IntervalOfValidity always ( )
inlinestatic

Function that returns an interval of validity that is always valid, c.f.

the default constructor which is never valid (a zero interval)

Returns
an interval of validity that is always valid

Definition at line 62 of file IntervalOfValidity.h.

62 {return IntervalOfValidity(0, 0, -1, -1);};
IntervalOfValidity()
Default constructor which will create an empty iov.

◆ checkLowerBound()

int checkLowerBound ( int  experiment,
int  run 
) const
private

Helper function to check whether a given experiment/run number is above or below the lower bound of the interval of validity.

Parameters
experimentthe experiment number
runthe run number
Returns
0 if the given experiment/run number is equal to the lower bound, -1 if it is below the lower bound, 1 if it is above the lower bound.

Definition at line 40 of file IntervalOfValidity.cc.

◆ checkUpperBound()

int checkUpperBound ( int  experiment,
int  run 
) const
private

Helper function to check whether a given experiment/run number is above or below the upper bound of the interval of validity.

Parameters
experimentthe experiment number
runthe run number
Returns
0 if the given experiment/run number is equal to the upper bound, -1 if it is below the upper bound, 1 if it is above the upper bound.

Definition at line 54 of file IntervalOfValidity.cc.

◆ contains() [1/2]

bool contains ( const EventMetaData event) const

Function that checks whether the event is inside the validity interval.

Parameters
eventevent meta data to be checked, if the run number 0 it's checked whether the whole experiment is inside the validity interval
Returns
true if the given event is inside the validity interval.

Definition at line 80 of file IntervalOfValidity.cc.

◆ contains() [2/2]

bool contains ( const IntervalOfValidity iov) const
inline

Function that checks the validity interval contains another interval of validity.

Parameters
iovthe other validity interval
Returns
true if the given other interval of validity is inside the validity interval.

Definition at line 86 of file IntervalOfValidity.h.

◆ empty()

bool empty ( ) const
inline

Function that checks whether the validity interval is empty.

Returns
true if the validity interval is empty.

Definition at line 55 of file IntervalOfValidity.h.

◆ getExperimentHigh()

int getExperimentHigh ( ) const
inline

Getter for highest experiment number.

-1 means no bound (unless it is a special case described below).

If both m_experimentHigh and m_experimentLow are equal to -1, interval is empty (doesn't match any experiments/runs).

Definition at line 137 of file IntervalOfValidity.h.

◆ getExperimentLow()

int getExperimentLow ( ) const
inline

Getter for lowest experiment number.

-1 means no bound (unless it is a special case described below).

If both m_experimentHigh and m_experimentLow are equal to -1, interval is empty (doesn't match any experiments/runs).

Definition at line 117 of file IntervalOfValidity.h.

◆ getRunHigh()

int getRunHigh ( ) const
inline

Getter for highest run number.

-1 means no bound.

Definition at line 145 of file IntervalOfValidity.h.

◆ getRunLow()

int getRunLow ( ) const
inline

Getter for lowest run number.

-1 means no bound.

Definition at line 125 of file IntervalOfValidity.h.

◆ overlap()

IntervalOfValidity overlap ( const IntervalOfValidity iov) const

Function that determines the overlap of the validity interval with another interval of validity.

Parameters
iovthe other validity interval
Returns
the interval that is common to both intervals of validity.

Definition at line 94 of file IntervalOfValidity.cc.

◆ overlaps()

bool overlaps ( const IntervalOfValidity iov) const
inline

Function that checks the validity interval overlaps with another interval of validity.

Parameters
iovthe other validity interval
Returns
true if both intervals of validity have a common range.

Definition at line 93 of file IntervalOfValidity.h.

◆ trimOverlap()

bool trimOverlap ( IntervalOfValidity iov,
bool  trimOlder = true 
)

Remove the overlap between two intervals of validity by shortening one of them.

This does not work if an interval would be cut into two.

Parameters
iovthe other validity interval
trimOlderflag to determine which validity interval should be trimmed based on the comparison of the lower range bound
Returns
true if the overlap could be removed.

Definition at line 112 of file IntervalOfValidity.cc.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  output,
const IntervalOfValidity iov 
)
friend

Output stream operator for writing IoV data to a text file.

Parameters
outputThe output stream.
iovThe IntervalOfValidity object.

Definition at line 194 of file IntervalOfValidity.cc.

◆ operator>>

std::istream& operator>> ( std::istream &  input,
IntervalOfValidity iov 
)
friend

Input stream operator for reading IoV data from a text file.

Parameters
inputThe input stream.
iovThe InervalOfValidity object.

Definition at line 150 of file IntervalOfValidity.cc.

Member Data Documentation

◆ m_experimentHigh

int m_experimentHigh
private

Highest experiment number.

-1 means no bound.

Definition at line 176 of file IntervalOfValidity.h.

◆ m_experimentLow

int m_experimentLow
private

Lowest experiment number.

-1 means no bound.

Definition at line 168 of file IntervalOfValidity.h.

◆ m_runHigh

int m_runHigh
private

Highest run number.

-1 means no bound.

Definition at line 180 of file IntervalOfValidity.h.

◆ m_runLow

int m_runLow
private

Lowest run number.

-1 means no bound.

Definition at line 172 of file IntervalOfValidity.h.


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