Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
53
54
55
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
88
89
90
91
92
93
94
95
96
97
98
/**
* CbmDeviceEventBuilderEtofStar2019.h
*
*/
#ifndef CBMDEVICEEVENTBUILDERETOFSTAR2019_H_
#define CBMDEVICEEVENTBUILDERETOFSTAR2019_H_
#include "FairMQDevice.h"
#include "Timeslice.hpp"
#include "TMessage.h"
#include "TStopwatch.h"
class CbmStar2019EventBuilderEtofAlgo;
class CbmStar2019TofPar;
class CbmDeviceEventBuilderEtofStar2019: public FairMQDevice
{
public:
CbmDeviceEventBuilderEtofStar2019();
virtual ~CbmDeviceEventBuilderEtofStar2019();
virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
virtual void Reset();
virtual void Finish();
void SetParContainers();
Bool_t InitContainers();
Bool_t ReInitContainers();
void SetSandboxMode( Bool_t bSandboxMode = kTRUE ){ fbSandboxMode = bSandboxMode; }
void SetEventDumpEnable( Bool_t bDumpEna = kTRUE );
/// Temp until we change from CbmMcbmUnpack to something else
void AddMsComponentToList( size_t component, UShort_t usDetectorId );
void SetNbMsInTs( size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/ ){};
CbmDeviceEventBuilderEtofStar2019(const CbmDeviceEventBuilderEtofStar2019&) = delete;
CbmDeviceEventBuilderEtofStar2019 operator=(const CbmDeviceEventBuilderEtofStar2019&) = delete;
protected:
virtual void InitTask();
bool HandleData(FairMQMessagePtr&, int);
bool HandleParts(FairMQParts&, int);
bool HandleMessage(FairMQMessagePtr&, int);
virtual bool SendEvent(std::vector<Int_t>, int);
virtual bool SendSubevent(uint,char*,int, int);
private:
uint64_t fNumMessages;
/// Control flags
Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms
Bool_t fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms
Bool_t fbSandboxMode; //! Switch OFF the emission of data toward the STAR DAQ
Bool_t fbEventDumpEna; //! Switch ON the dumping of the events to a binary file
/// Parameters management
TList* fParCList;
/// Statistics & first TS rejection
uint64_t fulTsCounter;
uint64_t fNumEvt;
bool CheckTimeslice(const fles::Timeslice& ts);
bool IsChannelNameAllowed(std::string channelName);
std::vector<std::string> fAllowedChannels
= {"tofcomponent","parameters","etofevts","syscmd"};
std::vector<std::vector<std::string>> fChannelsToSend = { {},{},{} };
/// Processing algo
CbmStar2019EventBuilderEtofAlgo * fEventBuilderAlgo;
TStopwatch fTimer;
CbmStar2019TofPar* fUnpackPar; //!
/// Event dump to binary file
std::fstream * fpBinDumpFile;
const UInt_t kuBinDumpBegWord = 0xFEEDBEAF;
const UInt_t kuBinDumpEndWord = 0xFAEBDEEF;
};
// special class to expose protected TMessage constructor
class CbmMQTMessage : public TMessage
{
public:
CbmMQTMessage(void* buf, Int_t len)
: TMessage(buf, len)
{
ResetBit(kIsOwner);
}
};
#endif /* CBMDEVICEEVENTBUILDERETOFSTAR2019_H_ */