All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
icarus::opdet::CustomPulseFunctionTool Struct Reference

Creates a CustomPulseFunction pulse shape. More...

Inheritance diagram for icarus::opdet::CustomPulseFunctionTool:
icarus::opdet::SinglePhotonPulseFunctionTool

Classes

struct  Config
 Configuration parameters. More...
 

Public Types

using Parameters = art::ToolConfigTable< Config >
 Tool parameter configuration. More...
 
- Public Types inherited from icarus::opdet::SinglePhotonPulseFunctionTool
using nanoseconds = util::quantities::nanosecond
 Convenience definition for time stored in nanoseconds. More...
 
using PulseFunction_t = icarus::opdet::PhotoelectronPulseFunction< nanoseconds >
 Type of function returned. More...
 

Public Member Functions

 CustomPulseFunctionTool (Parameters const &config)
 Constructor: sets the configuration. More...
 
- Public Member Functions inherited from icarus::opdet::SinglePhotonPulseFunctionTool
virtual ~SinglePhotonPulseFunctionTool ()=default
 
std::unique_ptr< PulseFunction_tgetPulseFunction ()
 Returns an instance of the pulse function. More...
 

Private Member Functions

virtual std::unique_ptr
< PulseFunction_t
doGetPulseFunction () override
 Returns the function that was created at construction time. More...
 

Static Private Member Functions

static std::unique_ptr
< PulseFunction_t
makePulseFunction (Config const &config)
 Creates and returns a pulse function with the specified configuration. More...
 

Private Attributes

std::unique_ptr< PulseFunction_tfPulseFunction
 Function stored while waiting to be delivered. More...
 

Detailed Description

Creates a CustomPulseFunction pulse shape.

See Also
icarus::opdet::SinglePhotonPulseFunctionTool

This tool creates a icarus::opdet::CustomPulseFunction<nanosecond> function to describe an arbitrary pulse shape.

See icarus::opdet::CustomPulseFunction for the details of the function.

Configuration

Run lar --print-description CustomPulseFunctionTool (or read Config data structure) for a short explanation of the meaning of the parameters.

Note
Because of the limitations of FHiCL language in Parameters specification, the names of the parameters need to be simple (e.g. [mu] rather than [mu]).

Definition at line 77 of file CustomPulseFunctionTool_tool.cc.

Member Typedef Documentation

Tool parameter configuration.

Definition at line 106 of file CustomPulseFunctionTool_tool.cc.

Constructor & Destructor Documentation

icarus::opdet::CustomPulseFunctionTool::CustomPulseFunctionTool ( Parameters const &  config)
inline

Constructor: sets the configuration.

Definition at line 109 of file CustomPulseFunctionTool_tool.cc.

110  : fPulseFunction(makePulseFunction(config())) {}
static std::unique_ptr< PulseFunction_t > makePulseFunction(Config const &config)
Creates and returns a pulse function with the specified configuration.
std::unique_ptr< PulseFunction_t > fPulseFunction
Function stored while waiting to be delivered.

Member Function Documentation

virtual std::unique_ptr<PulseFunction_t> icarus::opdet::CustomPulseFunctionTool::doGetPulseFunction ( )
inlineoverrideprivatevirtual

Returns the function that was created at construction time.

Implements icarus::opdet::SinglePhotonPulseFunctionTool.

Definition at line 118 of file CustomPulseFunctionTool_tool.cc.

119  { return std::move(fPulseFunction); }
std::unique_ptr< PulseFunction_t > fPulseFunction
Function stored while waiting to be delivered.
auto icarus::opdet::CustomPulseFunctionTool::makePulseFunction ( Config const &  config)
staticprivate

Creates and returns a pulse function with the specified configuration.

Definition at line 139 of file CustomPulseFunctionTool_tool.cc.

140 {
141 
143 
144  std::string const& expression = config.ShapeFormula();
145 
146  // collect the parameters
147  fhicl::ParameterSet configuredParameters; // will stay empty if not present
148  config.Parameters.get_if_present(configuredParameters);
149  MyFunction_t::PulseParameters_t parameters;
150  for (auto const& parName: configuredParameters.get_names())
151  parameters.emplace_back(parName, configuredParameters.get<double>(parName));
152 
153  std::string const& peakTimeStr = config.PeakTime();
154 
155  try {
156  // try to convert `peakTimeStr` into a nanosecond quantity
157  return std::make_unique<MyFunction_t>(
158  expression,
159  parameters,
160  util::quantities::makeQuantity<nanoseconds>(peakTimeStr, true)
161  );
162  }
163  catch (util::quantities::ValueError const&) {}
165 
166  mf::LogDebug("CustomPulseFunctionTool")
167  << "Parameter PeakTime ('" << peakTimeStr
168  << "') does not seem to be a nanosecond quantity; will try as formula."
169  ;
170 
171  return std::make_unique<MyFunction_t>(expression, parameters, peakTimeStr);
172 
173 } // icarus::opdet::CustomPulseFunctionTool::makePulseFunction()
String representing a quantity has spurious characters after the number.
Definition: quantities.h:1108
Describes the waveform from a single photoelectron.
String representing a quantity has an invalid number.
Definition: quantities.h:1104

Member Data Documentation

std::unique_ptr<PulseFunction_t> icarus::opdet::CustomPulseFunctionTool::fPulseFunction
private

Function stored while waiting to be delivered.

Definition at line 124 of file CustomPulseFunctionTool_tool.cc.


The documentation for this struct was generated from the following file: