34 (std::string
const&
s,
unsigned int width,
char pad =
' ')
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());
40 return std::string(left, pad) + s + std::string(right, pad);
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;
121 const std::string sep =
" ";
125 for (
auto pid: pids) {
126 auto iKnown = std::find_if(KnownPIDs.begin(), KnownPIDs.end(),
127 [pid](PIDInfo_t
const&
info){
return pid == std::get<0>(
info); }
130 if (iKnown == KnownPIDs.end()) {
131 out << std::setw(widthF) <<
"PID="
132 <<
std::left << std::setw(widthFtoErr + widthFerr) << pid
136 out << centerString(std::get<1>(*iKnown), widthCorr);
141 for (
unsigned int i = 0; i <= nSteps; ++i) {
143 float const E = Emin + i * Estep;
149 << std::fixed << std::setw(widthE) << std::setprecision(3) <<
E;
151 for (
auto pid: pids) {
152 auto corr = calibration->
correction(shower, pid);
155 << std::fixed << std::setw(widthF) << corr.
factor
156 << std::setw(widthFtoErr) <<
" +/- "
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.
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.
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.
then echo File list $list not found else cat $list while read file do echo $file sed s
float factor
correction factor
Interface for a shower calibration service provider.