-
Notifications
You must be signed in to change notification settings - Fork 3
/
EventBuilder.h
75 lines (55 loc) · 2.05 KB
/
EventBuilder.h
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
/**
* @file EventBuilder.h
* @brief EventBuilder for NestDAQ
* @date Created :
* Last Modified : 2023/07/21 09:43:39
*
* @author Shinsuke OTA <[email protected]>
*
*/
#ifndef NESTDAQ_EVENTBUILDER_H
#define NESTDAQ_EVENTBUILDER_H
#include <fairmq/Device.h>
namespace nestdaq {
class EventBuilder;
}
class nestdaq::EventBuilder : public fair::mq::Device {
public:
struct OptionKey {
static constexpr std::string_view InputChannelName {"in-chan-name"};
static constexpr std::string_view OutputChannelName {"out-chan-name"};
static constexpr std::string_view DQMChannelName {"dqm-chan-name"};
static constexpr std::string_view DataSuppress {"data-suppress"};
static constexpr std::string_view PollTimeout {"poll-timeout"};
static constexpr std::string_view SplitMethod {"split"};
static constexpr std::string_view TrefID {"tref-id"};
static constexpr std::string_view TrefCH {"tref-ch"};
};
EventBuilder();
virtual ~EventBuilder() override = default;
void InitTask() override;
bool ConditionalRun() override;
void PostRun() override;
static bool IsEndDelimiter(uint64_t data);
protected:
std::string fInputChannelName; // name of input channel
std::string fOutputChannelName; // name of output channel
std::string fName; // name of this process
uint32_t fID; // id of this process
int fNumDestination {0};
uint32_t fDirection {0};
int fPollTimeoutMS {0};
int fSplitMethod {0};
uint32_t fTrefID {0};
uint32_t fTrefCH {0};
std::vector<uint64_t> fTref; // store reference tbin
std::vector<std::vector<std::vector<uint64_t>>> fTDCData; // store tdc data in the array of tbin / stfb / nhits
//std::vector<std::vector<uint64_t>> fTDCData;
std::vector<int64_t> fTDCIdx; // idx
};
bool nestdaq::EventBuilder::IsEndDelimiter(uint64_t data)
{
return ((data & 0xf000'0000'0000'0000) == 0x7000'0000'0000'0000
|| (data & 0xf000'0000'0000'0000) == 0x5000'0000'0000'0000 );
}
#endif // NESTDAQ_EVENTBUILDER_H