Simulates a "majority" trigger. More...
Classes | |
struct | Config |
Public Types | |
using | microseconds = util::quantities::intervals::microseconds |
using | nanoseconds = util::quantities::intervals::nanoseconds |
using | Parameters = art::EDProducer::Table< Config > |
Public Member Functions | |
MajorityTriggerSimulation (Parameters const &config) | |
virtual void | beginJob () override |
Initializes the plots. More... | |
virtual void | produce (art::Event &event) override |
Runs the simulation and saves the results into the art event. More... | |
virtual void | endJob () override |
Prints end-of-job summaries. More... | |
Private Types | |
using | TriggerInfo_t = details::TriggerInfo_t |
Type alias. More... | |
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... | |
Private Member Functions | |
void | initializePlots () |
Initializes the full set of plots (all ADC thresholds). More... | |
TriggerInfo_t | produceForThreshold (art::Event &event, detinfo::DetectorTimings const &detTimings, ApplyBeamGateClass const &beamGate, std::size_t const iThr, icarus::trigger::ADCCounts_t const thr) |
Performs the simulation for the specified ADC threshold. More... | |
TriggerInfo_t | simulate (ApplyBeamGateClass const &clockData, TriggerGates_t const &gates) const |
Performs the simulation of the configured trigger on gates input. More... | |
TriggerInfo_t | simulateCryostat (ApplyBeamGateClass const &beamGate, std::size_t iCryo, TriggerGates_t const &gates) const |
Simulates the trigger response within a single cryostat. More... | |
raw::Trigger | triggerInfoToTriggerData (detinfo::DetectorTimings const &detTimings, unsigned int triggerNumber, TriggerInfo_t const &info) const |
Converts the trigger information into a raw::Trigger object. More... | |
void | plotTriggerResponse (std::size_t iThr, TriggerInfo_t const &triggerInfo) const |
Fills the plots for threshold index iThr with trigger information. More... | |
void | printSummary () const |
Prints the summary of fired triggers on screen. More... | |
icarus::trigger::ApplyBeamGateClass | makeMyBeamGate (art::Event const *event=nullptr) const |
Shortcut to create an ApplyBeamGate with the current configuration. More... | |
icarus::trigger::ApplyBeamGateClass | makeMyBeamGate (art::Event const &event) const |
Private Member Functions inherited from lar::UncopiableClass | |
UncopiableClass ()=default | |
Default constructor. More... | |
~UncopiableClass ()=default | |
Default destructor. More... | |
UncopiableClass (UncopiableClass const &)=delete | |
Deleted copy and move constructors and assignments. More... | |
UncopiableClass (UncopiableClass &&)=default | |
UncopiableClass & | operator= (UncopiableClass const &)=delete |
UncopiableClass & | operator= (UncopiableClass &&)=default |
Private Member Functions inherited from lar::UnmovableClass | |
UnmovableClass ()=default | |
Default constructor. More... | |
~UnmovableClass ()=default | |
Default destructor. More... | |
UnmovableClass (UnmovableClass const &)=default | |
Default copy constructor and assignment. More... | |
UnmovableClass & | operator= (UnmovableClass const &)=default |
UnmovableClass (UnmovableClass &&)=delete | |
Deleted move constructor and assignment. More... | |
UnmovableClass & | operator= (UnmovableClass &&)=delete |
Private Attributes | |
std::map < icarus::trigger::ADCCounts_t, art::InputTag > | fADCthresholds |
ADC thresholds to read, and the input tag connected to their data. More... | |
unsigned int const | fMinimumPrimitives |
Minimum number of trigger primitives for a trigger to happen. More... | |
microseconds | fBeamGateDuration |
Duration of the gate during with global optical triggers are accepted. More... | |
nanoseconds | fTriggerTimeResolution |
Trigger resolution in time. More... | |
std::uint32_t | fBeamBits |
Bits for the beam gate being simulated. More... | |
std::string const | fLogCategory |
Message facility stream category for output. More... | |
geo::GeometryCore const & | fGeom |
art::TFileDirectory | fOutputDir |
ROOT directory where all the plots are written. More... | |
MajorityTriggerCombiner const | fCombiner |
Algorithm to combine primitives. More... | |
GeometryChannelSplitter | fChannelSplitter |
Algorithm to sort trigger gates by cryostat or TPC. More... | |
icarus::trigger::PlotSandbox | fPlots |
All plots in one practical sandbox. More... | |
std::vector< std::atomic < unsigned int > > | fTriggerCount |
std::atomic< unsigned int > | fTotalEvents { 0U } |
Count of fired triggers. More... | |
icarus::ns::util::ThreadSafeChangeMonitor < icarus::trigger::ApplyBeamGateClass > | fGateChangeCheck |
Functor returning whether a gate has changed. More... | |
Simulates a "majority" trigger.
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 single trigger request.
This module simulates a trigger requesting a minimum number of single trigger requests in the event, and saves the result as raw::Trigger
data products. While only one trigger definition is used, inputs with different thresholds may be specified to have the different responses.
TriggerGatesTag
(string, mandatory): name of the module instance which produced the trigger primitives to be used as input; it must not include any instance name, as the instance names will be automatically added from Thresholds
parameter. The typical trigger primitives used as input may be LVDS discriminated output (e.g. from icarus::trigger::LVDSgates
module) or combinations of them (e.g. from icarus::trigger::SlidingWindowTrigger
module).Thresholds
(list of integers, mandatory): list of the discrimination thresholds to consider, in ADC counts. A data product containing a digital signal is read for each one of the thresholds, and the tag of the data product is expected to be the module label TriggerGatesTag
with as instance name the value of the threshold (e.g. for a threshold of 60 ADC counts the data product tag might be LVDSgates:60
).MinimumPrimitives
(integer, mandatory): the required number of single trigger requests in order for the trigger to fire;BeamGateDuration
(time, mandatory): the duration of the beam gate; the time requires the unit to be explicitly specified: use "1.6 us"
for BNB, 9.5 us
for NuMI (also available as BNB_settings.spill_duration
and NuMI_settings.spill_duration
in trigger_icarus.fcl
);TriggerTimeResolution
(time, default: 8 ns
): time resolution for the trigger primitives;LogCategory
(string, default TriggerEfficiencyPlots
): name of category used to stream messages from this module into message facility.An example job configuration is provided as simulatemajoritytriggers_icarus.fcl
.
std::vector<raw::Trigger>
(one instance per ADC threshold): list of triggers fired according to the configured trigger definition; there is one collection (and data product) per ADC threshold, and the data product has the same instance name as the input data one (see TriggerGatesTag
and Thresholds
configuration parameters); currently only at most one trigger is emitted, with time stamp matching the first time the trigger criteria are satisfied. This section describes the trigger logic algorithm used in icarus::trigger::MajorityTriggerSimulation
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 trigger requirement is simply how many trigger primitives must be open at the same time in a single cryostat for the trigger to fire. The requirement is set in the configuration (MinimumPrimitives
). To determine whether a trigger with the given minimum number of 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.
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).
Plots are directly stored in the producer folder of the TFileService
ROOT output file.
Summary plots are generated:
NTriggers
: total number of triggers, per thresholdEff
: fraction of events with at least one trigger, per thresholdTriggerTick
: trigger time distribution (optical tick), per thresholdThe plots marked "per threshold" have a "threshold" axis where each bin corresponds to the threshold specified in the Thresholds
configuration parameter. Note that the numerical value of the axis on that bin does not match the threshold value.
Definition at line 342 of file MajorityTriggerSimulation_module.cc.
|
private |
Type of trigger gate extracted from the input event.
Definition at line 434 of file MajorityTriggerSimulation_module.cc.
using icarus::trigger::MajorityTriggerSimulation::microseconds = util::quantities::intervals::microseconds |
Definition at line 349 of file MajorityTriggerSimulation_module.cc.
using icarus::trigger::MajorityTriggerSimulation::nanoseconds = util::quantities::intervals::nanoseconds |
Definition at line 350 of file MajorityTriggerSimulation_module.cc.
using icarus::trigger::MajorityTriggerSimulation::Parameters = art::EDProducer::Table<Config> |
Definition at line 398 of file MajorityTriggerSimulation_module.cc.
|
private |
A list of trigger gates from input.
Definition at line 437 of file MajorityTriggerSimulation_module.cc.
Type alias.
Definition at line 430 of file MajorityTriggerSimulation_module.cc.
|
explicit |
Definition at line 605 of file MajorityTriggerSimulation_module.cc.
|
overridevirtual |
Initializes the plots.
Definition at line 665 of file MajorityTriggerSimulation_module.cc.
|
overridevirtual |
Prints end-of-job summaries.
Definition at line 707 of file MajorityTriggerSimulation_module.cc.
|
private |
Initializes the full set of plots (all ADC thresholds).
Definition at line 715 of file MajorityTriggerSimulation_module.cc.
|
inlineprivate |
Shortcut to create an ApplyBeamGate
with the current configuration.
Definition at line 584 of file MajorityTriggerSimulation_module.cc.
|
inlineprivate |
Definition at line 593 of file MajorityTriggerSimulation_module.cc.
|
private |
Fills the plots for threshold index iThr
with trigger information.
Definition at line 887 of file MajorityTriggerSimulation_module.cc.
|
private |
Prints the summary of fired triggers on screen.
Definition at line 901 of file MajorityTriggerSimulation_module.cc.
|
overridevirtual |
Runs the simulation and saves the results into the art event.
Definition at line 673 of file MajorityTriggerSimulation_module.cc.
|
private |
Performs the simulation for the specified ADC threshold.
event | art event to read data from and put results into |
iThr | index of the threshold in the configuration |
thr | value of the threshold (ADC counts) |
For the given threshold, the simulation of the configured trigger is performed. The input data is read from the event (the source tag is from the module configuration), simulation is performed, auxiliary plots are drawn and a raw::Trigger
collection is stored into the event.
The stored collection contains either one or zero raw::Trigger
elements.
The simulation itself is performed by the simulate()
method.
Definition at line 785 of file MajorityTriggerSimulation_module.cc.
|
private |
Performs the simulation of the configured trigger on gates
input.
gates | the input to the trigger simulation |
The simulation is performed using the input single trigger requests (or trigger primitives) from the gates
collection.
The gates are split by cryostat, and the simulation is performed independently on each cryostat (simulateCryostat()
). Finally, the cryostat triggers are combined (OR) into the final trigger decision, bearing as time the earliest one.
Definition at line 826 of file MajorityTriggerSimulation_module.cc.
|
private |
Simulates the trigger response within a single cryostat.
beamGate | the beam gate to be applied |
iCryo | index of the cryostat being processed |
gates | the trigger primitives to be considered |
The simulation computes the count of trigger gates
open at any time, sets it in coincidence with the beam gate, and fires a trigger if within that gate the count of open gates
is equal or larger than the threshold configured (MinimumPrimitives
). The time is the earliest one when that requirement is met.
Definition at line 855 of file MajorityTriggerSimulation_module.cc.
|
private |
Converts the trigger information into a raw::Trigger
object.
triggerNumber | the unique number to assign to this trigger |
info | the information about the fired trigger |
raw::Trigger
object with all the information encodedThe trigger described by info
is encoded into a raw::Trigger
object. The trigger must have fired.
Definition at line 926 of file MajorityTriggerSimulation_module.cc.
|
private |
ADC thresholds to read, and the input tag connected to their data.
Definition at line 443 of file MajorityTriggerSimulation_module.cc.
|
private |
Bits for the beam gate being simulated.
Definition at line 453 of file MajorityTriggerSimulation_module.cc.
|
private |
Duration of the gate during with global optical triggers are accepted.
Definition at line 449 of file MajorityTriggerSimulation_module.cc.
|
private |
Algorithm to sort trigger gates by cryostat or TPC.
Definition at line 475 of file MajorityTriggerSimulation_module.cc.
|
private |
Algorithm to combine primitives.
Definition at line 472 of file MajorityTriggerSimulation_module.cc.
|
private |
Functor returning whether a gate has changed.
Definition at line 488 of file MajorityTriggerSimulation_module.cc.
|
private |
Definition at line 462 of file MajorityTriggerSimulation_module.cc.
|
private |
Message facility stream category for output.
Definition at line 456 of file MajorityTriggerSimulation_module.cc.
|
private |
Minimum number of trigger primitives for a trigger to happen.
Definition at line 446 of file MajorityTriggerSimulation_module.cc.
|
private |
ROOT directory where all the plots are written.
Definition at line 465 of file MajorityTriggerSimulation_module.cc.
|
private |
All plots in one practical sandbox.
Count of fired triggers, per threshold.
Definition at line 478 of file MajorityTriggerSimulation_module.cc.
|
private |
Count of fired triggers.
Definition at line 482 of file MajorityTriggerSimulation_module.cc.
|
private |
Definition at line 481 of file MajorityTriggerSimulation_module.cc.
|
private |
Trigger resolution in time.
Definition at line 451 of file MajorityTriggerSimulation_module.cc.