DABC (Data Acquisition Backbone Core)  2.9.9
BnetMasterModule.h
Go to the documentation of this file.
1 // $Id: BnetMasterModule.h 4707 2021-02-26 11:29:21Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef HADAQ_BnetMasterModule
17 #define HADAQ_BnetMasterModule
18 
19 #ifndef DABC_ModuleAsync
20 #include "dabc/ModuleAsync.h"
21 #endif
22 
23 #include <vector>
24 #include <string>
25 
26 
27 namespace hadaq {
28 
35  protected:
36 
37  bool fControl;
38  unsigned fMaxRunSize;
40  int fCmdCnt;
42  double fCmdQuality;
43  unsigned fCalibrRunId;
44 
46  int fRefreshCnt{0};
47  int fRefreshReplies{0};
48 
49  int fCtrlId;
52  int fCtrlCnt;
53  bool fCtrlError;
56  std::string fCtrlStateName;
62  double fCtrlData;
63  double fCtrlEvents;
64  double fCtrlLost;
65  uint64_t fCurrentLost;
66  uint64_t fCurrentEvents;
67  uint64_t fCurrentData;
68  uint64_t fTotalLost;
69  uint64_t fTotalEvents;
70  uint64_t fTotalData;
72  unsigned fCtrlRunId;
73  std::string fCtrlRunPrefix;
74  std::vector<std::string> fLastBuilders;
77 
78  virtual bool ReplyCommand(dabc::Command cmd);
79 
80  void AddItem(std::vector<std::string> &items, std::vector<std::string> &nodes, const std::string &item, const std::string &node);
81 
82  void PreserveLastCalibr(bool do_write = false, double quality = 1., unsigned runid = 0);
83 
84  public:
85 
86  BnetMasterModule(const std::string &name, dabc::Command cmd = nullptr);
87 
88  virtual void BeforeModuleStart();
89 
90  virtual void ProcessTimerEvent(unsigned timer);
91 
92  virtual int ExecuteCommand(dabc::Command cmd);
93 
94  };
95 }
96 
97 
98 #endif
Represents command with its arguments.
Definition: Command.h:99
Base class for user-derived code, implementing event-processing.
Definition: ModuleAsync.h:32
Master monitor for BNet components.
void PreserveLastCalibr(bool do_write=false, double quality=1., unsigned runid=0)
double fCtrlEvents
accumulated events rate
virtual int ExecuteCommand(dabc::Command cmd)
Main method where commands are executed.
dabc::TimeStamp fLastRateTm
last time ratemeter was updated
dabc::TimeStamp fNewRunTm
time when last control count was send
int fRefreshCnt
currently running refresh command
int fCtrlInpNodesCnt
count of recognized input nodes
int fCtrlCnt
how many control replies are awaited
unsigned fCtrlRunId
received run id from builders
int fCmdReplies
number of replies for current command
double fCmdQuality
current command quality, used when creating calibration
double fCtrlStateQuality
<0.3 error, <0.7 warning, more is ok
virtual bool ReplyCommand(dabc::Command cmd)
Reimplement this method to react on command reply Return true if command can be destroyed by framewor...
uint64_t fCurrentData
current value
uint64_t fTotalData
last value
unsigned fMaxRunSize
maximal run size in MB
uint64_t fTotalLost
last value
uint64_t fTotalEvents
last value
int fCtrlBldNodesExpect
count of expected builder nodes
uint64_t fCurrentLost
current value
BnetMasterModule(const std::string &name, dabc::Command cmd=nullptr)
uint64_t fCurrentEvents
current value
virtual void BeforeModuleStart()
std::string fCtrlStateName
current name
dabc::Command fCurrentRefreshCmd
currently running cmd to refresh nodes qualities
std::vector< std::string > fLastBuilders
last list of builder nodes
int fCtrlErrorCnt
number of consequent control errors
int fCtrlSzLimit
0 - do nothing, 1 - start checking (after start run), 2 - exced
virtual void ProcessTimerEvent(unsigned timer)
Method called by framework when timer event is produced.
unsigned fCalibrRunId
last calibration runid
int fCtrlId
counter for control requests
int fSameBuildersCnt
how many time same number of inputs was detected
dabc::Command fCurrentFileCmd
currently running cmd to switch files
std::string fCtrlRunPrefix
received run prefix from builders
bool fCtrlError
if there are error during current communication loop
dabc::TimeStamp fCtrlTm
time when last control count was send
int fCtrlBldNodesCnt
count of recognized builder nodes
int fCtrlInpNodesExpect
count of expected input nodes
dabc::Command fInitRunCmd
command used to start run at very beginning, uses delay technique
bool fControl
when true, master actively controls BNET nodes and switches to new RUNs
double fCtrlData
accumulated data rate
int fRefreshReplies
number of replies for current command
void AddItem(std::vector< std::string > &items, std::vector< std::string > &nodes, const std::string &item, const std::string &node)
double fCtrlLost
accumulated lost rate
int fCmdCnt
just counter to avoid mismatch
Support for HADAQ - HADES DAQ
Definition: api.h:27
Class for acquiring and holding timestamps.
Definition: timing.h:40