ROOTANA
Loading...
Searching...
No Matches
UnpackVF48A.h
Go to the documentation of this file.
1// UnpackVF48A.h
2
3#ifndef UnpackVF48A_H
4#define UnpackVF48A_H
5
6#include <stdint.h>
7#include <deque>
8
9#define VF48_MAX_MODULES 22
10#define VF48_MAX_GROUPS 6
11#define VF48_MAX_CHANNELS 48
12#define VF48_MAX_SAMPLES 1100
13
15{
17 uint32_t time;
18 uint32_t charge;
22};
23
25{
26 int unit;
27 uint32_t trigger;
28 int error;
29 int tgroup;
34 uint32_t groupMask;
37 //int numSamples;
38 //int numChannels;
39 int presentMask[VF48_MAX_GROUPS]; // mask of channels present in the data
40 int hitMask[VF48_MAX_GROUPS]; // mask of channels that have hits detected by firmware
42
43 VF48module(int i); // ctor
44
45 void PrintModule() const;
46};
47
49{
52 int error;
53 uint32_t modulesMask;
54 double timestamp;
56
57 VF48event(int eventNo); // ctor
58
59 ~VF48event(); // dtor
60
61 void PrintSummary() const;
62 void PrintEvent() const;
63};
64
66{
67 public:
68 UnpackVF48(); // ctor
69 ~UnpackVF48(); // dtor
70
71 void Reset();
72
73 void UnpackStream(int module, const void* data_ptr, int data_size);
74 VF48event* GetEvent(bool flush=false);
75
76 void SetNumModules(int num_modules);
77 void SetModulesMask(uint32_t mask);
78 void SetGroupEnableMask(int module, int grp_enable_mask);
79 void SetNumSamples(int module, int num_samples);
80
81 void SetDisasm(bool stream, bool structure, bool samples);
82
83 void SetCoincTime(double time_sec);
84 void SetTimestampResync(bool enable);
85 void SetTsFreq(int module, double ts_freq_hz);
86 void SetChanEnable(int module, int grp, int chan_enable);
87 void SetFlushIncompleteThreshold(int threshold);
88
89 double GetTsFreq(int module);
90
91 public:
93 uint32_t fModulesMask;
98 double fCoinc;
100
104
106
109
110 // buffer of pending events
111 std::deque<VF48event*> fBuffer;
112
113 // buffer of stream data
120
121 // timestamps
124
125 private:
126 void UnpackEvent(int module, int group, const uint32_t* data, int wcount);
127 VF48event* FindEvent(int unit, double timestamp, bool dup = false);
128 VF48module* FindModule(int unit, int group, double timestamp);
129 void AddToEvent(VF48module* m);
130 void CompleteModule(VF48module* m);
131 void CompleteEvent(VF48event* e);
132 void ResetEventBuffer();
133 void ResetStreamBuffer();
134 void PrintAllEvents();
135 int NewGroup(int unit);
136};
137
138#endif
139// end
#define VF48_MAX_SAMPLES
Definition UnpackVF48A.h:12
#define VF48_MAX_MODULES
Definition UnpackVF48A.h:9
#define VF48_MAX_CHANNELS
Definition UnpackVF48A.h:11
#define VF48_MAX_GROUPS
Definition UnpackVF48A.h:10
void SetNumModules(int num_modules)
bool fDisasmStream
void UnpackEvent(int module, int group, const uint32_t *data, int wcount)
void SetTsFreq(int module, double ts_freq_hz)
bool wacc[VF48_MAX_MODULES][VF48_MAX_GROUPS]
bool fChanEnabled[VF48_MAX_MODULES][VF48_MAX_CHANNELS]
Definition UnpackVF48A.h:95
unsigned fFlushIncompleteThreshold
Definition UnpackVF48A.h:99
void CompleteModule(VF48module *m)
bool fDisasmSamples
VF48event * FindEvent(int unit, double timestamp, bool dup=false)
void SetChanEnable(int module, int grp, int chan_enable)
void CompleteEvent(VF48event *e)
void SetNumSamples(int module, int num_samples)
int wgrp[VF48_MAX_MODULES]
int NewGroup(int unit)
VF48module * FindModule(int unit, int group, double timestamp)
double fCoinc
Definition UnpackVF48A.h:98
int wdiscarded[VF48_MAX_MODULES]
void SetModulesMask(uint32_t mask)
void SetTimestampResync(bool enable)
int wptr[VF48_MAX_MODULES][VF48_MAX_GROUPS]
double GetTsFreq(int module)
bool fTimestampResyncEnable
void SetFlushIncompleteThreshold(int threshold)
void PrintAllEvents()
void UnpackStream(int module, const void *data_ptr, int data_size)
int fNumModules
Definition UnpackVF48A.h:92
uint32_t fModulesMask
Definition UnpackVF48A.h:93
uint64_t ts_first[VF48_MAX_MODULES][VF48_MAX_GROUPS]
void ResetStreamBuffer()
void SetCoincTime(double time_sec)
double fFreq[VF48_MAX_MODULES]
Definition UnpackVF48A.h:97
int fNumSamples[VF48_MAX_MODULES]
Definition UnpackVF48A.h:96
uint32_t fGroupEnabled[VF48_MAX_MODULES]
Definition UnpackVF48A.h:94
void AddToEvent(VF48module *m)
uint32_t * wbuf[VF48_MAX_MODULES][VF48_MAX_GROUPS]
bool fDisasmStructure
void SetDisasm(bool stream, bool structure, bool samples)
void SetGroupEnableMask(int module, int grp_enable_mask)
void ResetEventBuffer()
uint64_t ts_last[VF48_MAX_MODULES][VF48_MAX_GROUPS]
VF48event * GetEvent(bool flush=false)
int fBadDataCount
std::deque< VF48event * > fBuffer
int wmax[VF48_MAX_MODULES][VF48_MAX_GROUPS]
uint32_t time
Definition UnpackVF48A.h:17
uint32_t charge
Definition UnpackVF48A.h:18
uint16_t samples[VF48_MAX_SAMPLES]
Definition UnpackVF48A.h:21
void PrintSummary() const
VF48module * modules[VF48_MAX_MODULES]
Definition UnpackVF48A.h:55
double timestamp
Definition UnpackVF48A.h:54
void PrintEvent() const
uint32_t modulesMask
Definition UnpackVF48A.h:53
VF48channel channels[VF48_MAX_CHANNELS]
Definition UnpackVF48A.h:41
uint32_t completeGroupMask
Definition UnpackVF48A.h:35
uint64_t timestamp64[VF48_MAX_GROUPS]
Definition UnpackVF48A.h:31
double timestamps[VF48_MAX_GROUPS]
Definition UnpackVF48A.h:32
int presentMask[VF48_MAX_GROUPS]
Definition UnpackVF48A.h:39
uint32_t timestampGroupMask
Definition UnpackVF48A.h:30
int hitMask[VF48_MAX_GROUPS]
Definition UnpackVF48A.h:40
void PrintModule() const
uint32_t trigno[VF48_MAX_GROUPS]
Definition UnpackVF48A.h:33
uint32_t trigger
Definition UnpackVF48A.h:27
uint32_t groupMask
Definition UnpackVF48A.h:34
bool complete
Definition UnpackVF48A.h:36