All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
daq::details Namespace Reference

Classes

struct  BoardSetup_t
 Information of the setup of a V1730 readout board. More...
 
struct  BoardFacts_t
 Derivative information of a V1730 readout board. More...
 
struct  CompareWithKey
 
class  BoardInfoLookup
 Utility class for fast lookup of board data by fragment ID. More...
 

Functions

std::ostream & operator<< (std::ostream &, BoardSetup_t::ChannelSetup_t const &)
 
std::ostream & operator<< (std::ostream &, BoardInfoLookup const &)
 
template<typename Coll , typename Key , typename KeyExtractor >
Coll::value_type const * binarySearch (Coll const &coll, Key const &key, KeyExtractor &&extractKey)
 
template<std::size_t KeyIndex = 0U, typename Coll , typename Key >
Coll::value_type const * binarySearch (Coll const &coll, Key const &key)
 

Function Documentation

template<typename Coll , typename Key , typename KeyExtractor >
Coll::value_type const * daq::details::binarySearch ( Coll const &  coll,
Key const &  key,
KeyExtractor &&  extractKey 
)

Definition at line 218 of file PMTDecoderUtils.h.

219 {
220  using std::begin, std::end;
221  auto const b = begin(coll);
222  auto const e = end(coll);
223  auto it = std::lower_bound(
224  b, e, key,
225  [&extractKey](auto const& a, Key const& key){ return extractKey(a) < key; }
226  );
227  return ((it != e) && (extractKey(*it) == key))? &*it: nullptr;
228 } // daq::details::binarySearch()
process_name gaushit a
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
do i e
template<std::size_t KeyIndex = 0U, typename Coll , typename Key >
Coll::value_type const * daq::details::binarySearch ( Coll const &  coll,
Key const &  key 
)

Finds the element in coll with the item KeyIndex equal to key.

Returns
a pointer to the item found, or nullptr if none

Definition at line 234 of file PMTDecoderUtils.h.

235 {
236  return binarySearch
237  (coll, key, [](auto const& a){ return std::get<KeyIndex>(a); });
238 } // daq::details::binarySearch()
process_name gaushit a
Coll::value_type const * binarySearch(Coll const &coll, Key const &key, KeyExtractor &&extractKey)
std::ostream & daq::details::operator<< ( std::ostream &  out,
BoardSetup_t::ChannelSetup_t const &  chSetup 
)

Definition at line 22 of file PMTDecoderUtils.cxx.

23 {
24  out << "channel ";
25  if (chSetup.hasChannel()) {
26  if (chSetup.category.empty()) out << chSetup.channelID;
27  else out << "0x" << std::hex << chSetup.channelID << std::dec;
28  }
29  else out << "from channel DB";
30 
31  if (chSetup.mustSkip()) out << ", always skipped";
32  else {
33  if (chSetup.mustSave() || chSetup.hasChannel()) {
34  if (chSetup.mustSave() || (chSetup.minSpan == 0))
35  out << ", always saved";
36  else
37  out << ", saved if span larger than " << chSetup.minSpan << " ADC";
38  }
39  else {
40  out << ", saved if in channel DB";
41  if (chSetup.minSpan > 0)
42  out << " and if span larger than " << chSetup.minSpan << " ADC";
43  }
44 
45  if (chSetup.onGlobalOnly) out << " only if on global trigger";
46 
47  if (!chSetup.category.empty())
48  out << " in special category '" << chSetup.category << "'";
49 
50  } // if not forced to skip
51 
52  return out;
53 } // daq::details::operator<< (daq::details::BoardSetup_t::ChannelSetup_t)
std::ostream & daq::details::operator<< ( std::ostream &  out,
BoardInfoLookup const &  db 
)

Definition at line 58 of file PMTDecoderUtils.cxx.

59 {
60 
61  out << "Information on " << db.nBoardInfo() << " boards recorded:";
62  for (BoardInfoLookup::BoardInfo_t const& boardInfo: db.allBoardInfo()) {
63  assert(boardInfo.setup);
64  out << "\n board \"" << boardInfo.setup->name
65  << "\" (fragment ID " << std::hex << boardInfo.fragmentID << std::dec
66  << "): trigger delay " << boardInfo.setup->triggerDelay
67  << ", TTT reset delay " << boardInfo.setup->TTTresetDelay
68  << ", pre-trigger buffer length " << boardInfo.facts.preTriggerTime;
69  if (boardInfo.config) {
70  out << ", buffer " << boardInfo.config->bufferLength
71  << " tick long, board ID " << boardInfo.config->boardID
72  << " with " << boardInfo.config->nChannels << " channels";
73  }
74  else {
75  out << " (no PMT configuration)";
76  }
77 
78  std::vector<std::size_t> specialChannels;
79  for (auto const& [ iChannel, chSetup ]
80  : util::enumerate(boardInfo.setup->channelSettings)
81  ) {
82  if (!chSetup.isDefault()) specialChannels.push_back(iChannel);
83  }
84  if (specialChannels.empty()) continue;
85  out << "; " << specialChannels.size() << " special channel configurations:";
86  for (std::size_t const iCh: specialChannels) {
87  out << "\n ch.number " << iCh << ": "
88  << boardInfo.setup->channelSettings[iCh];
89  }
90 
91  } // for board info
92  out << '\n';
93  return out;
94 } // daq::details::operator<< (daq::details::BoardInfoLookup)
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
height to which particles are projected pnfs larsoft persistent physics cosmics Fermilab CORSIKA standard He_showers_ * db