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

Produces plots about trigger simulation and trigger efficiency. More...

Inheritance diagram for icarus::trigger::SlidingWindowTriggerEfficiencyPlots:
icarus::trigger::TriggerEfficiencyPlotsBase

Classes

struct  Config
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 

Public Member Functions

 SlidingWindowTriggerEfficiencyPlots (Parameters const &config)
 
virtual void beginJob () override
 Initializes the plots. More...
 
virtual void analyze (art::Event const &event) override
 Fills the plots. Also extracts the information to fill them with. More...
 
virtual void endJob () override
 Prints end-of-job summaries. More...
 

Private Types

using WindowPatterns_t = icarus::trigger::WindowPatterns_t
 List of configured patterns. More...
 
using TriggerInfo_t = details::TriggerInfo_t
 
using WindowTriggerInfo_t = icarus::trigger::SlidingWindowPatternAlg::AllTriggerInfo_t
 Data structure to communicate internally a trigger response. More...
 
- Private Types inherited from icarus::trigger::TriggerEfficiencyPlotsBase
using microseconds = util::quantities::intervals::microseconds
 
using nanoseconds = util::quantities::intervals::nanoseconds
 
using EventInfo_t = details::EventInfo_t
 
using PMTInfo_t = details::PMTInfo_t
 
using TriggerInfo_t = details::TriggerInfo_t
 
using PlotSandbox = icarus::trigger::PlotSandbox
 Import type. More...
 
using PlotSandboxRefs_t = std::vector< std::reference_wrapper< PlotSandbox const >>
 List of references to plot sandboxes. More...
 
using PlotCategories_t = std::vector< PlotCategory >
 
using InputTriggerGate_t = icarus::trigger::TrackedOpticalTriggerGate< sbn::OpDetWaveformMeta >
 Type of trigger gate extracted from the input event. More...
 
using TriggerGates_t = std::vector< InputTriggerGate_t >
 A list of trigger gates from input. More...
 
using TriggerGatesPerCryostat_t = std::vector< TriggerGates_t >
 Type of lists of gates, one list per cryostat (outer index: cryostat no). More...
 
using ChannelID_t = InputTriggerGate_t::TriggerGate_t::ChannelID_t
 Type representing the unique identifier of a optical detector channel. More...
 

Private Member Functions

virtual void initializePlotSet (PlotSandbox &plots, std::vector< SettingsInfo_t > const &settings) const override
 Initializes full set of plots for (ADC threshold + category). More...
 
virtual void simulateAndPlot (std::size_t const thresholdIndex, TriggerGatesPerCryostat_t const &gates, EventInfo_t const &eventInfo, detinfo::DetectorClocksData const &clockData, PlotSandboxRefs_t const &selectedPlots) override
 Simulates all trigger minimum requirements plots the results. More...
 
void plotResponse (std::size_t iThr, std::string const &threshold, std::size_t iPattern, WindowPattern const &pattern, PlotSandboxRefs_t const &plotSets, EventInfo_t const &eventInfo, PMTInfo_t const &PMTinfo, WindowTriggerInfo_t const &triggerInfo) const
 Fills plots with the specified trigger response. More...
 
void initializePatternAlgorithms ()
 
void fillAllEventPlots (PlotSandboxRefs_t const &plotSets, EventInfo_t const &eventInfo) const
 Fills all event plots with data from eventInfo as in fillEventPlots(). More...
 
void fillAllPMTplots (PlotSandboxRefs_t const &plotSets, PMTInfo_t const &PMTinfo) const
 Fills all PMY plots with data from PMTinfo as in fillPMTplots(). More...
 
SlidingWindowTriggerEfficiencyPlots
const & 
helper () const
 Access to the helper. More...
 
SlidingWindowTriggerEfficiencyPlotshelper ()
 
- Private Member Functions inherited from icarus::trigger::TriggerEfficiencyPlotsBase
 TriggerEfficiencyPlotsBase (Config const &config, art::ConsumesCollector &consumer)
 Constructor; requires a configuration and module's consumesCollector(). More...
 
void process (art::Event const &event)
 Fills the plots. Also extracts the information to fill them with. More...
 
void printSummary () const
 Prints end-of-job summaries. More...
 
std::string const & logCategory () const
 Returns the name of the log category. More...
 
TTree * eventTree ()
 Returns a pointer to the tree where event information is written. More...
 
bool useGen () const
 Returns whether we are using and filling generator information. More...
 
bool useEDep () const
 Returns whether we are using and filling energy deposition information. More...
 
std::size_t nADCthresholds () const
 Returns the number of configured PMT thresholds. More...
 
auto ADCthresholds () const
 Returns a iterable sequence of all configured PMT thresholds. More...
 
std::string const & ADCthresholdTag (std::size_t iThr) const
 
geo::GeometryCore const & geometry () const
 Returns the detector geometry service provider. More...
 
nanoseconds triggerTimeResolution () const
 Returns the resolution of trigger timing clock [ns]. More...
 
virtual void initializePlots (PlotCategories_t categories, std::vector< SettingsInfo_t > const &settings)
 Initializes all the plot sets, one per PMT threshold. More...
 
void initializePlots (std::vector< SettingsInfo_t > const &settings)
 Initializes sets of default plots, one per PMT threshold. More...
 
virtual void initializeEfficiencyPerTriggerPlots (PlotSandbox &plots) const
 Initializes set of plots per complete trigger definition into plots. More...
 
virtual void initializeEventPlots (PlotSandbox &plots) const
 Initializes a single, trigger-independent plot set into plots. More...
 
virtual void initializePMTplots (PlotSandbox &plots) const
 
virtual bool shouldPlotEvent (EventInfo_t const &eventInfo) const
 
virtual void fillEventPlots (EventInfo_t const &eventInfo, PlotSandbox const &plots) const
 Fills the plots (initializeEventPlots()) with info from eventInfo. More...
 
virtual void fillPMTplots (PMTInfo_t const &PMTinfo, PlotSandbox const &plots) const
 Fill the plots (initializePMTplots()) with info from PMTinfo. More...
 
virtual void fillEfficiencyPlots (EventInfo_t const &eventInfo, TriggerInfo_t const &triggerInfo, PlotSandbox const &plots) const
 
virtual void fillAllEfficiencyPlots (EventInfo_t const &eventInfo, PMTInfo_t const &PMTinfo, TriggerInfo_t const &triggerInfo, PlotSandbox const &plots) const
 
void deleteEmptyPlots ()
 Deletes plots with no entries, and directories which became empty. More...
 
std::size_t createCountersForPattern (std::string const &patternName)
 Creates counters for all the thresholds of the specified trigger. More...
 
GatePack_t makeGatePack (art::Event const *event=nullptr) const
 Creates a GatePack_t from the specified event. More...
 
void registerTriggerResult (std::size_t threshold, std::size_t pattern, bool fired)
 Registers the outcome of the specified trigger. More...
 
void registerTriggerResult (std::size_t threshold, std::size_t pattern, TriggerInfo_t const &triggerInfo)
 
icarus::trigger::ApplyBeamGateClass makeMyBeamGate (detinfo::DetectorClocksData const &clockData) const
 Shortcut to create an ApplyBeamGate with the current configuration. More...
 
icarus::trigger::ApplyBeamGateClass makeMyBeamGate (art::Event const *event=nullptr) const
 
icarus::trigger::ApplyBeamGateClass makeMyBeamGate (art::Event const &event) const
 

Private Attributes

WindowPatterns_t const fPatterns
 Configured sliding window requirement patterns. More...
 
icarus::trigger::WindowTopologyManager fWindowMapMan
 Mapping of each sliding window with location and topological information. More...
 
std::vector
< icarus::trigger::SlidingWindowPatternAlg
fPatternAlgs
 All algorithm instances, one per pattern. More...
 
std::unique_ptr< ResponseTreefResponseTree
 Handler of ROOT tree output. More...
 

Additional Inherited Members

- Static Private Member Functions inherited from icarus::trigger::TriggerEfficiencyPlotsBase
static std::vector< ChannelID_textractActiveChannels (TriggerGatesPerCryostat_t const &cryoGates)
 Returns all channels contributing to the trigger gates. More...
 
- Static Private Attributes inherited from icarus::trigger::TriggerEfficiencyPlotsBase
static PlotCategories_t const DefaultPlotCategories
 List of event categories. More...
 

Detailed Description

Produces plots about trigger simulation and trigger efficiency.

This module is an implementation of TriggerEfficiencyPlotsBase for a trigger defined as a pattern of sliding windows.

Note that the multi-level logical waveforms from the sliding windows are expected to be provided as input.

The single sliding window with the highest activity is picked as a reference. A requirement on the number of trigger primitives "on" in that window is imposed. Additional requirements may be imposed on three other sliding windows: the upstream one (if any), the downstream one (if any) and the opposite one in the same cryostat.

As usual for TriggerEfficiencyPlotsBase based modules, this happens for every configured PMT discrimination threshold.

Trigger logic algorithm

This section describes the trigger logic algorithm used in icarus::trigger::SlidingWindowTriggerEfficiencyPlots and its assumptions.

The module receives as input a multi-level trigger gate for each of the windows to be considered. On the first input (i.e. the first event), that input is parsed to learn the windows and their relative position from the input trigger gates (initializeTopologicalMaps()). This topology will be used to apply the configured patterns. On the following events, their input is checked to confirm the compatibility of the composition of its windows with the one from that first event (verifyTopologicalMap()).

All multi-level gates are set in coincidence with the beam gate by multiplying the multi-level and the beam gates. Beacuse of this, trigger gates are suppressed everywhere except than during the beam gate. The beam gate opens at a time configured in DetectorClocks service provider (detinfo::DetectorClocks::BeamGateTime()) and has a duration configured in this module (BeamGateDuration).

The algorithm handles independently multiple trigger patterns. On each input, each configured pattern is applied based on the window topology. Each pattern describes a minimum level of the trigger gate in the window, that usually means the number of LVDS signals in coincidence at any given time ("majority"). A pattern may have requirements on the neighbouring windows in addition to the main one. The pattern is satisfied if all involved windows pass their specific requirements at the same time (coincidence between windows). Each pattern is applied in turn to each of the windows (which is the "main" window). The neighborhood described in the pattern is applied with respect to that main window. The method applyWindowPattern() performs this combination. The trigger fires if one or more of the windows satisfy the pattern, and the trigger time is the one of the earliest satisfied pattern (more precisely, the earliest tick when the coincidence required by that pattern is satisfied).

All windows in the detector are considered independently, but the supported patterns may only include components in the same cryostat. Therefore, triggers are effectively on a single cryostat.

Eventually, for each event there are as many different trigger responses as how many different patterns are configured (Patterns configuration parameter), times how many ADC thresholds are provided in input, configured in Thresholds.

While there is a parameter describing the time resolution of the trigger (TriggerTimeResolution), this is currently only used for aesthetic purposes to choose the binning of some plots: the resolution is not superimposed to the gates (yet).

The set of plots and their organization are described in the documentation of icarus::trigger::TriggerEfficiencyPlotsBase. In the following documentation only the additions are described.

Output plots

A generic "setting" of icarus::trigger::TriggerEfficiencyPlotsBase is in this module represented by a tag encoding the characteristics of the pattern (see WindowPattern::tag()). The folders and plots will identify each requirement with tags like M8 or M5O2.

There are different "types" of plots. Some do not depend on triggering at all, like the deposited energy distribution. Others cross different trigger definitions, like the trigger efficiency as function of trigger requirement. Others still assume a single trigger definition: this is the case of trigger efficiency plots versus energy. Finally, there are plots that depend on a specific trigger definition and outcome: this is the case of all the plots including only triggering or non-triggering events.

There are a few plots that are produced by this module in addition to the ones in TriggerEfficiencyPlotsBase. They are described below.

All the plots are always relative to a specific optical detector channel threshold (ADC) and a broad event category.

Plots independent of the triggers (selection plots)

Only the standard plots from TriggerEfficiencyPlotsBase are produced in this category.

Plots including different trigger requirements

In addition to the plots from TriggerEfficiencyPlotsBase, the following plots are also produced:

Plots depending on a specific trigger definition

Only the standard plots from TriggerEfficiencyPlotsBase are produced in this category.

Plots depending on a specific trigger definition and response

Only the standard plots from TriggerEfficiencyPlotsBase are produced in this category.

Configuration parameters

In addition to all the configuration parameters from TriggerEfficiencyPlotsBase, the following one is also present:

An example job configuration is provided as makeslidingwindowtriggerplots_icarus.fcl.

Technical description of the module

This module class is derived from icarus::trigger::TriggerEfficiencyPlotsBase, which provides a backbone to perform the simulation of triggers and plotting of their efficiency.

There is no superior design involved in this separation, but rather the goal to share most code possible between different modules which simulate different trigger patterns and as a consequence might have specific plots to fill.

This module redefines:

It does not redefine initializeEfficiencyPerTriggerPlots() nor initializeEventPlots() because there are no additional plots of the types these functions deal with.

The event categories are from the default list (DefaultPlotCategories) too.

Definition at line 332 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

Member Typedef Documentation

List of configured patterns.

Definition at line 380 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

Data structure to communicate internally a trigger response.

Definition at line 386 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

Constructor & Destructor Documentation

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

Definition at line 552 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

553  : art::EDAnalyzer (config)
555  // configuration
556  , fPatterns(config().Patterns())
557  // internal variables
558  , fWindowMapMan{
559  helper().geometry(),
560  helper().logCategory() + "_WindowMapManager"
561  }
562 {
563 
564  if (fPatterns.empty()) {
565  throw art::Exception(art::errors::Configuration)
566  << "At least one 'MinimumPrimitives' requirement... required.";
567  }
568 
569  std::size_t iPattern [[maybe_unused]] = 0U; // NOTE: incremented only in DEBUG
570  for (auto const& pattern: fPatterns) {
571  std::size_t const index [[maybe_unused]]
573  assert(index == iPattern++);
574 
575  } // for patterns
576 
577  //
578  // more complex parameter parsing
579  //
580  if (helper().eventTree()) {
581 
582  fResponseTree = std::make_unique<ResponseTree>
584 
585  } // if make tree
586 
587  {
588  mf::LogInfo log(helper().logCategory());
589 
590  log
591  << "Requirement of sliding window patterns ("
592  << fPatterns.size() << "):";
593  for (auto const& pattern: fPatterns)
594  log << "\n [" << pattern.tag() << "] " << pattern.description();
595 
596  }
597 
598 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::SlidingWindowTriggerEfficiencyPlots()
TriggerEfficiencyPlotsBase(Config const &config, art::ConsumesCollector &consumer)
Constructor; requires a configuration and module&#39;s consumesCollector().
std::string const & logCategory() const
Returns the name of the log category.
TTree * eventTree()
Returns a pointer to the tree where event information is written.
icarus::trigger::WindowTopologyManager fWindowMapMan
Mapping of each sliding window with location and topological information.
WindowPatterns_t const fPatterns
Configured sliding window requirement patterns.
auto ADCthresholds() const
Returns a iterable sequence of all configured PMT thresholds.
geo::GeometryCore const & geometry() const
Returns the detector geometry service provider.
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
std::size_t createCountersForPattern(std::string const &patternName)
Creates counters for all the thresholds of the specified trigger.
std::unique_ptr< ResponseTree > fResponseTree
Handler of ROOT tree output.
fDetProps &fDetProps fDetProps &fDetProps consumesCollector())

Member Function Documentation

void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::analyze ( art::Event const &  event)
overridevirtual

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

Definition at line 626 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

627 {
628 
629  // hook helper and framework;
630  // actual action is in the (overridden) virtual function `plotResponse()`
631  // and `fillXxxPlots()`.
632  helper().process(event);
633 
634 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::analyze()
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
void process(art::Event const &event)
Fills the plots. Also extracts the information to fill them with.
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::beginJob ( )
overridevirtual

Initializes the plots.

Definition at line 602 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

602  {
603 
604  // hook helper and framework;
605  // actual action is in the (overridden) virtual functions `initializeXxx()`.
606 
607  // NOTE this action can't happen in constructor because relies on polymorphism
608  std::vector<SettingsInfo_t> settings;
609  for (auto const& [ iPattern, pattern ]: util::enumerate(fPatterns)) {
610  settings.emplace_back(
611  iPattern, // index
612  pattern.tag(), // tag
613  pattern.description() // description
614  );
615  } // for
616 
617  // we use the default plot categories defined in
618  // `TriggerEfficiencyPlotsBase::DefaultPlotCategories`
619  helper().initializePlots(settings);
620 
621 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::beginJob()
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
WindowPatterns_t const fPatterns
Configured sliding window requirement patterns.
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
virtual void initializePlots(PlotCategories_t categories, std::vector< SettingsInfo_t > const &settings)
Initializes all the plot sets, one per PMT threshold.
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::endJob ( )
overridevirtual

Prints end-of-job summaries.

Definition at line 638 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

638  {
639 
640  helper().deleteEmptyPlots(); // don't keep plots with no entries
641 
642  // hook helper and framework
643  helper().printSummary();
644 
645 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::endJob()
void printSummary() const
Prints end-of-job summaries.
void deleteEmptyPlots()
Deletes plots with no entries, and directories which became empty.
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fillAllEventPlots ( PlotSandboxRefs_t const &  plotSets,
EventInfo_t const &  eventInfo 
) const
private

Fills all event plots with data from eventInfo as in fillEventPlots().

Definition at line 830 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

831 {
832  /*
833  * Now fill the plots independent of the trigger response:
834  * the same value is plotted in all plot sets.
835  * (again for all pertinent event categories, e.g. charged currents, etc.)
836  */
837  for (PlotSandbox const& plotSet: plotSets) {
838 
839  //
840  // general plots, independent of trigger definition details
841  //
842  fillEventPlots(eventInfo, plotSet);
843 
844  } // for
845 
846 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fillAllEventPlots()
virtual void fillEventPlots(EventInfo_t const &eventInfo, PlotSandbox const &plots) const
Fills the plots (initializeEventPlots()) with info from eventInfo.
icarus::trigger::PlotSandbox PlotSandbox
Import type.
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fillAllPMTplots ( PlotSandboxRefs_t const &  plotSets,
PMTInfo_t const &  PMTinfo 
) const
private

Fills all PMY plots with data from PMTinfo as in fillPMTplots().

Definition at line 852 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

853 {
854  /*
855  * Now fill the plots independent of the trigger response:
856  * the same value is plotted in all plot sets.
857  * (again for all pertinent event categories, e.g. charged currents, etc.)
858  */
859  for (PlotSandbox const& plotSet: plotSets) {
860 
861  //
862  // general plots, independent of trigger definition but dependent on
863  // threshold
864  //
865  fillPMTplots(PMTinfo, plotSet);
866 
867  } // for
868 
869 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fillAllPMTplots()
virtual void fillPMTplots(PMTInfo_t const &PMTinfo, PlotSandbox const &plots) const
Fill the plots (initializePMTplots()) with info from PMTinfo.
icarus::trigger::PlotSandbox PlotSandbox
Import type.
SlidingWindowTriggerEfficiencyPlots const& icarus::trigger::SlidingWindowTriggerEfficiencyPlots::helper ( ) const
inlineprivate

Access to the helper.

Definition at line 412 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

412 { return *this; }
SlidingWindowTriggerEfficiencyPlots& icarus::trigger::SlidingWindowTriggerEfficiencyPlots::helper ( )
inlineprivate

Definition at line 413 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

413 { return *this; }
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::initializePatternAlgorithms ( )
private

Constructs all the pattern algorithms. Must be called after setting the window topology.

Definition at line 820 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

821 {
822  fPatternAlgs.clear();
823  for (auto const& pattern: fPatterns)
824  fPatternAlgs.emplace_back(*fWindowMapMan, pattern, helper().logCategory());
825 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::initializePatternAlgorithms()
std::string const & logCategory() const
Returns the name of the log category.
std::vector< icarus::trigger::SlidingWindowPatternAlg > fPatternAlgs
All algorithm instances, one per pattern.
icarus::trigger::WindowTopologyManager fWindowMapMan
Mapping of each sliding window with location and topological information.
WindowPatterns_t const fPatterns
Configured sliding window requirement patterns.
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::initializePlotSet ( PlotSandbox plots,
std::vector< SettingsInfo_t > const &  settings 
) const
overrideprivatevirtual

Initializes full set of plots for (ADC threshold + category).

This customization of TriggerEfficiencyPlotsBase::initializePlotSet() adds some trigger-definition specific plots and some overview plots across different trigger definitions.

Reimplemented from icarus::trigger::TriggerEfficiencyPlotsBase.

Definition at line 650 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

651 {
652 
653  //
654  // Selection-related plots
655  //
656 
657  // (inherited)
658  helper().TriggerEfficiencyPlotsBase::initializePlotSet(plots, settings);
659 
660  //
661  // overview plots with different settings
662  //
663 
664  std::vector<std::string> patternLabels; // each pattern has tag as label
666  fPatterns.cbegin(), fPatterns.cend(), back_inserter(patternLabels),
667  std::mem_fn(&WindowPattern::tag)
668  );
669 
670  //
671  // Triggering efficiency vs. requirements.
672  //
673  auto const [ detTimings, beamGate, preSpillWindow ] = makeGatePack();
674  detinfo::timescales::optical_time_ticks const triggerResolutionTicks
675  { detTimings.toOpticalTicks(helper().triggerTimeResolution()) };
676 
677  auto const& beamGateOpt = beamGate.asOptTickRange();
678 
679  auto* TrigTime = plots.make<TH2F>(
680  "TriggerTick",
681  "Trigger time tick"
682  ";window pattern"
683  ";optical time tick [ /" + util::to_string(triggerResolutionTicks) + " ]",
684  fPatterns.size(), 0.0, double(fPatterns.size()),
685  beamGateOpt.duration() / triggerResolutionTicks,
686  beamGateOpt.first.value(), beamGateOpt.second.value()
687  );
688 
689  util::ROOT::applyAxisLabels(TrigTime->GetXaxis(), patternLabels);
690 
691  auto* Triggers = plots.make<TH1F>(
692  "Triggers",
693  "Triggered events"
694  ";window pattern"
695  ";triggered events",
696  fPatterns.size(), 0.0, double(fPatterns.size())
697  );
698 
699  util::ROOT::applyAxisLabels(Triggers->GetXaxis(), patternLabels);
700 
701  auto* Eff = plots.make<TEfficiency>(
702  "Eff",
703  "Efficiency of triggering"
704  ";window pattern"
705  ";trigger efficiency",
706  fPatterns.size(), 0.0, double(fPatterns.size())
707 // fMinimumPrimitives.back(), 0, fMinimumPrimitives.back() + 1
708  );
709 
710  // people are said to have earned hell for things like this;
711  // but TEfficiency really does not expose the interface to assign labels to
712  // its axes, which supposedly could be done had we chosen to create it by
713  // histograms instead of directly as recommended.
714  // Also need to guess which is the relevant histogram.
716  (const_cast<TH1*>(Eff->GetTotalHistogram())->GetXaxis(), patternLabels);
718  (const_cast<TH1*>(Eff->GetPassedHistogram())->GetXaxis(), patternLabels);
719 
720 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::initializePlotSet()
static constexpr Sample_t transform(Sample_t sample)
void applyAxisLabels(TAxis *pAxis, std::vector< std::string > const &labels, int first=1)
Sets all the labels starting with the bin first (1 by default).
Definition: ROOTutils.h:175
timescale_traits< OpticalTimeCategory >::tick_interval_t optical_time_ticks
nanoseconds triggerTimeResolution() const
Returns the resolution of trigger timing clock [ns].
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
WindowPatterns_t const fPatterns
Configured sliding window requirement patterns.
std::vector< PlotDef > plots
Definition: demo.h:54
GatePack_t makeGatePack(art::Event const *event=nullptr) const
Creates a GatePack_t from the specified event.
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
std::string tag() const
Returns a tag summarizing the pattern.
fDetProps &fDetProps fDetProps &fDetProps detTimings
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::plotResponse ( std::size_t  iThr,
std::string const &  threshold,
std::size_t  iPattern,
WindowPattern const &  pattern,
PlotSandboxRefs_t const &  plotSets,
EventInfo_t const &  eventInfo,
PMTInfo_t const &  PMTinfo,
WindowTriggerInfo_t const &  triggerInfo 
) const
private

Fills plots with the specified trigger response.

Parameters
iThrindex of PMT threshold (used in tree output)
thresholdPMT threshold tag (for printing)
iPatternindex of the pattern being plotted
patternthe pattern being plotted
plotSetsset of plot boxes to fill (from initializePlotSet())
eventInfoevent information for plotting
triggerInfothe information about the response of this trigger

This method fills all the relevant plots for the specified trigger pattern and threshold. The trigger response is passed as a parameter.

Definition at line 872 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

879  {
880 
881  using namespace std::string_literals;
882 
883  bool const fired = triggerInfo.info.fired();
884 
885  if (fResponseTree) fResponseTree->assignResponse(iThr, iPattern, fired);
886 
887 
888  std::string const patternTag { pattern.tag() };
889 
890  // go through all the plot categories this event qualifies for
891  // (for example: charged currents, muon neutrinos, ...)
892  for (icarus::trigger::PlotSandbox const& plotSet: plotSets) {
893 
894  //
895  // overview plots from different thresholds
896  //
897 
898  HistGetter const get { plotSet };
899 
900  // simple efficiency
901  get.Eff("Eff"s).Fill(fired, iPattern);
902 
903  // simple count
904  if (fired) get.Hist("Triggers"s).Fill(iPattern);
905 
906  // trigger time (if any)
907  if (fired) {
908  get.Hist2D("TriggerTick"s).Fill
909  (iPattern, triggerInfo.info.atTick().value());
910  }
911 
912  //
913  // plots depending on the trigger response
914  // (but not caring of the trigger definition details)
915  //
916 
917  // efficiency plots
918  // (including event plots in the triggered or non-triggered category)
920  (eventInfo, PMTinfo, triggerInfo.info, plotSet.demandSandbox(patternTag));
921 
922  //
923  // add here further trigger-specific plots
924  //
925 
926  } // for all qualifying plot categories
927 
928 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::plotResponse()
virtual void fillAllEfficiencyPlots(EventInfo_t const &eventInfo, PMTInfo_t const &PMTinfo, TriggerInfo_t const &triggerInfo, PlotSandbox const &plots) const
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
std::unique_ptr< ResponseTree > fResponseTree
Handler of ROOT tree output.
A helper to manage ROOT objects with consistent naming.
Definition: PlotSandbox.h:95
void icarus::trigger::SlidingWindowTriggerEfficiencyPlots::simulateAndPlot ( std::size_t const  thresholdIndex,
TriggerGatesPerCryostat_t const &  gates,
EventInfo_t const &  eventInfo,
detinfo::DetectorClocksData const &  clockData,
PlotSandboxRefs_t const &  selectedPlots 
)
overrideprivatevirtual

Simulates all trigger minimum requirements plots the results.

Parameters
thresholdIndexthe index of the PMT threshold of input primitives
gatesthe trigger primitives used to simulate the trigger response
eventInfogeneral information about the event being simulated
selectedPlotslist of boxes containing plots to be filled

This method is expected to perform the following steps for each trigger primitive requirement in MinimumPrimitives:

  1. combine the trigger primitives: combineTriggerPrimitives();
  2. apply the beam gate: applyBeamGateToAll() on the combined primitives;
  3. generate the trigger response: in plotResponse();
  4. fill all plots: also in in plotResponse().

Details are in the documentation of the relevant methods.

This method is invoked once per PMT threshold.

Implements icarus::trigger::TriggerEfficiencyPlotsBase.

Definition at line 724 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

730  {
731 
732  auto const threshold = helper().ADCthresholdTag(thresholdIndex);
733 
734  /*
735  * 0. initialize or verify the topology of the input
736  * 1. apply the beam gate to each input gate
737  * 2. for each pattern: apply the pattern, plot the trigger outcome
738  * 3. fill all trigger-independent plots
739  * 4. fill all PMT plots (threshold-dependent)
740  */
741 
742  //
743  // 0. initialize or verify the topology of the input
744  //
745 
746  // throws exception on verification failure;
747  // pattern algorithms are constructed here because they require window mapping
749 
750 
751  auto const& beamGate = helper().makeMyBeamGate(clockData);
752 
753  //
754  // 1. apply the beam gate to each input gate
755  // (it's ok to lose provenance information since we have the map)
756  //
757  TriggerGates_t inBeamGates;
758  for (auto const& cryoGates: gates)
759  appendCollection(inBeamGates, beamGate.applyToAll(cryoGates));
760 
761  // --- BEGIN DEBUG -----------------------------------------------------------
762  {
763  mf::LogTrace log(helper().logCategory());
764  log << "Input for threshold " << threshold << ": " << inBeamGates.size()
765  << " primitives. After beam gate:";
766  unsigned int nOpen = 0U;
768  for (auto const& [ iWindow, gate ]: util::enumerate(gatesIn(inBeamGates))) {
769  auto const maxTick = gate.findMaxOpen();
770  if (maxTick == gate.MinTick) continue;
771  ++nOpen;
772  log << "\n window #" << iWindow << ": maximum "
773  << gate.openingCount(maxTick) << " at tick " << maxTick;
774  } // for
775  if (!nOpen) log << " nothing.";
776  }
777  // --- END DEBUG -------------------------------------------------------------
778 
779  // get which gates are active during the beam gate
780  PMTInfo_t const PMTinfo
781  { threshold, helper().extractActiveChannels(gates) };
782 
783  //
784  // 2. for each pattern:
785  //
786  for (auto const& [ iPattern, pattern ]: util::enumerate(fPatterns)) {
787 
788  auto& patternAlg = fPatternAlgs[iPattern];
789 
790  WindowTriggerInfo_t const triggerInfo
791  = patternAlg.simulateResponse(inBeamGates);
792 
793  registerTriggerResult(thresholdIndex, iPattern, triggerInfo.info);
794 
795  plotResponse(
796  thresholdIndex, threshold,
797  iPattern, pattern,
798  selectedPlots,
799  eventInfo, PMTinfo, triggerInfo
800  );
801 
802  } // for window patterns
803 
804  //
805  // 3. fill all trigger-independent plots (one copy per threshold... meh)
806  //
807  fillAllEventPlots(selectedPlots, eventInfo);
808 
809  //
810  // 4. fill all PMT plots (threshold-dependent)
811  //
812  fillAllPMTplots(selectedPlots, PMTinfo);
813 
814 } // icarus::trigger::SlidingWindowTriggerEfficiencyPlots::simulateAndPlot()
std::string const & ADCthresholdTag(std::size_t iThr) const
void plotResponse(std::size_t iThr, std::string const &threshold, std::size_t iPattern, WindowPattern const &pattern, PlotSandboxRefs_t const &plotSets, EventInfo_t const &eventInfo, PMTInfo_t const &PMTinfo, WindowTriggerInfo_t const &triggerInfo) const
Fills plots with the specified trigger response.
std::string const & logCategory() const
Returns the name of the log category.
auto gatesIn(TrackingGateColl &trackingGates)
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
std::vector< icarus::trigger::SlidingWindowPatternAlg > fPatternAlgs
All algorithm instances, one per pattern.
icarus::trigger::ApplyBeamGateClass makeMyBeamGate(detinfo::DetectorClocksData const &clockData) const
Shortcut to create an ApplyBeamGate with the current configuration.
void fillAllEventPlots(PlotSandboxRefs_t const &plotSets, EventInfo_t const &eventInfo) const
Fills all event plots with data from eventInfo as in fillEventPlots().
icarus::trigger::WindowTopologyManager fWindowMapMan
Mapping of each sliding window with location and topological information.
WindowPatterns_t const fPatterns
Configured sliding window requirement patterns.
static std::vector< ChannelID_t > extractActiveChannels(TriggerGatesPerCryostat_t const &cryoGates)
Returns all channels contributing to the trigger gates.
SlidingWindowTriggerEfficiencyPlots const & helper() const
Access to the helper.
icarus::trigger::SlidingWindowPatternAlg::AllTriggerInfo_t WindowTriggerInfo_t
Data structure to communicate internally a trigger response.
void registerTriggerResult(std::size_t threshold, std::size_t pattern, bool fired)
Registers the outcome of the specified trigger.
void fillAllPMTplots(PlotSandboxRefs_t const &plotSets, PMTInfo_t const &PMTinfo) const
Fills all PMY plots with data from PMTinfo as in fillPMTplots().
std::vector< InputTriggerGate_t > TriggerGates_t
A list of trigger gates from input.

Member Data Documentation

std::vector<icarus::trigger::SlidingWindowPatternAlg> icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fPatternAlgs
private

All algorithm instances, one per pattern.

Definition at line 403 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

WindowPatterns_t const icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fPatterns
private

Configured sliding window requirement patterns.

Definition at line 391 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

std::unique_ptr<ResponseTree> icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fResponseTree
private

Handler of ROOT tree output.

Definition at line 405 of file SlidingWindowTriggerEfficiencyPlots_module.cc.

icarus::trigger::WindowTopologyManager icarus::trigger::SlidingWindowTriggerEfficiencyPlots::fWindowMapMan
mutableprivate

Mapping of each sliding window with location and topological information.

Definition at line 400 of file SlidingWindowTriggerEfficiencyPlots_module.cc.


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