Project
Loading...
Searching...
No Matches
HmpidDecodeRawMem.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
18
19/* ------ HISTORY ---------
20*/
21#include <fairlogger/Logger.h> // for LOG
22#include "Framework/Logger.h"
23
25#include "HMPIDBase/Geo.h"
27
28using namespace o2::hmpid;
29
36 : HmpidDecoder(numOfEquipments)
37{
38}
39
49HmpidDecodeRawMem::HmpidDecodeRawMem(int* EqIds, int* CruIds, int* LinkIds, int numOfEquipments)
50 : HmpidDecoder(EqIds, CruIds, LinkIds, numOfEquipments)
51{
52}
53
56
66bool HmpidDecodeRawMem::setUpStream(void* Buffer, long BufferLen)
67{
68 long wordsBufferLen = BufferLen / (sizeof(int32_t) / sizeof(char)); // Converts the len in words
69 if (Buffer == nullptr) {
70 LOG(error) << "Raw data buffer null Pointer ! ";
72 }
73 if (wordsBufferLen == 0) {
74 LOG(error) << "Raw data buffer Empty ! ";
75 throw TH_BUFFEREMPTY;
76 }
77 if (wordsBufferLen < 16) {
78 LOG(error) << "Raw data buffer less then the Header Dimension = " << wordsBufferLen;
80 }
81
82 mActualStreamPtr = (uint32_t*)Buffer; // sets the pointer to the Buffer
83 mEndStreamPtr = ((uint32_t*)Buffer) + wordsBufferLen; //sets the End of buffer
84 mStartStreamPtr = ((uint32_t*)Buffer);
85 // std::cout << " setUpStrem : StPtr=" << mStartStreamPtr << " EndPtr=" << mEndStreamPtr << " Len=" << wordsBufferLen << std::endl;
86 return (true);
87}
88
94bool HmpidDecodeRawMem::getBlockFromStream(uint32_t** streamPtr, uint32_t Size)
95{
96 *streamPtr = mActualStreamPtr;
99 // std::cout << " getBlockFromStream : StPtr=" << mActualStreamPtr << " EndPtr=" << mEndStreamPtr << " Len=" << Size << std::endl;
100 // std::cout << "Beccato " << std::endl;
101 // throw TH_WRONGBUFFERDIM;
102 return (false);
103 }
104 return (true);
105}
106
110bool HmpidDecodeRawMem::getHeaderFromStream(uint32_t** streamPtr)
111{
112 return (getBlockFromStream(streamPtr, mRDHSize));
113}
114
118bool HmpidDecodeRawMem::getWordFromStream(uint32_t* word)
119{
120 uint32_t* appo;
121 *word = *mActualStreamPtr;
122 return (getBlockFromStream(&appo, 1));
123}
124
134void HmpidDecodeRawMem::setPad(HmpidEquipment* eq, int col, int dil, int ch, uint16_t charge)
135{
136 eq->setPad(col, dil, ch, charge);
137 return;
138}
139
140// ========================================================================================
141
148 : HmpidDecodeRawMem(numOfEquipments)
149{
150}
151
161HmpidDecodeRawDigit::HmpidDecodeRawDigit(int* EqIds, int* CruIds, int* LinkIds, int numOfEquipments)
162 : HmpidDecodeRawMem(EqIds, CruIds, LinkIds, numOfEquipments)
163{
164}
165
168
178void HmpidDecodeRawDigit::setPad(HmpidEquipment* eq, int col, int dil, int ch, uint16_t charge)
179{
180 eq->setPad(col, dil, ch, charge);
181 mDigits.push_back(o2::hmpid::Digit(charge, eq->getEquipmentId(), col, dil, ch));
182 //std::cout << "DI " << mDigits.back() << " "<<col<<","<< dil<<","<< ch<<"="<< charge<<std::endl;
183 return;
184}
int16_t charge
Definition RawEventData.h:5
Derived Class for decoding Raw Data Memory stream.
uint32_t col
Definition RawData.h:4
HMPID Digit declaration.
Definition Digit.h:36
HmpidDecodeRawDigit(int *EqIds, int *CruIds, int *LinkIds, int numOfEquipments)
std::vector< o2::hmpid::Digit > mDigits
HmpidDecodeRawMem(int *EqIds, int *CruIds, int *LinkIds, int numOfEquipments)
bool setUpStream(void *Buffer, long BufferLen) override
void setPad(int col, int dil, int cha, uint16_t charge)
const int TH_BUFFEREMPTY
const int TH_NULLBUFFERPOINTER
const int TH_WRONGBUFFERDIM
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"