Simple DAQ environent for setups with a single ROC and 0-2 FEBs. More...
#include <QuickDaq.h>

| Public Types | |
| enum | daqState { kDaqStopped = 0, kDaqStarting, kDaqRunning, kDaqStopping } | 
| Names for DAQ states.More... | |
| enum | daqStopCode { kDaqStopPending = 0, kDaqStopByCount, kDaqStopByTime, kDaqStopByInterrupt, kDaqStopByStop, kDaqStopByTimeout } | 
| Names for DAQ stop codes.More... | |
| Public Member Functions | |
| QuickDaq (base::Board *board) | |
| Constructor with Board and no FEB. | |
| QuickDaq (nxyter::FebBase *feb0=0, nxyter::FebBase *feb1=0) | |
| Normal constructor with one or two FEB's. | |
| virtual | ~QuickDaq () | 
| int | setNxTestModes (bool testpuls, bool testtrig, int calselect) | 
| Setup test pulser and test trigger mode in all nXYTERs. | |
| int | setNxRegisterAll (uint8_t reg, uint8_t val, bool veri=true) | 
| Write a value into a register of all nXYTERs. | |
| void | nextRunNxMask (int nxmask) | 
| Set active nXYTER mask for next run. | |
| int | startRun (int maxmsg=0, double maxtime=0., bool noinit=false) | 
| Prepare for data taking, start a run. | |
| int | stopRun (bool hardstop=false) | 
| End data taking. | |
| void | interruptRun () | 
| Interrupt data taking. | |
| bool | testRun (double timeout=0.) | 
| Check run status. | |
| roc::Message & | msg () | 
| Access current message data object. | |
| uint32_t | getMsgEpoch () const | 
| Returns current epoch. | |
| double | getMsgTime () | 
| Returns full message time as double. | |
| double | getRunTime () | 
| Returns wall clock time of message (measured since start run). | |
| double | getStartTime () | 
| Returns start time. | |
| double | getStopTime () | 
| Returns stop time. | |
| const QuickDaqStats & | stats () | 
| Access statistics object. | |
| int | getState () | 
| Returns DAQ state. | |
| int | getStopCode () | 
| Returns DAQ stop code. | |
| Static Public Member Functions | |
| static double | now () | 
| Returns current time as a double. | |
| Protected Attributes | |
| base::Board * | fBoard | 
| board pointer | |
| nxyter::FebBase * | fFebs [2] | 
| available FEBs | |
| nxyter::RocNx | fRocNx | 
| rocnx pointer | |
| int | fState | 
| DAQ state. | |
| int | fStopCode | 
| DAQ stop code. | |
| int | fDaqLowWater | 
| for setRocLowHighWater | |
| int | fDaqHighWater | 
| for setRocLowHighWater | |
| uint32_t | fDaqFlushTimer | 
| for setRocBufferFlushTimer | |
| double | fDaqStaStoTimeout | 
| timeout for start/stop | |
| QuickDaqStats | fStats | 
| statistic counters | |
| bool | fNextNxMaskActive | 
| nextRunNxMask() called | |
| int | fNextNxMask | 
| nXYTER mask for next run | |
| double | fStartTime | 
| time start call | |
| double | fStopTime | 
| time stop call | |
| double | fStartMsgTime | 
| time start message | |
| double | fStopMsgTime | 
| time stop message | |
| double | fMaxMsg | 
| maximal number of msg in run | |
| double | fMaxTime | 
| maximal time of run | |
| roc::Iterator | fIter | 
| current iterator | |
| double | fMsgTime | 
| current message time stamp | |
| double | fNowTime | 
| wall time of message | |
Simple DAQ environent for setups with a single ROC and 0-2 FEBs.
Definition at line 19 of file QuickDaq.h.
Names for DAQ states.
| kDaqStopped | stopped, not active | 
| kDaqStarting | started, before start sysmsg | 
| kDaqRunning | started, start sysmsg received | 
| kDaqStopping | rundown, before stopped sysmsg | 
Definition at line 46 of file QuickDaq.h.
Names for DAQ stop codes.
Definition at line 53 of file QuickDaq.h.
| nxyter::QuickDaq::QuickDaq | ( | base::Board * | board | ) |  [explicit] | 
Constructor with Board and no FEB.
Sets up QuickDaq object with no FEB. 
| board | ROC board pointer | 
Definition at line 31 of file QuickDaq.cxx.
References fFebs.
| nxyter::QuickDaq::QuickDaq | ( | nxyter::FebBase * | feb0 = 0, | |
| nxyter::FebBase * | feb1 = 0 | |||
| ) |  [explicit] | 
Normal constructor with one or two FEB's.
Sets up QuickDaq object with full board and FEB context. 
| feb0 | 1st connected FEB (maybe 0) | |
| feb1 | 2nd connected FEB (maybe 0) | 
| runtime_error | when both feb0 and feb1 or null pointers or if two febs given both not hosted by the same board. | 
Definition at line 63 of file QuickDaq.cxx.
References fBoard, fFebs, and base::Peripheral::getBoard().
| nxyter::QuickDaq::~QuickDaq | ( | ) |  [virtual] | 
Definition at line 95 of file QuickDaq.cxx.
References fState, kDaqRunning, and stopRun().
| uint32_t nxyter::QuickDaq::getMsgEpoch | ( | ) | const  [inline] | 
Returns current epoch.
Definition at line 83 of file QuickDaq.h.
References fIter, and roc::Iterator::getMsgEpoch().
Referenced by cmd_printdata().
| double nxyter::QuickDaq::getMsgTime | ( | ) |  [inline] | 
Returns full message time as double. 
Definition at line 87 of file QuickDaq.h.
References fMsgTime.
Referenced by cmd_testrocaux(), and cmd_testrocsync().
| double nxyter::QuickDaq::getRunTime | ( | ) |  [inline] | 
Returns wall clock time of message (measured since start run).
Definition at line 91 of file QuickDaq.h.
References fNowTime, and fStartTime.
| double nxyter::QuickDaq::getStartTime | ( | ) |  [inline] | 
Returns start time.
Definition at line 95 of file QuickDaq.h.
References fStartTime.
Referenced by cmd_printdata(), cmd_testrocaux(), cmd_testrocsync(), and print_daq_stats().
| int nxyter::QuickDaq::getState | ( | ) |  [inline] | 
| int nxyter::QuickDaq::getStopCode | ( | ) |  [inline] | 
| double nxyter::QuickDaq::getStopTime | ( | ) |  [inline] | 
Returns stop time.
Definition at line 99 of file QuickDaq.h.
References fStopTime.
Referenced by cmd_printdata(), cmd_testrocaux(), cmd_testrocsync(), and print_daq_stats().
| void nxyter::QuickDaq::interruptRun | ( | ) | 
Interrupt data taking.
Main application for this method is to be called from a signal handler, often a SIGINT handler to catch a ^C. The code example below shows how such a SIGINT handler can be implemented.
void hdl_int(int sig, siginfo_t *info, void *cnxt) { p_to_quickdaq->interruptRun(); } int main(int argc, char* argv[]) { struct sigaction act; memset (&act, '\0', sizeof(act)); act.sa_sigaction = &hdl_int; act.sa_flags = SA_SIGINFO; if (sigaction(SIGINT, &act, 0) < 0) { perror ("sigaction"); } ... }
With such a handler DAQ runs will be gracefully terminated upon ^C.
Definition at line 288 of file QuickDaq.cxx.
References fState, fStopCode, and kDaqStopped.
Referenced by hdl_int().
| roc::Message& nxyter::QuickDaq::msg | ( | ) |  [inline] | 
Access current message data object.
Definition at line 79 of file QuickDaq.h.
References fIter, and roc::Iterator::msg().
Referenced by acquire_data(), nxyter::FebUtil::acquireTestTriggerData(), cmd_autosettrh(), cmd_printdata(), cmd_testrocaux(), cmd_testrocsync(), and testRun().
| void nxyter::QuickDaq::nextRunNxMask | ( | int | nxmask | ) | 
Set active nXYTER mask for next run.
Definition at line 151 of file QuickDaq.cxx.
References fNextNxMask, and fNextNxMaskActive.
Referenced by nxyter::FebUtil::acquireTestTriggerData().
| double nxyter::QuickDaq::now | ( | ) |  [static] | 
Returns current time as a double. 
Definition at line 385 of file QuickDaq.cxx.
Referenced by startRun(), stopRun(), and testRun().
| int nxyter::QuickDaq::setNxRegisterAll | ( | uint8_t | reg, | |
| uint8_t | val, | |||
| bool | veri = true | |||
| ) | 
Write a value into a register of all nXYTERs.
Writes val into register reg of all nXYTERs in the setup.
| reg | register number | |
| val | value to be written | |
| veri | if truereadback verification done (default istrue) | 
Definition at line 137 of file QuickDaq.cxx.
References fFebs, base::Board::operErrBuildInc(), and nxyter::FebBase::setNxRegisterAll().
| int nxyter::QuickDaq::setNxTestModes | ( | bool | testpuls, | |
| bool | testtrig, | |||
| int | calselect | |||
| ) | 
Setup test pulser and test trigger mode in all nXYTERs.
Calls for all nXYTERs in the setup the NxI2c::setTestModes() method, check the documentation of this method for details.
| testtrig | determines whether test trigger mode is enabled | |
| testpuls | determines whether test pulser mode is enabled | |
| calselect | determines which channel group receives test pulse | 
Definition at line 115 of file QuickDaq.cxx.
References fFebs, base::Board::operErrBuildInc(), and nxyter::FebBase::setNxTestModes().
| int nxyter::QuickDaq::startRun | ( | int | maxmsg = 0, | |
| double | maxtime = 0., | |||
| bool | noinit = false | |||
| ) | 
Prepare for data taking, start a run.
Definition at line 163 of file QuickDaq.cxx.
References nxyter::QuickDaqStats::clear(), base::Board::Debug(), fBoard, fDaqFlushTimer, fDaqHighWater, fDaqLowWater, fFebs, fMaxMsg, fMaxTime, fNextNxMask, fNextNxMaskActive, fRocNx, fStartMsgTime, fStartTime, fState, fStats, fStopCode, nxyter::RocNx::getNxActive(), nxyter::FebBase::initRoc(), base::Board::isFile(), now(), base::Board::setFlushTimeout(), nxyter::RocNx::setNxActive(), roc::UdpBoard::setRocBufferFlushTimer(), roc::UdpBoard::setRocLowHighWater(), base::Board::startDaq(), base::Board::stopDaq(), stopRun(), and roc::Board::uploadStartDaqCmdList().
Referenced by acquire_data(), nxyter::FebUtil::acquireTestTriggerData(), cmd_autosettrh(), cmd_printdata(), cmd_testnxdata(), cmd_testrocaux(), and cmd_testrocsync().
| const QuickDaqStats& nxyter::QuickDaq::stats | ( | ) |  [inline] | 
Access statistics object.
Definition at line 103 of file QuickDaq.h.
References fStats.
Referenced by acquire_data(), nxyter::FebUtil::acquireTestTriggerData(), cmd_printdata(), cmd_scanvbiasf(), cmd_testrocaux(), cmd_testrocsync(), and get_vbiass_data().
| int nxyter::QuickDaq::stopRun | ( | bool | hardstop = false | ) | 
End data taking.
Definition at line 234 of file QuickDaq.cxx.
References fBoard, fIter, fState, fStopCode, fStopTime, kDaqRunning, kDaqStarting, kDaqStopPending, kDaqStopping, roc::Iterator::next(), now(), and base::Board::suspendDaq().
Referenced by startRun(), testRun(), and ~QuickDaq().
| bool nxyter::QuickDaq::testRun | ( | double | timeout = 0. | ) | 
Check run status.
Definition at line 298 of file QuickDaq.cxx.
References fBoard, fDaqStaStoTimeout, fIter, fMaxMsg, fMaxTime, fMsgTime, fNowTime, fStartMsgTime, fStartTime, fState, fStats, fStopCode, fStopMsgTime, fStopTime, roc::Iterator::getMsgFullTimeD(), nxyter::QuickDaqStats::increment(), base::Board::isFile(), roc::Message::isStartDaqMsg(), roc::Message::isStopDaqMsg(), kDaqRunning, kDaqStarting, kDaqStopByInterrupt, kDaqStopped, kDaqStopPending, kDaqStopping, nxyter::QuickDaqStats::kNMessage, roc::Iterator::msg(), msg(), roc::Iterator::next(), now(), and stopRun().
Referenced by acquire_data(), nxyter::FebUtil::acquireTestTriggerData(), cmd_autosettrh(), cmd_printdata(), cmd_testrocaux(), and cmd_testrocsync().
| base::Board* nxyter::QuickDaq::fBoard  [protected] | 
board pointer
Definition at line 21 of file QuickDaq.h.
Referenced by QuickDaq(), startRun(), stopRun(), and testRun().
| uint32_t nxyter::QuickDaq::fDaqFlushTimer  [protected] | 
| int nxyter::QuickDaq::fDaqHighWater  [protected] | 
| int nxyter::QuickDaq::fDaqLowWater  [protected] | 
| double nxyter::QuickDaq::fDaqStaStoTimeout  [protected] | 
| nxyter::FebBase* nxyter::QuickDaq::fFebs[2]  [protected] | 
available FEBs
Definition at line 22 of file QuickDaq.h.
Referenced by QuickDaq(), setNxRegisterAll(), setNxTestModes(), and startRun().
| roc::Iterator nxyter::QuickDaq::fIter  [protected] | 
current iterator
Definition at line 39 of file QuickDaq.h.
Referenced by getMsgEpoch(), msg(), stopRun(), and testRun().
| double nxyter::QuickDaq::fMaxMsg  [protected] | 
maximal number of msg in run
Definition at line 37 of file QuickDaq.h.
Referenced by startRun(), and testRun().
| double nxyter::QuickDaq::fMaxTime  [protected] | 
maximal time of run
Definition at line 38 of file QuickDaq.h.
Referenced by startRun(), and testRun().
| double nxyter::QuickDaq::fMsgTime  [protected] | 
current message time stamp
Definition at line 40 of file QuickDaq.h.
Referenced by getMsgTime(), and testRun().
| int nxyter::QuickDaq::fNextNxMask  [protected] | 
nXYTER mask for next run
Definition at line 32 of file QuickDaq.h.
Referenced by nextRunNxMask(), and startRun().
| bool nxyter::QuickDaq::fNextNxMaskActive  [protected] | 
nextRunNxMask() called
Definition at line 31 of file QuickDaq.h.
Referenced by nextRunNxMask(), and startRun().
| double nxyter::QuickDaq::fNowTime  [protected] | 
wall time of message
Definition at line 41 of file QuickDaq.h.
Referenced by getRunTime(), and testRun().
| nxyter::RocNx nxyter::QuickDaq::fRocNx  [protected] | 
| double nxyter::QuickDaq::fStartMsgTime  [protected] | 
time start message
Definition at line 35 of file QuickDaq.h.
Referenced by startRun(), and testRun().
| double nxyter::QuickDaq::fStartTime  [protected] | 
time start call
Definition at line 33 of file QuickDaq.h.
Referenced by getRunTime(), getStartTime(), startRun(), and testRun().
| int nxyter::QuickDaq::fState  [protected] | 
DAQ state.
Definition at line 24 of file QuickDaq.h.
Referenced by getState(), interruptRun(), startRun(), stopRun(), testRun(), and ~QuickDaq().
| QuickDaqStats nxyter::QuickDaq::fStats  [protected] | 
statistic counters
Definition at line 30 of file QuickDaq.h.
Referenced by startRun(), stats(), and testRun().
| int nxyter::QuickDaq::fStopCode  [protected] | 
DAQ stop code.
Definition at line 25 of file QuickDaq.h.
Referenced by getStopCode(), interruptRun(), startRun(), stopRun(), and testRun().
| double nxyter::QuickDaq::fStopMsgTime  [protected] | 
| double nxyter::QuickDaq::fStopTime  [protected] | 
time stop call
Definition at line 34 of file QuickDaq.h.
Referenced by getStopTime(), stopRun(), and testRun().
 1.7.1
 1.7.1