Create and manage a buffer for triggers. More...
#include <TriggerBuffer.h>
Public Member Functions | |
bool | AddTrigger (const double aTime, const double aFrequency, const double aSNR, const double aQ, const double aTstart, const double aTend, const double aFstart, const double aFend, const double aAmplitude, const double aPhase) |
Adds a trigger to the buffer. | |
bool | FlushBuffer (void) |
Flush the trigger buffer to the TTree. | |
double | GetBufferLiveTime (void) |
int | GetBufferSize (void) |
Returns the size of the buffer. | |
int | GetNtriggers (void) |
Returns the number of triggers currently in memory. | |
void | ResetAfter (const double aTime) |
Removes triggers (and segments) starting after a given time. | |
void | ResetBuffer (void) |
Resets the buffer. | |
bool | SetBufferSegments (Segments *aSeg) |
Defines new buffer time segments. | |
Constructors and destructors | |
TriggerBuffer (const int aSize, const string aStreamName, const int aVerbose=0) | |
Constructor of the TriggerBuffer class. | |
virtual | ~TriggerBuffer (void) |
Destructor of the TriggerBuffer class. |
Create and manage a buffer for triggers.
See also MakeTriggers()
TriggerBuffer::TriggerBuffer | ( | const int | aSize, | |
const string | aStreamName, | |||
const int | aVerbose = 0 | |||
) |
Constructor of the TriggerBuffer class.
The size of the buffer is defined. This size determines the maximum number of triggers which can be saved in the buffer. The memory for the buffer is then allocated.
aSize | buffer size | |
aStreamName | stream name | |
aVerbose | verbosity level |
TriggerBuffer::~TriggerBuffer | ( | void | ) | [virtual] |
Destructor of the TriggerBuffer class.
bool TriggerBuffer::AddTrigger | ( | const double | aTime, | |
const double | aFrequency, | |||
const double | aSNR, | |||
const double | aQ, | |||
const double | aTstart, | |||
const double | aTend, | |||
const double | aFstart, | |||
const double | aFend, | |||
const double | aAmplitude, | |||
const double | aPhase | |||
) |
Adds a trigger to the buffer.
Returns false if the buffer is full.
This function overloads Triggers::AddTrigger() to fill the buffer instead the final structure. If the buffer size is 0, Triggers::AddTrigger() is called directly.
aTime | trigger peak time | |
aFrequency | trigger peak frequency | |
aSNR | trigger SNR | |
aQ | trigger Q | |
aTstart | trigger time start | |
aTend | trigger time end | |
aFstart | trigger frequency start | |
aFend | trigger frequency end | |
aAmplitude | trigger amplitude | |
aPhase | trigger phase |
Reimplemented from Triggers.
bool TriggerBuffer::FlushBuffer | ( | void | ) |
Flush the trigger buffer to the TTree.
The buffer is then reset.
double TriggerBuffer::GetBufferLiveTime | ( | void | ) | [inline] |
int TriggerBuffer::GetBufferSize | ( | void | ) | [inline] |
Returns the size of the buffer.
int TriggerBuffer::GetNtriggers | ( | void | ) | [inline] |
Returns the number of triggers currently in memory.
in the buffer or in the TTree.
Reimplemented from Triggers.
void TriggerBuffer::ResetAfter | ( | const double | aTime | ) |
Removes triggers (and segments) starting after a given time.
Entire segments are removed.
aTime | time after which segments are removed |
void TriggerBuffer::ResetBuffer | ( | void | ) |
Resets the buffer.
All triggers saved until now are removed.
bool TriggerBuffer::SetBufferSegments | ( | Segments * | aSeg | ) |
Defines new buffer time segments.
Before adding triggers to the buffer, time segments must be defined. This function defines the time segments associated to the buffer. In the following, triggers starting times must then belong to the buffer segments.
Segments must be added in a chronological order and with no overlap with the previous segments. If this is not verified, false is returned.
aSeg | buffer segments |