// // File : ReadoutCmd.hh // // Purpose: Command tag definition file for the readout process // // $Id: ReadoutCmd.hh 9725 2010-09-28 07:31:17Z mathes $ // /** @file ReadoutCmd.hh * Declaration of commands and messages to/from the readout process. * @author H.-J. Mathes, FzK */ #ifndef _ReadoutCmd_hh_ #define _ReadoutCmd_hh_ #ifndef _MiReadout_hh_ # warning # warning File ReadoutCmd.hh is included directly ! # warning Please include MiReadout.hh instead ! # warning #endif // _MiReadout_hh_ #include #include #ifndef NO_VERSION # include #endif // NO_VERSION // /** This class contains all data structures necessary to communicate with the // * readout process. // */ namespace MiReadout { /** Command tag definitions for the communication with the readout process * via the TSockServer and TSockClient classes. */ typedef enum { /* cmds to control data acquisition ... */ READOUT_CMD_ACQ_INIT = 0, READOUT_CMD_ACQ_INIT_ACKN, READOUT_CMD_ACQ_START, /* transfer also RunParametersRec */ READOUT_CMD_ACQ_START_ACKN, READOUT_CMD_ACQ_STOP, READOUT_CMD_ACQ_STOP_ACKN, READOUT_CMD_ACQ_SHUTDOWN, READOUT_CMD_ACQ_SHUTDOWN_ACKN, READOUT_CMD_ACQ_GET_STATUS, /* request DAQ status */ READOUT_CMD_ACQ_STATUS, /* sends back RunStatusRec */ READOUT_CMD_SET_SLT_PARAMETERS, READOUT_CMD_GET_SLT_PARAMETERS, READOUT_CMD_SLT_PARAMETERS, READOUT_CMD_SET_TLT_PARAMETERS, /* exchange parameters for the TLT */ READOUT_CMD_GET_TLT_PARAMETERS, READOUT_CMD_TLT_PARAMETERS, #if 0 READOUT_CMD_LOAD_, /* load/save parameters from a DB (like) store */ READOUT_CMD_SAVE_, #endif READOUT_NUM_CMDS } EReadoutCmd; /* --- readout INIT/START parameters definition --- */ /** First protocol version to communicate with the readout process. */ #define MiREADOUTVERSIONv1 1 /** Second protocol version to communicate with the readout process. */ #define MiREADOUTVERSIONv2 2 /** Third protocol version to communicate with the readout process. */ #define MiREADOUTVERSIONv3 3 /** 4th protocol version to communicate with the readout process. */ #define MiREADOUTVERSIONv4 4 /** 5th protocol version to communicate with the readout process. */ #define MiREADOUTVERSIONv5 5 /** 5th protocol version to communicate with the readout process (v1r15). */ #define MiREADOUTVERSIONv6 6 /** 5th protocol version to communicate with the readout process (v2r1). */ #define MiREADOUTVERSIONv7 7 /** Current protocol version to communicate with the readout process. */ #define MiREADOUTVERSION MiREADOUTVERSIONv7 /** Limit type definitions for the DAQ. */ typedef enum { kNONE, kLIMIT_EVENT, kLIMIT_TIME } ELimitType; /** This structure is sent to the readout process to setup the parameters of * the RUN. This structure is sent together with the READOUT_CMD_ACQ_START * message. It has to be acknowledged by the READOUT_CMD_ACQ_START_ACKN * message. */ typedef struct _RunParametersRec { /** Version of this struct. */ Version_t fVersion; /** Flag, if data is to be saved (not used at the moment). */ int fDoSave; /** The filename, if the data is to be saved * not used at the moment). */ char fFilename[256]; /** Flag, if the run is performed using any limit. * The size and type of the limit are set with the next two parameters. */ int fHasLimit; /** The size of the limit, either in 'number of events' or in 'minutes'. */ int fLimit; /** The type of the limit (no limit, limit in events, limit in time). */ ELimitType fLimitType; /** The RUN Id of the next RUN to be started. */ int fRunId; /** A comment string which is stored in the RUN header. */ char fComment[256]; } RunParametersRec, *RunParameters; /* --- run status definition --- */ /** Structure which is sent after the READOUT_CMD_ACQ_GET_STATUS message * has been sent to the readout process. * This structure is sent with the READOUT_CMD_ACQ_STATUS message. */ typedef struct _RunStatusRec { /** Version of this struct, thus append always at the end !!! */ Version_t fVersion; /** Current DAQ status: 1= RUN, 0= STOP, <0 Error */ int fStatus; /** Number of events recorded so far (T2). */ unsigned int fNEvents; /** Number of triggers seen so far (T1). */ unsigned int fNTriggers; /** Time of RUN start. */ std::time_t fStartTime; /** Total time of the RUN (in seconds). */ unsigned int fRunTime; /** Actual RUN id. */ unsigned int fRunId; /** Accumulated RUN time (since v2r1). */ unsigned long long fRunTimeCounter; /** Accumulated dead time (since v2r1). */ unsigned long long fDeadTimeCounter; /** Accumulated VETO time (since v2r1). */ unsigned long long fVetoTimeCounter; } RunStatusRec, *RunStatus; /** The default settings for the RunStatusRec struct. */ #define DEFAULT_RUN_STATUS \ { MiREADOUTVERSION, \ 0, /* fStatus */ \ 0, /* fNEvents */ \ 0, /* fNTriggers */ \ 0, /* fStartTime */ \ 0, /* fRunTime */ \ 0, /* fRunId */ \ 0ULL, /* fRunTimeCounter */ \ 0ULL, /* fDeadTimeCounter */ \ 0ULL, /* fVetoTimeCounter */ \ } } // namespace MiReadout #ifndef _MiReadout_hh_ # include #endif // _MiReadout_hh_ #endif // _ReadoutCmd_hh_