21#include <trg/cdc/modules/trgcdcetfUnpacker/TRGCDCETFUnpackerModule.h>
25using namespace TRGCDCETFUNPACKERSPACE;
32 return string(
"1.00");
39 string desc =
"TRGCDCETFUnpackerModule(" +
version() +
")";
41 B2INFO(
"TRGCDCETFUnpacker: Constructor done.");
69 for (
int i = 0; i < raw_trgarray.
getEntries(); i++) {
72 if (raw_trgarray[i]->GetMaxNumOfCh(0) == 48) {
m_pciedata =
true; }
73 else if (raw_trgarray[i]->GetMaxNumOfCh(0) == 4) {
m_pciedata =
false; }
74 else { B2FATAL(
"TRGCDCETFUnpackerModule: Invalid value of GetMaxNumOfCh from raw data: " <<
LogVar(
"Number of ch: ", raw_trgarray[i]->GetMaxNumOfCh(0))); }
76 unsigned int node_id = 0;
77 unsigned int ch_id = 0;
86 for (
int j = 0; j < raw_trgarray[i]->GetNumEntries(); j++) {
87 if (raw_trgarray[i]->GetNodeID(j) == node_id) {
88 if (raw_trgarray[i]->GetDetectorNwords(j, ch_id) > 0) {
99 const unsigned nword_header = 3;
102 for (
int clk = 0; clk < nClks; clk++) {
105 int ntups =
m_store.getEntries() - 1;
106 int* bitArray[nLeafs + nLeafsExtra];
107 setLeafPointersArray(
m_store[ntups], bitArray);
108 for (
int l = 0; l < nLeafs + nLeafsExtra; l++) *bitArray[l] = 0;
112 m_store[ntups]->m_firmid = buf[0];
113 m_store[ntups]->m_firmvers = buf[1];
137 for (
unsigned _wd = 0; _wd < nBits / 32; _wd++) {
138 unsigned wd = buf[clk * (nBits / 32) + _wd + nword_header];
139 for (
int bb = 0; bb < 32; bb++) {
140 if ((wd >> (31 - bb)) & 1) {
141 int bitPosition = (nBits - 1) - _wd * 32 - bb;
143 leaf < nLeafs; leaf++) {
144 int bitMaxOfTheLeaf = BitMap[leaf][0];
145 int bitWidOfTheLeaf = BitMap[leaf][1];
146 int bitMinOfTheLeaf = bitMaxOfTheLeaf - bitWidOfTheLeaf;
147 if (bitMinOfTheLeaf <= bitPosition && bitPosition <= bitMaxOfTheLeaf) {
148 *bitArray[leaf] |= (1 << (bitPosition - bitMinOfTheLeaf));
void setDescription(const std::string &description)
Sets the description of the module.
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
bool m_pciedata
PCIe40 data or copper data.
virtual ~TRGCDCETFUnpackerModule()
Destructor.
virtual void initialize() override
Initilizes TRGCDCETFUnpackerUnpackerModule.
virtual void event() override
Called event by event.
virtual void endRun() override
Called when run ended.
unsigned int m_pcie40_ch
channel ID of PCIe40 module
virtual void terminate() override
Called when processing ended.
virtual void beginRun() override
Called when new run started.
virtual void fillTreeTRGCDCETFUnpacker(int *buf, int evt)
Unpacker main function.
unsigned int m_pcie40_address
address of PCIe40 module
StoreArray< TRGCDCETFUnpackerStore > m_store
Output datastore for unpacker.
unsigned int m_copper_address
address of copper module
TRGCDCETFUnpackerModule()
Constructor.
std::string version() const
returns version of TRGCDCETFUnpackerModule.
unsigned int m_copper_ab
address of copper module
Class to store variables with their name which were sent to the logging service.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.