ShowerCalibrationGaloreScale.h
Go to the documentation of this file.
1 /**
2  * @file ShowerCalibrationGaloreScale.h
3  * @brief Shower calibration service provider applying a uniform energy scale
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date April 28, 2016
6  * @see ShowerCalibrationGalore.h
7  * @ingroup ShowerCalibrationGalore
8  *
9  *
10  */
11 
12 
13 #ifndef LAREXAMPLES_SERVICES_SHOWERCALIBRATIONGALORE_PROVIDERS_SHOWERCALIBRATIONGALORESCALE_H
14 #define LAREXAMPLES_SERVICES_SHOWERCALIBRATIONGALORE_PROVIDERS_SHOWERCALIBRATIONGALORESCALE_H
15 
16 
17 // LArSoft libraries
19 
20 // framework libraries
21 #include "fhiclcpp/types/Atom.h"
22 #include "fhiclcpp/types/Table.h"
23 
24 // C/C++ standard libraries
25 #include <sstream>
26 
27 
28 namespace lar {
29  namespace example {
30 
31  /**
32  * @brief A shower calibration service provider applying a uniform scale.
33  * @ingroup ShowerCalibrationGalore
34  * @see @ref ShowerCalibrationGalore "ShowerCalibrationGalore example overview"
35  *
36  * The service provider computes a calibration factor for a reconstructed
37  * shower. The calibration factor is a single number for the whole
38  * detector and for the entire data sample.
39  *
40  * Configuration parameters
41  * -------------------------
42  *
43  * * *factor* (real, _mandatory_): the scale factor to apply
44  * * *error* (real, _mandatory_): the total uncertainty on the correction
45  * factor
46  *
47  */
49  public:
50 
51  //---------------------------------------------------------------------
52  /// Collection of configuration parameters for the service
53  struct Config {
54  using Name = fhicl::Name;
56 
58  Name("factor"),
59  Comment("correction factor to be applied to all particles")
60  };
61 
63  Name("error"),
64  Comment("uncertainty on the correction factor")
65  };
66 
67  }; // struct Config
68 
69  /// Type describing all the parameters
71 
72 
73  //---------------------------------------------------------------------
74  /// Constructor from the complete configuration object
76  : corr(config.factor(), config.error())
77  {}
78 
79  //---------------------------------------------------------------------
80  /// Constructor from a parameter set
83  (parameters_type(pset, { "service_type", "service_provider" })())
84  {}
85 
86 
87  /// @{
88  /// @name Correction query
89 
90  //---------------------------------------------------------------------
91  /**
92  * @brief Returns a correction factor for a given reconstructed shower
93  * @return the uniform energy correction factor
94  * @see correction()
95  *
96  * The returned value includes a correction factor to be applied to
97  * the shower energy to calibrate it, but no uncertainty.
98  *
99  */
100  virtual float correctionFactor
101  (recob::Shower const&, PDGID_t = unknownID) const override
102  { return corr.factor; }
103 
104  /**
105  * @brief Returns the correction for a given reconstructed shower
106  * @return the correction with its uncertainty
107  * @see correctionFactor()
108  *
109  * The returned value includes a correction factor to be applied to
110  * any shower energy to calibrate it, with its global uncertainty.
111  *
112  */
113  virtual Correction_t correction
114  (recob::Shower const&, PDGID_t = unknownID) const override
115  { return corr; }
116 
117  /// @}
118 
119 
120  /// Returns a string with a short report of the current correctionß
121  virtual std::string report() const override
122  {
123  std::ostringstream sstr;
124  sstr << "Uniform correction: " << corr;
125  return sstr.str();
126  }
127 
128 
129  //---------------------------------------------------------------------
130  private:
132 
133  }; // class ShowerCalibrationGaloreScale
134 
135 
136  } // namespace example
137 } // namespace lar
138 
139 
140 #endif // LAREXAMPLES_SERVICES_SHOWERCALIBRATIONGALORE_PROVIDERS_SHOWERCALIBRATIONGALORESCALE_H
141 
virtual Correction_t correction(recob::Shower const &, PDGID_t=unknownID) const override
Returns the correction for a given reconstructed shower.
std::string string
Definition: nybbler.cc:12
A shower calibration service provider applying a uniform scale.
ChannelGroupService::Name Name
error
Definition: include.cc:26
virtual float correctionFactor(recob::Shower const &, PDGID_t=unknownID) const override
Returns a correction factor for a given reconstructed shower.
A correction factor with global uncertainty.
virtual std::string report() const override
Returns a string with a short report of the current correctionß
ShowerCalibrationGaloreScale(fhicl::ParameterSet const &pset)
Constructor from a parameter set.
static Config * config
Definition: config.cpp:1054
ShowerCalibrationGaloreScale(Config const &config)
Constructor from the complete configuration object.
static constexpr PDGID_t unknownID
A mnemonic constant for unknown particle ID.
#define Comment
int PDGID_t
A type representing a particle ID in Particle Data Group convention.
Interface for a shower calibration service provider.
LArSoft-specific namespace.
Collection of configuration parameters for the service.
Interface for a shower calibration service provider.