Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

nxyter::QuickDaq Class Reference

Simple DAQ environent for setups with a single ROC and 0-2 FEBs. More...

#include <QuickDaq.h>

Collaboration diagram for nxyter::QuickDaq:
Collaboration graph
[legend]

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::Messagemsg ()
 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 QuickDaqStatsstats ()
 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::BoardfBoard
 board pointer
nxyter::FebBasefFebs [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

Detailed Description

Simple DAQ environent for setups with a single ROC and 0-2 FEBs.

Definition at line 19 of file QuickDaq.h.


Member Enumeration Documentation

Names for DAQ states.

Enumerator:
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.

Enumerator:
kDaqStopPending 

DAQ active or never started.

kDaqStopByCount 

stop due to message count

kDaqStopByTime 

stop due to time expired

kDaqStopByInterrupt 

stop due to interrupt()

kDaqStopByStop 

stop due to stop()

kDaqStopByTimeout 

stop due to timeout

Definition at line 53 of file QuickDaq.h.


Constructor & Destructor Documentation

nxyter::QuickDaq::QuickDaq ( base::Board board  )  [explicit]

Constructor with Board and no FEB.

Sets up QuickDaq object with no FEB.

Parameters:
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.

Parameters:
feb0 1st connected FEB (maybe 0)
feb1 2nd connected FEB (maybe 0)
Exceptions:
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]
Todo:
recheck dtor logic, is buffer drain needed with DABC (it is with KNUT)

Definition at line 95 of file QuickDaq.cxx.

References fState, kDaqRunning, and stopRun().


Member Function Documentation

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]

Returns DAQ state.

Definition at line 107 of file QuickDaq.h.

References fState.

int nxyter::QuickDaq::getStopCode (  )  [inline]

Returns DAQ stop code.

Definition at line 111 of file QuickDaq.h.

References fStopCode.

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.

Parameters:
reg register number
val value to be written
veri if true readback verification done (default is true)
Returns:
see roc::Board get/put/oper return codes

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.

Parameters:
testtrig determines whether test trigger mode is enabled
testpuls determines whether test pulser mode is enabled
calselect determines which channel group receives test pulse
Returns:
see roc::Board get/put/oper return codes

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 
)
const QuickDaqStats& nxyter::QuickDaq::stats (  )  [inline]
int nxyter::QuickDaq::stopRun ( bool  hardstop = false  ) 
bool nxyter::QuickDaq::testRun ( double  timeout = 0.  ) 

Field Documentation

board pointer

Definition at line 21 of file QuickDaq.h.

Referenced by QuickDaq(), startRun(), stopRun(), and testRun().

uint32_t nxyter::QuickDaq::fDaqFlushTimer [protected]

for setRocBufferFlushTimer

Definition at line 28 of file QuickDaq.h.

Referenced by startRun().

for setRocLowHighWater

Definition at line 27 of file QuickDaq.h.

Referenced by startRun().

for setRocLowHighWater

Definition at line 26 of file QuickDaq.h.

Referenced by startRun().

timeout for start/stop

Definition at line 29 of file QuickDaq.h.

Referenced by testRun().

available FEBs

Definition at line 22 of file QuickDaq.h.

Referenced by QuickDaq(), setNxRegisterAll(), setNxTestModes(), and startRun().

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().

nXYTER mask for next run

Definition at line 32 of file QuickDaq.h.

Referenced by nextRunNxMask(), and startRun().

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().

rocnx pointer

Definition at line 23 of file QuickDaq.h.

Referenced by startRun().

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().

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]

time stop message

Definition at line 36 of file QuickDaq.h.

Referenced by testRun().

double nxyter::QuickDaq::fStopTime [protected]

time stop call

Definition at line 34 of file QuickDaq.h.

Referenced by getStopTime(), stopRun(), and testRun().


The documentation for this class was generated from the following files: