All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
daq::details::BoardInfoLookup Class Reference

Utility class for fast lookup of board data by fragment ID. More...

#include <PMTDecoderUtils.h>

Classes

struct  BoardInfo_t
 Record of information about a readout board. More...
 

Public Types

using FragmentID_t = unsigned int
 
using Database_t = std::vector< BoardInfo_t >
 

Public Member Functions

 BoardInfoLookup (Database_t &&database)
 
unsigned int nBoardInfo () const
 Returns the number of registered boards. More...
 
auto const & allBoardInfo () const
 Returns an object that can be iterated for all available information. More...
 
BoardInfo_t const * findBoardInfo (FragmentID_t fragmentID) const
 Returns a pointer to the information for board with fragmentID. More...
 
BoardSetup_t const * findBoardSetup (FragmentID_t fragmentID) const
 Returns a pointer to the setup information for board with fragmentID. More...
 
sbn::V1730Configuration const * findBoardConfig (FragmentID_t fragmentID) const
 Returns a pointer to the configuration of board with fragmentID. More...
 

Static Private Member Functions

static Database_t sortDatabase (Database_t &&db)
 Sorts the database structure in the argument and returns it. More...
 

Private Attributes

Database_t const fDatabase
 

Detailed Description

Utility class for fast lookup of board data by fragment ID.

Definition at line 144 of file PMTDecoderUtils.h.

Member Typedef Documentation

Definition at line 160 of file PMTDecoderUtils.h.

Definition at line 147 of file PMTDecoderUtils.h.

Constructor & Destructor Documentation

daq::details::BoardInfoLookup::BoardInfoLookup ( Database_t &&  database)
inlineexplicit

Definition at line 163 of file PMTDecoderUtils.h.

164  : fDatabase(sortDatabase(std::move(database)))
165  {}
static Database_t sortDatabase(Database_t &&db)
Sorts the database structure in the argument and returns it.

Member Function Documentation

auto const& daq::details::BoardInfoLookup::allBoardInfo ( ) const
inline

Returns an object that can be iterated for all available information.

Definition at line 171 of file PMTDecoderUtils.h.

171 { return fDatabase; } // C++20: replace with std::span<>
sbn::V1730Configuration const* daq::details::BoardInfoLookup::findBoardConfig ( FragmentID_t  fragmentID) const
inline

Returns a pointer to the configuration of board with fragmentID.

Definition at line 184 of file PMTDecoderUtils.h.

185  {
186  auto const* pInfo = findBoardInfo(fragmentID);
187  return pInfo? pInfo->config: nullptr;
188  }
BoardInfo_t const * findBoardInfo(FragmentID_t fragmentID) const
Returns a pointer to the information for board with fragmentID.
auto daq::details::BoardInfoLookup::findBoardInfo ( FragmentID_t  fragmentID) const
inline

Returns a pointer to the information for board with fragmentID.

Definition at line 207 of file PMTDecoderUtils.h.

208 {
209  return binarySearch(fDatabase, fragmentID, std::mem_fn(&BoardInfo_t::fragmentID));
210 }
Coll::value_type const * binarySearch(Coll const &coll, Key const &key, KeyExtractor &&extractKey)
BoardSetup_t const* daq::details::BoardInfoLookup::findBoardSetup ( FragmentID_t  fragmentID) const
inline

Returns a pointer to the setup information for board with fragmentID.

Definition at line 177 of file PMTDecoderUtils.h.

178  {
179  auto const* pInfo = findBoardInfo(fragmentID);
180  return pInfo? pInfo->setup: nullptr;
181  }
BoardInfo_t const * findBoardInfo(FragmentID_t fragmentID) const
Returns a pointer to the information for board with fragmentID.
unsigned int daq::details::BoardInfoLookup::nBoardInfo ( ) const
inline

Returns the number of registered boards.

Definition at line 168 of file PMTDecoderUtils.h.

168 { return fDatabase.size(); }
static Database_t daq::details::BoardInfoLookup::sortDatabase ( Database_t &&  db)
inlinestaticprivate

Sorts the database structure in the argument and returns it.

Definition at line 196 of file PMTDecoderUtils.h.

197  { std::sort(db.begin(), db.end()); return std::move(db); }
height to which particles are projected pnfs larsoft persistent physics cosmics Fermilab CORSIKA standard He_showers_ * db

Member Data Documentation

Database_t const daq::details::BoardInfoLookup::fDatabase
private

Definition at line 193 of file PMTDecoderUtils.h.


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