10 #include <arich/modules/arichRawUnpacker/ARICHRawUnpackerModule.h>
11 #include <arich/dataobjects/ARICHRawDigit.h>
14 #include <framework/datastore/StoreArray.h>
17 #include <rawdata/dataobjects/RawARICH.h>
48 h_rate_a_all =
new TH1F(
"h_rate_a_all",
";Channel ID", 144 * 6, 0, 144 * 6);
49 h_rate_b_all =
new TH1F(
"h_rate_b_all",
";Channel ID", 144 * 6, 0, 144 * 6);
50 h_rate_c_all =
new TH1F(
"h_rate_c_all",
";Channel ID", 144 * 6, 0, 144 * 6);
51 h_rate_d_all =
new TH1F(
"h_rate_d_all",
";Channel ID", 144 * 6, 0, 144 * 6);
67 for (
auto& raw : rawdata) {
68 for (
int finesse = 0; finesse < 4; finesse++) {
69 const int* buf = (
const int*)raw.GetDetectorBuffer(0, finesse);
70 int bufSize = raw.GetDetectorNwords(0, finesse);
71 if (bufSize < 1)
continue;
74 int type = calbyte(buf);
75 int ver = calbyte(buf);
76 int boardid = calbyte(buf);
77 int febno = calbyte(buf);
78 unsigned int length_all = calword(buf);
79 unsigned int mrg_evtno = calword(buf);
81 rawdigit->setCopperId(raw.GetNodeID(0));
82 rawdigit->setHslbId(finesse);
83 while (m_ibyte < length_all) {
84 int type_feb = calbyte(buf);
86 boardid = calbyte(buf);
88 unsigned int length = calword(buf);
89 int evtno = calword(buf);
90 unsigned int ibyte = 0;
92 ss <<
"type=" << type_feb <<
", ver=" << ver <<
" "
93 <<
", boardid=" << boardid <<
", febno=" << febno
94 <<
", length=" << length <<
", evtno=" << evtno <<
" ";
96 long long feb_trigno = 0;
97 for (
int i = 0; i < 10; i++) {
98 int val = calbyte(buf);
100 if (i > 1 && i < 6) {
101 feb_trigno |= (0xff & val) << (5 - i) * 8;
105 if (type_feb == 0x02) {
108 while (ibyte < length) {
109 int val = calbyte(buf);
112 ss <<
"ch# " << ch <<
"(" << val <<
") ";
114 if (febno < 0 || febno > 6) {
115 B2ERROR(
"FEB is bad:" <<
LogVar(
"FEB", std::to_string(febno) +
" hslb-" + std::to_string(finesse))
120 feb.push_back(ch, val);
125 }
else if (type_feb == 0x01) {
126 if (length > 144 * 2 + 10) B2FATAL(
"error " << length);
128 while (ibyte < length) {
129 int ch = calbyte(buf);
131 int val = calbyte(buf);
134 ss <<
"ch# " << ch <<
"(" << val <<
") ";
136 if (febno < 0 || febno > 6) {
137 B2ERROR(
"FEB is bad:" <<
LogVar(
"FEB", std::to_string(febno) +
" hslb-" + std::to_string(finesse))
143 feb.push_back(ch, val);
147 rawdigit->addFEB(feb, type, ver, boardid, febno, length, evtno, feb_trigno);
148 if (m_debug && hasHit) {
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
Class to store variables with their name which were sent to the logging service.
virtual void initialize() override
Initialize the Module.
ARICHRawUnpackerModule()
Constructor.
virtual void event() override
Event processor.
REG_MODULE(arichBtest)
Register the Module.
virtual ~ARICHRawUnpackerModule()
Destructor.
virtual void defineHisto() override
Function to define histograms.
Abstract base class for different kinds of events.