Tool decoding the trigger information from DAQ. More...
Classes | |
struct | TriggerGateTypes |
Codes of gate types from the trigger hardware. More... | |
Public Member Functions | |
TriggerDecoder (fhicl::ParameterSet const &pset) | |
virtual void | produces (art::ProducesCollector &) override |
The space point building should output the hit collection for those hits which combine to form space points - a nice noise filter! More... | |
virtual void | configure (const fhicl::ParameterSet &) override |
Interface for configuring the particular algorithm tool. More... | |
virtual void | initializeDataProducts () override |
Initialize any data products the tool will output. More... | |
virtual void | process_fragment (const artdaq::Fragment &fragment) override |
Given a set of recob hits, run DBscan to form 3D clusters. More... | |
virtual void | outputDataProducts (art::Event &event) override |
Output the data products to the event store. More... | |
TriggerDecoder (fhicl::ParameterSet const &pset) | |
virtual void | consumes (art::ConsumesCollector &collector) override |
Declare to the framework what you expect to read. More... | |
virtual void | produces (art::ProducesCollector &) override |
The space point building should output the hit collection for those hits which combine to form space points - a nice noise filter! More... | |
virtual void | configure (const fhicl::ParameterSet &) override |
Interface for configuring the particular algorithm tool. More... | |
virtual void | initializeDataProducts () override |
Initialize any data products the tool will output. More... | |
virtual void | setupRun (art::Run const &run) override |
Preparation to process a new run. More... | |
virtual void | process_fragment (const artdaq::Fragment &fragment) override |
Given a set of recob hits, run DBscan to form 3D clusters. More... | |
virtual void | outputDataProducts (art::Event &event) override |
Output the data products to the event store. More... | |
Public Member Functions inherited from daq::IDecoder | |
virtual | ~IDecoder () noexcept=default |
Virtual Destructor. More... | |
virtual void | setupEvent (art::Event const &event) |
Preparation to process a new event. More... | |
Private Types | |
using | nanoseconds = util::quantities::nanosecond |
using | TriggerCollection = std::vector< raw::ExternalTrigger > |
using | TriggerPtr = std::unique_ptr< TriggerCollection > |
using | RelativeTriggerCollection = std::vector< raw::Trigger > |
using | BeamGateInfoCollection = std::vector< sim::BeamGateInfo > |
using | BeamGateInfoPtr = std::unique_ptr< BeamGateInfoCollection > |
using | ExtraInfoPtr = std::unique_ptr< sbn::ExtraTriggerInfo > |
using | microseconds = util::quantities::microsecond |
using | nanoseconds = util::quantities::nanosecond |
using | TriggerCollection = std::vector< raw::ExternalTrigger > |
using | TriggerPtr = std::unique_ptr< TriggerCollection > |
using | RelativeTriggerCollection = std::vector< raw::Trigger > |
using | BeamGateInfoCollection = std::vector< sim::BeamGateInfo > |
using | BeamGateInfoPtr = std::unique_ptr< BeamGateInfoCollection > |
using | ExtraInfoPtr = std::unique_ptr< sbn::ExtraTriggerInfo > |
Private Member Functions | |
icarus::ICARUSTriggerUDPFragment | makeTriggerFragment (artdaq::Fragment const &fragment) const |
Creates a ICARUSTriggerInfo from a generic fragment. More... | |
icarus::ICARUSTriggerInfo | parseTriggerString (std::string_view data) const |
Parses the trigger data packet with the "standard" parser. More... | |
icarus::ICARUSTriggerV2Fragment | makeTriggerFragment (artdaq::Fragment const &fragment) const |
Creates a ICARUSTriggerInfo from a generic fragment. More... | |
icarus::ICARUSTriggerInfo | parseTriggerString (std::string_view data) const |
Parses the trigger data packet with the "standard" parser. More... | |
icarus::KeyValuesData | parseTriggerStringAsCSV (std::string const &data) const |
Parses the trigger data packet with a CSV parser. More... | |
Static Private Member Functions | |
static std::string_view | firstLine (std::string const &s, std::string const &endl="\0\n\r"s) |
static std::uint64_t | makeTimestamp (unsigned int s, unsigned int ns) |
Combines second and nanosecond counts into a 64-bit timestamp. More... | |
static long long int | timestampDiff (std::uint64_t a, std::uint64_t b) |
Returns the difference a - b . More... | |
static std::string_view | firstLine (std::string const &s, std::string const &endl="\0\n\r"s) |
static std::uint64_t | makeTimestamp (unsigned int s, unsigned int ns) |
Combines second and nanosecond counts into a 64-bit timestamp. More... | |
static long long int | timestampDiff (std::uint64_t a, std::uint64_t b) |
Returns the difference a - b . More... | |
static std::uint64_t | encodeLVDSbits (short int cryostat, short int connector, std::uint64_t connectorWord) |
static sim::BeamType_t | simGateType (sbn::triggerSource source) |
Returns the beam type corresponding to the specified trigger source . More... | |
Private Attributes | |
TriggerPtr | fTrigger |
TriggerPtr | fPrevTrigger |
std::unique_ptr < RelativeTriggerCollection > | fRelTrigger |
ExtraInfoPtr | fTriggerExtra |
BeamGateInfoPtr | fBeamGateInfo |
bool | fDiagnosticOutput |
Produces large number of diagnostic messages, use with caution! More... | |
bool | fDebug |
Use this for debugging this tool. More... | |
long | fLastEvent = 0 |
detinfo::DetectorTimings const | fDetTimings |
Detector clocks and timings. More... | |
art::InputTag | fTriggerConfigTag |
Data product with hardware trigger configuration. More... | |
icarus::TriggerConfiguration const * | fTriggerConfiguration = nullptr |
Cached pointer to the trigger configuration of the current run, if any. More... | |
Static Private Attributes | |
static std::string const | CurrentTriggerInstanceName {} |
Name of the data product instance for the current trigger. More... | |
static std::string const | PreviousTriggerInstanceName { "previous" } |
Name of the data product instance for the previous trigger. More... | |
static constexpr double | UnknownBeamTime = std::numeric_limits<double>::max() |
static constexpr nanoseconds | BNBgateDuration { 1600. } |
static constexpr nanoseconds | NuMIgateDuration { 9500. } |
Tool decoding the trigger information from DAQ.
Produces:
std::vector<raw::ExternalTrigger>
containing the absolute trigger time stamp from the White Rabbit system, and a trigger count; it always includes a single entry (zero might be supported).std::vector<raw::Trigger>
containing:
TriggerTime()
: the relative time of the trigger as reported in the White Rabbit timestamp, measured in the electronics time scale (for ICARUS it will always be detinfo::DetectorClocksData::TriggerTime()
).BeamGateTime()
: relative time of the announced arrival of the beam (currently not available) also in electronics time scale.TriggerCount()
: the trigger count from the beginning of the run.TriggerBits()
: includes the beam(s) with an open gate when the trigger happened (currently only one beam gate per trigger); definitions are in sbn::beamType
namespace.It always includes a single entry (zero might be supported).
std::vector<sim::BeamGateInfo>
containing information on the "main" beam gate associated to each trigger (a way to say that if by any chance there are more than one bits set for the trigger, this gate will pick only one of them):Start()
: relative time of the announced arrival of the beam (currently not available), in simulation time scale.Width()
: duration of the gate, in nanoseconds; currently set to a nominal value.BeamType()
: the type of the beam gate being described (BNB, NuMI).sbn::ExtraTriggerInfo
: the most complete collection of information, duplicating also some from the other data products. Some of the information is not available yet: if a count is not available, its value is set to 0
(which is an invalid value because their valid range starts with 1
since they include the current event), and if a timestamp is not available it is set to sbn::ExtraTriggerInfo::NoTimestamp
; these two conditions can be checked with static methods sbn::ExtraTriggerInfo::isValidTimestamp()
and sbn::ExtraTriggerInfo::isValidCount()
respectively. Note that differently from the usual, this is a single object, not a collection; also, this data product has no instance name. The information already available includes:sourceType
: the type of beam or trigger source, a value from sbn::triggerSource
(equivalent to raw::Trigger::TriggerBits()
, but in the form of an enumerator rather than a bit mask).triggerTimestamp
: same as raw::ExternalTrigger::GetTrigTime()
(nanoseconds from the Epoch, Coordinated Universal Time).beamGateTimestamp
: absolute time of the beam gate opening as reported by the trigger hardware, directly comparable with triggerTimestamp
(same scale and unit).triggerID
: same as raw::ExternalTrigger::GetTrigID()
. Should match the event number.gateID
: the count of gates since the beginning of the run, as reported by the trigger hardware.Besides the main data product (empty instance name) an additional std::vector<raw::ExternalTrigger>
data product with instance name "previous"
is also produced, which relays the same kind of information but for the previous trigger. This information also comes from the trigger DAQ. If no previous trigger is available, this collection will be empty.
The reference trigger time is driven by the trigger fragment time, which is expected to have been derived from the actual trigger time from the White Rabbit system properly corrected to UTC by the board reader.
All absolute timestamps are corrected to be on that same scale. The absolute timestamps related to the White Rabbit time are added an offset to achieve this correction; this offset is stored in the data product (sbn::ExtraTriggerInfo::WRtimeToTriggerTime
).
Produces:
std::vector<raw::ExternalTrigger>
containing the absolute trigger time stamp from the White Rabbit system, and a trigger count; it always includes a single entry (zero might be supported).std::vector<raw::Trigger>
containing:
TriggerTime()
: the relative time of the trigger as reported in the White Rabbit timestamp, measured in the electronics time scale (for ICARUS it will always be detinfo::DetectorClocksData::TriggerTime()
).BeamGateTime()
: relative time of the announced arrival of the beam, also in electronics time scale.TriggerCount()
: the trigger count from the beginning of the run.TriggerBits()
: includes the beam(s) with an open gate when the trigger happened (currently only one beam gate per trigger); definitions are in sbn::beamType
namespace.It always includes a single entry (zero might be supported).
std::vector<sim::BeamGateInfo>
containing information on the "main" beam gate associated to each trigger (a way to say that if by any chance there are more than one bits set for the trigger, this gate will pick only one of them):Start()
: relative time of the announced arrival of the beam, in simulation time scale.Width()
: duration of the gate, in nanoseconds; read from trigger configuration if specified (TrigConfigLabel
), set to 0
otherwise.BeamType()
: the type of the beam gate being described (BNB, NuMI).sbn::ExtraTriggerInfo
: the most complete collection of information, duplicating also some from the other data products. Note that differently from the usual, this is a single object, not a collection; also, this data product has no instance name. The information already available includes:
sourceType
: the type of beam or trigger source, a value from sbn::triggerSource
(equivalent to raw::Trigger::TriggerBits()
, but in the form of an enumerator rather than a bit mask). Also called gate type.triggerTimestamp
: same as raw::ExternalTrigger::GetTrigTime()
(nanoseconds from the Epoch, Coordinated Universal Time).beamGateTimestamp
: absolute time of the beam gate opening as reported by the trigger hardware, directly comparable with triggerTimestamp
(same scale and unit).enableGateTimestamp
: absolute time of the enable gate opening as reported by the trigger hardware, directly comparable with triggerTimestamp
(same scale and unit). This is the gate that enables the generation of trigger primitives and the off-spill readout of PMT. Its duration can be found in the trigger configuration data product (icarus::TriggerConfiguration
).triggerID
: same as raw::ExternalTrigger::GetTrigID()
. Should match the event number.gateID
: the count of gates since the beginning of the run, as reported by the trigger hardware.gateCountFromPreviousTrigger
: number of gates since the last trigger: specifically, if this trigger is e.g. from off-beam BNB gate, this is the number of off-beam BNB gates from the last off-beam BNB trigger (minimum number is 1
, since that gate is included).previousTriggerTimestamp
: absolute timestamp of the previous trigger from this source. For example, if this trigger is from an off-beam BNB gate, this represents the previous off-beam BNB trigger.gateCount
: total number of gates of this type (triggered or not) from the beginning of the run (minimum 1
since this one is included). For example, if this trigger is from an off-beam BNB gate, this is the number of off-beam BNB gates from the beginning of the run.triggerCount
: total number of triggers from gates of this type from the beginning of the run (minimum 1
since this one is included). For example, if this trigger is from an off-beam BNB gate, this is the number of off-beam BNB triggers from the beginning of the run.anyTriggerCountFromPreviousTrigger
: number of triggers that occurred since the last trigger of this time (the one with timestamp previousTriggerTimestamp
). For example, if this trigger is from an off-beam BNB gate, this is the number of triggers from any gate (including also e.g. off-beam NuMI, BNB, calibration...) that occurred from the previous off-beam BNB trigger.anyGateCountFromAnyPreviousTrigger
: how many gates have passed since the last trigger (reported by anyPreviousTriggerTimestamp
). The minimum value is 1
.anyPreviousTriggerTimestamp
: absolute timestamp of the previous trigger (from any source). For example, if this trigger is from an off-beam BNB gate, and the previous was from a NuMI gate, this represents that previous (NuMI) trigger.anyPreviousTriggerSourceType
: the type of gate of the previous trigger (the one reported by anyPreviousTriggerTimestamp
).WRtimeToTriggerTime
(nanoseconds): correction added to the GPS/White Rabbit time to obtain the trigger timestamp (normally it's the conversion from TAI to NTP timestamps).triggerLocationBits
: whether the trigger came from the east or west cryostat (currently the triggers combine the two opposite PMT walls, so there is no TPC-level granularity).cryostats
: information per cryostat (east first, then west). Note however that only the cryostats that are mentioned in triggerLocationBits
have the information filled.triggerCount
: number of triggers in this cryostat fired during the trigger window; only the first one becomes the global trigger, but we still keep the count of how many happen. Its value is 0
when trigger happened from elsewhere.LVDSstatus
: information per PMT wall (i.e. TPC; east first, then west) of the LVDS signals of the discriminated PMT pairs at the time of the global trigger. All bits are 0
when trigger happened elsewhere. Otherwise, the encoding is currently implemented in terms of hardware connectors as follows:
00<C3P2><C3P1><C3P0>00<C2P2><C2P1><C2P0>
00<C1P2><C1P1><C1P0>00<C0P2><C0P1><C0P0>
For the expected matching with PMT, see the documentation of sbn::ExtraTriggerInfo::CryostatInfo::LVDSstatus
.
Information may be missing. If a count is not available, its value is set to 0
(which is an invalid value because their valid range starts with 1
since they include the current event), and if a timestamp is not available it is set to sbn::ExtraTriggerInfo::NoTimestamp
; these two conditions can be checked with static methods sbn::ExtraTriggerInfo::isValidTimestamp()
and sbn::ExtraTriggerInfo::isValidCount()
respectively.
Besides the main data product (empty instance name) an additional std::vector<raw::ExternalTrigger>
data product with instance name "previous"
is also produced, which relays the same kind of information but for the previous trigger. This information also comes from the trigger DAQ. If no previous trigger is available, this collection will be empty.
The reference trigger time is driven by the trigger fragment time, which is expected to have been derived from the actual trigger time from the White Rabbit system properly corrected to UTC by the board reader.
All absolute timestamps are corrected to be on that same scale. The absolute timestamps related to the White Rabbit time are added an offset to achieve this correction; this offset is stored in the data product (sbn::ExtraTriggerInfo::WRtimeToTriggerTime
).
TrigConfigLabel
(input tag, mandatory): tag of the trigger configuration data product (see icarus::TriggerConfigurationExtractor
module) to be used. Specifying its tag is mandatory, but if it is explicitly specified empty, the decoder will try to work around its absence.DiagnosticOutput
(flag, default: false
): prints on console trigger data diagnostics (including a full dump of the parsed content).Debug
(flag, default: false
): prints on console decoding debug information, including a dump of the trigger data fragment. Definition at line 128 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 144 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 230 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 145 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 231 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 146 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 232 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 213 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 130 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 214 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 143 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 229 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 141 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 227 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 142 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 228 of file TriggerDecoderV2_tool.cc.
|
explicit |
Definition at line 205 of file TriggerDecoder_tool.cc.
|
explicit |
|
overridevirtual |
Interface for configuring the particular algorithm tool.
ParameterSet | The input set of parameters for configuration |
Implements daq::IDecoder.
Definition at line 223 of file TriggerDecoder_tool.cc.
|
overridevirtual |
Interface for configuring the particular algorithm tool.
ParameterSet | The input set of parameters for configuration |
Implements daq::IDecoder.
|
overridevirtual |
Declare to the framework what you expect to read.
Reimplemented from daq::IDecoder.
Definition at line 314 of file TriggerDecoderV2_tool.cc.
|
staticprivate |
Encodes the connectorWord
LVDS bits from the specified cryostat
and connector
into the format required by sbn::ExtraTriggerInfo
.
Definition at line 755 of file TriggerDecoderV2_tool.cc.
|
staticprivate |
Definition at line 485 of file TriggerDecoder_tool.cc.
|
staticprivate |
|
overridevirtual |
Initialize any data products the tool will output.
Implements daq::IDecoder.
Definition at line 230 of file TriggerDecoder_tool.cc.
|
overridevirtual |
Initialize any data products the tool will output.
Implements daq::IDecoder.
|
inlinestaticprivate |
Combines second and nanosecond counts into a 64-bit timestamp.
Definition at line 192 of file TriggerDecoder_tool.cc.
|
inlinestaticprivate |
Combines second and nanosecond counts into a 64-bit timestamp.
Definition at line 285 of file TriggerDecoderV2_tool.cc.
|
private |
Creates a ICARUSTriggerInfo
from a generic fragment.
Definition at line 244 of file TriggerDecoder_tool.cc.
|
private |
Creates a ICARUSTriggerInfo
from a generic fragment.
|
overridevirtual |
Output the data products to the event store.
event | The event store objects |
Implements daq::IDecoder.
Definition at line 473 of file TriggerDecoder_tool.cc.
|
overridevirtual |
Output the data products to the event store.
event | The event store objects |
Implements daq::IDecoder.
|
private |
Parses the trigger data packet with the "standard" parser.
Definition at line 266 of file TriggerDecoder_tool.cc.
|
private |
Parses the trigger data packet with the "standard" parser.
|
private |
Parses the trigger data packet with a CSV parser.
Definition at line 406 of file TriggerDecoderV2_tool.cc.
|
overridevirtual |
Given a set of recob hits, run DBscan to form 3D clusters.
fragment | The artdaq fragment to process |
Implements daq::IDecoder.
Definition at line 288 of file TriggerDecoder_tool.cc.
|
overridevirtual |
Given a set of recob hits, run DBscan to form 3D clusters.
fragment | The artdaq fragment to process |
Implements daq::IDecoder.
|
overridevirtual |
The space point building should output the hit collection for those hits which combine to form space points - a nice noise filter!
Implements daq::IDecoder.
Definition at line 213 of file TriggerDecoder_tool.cc.
|
overridevirtual |
The space point building should output the hit collection for those hits which combine to form space points - a nice noise filter!
Implements daq::IDecoder.
|
overridevirtual |
Preparation to process a new run.
To be called on every art run transition.
Reimplemented from daq::IDecoder.
Definition at line 427 of file TriggerDecoderV2_tool.cc.
|
staticprivate |
Returns the beam type corresponding to the specified trigger source
.
Definition at line 776 of file TriggerDecoderV2_tool.cc.
|
inlinestaticprivate |
|
inlinestaticprivate |
|
staticprivate |
Definition at line 185 of file TriggerDecoder_tool.cc.
|
staticprivate |
Name of the data product instance for the current trigger.
Definition at line 170 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 151 of file TriggerDecoder_tool.cc.
|
private |
Use this for debugging this tool.
Definition at line 153 of file TriggerDecoder_tool.cc.
|
private |
Detector clocks and timings.
Definition at line 160 of file TriggerDecoder_tool.cc.
|
private |
Produces large number of diagnostic messages, use with caution!
Definition at line 152 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 158 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 148 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 149 of file TriggerDecoder_tool.cc.
|
private |
Definition at line 147 of file TriggerDecoder_tool.cc.
|
private |
Data product with hardware trigger configuration.
Definition at line 238 of file TriggerDecoderV2_tool.cc.
|
private |
Cached pointer to the trigger configuration of the current run, if any.
Definition at line 247 of file TriggerDecoderV2_tool.cc.
|
private |
Definition at line 150 of file TriggerDecoder_tool.cc.
|
staticprivate |
Definition at line 186 of file TriggerDecoder_tool.cc.
|
staticprivate |
Name of the data product instance for the previous trigger.
Definition at line 173 of file TriggerDecoder_tool.cc.
|
staticprivate |
Definition at line 175 of file TriggerDecoder_tool.cc.