All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PMTDecoderUtils.cxx
Go to the documentation of this file.
1 /**
2  * @file icaruscode/Decode/DecoderTools/details/PMTDecoderUtils.h
3  * @brief Some helpers for PMT decoder tool.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date April 13, 2021
6  */
7 
8 
9 // library header
11 
12 // LArSoft libraries
14 
15 // C/C++ standard libraries
16 #include <ostream>
17 #include <cassert>
18 
19 
20 // -----------------------------------------------------------------------------
21 std::ostream& daq::details::operator<<
22  (std::ostream& out, BoardSetup_t::ChannelSetup_t const& chSetup)
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)
54 
55 
56 // -----------------------------------------------------------------------------
57 std::ostream& daq::details::operator<<
58  (std::ostream& out, BoardInfoLookup const& db)
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)
95 
96 
97 // -----------------------------------------------------------------------------
Utility class for fast lookup of board data by fragment ID.
Definition of util::enumerate().
Some helpers for PMT decoder tool.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
Special settings for one channel on the board.
Record of information about a readout board.
height to which particles are projected pnfs larsoft persistent physics cosmics Fermilab CORSIKA standard He_showers_ * db