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

Algorithm to produce trigger gates out of optical readout waveforms. More...

#include <TriggerGateBuilder.h>

Inheritance diagram for icarus::trigger::TriggerGateBuilder:
icarus::trigger::ManagedTriggerGateBuilder icarus::trigger::DynamicTriggerGateBuilder icarus::trigger::FixedTriggerGateBuilder icarus::trigger::DynamicTriggerGateBuilderTool icarus::trigger::FixedTriggerGateBuilderTool

Classes

struct  Config
 
class  TriggerGates
 Container of logical gates for all triggering channels for a threshold. More...
 

Public Types

using Channel_t = raw::Channel_t
 

Public Member Functions

 TriggerGateBuilder (Config const &config)
 Constructor: sets the configuration. More...
 
virtual ~TriggerGateBuilder ()=default
 Virtual destructor. Nothing special about it, except that it's virtual. More...
 
virtual void setup (detinfo::DetectorTimings const &timings)
 Algorithm setup. More...
 
virtual void reset ()
 Algorithm reset. It will require a new setup before using it again. More...
 
virtual void resetup (detinfo::DetectorTimings const &timings)
 Resets and sets up. More...
 
virtual void resetup (detinfo::DetectorTimings const &timings, std::vector< ADCCounts_t > const &thresholds)
 Resets and sets up (including a new set of thresholds). More...
 
virtual std::vector< TriggerGatesbuild (std::vector< WaveformWithBaseline > const &waveforms) const =0
 Returns a collection of TriggerGates objects sorted by threshold. More...
 
std::vector< ADCCounts_t > const & channelThresholds () const
 Returns all the configured thresholds. More...
 
std::size_t nChannelThresholds () const
 Returns the number of configured thresholds. More...
 
optical_tick timeToOpticalTick (microsecond time) const
 Converts a time [s] into optical ticks. More...
 
optical_tick timeStampToOpticalTick (raw::TimeStamp_t time) const
 Converts a timestamp from raw::OpDetWaveform into optical ticks. More...
 

Static Public Member Functions

static constexpr bool isValidChannel (Channel_t channel)
 Returns whether channel is valid. More...
 

Static Public Attributes

static constexpr Channel_t InvalidChannel = std::numeric_limits<Channel_t>::max()
 Mnemonic for an invalid optical detector channel. More...
 

Protected Member Functions

detinfo::DetectorTimings const & detTimings () const
 Returns a detector timings object. More...
 
std::vector< TriggerGatesprepareAllGates () const
 
virtual void doSetThresholds (std::vector< ADCCounts_t > const &thresholds)
 Sets all thresholds anew. More...
 

Private Attributes

std::vector< ADCCounts_tfChannelThresholds
 All single channel thresholds, sorted in increasing order. More...
 
std::optional
< detinfo::DetectorTimings
fDetTimings
 LArSoft detector timing utility. More...
 

Detailed Description

Algorithm to produce trigger gates out of optical readout waveforms.

See Also
icarus::trigger::DynamicTriggerGateBuilder, icarus::trigger::FixedTriggerGateBuilder

This is an abstract class. Derived algorithms need to provide a way to actually build() the gates.

Definition at line 102 of file TriggerGateBuilder.h.

Member Typedef Documentation

Definition at line 108 of file TriggerGateBuilder.h.

Constructor & Destructor Documentation

icarus::trigger::TriggerGateBuilder::TriggerGateBuilder ( Config const &  config)

Constructor: sets the configuration.

Definition at line 129 of file TriggerGateBuilder.cxx.

130  : fChannelThresholds(FHiCLsequenceWrapper(config.ChannelThresholds()))
131 {
132  std::sort(fChannelThresholds.begin(), fChannelThresholds.end());
133 
134  if (!fChannelThresholds.empty()
135  && (fChannelThresholds.front() < ADCCounts_t{0})
136  ) {
137  throw cet::exception("TriggerGateBuilder")
138  << "icarus::trigger::TriggerGateBuilder does not support"
139  " negative thresholds (like "
140  << fChannelThresholds.front() << ").\n";
141  }
142 
143 } // icarus::trigger::TriggerGateBuilder::TriggerGateBuilder()
util::quantities::counts_as< raw::ADC_Count_t > ADCCounts_t
ADC counts for optical detector readout.
Definition: TriggerTypes.h:40
std::vector< ADCCounts_t > fChannelThresholds
All single channel thresholds, sorted in increasing order.
virtual icarus::trigger::TriggerGateBuilder::~TriggerGateBuilder ( )
virtualdefault

Virtual destructor. Nothing special about it, except that it's virtual.

Member Function Documentation

virtual std::vector<TriggerGates> icarus::trigger::TriggerGateBuilder::build ( std::vector< WaveformWithBaseline > const &  waveforms) const
pure virtual

Returns a collection of TriggerGates objects sorted by threshold.

Implemented in icarus::trigger::FixedTriggerGateBuilder, and icarus::trigger::DynamicTriggerGateBuilder.

std::vector<ADCCounts_t> const& icarus::trigger::TriggerGateBuilder::channelThresholds ( ) const
inline

Returns all the configured thresholds.

Definition at line 220 of file TriggerGateBuilder.h.

221  { return fChannelThresholds; }
std::vector< ADCCounts_t > fChannelThresholds
All single channel thresholds, sorted in increasing order.
detinfo::DetectorTimings const& icarus::trigger::TriggerGateBuilder::detTimings ( ) const
inlineprotected

Returns a detector timings object.

Definition at line 241 of file TriggerGateBuilder.h.

241 { return *fDetTimings; }
std::optional< detinfo::DetectorTimings > fDetTimings
LArSoft detector timing utility.
virtual void icarus::trigger::TriggerGateBuilder::doSetThresholds ( std::vector< ADCCounts_t > const &  thresholds)
inlineprotectedvirtual

Sets all thresholds anew.

Definition at line 248 of file TriggerGateBuilder.h.

249  { fChannelThresholds = thresholds; }
std::vector< ADCCounts_t > fChannelThresholds
All single channel thresholds, sorted in increasing order.
static constexpr bool icarus::trigger::TriggerGateBuilder::isValidChannel ( Channel_t  channel)
inlinestatic

Returns whether channel is valid.

Definition at line 235 of file TriggerGateBuilder.h.

236  { return channel != InvalidChannel; }
static constexpr Channel_t InvalidChannel
Mnemonic for an invalid optical detector channel.
std::size_t icarus::trigger::TriggerGateBuilder::nChannelThresholds ( ) const
inline

Returns the number of configured thresholds.

Definition at line 224 of file TriggerGateBuilder.h.

224 { return channelThresholds().size(); }
std::vector< ADCCounts_t > const & channelThresholds() const
Returns all the configured thresholds.
auto icarus::trigger::TriggerGateBuilder::prepareAllGates ( ) const
protected

Creates an empty TriggerGates object for each threshold; thresholds are kept relative.

Definition at line 172 of file TriggerGateBuilder.cxx.

174 {
175 
176  // create an empty TriggerGates object for each threshold;
177  // thresholds are kept relative
178  std::vector<TriggerGates> allGates;
179  allGates.reserve(nChannelThresholds());
180  for (auto threshold: channelThresholds()) allGates.emplace_back(threshold);
181  return allGates;
182 
183 } // icarus::trigger::TriggerGateBuilder::prepareAllGates()
std::vector< ADCCounts_t > const & channelThresholds() const
Returns all the configured thresholds.
std::size_t nChannelThresholds() const
Returns the number of configured thresholds.
virtual void icarus::trigger::TriggerGateBuilder::reset ( )
inlinevirtual

Algorithm reset. It will require a new setup before using it again.

Definition at line 202 of file TriggerGateBuilder.h.

202 {}
virtual void icarus::trigger::TriggerGateBuilder::resetup ( detinfo::DetectorTimings const &  timings)
inlinevirtual

Resets and sets up.

Definition at line 205 of file TriggerGateBuilder.h.

206  { reset(); setup(timings); }
virtual void setup(detinfo::DetectorTimings const &timings)
Algorithm setup.
virtual void reset()
Algorithm reset. It will require a new setup before using it again.
virtual void icarus::trigger::TriggerGateBuilder::resetup ( detinfo::DetectorTimings const &  timings,
std::vector< ADCCounts_t > const &  thresholds 
)
inlinevirtual

Resets and sets up (including a new set of thresholds).

Definition at line 209 of file TriggerGateBuilder.h.

213  { resetup(timings); doSetThresholds(thresholds); }
virtual void resetup(detinfo::DetectorTimings const &timings)
Resets and sets up.
virtual void doSetThresholds(std::vector< ADCCounts_t > const &thresholds)
Sets all thresholds anew.
void icarus::trigger::TriggerGateBuilder::setup ( detinfo::DetectorTimings const &  timings)
virtual

Algorithm setup.

Reimplemented in icarus::trigger::FixedTriggerGateBuilder.

Definition at line 148 of file TriggerGateBuilder.cxx.

149 {
150  fDetTimings = timings;
151 } // icarus::trigger::TriggerGateBuilder::setup()
std::optional< detinfo::DetectorTimings > fDetTimings
LArSoft detector timing utility.
auto icarus::trigger::TriggerGateBuilder::timeStampToOpticalTick ( raw::TimeStamp_t  time) const

Converts a timestamp from raw::OpDetWaveform into optical ticks.

Definition at line 165 of file TriggerGateBuilder.cxx.

166 {
167  return timeToOpticalTick(microsecond{ time });
168 } // icarus::trigger::TriggerGateBuilder::timeStampToOpticalTick()
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
Definition: spacetime.h:119
optical_tick timeToOpticalTick(microsecond time) const
Converts a time [s] into optical ticks.
auto icarus::trigger::TriggerGateBuilder::timeToOpticalTick ( microsecond  time) const

Converts a time [s] into optical ticks.

Definition at line 156 of file TriggerGateBuilder.cxx.

157 {
159  return detTimings().toTick<optical_tick>(optical_time{ time });
160 }
detinfo::DetectorTimings const & detTimings() const
Returns a detector timings object.
timescale_traits< OpticalTimeCategory >::time_point_t optical_time
A point in time on the optical detector electronics time scale.
timescale_traits< OpticalTimeCategory >::tick_t optical_tick
TargetTick toTick(FromTime time) const
Returns a time point as a tick on a different time scale.

Member Data Documentation

std::vector<ADCCounts_t> icarus::trigger::TriggerGateBuilder::fChannelThresholds
private

All single channel thresholds, sorted in increasing order.

Definition at line 256 of file TriggerGateBuilder.h.

std::optional<detinfo::DetectorTimings> icarus::trigger::TriggerGateBuilder::fDetTimings
private

LArSoft detector timing utility.

Definition at line 264 of file TriggerGateBuilder.h.

constexpr Channel_t icarus::trigger::TriggerGateBuilder::InvalidChannel = std::numeric_limits<Channel_t>::max()
static

Mnemonic for an invalid optical detector channel.

Definition at line 112 of file TriggerGateBuilder.h.


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