Public Member Functions | Private Attributes | List of all members
daq2raw::SpillWrapper Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-09-26/DAQ2RawDigit/testbeam/BeamlineUnpack.h"

Public Member Functions

 SpillWrapper (std::size_t nfragments)
 
void add (const art::Event &evt, const art::InputTag &tag)
 
void add (const artdaq::Fragment &frag)
 
const uint8_t * get () const
 
std::size_t size () const
 
bool ready () const
 

Private Attributes

const std::size_t nfragments_
 
std::vector< uint8_t > buffer_
 
std::size_t nfragments_processed_
 
std::size_t size_
 

Detailed Description

Definition at line 68 of file BeamlineUnpack.h.

Constructor & Destructor Documentation

daq2raw::SpillWrapper::SpillWrapper ( std::size_t  nfragments)
inline

Definition at line 72 of file BeamlineUnpack.h.

References add(), evt, and getGoodRuns4SAM::tag.

72  :
73  nfragments_(nfragments),
75  size_(0)
76  {}
const std::size_t nfragments_
std::size_t nfragments_processed_

Member Function Documentation

void daq2raw::SpillWrapper::add ( const art::Event evt,
const art::InputTag tag 
)

Definition at line 40 of file BeamlineUnpack.cxx.

References allTimeWatchdog::endl, art::DataViewImpl::getValidHandle(), and getGoodRuns4SAM::tag.

Referenced by daq2raw::BeamlineRawInputDriver::loadSpillFragments(), daq2raw::TestBeamRawInputDriver::loadSpillFragments(), and SpillWrapper().

40  {
41 
43  if (raw->size() != 1)
44  throw cet::exception("SpillWrapper") << "Error in SpillWrapper::add(): expected 1 artdaq fragment in event, found "
45  << raw->size() << std::endl;
46 
47  this->add((*raw)[0]);
48  return;
49 
50 }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
void add(const art::Event &evt, const art::InputTag &tag)
void daq2raw::SpillWrapper::add ( const artdaq::Fragment &  frag)

Definition at line 20 of file BeamlineUnpack.cxx.

References buffer_, nfragments_, nfragments_processed_, and size_.

20  {
21 
22  if (nfragments_processed_ == 0) {
23  // Basically, it's the LAST of the fragments which is the
24  // largest if the spill couldn't be evenly split into four
25  // fragments, so that's why we add the "+1" padding to the
26  // buffer
27  size_t bufsize = (frag.dataSize() + 1) * sizeof(artdaq::RawDataType) * nfragments_ ;
28  buffer_.resize( bufsize );
29  }
30 
31  memcpy( &*buffer_.begin() + size_, frag.dataBeginBytes(), frag.dataSizeBytes() );
32 
33  // Bookkeeping
34  size_ += frag.dataSizeBytes();
36 
37 }
const std::size_t nfragments_
std::vector< uint8_t > buffer_
std::size_t nfragments_processed_
const uint8_t* daq2raw::SpillWrapper::get ( ) const
inline

Definition at line 82 of file BeamlineUnpack.h.

References buffer_.

Referenced by daq2raw::BeamlineRawInputDriver::getSpillFrag(), and daq2raw::TestBeamRawInputDriver::getSpillFrag().

82 {return &*buffer_.begin(); }
std::vector< uint8_t > buffer_
bool daq2raw::SpillWrapper::ready ( ) const
inline
std::size_t daq2raw::SpillWrapper::size ( ) const
inline

Member Data Documentation

std::vector<uint8_t> daq2raw::SpillWrapper::buffer_
private

Definition at line 91 of file BeamlineUnpack.h.

Referenced by add(), and get().

const std::size_t daq2raw::SpillWrapper::nfragments_
private

Definition at line 90 of file BeamlineUnpack.h.

Referenced by add(), and ready().

std::size_t daq2raw::SpillWrapper::nfragments_processed_
private

Definition at line 93 of file BeamlineUnpack.h.

Referenced by add(), and ready().

std::size_t daq2raw::SpillWrapper::size_
private

Definition at line 94 of file BeamlineUnpack.h.

Referenced by add(), and size().


The documentation for this class was generated from the following files: