All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
icarus::trigger::LVDSgates Class Reference

Combines discriminated PMT outputs into V1730 LVDS gates. More...

Inheritance diagram for icarus::trigger::LVDSgates:

Classes

struct  Config
 
struct  SourceInfo_t
 Information for each source. More...
 

Public Types

enum  ComboMode {
  ComboMode::disable, ComboMode::Input1, ComboMode::Input2, ComboMode::AND,
  ComboMode::OR
}
 Available operations for the combination of channels. More...
 
using TriggerGateData_t = icarus::trigger::OpticalTriggerGate::GateData_t
 
using Parameters = art::EDProducer::Table< Config >
 

Public Member Functions

 LVDSgates (Parameters const &config)
 
 LVDSgates (LVDSgates const &)=delete
 
 LVDSgates (LVDSgates &&)=delete
 
LVDSgatesoperator= (LVDSgates const &)=delete
 
LVDSgatesoperator= (LVDSgates &&)=delete
 
virtual void produce (art::Event &event) override
 Fills the plots. Also extracts the information to fill them with. More...
 
template<typename Op >
auto binaryCombineChannel (std::vector< TrackedTriggerGate_t > const &gates, std::vector< raw::Channel_t > const &pairing, Op combine) const -> TrackedTriggerGate_t
 

Private Types

using BinaryCombinationFunc_t = OpticalTriggerGate &(OpticalTriggerGate::*)(OpticalTriggerGate const &)
 Type of member function to combine the current gate with another one. More...
 
using TrackedTriggerGate_t = icarus::trigger::TrackedOpticalTriggerGate< sbn::OpDetWaveformMeta >
 Reconstituted trigger gate type internally used. More...
 

Private Member Functions

void produceThreshold (art::Event &event, icarus::trigger::OpDetWaveformMetaDataProductMap_t &waveformMap, std::string const &thresholdStr, SourceInfo_t const &srcInfo) const
 Completely processes the data for the specified threshold. More...
 
std::vector< std::vector
< raw::Channel_t > > 
removeChannels (std::vector< std::vector< raw::Channel_t >> channelPairing, std::vector< raw::Channel_t > const &ignoreChannels) const
 Removes all the channel in ignoreChannels from channelPairing. More...
 
TrackedTriggerGate_t discardChannels (std::vector< TrackedTriggerGate_t > const &, std::vector< raw::Channel_t > const &pairing) const
 Combination function for the disable mode. More...
 
TrackedTriggerGate_t selectChannel (std::vector< TrackedTriggerGate_t > const &, std::vector< raw::Channel_t > const &pairing, std::size_t chosenIndex) const
 Combination function for the input1 and input2 modes. More...
 
template<typename Op >
TrackedTriggerGate_t binaryCombineChannel (std::vector< TrackedTriggerGate_t > const &gates, std::vector< raw::Channel_t > const &pairing, Op combine) const
 Combination function for the AND and OR modes; op is from GateOps. More...
 
TrackedTriggerGate_t combineChannels (std::vector< TrackedTriggerGate_t > const &gates, std::vector< raw::Channel_t > const &pairing, ComboMode comboMode) const
 Performs the combination of a group of channels. More...
 
unsigned int checkPairings () const
 
void checkInput (std::vector< TrackedTriggerGate_t > const &gates) const
 Input requirement check. Throws if requirements fail. More...
 

Static Private Member Functions

static void UpdateWaveformMap (icarus::trigger::OpDetWaveformMetaDataProductMap_t &map, art::Assns< TriggerGateData_t, sbn::OpDetWaveformMeta > const &assns)
 Adds the associated waveforms into the map. More...
 
static std::vector
< TrackedTriggerGate_t
ReadTriggerGates (art::Event const &event, art::InputTag const &dataTag, icarus::trigger::OpDetWaveformMetaDataProductMap_t &waveformMap)
 Assembles trigger gates from dataTag data products in event. More...
 
static art::InputTag makeTag (std::string const &thresholdStr, std::string const &defModule)
 Converts a threshold string into an input tag. More...
 
static std::string makeOutputInstanceName (art::InputTag const &inputTag, std::string const &defModule)
 Converts an input tag into an instance name for the corresponding output. More...
 

Private Attributes

std::map< std::string,
SourceInfo_t
fADCthresholds
 ADC thresholds to read, and the input tag connected to their data. More...
 
std::vector< std::vector
< raw::Channel_t > > 
fChannelPairing
 Pairing of optical detector channels. More...
 
ComboMode fComboMode
 The operation used to combinate channels. More...
 
std::vector< raw::Channel_tfIgnoreChannels
 
bool fProduceWaveformAssns
 Whether to produce gate/waveform associations. More...
 
std::string fLogCategory
 Message facility stream category for output. More...
 

Detailed Description

Combines discriminated PMT outputs into V1730 LVDS gates.

This module simulates the combination of discriminated PMT outputs by the V1730 board LVDS output.

Input data products

Requirements

The algorithms require that the list of discriminated waveforms has in each position the waveform from the optical detector channel number matching the position (e.g. entry 0 will be the discriminated waveform from channel 0, and so forth). No gaps are allowed: if no signal is present above threshold for a certain channel, a discriminated waveform should appear for that channel, with a gate always closed.

Output data products

Configuration parameters

A terse description of the parameters is printed by running lar --print-description LVDSgates.

Definition at line 166 of file LVDSgates_module.cc.

Member Typedef Documentation

Type of member function to combine the current gate with another one.

Definition at line 277 of file LVDSgates_module.cc.

using icarus::trigger::LVDSgates::Parameters = art::EDProducer::Table<Config>

Definition at line 248 of file LVDSgates_module.cc.

Reconstituted trigger gate type internally used.

Definition at line 281 of file LVDSgates_module.cc.

Definition at line 170 of file LVDSgates_module.cc.

Member Enumeration Documentation

Available operations for the combination of channels.

Enumerator
disable 
Input1 
Input2 
AND 
OR 

Definition at line 173 of file LVDSgates_module.cc.

173 { disable, Input1, Input2, AND, OR };

Constructor & Destructor Documentation

icarus::trigger::LVDSgates::LVDSgates ( Parameters const &  config)
explicit

Definition at line 399 of file LVDSgates_module.cc.

400  : art::EDProducer(config)
401  // configuration
402  , fChannelPairing(config().ChannelPairing())
403  , fComboMode(config().getCombinationMode())
404  , fIgnoreChannels(config().IgnoreChannels())
405  , fProduceWaveformAssns(config().ProduceWaveformAssns())
406  , fLogCategory(config().LogCategory())
407 {
408  //
409  // more complex parameter parsing
410  //
411  std::string const discrModuleLabel = config().TriggerGatesTag().value_or("");
412  for (std::string const& thresholdStr: config().Thresholds()) {
413  art::InputTag const inputTag = makeTag(thresholdStr, discrModuleLabel);
414  fADCthresholds[thresholdStr]
415  = { inputTag, makeOutputInstanceName(inputTag, discrModuleLabel) };
416  } // for all thresholds
417 
418  //
419  // configuration validation
420  //
421  unsigned int nConfiguredChannels = checkPairings();
422 
423  //
424  // configuration report (short)
425  //
426  {
427  mf::LogInfo log(fLogCategory);
428  log << nConfiguredChannels
429  << " optical channels configured to be combined into "
430  << fChannelPairing.size() << " LVDS outputs.";
431  log << "\nignored " << fIgnoreChannels.size() << " channels.";
432  log << "\nConfigured " << fADCthresholds.size() << " thresholds (ADC):";
433  for (auto const& [ threshold, srcInfo ]: fADCthresholds) {
434  log << "\n * " << threshold
435  << " (from '" << srcInfo.inputTag.encode() << "')";
436  }
437  } // local block
438 
439 
440  using icarus::trigger::OpticalTriggerGateData_t; // for convenience
441 
442  //
443  // input data declaration
444  //
445  for (auto const& [ inputTag, outName ]: util::const_values(fADCthresholds)) {
446  consumes<std::vector<OpticalTriggerGateData_t>>(inputTag);
447  consumes<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
448  (inputTag);
449  } // for
450 
451 
452  //
453  // output data declaration
454  //
455  for (auto const& [ inputTag, outName ]: util::const_values(fADCthresholds)) {
456  produces<std::vector<OpticalTriggerGateData_t>>(outName);
457  produces<art::Assns<OpticalTriggerGateData_t, raw::OpDetWaveform>>(outName);
458  if (fProduceWaveformAssns) {
459  produces<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
460  (outName);
461  }
462  } // for
463 
464 
465 } // icarus::trigger::LVDSgates::LVDSgates()
BEGIN_PROLOG BeamGateDuration pmtthr physics producers trigtilewindowORS Thresholds
static art::InputTag makeTag(std::string const &thresholdStr, std::string const &defModule)
Converts a threshold string into an input tag.
decltype(auto) const_values(Coll &&coll)
Range-for loop helper iterating across the constant values of the specified collection.
static std::string makeOutputInstanceName(art::InputTag const &inputTag, std::string const &defModule)
Converts an input tag into an instance name for the corresponding output.
bool fProduceWaveformAssns
Whether to produce gate/waveform associations.
icarus::trigger::ReadoutTriggerGate< TriggerGateTick_t, TriggerGateTicks_t, raw::Channel_t > OpticalTriggerGateData_t
Type of trigger gate data serialized into art data products.
std::map< std::string, SourceInfo_t > fADCthresholds
ADC thresholds to read, and the input tag connected to their data.
std::string fLogCategory
Message facility stream category for output.
std::vector< std::vector< raw::Channel_t > > fChannelPairing
Pairing of optical detector channels.
ComboMode fComboMode
The operation used to combinate channels.
unsigned int checkPairings() const
std::vector< raw::Channel_t > fIgnoreChannels
icarus::trigger::LVDSgates::LVDSgates ( LVDSgates const &  )
delete
icarus::trigger::LVDSgates::LVDSgates ( LVDSgates &&  )
delete

Member Function Documentation

template<typename Op >
TrackedTriggerGate_t icarus::trigger::LVDSgates::binaryCombineChannel ( std::vector< TrackedTriggerGate_t > const &  gates,
std::vector< raw::Channel_t > const &  pairing,
Op  combine 
) const
private

Combination function for the AND and OR modes; op is from GateOps.

template<typename Op >
auto icarus::trigger::LVDSgates::binaryCombineChannel ( std::vector< TrackedTriggerGate_t > const &  gates,
std::vector< raw::Channel_t > const &  pairing,
Op  combine 
) const -> TrackedTriggerGate_t

Definition at line 645 of file LVDSgates_module.cc.

649  {
650  if (pairing.empty()) return discardChannels(gates, pairing);
651 
652 #if 1
653 
654  auto byIndex = [&gates](std::size_t index) -> TrackedTriggerGate_t const&
655  { return gates[index]; };
656 
657 # if 0
658  // C++20: the following loses the debug output:
659 
661  (combine, pairing | std::ranges::views::transform(byIndex));
662 # else
663 
665  (combine, util::make_transformed_span(pairing, byIndex));
666 
667 # endif // 0
668 
669 #else
670  auto iChannel = pairing.begin();
671  auto cend = pairing.end();
672 
673  // requiring that gates are at an index matching their channel number
674  TrackedTriggerGate_t gate { gates[*iChannel] };
675 
676  mf::LogTrace(fLogCategory) << "Input: " << gates[*iChannel].gate();
677  while (++iChannel != cend) {
678 
679  mf::LogTrace(fLogCategory) << "Input: " << gates[*iChannel].gate();
680  gate = icarus::trigger::OpGates(combine, gate, gates[*iChannel]);
681 
682  } // while
683  mf::LogTrace(fLogCategory) << "Output: " << gate.gate();
684 
685  return gate;
686 #endif // 0
687 } // icarus::trigger::LVDSgates::binaryCombineChannel()
static constexpr Sample_t transform(Sample_t sample)
TrackedTriggerGate_t discardChannels(std::vector< TrackedTriggerGate_t > const &, std::vector< raw::Channel_t > const &pairing) const
Combination function for the disable mode.
auto cend(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:579
auto OpGateColl(Op op, GateColl const &gates)
Computes the result of an operation on all gates from collection.
auto make_transformed_span(BIter begin, EIter end, Op &&op)
Definition: span.h:294
AGate OpGates(Op op, AGate A, BGate const &B, OGates const &...others)
Applies an operation to two gates.
std::string fLogCategory
Message facility stream category for output.
icarus::trigger::TrackedOpticalTriggerGate< sbn::OpDetWaveformMeta > TrackedTriggerGate_t
Reconstituted trigger gate type internally used.
void icarus::trigger::LVDSgates::checkInput ( std::vector< TrackedTriggerGate_t > const &  gates) const
private

Input requirement check. Throws if requirements fail.

Definition at line 781 of file LVDSgates_module.cc.

782 {
783  /*
784  * check that
785  * * each gate has a single channel
786  * * each gate is in the position matching its channel number
787  */
788 
790 
791  for (auto const& [ iGate, gate ]: util::enumerate(gatesIn(gates))) {
792  // gate is a OpticalTriggerGateData_t
793 
794  auto const expectedChannel = static_cast<raw::Channel_t>(iGate);
795 
796  if (gate.nChannels() != 1U) {
797  cet::exception e("LVDSgates");
798  e << "Requirement failure: gate #" << iGate << " includes ";
799  if (!gate.hasChannels())
800  e << "no channels";
801  else {
802  auto const& channels = gate.channels();
803  auto iChannel = channels.begin();
804  auto const cend = channels.end();
805  e << gate.nChannels() << " channels (" << *iChannel;
806  while (++iChannel != cend) e << ", " << *iChannel;
807  e << ")";
808  }
809  e << " should have exactly one channel (" << expectedChannel << ").\n";
810  throw e;
811  }
812 
813  if (gate.channel() != expectedChannel) {
814  throw cet::exception("LVDSgates")
815  << "Requirement failure: gate #" << iGate << " gate covers channel "
816  << gate.channel() << ", should cover " << expectedChannel
817  << " instead.\n";
818  }
819 
820  } // for
821 
822  MF_LOG_TRACE(fLogCategory)
823  << "LVDSgates[" << moduleDescription().moduleLabel() << "]: input checked.";
824 
825 } // icarus::trigger::LVDSgates::checkInput()
auto gatesIn(TrackingGateColl &trackingGates)
auto cend(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:579
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
do i e
std::string fLogCategory
Message facility stream category for output.
unsigned int icarus::trigger::LVDSgates::checkPairings ( ) const
private

Checks the pairing configuration, throws on error. Returns the number of configured channels.

Definition at line 691 of file LVDSgates_module.cc.

691  {
692 
693  //
694  // collect all the errors first
695  //
696  auto const& geom = *(lar::providerFrom<geo::Geometry>());
697 
698 
699  // collect configured and duplicate channel numbers
700  unsigned int nEmptyGroups = 0U;
701  std::set<raw::Channel_t> configuredChannels, duplicateChannels;
702  for (auto const& pairing: fChannelPairing) {
703  if (pairing.empty()) {
704  ++nEmptyGroups;
705  continue;
706  }
707  for (raw::Channel_t channel: pairing) {
708  if (!configuredChannels.insert(channel).second)
709  duplicateChannels.insert(channel);
710  } // for channel
711  } // for pairing
712 
713  // collect invalid channel numbers
714  std::vector<raw::Channel_t> invalidChannels;
715  for (raw::Channel_t channel: configuredChannels) {
716  if (!geom.IsValidOpChannel(channel)) invalidChannels.push_back(channel);
717  } // for configured channels
718 
719  // collect missing channels
720  auto const endChannel = geom.MaxOpChannel() + 1U;
721  std::vector<raw::Channel_t> missingChannels;
722  for (auto channel: util::counter<raw::Channel_t>(endChannel)) {
723  if (!geom.IsValidOpChannel(channel)) continue;
724  if (configuredChannels.count(channel) > 0U) continue;
725  missingChannels.push_back(channel);
726  } // for channel
727 
728  // no error? good we are
729  if (invalidChannels.empty()
730  && missingChannels.empty()
731  && duplicateChannels.empty()
732  && (nEmptyGroups == 0U)
733  ) {
734  return configuredChannels.size();
735  }
736 
737  // error? good we are not
738  art::Exception e(art::errors::Configuration);
739  e << "The pairing configuration of " << configuredChannels.size()
740  << " optical channels in `ChannelPairing` presents the following errors.\n";
741  if (!invalidChannels.empty()) {
742  auto iChannel = invalidChannels.cbegin();
743  auto const cend = invalidChannels.cend();
744  e
745  << invalidChannels.size()
746  << " channel numbers do not represent valid channels: " << *iChannel;
747  while (++iChannel != cend) e << ", " << *iChannel;
748  e << ".\n";
749  } // if invalid channels
750 
751  if (!missingChannels.empty()) {
752  auto iChannel = missingChannels.cbegin();
753  auto const cend = missingChannels.cend();
754  e
755  << missingChannels.size()
756  << " channels do not appear in the configuration: " << *iChannel;
757  while (++iChannel != cend) e << ", " << *iChannel;
758  e << ".\n";
759  } // if missing channels
760 
761  if (!duplicateChannels.empty()) {
762  auto iChannel = duplicateChannels.cbegin();
763  auto const cend = duplicateChannels.cend();
764  e
765  << duplicateChannels.size()
766  << " channels are specified more than once: " << *iChannel;
767  while (++iChannel != cend) e << ", " << *iChannel;
768  e << ".\n";
769  } // if duplicate channels
770 
771  if (nEmptyGroups > 0U) {
772  e << nEmptyGroups << " channel groups are empty.";
773  }
774 
775  throw e;
776 } // icarus::trigger::LVDSgates::checkPairings()
auto cend(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:579
do i e
std::vector< std::vector< raw::Channel_t > > fChannelPairing
Pairing of optical detector channels.
auto icarus::trigger::LVDSgates::combineChannels ( std::vector< TrackedTriggerGate_t > const &  gates,
std::vector< raw::Channel_t > const &  pairing,
ComboMode  comboMode 
) const
private

Performs the combination of a group of channels.

Definition at line 565 of file LVDSgates_module.cc.

569  {
570 
571  namespace GateOps = icarus::trigger::GateOps;
572 
573  switch (comboMode) {
574  case ComboMode::disable:
575  return discardChannels(gates, pairing);
576  case ComboMode::AND:
577  return binaryCombineChannel(gates, pairing, GateOps::Min);
578  case ComboMode::OR:
579  return binaryCombineChannel(gates, pairing, GateOps::Max);
580  case ComboMode::Input1:
581  return selectChannel(gates, pairing, 0U);
582  case ComboMode::Input2:
583  return selectChannel(gates, pairing, 1U);
584  default:
585  throw art::Exception(art::errors::LogicError)
586  << "Unexpected combination mode (#" << static_cast<int>(comboMode)
587  << ").\n";
588  } // switch(comboMode)
589 } // icarus::trigger::LVDSgates::combineChannels()
TrackedTriggerGate_t binaryCombineChannel(std::vector< TrackedTriggerGate_t > const &gates, std::vector< raw::Channel_t > const &pairing, Op combine) const
Combination function for the AND and OR modes; op is from GateOps.
TrackedTriggerGate_t discardChannels(std::vector< TrackedTriggerGate_t > const &, std::vector< raw::Channel_t > const &pairing) const
Combination function for the disable mode.
TrackedTriggerGate_t selectChannel(std::vector< TrackedTriggerGate_t > const &, std::vector< raw::Channel_t > const &pairing, std::size_t chosenIndex) const
Combination function for the input1 and input2 modes.
auto icarus::trigger::LVDSgates::discardChannels ( std::vector< TrackedTriggerGate_t > const &  gates,
std::vector< raw::Channel_t > const &  pairing 
) const
private

Combination function for the disable mode.

Definition at line 614 of file LVDSgates_module.cc.

617  {
619  for (raw::Channel_t channel: pairing) gate.gate().addChannel(channel);
620  for (auto const& srcGate: gates) gate.tracking().add(srcGate.tracking());
621  return gate;
622 } // icarus::trigger::LVDSgates::combineChannels()
icarus::trigger::TrackedOpticalTriggerGate< sbn::OpDetWaveformMeta > TrackedTriggerGate_t
Reconstituted trigger gate type internally used.
std::string icarus::trigger::LVDSgates::makeOutputInstanceName ( art::InputTag const &  inputTag,
std::string const &  defModule 
)
staticprivate

Converts an input tag into an instance name for the corresponding output.

Definition at line 878 of file LVDSgates_module.cc.

879 {
880  return (inputTag.label() == defModule)
881  ? inputTag.instance()
882  : inputTag.instance().empty()
883  ? inputTag.label(): inputTag.label() + inputTag.instance()
884  ;
885 } // icarus::trigger::LVDSgates::makeTag()
art::InputTag icarus::trigger::LVDSgates::makeTag ( std::string const &  thresholdStr,
std::string const &  defModule 
)
staticprivate

Converts a threshold string into an input tag.

Definition at line 862 of file LVDSgates_module.cc.

863 {
864  return (thresholdStr.find(':') != std::string::npos)
865  ? art::InputTag{ thresholdStr }
866  : defModule.empty()
867  ? throw (art::Exception(art::errors::Configuration)
868  << "No default module label (`TriggerGatesTag`) specified"
869  ", and it's needed for threshold '"
870  << thresholdStr << "'.\n")
871  : art::InputTag{ defModule, thresholdStr }
872  ;
873 } // icarus::trigger::LVDSgates::makeTag()
LVDSgates& icarus::trigger::LVDSgates::operator= ( LVDSgates const &  )
delete
LVDSgates& icarus::trigger::LVDSgates::operator= ( LVDSgates &&  )
delete
void icarus::trigger::LVDSgates::produce ( art::Event &  event)
overridevirtual

Fills the plots. Also extracts the information to fill them with.

Definition at line 469 of file LVDSgates_module.cc.

469  {
470 
472 
473  for (auto const& [ thresholdStr, srcInfo ]: fADCthresholds) {
474 
475  produceThreshold(event, waveformMap, thresholdStr, srcInfo);
476 
477  } // for all thresholds
478 
479 } // icarus::trigger::LVDSgates::produce()
void produceThreshold(art::Event &event, icarus::trigger::OpDetWaveformMetaDataProductMap_t &waveformMap, std::string const &thresholdStr, SourceInfo_t const &srcInfo) const
Completely processes the data for the specified threshold.
std::map< std::string, SourceInfo_t > fADCthresholds
ADC thresholds to read, and the input tag connected to their data.
util::DataProductPointerMap_t< sbn::OpDetWaveformMeta > OpDetWaveformMetaDataProductMap_t
Map util::DataProductPointerMap_t for sbn::OpDetWaveformMeta objects.
void icarus::trigger::LVDSgates::produceThreshold ( art::Event &  event,
icarus::trigger::OpDetWaveformMetaDataProductMap_t waveformMap,
std::string const &  thresholdStr,
SourceInfo_t const &  srcInfo 
) const
private

Completely processes the data for the specified threshold.

Definition at line 485 of file LVDSgates_module.cc.

490  {
491 
492  auto const& [ dataTag, outputInstanceName ] = srcInfo;
493 
494  mf::LogDebug(fLogCategory)
495  << "Processing threshold " << thresholdStr
496  << " from '" << dataTag.encode() << "'";
497 
498  using icarus::trigger::OpticalTriggerGateData_t; // for convenience
499 
500  std::vector<TrackedTriggerGate_t> const& gates
501  = ReadTriggerGates(event, dataTag, waveformMap);
502 
503  checkInput(gates);
504 
505  std::vector<TrackedTriggerGate_t> combinedGates;
506 
507  std::vector<std::vector<raw::Channel_t>> const cleanedChannels
509 
510  for (std::vector<raw::Channel_t> const& pairing: cleanedChannels) {
511  if (pairing.empty()) continue; // ???
512 
513  combinedGates.push_back(combineChannels(gates, pairing, fComboMode));
514 
515  } // for
516 
517  // transform the data; after this line, `gates` is not usable any more
518  art::PtrMaker<OpticalTriggerGateData_t> const makeGatePtr
519  (event, outputInstanceName);
520  auto [ outputGates, outputAssns ]
522  (std::move(combinedGates), makeGatePtr, waveformMap);
523 
524  mf::LogTrace(fLogCategory)
525  << "Threshold " << thresholdStr << " ('" << dataTag.encode() << "'): "
526  << gates.size() << " input channels, "
527  << outputGates.size() << " output channels (+"
528  << outputAssns.size() << " associations to waveforms) into '"
529  << moduleDescription().moduleLabel() << ":" << outputInstanceName << "'"
530  ;
531 
532 
533  if (fProduceWaveformAssns) {
534 
535  // produce one gate-waveform association for each gate-metadata one;
536  // do it now while the gate/metadata association is still locally available
537  icarus::trigger::OpDetWaveformMetaMatcher waveformMetaMatcher{ event };
538  art::Assns<OpticalTriggerGateData_t, raw::OpDetWaveform> outputWaveAssns;
539  for (auto const [ gatePtr, metaPtr ]: outputAssns)
540  outputWaveAssns.addSingle(gatePtr, waveformMetaMatcher(metaPtr));
541 
542  event.put(
543  std::make_unique<art::Assns<OpticalTriggerGateData_t, raw::OpDetWaveform>>
544  (std::move(outputWaveAssns)),
545  outputInstanceName
546  );
547 
548  } // if fProduceWaveformAssns
549 
550  event.put(
551  std::make_unique<std::vector<OpticalTriggerGateData_t>>
552  (std::move(outputGates)),
553  outputInstanceName
554  );
555  event.put(
556  std::make_unique<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
557  (std::move(outputAssns)),
558  outputInstanceName
559  );
560 
561 } // icarus::trigger::LVDSgates::produceThreshold()
std::vector< icarus::trigger::OpticalTriggerGateData_t > transformIntoOpticalTriggerGate(Gates &&gates)
Returns the trigger gates in serializable format.
TrackedTriggerGate_t combineChannels(std::vector< TrackedTriggerGate_t > const &gates, std::vector< raw::Channel_t > const &pairing, ComboMode comboMode) const
Performs the combination of a group of channels.
void checkInput(std::vector< TrackedTriggerGate_t > const &gates) const
Input requirement check. Throws if requirements fail.
static std::vector< TrackedTriggerGate_t > ReadTriggerGates(art::Event const &event, art::InputTag const &dataTag, icarus::trigger::OpDetWaveformMetaDataProductMap_t &waveformMap)
Assembles trigger gates from dataTag data products in event.
Object to facilitate the discovery of the raw::OpDetWaveform a sbn::OpDetWaveformMeta objects comes f...
bool fProduceWaveformAssns
Whether to produce gate/waveform associations.
icarus::trigger::ReadoutTriggerGate< TriggerGateTick_t, TriggerGateTicks_t, raw::Channel_t > OpticalTriggerGateData_t
Type of trigger gate data serialized into art data products.
std::string fLogCategory
Message facility stream category for output.
std::vector< std::vector< raw::Channel_t > > removeChannels(std::vector< std::vector< raw::Channel_t >> channelPairing, std::vector< raw::Channel_t > const &ignoreChannels) const
Removes all the channel in ignoreChannels from channelPairing.
std::vector< std::vector< raw::Channel_t > > fChannelPairing
Pairing of optical detector channels.
ComboMode fComboMode
The operation used to combinate channels.
std::vector< raw::Channel_t > fIgnoreChannels
auto icarus::trigger::LVDSgates::ReadTriggerGates ( art::Event const &  event,
art::InputTag const &  dataTag,
icarus::trigger::OpDetWaveformMetaDataProductMap_t waveformMap 
)
staticprivate

Assembles trigger gates from dataTag data products in event.

Definition at line 841 of file LVDSgates_module.cc.

845  {
847 
848  auto const& assns =
849  event.getProduct<art::Assns<OpticalTriggerGateData_t, sbn::OpDetWaveformMeta>>
850  (dataTag);
851 
852  UpdateWaveformMap(waveformMap, assns);
853 
855  (event.getProduct<std::vector<OpticalTriggerGateData_t>>(dataTag), assns);
856 
857 } // icarus::trigger::LVDSgates::ReadTriggerGates()
icarus::trigger::ReadoutTriggerGate< TriggerGateTick_t, TriggerGateTicks_t, raw::Channel_t > OpticalTriggerGateData_t
Type of trigger gate data serialized into art data products.
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.
static void UpdateWaveformMap(icarus::trigger::OpDetWaveformMetaDataProductMap_t &map, art::Assns< TriggerGateData_t, sbn::OpDetWaveformMeta > const &assns)
Adds the associated waveforms into the map.
std::vector< std::vector< raw::Channel_t > > icarus::trigger::LVDSgates::removeChannels ( std::vector< std::vector< raw::Channel_t >>  channelPairing,
std::vector< raw::Channel_t > const &  ignoreChannels 
) const
private

Removes all the channel in ignoreChannels from channelPairing.

Returns
a copy of channelPairing with no element from ignoreChannels

Channel lists in the returned list may become empty.

Definition at line 593 of file LVDSgates_module.cc.

596  {
597 
598  for (std::vector<raw::Channel_t>& channels: channelPairing) {
599  for (unsigned int j = channels.size(); j-- > 0; ) {
600  std::vector<raw::Channel_t>::const_iterator const it
601  = find(ignoreChannels.begin(), ignoreChannels.end(), channels[j]);
602  if (it != fIgnoreChannels.end()) {
603  channels.erase(channels.begin() + j);
604  }
605  }
606  }
607 
608  return channelPairing;
609 
610 } // icarus::trigger::LVDSgates::removeChannels()
std::vector< raw::Channel_t > fIgnoreChannels
auto icarus::trigger::LVDSgates::selectChannel ( std::vector< TrackedTriggerGate_t > const &  gates,
std::vector< raw::Channel_t > const &  pairing,
std::size_t  chosenIndex 
) const
private

Combination function for the input1 and input2 modes.

Definition at line 626 of file LVDSgates_module.cc.

630  {
631  // requiring that gates are at an index matching their channel number
632  TrackedTriggerGate_t gate { gates[pairing[chosenIndex]] };
633  for (raw::Channel_t channel: pairing) {
634  mf::LogTrace(fLogCategory) << "Input: " << gates[channel].gate();
635  gate.gate().addChannel(channel);
636  }
637  mf::LogTrace(fLogCategory) << "Output: " << gate.gate();
638  for (auto const& srcGate: gates) gate.tracking().add(srcGate.tracking());
639  return gate;
640 } // icarus::trigger::LVDSgates::selectChannel()
std::string fLogCategory
Message facility stream category for output.
icarus::trigger::TrackedOpticalTriggerGate< sbn::OpDetWaveformMeta > TrackedTriggerGate_t
Reconstituted trigger gate type internally used.
void icarus::trigger::LVDSgates::UpdateWaveformMap ( icarus::trigger::OpDetWaveformMetaDataProductMap_t map,
art::Assns< TriggerGateData_t, sbn::OpDetWaveformMeta > const &  assns 
)
staticprivate

Adds the associated waveforms into the map.

Definition at line 829 of file LVDSgates_module.cc.

832  {
833 
834  for (art::Ptr<sbn::OpDetWaveformMeta> const& wave: util::get_elements<1U>(assns))
835  map.emplace(wave.get(), wave);
836 
837 } // icarus::trigger::LVDSgates::UpdateWaveformMap()

Member Data Documentation

std::map<std::string, SourceInfo_t> icarus::trigger::LVDSgates::fADCthresholds
private

ADC thresholds to read, and the input tag connected to their data.

Definition at line 293 of file LVDSgates_module.cc.

std::vector<std::vector<raw::Channel_t> > icarus::trigger::LVDSgates::fChannelPairing
private

Pairing of optical detector channels.

Definition at line 296 of file LVDSgates_module.cc.

ComboMode icarus::trigger::LVDSgates::fComboMode
private

The operation used to combinate channels.

Definition at line 297 of file LVDSgates_module.cc.

std::vector<raw::Channel_t> icarus::trigger::LVDSgates::fIgnoreChannels
private

Definition at line 299 of file LVDSgates_module.cc.

std::string icarus::trigger::LVDSgates::fLogCategory
private

Message facility stream category for output.

Definition at line 304 of file LVDSgates_module.cc.

bool icarus::trigger::LVDSgates::fProduceWaveformAssns
private

Whether to produce gate/waveform associations.

Definition at line 302 of file LVDSgates_module.cc.


The documentation for this class was generated from the following file: