36 unsigned int const left 37 =
std::max(0U, (width - (
unsigned int) s.length()) / 2);
38 unsigned int const right 39 =
std::max(0U, width - left - (
unsigned int) s.length());
57 { 0.1*
E, 0.1*
E, 0.1*E },
82 template <
typename Stream>
86 float Emin = 0.0,
float Emax = 2.5,
float Estep = 0.1,
87 std::vector<lar::example::ShowerCalibrationGalore::PDGID_t>
const& pids
88 = { 11, 13, 111, 2212, 22 }
95 = std::pair<lar::example::ShowerCalibrationGalore::PDGID_t, std::string>;
96 std::vector<PIDInfo_t>
const KnownPIDs = {
108 PIDInfo_t
const UnknownPID = { 0,
"<unnamed>" };
111 if (Estep == 0.) Estep =
std::abs(Emax - Emin) / 10;
112 if (Emax < Emin) Estep = -
std::abs(Estep);
113 const unsigned int nSteps
114 = (Emax == Emin)? 1U: (
unsigned int)((Emax - Emin)/Estep);
116 constexpr
unsigned int widthE = 7;
117 constexpr
unsigned int widthF = 5;
118 constexpr
unsigned int widthFtoErr = 5;
119 constexpr
unsigned int widthFerr = 5;
120 constexpr
unsigned int widthCorr = widthF + widthFtoErr + widthFerr;
125 for (
auto pid: pids) {
126 auto iKnown = std::find_if(KnownPIDs.begin(), KnownPIDs.end(),
130 if (iKnown == KnownPIDs.end()) {
136 out << centerString(std::get<1>(*iKnown), widthCorr);
141 for (
unsigned int i = 0; i <= nSteps; ++i) {
143 float const E = Emin + i * Estep;
151 for (
auto pid: pids) {
155 << std::fixed <<
std::setw(widthF) << corr.factor
157 << std::fixed <<
std::setw(widthFerr) << corr.error;
void set_total_energy(const std::vector< double > &q)
recob::Shower MakeShower(float E, int bestPlane=2, int ID=1)
virtual Correction_t correction(recob::Shower const &shower, PDGID_t PDGID=unknownID) const =0
Returns the correction for a given reconstructed shower.
Q_EXPORT QTSManip setprecision(int p)
static int max(int a, int b)
Q_EXPORT QTSManip setw(int w)
std::string centerString(std::string const &s, unsigned int width, char pad= ' ')
Returns a string padding s to be centered in a width w.
Interface for a shower calibration service provider.
LArSoft-specific namespace.
unsigned int ShowerCalibrationTableTest(Stream &&out, lar::example::ShowerCalibrationGalore const *calibration, float Emin=0.0, float Emax=2.5, float Estep=0.1, std::vector< lar::example::ShowerCalibrationGalore::PDGID_t > const &pids={11, 13, 111, 2212, 22})
Synthetic test: prints corrections for showers in a energy range.
Interface for a shower calibration service provider.