Extracts a baseline from PMT waveforms. More...
Classes | |
struct | BaselineInfo_t |
Record of baseline information to be written. More... | |
struct | Config |
Public Types | |
using | Parameters = art::SharedProducer::Table< Config > |
Public Member Functions | |
PMTWaveformBaselinesFromChannelData (Parameters const &config, art::ProcessingFrame const &) | |
virtual void | beginJob (art::ProcessingFrame const &frame) override |
Prepares the plots to be filled. More... | |
virtual void | beginRun (art::Run &run, art::ProcessingFrame const &) override |
Reads needed PMT configuration. More... | |
virtual void | produce (art::Event &event, art::ProcessingFrame const &) override |
Creates the data products. More... | |
virtual void | endJob (art::ProcessingFrame const &frame) override |
Remove empty plots. More... | |
Private Member Functions | |
unsigned int | removeWaveformsAround (std::vector< raw::OpDetWaveform const * > &waveforms, double time) const |
Removes waveforms containing time , retuning how many were removed. More... | |
unsigned int | getPretriggerBuffer (sbn::PMTconfiguration const &PMTconfig) const |
Returns the smallest pre-trigger buffer size available among all boards. More... | |
void | setupPlots (art::ProcessingFrame const &frame) |
Creates all the plots to be filled by the module. More... | |
void | buildBaselineGraphs (art::ProcessingFrame const &frame) |
Removes the empty plots. More... | |
Static Private Member Functions | |
static std::vector < std::vector < raw::OpDetWaveform const * > > | groupByChannel (std::vector< raw::OpDetWaveform > const &waveforms) |
Private Attributes | |
art::InputTag const | fOpDetWaveformTag |
Input optical waveform tag. More... | |
unsigned int | fExcludeSpillTimeIfMoreThan |
Minimum number of waveforms when excluding trigger one is allowed. More... | |
unsigned int | fPretriggerSamples |
Samples in the pre-trigger buffer. More... | |
std::optional< art::InputTag > | fPMTconfigTag |
Tag for PMT configuration data product. More... | |
float const | fSampleFraction |
Fraction of pretrigger buffer to use. More... | |
opdet::SharedWaveformBaseline::Params_t | fAlgoParams |
Parameters for the baseline algorithm. More... | |
bool const | fPlotBaselines |
Whether to produce plots. More... | |
double const | fBaselineTimeAverage { 0.0 } |
Width of baseline time profile binning [s]. More... | |
std::string const | fLogCategory |
Category name for the console output stream. More... | |
util::quantities::intervals::nanoseconds | fOpticalTick |
Duration of a PMT digitizer tick. More... | |
std::size_t | fNPlotChannels = 0U |
Number of plotted channels. More... | |
TH2 * | fHBaselines = nullptr |
All baselines, per channel. More... | |
std::vector< std::vector < std::pair< double, double > > > | fBaselinesVsTime |
For each channel, all event times and their baselines. More... | |
Extracts a baseline from PMT waveforms.
This module produces a baseline data product for each optical detector waveform. The algorithm extracts a baseline per channel per event, considering all the waveforms from one channel together, under the assumptions that:
The core of the algorithm is described in its own class, opdet::SharedWaveformBaseline
.
On each event independently, the waveforms are grouped by channel. For each waveform, opdet::SharedWaveformBaseline
considers their first part for baseline calculation. The number of samples of that part is specified as a fraction of the pre-trigger buffer. The pre-trigger buffer includes the samples that were collected before the physics activity that causes the data acquisition happened, and as such is expected to be almost completely free of physics signal and to be made of just electronics noise. The size of this prebuffer is determined in data by the readout configuration, which can be accessed by specifying the parameter PMTconfigurationTag
, and in simulation by a digitization module parameter, which can be replicated here by the parameter PretriggerBufferSize
. The fraction of such buffer used for the baseline estimation is also specified by a configuration parameter (PretriggerBufferFractionForBaseline
). Depending on the value of the configuration parameter ExcludeSpillTimeIfMoreThan
, the one waveform that covers the trigger time may be excluded and not used; the rationale is that there is a conspicuous number of events triggered by the late light of a cosmic ray happening before the beam spill, in which case the activity may contaminate the pre-trigger buffer and could bias the estimation of the baseline.
The result of the opdet::SharedWaveformBaseline
is currently used directly as the baseline for all the waveforms on the channel on that event.
std::vector<icarus::WaveformBaseline>
, with one baseline per input waveform; the baselines are guaranteed to be in the same order as the waveforms in the input collection;std::vector<icarus::WaveformRMS>
, with one baseline RMS per input waveform; the baselines are guaranteed to be in the same order as the waveforms in the input collection;art::Assns<icarus::WaveformBaseline, raw::OpDetWaveform>
and art::Assns<icarus::WaveformRMS, raw::OpDetWaveform>
.Baselines
: baseline distribution, per channel; average baseline [ADC] per event per channel; all waveforms on the same channels in a single event contribute to the average, and channels with no waveforms in an event do not contribute an entry for that event.std::vector<raw::OpDetWaveform>
: a single waveform for each recorded optical detector activity; the activity belongs to a single channel, but there may be multiple waveforms on the same channel.DetectorClocksService
for the determination of the optical tick duration and the trigger time (if the exclusion of waveform with trigger is enabled).TFileService
and Geometry
if PlotBaselines
is enabled.A terse description of the parameters is printed by running lar --print-description PMTWaveformBaselinesFromChannelData
.
OpticalWaveforms
(input tag, mandatory): the data product containing all optical detector waveforms;PretriggerBufferSize
(positive integer, optional): the number of samples collected by the PMT readout before the PMT signal. This number is used as base for the size of the initial part of the waveform to be used in baseline calculation. This and PMTconfigurationTag
parameters are exclusive. This one is expected to be preferred for simulated samples.PMTconfigurationTag
(input tag): the (run) data product containing the PMT readout configuration. This is extracted from the run configuration for data events. The pre-trigger buffer size is read from this data product, and used as base for the size of the initial part of the waveform to be used in baseline calculation. This and PretriggerBufferSize
parameters are exclusive. This one is expected to be preferred for data samples.PretriggerBufferFractionForBaseline
(real, default: 0.5
): the fraction of the pre-trigger buffer (see PretriggerBufferSize
and PMTconfigurationTag
parameters) to be used to extract the baseline.ExcludeSpillTimeIfMoreThan
(integer, default: disable): the minimum number of PMT waveforms on a single channel of a single event, in order for the exclusion of the waveform containing the global trigger to be enabled. By default (huge number) the feature is disabled.AlgoParams
(table): configuration of the core algorithm extracting the baseline from a set of waveforms on the same channel. The configuration is as follows:AcceptedSampleRangeRMS
(real): for a waveform to be considered for the baseline, the values of the samples must stay within a certain range, which is defined as this number of RMS away in either directions from a central value that is a rougher estimation of the baseline.ExcessSampleLimit
(integer): for a waveform to be considered for the baseline, there must be less than this number of samples in a row that are outside of the range defined by AcceptedSampleRangeRMS
parameter.PlotBaselines
(flag, default: true
): whether to produce distributions of the extracted baselines.BaselineTimeAverage
(real number, default: 600.0
): binning of the baseline profile vs. time, in seconds. Requires PlotBaselines
to be set.OutputCategory
(string, default: "PMTWaveformBaselinesFromChannelData"
): label for the category of messages in the console output; this is the label that can be used for filtering messages via MessageFacility service configuration. Definition at line 206 of file PMTWaveformBaselinesFromChannelData_module.cc.
using icarus::PMTWaveformBaselinesFromChannelData::Parameters = art::SharedProducer::Table<Config> |
Definition at line 297 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
explicit |
Definition at line 462 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
overridevirtual |
Prepares the plots to be filled.
Definition at line 529 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
overridevirtual |
Reads needed PMT configuration.
Definition at line 542 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Removes the empty plots.
Definition at line 799 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
overridevirtual |
Remove empty plots.
Definition at line 698 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Returns the smallest pre-trigger buffer size available among all boards.
Definition at line 734 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
staticprivate |
Returns a common baseline for all the specified waveforms
. Returns a vector of waveforms per channel (which is the index).
Definition at line 755 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
overridevirtual |
Creates the data products.
Definition at line 568 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Removes waveforms
containing time
, retuning how many were removed.
Definition at line 771 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Creates all the plots to be filled by the module.
Definition at line 708 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Parameters for the baseline algorithm.
Definition at line 346 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
For each channel, all event times and their baselines.
Definition at line 380 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Width of baseline time profile binning [s].
Definition at line 351 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Minimum number of waveforms when excluding trigger one is allowed.
Definition at line 334 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
All baselines, per channel.
Definition at line 377 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Category name for the console output stream.
Definition at line 353 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Number of plotted channels.
Definition at line 376 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Input optical waveform tag.
Definition at line 331 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Duration of a PMT digitizer tick.
Definition at line 361 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Whether to produce plots.
Definition at line 348 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Tag for PMT configuration data product.
Definition at line 340 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Samples in the pre-trigger buffer.
Definition at line 337 of file PMTWaveformBaselinesFromChannelData_module.cc.
|
private |
Fraction of pretrigger buffer to use.
Definition at line 342 of file PMTWaveformBaselinesFromChannelData_module.cc.