Classes | Public Member Functions | Protected Attributes | List of all members
dune::FelixFragmentBase Class Referenceabstract

#include <FelixFragment.hh>

Inheritance diagram for dune::FelixFragmentBase:
dune::FelixFragment dune::FelixFragmentCompressed dune::FelixFragmentReordered dune::FelixFragmentUnordered

Classes

struct  Metadata
 
struct  Old_Metadata
 

Public Member Functions

virtual uint8_t sof (const unsigned &frame_ID=0) const =0
 
virtual uint8_t version (const unsigned &frame_ID=0) const =0
 
virtual uint8_t fiber_no (const unsigned &frame_ID=0) const =0
 
virtual uint8_t slot_no (const unsigned &frame_ID=0) const =0
 
virtual uint8_t crate_no (const unsigned &frame_ID=0) const =0
 
virtual uint8_t mm (const unsigned &frame_ID=0) const =0
 
virtual uint8_t oos (const unsigned &frame_ID=0) const =0
 
virtual uint16_t wib_errors (const unsigned &frame_ID=0) const =0
 
virtual uint64_t timestamp (const unsigned &frame_ID=0) const =0
 
virtual uint16_t wib_counter (const unsigned &frame_ID=0) const =0
 
virtual uint8_t s1_error (const unsigned &frame_ID, const uint8_t &block_num) const =0
 
virtual uint8_t s2_error (const unsigned &frame_ID, const uint8_t &block_num) const =0
 
virtual uint16_t checksum_a (const unsigned &frame_ID, const uint8_t &block_num) const =0
 
virtual uint16_t checksum_b (const unsigned &frame_ID, const uint8_t &block_num) const =0
 
virtual uint16_t coldata_convert_count (const unsigned &frame_ID, const uint8_t &block_num) const =0
 
virtual uint16_t error_register (const unsigned &frame_ID, const uint8_t &block_num) const =0
 
virtual uint8_t hdr (const unsigned &frame_ID, const uint8_t &block_num, const uint8_t &hdr_num) const =0
 
virtual adc_t get_ADC (const unsigned &frame_ID, const uint8_t channel_ID) const =0
 
virtual void print_timestamps () const =0
 
virtual void print (const unsigned i) const =0
 
virtual void print_frames () const =0
 
 FelixFragmentBase (const artdaq::Fragment &fragment)
 
virtual ~FelixFragmentBase ()
 
virtual size_t total_words () const =0
 
virtual size_t total_frames () const =0
 
virtual size_t total_adc_values () const =0
 
virtual size_t adc_range (int daq_adc_bits=12)
 
const uint8_t * dataBeginBytes () const
 
size_t dataSizeBytes () const
 

Protected Attributes

Metadata meta_
 
const void * artdaq_Fragment_
 
size_t sizeBytes_
 

Detailed Description

Definition at line 35 of file FelixFragment.hh.

Constructor & Destructor Documentation

dune::FelixFragmentBase::FelixFragmentBase ( const artdaq::Fragment &  fragment)
inline

Definition at line 121 of file FelixFragment.hh.

122  : meta_(*(fragment.metadata<Metadata>())),
123  artdaq_Fragment_(fragment.dataBeginBytes()),
124  sizeBytes_(fragment.dataSizeBytes()) {
125  // Check whether the metadata is of the old format.
126  if (meta_.control_word != 0xabc &&
127  !(meta_.num_frames == 6024 && meta_.offset_frames == 500 &&
128  meta_.window_frames == 6000)) {
129  // mf::LogInfo("dune::FelixFragment")
130  // << "Fragment has old metadata format. (Control word "
131  // << (unsigned)meta_.control_word << ")\n";
132  const Old_Metadata* old_meta = fragment.metadata<Old_Metadata>();
133  meta_ = {0,
134  0,
135  old_meta->reordered,
136  old_meta->compressed,
137  old_meta->num_frames,
138  old_meta->offset_frames,
139  old_meta->window_frames};
140  }
141 
142  // Deal with very long fragments that overflow the frame counter.
143  if (fragment.dataSizeBytes() > meta_.num_frames*sizeof(dune::FelixFrame)*3) {
144  // Assume uncompressed data.
145  meta_.reordered = 0;
146  meta_.compressed = 0;
147  meta_.num_frames = fragment.dataSizeBytes()/sizeof(dune::FelixFrame);
148  // Assume the offset is 11 frames at most.
149  meta_.window_frames = fragment.dataSizeBytes()/sizeof(dune::FelixFrame)-12;
150  }
151  // Check whether current metadata makes sense and guess the format
152  // otherwise.
153  else if (meta_.reordered > 1 || meta_.compressed > 1 ||
155  // Assume 6024 frames in a fragment if there is no meaningful metadata.
156  meta_.num_frames = 6024;
157  meta_.offset_frames = 500;
158  meta_.window_frames = 6000;
159  // Try to predict reordered/compressed from fragment size.
160  unsigned sizeBytes = fragment.dataSizeBytes();
161  if (sizeBytes == meta_.num_frames * 464) {
162  meta_.reordered = 0;
163  meta_.compressed = 0;
164  } else if (sizeBytes > meta_.num_frames * 592) {
165  // Assume compression factor > 1.
166  meta_.reordered = 1;
167  meta_.compressed = 0;
168  } else {
169  // Assume reordered if compressed.
170  meta_.reordered = 1;
171  meta_.compressed = 1;
172  }
173  }
174  }
const void * artdaq_Fragment_
virtual dune::FelixFragmentBase::~FelixFragmentBase ( )
inlinevirtual

Definition at line 175 of file FelixFragment.hh.

175 {}

Member Function Documentation

virtual size_t dune::FelixFragmentBase::adc_range ( int  daq_adc_bits = 12)
inlinevirtual

Definition at line 184 of file FelixFragment.hh.

184  {
185  return (1ul << daq_adc_bits);
186  }
virtual uint16_t dune::FelixFragmentBase::checksum_a ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
pure virtual
virtual uint16_t dune::FelixFragmentBase::checksum_b ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
pure virtual
virtual uint16_t dune::FelixFragmentBase::coldata_convert_count ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::crate_no ( const unsigned &  frame_ID = 0) const
pure virtual
const uint8_t* dune::FelixFragmentBase::dataBeginBytes ( ) const
inline

Definition at line 189 of file FelixFragment.hh.

189  {
190  return reinterpret_cast<uint8_t const*>(artdaq_Fragment_);
191  }
const void * artdaq_Fragment_
size_t dune::FelixFragmentBase::dataSizeBytes ( ) const
inline

Definition at line 192 of file FelixFragment.hh.

192 { return sizeBytes_; }
virtual uint16_t dune::FelixFragmentBase::error_register ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::fiber_no ( const unsigned &  frame_ID = 0) const
pure virtual
virtual adc_t dune::FelixFragmentBase::get_ADC ( const unsigned &  frame_ID,
const uint8_t  channel_ID 
) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::hdr ( const unsigned &  frame_ID,
const uint8_t &  block_num,
const uint8_t &  hdr_num 
) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::mm ( const unsigned &  frame_ID = 0) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::oos ( const unsigned &  frame_ID = 0) const
pure virtual
virtual void dune::FelixFragmentBase::print ( const unsigned  i) const
pure virtual
virtual void dune::FelixFragmentBase::print_frames ( ) const
pure virtual
virtual void dune::FelixFragmentBase::print_timestamps ( ) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::s1_error ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::s2_error ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::slot_no ( const unsigned &  frame_ID = 0) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::sof ( const unsigned &  frame_ID = 0) const
pure virtual
virtual uint64_t dune::FelixFragmentBase::timestamp ( const unsigned &  frame_ID = 0) const
pure virtual
virtual size_t dune::FelixFragmentBase::total_adc_values ( ) const
pure virtual
virtual size_t dune::FelixFragmentBase::total_frames ( ) const
pure virtual
virtual size_t dune::FelixFragmentBase::total_words ( ) const
pure virtual
virtual uint8_t dune::FelixFragmentBase::version ( const unsigned &  frame_ID = 0) const
pure virtual
virtual uint16_t dune::FelixFragmentBase::wib_counter ( const unsigned &  frame_ID = 0) const
pure virtual
virtual uint16_t dune::FelixFragmentBase::wib_errors ( const unsigned &  frame_ID = 0) const
pure virtual

Member Data Documentation

const void* dune::FelixFragmentBase::artdaq_Fragment_
protected

Definition at line 196 of file FelixFragment.hh.

Metadata dune::FelixFragmentBase::meta_
protected

Definition at line 195 of file FelixFragment.hh.

size_t dune::FelixFragmentBase::sizeBytes_
protected

Definition at line 197 of file FelixFragment.hh.


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