LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
HitAlgoMakerToolBase.h
Go to the documentation of this file.
1 
10 #ifndef LARANA_OPTICALDETECTOR_HITALGOMAKERTOOLBASE_H
11 #define LARANA_OPTICALDETECTOR_HITALGOMAKERTOOLBASE_H
12 
13 // LArSoft libraries
17 
18 // framework libraries
21 #include "fhiclcpp/ParameterSet.h"
24 
25 namespace opdet {
26  template <class HitAlgoClass>
28 }
29 
68 template <class HitAlgoClass>
70 
71 public:
72  struct Config {
73 
75  fhicl::Name{"HitAlgoPset"},
76  fhicl::Comment{"configuration of the hit finder algorithm"}};
77 
79  fhicl::Name{"RiseTimeCalculator"},
80  fhicl::Comment{"configuration of the rise time calculator algorithm"}};
81 
82  }; // struct Config
83 
85 
87  HitAlgoMakerToolBase(Parameters const& params);
88 
90  virtual std::unique_ptr<pmtana::PMTPulseRecoBase> makeAlgo() override;
91 
92 protected:
94 
95 }; // opdet::HitAlgoMakerToolBase
96 
97 // -----------------------------------------------------------------------------
98 // --- template implementation
99 // -----------------------------------------------------------------------------
100 template <class HitAlgoClass>
102  : fConfig{params()}
103 {}
104 
105 // -----------------------------------------------------------------------------
106 template <class HitAlgoClass>
107 std::unique_ptr<pmtana::PMTPulseRecoBase> opdet::HitAlgoMakerToolBase<HitAlgoClass>::makeAlgo()
108 {
109 
110  std::unique_ptr<pmtana::RiseTimeCalculatorBase> riseCalcAlgo =
112  art::make_tool<pmtana::RiseTimeCalculatorBase>(
113  fConfig.RiseTimeCalculator.template get_if_present<fhicl::ParameterSet>().value()) :
114  nullptr;
115 
116  return std::make_unique<HitAlgoClass>(fConfig.HitAlgoPset.template get<fhicl::ParameterSet>(),
117  std::move(riseCalcAlgo));
118 
119 } // opdet::HitAlgoMakerToolBase::makeAlgo()
120 
121 // -----------------------------------------------------------------------------
122 
123 #endif // LARANA_OPTICALDETECTOR_HITALGOMAKERTOOLBASE_H
HitAlgoMakerToolBase(Parameters const &params)
Constructor: copies and stores the configuration for the algorithm.
Interfacce class for a tool to calculate the pulse rise time.
virtual std::unique_ptr< pmtana::PMTPulseRecoBase > makeAlgo() override
Creates and returns the algorithm from the configuration on construction.
Base art tool class wrapping a hit algorithm.
double value
Definition: spectrum.C:18
Tool interface for creating a hit finder algorithm.
fhicl::DelegatedParameter HitAlgoPset
Config fConfig
Tool configuration cache.
Class definition file of PMTPulseRecoBase.
Tool interface for creating a hit finder algorithm.
fhicl::OptionalDelegatedParameter RiseTimeCalculator