LDMX Software
Public Member Functions | Private Attributes | List of all members
packing::FiberTrackerField Class Reference

Each "field" of data in a FiberTracker packet. More...

Public Member Functions

 FiberTrackerField (utility::Reader &r, int i_field)
 r - reader i_field - field we are supposed to be reading from
 
int to_int (const std::size_t i=0) const
 conversion to a single int
 
std::string to_string () const
 conversion from series of ints to string specific to FiberTrackerDAQ
 
long int to_long (const std::size_t i=0) const
 long split across two ints
 
double to_double (const std::size_t i=0) const
 convert two ints into a double
 
const std::vector< uint32_t > & value () const
 Get the field value.
 

Private Attributes

uint32_t field_header_
 
std::vector< uint32_t > field_value_
 

Detailed Description

Each "field" of data in a FiberTracker packet.

Definition at line 54 of file FiberTrackerRawDecoder.cxx.

Constructor & Destructor Documentation

◆ FiberTrackerField()

packing::FiberTrackerField::FiberTrackerField ( utility::Reader r,
int  i_field 
)
inline

r - reader i_field - field we are supposed to be reading from

Definition at line 63 of file FiberTrackerRawDecoder.cxx.

63 {
64 uint32_t len;
65 r >> len >> field_header_;
66 r.read(field_value_, len - 1);
67 if (i_field != field_header_) {
68 EXCEPTION_RAISE("BadForm", "Field " + std::to_string(i_field) +
69 " has a mismatched header " +
70 std::to_string(field_header_));
71 }
72 }

References packing::utility::Reader::read().

Member Function Documentation

◆ to_double()

double packing::FiberTrackerField::to_double ( const std::size_t  i = 0) const
inline

convert two ints into a double

Definition at line 104 of file FiberTrackerRawDecoder.cxx.

104 {
105 return to_double_ft(this->to_long(i));
106 }
long int to_long(const std::size_t i=0) const
long split across two ints

References to_long().

Referenced by packing::FiberTrackerBinaryPacket::read().

◆ to_int()

int packing::FiberTrackerField::to_int ( const std::size_t  i = 0) const
inline

conversion to a single int

Definition at line 77 of file FiberTrackerRawDecoder.cxx.

77{ return field_value_.at(i); }

Referenced by packing::FiberTrackerBinaryPacket::read().

◆ to_long()

long int packing::FiberTrackerField::to_long ( const std::size_t  i = 0) const
inline

long split across two ints

i is index of field value to start from

Definition at line 96 of file FiberTrackerRawDecoder.cxx.

96 {
97 return ((uint64_t)field_value_.at(i + 1) << 32) |
98 (uint64_t)field_value_.at(i);
99 }

Referenced by packing::FiberTrackerBinaryPacket::read(), and to_double().

◆ to_string()

std::string packing::FiberTrackerField::to_string ( ) const
inline

conversion from series of ints to string specific to FiberTrackerDAQ

Definition at line 82 of file FiberTrackerRawDecoder.cxx.

82 {
83 std::string str;
84 str.resize(field_value_.size());
85 for (int i{0}; i < str.size(); i++) {
86 str[i] = (char)field_value_[i];
87 }
88 return str;
89 }

Referenced by packing::FiberTrackerBinaryPacket::read().

◆ value()

const std::vector< uint32_t > & packing::FiberTrackerField::value ( ) const
inline

Get the field value.

Definition at line 111 of file FiberTrackerRawDecoder.cxx.

111{ return field_value_; }

Referenced by packing::FiberTrackerBinaryPacket::read().

Member Data Documentation

◆ field_header_

uint32_t packing::FiberTrackerField::field_header_
private

Definition at line 55 of file FiberTrackerRawDecoder.cxx.

◆ field_value_

std::vector<uint32_t> packing::FiberTrackerField::field_value_
private

Definition at line 56 of file FiberTrackerRawDecoder.cxx.


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