CbmDeviceMonitorT0.h 2.59 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * CbmDeviceMonitorT0.h
 *
 * @since 2019-03-26
 * @author F. Uhlig
 */

#ifndef CBMDEVICEMONITORT0_H_
#define CBMDEVICEMONITORT0_H_

#include "FairMQDevice.h"

#include "Timeslice.hpp"

#include "Rtypes.h"
Administrator's avatar
Administrator committed
16
#include "TMessage.h"
17
18
19
#include "TObjArray.h"

#include <chrono>
Administrator's avatar
Administrator committed
20
21
#include <map>
#include <vector>
22
23
24
25

class TList;
class CbmMcbm2018MonitorAlgoT0;

Administrator's avatar
Administrator committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class CbmDeviceMonitorT0 : public FairMQDevice {
public:
  CbmDeviceMonitorT0();
  virtual ~CbmDeviceMonitorT0();

protected:
  virtual void InitTask();
  bool HandleData(FairMQMessagePtr&, int);

private:
  /// Constants
  static const uint16_t kusSysId = 0x90;

  /// Control flags
  Bool_t
    fbIgnoreOverlapMs;  //! Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice
  Bool_t fbComponentsAddedToList = kFALSE;

  /// User settings parameters
  std::string fsChannelNameDataInput;
  std::string fsChannelNameHistosInput;
  std::string fsChannelNameHistosConfig;
  std::string fsChannelNameCanvasConfig;
  uint32_t fuHistoryHistoSize;
  uint32_t fuMinTotPulser;
  uint32_t fuMaxTotPulser;
  uint32_t fuOffSpillCountLimit;
53
  uint32_t fuOffSpillCountLimitNonPulser;
Pierre-Alain Loizeau's avatar
Pierre-Alain Loizeau committed
54
  double fdSpillCheckInterval;
55
  std::vector<uint32_t> fvuChanMap;
Administrator's avatar
Administrator committed
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  uint32_t fuPublishFreqTs;
  double_t fdMinPublishTime;
  double_t fdMaxPublishTime;

  /// List of MQ channels names
  std::vector<std::string> fsAllowedChannels;

  /// Parameters management
  TList* fParCList;

  /// Statistics & first TS rejection
  uint64_t fulNumMessages;
  uint64_t fulTsCounter;
  std::chrono::system_clock::time_point fLastPublishTime;

  /// Processing algo
  CbmMcbm2018MonitorAlgoT0* fMonitorAlgo;

  /// Array of histograms to send to the histogram server
  TObjArray fArrayHisto;
  /// Vector of string pairs with ( HistoName, FolderPath ) to send to the histogram server
  std::vector<std::pair<std::string, std::string>> fvpsHistosFolder;
  /// Vector of string pairs with ( CanvasName, CanvasConfig ) to send to the histogram server
  /// Format of Can config is "NbPadX(U);NbPadY(U);ConfigPad1(s);....;ConfigPadXY(s)"
  /// Format of Pad config is "GrixX(b),GridY(b),LogX(b),LogY(b),LogZ(b),HistoName(s),DrawOptions(s)"
  std::vector<std::pair<std::string, std::string>> fvpsCanvasConfig;

  bool IsChannelNameAllowed(std::string channelName);
  Bool_t InitContainers();
  Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
  void Finish();
  bool SendHistograms();
88
89
90
};

// special class to expose protected TMessage constructor
Administrator's avatar
Administrator committed
91
92
93
94
95
class CbmMQTMessage : public TMessage {
public:
  CbmMQTMessage(void* buf, Int_t len) : TMessage(buf, len) {
    ResetBit(kIsOwner);
  }
96
97
98
99
};


#endif /* CBMDEVICEMONITORT0_H_ */