Belle II Software development
PXDRawAdc.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
15
16#include <pxd/dataobjects/PXDRawAdc.h>
17#include <boost/endian/arithmetic.hpp>
18#include <framework/logging/Logger.h>
19#include <cstring>
20
21using namespace std;
22using namespace Belle2;
23
24PXDRawAdc::PXDRawAdc(VxdID sensorID, void* data, int len):
25 m_sensorID(sensorID), m_adcs()
26{
27 unsigned char* d = (unsigned char*)data;
28 m_dhp_header = ((boost::endian::big_uint16_t*)data)[2];
29 d += 8; // Skip DHH and DHP header, data is 64kb large (+ 8 bytes)
30 len -= 8;
31 if (len < 0) {
32 B2ERROR("PXDRawAdc size is negative!");
33 } else {
34 m_adcs.resize(len);// resize vector
35 std::memcpy(&m_adcs[0], d, len);// lowlevel hardcore, TODO maybe better use std::copy ?
36 // seems endianess swapping is not needed
37 }
38};
unsigned short m_dhp_header
needed for Chip id
Definition: PXDRawAdc.h:72
std::vector< uint8_t > m_adcs
Raw ADC data as it is memory dumped by the DHP.
Definition: PXDRawAdc.h:73
PXDRawAdc()
Default constructor for the ROOT IO.
Definition: PXDRawAdc.h:35
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
Abstract base class for different kinds of events.
STL namespace.