Produces plots about trigger simulation and trigger efficiency. More...
Classes | |
struct | Config |
Public Types | |
using | Parameters = art::EDAnalyzer::Table< Config > |
Public Member Functions | |
MajorityTriggerEfficiencyPlots (Parameters const &config) | |
MajorityTriggerEfficiencyPlots (MajorityTriggerEfficiencyPlots const &)=delete | |
MajorityTriggerEfficiencyPlots (MajorityTriggerEfficiencyPlots &&)=delete | |
MajorityTriggerEfficiencyPlots & | operator= (MajorityTriggerEfficiencyPlots const &)=delete |
MajorityTriggerEfficiencyPlots & | operator= (MajorityTriggerEfficiencyPlots &&)=delete |
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 | WorkingTriggerGate_t = InputTriggerGate_t |
Type of gate data used for internal processing. 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 | plotResponses (std::size_t iThr, std::string const &threshold, PlotSandboxRefs_t const &plotSets, EventInfo_t const &eventInfo, detinfo::DetectorClocksData const &clockData, std::vector< WorkingTriggerGate_t > const &combinedCounts, std::vector< ChannelID_t > const &channelList) |
Completes the event trigger simulation and fills the plots. More... | |
std::vector< WorkingTriggerGate_t > | combineTriggerPrimitives (TriggerGatesPerCryostat_t const &cryoGates, std::string const &threshold) const |
Computes the trigger response from primitives with the given threshold . More... | |
MajorityTriggerEfficiencyPlots const & | helper () const |
Access to the helper. More... | |
MajorityTriggerEfficiencyPlots & | helper () |
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 | |
std::vector< unsigned int > | fMinimumPrimitives |
Minimum number of trigger primitives for a trigger to happen. More... | |
std::unique_ptr< ResponseTree > | fResponseTree |
Handler of ROOT tree output. More... | |
Additional Inherited Members | |
Static Private Member Functions inherited from icarus::trigger::TriggerEfficiencyPlotsBase | |
static std::vector< ChannelID_t > | extractActiveChannels (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... | |
Produces plots about trigger simulation and trigger efficiency.
This module is an implementation of TriggerEfficiencyPlotsBase
for a trigger defined as a minimum number of trigger primitives beyond threshold.
A trigger primitive is a two-level function of time which describes when that primitive is on and when it is off. Trigger primitives are given as input to this module and their origin may vary, but the standard source in ICARUS is the pairing with AND or OR of two optical detector channels discriminated against a certain ADC count threshold.
This section describes the trigger logic algorithm used in icarus::trigger::MajorityTriggerEfficiencyPlots
and its assumptions.
The algorithm keeps the trigger primitives from the different cryostats separate for the most time. Within each cryostat, all trigger primitives are treated equally, whether they originate from one or from two channels (or 10 or 30), and wherever their channels are in the cryostat. The trigger primitives in each cryostat are combined in a multi-level gate by adding them, so that the level of the resulting gate matches at any time how many trigger primitives are on at that time. Finally, the maximum number of trigger primitives open in any of the cryostats at each time is the level to be compared to the trigger requirements.
This multi-level gate is set in coincidence with the beam gate by multiplying the multi-level and the beam gates. The beam gate opens at a time configured in DetectorClocks
service provider (detinfo::DetectorClocks::BeamGateTime()
) and has a duration configured in this module (BeamGateDuration
).
At this point, the trigger gate is a multi-level gate suppressed everywhere except than during the beam gate. The algorithm handles multiple trigger primitive requirements. Each requirement is simply how many trigger primitives must be open at the same time in a single cryostat for the trigger to fire. The values of these requirements are set in the configuration (MinimumPrimitives
). To determine whether a trigger with a given requirement, i.e. with a required minimum number of trigger primitives open at the same time, has fired, the gate combined as described above is scanned to find the first tick where the level of the gate reaches or passes this minimum required number. If such tick exists, the trigger is considered to have fired, and at that time.
As a consequence, there are for each event as many different trigger responses as how many different requirements are configured in MinimumPrimitives
, 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 combination algorithm is implemented in combineTriggerPrimitives()
while the requirement evaluation and plotting are implemented in plotResponses()
.
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.
A generic "setting" of icarus::trigger::TriggerEfficiencyPlotsBase
is in this module represented by the single trigger primitive requirement N (configuration parameter: MinimumPrimitives
). The folders and plots will identify each requirement with the tag ReqN
(e.g. Req5
when requesting at least 5 trigger primitives for an event trigger).
There are a few plots that are produced by this module in addition to the ones in TriggerEfficiencyPlotsBase
.
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.
A list of additional plots follows for each plot type. All the plots are always relative to a specific optical detector channel threshold (ADC) and a broad event category.
Only the standard plots from TriggerEfficiencyPlotsBase
are produced in this category.
In addition to the plots from TriggerEfficiencyPlotsBase
, the following plots are also produced:
Eff
: trigger efficiency defined as number of triggered events over the total number of events, as function of the minimum number of trigger primitives (MinimumPrimitives
) to define a firing trigger; uncertainties are managed by TEfficiency
.TriggerTick
: distribution of the time of the earliest trigger for the event, as function of the minimum number of trigger primitives (as in Eff
). It may happen that the event is such that there is e.g. a 20-primitive flash, then subsiding, and then another 30-primitive flash. In such a case, in the trigger requirement "≥ 15 primitives" such event will show at the time of the 20-primitive flash, while in the trigger requirement "≥ 25 primitives" it will show at the time of the 30-primitive flash. Each event appears at most once for each trigger requirement, and it may not appear at all if does not fire a trigger.NPrimitives
: the maximum number of primitives "on" at any time. Only the standard plots from TriggerEfficiencyPlotsBase
are produced in this category.
Only the standard plots from TriggerEfficiencyPlotsBase
are produced in this category.
In addition to all the configuration parameters from TriggerEfficiencyPlotsBase
, the following one is also present:
MinimumPrimitives
(list of integers, mandatory): a list of alternative requirements for the definition of a trigger; each value is the number of trigger primitives needed to be "on" at the same time for the trigger to fire;An example job configuration is provided as maketriggerplots_icarus.fcl
.
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 not any superior design involved in this separation, but just the desire 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:
initializePlotSet()
to define the few additional plots needed;simulateAndPlot()
, which must always be defined, and which connects the simulation pieces and the plotting.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 278 of file MajorityTriggerEfficiencyPlots_module.cc.
using icarus::trigger::MajorityTriggerEfficiencyPlots::Parameters = art::EDAnalyzer::Table<Config> |
Definition at line 298 of file MajorityTriggerEfficiencyPlots_module.cc.
|
private |
Type of gate data used for internal processing.
Definition at line 331 of file MajorityTriggerEfficiencyPlots_module.cc.
|
explicit |
Definition at line 506 of file MajorityTriggerEfficiencyPlots_module.cc.
|
delete |
|
delete |
|
overridevirtual |
Fills the plots. Also extracts the information to fill them with.
Definition at line 574 of file MajorityTriggerEfficiencyPlots_module.cc.
|
overridevirtual |
Initializes the plots.
Definition at line 549 of file MajorityTriggerEfficiencyPlots_module.cc.
|
private |
Computes the trigger response from primitives with the given threshold
.
cryoGates | collections of trigger primitives, one coll. per cryostat |
threshold | PMT threshold of the primitives (for printing purposes) |
The input trigger primitives are already grouped by cryostat. For each cryostat, the primitives are combined and one combination is returned. The combination is just the "total" of the primitives opened at each tick.
The event trigger is not finalized here, and the cryostat trigger primitives are all returned.
Definition at line 902 of file MajorityTriggerEfficiencyPlots_module.cc.
|
overridevirtual |
Prints end-of-job summaries.
Definition at line 586 of file MajorityTriggerEfficiencyPlots_module.cc.
|
inlineprivate |
Access to the helper.
Definition at line 351 of file MajorityTriggerEfficiencyPlots_module.cc.
|
inlineprivate |
Definition at line 352 of file MajorityTriggerEfficiencyPlots_module.cc.
|
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 596 of file MajorityTriggerEfficiencyPlots_module.cc.
|
delete |
|
delete |
|
private |
Completes the event trigger simulation and fills the plots.
iThr | index of PMT threshold (used in tree output) |
threshold | PMT threshold in ADC counts (for printing) |
plotSets | set of plot boxes to fill (from initializePlotSet() ) |
eventInfo | event information for plotting |
combinedCounts | combined trigger primitives, per cryostat |
For each of the trigger requirements (MinimumPrimitives
), this method:
combinedCounts
trigger primitiveThe input combined trigger primitives contain the maximum number of trigger primitives active at each optical clock tick, one entry for each cryostat. It is assumed that the beam gate has already been "applied" so that outside it no trigger primitive is considered open.
A trigger with requirement of minimum trigger primitives N is fired if this combined primitive reaches or passes N, i.e. if there are at least N open trigger primitives at any time. The time of the trigger is taken as the first tick at which the requirement is met.
Extra plots are an overview of the trigger efficiency for different requirements, per threshold, the distribution of the trigger time for different requirements, and maximum number of open primitive in a cryostat, per event.
Note that there is no information about which cryostat is meeting the trigger requirement.
Definition at line 716 of file MajorityTriggerEfficiencyPlots_module.cc.
|
overrideprivatevirtual |
Simulates all trigger minimum requirements plots the results.
thresholdIndex | the index of the PMT threshold of input primitives |
gates | the trigger primitives used to simulate the trigger response |
eventInfo | general information about the event being simulated |
selectedPlots | list of boxes containing plots to be filled |
This method is expected to perform the following steps for each trigger primitive requirement in MinimumPrimitives
:
combineTriggerPrimitives()
;applyBeamGate()
on the combined primitives;plotResponses()
;plotResponses()
.Details are in the documentation of the relevant methods.
This method is invoked once per PMT threshold.
Implements icarus::trigger::TriggerEfficiencyPlotsBase.
Definition at line 687 of file MajorityTriggerEfficiencyPlots_module.cc.
|
private |
Minimum number of trigger primitives for a trigger to happen.
Definition at line 337 of file MajorityTriggerEfficiencyPlots_module.cc.
|
private |
Handler of ROOT tree output.
Definition at line 344 of file MajorityTriggerEfficiencyPlots_module.cc.