Belle II Software  release-05-01-25
PXDRawAdc.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Bjoern Spruck *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
17 
18 #include <pxd/dataobjects/PXDRawAdc.h>
19 #include <boost/spirit/home/support/detail/endian.hpp>
20 #include <framework/logging/Logger.h>
21 #include <cstring>
22 
23 using namespace std;
24 using namespace Belle2;
25 
26 PXDRawAdc::PXDRawAdc(VxdID sensorID, void* data, int len):
27  m_sensorID(sensorID) , m_adcs()
28 {
29  unsigned char* d = (unsigned char*)data;
30  m_dhp_header = ((boost::spirit::endian::ubig16_t*)data)[2];
31  d += 8; // Skip DHH and DHP header, data is 64kb large (+ 8 bytes)
32  len -= 8;
33  if (len < 0) {
34  B2ERROR("PXDRawAdc size is negative!");
35  } else {
36  m_adcs.resize(len);// resize vector
37  std::memcpy(&m_adcs[0], d, len);// lowlevel hardcore, TODO maybe better use std::copy ?
38  // seems endianess swapping is not needed
39  }
40 };
Belle2::PXDRawAdc::m_adcs
std::vector< uint8_t > m_adcs
Raw ADC data as it is memory dumped by the DHP.
Definition: PXDRawAdc.h:82
Belle2::VxdID
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:43
Belle2::PXDRawAdc::m_dhp_header
unsigned short m_dhp_header
needed for Chip id
Definition: PXDRawAdc.h:81
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19