#include <CExperiment>
CExperiment
CExperiment(std::string ringName, size_t eventBufferSize = 4096);
CEventTrigger* getEventTrigger();
CEventTrigger* getScalerTrigger();
void setBufferSize(size_t newSize);
const size_t getBufferSize();
void Start(bool resume = false);
void Stop(bool pause = false);
void AddEventSegment(CEventSegment* pSegment);
void RemoveEventSegment(CEventSegment* pSegment);
void AddScalerModule(CScaler* pModule);
void RemoveScalerModule(CScaler* pModule);
void EstablishTrigger(CEventTrigger* pEventTrigger);
void setScalerTrigger(CEventTrigger* pScalerTrigger);
void EstablishBusy(CBusy* pBusyModule);
void ReadEvent();
void TriggerScalerReadout();
void DocumentPackets();
void ScheduleRunVariableDump();
CRingBuffer* getRing();
Most of the functionality of an experiment is encapsulated in or
reachable via the CExperiment
class. This
has methods for configuration as well as several well defined methods
that are invoked by the framework at specific points in the run-time
of the system.
CExperiment(std::string ringName, size_t eventBufferSize = 4096);
Constructs the CExperiment
object. The
framework generally only has one experiment object live at a time.
ringName
is the name of the ring buffer into
which data will bge put. This is the name of a local ring buffer.
eventBufferSize
is the size of the buffer
created to hold events. No event can be larger than this size.
The size can be changed via a call to
setBufferSize
.
CEventTrigger* getEventTrigger();
Returns a pointer to the CEventTrigger object that will be used to trigger a readout of the event segment of the experiment.
CEventTrigger* getScalerTrigger();
Returns a pointer to the CEventTrigger
that will be used
to trigger a readout of the scaler bank in the experiment.
void setBufferSize(size_t newSize);
Sets the event buffer size to newSize
16 bit words. Ifyour experiment is taking large events that may overflow
the default buffer size you may want to invoke this from
your Skeleton::SetupReadout
method.
const size_t getBufferSize();
Returns the current event buffer size.
void Start(bool resume = false);
Invoked by the framework to start data taking. If resume
is true the run is being restarted
after being paused.
void Stop(bool pause = false);
Invoked by the framework to stop data taking. If
data is being suspended due to a pause, pause
will be true.
void AddEventSegment(CEventSegment* pSegment);
Add an event segment to the top level event segment in the experiment.
pSegment
is the segment to add to the top
level CCompoundEventSegment
in the
experiment. Note that pSegment
could itself
point to a CCompoundEventSegment
object.
void RemoveEventSegment(CEventSegment* pSegment);
Remove an event segment from the top level event segment in
the experiment. If pSegment
points to an
event segment in the top level CCompoundEventSegment
it is removed. Otherwise this function does nothing.
void AddScalerModule(CScaler* pModule);
Adds a scaler module to the top level scaler bank in the
experiement. pModule
is added to
the end of the collection of modules in the bank. Note that
pModule
might itself point to a
CScalerBank
object.
void RemoveScalerModule(CScaler* pModule);
Removes a scaler object from the top level scaler bank.
If pModule
is in the
top level CScalerBank
object it is removed.
If not, this method does nothing.
void EstablishTrigger(CEventTrigger* pEventTrigger);
Establishes the event trigger. The trigger for the top level
event segment readout is set pEventTrigger
.
When this CEventTrigger
object's
operator()
returns true
when polled during data taking, the event segment will be read.
void setScalerTrigger(CEventTrigger* pScalerTrigger);
Sets the scaler trigger to pScalerTrigger
.
During data taking this trigger's operator()
is polled. When it returns true the top level
scaler bank will be read.
void EstablishBusy(CBusy* pBusyModule);
Sets pBusyModule
to be the object that
will be used to handle the external computer busy hardware.
void ReadEvent();
Called by the trigger thread to read an event.
void TriggerScalerReadout();
Called by the trigger thread to read a scaler event.
void DocumentPackets();
Called by the framework to emit events that describe the set of
CDocumentedPacket
objects that are
currently instantiated.
void ScheduleRunVariableDump();
Called by the framework to create events that describe the values of run and statevariables.