#include <CRingPhysicsEventCount.h> class CRingPhysicsEventCountItem : public CRingItem { public: CRingPhysicsEventCountItem(); CRingPhysicsEventCountItem(uint64_t count, uint32_t timeOffset, unsigned divisor = 1); CRingPhysicsEventCountItem(uint64_t count, uint32_t timeoffset, time_t stamp, uint32_t sid, unsigned divisor = 1); virtual uint32_t getTimeOffset() const; virtual void setTimeOffset(uint32_t offset); virtual float computeElapsedTime() const; virtual uint32_t getTimeDivisor() const; virtual time_t getTimestamp() const; virtual void setTimestamp(time_t stamp); virtual uint64_t getEventCount() const; virtual void setEventCount(uint64_t count); virtual uint32_t getOriginalSourceId() const; virtual void setBodyHeader(uint64_t timestamp, uint32_t sourceId, uint32_t barrierType = 0); virtual void* getBodyHeader() const; virtual std::string typeName() const; // Textual type of item. virtual std::string toString() const; // Provide string dump of the item. };
Online analysis software often samples data in order to
avoid being the throughput bottleneck. It is useful for such
software to be able to compute the fraction of the actual
data it has analyzed. This ring item provides the number
of physics triggers (CPHysicsEventItem
objects) that have been emitted by a readout (or the event builder)
at some point in time. By counting the number of physics
triggers processe and dividing by the number of actual
triggers, the fraction of data analyzed can be computed.
CRingPhysicsEventCountItem();
Constructs an event count item with a count of zero, run time offset of zero and timestamp of the time the constructor was invoked.
CRingPhysicsEventCountItem(uint64_t count, uint32_t timeOffset, unsigned divisor);
Creates an event count item where the trigger
count is initialized to count
.
The run offset is given by timeOffset
with divisor
ticks per second.
The clock time is set to the construction time of
the object.
CRingPhysicsEventCountItem(uint64_t count, uint32_t timeoffset, time_t stamp, uint32_t sid, unsigned divisor = 1);
Full construction of a physics event count item
with a prototypical body header. The additional
parameter from the previous constructor are
stamp
, which provides
the clock time at which the item was constructed and
sid
which provides the source
id for the original source id field (if any) of the
item.
The original source id allows analysis programs to
track the originating data source for this item.
Note that the constructor does not produce a
body header but one can be added with
setBodyHeader
.
const virtual uint32_t getTimeOffset();
Returns the raw time offset into the run at which
this item was created. Note that
computeElapsedTime
is the
preferred method to get the elapsed run time.
virtual void setTimeOffset(uint32_t offset);
Sets the object's raw run time offset. This offset is uncorrected by the offset divisor.
const virtual float computeElapsedTime();
Computes the elapsed time in the run at which this was emitted from the raw offset and the divisor. Units are seconds.
const virtual uint32_t getTimeDivisor();
Returns the number of ticks in a second in the elapsed time raw value.
virtual time_t getTimestamp();
Return the clock time associated with the item.
virtual void setTimestamp(time_t stamp);
Sets the clock time associated with the item.
const virtual uint64_t getEventCount();
Return the number of triggers documented by this item.
virtual void setEventCount(uint64_t count);
sets the item's trigger count.
const virtual uint32_t getOriginalSourceId();
Returns the source id of the data source that emitted this object.
const virtual std::string typeName();
Returns a string indicating the type of ring item this object is: Trigger count
const virtual std::string toString();
Return a string that describes the contents of the item. This is used by, e.g. dumper
virtual void setBodyHeader(uint64_t timestamp, uint32_t sourceId, uint32_t barrierType = 0);
Adds a new body header or modifies the contents of the existing body header.
const virtual void* getBodyHeader();
Returns a pointer to the body header or nullptr if the object has no body header.