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

Pedestal "algorithm" reading the pedestals from somewhere else. More...

#include <PedAlgoFixed.h>

Inheritance diagram for pmtana::PedAlgoFixed:
pmtana::PMTPedestalBase

Classes

struct  Config
 
struct  InputSet_t
 Input information. More...
 

Public Types

using Parameters = fhicl::Table< Config >
 

Public Member Functions

 PedAlgoFixed (Parameters const &params, std::string const &name="PedFixed")
 
std::string const & waveformSourceName () const
 Returns the name of the configured waveform source. More...
 
std::string const & pedestalSourceName () const
 Returns the name of the configured pedestal source. More...
 
std::string const & pedestalRMSName () const
 Returns the name of the configured RMS source. More...
 
void setParameters (InputSet_t inputSet)
 Records the current pedestals and RMS per channel. More...
 
void clearParameters ()
 Removes the pedestal and RMS records. More...
 
- Public Member Functions inherited from pmtana::PMTPedestalBase
 PMTPedestalBase (std::string name="noname")
 Default constructor. More...
 
virtual ~PMTPedestalBase ()
 Default destructor. More...
 
const std::string & Name () const
 Name getter. More...
 
bool Evaluate (const pmtana::Waveform_t &wf)
 Method to compute a pedestal. More...
 
double Mean (size_t i) const
 Getter of the pedestal mean value. More...
 
double Sigma (size_t i) const
 Getter of the pedestal standard deviation. More...
 
const pmtana::PedestalMean_tMean () const
 Getter of the pedestal mean value. More...
 
const pmtana::PedestalSigma_tSigma () const
 Getter of the pedestal standard deviation. More...
 

Protected Member Functions

virtual bool ComputePedestal (pmtana::Waveform_t const &waveform, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v) override
 Computes the pedestal of the specified waveform. More...
 
std::pair< InputSet_t const
*, std::size_t > 
findWaveform (pmtana::Waveform_t const &waveform) const
 Returns the input set and index of the specified waveform. More...
 
- Protected Member Functions inherited from pmtana::PMTPedestalBase
virtual bool ComputePedestal (const ::pmtana::Waveform_t &wf, pmtana::PedestalMean_t &mean_v, pmtana::PedestalSigma_t &sigma_v)=0
 

Protected Attributes

std::string fWaveformTag
 Name of the data source for waveforms. More...
 
std::string fPedestalTag
 Name of the data source for pedestals. More...
 
std::string fRMSTag
 Name of the data source for RMS. More...
 
InputSet_t fInput
 The set of input waveforms currently registered. More...
 

Detailed Description

Pedestal "algorithm" reading the pedestals from somewhere else.

Definition at line 64 of file PedAlgoFixed.h.

Member Typedef Documentation

Definition at line 105 of file PedAlgoFixed.h.

Constructor & Destructor Documentation

pmtana::PedAlgoFixed::PedAlgoFixed ( Parameters const &  params,
std::string const &  name = "PedFixed" 
)

Definition at line 29 of file PedAlgoFixed.cxx.

31  , fWaveformTag{ params().WaveformTag() }
32  , fPedestalTag{ params().PedestalTag() }
33  , fRMSTag{ params().RMSTag().value_or(fPedestalTag) }
34  {}
std::string fPedestalTag
Name of the data source for pedestals.
Definition: PedAlgoFixed.h:138
std::string fRMSTag
Name of the data source for RMS.
Definition: PedAlgoFixed.h:139
then echo fcl name
std::string fWaveformTag
Name of the data source for waveforms.
Definition: PedAlgoFixed.h:137

Member Function Documentation

void pmtana::PedAlgoFixed::clearParameters ( )

Removes the pedestal and RMS records.

Definition at line 69 of file PedAlgoFixed.cxx.

69  {
70  fInput = {};
71 } // pmtana::PedAlgoFixed::clearParameters()
InputSet_t fInput
The set of input waveforms currently registered.
Definition: PedAlgoFixed.h:142
bool pmtana::PedAlgoFixed::ComputePedestal ( pmtana::Waveform_t const &  waveform,
pmtana::PedestalMean_t mean_v,
pmtana::PedestalSigma_t sigma_v 
)
overrideprotectedvirtual

Computes the pedestal of the specified waveform.

Parameters
[in]waveformthe waveform to be processed
[out]mean_vthe mean value of the pedestal, tick by tick
[out]sigma_vthe RMS of the pedestal, tick by tick
Returns
whether the pedestal was successfully found

The algorithm is quite simple, since it picks the baseline that was provided in the configuration.

Definition at line 75 of file PedAlgoFixed.cxx.

79  {
80 
81  auto const [ inputSet, waveformIndex ] = findWaveform(wf);
82  if (!inputSet) {
83  // this means that this work is hopeless
84  throw std::logic_error{
85  "pmtana::PedAlgoFixed::ComputePedestal(): input waveform (address="
86  + std::to_string(reinterpret_cast<std::intptr_t>(&wf))
87  + ") not registered in any input (ID: "
89  };
90  }
91 
92  std::size_t const nSamples = inputSet->waveforms[waveformIndex]->size();
93 
94  mean_v.resize(nSamples);
95  std::fill(mean_v.begin(), mean_v.end(), inputSet->pedestals[waveformIndex]);
96 
97  sigma_v.resize(nSamples);
98  std::fill(sigma_v.begin(), sigma_v.end(), inputSet->RMSs[waveformIndex]);
99 
100  return true;
101 
102 } // pmtana::PedAlgoFixed::ComputePedestal()
std::pair< InputSet_t const *, std::size_t > findWaveform(pmtana::Waveform_t const &waveform) const
Returns the input set and index of the specified waveform.
void fill(const art::PtrVector< recob::Hit > &hits, int only_plane)
unsigned int inputID
An unique identifier for this input set.
Definition: PedAlgoFixed.h:71
std::string to_string(WindowPattern const &pattern)
InputSet_t fInput
The set of input waveforms currently registered.
Definition: PedAlgoFixed.h:142
auto pmtana::PedAlgoFixed::findWaveform ( pmtana::Waveform_t const &  waveform) const
protected

Returns the input set and index of the specified waveform.

Definition at line 107 of file PedAlgoFixed.cxx.

109 {
110  InputSet_t const* inputSet = &fInput;
111  auto const wbegin = inputSet->waveforms.begin();
112  auto const wend = inputSet->waveforms.end();
113  if (auto it = std::find(wbegin, wend, &waveform); it == wend)
114  return { nullptr, std::numeric_limits<std::size_t>::max() };
115  else
116  return { inputSet, std::distance(wbegin, it) };
117 
118 } // pmtana::PedAlgoFixed::findWaveform()
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
std::vector< pmtana::Waveform_t const * > waveforms
All the waveforms that are going to process.
Definition: PedAlgoFixed.h:73
InputSet_t fInput
The set of input waveforms currently registered.
Definition: PedAlgoFixed.h:142
std::string const& pmtana::PedAlgoFixed::pedestalRMSName ( ) const
inline

Returns the name of the configured RMS source.

Definition at line 122 of file PedAlgoFixed.h.

122 { return fRMSTag; }
std::string fRMSTag
Name of the data source for RMS.
Definition: PedAlgoFixed.h:139
std::string const& pmtana::PedAlgoFixed::pedestalSourceName ( ) const
inline

Returns the name of the configured pedestal source.

Definition at line 119 of file PedAlgoFixed.h.

119 { return fPedestalTag; }
std::string fPedestalTag
Name of the data source for pedestals.
Definition: PedAlgoFixed.h:138
void pmtana::PedAlgoFixed::setParameters ( InputSet_t  inputSet)

Records the current pedestals and RMS per channel.

Definition at line 50 of file PedAlgoFixed.cxx.

50  {
51  if (
52  (inputSet.pedestals.size() != inputSet.waveforms.size())
53  || (inputSet.RMSs.size() != inputSet.waveforms.size())
54  ) {
55  throw std::runtime_error{
56  "pmtana::PedAlgoFixed::setParameters(): inconsistent sizes of input: "
57  + std::to_string(inputSet.waveforms.size()) + " waveforms, "
58  + std::to_string(inputSet.pedestals.size()) + " pedestals, "
59  + std::to_string(inputSet.RMSs.size()) + " RMS.\n"
60  };
61  }
62 
63  fInput = std::move(inputSet);
64 
65 } // pmtana::PedAlgoFixed::setParameters()
std::string to_string(WindowPattern const &pattern)
InputSet_t fInput
The set of input waveforms currently registered.
Definition: PedAlgoFixed.h:142
std::string const& pmtana::PedAlgoFixed::waveformSourceName ( ) const
inline

Returns the name of the configured waveform source.

Definition at line 116 of file PedAlgoFixed.h.

116 { return fWaveformTag; }
std::string fWaveformTag
Name of the data source for waveforms.
Definition: PedAlgoFixed.h:137

Member Data Documentation

InputSet_t pmtana::PedAlgoFixed::fInput
protected

The set of input waveforms currently registered.

Definition at line 142 of file PedAlgoFixed.h.

std::string pmtana::PedAlgoFixed::fPedestalTag
protected

Name of the data source for pedestals.

Definition at line 138 of file PedAlgoFixed.h.

std::string pmtana::PedAlgoFixed::fRMSTag
protected

Name of the data source for RMS.

Definition at line 139 of file PedAlgoFixed.h.

std::string pmtana::PedAlgoFixed::fWaveformTag
protected

Name of the data source for waveforms.

Definition at line 137 of file PedAlgoFixed.h.


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