All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SlidingWindowTrigger_module.cc
Go to the documentation of this file.
1 /**
2  * @file SlidingWindowTrigger_module.cc
3  * @brief Combines trigger channels into sliding windows.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date January 6, 2020
6  */
7 
8 // ICARUS libraries
19 #include "icaruscode/IcarusObj/OpDetWaveformMeta.h" // sbn::OpDetWaveformMeta
20 #include "icarusalg/Utilities/FHiCLutils.h" // util::fhicl::getOptionalValue()
21 
22 // LArSoft libraries
23 #include "lardata/Utilities/NestedIterator.h" // lar::double_fwd_const_iterator
25 #include "larcore/CoreUtils/ServiceUtil.h" // lar::providerFrom()
27 #include "larcorealg/CoreUtils/StdUtils.h" // util::to_string()
28 #include "larcorealg/CoreUtils/values.h" // util::const_values()
30 #include "larcorealg/CoreUtils/get_elements.h" // util::get_elements()
31 // #include "larcorealg/CoreUtils/DebugUtils.h" // lar::debug::::static_assert_on<>
33 
34 // framework libraries
35 #include "art/Framework/Services/Registry/ServiceHandle.h"
36 #include "art/Framework/Core/EDProducer.h"
37 #include "art/Framework/Core/ModuleMacros.h"
38 #include "art/Framework/Principal/Event.h"
39 #include "art/Framework/Principal/Handle.h"
40 #include "canvas/Utilities/InputTag.h"
41 #include "canvas/Utilities/Exception.h"
42 #include "messagefacility/MessageLogger/MessageLogger.h"
43 #include "fhiclcpp/types/OptionalSequence.h"
44 #include "fhiclcpp/types/Sequence.h"
45 #include "fhiclcpp/types/OptionalAtom.h"
46 #include "fhiclcpp/types/Atom.h"
47 #include "cetlib_except/exception.h"
48 
49 
50 // C/C++ standard libraries
51 #include <numeric> // std::iota()
52 #include <map>
53 #include <vector>
54 #include <string>
55 #include <optional>
56 #include <memory> // std::unique_ptr
57 #include <utility> // std::move()
58 #include <cassert>
59 #if 0
60 #include <set>
61 #include <cstddef> // std::size_t
62 
63 #endif // 0
64 
65 //------------------------------------------------------------------------------
66 namespace icarus::trigger { class SlidingWindowTrigger; }
67 
68 /**
69  * @brief Combines trigger channels (V1730 LVDS gates) into sliding windows.
70  *
71  * This module combines the input discriminated waveforms into a set of new
72  * multi-level discriminated gates according to the geometric criterion of a
73  * sliding window.
74  *
75  * The combination is a sum of all the discriminated waveforms within the
76  * window.
77  * Different optical detector planes are treated independently and separately.
78  * It is expected that the input is from V1730 LVDS gates
79  * (see `icarus::trigger::LVDSgates` module) which combine (usually) two optical
80  * detector channels each.
81  *
82  *
83  * Sliding window configuration
84  * -----------------------------
85  *
86  * The size of the window is specified in terms on number of optical detector
87  * channels per window and of stride. The windows are allowed to overlap, but
88  * they have all the same number of channels.
89  * If the parameters yield an invalid configuration, the module will throw an
90  * exception.
91  *
92  * The definition of a valid window configuration is quite restrictive.
93  * Optical detector channels are grouped by the TPC width coordinate (_z_) into
94  * "towers". In ICARUS, a tower is made of either two or three channels,
95  * depending on the position in _z_. A window can't split a tower, but rather
96  * has to include whole towers.
97  * In addition, the input discriminated waveforms may include information from
98  * multiple channels (that is the common case if the input is LVDS gates).
99  * A window can't cover only part of the channels of any input, but rather must
100  * extend wide enough so that all the channels in the included gates are
101  * covered. Channels may be exempted by marking them as "missing".
102  * Finally, all the channels which are not "missing" must be covered by at least
103  * one window.
104  *
105  * For the sliding window configuration to be valid, all the windows starting
106  * with an offset multiple of the stride must be valid.
107  *
108  * For the standard pairing of LVDS gates in ICARUS, this translates into the
109  * only allowed window sizes are by 10 and 15 channels or their multiples,
110  * with a stride also in multiples of 10 or 15 respectively.
111  * For example, the following configurations are all valid:
112  * * 10 channels per window, with stride of 10 channels (9 windows per plane);
113  * * 20 channels per window, with stride of 10 channels (8 windows per plane);
114  * * 30 channels per window, with stride of 10 channels (7 windows per plane);
115  * * 15 channels per window, with stride of 15 channels (6 windows per plane);
116  * * 30 channels per window, with stride of 30 channels (3 windows per plane);
117  * * 30 channels per window, with stride of 15 channels (5 windows per plane);
118  * * 45 channels per window, with stride of 45 channels (2 windows per plane).
119  *
120  *
121  * Input data products
122  * ====================
123  *
124  * * `std::vector<icarus::trigger::OpticalTriggerGateData_t>` (labels out of
125  * `TriggerGatesTag` and `Thresholds`): full sets of discriminated waveforms,
126  * each waveform possibly covering multiple optical channels,
127  * and their associations to waveform metadata (`sbn::OpDetWaveformMeta`).
128  * One set per threshold.
129  *
130  * Requirements
131  * -------------
132  *
133  * The algorithms require that in each set all optical channels are covered.
134  *
135  *
136  * Output data products
137  * =====================
138  *
139  * * `std::vector<icarus::trigger::OpticalTriggerGateData_t>` (instance name:
140  * same as the input gates): sets of gates combined according to the window
141  * configuration; one set per input threshold.
142  * * `art::Assns<icarus::trigger::OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>`
143  * (instance name: same as the input gates): associations between each
144  * produced gate and the metadata of optical waveforms providing the original
145  * data.
146  * * `art::Assns<icarus::trigger::OpticalTriggerGateData_t, raw::OpDetWaveform>`
147  * (instance name: same as the input gates): associations between each
148  * produced gate and the optical waveforms providing the original data.
149  * It is produced only if `ProduceWaveformAssns` configuration parameter is
150  * `true`, and it relies on the assumption that there is an association
151  * available between each `sbn::OpDetWaveformMeta` and its
152  * `raw::OpDetWaveform`, produced by the same module (i.e. with the same input
153  * tag) as the one of the original `sbn::OpDetWaveformMeta` data product
154  * itself.
155  *
156  * If window selection is requested (with `EnableOnlyWindows` or
157  * `DisableWindows` configuration parameters), only the selected windows will
158  * have an output entry. While each trigger data object comes with all the
159  * channels it covers, there is no explicit information of the _index_ of the
160  * surviving windows.
161  *
162  * @note At the moment, associations between input and output gates is not
163  * produced. `art::Assns` would not support it, requiring distinct
164  * types for the associated objects.
165  *
166  *
167  * Configuration parameters
168  * =========================
169  *
170  * A terse description of the parameters is printed by running
171  * `lar --print-description SlidingWindowTrigger`.
172  *
173  * * `TriggerGatesTag` (string, mandatory): name of the module
174  * instance which produced the discriminated waveforms; it must not include
175  * any instance name, as the instance names will be automatically added from
176  * `Thresholds` parameter.
177  * * `Thresholds` (list of strings, mandatory): list of the discrimination
178  * thresholds to consider. A data product containing a digital signal is
179  * read for each one of the thresholds, and the tag of the data product is
180  * expected to be the module label `TriggerGatesTag` with as instance name
181  * the value of the entry in this list. While it is common for this entry to
182  * be the actual threshold value in ADC (e.g. `"400"`), this is not
183  * required.
184  * * `WindowSize` (integral, mandatory): the number of _optical detector
185  * channels_ that every window must include. Note that this is not
186  * equivalent to the number of input objects from the `TriggerGatesTag` data
187  * products: for example, in the standard ICARUS configuration, a window
188  * spanning 15 channels is generated out of only 8 LVDS input gates.
189  * * `Stride` (integral, default: as `WindowSize`): the base offset, in number
190  * of optical detector channels, where to start a new window. Windows are
191  * started at all multiples of `Stride`. For example, windows of 30 channels
192  * with `Stride` 15 will start after 0, 15, 30, 45 and 60 channels on each
193  * optical detector plane.
194  * * `EnableOnlyWindows` (list of integers, default: omitted): if specified,
195  * only the windows with index in this list will be processed and output;
196  * mutually exclusive with `DisableWindows`.
197  * * `DisableWindows` (list of integers, default: omitted): if specified,
198  * the windows with index in this list will be excluded from processing and
199  * from output; mutually exclusive with `EnableOnlyWindows`.
200  * * `MissingChannels` (list of integers, default: empty): the channels whose ID
201  * is included in this list are expected and required not to be present in
202  * the input (i.e. no input gate should include them).
203  * * `ProduceWaveformAssns` (flag, default: `true`): produce also associations
204  * between each gate and the `raw::OpDetWaveform` which contributed to it.
205  * * `LogCategory` (string): name of the output stream category for console
206  * messages (managed by MessageFacility library).
207  *
208  * *Note*: when using `EnableOnlyWindows` or `DisableWindows` it may be useful
209  * to check the output of the module (at construction) to verify that the
210  * selected indices match the intended windows.
211  *
212  */
213 class icarus::trigger::SlidingWindowTrigger: public art::EDProducer {
214 
215  public:
216 
217 
218  // --- BEGIN Configuration ---------------------------------------------------
219  struct Config {
220 
221  using Name = fhicl::Name;
222  using Comment = fhicl::Comment;
223 
224 
225  fhicl::Atom<std::string> TriggerGatesTag {
226  Name("TriggerGatesTag"),
227  Comment("label of the input trigger gate data product (no instance name)")
228  };
229 
230  fhicl::Sequence<std::string> Thresholds {
231  Name("Thresholds"),
232  Comment
233  ("thresholds to consider (instance names of `TriggerGatesTag` input)")
234  };
235 
236  fhicl::Atom<unsigned int> WindowSize {
237  Name("WindowSize"),
238  Comment("number of optical channels to be included in each window")
239  };
240  fhicl::OptionalAtom<unsigned int> Stride {
241  Name("Stride"),
242  Comment(
243  "number of optical channel used as offset for sliding window [as WindowSize]"
244  )
245  };
246 
247  fhicl::OptionalSequence<std::size_t> DisableWindows {
248  Name("DisableWindows"),
249  Comment("ignores the windows with the specified index"),
250  [this](){ return !EnableOnlyWindows.hasValue(); }
251  };
252 
253  fhicl::OptionalSequence<std::size_t> EnableOnlyWindows {
254  Name("EnableOnlyWindows"),
255  Comment("only enables the windows with the specified index"),
256  [this](){ return !DisableWindows.hasValue(); }
257  };
258 
259  fhicl::Sequence<raw::Channel_t> MissingChannels {
260  Name("MissingChannels"),
261  Comment("list of ID of channels missing from the input"),
262  std::vector<raw::Channel_t>{}
263  };
264 
265  fhicl::Atom<bool> ProduceWaveformAssns {
266  Name("ProduceWaveformAssns"),
267  Comment
268  ("also produce gate/waveform associations together with gate/metadata"),
269  true
270  };
271 
272  fhicl::Atom<std::string> LogCategory {
273  Name("LogCategory"),
274  Comment("name of the category used for the output"),
275  "SlidingWindowTrigger" // default
276  };
277 
278  }; // struct Config
279 
280  using Parameters = art::EDProducer::Table<Config>;
281 
282  // --- END Configuration -----------------------------------------------------
283 
284 
285  // --- BEGIN Constructors ----------------------------------------------------
286  explicit SlidingWindowTrigger(Parameters const& config);
287 
288  // Plugins should not be copied or assigned.
293 
294  // --- END Constructors ------------------------------------------------------
295 
296 
297  // --- BEGIN Framework hooks -------------------------------------------------
298 
299  /// Fills the plots. Also extracts the information to fill them with.
300  virtual void produce(art::Event& event) override;
301 
302  // --- END Framework hooks ---------------------------------------------------
303 
304 
305  private:
306  /// Definition of all windows.
308 
310 
311  /// Reconstituted trigger gate type internally used.
314 
315  // --- BEGIN Configuration variables -----------------------------------------
316 
317  /// ADC thresholds to read, and the input tag connected to their data.
318  std::map<std::string, art::InputTag> fADCthresholds;
319 
320  unsigned int const fWindowSize; ///< Sliding window size in number of channels.
321  unsigned int const fWindowStride; ///< Sliding window base offset.
322 
323  /// Channel content of each window.
325 
326  /// List of windows to be included.
327  std::vector<std::size_t> const fEnabledWindows;
328 
329  /// Whether to produce gate/waveform associations.
331 
332  /// Message facility stream category for output.
333  std::string const fLogCategory;
334 
335  // --- END Configuration variables -------------------------------------------
336 
337  /// Combining algorithm.
339 
340 
341  /// Returns the number of disabled windows.
342  unsigned int nDisabledWindows() const noexcept
343  { return fWindowChannels.size() - fEnabledWindows.size(); }
344 
345  /// Performs the combination for data with a specified threshold.
346  void produceThreshold(
347  art::Event& event,
349  std::string const& threshold,
350  art::InputTag const& dataTag
351  ) const;
352 
353  /// Reads a set of input gates from the `event` and updates `waveformMap`.
354  std::vector<icarus::trigger::TrackedOpticalTriggerGate<sbn::OpDetWaveformMeta>> ReadTriggerGates(
355  art::Event const& event,
356  art::InputTag const& dataTag,
358  ) const;
359 
360  /// Defines the channels falling in each window.
361  WindowDefs_t defineWindows() const;
362 
363  /// Returns a list of enabled window indices.
364  static std::vector<std::size_t> makeEnabledWindowIndices(
365  std::size_t nWindows
366  , fhicl::OptionalSequence<std::size_t> const& enabled
367  , fhicl::OptionalSequence<std::size_t> const& disabled
368  );
369 
370  /// Adds the waveforms in the specified association to the waveform `map`.
371  static void UpdateWaveformMap(
373  art::Assns<TriggerGateData_t, sbn::OpDetWaveformMeta> const& assns
374  );
375 
376 }; // class icarus::trigger::SlidingWindowTrigger
377 
378 
379 
380 //------------------------------------------------------------------------------
381 //--- Implementation
382 //------------------------------------------------------------------------------
383 namespace {
384 
385  /// Returns a collection of type CONT with copies of only the elements with
386  /// the specified `indices`.
387  template <typename Cont, typename Indices>
388  Cont filter(Cont const& coll, Indices const& indices) {
389 
390  Cont selected;
391  for (auto const index: indices) selected.push_back(coll.at(index));
392  return selected;
393 
394  } // filter()
395 
396 } // local namespace
397 
398 
399 //------------------------------------------------------------------------------
400 //--- icarus::trigger::SlidingWindowTrigger
401 //------------------------------------------------------------------------------
403  (Parameters const& config)
404  : art::EDProducer(config)
405  // configuration
406  , fWindowSize(config().WindowSize())
407  , fWindowStride
408  (util::fhicl::getOptionalValue(config().Stride).value_or(fWindowSize))
409  , fWindowChannels(defineWindows())
410  , fEnabledWindows(makeEnabledWindowIndices(
411  fWindowChannels.size(),
412  config().EnableOnlyWindows, config().DisableWindows
413  ))
414  , fProduceWaveformAssns(config().ProduceWaveformAssns())
415  , fLogCategory(config().LogCategory())
416  // demand full PMT coverage only if no window was disabled:
417  , fCombiner(
418  filter(fWindowChannels, fEnabledWindows),
419  config().MissingChannels(),
420  nDisabledWindows() == 0U
421  )
422 {
423  //
424  // more complex parameter parsing
425  //
426  std::string const discrModuleLabel = config().TriggerGatesTag();
427  for (std::string const& threshold: config().Thresholds())
428  fADCthresholds[threshold] = art::InputTag{ discrModuleLabel, threshold };
429 
430  //
431  // configuration report (short)
432  //
433  {
434  mf::LogInfo log(fLogCategory);
435  log << "Trigger configuration: " << fWindowChannels.size() << " windows";
436  if (fEnabledWindows.size() < fWindowChannels.size())
437  log << " (only " << fEnabledWindows.size() << " enabled)";
438  log << ":";
439  for (auto const& [ iWindow, window ]: util::enumerate(fWindowChannels)) {
440  log << "\n #" << iWindow << ": "
442  if (std::find(fEnabledWindows.begin(), fEnabledWindows.end(), iWindow)
443  == fEnabledWindows.end())
444  {
445  log << " (disabled)";
446  }
447  } // for
448 
449  log << "\nConfigured " << fADCthresholds.size() << " thresholds (ADC):";
450  for (auto const& [ threshold, dataTag ]: fADCthresholds)
451  log << "\n * " << threshold << " (from '" << dataTag.encode() << "')";
452  } // local block
453 
454 
455  using icarus::trigger::OpticalTriggerGateData_t; // for convenience
456 
457  //
458  // input data declaration
459  //
460  for (art::InputTag const& inputDataTag: util::const_values(fADCthresholds)) {
461  consumes<std::vector<OpticalTriggerGateData_t>>(inputDataTag);
462  consumes<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
463  (inputDataTag);
464  } // for
465 
466 
467  //
468  // output data declaration
469  //
470  for (art::InputTag const& inputDataTag: util::const_values(fADCthresholds)) {
471  produces<std::vector<OpticalTriggerGateData_t>>(inputDataTag.instance());
472  produces<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
473  (inputDataTag.instance());
474  if (fProduceWaveformAssns) {
475  produces<art::Assns<OpticalTriggerGateData_t, raw::OpDetWaveform>>
476  (inputDataTag.instance());
477  }
478  } // for
479 
480 
481 } // icarus::trigger::SlidingWindowTrigger::SlidingWindowTrigger()
482 
483 
484 //------------------------------------------------------------------------------
486 
488 
489  for (auto const& [ thresholdStr, dataTag ]: fADCthresholds) {
490 
491  produceThreshold(event, waveformMap, thresholdStr, dataTag);
492 
493  } // for all thresholds
494 
495 } // icarus::trigger::SlidingWindowTrigger::produce()
496 
497 
498 //------------------------------------------------------------------------------
500  -> WindowDefs_t
501 {
502  // delegated to `SlidingWindowDefinitionAlg`
503 
505  *(lar::providerFrom<geo::Geometry>()),
506  "SlidingWindowTrigger/SlidingWindowDefinitionAlg"
507  };
508 
509  return algo.makeWindows(fWindowSize, fWindowStride);
510 
511 } // icarus::trigger::SlidingWindowTrigger::defineWindows()
512 
513 
514 //------------------------------------------------------------------------------
516  art::Event& event,
518  std::string const& threshold,
519  art::InputTag const& dataTag
520 ) const {
521 
522  mf::LogDebug(fLogCategory)
523  << "Processing threshold " << threshold
524  << " from '" << dataTag.encode() << "'"
525  ;
526 
527  using icarus::trigger::OpticalTriggerGateData_t; // for convenience
530 
531  std::vector<TrackedTriggerGate_t> const& gates
532  = ReadTriggerGates(event, dataTag, waveformMap);
533 
534  std::vector<TrackedTriggerGate_t> combinedGates = fCombiner.combine(gates);
535 
536  // transform the data; after this line, `gates` is not usable any more
537  art::PtrMaker<OpticalTriggerGateData_t> const makeGatePtr
538  (event, dataTag.instance());
539  auto [ outputGates, outputAssns ]
541  (std::move(combinedGates), makeGatePtr, waveformMap);
542 
543  {
544  mf::LogTrace log { fLogCategory };
545  log
546  << "Threshold " << threshold << " ('" << dataTag.encode() << "'): "
547  << gates.size() << " input channels, "
548  << outputGates.size() << " output channels (+"
549  << outputAssns.size() << " associations to waveforms) into '"
550  << moduleDescription().moduleLabel() << ":" << dataTag.instance() << "'"
551  ;
552  for (auto const& [ iGate, gate ]: util::enumerate(outputGates)) {
553  log << "\n [#" << iGate << "] " << compactdump(gate);
554  } // for
555  } // local scope
556 
557  if (fProduceWaveformAssns) {
558 
559  // produce one gate-waveform association for each gate-metadata one;
560  // do it now while the gate/metadata association is still locally available
561  icarus::trigger::OpDetWaveformMetaMatcher waveformMetaMatcher{ event };
562  art::Assns<OpticalTriggerGateData_t, raw::OpDetWaveform> outputWaveAssns;
563  for (auto const [ gatePtr, metaPtr ]: outputAssns)
564  outputWaveAssns.addSingle(gatePtr, waveformMetaMatcher(metaPtr));
565 
566  event.put(
567  std::make_unique<art::Assns<OpticalTriggerGateData_t, raw::OpDetWaveform>>
568  (std::move(outputWaveAssns)),
569  dataTag.instance()
570  );
571  } // if fProduceWaveformAssns
572 
573  event.put(
574  std::make_unique<std::vector<OpticalTriggerGateData_t>>
575  (std::move(outputGates)),
576  dataTag.instance()
577  );
578  event.put(
579  std::make_unique<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
580  (std::move(outputAssns)),
581  dataTag.instance()
582  );
583 
584 } // icarus::trigger::SlidingWindowTrigger::produceThreshold()
585 
586 
587 //------------------------------------------------------------------------------
589  std::size_t nWindows
590  , fhicl::OptionalSequence<std::size_t> const& enabled
591  , fhicl::OptionalSequence<std::size_t> const& disabled
592 ) -> std::vector<std::size_t> {
593 
594  std::vector<std::size_t> selection; // indices of the enabled windows
595 
596  // add all enabled windows (or all if no enabled list is specified)
597  if (!enabled(selection)) {
598  selection.resize(nWindows);
599  std::iota(selection.begin(), selection.end(), 0U);
600  }
601 
602  // remove all disabled windows (if any)
603  std::vector<std::size_t> removeWindows;
604  disabled(removeWindows);
605  auto const find = [&selection](std::size_t index)
606  { return std::find(selection.begin(), selection.end(), index); };
607  for (std::size_t const index: removeWindows) {
608  if (auto const it = find(index); it != selection.end()) selection.erase(it);
609  } // for
610 
611  return selection;
612 } // icarus::trigger::SlidingWindowTrigger::makeEnabledWindowIndices()
613 
614 
615 //------------------------------------------------------------------------------
618  art::Assns<TriggerGateData_t, sbn::OpDetWaveformMeta> const& assns
619 ) {
620 
621  for (art::Ptr<sbn::OpDetWaveformMeta> const& wave: util::get_elements<1U>(assns))
622  map.emplace(wave.get(), wave);
623 
624 } // icarus::trigger::SlidingWindowTrigger::UpdateWaveformMap()
625 
626 
627 //------------------------------------------------------------------------------
629  art::Event const& event,
630  art::InputTag const& dataTag,
632 ) const -> std::vector<TrackedTriggerGate_t> {
634 
635  auto const& assns =
636  event.getProduct<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
637  (dataTag);
638 
639  UpdateWaveformMap(waveformMap, assns);
640 
642  (event.getProduct<std::vector<OpticalTriggerGateData_t>>(dataTag), assns);
643 
644 } // icarus::trigger::SlidingWindowTrigger::ReadTriggerGates()
645 
646 //------------------------------------------------------------------------------
647 DEFINE_ART_MODULE(icarus::trigger::SlidingWindowTrigger)
648 
649 
650 //------------------------------------------------------------------------------
BEGIN_PROLOG BeamGateDuration pmtthr physics producers trigtilewindowORS Thresholds
std::vector< std::size_t > const fEnabledWindows
List of windows to be included.
fhicl::OptionalSequence< std::size_t > EnableOnlyWindows
Utilities related to art service access.
Utilities for the conversion of trigger gate data formats.
WindowDefs_t const fWindowChannels
Channel content of each window.
SlidingWindowTrigger & operator=(SlidingWindowTrigger const &)=delete
std::optional< typename Optional::value_type > getOptionalValue(Optional const &parameter)
Returns the value of an optional parameter as std::optional.
Definition: FHiCLutils.h:188
bool fProduceWaveformAssns
Whether to produce gate/waveform associations.
Definition of util::get_elements() and util::get_const_elements().
Definition of util::enumerate().
A wrapper to trigger gate objects tracking the input of operations.
Utilities for TriggerGateData printout.
Derivative information from raw::OpDetWaveform data.
std::vector< icarus::trigger::OpticalTriggerGateData_t > transformIntoOpticalTriggerGate(Gates &&gates)
Returns the trigger gates in serializable format.
decltype(auto) const_values(Coll &&coll)
Range-for loop helper iterating across the constant values of the specified collection.
std::map< std::string, art::InputTag > fADCthresholds
ADC thresholds to read, and the input tag connected to their data.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
fDetProps &fDetProps fDetProps &fDetProps fLogCategory
unsigned int nDisabledWindows() const noexcept
Returns the number of disabled windows.
Access the description of detector geometry.
unsigned int const fWindowStride
Sliding window base offset.
Combines trigger channels (V1730 LVDS gates) into sliding windows.
icarus::trigger::TriggerWindowDefs_t WindowDefs_t
Definition of all windows.
auto dumpTriggerWindowChannels(TriggerWindowChannels_t const &window) -> details::DumpTriggerWindowChannelWrapper
Logical multi-level gate associated to one or more readout channels.
Object to facilitate the discovery of the raw::OpDetWaveform a sbn::OpDetWaveformMeta objects comes f...
Simple type definitions for trigger algorithms.
Algorithm composing PMT sliding windows from geometry information.
A trigger gate data object for optical detector electronics.
unsigned int const fWindowSize
Sliding window size in number of channels.
constexpr std::array< std::size_t, geo::vect::dimension< Vector >)> indices()
Returns a sequence of indices valid for a vector of the specified type.
Algorithm to combine trigger channels into sliding windows.
icarus::trigger::ReadoutTriggerGate< TriggerGateTick_t, TriggerGateTicks_t, raw::Channel_t > OpticalTriggerGateData_t
Type of trigger gate data serialized into art data products.
Algorihtm to group PMTs into piling towers.
std::string const fLogCategory
Message facility stream category for output.
BEGIN_PROLOG vertical distance to the surface Name
fhicl::OptionalSequence< std::size_t > DisableWindows
BEGIN_PROLOG triggeremu_data_config_icarus settings sequence::triggeremu_data_config_icarus settings PMTADCthresholds sequence::triggeremu_data_config_icarus settings PMTADCthresholds WindowSize
Definition for PMT sliding windows.
physics filters filter
std::vector< icarus::trigger::TrackedOpticalTriggerGate< sbn::OpDetWaveformMeta > > ReadTriggerGates(art::Event const &event, art::InputTag const &dataTag, icarus::trigger::OpDetWaveformMetaDataProductMap_t &waveformMap) const
Reads a set of input gates from the event and updates waveformMap.
static void UpdateWaveformMap(icarus::trigger::OpDetWaveformMetaDataProductMap_t &map, art::Assns< TriggerGateData_t, sbn::OpDetWaveformMeta > const &assns)
Adds the waveforms in the specified association to the waveform map.
Utilities for matching raw::OpDetWaveform and their sbn::OpDetWaveformMeta.
size_t Stride(bool allow_default)
Functions pulling in STL customization if available.
icarus::trigger::SlidingWindowCombinerAlg const fCombiner
Combining algorithm.
static std::vector< std::size_t > makeEnabledWindowIndices(std::size_t nWindows, fhicl::OptionalSequence< std::size_t > const &enabled, fhicl::OptionalSequence< std::size_t > const &disabled)
Returns a list of enabled window indices.
void produceThreshold(art::Event &event, icarus::trigger::OpDetWaveformMetaDataProductMap_t &waveformMap, std::string const &threshold, art::InputTag const &dataTag) const
Performs the combination for data with a specified threshold.
A simple alias for a most commonly used TrackedTriggerGate type.
std::vector< icarus::trigger::TrackedOpticalTriggerGate< OpDetInfo > > FillTriggerGates(std::vector< icarus::trigger::OpticalTriggerGateData_t > const &gates, art::Assns< icarus::trigger::OpticalTriggerGateData_t, OpDetInfo > const &gateToWaveformInfo)
Creates a gate object out of trigger gate data products.
Simple helper functions to deal with FHiCL.
Groups optical detector channels into windows based on position.
Definition of util::values() and util::const_values().
virtual void produce(art::Event &event) override
Fills the plots. Also extracts the information to fill them with.
std::vector< TriggerWindowChannels_t > TriggerWindowDefs_t
Definition of all windows.
std::vector< icarus::trigger::TrackedOpticalTriggerGate< OpDetInfo > > ReadTriggerGates(Event const &event, art::InputTag const &dataTag)
Assembles and returns trigger gates from serialized data.
Iterators recursing though nested collections.
util::DataProductPointerMap_t< sbn::OpDetWaveformMeta > OpDetWaveformMetaDataProductMap_t
Map util::DataProductPointerMap_t for sbn::OpDetWaveformMeta objects.
WindowDefs_t makeWindows(unsigned int windowSize, unsigned int windowStride) const
Performs the calculation and returns the sliding window composition.
OpticalTriggerGateData_t GateData_t
Type for gate data access.
art framework interface to geometry description
WindowDefs_t defineWindows() const
Defines the channels falling in each window.
auto compactdump(ReadoutTriggerGate< Tick, TickInterval, ChannelIDType > const &gate) -> details::CompactFormatter< ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >>
Manipulator-like function for compact format of trigger gates.