MIDAS
Loading...
Searching...
No Matches
EqRandom Class Reference
Inheritance diagram for EqRandom:
Collaboration diagram for EqRandom:

Public Member Functions

 EqRandom (const char *eqname, const char *eqfilename)
 
TMFeResult HandleInit (const std::vector< std::string > &args)
 
void HandlePeriodic ()
 
- Public Member Functions inherited from TMFeEquipment
 TMFeEquipment (const char *eqname, const char *eqfilename)
 
virtual ~TMFeEquipment ()
 
TMFeResult EqInit (const std::vector< std::string > &args)
 Initialize equipment.
 
TMFeResult EqPreInit ()
 Initialize equipment, before EquipmentBase::Init()
 
TMFeResult EqPostInit ()
 Initialize equipment, after EquipmentBase::Init()
 
TMFeResult EqReadCommon ()
 Read TMFeEqInfo from ODB /Equipment/NAME/Common.
 
TMFeResult EqWriteCommon (bool create=false)
 Write TMFeEqInfo to ODB /Equipment/NAME/Common.
 
virtual void HandleUsage ()
 
virtual TMFeResult HandleBeginRun (int run_number)
 
virtual TMFeResult HandleEndRun (int run_number)
 
virtual TMFeResult HandlePauseRun (int run_number)
 
virtual TMFeResult HandleResumeRun (int run_number)
 
virtual TMFeResult HandleStartAbortRun (int run_number)
 
virtual TMFeResult HandleRpc (const char *cmd, const char *args, std::string &response)
 
virtual bool HandlePoll ()
 
virtual void HandlePollRead ()
 
void EqPollThread ()
 
void EqStartPollThread ()
 
void EqStopPollThread ()
 
TMFeResult ComposeEvent (char *pevent, size_t size) const
 
TMFeResult BkInit (char *pevent, size_t size) const
 
voidBkOpen (char *pevent, const char *bank_name, int bank_type) const
 
TMFeResult BkClose (char *pevent, void *ptr) const
 
int BkSize (const char *pevent) const
 
TMFeResult EqSendEvent (const char *pevent, bool write_to_odb=true)
 
TMFeResult EqSendEvent (const std::vector< char > &event, bool write_to_odb=true)
 
TMFeResult EqSendEvent (const std::vector< std::vector< char > > &event, bool write_to_odb=true)
 
TMFeResult EqSendEvent (int sg_n, const char *sg_ptr[], const size_t sg_len[], bool write_to_odb=true)
 
TMFeResult EqWriteEventToOdb (const char *pevent)
 
TMFeResult EqZeroStatistics ()
 
TMFeResult EqWriteStatistics ()
 
TMFeResult EqSetStatus (const char *status, const char *color)
 
 TMFeEquipment (TMFE *mfe, const char *name, TMFeCommon *common)
 
TMFeError Init ()
 Initialize equipment.
 
TMFeError SendData (const char *data, int size)
 ...
 
TMFeError ComposeEvent (char *pevent, int size)
 
TMFeError BkInit (char *pevent, int size)
 
voidBkOpen (char *pevent, const char *bank_name, int bank_type)
 
TMFeError BkClose (char *pevent, void *ptr)
 
int BkSize (const char *pevent)
 
TMFeError SendEvent (const char *pevent)
 
TMFeError ZeroStatistics ()
 
TMFeError WriteStatistics ()
 
TMFeError SetStatus (const char *status, const char *color)
 
- Public Member Functions inherited from TMFeRpcHandlerInterface
virtual TMFeResult HandleBinaryRpc (const char *cmd, const char *args, std::vector< char > &result)
 
virtual void HandleBeginRun ()
 
virtual void HandleEndRun ()
 
virtual void HandlePauseRun ()
 
virtual void HandleResumeRun ()
 
virtual void HandleStartAbortRun ()
 
virtual std::string HandleRpc (const char *cmd, const char *args)
 

Additional Inherited Members

- Public Attributes inherited from TMFeEquipment
std::string fEqName
 
std::string fEqFilename
 
bool fEqConfEnableRpc = true
 
bool fEqConfEnablePeriodic = true
 
bool fEqConfEnablePoll = false
 
bool fEqConfReadConfigFromOdb = true
 
bool fEqConfEnabled = true
 
uint16_t fEqConfEventID = 1
 
uint16_t fEqConfTriggerMask = 0
 
std::string fEqConfBuffer = "SYSTEM"
 
int fEqConfType = 0
 
int fEqConfSource = 0
 
std::string fEqConfFormat = "MIDAS"
 
int fEqConfReadOn = 0
 
int fEqConfPeriodMilliSec = 1000
 
double fEqConfEventLimit = 0
 
uint32_t fEqConfNumSubEvents = 0
 
int fEqConfLogHistory = 0
 
bool fEqConfHidden = false
 
int fEqConfWriteCacheSize = 10000000
 
bool fEqConfReadOnlyWhenRunning = true
 
bool fEqConfWriteEventsToOdb = false
 
double fEqConfPeriodStatisticsSec = 1.0
 
double fEqConfPollSleepSec = 0.000100
 
size_t fEqConfMaxEventSize = 0
 
size_t fEqConfBufferSize = 0
 
std::mutex fEqMutex
 
TMFEfMfe = NULL
 
TMFrontendfFe = NULL
 
MVOdbfOdbEq = NULL
 ODB Equipment/EQNAME.
 
MVOdbfOdbEqCommon = NULL
 ODB Equipment/EQNAME/Common.
 
MVOdbfOdbEqSettings = NULL
 ODB Equipment/EQNAME/Settings.
 
MVOdbfOdbEqVariables = NULL
 ODB Equipment/EQNAME/Variables.
 
MVOdbfOdbEqStatistics = NULL
 ODB Equipment/EQNAME/Statistics.
 
TMEventBufferfEqEventBuffer = NULL
 
int fEqSerial = 0
 
double fEqStatEvents = 0
 
double fEqStatBytes = 0
 
double fEqStatEpS = 0
 
double fEqStatKBpS = 0
 
double fEqStatLastTime = 0
 
double fEqStatLastEvents = 0
 
double fEqStatLastBytes = 0
 
double fEqStatLastWrite = 0
 
double fEqStatNextWrite = 0
 
double fEqPeriodicLastCallTime = 0
 
double fEqPeriodicNextCallTime = 0
 
std::atomic_bool fEqPollThreadStarting {false}
 
std::atomic_bool fEqPollThreadRunning {false}
 
std::atomic_bool fEqPollThreadShutdownRequested {false}
 
std::thread * fEqPollThread = NULL
 
std::string fName
 
TMFeCommonfCommon
 
int fBufferHandle
 
int fSerial
 
double fStatEvents
 
double fStatBytes
 
double fStatEpS
 
double fStatKBpS
 
double fStatLastTime
 
double fStatLastEvents
 
double fStatLastBytes
 

Detailed Description

Definition at line 25 of file fetest.cxx.

Constructor & Destructor Documentation

◆ EqRandom()

EqRandom::EqRandom ( const char eqname,
const char eqfilename 
)
inline

Definition at line 29 of file fetest.cxx.

31 {
37 }
bool fEqConfWriteEventsToOdb
Definition tmfe.h:197
uint16_t fEqConfEventID
Definition tmfe.h:171
int fEqConfPeriodMilliSec
Definition tmfe.h:178
TMFeEquipment()
Definition tmfe.h:255
int fEqConfLogHistory
Definition tmfe.h:181
bool fEqConfReadOnlyWhenRunning
Definition tmfe.h:196
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24

Member Function Documentation

◆ HandleInit()

TMFeResult EqRandom::HandleInit ( const std::vector< std::string > &  args)
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 39 of file fetest.cxx.

40 {
44 return TMFeOk();
45 }
TMFeResult TMFeOk()
Definition tmfe.h:106
Here is the call graph for this function:

◆ HandlePeriodic()

void EqRandom::HandlePeriodic ( )
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 47 of file fetest.cxx.

48 {
49 char event[fEqConfMaxEventSize];
50
52
53 char* pbh = event + sizeof(EVENT_HEADER);
54
55 double r = drand48();
56 if (r < 0.3)
57 bk_init(pbh);
58 else if (r < 0.6)
60 else
62
63 int nbank = 0+9*drand48(); // nbank range: 0..9, see how bank names are generated: RND0..RND9
64
65 for (int i=0; i<nbank; i++) {
66 int tid = 1+(TID_LAST-1)*drand48();
67 int size = 0+100*drand48();
68
69 //int total = bk_size(pbh);
70 //printf("total %d, add %d, max %d\n", total, size, (int)fMaxEventSize);
71
72 char name[5];
73 name[0] = 'R';
74 name[1] = 'N';
75 name[2] = 'D';
76 name[3] = '0' + (nbank-i-1);
77 name[4] = 0;
78
79 char* ptr;
80 bk_create(pbh, name, tid, (void**)&ptr);
81
82 for (int j=0; j<size; j++)
83 ptr[j] = (nbank-i-1);
84
85 bk_close(pbh, ptr + size);
86 }
87
88 //printf("sending %d, max %d\n", (int)bk_size(pbh), (int)fMaxEventSize);
89
90 EqSendEvent(event);
91 }
TMFeResult ComposeEvent(char *pevent, size_t size) const
Definition tmfe.cxx:1995
TMFeResult EqSendEvent(const char *pevent, bool write_to_odb=true)
Definition tmfe.cxx:2006
size_t fEqConfMaxEventSize
Definition tmfe.h:200
void bk_init32a(void *event)
Definition midas.cxx:16482
INT bk_close(void *event, void *pdata)
Definition midas.cxx:16780
void bk_init(void *event)
Definition midas.cxx:16406
void bk_init32(void *event)
Definition midas.cxx:16469
void bk_create(void *event, const char *name, WORD type, void **pdata)
Definition midas.cxx:16561
#define TID_LAST
Definition midas.h:354
INT i
Definition mdump.cxx:32
#define name(x)
Definition midas_macro.h:24
INT j
Definition odbhist.cxx:40
Here is the call graph for this function:

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