All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
sbn::OpDetWaveformMetaMaker Class Reference

Converter from raw::OpDetWaveform into sbn::OpDetWaveformMeta. More...

#include <OpDetWaveformMetaUtils.h>

Public Types

using microseconds = util::quantities::intervals::microseconds
 

Public Member Functions

 OpDetWaveformMetaMaker (detinfo::DetectorTimings const &detTimings)
 
 OpDetWaveformMetaMaker (microseconds opDetTickPeriod)
 
sbn::OpDetWaveformMeta make (raw::OpDetWaveform const &waveform) const
 Creates a sbn::OpDetWaveformMeta out of the specified waveform. More...
 
sbn::OpDetWaveformMeta operator() (raw::OpDetWaveform const &waveform) const
 

Private Types

using electronics_time = detinfo::timescales::electronics_time
 

Private Attributes

microseconds fOpDetTickPeriod
 The duration of a optical detector tick. More...
 
std::optional< electronics_timefTriggerTime
 Cached trigger time. More...
 
std::optional< electronics_timefBeamGateTime
 Cached beam gate time. More...
 

Detailed Description

Converter from raw::OpDetWaveform into sbn::OpDetWaveformMeta.

An object of this class is initialized once with some timings (e.g. once per event), used to make() multiple sbn::OpDetWaveformMeta and then discarded:

(art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event));
std::vector<sbn::OpDetWaveformMeta> PMTinfo;
for (raw::OpDetWaveform const& waveform: waveforms)
PMTinfo.push_back(makeOpDetWaveformMeta(waveform));

It supports a scenario where times (trigger and beam gate) are not available or not relevant, in which case only the duration in time of a optical detector waveform tick is needed.

Definition at line 123 of file OpDetWaveformMetaUtils.h.

Member Typedef Documentation

Definition at line 147 of file OpDetWaveformMetaUtils.h.

Definition at line 127 of file OpDetWaveformMetaUtils.h.

Constructor & Destructor Documentation

sbn::OpDetWaveformMetaMaker::OpDetWaveformMetaMaker ( detinfo::DetectorTimings const &  detTimings)

Constructor: allows creation of sbn::OpDetWaveformMeta with full information.

Definition at line 22 of file OpDetWaveformMetaUtils.cxx.

23  : fOpDetTickPeriod{ detTimings.OpticalClockPeriod() }
24  , fTriggerTime{ detTimings.TriggerTime() }
25  , fBeamGateTime{ detTimings.BeamGateTime() }
26  {}
std::optional< electronics_time > fBeamGateTime
Cached beam gate time.
microseconds fOpDetTickPeriod
The duration of a optical detector tick.
std::optional< electronics_time > fTriggerTime
Cached trigger time.
fDetProps &fDetProps fDetProps &fDetProps detTimings
sbn::OpDetWaveformMetaMaker::OpDetWaveformMetaMaker ( microseconds  opDetTickPeriod)

Constructor: allows creation of sbn::OpDetWaveformMeta with no trigger/beam time information.

Definition at line 30 of file OpDetWaveformMetaUtils.cxx.

31  : fOpDetTickPeriod{ opDetTickPeriod }
32  {}
microseconds fOpDetTickPeriod
The duration of a optical detector tick.

Member Function Documentation

sbn::OpDetWaveformMeta sbn::OpDetWaveformMetaMaker::make ( raw::OpDetWaveform const &  waveform) const

Creates a sbn::OpDetWaveformMeta out of the specified waveform.

Definition at line 37 of file OpDetWaveformMetaUtils.cxx.

38 {
39 
41 
42  raw::Channel_t const channel = waveform.ChannelNumber();
43  std::size_t const nSamples = waveform.Waveform().size();
44  electronics_time const startTime { waveform.TimeStamp() };
45  electronics_time const endTime
46  = startTime + waveform.Waveform().size() * fOpDetTickPeriod;
47 
49  channel // channel
50  , nSamples // nSamples
51  , startTime.value() // startTime
52  , endTime.value() // endTime
53  /* the following are left default:
54  // flags
55  */
56  };
57 
58  auto const setFlag = [&info]
60  { if (value) info.flags.set(flag); else info.flags.unset(flag); };
61 
62  auto const isInWaveform = [startTime,endTime](electronics_time t)
63  { return (t >= startTime) && (t < endTime); };
64 
65  if (fTriggerTime) {
66  setFlag
68  }
69 
70  if (fBeamGateTime) {
71  setFlag
73  }
74 
75  return info;
76 
77 } // sbn::OpDetWaveformMetaMaker::make()
std::optional< electronics_time > fBeamGateTime
Cached beam gate time.
then echo unknown compiler flag
Derivative information from raw::OpDetWaveform data.
detinfo::timescales::electronics_time electronics_time
microseconds fOpDetTickPeriod
The duration of a optical detector tick.
typename Mask_t::Flag_t Flag_t
Type identifying a single flag.
Definition: FlagSet.h:60
static constexpr Flag_t WithBeamGate
Whether this time interval includes the nominal beam gate opening.
static constexpr Flag_t WithTrigger
Whether this time interval includes the hardware trigger time.
std::optional< electronics_time > fTriggerTime
Cached trigger time.
temporary value
timescale_traits< ElectronicsTimeCategory >::time_point_t electronics_time
A point in time on the electronics time scale.
sbn::OpDetWaveformMeta sbn::OpDetWaveformMetaMaker::operator() ( raw::OpDetWaveform const &  waveform) const
inline

Definition at line 141 of file OpDetWaveformMetaUtils.h.

142  { return make(waveform); }
sbn::OpDetWaveformMeta make(raw::OpDetWaveform const &waveform) const
Creates a sbn::OpDetWaveformMeta out of the specified waveform.

Member Data Documentation

std::optional<electronics_time> sbn::OpDetWaveformMetaMaker::fBeamGateTime
private

Cached beam gate time.

Definition at line 152 of file OpDetWaveformMetaUtils.h.

microseconds sbn::OpDetWaveformMetaMaker::fOpDetTickPeriod
private

The duration of a optical detector tick.

Definition at line 149 of file OpDetWaveformMetaUtils.h.

std::optional<electronics_time> sbn::OpDetWaveformMetaMaker::fTriggerTime
private

Cached trigger time.

Definition at line 151 of file OpDetWaveformMetaUtils.h.


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