Public Member Functions | Private Attributes | List of all members
dune::FelixFragment Class Reference

#include <FelixFragment.hh>

Inheritance diagram for dune::FelixFragment:
dune::FelixFragmentBase

Public Member Functions

 FelixFragment (const artdaq::Fragment &fragment)
 
 ~FelixFragment ()
 
uint8_t sof (const unsigned &frame_ID=0) const
 
uint8_t version (const unsigned &frame_ID=0) const
 
uint8_t fiber_no (const unsigned &frame_ID=0) const
 
uint8_t slot_no (const unsigned &frame_ID=0) const
 
uint8_t crate_no (const unsigned &frame_ID=0) const
 
uint8_t mm (const unsigned &frame_ID=0) const
 
uint8_t oos (const unsigned &frame_ID=0) const
 
uint16_t wib_errors (const unsigned &frame_ID=0) const
 
uint64_t timestamp (const unsigned &frame_ID=0) const
 
uint16_t wib_counter (const unsigned &frame_ID=0) const
 
uint8_t s1_error (const unsigned &frame_ID, const uint8_t &block_num) const
 
uint8_t s2_error (const unsigned &frame_ID, const uint8_t &block_num) const
 
uint16_t checksum_a (const unsigned &frame_ID, const uint8_t &block_num) const
 
uint16_t checksum_b (const unsigned &frame_ID, const uint8_t &block_num) const
 
uint16_t coldata_convert_count (const unsigned &frame_ID, const uint8_t &block_num) const
 
uint16_t error_register (const unsigned &frame_ID, const uint8_t &block_num) const
 
uint8_t hdr (const unsigned &frame_ID, const uint8_t &block_num, const uint8_t &hdr_num) const
 
adc_t get_ADC (const unsigned &frame_ID, const uint8_t channel_ID) const
 
adc_t get_ADC (const unsigned &frame_ID, const uint8_t block_ID, const uint8_t channel_ID) const
 
adc_v get_ADCs_by_channel (const uint8_t channel_ID) const
 
adc_v get_ADCs_by_channel (const uint8_t block_ID, const uint8_t channel_ID) const
 
std::map< uint8_t, adc_vget_all_ADCs () const
 
void print_timestamps () const
 
void print (const unsigned i) const
 
void print_frames () const
 
size_t total_words () const
 
size_t total_frames () const
 
size_t total_adc_values () const
 
- Public Member Functions inherited from dune::FelixFragmentBase
 FelixFragmentBase (const artdaq::Fragment &fragment)
 
virtual ~FelixFragmentBase ()
 
virtual size_t adc_range (int daq_adc_bits=12)
 
const uint8_t * dataBeginBytes () const
 
size_t dataSizeBytes () const
 

Private Attributes

size_t trig_offset = 0
 
const FelixFragmentBaseflxfrag
 

Additional Inherited Members

- Protected Attributes inherited from dune::FelixFragmentBase
Metadata meta_
 
const void * artdaq_Fragment_
 
size_t sizeBytes_
 

Detailed Description

Definition at line 684 of file FelixFragment.hh.

Constructor & Destructor Documentation

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

Definition at line 686 of file FelixFragment.hh.

687  : FelixFragmentBase(fragment) {
688  if (meta_.compressed) {
689  flxfrag = new FelixFragmentCompressed(fragment);
690  } else if (meta_.reordered) {
691  flxfrag = new FelixFragmentReordered(fragment);
692  } else {
693  flxfrag = new FelixFragmentUnordered(fragment);
694  }
695 
696  // Try to set the timestamp offset to the metadata offset.
697  bool shift_good = true;
698  // Is the first requested frame in the data?
699  shift_good &=
700  fragment.timestamp() - meta_.offset_frames * 25 >= flxfrag->timestamp();
701  // Is the data big enough to accommodate the window size?
702  shift_good &= fragment.timestamp() -
704  flxfrag->timestamp() + meta_.num_frames * 25;
705 
706  if (shift_good) {
707  trig_offset = (fragment.timestamp() - flxfrag->timestamp()) / 25 - meta_.offset_frames;
708  } else {
709  mf::LogWarning("dune::FelixFragment")
710  << "Can't find the trigger window in FELIX fragment "
711  << fragment.fragmentID() << ".\nFragment TS: " << fragment.timestamp()
712  << " first frame TS: " << flxfrag->timestamp() << '\n';
713  }
714  }
FelixFragmentBase(const artdaq::Fragment &fragment)
virtual uint64_t timestamp(const unsigned &frame_ID=0) const =0
const FelixFragmentBase * flxfrag
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
dune::FelixFragment::~FelixFragment ( )
inline

Definition at line 716 of file FelixFragment.hh.

716 { delete flxfrag; }
const FelixFragmentBase * flxfrag

Member Function Documentation

uint16_t dune::FelixFragment::checksum_a ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 757 of file FelixFragment.hh.

758  {
759  return flxfrag->checksum_a(frame_ID + trig_offset, block_num);
760  }
const FelixFragmentBase * flxfrag
virtual uint16_t checksum_a(const unsigned &frame_ID, const uint8_t &block_num) const =0
uint16_t dune::FelixFragment::checksum_b ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 761 of file FelixFragment.hh.

762  {
763  return flxfrag->checksum_b(frame_ID + trig_offset, block_num);
764  }
virtual uint16_t checksum_b(const unsigned &frame_ID, const uint8_t &block_num) const =0
const FelixFragmentBase * flxfrag
uint16_t dune::FelixFragment::coldata_convert_count ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 765 of file FelixFragment.hh.

766  {
767  return flxfrag->coldata_convert_count(frame_ID + trig_offset, block_num);
768  }
virtual uint16_t coldata_convert_count(const unsigned &frame_ID, const uint8_t &block_num) const =0
const FelixFragmentBase * flxfrag
uint8_t dune::FelixFragment::crate_no ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 731 of file FelixFragment.hh.

731  {
732  return flxfrag->crate_no(frame_ID + trig_offset);
733  }
const FelixFragmentBase * flxfrag
virtual uint8_t crate_no(const unsigned &frame_ID=0) const =0
uint16_t dune::FelixFragment::error_register ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 769 of file FelixFragment.hh.

770  {
771  return flxfrag->error_register(frame_ID + trig_offset, block_num);
772  }
const FelixFragmentBase * flxfrag
virtual uint16_t error_register(const unsigned &frame_ID, const uint8_t &block_num) const =0
uint8_t dune::FelixFragment::fiber_no ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 725 of file FelixFragment.hh.

725  {
726  return flxfrag->fiber_no(frame_ID + trig_offset);
727  }
virtual uint8_t fiber_no(const unsigned &frame_ID=0) const =0
const FelixFragmentBase * flxfrag
adc_t dune::FelixFragment::get_ADC ( const unsigned &  frame_ID,
const uint8_t  channel_ID 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 779 of file FelixFragment.hh.

779  {
780  return flxfrag->get_ADC(frame_ID + trig_offset, channel_ID);
781  }
virtual adc_t get_ADC(const unsigned &frame_ID, const uint8_t channel_ID) const =0
const FelixFragmentBase * flxfrag
adc_t dune::FelixFragment::get_ADC ( const unsigned &  frame_ID,
const uint8_t  block_ID,
const uint8_t  channel_ID 
) const
inline

Definition at line 782 of file FelixFragment.hh.

783  {
784  return get_ADC(frame_ID, channel_ID + block_ID * 64);
785  }
adc_t get_ADC(const unsigned &frame_ID, const uint8_t channel_ID) const
adc_v dune::FelixFragment::get_ADCs_by_channel ( const uint8_t  channel_ID) const
inline

Definition at line 788 of file FelixFragment.hh.

788  {
790  for (size_t i = 0; i < total_frames(); i++) {
791  output[i] = get_ADC(i, channel_ID);
792  }
793  return output;
794  }
size_t total_frames() const
std::vector< uint16_t > adc_v
Definition: FelixFormat.hh:19
adc_t get_ADC(const unsigned &frame_ID, const uint8_t channel_ID) const
adc_v dune::FelixFragment::get_ADCs_by_channel ( const uint8_t  block_ID,
const uint8_t  channel_ID 
) const
inline

Definition at line 795 of file FelixFragment.hh.

796  {
797  return get_ADCs_by_channel(channel_ID + block_ID * 64);
798  }
adc_v get_ADCs_by_channel(const uint8_t channel_ID) const
std::map<uint8_t, adc_v> dune::FelixFragment::get_all_ADCs ( ) const
inline

Definition at line 801 of file FelixFragment.hh.

801  {
802  std::map<uint8_t, adc_v> output;
803  for (int i = 0; i < 256; i++)
804  output.insert(std::pair<uint8_t, adc_v>(i, get_ADCs_by_channel(i)));
805  return output;
806  }
adc_v get_ADCs_by_channel(const uint8_t channel_ID) const
uint8_t dune::FelixFragment::hdr ( const unsigned &  frame_ID,
const uint8_t &  block_num,
const uint8_t &  hdr_num 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 773 of file FelixFragment.hh.

774  {
775  return flxfrag->hdr(frame_ID + trig_offset, block_num, hdr_num);
776  }
virtual uint8_t hdr(const unsigned &frame_ID, const uint8_t &block_num, const uint8_t &hdr_num) const =0
const FelixFragmentBase * flxfrag
uint8_t dune::FelixFragment::mm ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 734 of file FelixFragment.hh.

734  {
735  return flxfrag->mm(frame_ID + trig_offset);
736  }
virtual uint8_t mm(const unsigned &frame_ID=0) const =0
const FelixFragmentBase * flxfrag
uint8_t dune::FelixFragment::oos ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 737 of file FelixFragment.hh.

737  {
738  return flxfrag->oos(frame_ID + trig_offset);
739  }
virtual uint8_t oos(const unsigned &frame_ID=0) const =0
const FelixFragmentBase * flxfrag
void dune::FelixFragment::print ( const unsigned  i) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 811 of file FelixFragment.hh.

811 { return flxfrag->print(i); }
virtual void print(const unsigned i) const =0
const FelixFragmentBase * flxfrag
void dune::FelixFragment::print_frames ( ) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 813 of file FelixFragment.hh.

813 { return flxfrag->print_frames(); }
virtual void print_frames() const =0
const FelixFragmentBase * flxfrag
void dune::FelixFragment::print_timestamps ( ) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 809 of file FelixFragment.hh.

809 { return flxfrag->print_timestamps(); }
virtual void print_timestamps() const =0
const FelixFragmentBase * flxfrag
uint8_t dune::FelixFragment::s1_error ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 751 of file FelixFragment.hh.

751  {
752  return flxfrag->s1_error(frame_ID + trig_offset, block_num);
753  }
virtual uint8_t s1_error(const unsigned &frame_ID, const uint8_t &block_num) const =0
const FelixFragmentBase * flxfrag
uint8_t dune::FelixFragment::s2_error ( const unsigned &  frame_ID,
const uint8_t &  block_num 
) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 754 of file FelixFragment.hh.

754  {
755  return flxfrag->s2_error(frame_ID + trig_offset, block_num);
756  }
const FelixFragmentBase * flxfrag
virtual uint8_t s2_error(const unsigned &frame_ID, const uint8_t &block_num) const =0
uint8_t dune::FelixFragment::slot_no ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 728 of file FelixFragment.hh.

728  {
729  return flxfrag->slot_no(frame_ID + trig_offset);
730  }
virtual uint8_t slot_no(const unsigned &frame_ID=0) const =0
const FelixFragmentBase * flxfrag
uint8_t dune::FelixFragment::sof ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 719 of file FelixFragment.hh.

719  {
720  return flxfrag->sof(frame_ID + trig_offset);
721  }
const FelixFragmentBase * flxfrag
virtual uint8_t sof(const unsigned &frame_ID=0) const =0
uint64_t dune::FelixFragment::timestamp ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 743 of file FelixFragment.hh.

743  {
744  return flxfrag->timestamp(frame_ID + trig_offset);
745  }
virtual uint64_t timestamp(const unsigned &frame_ID=0) const =0
const FelixFragmentBase * flxfrag
size_t dune::FelixFragment::total_adc_values ( ) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 820 of file FelixFragment.hh.

820 { return flxfrag->total_adc_values(); }
const FelixFragmentBase * flxfrag
virtual size_t total_adc_values() const =0
size_t dune::FelixFragment::total_frames ( ) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 818 of file FelixFragment.hh.

818 { return flxfrag->total_frames(); }
virtual size_t total_frames() const =0
const FelixFragmentBase * flxfrag
size_t dune::FelixFragment::total_words ( ) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 816 of file FelixFragment.hh.

816 { return flxfrag->total_words(); }
virtual size_t total_words() const =0
const FelixFragmentBase * flxfrag
uint8_t dune::FelixFragment::version ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 722 of file FelixFragment.hh.

722  {
723  return flxfrag->version(frame_ID + trig_offset);
724  }
const FelixFragmentBase * flxfrag
virtual uint8_t version(const unsigned &frame_ID=0) const =0
uint16_t dune::FelixFragment::wib_counter ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 746 of file FelixFragment.hh.

746  {
747  return flxfrag->wib_counter(frame_ID + trig_offset);
748  }
const FelixFragmentBase * flxfrag
virtual uint16_t wib_counter(const unsigned &frame_ID=0) const =0
uint16_t dune::FelixFragment::wib_errors ( const unsigned &  frame_ID = 0) const
inlinevirtual

Implements dune::FelixFragmentBase.

Definition at line 740 of file FelixFragment.hh.

740  {
741  return flxfrag->wib_errors(frame_ID + trig_offset);
742  }
virtual uint16_t wib_errors(const unsigned &frame_ID=0) const =0
const FelixFragmentBase * flxfrag

Member Data Documentation

const FelixFragmentBase* dune::FelixFragment::flxfrag
private

Definition at line 824 of file FelixFragment.hh.

size_t dune::FelixFragment::trig_offset = 0
private

Definition at line 823 of file FelixFragment.hh.


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