Belle II Software development
EventDependency Class Reference

Class for handling changing conditions as a function of event number. More...

#include <EventDependency.h>

Inheritance diagram for EventDependency:
IntraRunDependency

Public Member Functions

 EventDependency (TObject *object=0, bool owner=true)
 Constructor for event depenent conditions.
 
void add (unsigned int event, TObject *object)
 Add an object to the intra run dependency.
 
const std::vector< unsigned int > & getEventNumbers () const
 Get a vector with event number boundaries In case of no intra-run dependence, the vector is empty In general for n payloads there are n-1 boundaries.
 
TObject * getObjectByIndex (int indx) const
 Get the stored object according to indx.
 
const std::vector< unsigned int > & getBoundaries () const override
 Get a vector with the intra-run boundaries (in this case, event numbers).
 
TObject * getObject (const EventMetaData &event) const
 Get the conditions object that is valid for the given event.
 
TObject * getAnyObject () const
 Get any of the objects.
 
bool isOwner () const
 Flag for ownership.
 

Protected Member Functions

virtual int getIndex (const EventMetaData &event) const override
 Get the index of the object that is valid for the given event.
 
 ClassDef (IntraRunDependency, 1)
 base class for intra run dependent conditions.
 

Protected Attributes

TObjArray m_objects
 Array of intra-run dependent objects.
 

Private Member Functions

 ClassDefOverride (EventDependency, 1)
 class for event number dependent conditions.
 

Private Attributes

std::vector< unsigned int > m_eventNumbers
 Vector of event number boundaries.
 

Detailed Description

Class for handling changing conditions as a function of event number.

Definition at line 22 of file EventDependency.h.

Constructor & Destructor Documentation

◆ EventDependency()

EventDependency ( TObject *  object = 0,
bool  owner = true 
)
inlineexplicit

Constructor for event depenent conditions.

Parameters
objectthe first valid object in the run.
ownerflag that indicates whether the EventDependency takes ownership of the payload objects or not.

Definition at line 30 of file EventDependency.h.

30: IntraRunDependency(object, owner) {};
IntraRunDependency(TObject *object=0, bool owner=true)
Constructor for intra run depenent conditions.

Member Function Documentation

◆ add()

void add ( unsigned int  event,
TObject *  object 
)

Add an object to the intra run dependency.

Note that the EventDependency object takes ownership of the added object by default.

Parameters
eventthe event number from which on the given conditions object is valid.
objectthe object which is valid starting from the given event number.

Definition at line 14 of file EventDependency.cc.

15{
16 m_objects.Add(object);
17 m_eventNumbers.push_back(event);
18}
std::vector< unsigned int > m_eventNumbers
Vector of event number boundaries.
TObjArray m_objects
Array of intra-run dependent objects.

◆ getAnyObject()

TObject * getAnyObject ( ) const
inlineinherited

Get any of the objects.

To be used only by the DBStore for type checking.

Returns
any of the intra-run dependent objects.

Definition at line 53 of file IntraRunDependency.h.

53{return m_objects.At(0);};

◆ getBoundaries()

const std::vector< unsigned int > & getBoundaries ( ) const
inlineoverridevirtual

Get a vector with the intra-run boundaries (in this case, event numbers).

In case of no intra-run dependence, the vector is empty. In general for n payloads there are n-1 boundaries.

Implements IntraRunDependency.

Definition at line 58 of file EventDependency.h.

58{ return getEventNumbers(); }
const std::vector< unsigned int > & getEventNumbers() const
Get a vector with event number boundaries In case of no intra-run dependence, the vector is empty In ...

◆ getEventNumbers()

const std::vector< unsigned int > & getEventNumbers ( ) const
inline

Get a vector with event number boundaries In case of no intra-run dependence, the vector is empty In general for n payloads there are n-1 boundaries.

Definition at line 45 of file EventDependency.h.

45{ return m_eventNumbers; }

◆ getIndex()

int getIndex ( const EventMetaData event) const
overrideprotectedvirtual

Get the index of the object that is valid for the given event.

Parameters
eventmeta data of the event for which we want to have the conditions.
Returns
array index of the object valid for the given event.

Implements IntraRunDependency.

Definition at line 21 of file EventDependency.cc.

22{
23 int result = 0;
24 for (unsigned int eventNumber : m_eventNumbers) {
25 if (eventNumber > event.getEvent()) return result;
26 result++;
27 }
28 return result;
29}

◆ getObject()

TObject * getObject ( const EventMetaData event) const
inlineinherited

Get the conditions object that is valid for the given event.

Parameters
eventmeta data of the event for which we want to have the conditions.
Returns
object valid for the given event.

Definition at line 47 of file IntraRunDependency.h.

47{return m_objects.At(getIndex(event));};
virtual int getIndex(const EventMetaData &event) const =0
Get the index of the object that is valid for the given event.

◆ getObjectByIndex()

TObject * getObjectByIndex ( int  indx) const
inline

Get the stored object according to indx.

Parameters
indxindex which can have values from 0 to getEventNumbers() - 1

Definition at line 51 of file EventDependency.h.

51{return m_objects.At(indx);}

◆ isOwner()

bool isOwner ( ) const
inlineinherited

Flag for ownership.

Returns
true if the IntraRunDependency owns the individual objects.

Definition at line 59 of file IntraRunDependency.h.

59{return m_objects.IsOwner();}

Member Data Documentation

◆ m_eventNumbers

std::vector<unsigned int> m_eventNumbers
private

Vector of event number boundaries.

Definition at line 70 of file EventDependency.h.

◆ m_objects

TObjArray m_objects
protectedinherited

Array of intra-run dependent objects.

Definition at line 70 of file IntraRunDependency.h.


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