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

Public Member Functions

 EqTrigger (const char *eqname, const char *eqfilename)
 
 ~EqTrigger ()
 
void HandleUsage ()
 
TMFeResult HandleInit (const std::vector< std::string > &args)
 
TMFeResult HandleRpc (const char *cmd, const char *args, std::string &response)
 
TMFeResult HandleBeginRun (int run_number)
 
TMFeResult HandleEndRun (int run_number)
 
bool HandlePoll ()
 
void HandlePollRead ()
 
- 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 TMFeResult HandlePauseRun (int run_number)
 
virtual TMFeResult HandleResumeRun (int run_number)
 
virtual TMFeResult HandleStartAbortRun (int run_number)
 
virtual void HandlePeriodic ()
 
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 93 of file tmfe_example_frontend.cxx.

Constructor & Destructor Documentation

◆ EqTrigger()

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

Definition at line 97 of file tmfe_example_frontend.cxx.

99 {
100 /* configure your equipment here */
101
103 fEqConfEventID = 1;
104 fEqConfBuffer = "SYSTEM";
105 fEqConfPeriodMilliSec = 0; // in milliseconds
108 //fEqConfWriteEventsToOdb = true;
109 fEqConfEnablePoll = true; // enable polled equipment
110 //fEqConfPollSleepSec = 0; // to create a "100% CPU busy" polling loop, set poll sleep time to zero
111 fEqConfPollSleepSec = 0.010; // limit event rate to 100 Hz. In a real experiment remove this line
112 }
uint16_t fEqConfEventID
Definition tmfe.h:171
double fEqConfPollSleepSec
Definition tmfe.h:199
int fEqConfPeriodMilliSec
Definition tmfe.h:178
TMFeEquipment()
Definition tmfe.h:255
int fEqConfLogHistory
Definition tmfe.h:181
bool fEqConfReadConfigFromOdb
Definition tmfe.h:168
bool fEqConfEnablePoll
Definition tmfe.h:166
std::string fEqConfBuffer
Definition tmfe.h:173
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

◆ ~EqTrigger()

EqTrigger::~EqTrigger ( )
inline

Definition at line 114 of file tmfe_example_frontend.cxx.

115 {
116 }

Member Function Documentation

◆ HandleBeginRun()

TMFeResult EqTrigger::HandleBeginRun ( int  run_number)
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 142 of file tmfe_example_frontend.cxx.

143 {
144 /* put here clear scalers etc. */
145 return TMFeOk();
146 }
TMFeResult TMFeOk()
Definition tmfe.h:106
Here is the call graph for this function:

◆ HandleEndRun()

TMFeResult EqTrigger::HandleEndRun ( int  run_number)
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 148 of file tmfe_example_frontend.cxx.

149 {
150 return TMFeOk();
151 }
Here is the call graph for this function:

◆ HandleInit()

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

Reimplemented from TMFeEquipment.

Definition at line 123 of file tmfe_example_frontend.cxx.

124 {
125 /* put any hardware initialization here */
126
127
128 /* start poll thread here */
129
130 //EqStartPollThread();
131
132 /* return TMFeErrorMessage("my error message") if frontend should not be started */
133 return TMFeOk();
134 }
Here is the call graph for this function:

◆ HandlePoll()

bool EqTrigger::HandlePoll ( )
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 153 of file tmfe_example_frontend.cxx.

154 {
155 /* Polling routine for events. Returns TRUE if event is available */
156 return true;
157 }

◆ HandlePollRead()

void EqTrigger::HandlePollRead ( )
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 159 of file tmfe_example_frontend.cxx.

160 {
161 char buf[1024];
162 ComposeEvent(buf, sizeof(buf));
163 BkInit(buf, sizeof(buf));
164
165 /* create structured ADC0 bank */
166 uint32_t* pdata = (uint32_t*)BkOpen(buf, "ADC0", TID_UINT32);
167
168 /* following code to "simulates" some ADC data */
169 for (int a = 0; a < 4; a++)
170 *pdata++ = rand()%1024 + rand()%1024 + rand()%1024 + rand()%1024;
171
172 BkClose(buf, pdata);
173
174 /* create variable length TDC bank */
175 pdata = (uint32_t*)BkOpen(buf, "TDC0", TID_UINT32);
176
177 /* following code to "simulates" some TDC data */
178 for (int a = 0; a < 4; a++)
179 *pdata++ = rand()%1024 + rand()%1024 + rand()%1024 + rand()%1024;
180
181 BkClose(buf, pdata);
182
183 EqSendEvent(buf);
184 }
void * BkOpen(char *pevent, const char *bank_name, int bank_type) const
Definition tmfe.cxx:2201
TMFeResult BkInit(char *pevent, size_t size) const
Definition tmfe.cxx:2195
TMFeResult BkClose(char *pevent, void *ptr) const
Definition tmfe.cxx:2208
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
#define TID_UINT32
Definition midas.h:337
Here is the call graph for this function:

◆ HandleRpc()

TMFeResult EqTrigger::HandleRpc ( const char cmd,
const char args,
std::string &  response 
)
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 136 of file tmfe_example_frontend.cxx.

137 {
138 /* handler for JRPC into the frontend, see tmfe_example_everything.cxx */
139 return TMFeOk();
140 }
Here is the call graph for this function:

◆ HandleUsage()

void EqTrigger::HandleUsage ( )
inlinevirtual

Reimplemented from TMFeEquipment.

Definition at line 118 of file tmfe_example_frontend.cxx.

119 {
120 printf("EqTrigger::Usage!\n");
121 }
Here is the call graph for this function:

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