32 #ifndef SBND_OPDETSIM_OPDETSBNDTRIGGERALG_HH
33 #define SBND_OPDETSIM_OPDETSBNDTRIGGERALG_HH
35 #include "fhiclcpp/types/Atom.h"
36 #include "fhiclcpp/types/Sequence.h"
37 #include "fhiclcpp/types/OptionalSequence.h"
38 #include "messagefacility/MessageLogger/MessageLogger.h"
45 #include <unordered_map>
54 class DetectorClocksData;
55 class DetectorPropertiesData;
76 Name(
"PulsePolarityPMT"),
77 Comment(
"Whether pulses go down (-1) or up (1)."),
82 Name(
"PulsePolarityArapuca"),
83 Comment(
"Whether pulses go down (-1) or up (1)."),
88 Name(
"TriggerThresholdADCArapuca"),
89 Comment(
"Threshold for channel to issue trigger across all arapuca channels. [ADC]")
93 Name(
"TriggerThresholdADCPMT"),
94 Comment(
"Threshold for channel to issue trigger across all pmt channels. [ADC]")
98 Name(
"MaskedChannels"),
99 Comment(
"Channels which are ignored for issuing triggers.")
103 Name(
"MaskLightBars"),
104 Comment(
"Whether to mask all light bar readout channels from issuing triggers."),
110 Comment(
"Whether to mask all PMT readout channels from issuing triggers."),
115 Name(
"MaskBarePMTs"),
116 Comment(
"Whether to mask all Bare PMT readout channels from issuing triggers."),
121 Name(
"MaskXArapucaPrimes"),
122 Comment(
"Whether to mask all Arapuca Prime readout channels from issuing triggers."),
127 Name(
"MaskXArapucas"),
128 Comment(
"Whether to mask all X-Arapuca readout channels from issuing triggers."),
133 Name(
"MaskArapucaT1s"),
134 Comment(
"Whether to mask all Arapuca T1 readout channels from issuing triggers."),
139 Name(
"MaskArapucaT1s"),
140 Comment(
"Whether to mask all Arapuca T2 readout channels from issuing triggers."),
145 Name(
"SelfTriggerPerChannel"),
146 Comment(
"If true, each channel's OpDetWaveform will be 'triggered' when that channel goes above threshold (this setting ignores all mask settings). If false, a group of global triggers to be issued across all channel's will instead be collected."),
151 Name(
"TriggerHoldoff"),
152 Comment(
"When collecting global triggers, sets an amount of time where one trigger will not be issued following the previous one. [us]"),
157 Name(
"TriggerCountWindow"),
158 Comment(
"Size of window to count triggers arriving from different readout channels. [us]"),
163 Name(
"TriggerChannelCount"),
164 Comment(
"Number of trigger signals from different readout channels required to issue global trigger."),
169 Name(
"BeamTriggerEnable"),
170 Comment(
"Whether to also send a beam trigger."),
175 Name(
"BeamTriggerTime"),
176 Comment(
"Time at which the beam trigger will be issued. [us]"),
181 Name(
"BeamTriggerHoldoff"),
182 Comment(
"Time to ignore other triggers after the beam trigger time. [us]"),
187 Name(
"AllowTriggerOverlap"),
188 Comment(
"Extend the readout length if a second trigger occurs during a readout (CAEN board setting)."),
193 Name(
"TriggerEnableWindowOneDriftBeforeTPCReadout"),
194 Comment(
"If true, triggers will be enabled starting one full drift period prior to the start of the TPC readout, continuing for the length of time that the TPC is read-out (DetectorClocks and DetectorProperties are used to determine this time span. Otherwise, the config options TriggerEnableWindowStart and TriggerEnableWindowLength are checked."),
200 Comment(
"Drift period, used to determine how soon before the TPC readout the trigger enable window begins. [us]"),
205 Name(
"TriggerEnableWindowStart"),
206 Comment(
"Start of the window of time for which triggers are enabled. Ignored if TriggerEnableWindowOneDriftBeforeTPCReadout is true. [us]"),
211 Name(
"TriggerEnableWindowLength"),
212 Comment(
"Length of time for which trigger are enabled. Ignored if TriggerEnableWindowOneDriftBeforeTPCReadout is true. [us]"),
217 Name(
"ReadoutWindowPreTrigger"),
218 Comment(
"Size of readout window prior to a non-beam trigger. [us]"),
223 Name(
"ReadoutWindowPostTrigger"),
224 Comment(
"Size of readout window post a non-beam trigger. [us]"),
229 Name(
"ReadoutWindowPreTriggerBeam"),
230 Comment(
"Size of readout window pre a beam trigger. [us]"),
235 Name(
"ReadoutWindowPostTriggerBeam"),
236 Comment(
"Size of readout window post a beam trigger. [us]"),
249 void ClearTriggerLocations();
300 #endif // SBND_OPDETSIM_OPDETSBNDTRIGGERALG_HH
fhicl::Atom< int > PulsePolarityArapuca
bool IsTriggerEnabled(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, raw::TimeStamp_t trigger_time) const
double ReadoutWindowPostTriggerBeam(raw::Channel_t channel) const
double ReadoutWindowPreTrigger(raw::Channel_t channel) const
fhicl::Atom< bool > MaskArapucaT2s
fhicl::Atom< int > TriggerThresholdADCPMT
fhicl::Atom< double > ReadoutWindowPostTriggerBeam
const std::vector< raw::TimeStamp_t > & GetTriggerTimes(raw::Channel_t channel) const
fhicl::Atom< double > TriggerEnableWindowStart
opDetSBNDTriggerAlg(const fhicl::ParameterSet &pset)
std::array< double, 2 > TriggerEnableWindow(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp) const
fhicl::Atom< bool > TriggerEnableWindowOneDriftBeforeTPCReadout
std::map< raw::Channel_t, std::vector< std::array< raw::TimeStamp_t, 2 > > > fTriggerRangesPerChannel
fhicl::Atom< bool > MaskPMTs
void FindTriggerLocations(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const raw::OpDetWaveform &waveform, raw::ADC_Count_t baseline)
double TimeStamp_t
us since 1970, based on TimeService
opDetSBNDTriggerAlg(const Config &config)
fhicl::Atom< unsigned > TriggerChannelCount
fhicl::Atom< double > ReadoutWindowPreTrigger
fhicl::Atom< double > ReadoutWindowPreTriggerBeam
bool IsChannelMasked(raw::Channel_t channel) const
fhicl::Atom< bool > MaskXArapucaPrimes
void MergeTriggerLocations()
timescale_traits< TriggerTimeCategory >::time_point_t trigger_time
A point in time on the trigger time scale.
double ReadoutWindowPreTriggerBeam(raw::Channel_t channel) const
fhicl::Atom< int > TriggerThresholdADCArapuca
opdet::sbndPDMapAlg fOpDetMap
double OpticalPeriod() const
BEGIN_PROLOG vertical distance to the surface Name
fhicl::Atom< bool > BeamTriggerEnable
fhicl::OptionalSequence< unsigned > MaskedChannels
fhicl::Atom< bool > AllowTriggerOverlap
fhicl::Atom< bool > MaskBarePMTs
fhicl::Atom< bool > MaskLightBars
std::vector< raw::OpDetWaveform > ApplyTriggerLocations(detinfo::DetectorClocksData const &clockData, const raw::OpDetWaveform &waveform) const
fhicl::Atom< double > ReadoutWindowPostTrigger
fhicl::Atom< double > TriggerHoldoff
fhicl::Atom< bool > MaskArapucaT1s
fhicl::Atom< double > BeamTriggerHoldoff
std::vector< unsigned > fMaskedChannels
Contains all timing reference information for the detector.
std::vector< raw::TimeStamp_t > fTriggerLocations
fhicl::Atom< double > TriggerEnableWindowLength
double ReadoutWindowPostTrigger(raw::Channel_t channel) const
fhicl::Atom< bool > MaskXArapucas
fhicl::Atom< bool > SelfTriggerPerChannel
fhicl::Atom< double > BeamTriggerTime
fhicl::Atom< int > PulsePolarityPMT
std::map< raw::Channel_t, std::vector< raw::TimeStamp_t > > fTriggerLocationsPerChannel
raw::TimeStamp_t Tick2Timestamp(raw::TimeStamp_t waveform_start, size_t waveform_index) const
fhicl::Atom< double > DriftPeriod
fhicl::Atom< double > TriggerCountWindow