#include <CExperiment.h>
Public Methods | |
CExperiment (unsigned nBufferSize=4096) | |
Default constructor. | |
CExperiment (CTrigger *pTriggerModule, CEventSegment *pEventReadout, CScaler *pScalers=0, CStatusModule *pStatus=0, unsigned nBufferSize=4096) | |
~CExperiment () | |
Destructor. | |
CNSCLPhysicsBuffer * | getBuffer () |
CStatusModule * | getStatusModule () |
CTrigger * | getTrigger () |
CScalerBank & | getScalers () |
CCompoundEventSegment & | getReadout () |
void | Start (CStateTransitionCommand &rCommand) |
void | Stop (CStateTransitionCommand &rCommand) |
void | ReadEvent () |
void | PostEvent () |
void | AddEventSegment (CEventSegment *rSegment) |
void | RemoveEventSegment (CEventSegment *pSegment) |
void | RemoveEventSegment (CCompoundEventSegment::EventSegmentList::iterator i) |
void | SetBusy () |
void | ClearBusy () |
void | EstablishTrigger (CTrigger *pTrigger) |
void | EstablishBusy (CStatusModule *pStatus) |
void | TriggerScalerReadout () |
void | TriggerRunVariableBuffer () |
void | TriggerStateVariableBuffer () |
void | TriggerSnapshotScaler () |
void | TriggerDocBuffer () |
void | AddScalerModule (CScaler *pScaler) |
void | RemoveScalerModule (CScaler *pScaler) |
void | RemoveScalerModule (ScalerListIterator it) |
void | ReplaceBuffer (unsigned nSize) |
Protected Methods | |
void | EmitStart () |
void | EmitEnd () |
void | EmitPause () |
void | EmitResume () |
void | StartTrigger () |
void | StopTrigger () |
unsigned long | GetElapsedTime () const |
unsigned short | GetRunNumber () const |
void | EmitScalerBuffer (unsigned int nBufferType, vector< unsigned long > &scalers, unsigned long nIntervalStartTime) |
RunVariableIterator | EmitRunVariableBuffer (CRunVariableBuffer &Buffer, RunVariableIterator start, RunVariableIterator stop) |
StateVariableIterator | EmitStateVariableBuffer (CStateVariableBuffer &Buffer, StateVariableIterator &start, StateVariableIterator &stop) |
DocumentationPacketIterator | EmitDocBuffer (DocumentationPacketIterator s, DocumentationPacketIterator e, CNSCLDocumentationBuffer &b) |
void | Overflow (DAQWordBufferPtr &header, DAQWordBufferPtr &End) |
void | SetupTimedEvent () |
Private Methods | |
CExperiment (const CExperiment &rhs) | |
Copy construction is forbidden:. | |
CExperiment & | operator= (const CExperiment &rhs) |
Assignment. | |
int | operator== (const CExperiment &rhs) const |
Comparison for equality. | |
int | operator!= (const CExperiment &rhs) const |
Private Attributes | |
CNSCLPhysicsBuffer * | m_EventBuffer |
unsigned int | m_nBufferSize |
CStatusModule * | m_pStatusModule |
Pointer to module handling status. | |
CTrigger * | m_pTrigger |
Trigger module handler. | |
CTriggerThread * | m_pTThread |
Trigger checking thread. | |
CScalerBank | m_Scalers |
Scaler bank (with modules). | |
CCompoundEventSegment | m_EventReadout |
Event Readout object. | |
vector< unsigned long > | m_IntervalSums |
Scaler sums over snapshot interval. | |
unsigned long | m_LastSnapTime |
Time of last snapshot. | |
unsigned long | m_LastScalerTime |
Time of last full scaler read. | |
CScalerTrigger * | m_pScalerTrigger |
unsigned int | m_nEventsAcquired |
unsigned int | m_nWordsAcquired |
Definition at line 362 of file CExperiment.h.
|
Default constructor. Default constructor. This is called when declarations of the form e.g.:
Definition at line 504 of file CExperiment.cpp. References SetupTimedEvent(). |
|
Parameterized constructor. Allows the experiment to be created as needed for an initial minimal set. The experiment can still be 'edited' later on by adding segments to the event and scalers to the initial module.
Definition at line 545 of file CExperiment.cpp. References CScalerBank::AddScalerModule(), CCompoundEventSegment::AddSegment(), m_EventReadout, m_Scalers, and SetupTimedEvent(). |
|
Destructor.
Definition at line 391 of file CExperiment.h. |
|
Copy construction is forbidden:.
|
|
Adds an event segment to the readout chain. Events are read out in segments. This member ads a segment to the chain of segments which are read out in response to an event trigger.
Definition at line 780 of file CExperiment.cpp. References CCompoundEventSegment::AddSegment(), and m_EventReadout. Referenced by CMyExperiment::SetupReadout(). |
|
Adds a scaler module to the readout subsystem.
Definition at line 1026 of file CExperiment.cpp. References CScalerBank::AddScalerModule(), and m_Scalers. |
|
Facades for the status module. Sets the status module to indicate the computer is now not busy. Definition at line 820 of file CExperiment.cpp. References CStatusModule::GoClear(), m_pStatusModule, and CStatusModule::ModuleClear(). Referenced by PostEvent(). |
|
Emits a documentation buffer. Documentation buffers list the set of documented packet ids. Packet Ids are used to identify the sub-contents of events in the physics data buffers. Making a packet id documented provides useful documentation information.
Definition at line 1236 of file CExperiment.cpp. References DocumentationPacketIterator, and CNSCLStringListBuffer::PutEntityString(). Referenced by TriggerDocBuffer(). |
|
Emits an end run buffer. End run bufers look just like Start run buffers (see EmitStart()), however the elapsed time value is nonzero. Definition at line 1082 of file CExperiment.cpp. References ENDRUNBF, GetElapsedTime(), GetRunNumber(), CReadoutMain::getTitle(), m_nBufferSize, CNSCLControlBuffer::PutTimeOffset(), CNSCLControlBuffer::PutTitle(), CNSCLOutputBuffer::Route(), CNSCLOutputBuffer::SetRun(), and CNSCLOutputBuffer::SetType(). Referenced by Stop(). |
|
Emits a pause run buffer. Pause run buffers also look like Begin buffers with nonzero time. They indicate a temporary halt in data taking. Definition at line 1096 of file CExperiment.cpp. References GetElapsedTime(), GetRunNumber(), CReadoutMain::getTitle(), m_nBufferSize, PAUSEBF, CNSCLControlBuffer::PutTimeOffset(), CNSCLControlBuffer::PutTitle(), CNSCLOutputBuffer::Route(), CNSCLOutputBuffer::SetRun(), and CNSCLOutputBuffer::SetType(). Referenced by Stop(). |
|
Emits a resume run buffer. Resume run buffers are like end run buffers with nonzero time. They indicate a resumption of data taking. Definition at line 1111 of file CExperiment.cpp. References GetElapsedTime(), GetRunNumber(), CReadoutMain::getTitle(), m_nBufferSize, CNSCLControlBuffer::PutTimeOffset(), CNSCLControlBuffer::PutTitle(), RESUMEBF, CNSCLOutputBuffer::Route(), CNSCLOutputBuffer::SetRun(), and CNSCLOutputBuffer::SetType(). Referenced by Start(). |
|
Creates a Run Variable buffer. Run variables buffers contain a set of run variables in the form varname=value\0.
Definition at line 1179 of file CExperiment.cpp. References CNSCLStringListBuffer::PutEntityString(), and RunVariableIterator. Referenced by TriggerRunVariableBuffer(). |
|
|
|
Emits the start of run buffer. A start of run buffer contains a standard buffer header as well as: # Run Title - up to 79 characters of title information followed by a null. # A long word of zero indicating that the buffer was emitted at the beginning of the run. # A time structure containing the fields:
Definition at line 1062 of file CExperiment.cpp. References BEGRUNBF, CNSCLOutputBuffer::ClearSequence(), GetElapsedTime(), GetRunNumber(), CReadoutMain::getTitle(), m_nBufferSize, CNSCLControlBuffer::PutTimeOffset(), CNSCLControlBuffer::PutTitle(), CNSCLOutputBuffer::Route(), CNSCLOutputBuffer::SetRun(), and CNSCLOutputBuffer::SetType(). Referenced by Start(). |
|
Emits a state variable buffer. State variable buffers are filled with strings of the form "name=value\0" and are always an even number of bytes long.
Definition at line 1205 of file CExperiment.cpp. References CStateVariable::FormatForBuffer(), CNSCLStringListBuffer::PutEntityString(), and StateVariableIterator. Referenced by TriggerStateVariableBuffer(). |
|
Establishes a module to manage the busy. The busy module has two NIM pulsed outputs. One indicates the computer is going busy for software reasons. The other indicates that the computer is going not busy for any reason.
Definition at line 854 of file CExperiment.cpp. References m_pStatusModule. Referenced by CReadoutMain::CreateExperiment(). |
|
Establishes the trigger module. This supplies a trigger object which will be run as a thread to check for events. Definition at line 835 of file CExperiment.cpp. References m_pTrigger. Referenced by CReadoutMain::CreateExperiment(). |
|
Definition at line 413 of file CExperiment.h. |
|
Get the elapsed run time.
Definition at line 1322 of file CExperiment.cpp. References CReadoutMain::getClock(), and CTimer::GetElapsedTime(). Referenced by EmitEnd(), EmitPause(), EmitResume(), EmitStart(), TriggerScalerReadout(), and TriggerSnapshotScaler(). |
|
Definition at line 426 of file CExperiment.h. |
|
Get the run number from the run state variables. Definition at line 1293 of file CExperiment.cpp. References CStateVariableCommand::end(), CStateVariableCommand::find(), CReadoutMain::getInstance(), CReadoutMain::getInterpreter(), CInterpreterShell::getInterpreterCore(), CInterpreterCore::getStateVariables(), and StateVariableIterator. Referenced by EmitEnd(), EmitPause(), EmitResume(), EmitStart(), Overflow(), ReadEvent(), TriggerDocBuffer(), TriggerRunVariableBuffer(), TriggerScalerReadout(), TriggerSnapshotScaler(), and TriggerStateVariableBuffer(). |
|
Definition at line 423 of file CExperiment.h. |
|
Definition at line 417 of file CExperiment.h. |
|
Definition at line 420 of file CExperiment.h. |
|
|
|
Assignment.
|
|
Comparison for equality.
|
|
Handles buffer overflows. The actual event buffer is created at double the size of the system buffer size. Data buffers then get tight packed by filling them with events until the used part of the buffer is larger than the system buffer size. At that point, a second buffer is created and the overflowed event is copied into that. The original buffer is then resized and routed.
Definition at line 1261 of file CExperiment.cpp. References CNSCLPhysicsBuffer::EndEvent(), GetRunNumber(), m_EventBuffer, m_nBufferSize, CNSCLPhysicsBuffer::RetractEvent(), CNSCLOutputBuffer::Route(), CNSCLOutputBuffer::SetRun(), and CNSCLPhysicsBuffer::StartEvent(). Referenced by ReadEvent(). |
|
Performs all operations which are required after the event has been read out. Definition at line 755 of file CExperiment.cpp. References ClearBusy(). Referenced by ReadEvent(). |
|
Reads an event in response to an event trigger. The event is read into the current position within the event buffer. If necessary (the worst case entity won't fit in the buffer), the event buffer is routed. Definition at line 706 of file CExperiment.cpp. References CCompoundEventSegment::Clear(), CNSCLPhysicsBuffer::EndEvent(), CNSCLOutputBuffer::EntityFits(), CReadoutMain::getInstance(), CReadoutMain::getInterpreter(), CInterpreterShell::getInterpreterCore(), GetRunNumber(), m_EventBuffer, m_EventReadout, m_nBufferSize, m_nEventsAcquired, m_nWordsAcquired, Overflow(), PostEvent(), CCompoundEventSegment::Read(), CNSCLOutputBuffer::Route(), CInterpreterCore::setEvents(), CNSCLOutputBuffer::SetRun(), CInterpreterCore::setWords(), CCompoundEventSegment::size(), and CNSCLPhysicsBuffer::StartEvent(). Referenced by CTriggerThread::MainLoop(). |
|
Definition at line 440 of file CExperiment.h. References CCompoundEventSegment::DeleteSegment(). |
|
Removes an event segment from the set of event segments read out by this experiment.
Definition at line 795 of file CExperiment.cpp. References CCompoundEventSegment::DeleteSegment(), and m_EventReadout. |
|
Definition at line 454 of file CExperiment.h. References RemoveScalerModule(), and ScalerListIterator. |
|
Removes a scaler module from the readout system.
Definition at line 1039 of file CExperiment.cpp. References CScalerBank::DeleteScalerModule(), and m_Scalers. Referenced by RemoveScalerModule(). |
|
|
|
Sets the status module to indicate the computer is now busy. Definition at line 807 of file CExperiment.cpp. References CStatusModule::GoBusy(), and m_pStatusModule. |
|
Sets up all timed events needed by the experiment when the run is active. These include:
Definition at line 1334 of file CExperiment.cpp. References CTimer::EstablishEvent(), CReadoutMain::getClock(), and m_pScalerTrigger. Referenced by CExperiment(). |
|
|
Starts the event trigger. This involves creating a thread which checks to see if a trigger is present. The thread will call our ReadEvent function in its own context. The thread will synchronize by holding the global sync mutex for several passes through its main loop.
Definition at line 1133 of file CExperiment.cpp. References m_pTrigger, m_pTThread, and CTriggerThread::Start(). Referenced by Start(). |
|
Schedules a transition from active to either inactive or paused. The trigger module is informed that it should stop running without giving any more event triggers. The appropriate end actions are performed.
Definition at line 662 of file CExperiment.cpp. References EmitEnd(), EmitPause(), CStateTransitionCommand::ExecutePostFunction(), CStateTransitionCommand::ExecutePreFunction(), CReadoutMain::getClock(), CTimer::Stop(), StopTrigger(), TriggerDocBuffer(), TriggerRunVariableBuffer(), TriggerScalerReadout(), and TriggerStateVariableBuffer(). Referenced by CPauseCommand::operator()(), and CEndCommand::operator()(). |
|
Stops the event trigger. This prevents future events from being acquired. Note that the trigger is processed in a separate thread. This function will block until the trigger thread has exited.
Definition at line 1153 of file CExperiment.cpp. References m_pTThread, and CTriggerThread::Stop(). Referenced by Stop(). |
|
Creates a buffer or potentially a set of buffers, fills them with documentation information about the registered packet types. Buffers are routed out of band with any physics event buffer which might be being filled. Definition at line 1005 of file CExperiment.cpp. References CDocumentedPacketManager::begin(), DocumentationPacketIterator, EmitDocBuffer(), CDocumentedPacketManager::end(), CDocumentedPacketManager::getInstance(), GetRunNumber(), m_nBufferSize, CNSCLOutputBuffer::Route(), and CNSCLOutputBuffer::SetRun(). |
|
Triggers the production of a run variable buffer.
Definition at line 923 of file CExperiment.cpp. References CRunVariableCommand::begin(), EmitRunVariableBuffer(), CRunVariableCommand::end(), CReadoutMain::getInterpreter(), CInterpreterShell::getInterpreterCore(), GetRunNumber(), CInterpreterCore::getRunVariables(), CNSCLOutputBuffer::Route(), RunVariableIterator, and CNSCLOutputBuffer::SetRun(). Referenced by CRunVariableDumpTrigger::operator()(), Start(), and Stop(). |
|
Called to initiate a scaler readout. The current buffer is routed a new buffer allocated, filled with scaler data and routed, and another new buffer is created for subsequent event readout data. Definition at line 869 of file CExperiment.cpp. References CScalerBank::Clear(), GetElapsedTime(), CNSCLOutputBuffer::getEntityCount(), GetRunNumber(), m_EventBuffer, m_IntervalSums, m_LastScalerTime, m_LastSnapTime, m_nBufferSize, m_Scalers, CNSCLScalerBuffer::PutScalerVector(), CScalerBank::Read(), CNSCLOutputBuffer::Route(), CNSCLScalerBuffer::SetEndTime(), CNSCLOutputBuffer::SetRun(), and CNSCLScalerBuffer::SetStartTime(). Referenced by CScalerTrigger::operator()(), and Stop(). |
|
Triggers a snapshot scaler readout. Action is similar to that of scaler readout, however the existsing event buffer is maintained and this buffer is sent around it. Definition at line 966 of file CExperiment.cpp. References CScalerBank::Clear(), GetElapsedTime(), GetRunNumber(), m_IntervalSums, m_LastSnapTime, m_nBufferSize, m_Scalers, CNSCLScalerBuffer::PutScalerVector(), CScalerBank::Read(), CNSCLOutputBuffer::Route(), CNSCLScalerBuffer::SetEndTime(), CNSCLOutputBuffer::SetRun(), CNSCLScalerBuffer::SetStartTime(), CNSCLOutputBuffer::SetType(), and SNAPSCBF. |
|
Definition at line 942 of file CExperiment.cpp. References CStateVariableCommand::begin(), EmitStateVariableBuffer(), CStateVariableCommand::end(), CReadoutMain::getInterpreter(), CInterpreterShell::getInterpreterCore(), GetRunNumber(), CInterpreterCore::getStateVariables(), m_nBufferSize, CNSCLOutputBuffer::Route(), CNSCLOutputBuffer::SetRun(), and StateVariableIterator. Referenced by CRunVariableDumpTrigger::operator()(), Start(), and Stop(). |
|
Definition at line 365 of file CExperiment.h. Referenced by Overflow(), ReadEvent(), and TriggerScalerReadout(). |
|
Event Readout object.
Definition at line 372 of file CExperiment.h. Referenced by AddEventSegment(), CExperiment(), ReadEvent(), RemoveEventSegment(), and Start(). |
|
Scaler sums over snapshot interval.
Definition at line 373 of file CExperiment.h. Referenced by TriggerScalerReadout(), and TriggerSnapshotScaler(). |
|
Time of last full scaler read.
Definition at line 375 of file CExperiment.h. Referenced by Start(), and TriggerScalerReadout(). |
|
Time of last snapshot.
Definition at line 374 of file CExperiment.h. Referenced by Start(), TriggerScalerReadout(), and TriggerSnapshotScaler(). |
|
Definition at line 366 of file CExperiment.h. Referenced by EmitEnd(), EmitPause(), EmitResume(), EmitStart(), Overflow(), ReadEvent(), TriggerDocBuffer(), TriggerScalerReadout(), TriggerSnapshotScaler(), and TriggerStateVariableBuffer(). |
|
Definition at line 377 of file CExperiment.h. |
|
Definition at line 378 of file CExperiment.h. |
|
Definition at line 376 of file CExperiment.h. Referenced by SetupTimedEvent(), and Start(). |
|
Pointer to module handling status.
Definition at line 368 of file CExperiment.h. Referenced by ClearBusy(), EstablishBusy(), and SetBusy(). |
|
Trigger module handler.
Definition at line 369 of file CExperiment.h. Referenced by EstablishTrigger(), and StartTrigger(). |
|
Trigger checking thread.
Definition at line 370 of file CExperiment.h. Referenced by StartTrigger(), and StopTrigger(). |
|
Scaler bank (with modules).
Definition at line 371 of file CExperiment.h. Referenced by AddScalerModule(), CExperiment(), RemoveScalerModule(), Start(), TriggerScalerReadout(), and TriggerSnapshotScaler(). |