8 : buffer_(nullptr), parseInternalData_(parseInternalData), debug_(
debug),
parameters(parserParameters) {
22 errors_[
"DCC::EVENT LENGTH"] = 0;
34 uint32_t tf(0), srf(0);
36 if ((nTT * tSamples) < 4 || (nTT * tSamples) % 4)
41 if (srf < 16 || srf % 16)
70 std::vector<std::string> dataVector;
74 dataVector.push_back(myWord);
79 uint32_t *myData =
new uint32_t[dataVector.size()];
80 uint32_t *
const myDataBeginning = myData;
83 for (uint32_t
i = 1;
i <= dataVector.size();
i++, myData++) {
84 sscanf((dataVector[
i - 1]).c_str(),
"%x", myData);
93 delete[] myDataBeginning;
112 std::vector<DCCTBEventBlock *>::iterator it;
124 if (bufferSize % 8) {
126 fatalError +=
"\n ======================================================================";
128 fatalError +=
"\n Buffer Size of = " +
getDecString(bufferSize) +
"[bytes] is not divisible by 8 ... ";
129 fatalError +=
"\n ======================================================================";
134 fatalError +=
"\n ======================================================================";
136 fatalError +=
"\n Buffer Size of = " +
getDecString(bufferSize) +
"[bytes] is less than an empty event ... ";
137 fatalError +=
"\n ======================================================================";
141 const uint32_t *myPointer =
buffer_;
144 uint32_t processedBytes(0), wordIndex(0), eventLength(0), errorMask(0);
155 uint32_t bytesToEnd = bufferSize - processedBytes;
156 std::pair<uint32_t, uint32_t> eventD =
checkEventLength(myPointer, bytesToEnd, singleEvent);
157 eventLength = eventD.second;
158 errorMask = eventD.first;
174 new DCCTBEventBlock(
this, myPointer, eventLength * 8, eventLength * 2 - 1, wordIndex, 0);
181 std::pair<const uint32_t *, uint32_t> eventPointer(myPointer, eventLength);
182 std::pair<uint32_t, std::pair<const uint32_t *, uint32_t> > eventPointerWithErrorMask(errorMask, eventPointer);
183 events_.push_back(eventPointerWithErrorMask);
187 processedBytes += eventLength * 8;
191 myPointer += eventLength * 2;
192 wordIndex += eventLength * 2;
209 std::pair<uint32_t, uint32_t>
result;
210 uint32_t errorMask(0);
214 const uint32_t *boePointer = pointerToEvent + 1;
221 const uint32_t *myPointer = pointerToEvent + 2;
226 bool eoeError =
false;
229 if (singleEvent && eventLength != bytesToEnd / 8) {
230 eventLength = bytesToEnd / 8;
231 (
errors_[
"DCC::EVENT LENGTH"])++;
232 errorMask = errorMask | (1 << 1);
235 else if (eventLength == 0 || eventLength > (bytesToEnd / 8) || eventLength < (
EMPTYEVENTSIZE / 8)) {
241 fatalError +=
"\n ======================================================================";
243 fatalError +=
"\n Decoded event length = " +
getDecString(eventLength);
244 fatalError +=
"\n bytes to buffer end = " +
getDecString(bytesToEnd);
245 fatalError +=
"\n Unable to procead the data decoding ...";
247 if (eventLength > (bytesToEnd / 8)) {
248 fatalError +=
" (eventLength > (bytesToEnd / 8)";
250 fatalError +=
"\n event length not big enough heaven to build an empty event ( 4x8 bytes)";
253 fatalError +=
"\n ======================================================================";
260 const uint32_t *endOfEventPointer = pointerToEvent + eventLength * 2 - 1;
263 errorMask = errorMask | (1 << 2);
268 result.second = eventLength;
278 char indexBuffer[20];
281 indexBuffer,
sizeof(indexBuffer),
"W[%08lu]",
pos);
292 long unsigned int data = dat;
333 std::vector<DCCTBEventBlock *>::iterator it;
std::vector< DCCTBEventBlock * > dccEvents_
void resetErrorCounters()
ret
prodAgent to be discontinued
std::string getDecString(uint32_t data)
std::string getIndexedData(uint32_t indexed, uint32_t *pointer)
uint32_t numbTriggerSamples()
void parseFile(std::string fileName, bool singleEvent=false)
std::map< std::string, uint32_t > errors_
std::pair< uint32_t, uint32_t > checkEventLength(const uint32_t *pointerToEvent, uint32_t bytesToEnd, bool singleEvent=false)
std::string getHexString(uint32_t data)
char data[epos_bytes_allocation]
std::vector< std::pair< uint32_t, std::pair< const uint32_t *, uint32_t > > > events_
static int position[264][3]
DCCTBDataMapper * mapper_
DCCTBDataParser(const std::vector< uint32_t > &parserParameters, bool parseInternalData=true, bool debug=true)
void parseBuffer(const uint32_t *buffer, uint32_t bufferSize, bool singleEvent=false)
std::string index(uint32_t position)