24 #include "messagefacility/MessageLogger/MessageLogger.h"
25 #include "cetlib_except/exception.h"
37 (
unsigned int windowSize,
unsigned int windowStride)
const
61 auto itSlice = planeSlices.begin();
62 auto const send = planeSlices.end();
63 while (itSlice != send) {
65 mf::LogTrace(
fLogCategory) <<
"Assembling window #" << windows.size();
67 WindowDefs_t::value_type window;
68 window.reserve(windowSize);
70 std::optional<decltype(itSlice)> nextStart;
71 unsigned int nChannels = 0U;
72 while (nChannels < windowSize) {
73 if (itSlice == send)
break;
76 if (nChannels == windowStride) {
78 <<
" (next window will start from this slice)";
81 else if ((nChannels > windowStride) && !nextStart) {
82 throw cet::exception(
"SlidingWindowDefinitionAlg")
83 <<
"Unable to start a new window " << windowStride
84 <<
" channels after window #" << windows.size()
85 <<
" (next slice starts " << nChannels <<
" channels after)\n";
89 <<
" adding " << itSlice->size() <<
" channels to existing "
94 =
fGeom.OpDetFromCryo(
id.OpDet,
id.Cryostat);
96 <<
" * " <<
id <<
" (channel " << channel <<
")";
97 window.push_back(channel);
99 nChannels += (itSlice++)->
size();
101 if (nChannels == windowStride) nextStart = itSlice;
104 if (nChannels < windowSize) {
105 if (!windows.empty()) {
108 <<
" ... couldn't complete the last " << windowSize
109 <<
"-channel window: only " << nChannels <<
" channels collected";
113 if (nChannels != windowSize) {
114 throw cet::exception(
"SlidingWindowDefinitionAlg")
115 <<
"Definition of one window yielded " << nChannels
116 <<
" elements (window should be of size " << windowSize
117 <<
" and with stride " << windowStride <<
").\n";
120 windows.push_back(std::move(window));
122 itSlice = nextStart.value();
126 <<
"SlidingWindowTrigger defined " << windows.size() <<
" windows.";
Encapsulate the construction of a single cyostat.
Definition of util::enumerate().
std::size_t size(FixedBins< T, C > const &) noexcept
Geometry information for a single cryostat.
icarus::trigger::TriggerWindowDefs_t WindowDefs_t
Definition of all windows.
Access the description of detector geometry.
void appendCryoSlices(Slices_t &slices, geo::CryostatGeo const &cryo) const
Computes slices from all PMT in cryo and appends them to slices.
Algorithm composing PMT sliding windows from geometry information.
Algorihtm to group PMTs into piling towers.
std::vector< TCSlice > slices
Encapsulate the geometry of an optical detector.
The data type to uniquely identify a optical detector.
WindowDefs_t makeWindows(unsigned int windowSize, unsigned int windowStride) const
Performs the calculation and returns the sliding window composition.
std::vector< PMTtowerOnPlane_t > Slices_t
Type of PMT towers, per plane.
std::vector< PMTtower_t > PMTtowerOnPlane_t
Type of list of PMT towers on a single optical detector plane.
Algorithm clustering PMT according to their position.