All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SlidingWindowDefs.cxx
Go to the documentation of this file.
1 /**
2  * @file icaruscode/PMT/Trigger/Algorithms/SlidingWindowDefs.cxx
3  * @brief Definition for PMT sliding windows.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date January 26, 2021
6  * @file icaruscode/PMT/Trigger/Algorithms/SlidingWindowDefs.h
7  *
8  */
9 
10 
11 // library header
13 
14 // ICARUS libraries
16 
17 // LArSoft libraries
19 
20 // C/C++ standard libraries
21 #include <ostream>
22 
23 
24 // -----------------------------------------------------------------------------
26  (std::ostream& out, TriggerWindowChannels_t const& window)
27 {
28  /*
29  * Format:
30  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31  * std::cout << "Window ";
32  * printTriggerWindowChannels(std::cout, window);
33  * std::cout << " defined." << std::endl;
34  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35  * may yield:
36  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37  * Window 6 channels ( 1, 2, 3, 4, 5, 6 ) defined.
38  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39  */
40  out << window.size() << " channels";
41  if (!window.empty())
42  out << " (" << icarus::makeIntegerRanges(window) << ")";
43 
44 } // icarus::trigger::printTriggerWindowChannels()
45 
46 
47 // -----------------------------------------------------------------------------
49  (std::ostream& out, TriggerWindowDefs_t const& windows)
50 {
51  /*
52  * Format:
53  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54  * std::cout << "Blah blah blah >";
55  * printTriggerWindowDefs(std::cout, windows);
56  * std::cout << "And blah blah." << std::endl;
57  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58  * may yield:
59  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60  * Blah blah blah >3 windows:
61  * #0: 6 channels ( 1, 2, 3, 4, 5, 6 )
62  * #1: 6 channels ( 4, 5, 6, 7, 8, 9 )
63  * #2: 6 channels ( 7, 8, 9, 10, 11, 12 )
64  * And blah blah.
65  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66  */
67  out << windows.size() << " windows:";
68  for (auto const& [ iWindow, window ]: util::enumerate(windows)) {
69  out << "\n #" << iWindow << ": ";
70  printTriggerWindowChannels(out, window);
71  } // for
72 
73 } // icarus::trigger::printTriggerWindowDefs()
74 
75 
76 // -----------------------------------------------------------------------------
void printTriggerWindowDefs(std::ostream &out, TriggerWindowDefs_t const &windows)
Prints the composition of all windows in long format.
Class compacting a list of integers.
Definition of util::enumerate().
void printTriggerWindowChannels(std::ostream &out, TriggerWindowChannels_t const &window)
Prints the composition of the optical detector window inline.
std::vector< raw::Channel_t > TriggerWindowChannels_t
Type of optical detector channel list in a window.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
IntegerRanges< typename Coll::value_type, CheckGrowing > makeIntegerRanges(Coll const &coll)
Definition for PMT sliding windows.
std::vector< TriggerWindowChannels_t > TriggerWindowDefs_t
Definition of all windows.