6 #include <boost/algorithm/string/erase.hpp> 8 #include <TGraphErrors.h> 15 const TH1*
const h = book[
name];
16 const TH1*
const reco = book[
base +
"_reconstruction"];
17 const TH1*
const field = book[
base +
"_field"];
20 p.reco = std::make_pair<float, float>(
reco->GetMean(),
reco->GetMeanError());
22 p.field = field->GetMean();
26 const TF1*
const f =
h->GetFunction(
"LA_profile_fit");
29 p.measured = std::make_pair<float, float>(
f->GetParameter(0),
f->GetParError(0));
30 p.chi2 =
f->GetChisquare();
32 p.entries = (unsigned)(
h->GetEntries());
40 const TF1*
const f =
h->GetFunction(
"SymmetryFit");
43 p.measured = std::make_pair<float, float>(
p.reco.first +
f->GetParameter(0),
f->GetParameter(1));
44 p.chi2 =
f->GetParameter(2);
45 p.ndof = (unsigned)(
f->GetParameter(3));
46 p.entries = (
m &
PROB1) ? (
unsigned)book[
base +
"_w1"]->GetEntries()
60 std::map<uint32_t, Result>
results;
62 const uint32_t detid =
63 std::stoul(std::regex_replace(it->first, std::regex(
".*_module(\\d*)_.*"),
std::string(
"\\1")));
70 std::map<std::string, Result>
results;
80 std::map<std::string, std::vector<Result> >
results;
82 const std::string name = std::regex_replace(it->first, std::regex(
"sample\\d*_"),
"");
89 typedef std::map<std::string, std::vector<Result> > results_t;
99 for (
auto const&
p :
group.second) {
103 book.
fill(
p.measured.second,
name +
"_merr", 500, 0, 0.01);
104 book.
fill((
p.measured.first -
p.reco.first) /
p.measured.second,
name +
"_pull", 500, -10, 10);
107 TF1 gaus(
"mygaus",
"gaus");
108 book[
name +
"_measure"]->Fit(&gaus,
"LLQ");
109 book[
name +
"_merr"]->Fit(&gaus,
"LLQ");
110 book[
name +
"_pull"]->Fit(&gaus,
"LLQ");
116 std::map<std::string, std::vector<EnsembleSummary> >
summary;
118 const std::string base = boost::erase_all_copy(it->first,
"_ensembleReco");
120 const TH1*
const reco = it->second;
121 const TH1*
const measure = book[
base +
"_measure"];
122 const TH1*
const merr = book[
base +
"_merr"];
123 const TH1*
const pull = book[
base +
"_pull"];
126 s.samples =
reco->GetEntries();
127 s.truth =
reco->GetMean();
128 s.meanMeasured = std::make_pair<float, float>(measure->GetFunction(
"gaus")->GetParameter(1),
129 measure->GetFunction(
"gaus")->GetParError(1));
130 s.sigmaMeasured = std::make_pair<float, float>(measure->GetFunction(
"gaus")->GetParameter(2),
131 measure->GetFunction(
"gaus")->GetParError(2));
132 s.meanUncertainty = std::make_pair<float, float>(merr->GetFunction(
"gaus")->GetParameter(1),
133 merr->GetFunction(
"gaus")->GetParError(1));
134 s.pull = std::make_pair<float, float>(
pull->GetFunction(
"gaus")->GetParameter(2),
135 pull->GetFunction(
"gaus")->GetParError(2));
144 const std::vector<LA_Filler_Fitter::EnsembleSummary>& ensembles) {
146 std::vector<float>
x,
y, xerr, yerr;
147 for (
auto const& ensemble : ensembles) {
148 x.push_back(ensemble.truth);
150 y.push_back(ensemble.meanMeasured.first);
151 yerr.push_back(ensemble.meanMeasured.second);
153 TGraphErrors graph(
x.size(), &(
x[0]), &(
y[0]), &(xerr[0]), &(yerr[0]));
155 TF1 pol1(
"mypol1",
"pol1");
157 const TF1*
const fit = graph.GetFunction(
"pol1");
159 return std::make_pair(std::make_pair(
fit->GetParameter(0),
fit->GetParError(0)),
160 std::make_pair(
fit->GetParameter(1),
fit->GetParError(1)));
162 std::cerr <<
"Fitting Line Failed " << std::endl <<
e << std::endl;
163 return std::make_pair(std::make_pair(0, 0), std::make_pair(0, 0));
169 for (
auto const& ensemble : ensembles) {
170 const float unc2 =
pow(ensemble.pull.second, 2);
171 p += ensemble.pull.first / unc2;
178 return strm <<
r.reco.first <<
"\t" <<
r.reco.second <<
"\t" <<
r.measured.first <<
"\t" <<
r.measured.second <<
"\t" 179 <<
r.calMeasured.first <<
"\t" <<
r.calMeasured.second <<
"\t" <<
r.field <<
"\t" <<
r.chi2 <<
"\t" 180 <<
r.ndof <<
"\t" <<
r.entries;
184 return strm <<
e.truth <<
"\t" <<
e.meanMeasured.first <<
"\t" <<
e.meanMeasured.second <<
"\t" 185 <<
e.sigmaMeasured.first <<
"\t" <<
e.sigmaMeasured.second <<
"\t" <<
e.meanUncertainty.first <<
"\t" 186 <<
e.meanUncertainty.second <<
"\t" <<
e.pull.first <<
"\t" <<
e.pull.second <<
"\t" <<
e.samples;
static std::map< std::string, Result > layer_results(const Book &, const Method)
void summarize_ensembles(Book &) const
static std::pair< std::pair< float, float >, std::pair< float, float > > offset_slope(const std::vector< EnsembleSummary > &)
static std::map< std::string, std::vector< EnsembleSummary > > ensemble_summary(const Book &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
static Result result(Method, const std::string name, const Book &)
iterator begin(string_t re=".*")
static std::string method(Method m, bool fit=true)
static std::map< std::string, std::vector< Result > > ensemble_results(const Book &, const Method)
void fill(double_t X, const char *name, uint_t NbinsX, double_t Xlow, double_t Xup, double_t W=1)
static std::map< uint32_t, Result > module_results(const Book &, const Method)
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
static float pull(const std::vector< EnsembleSummary > &)
std::ostream & operator<<(std::ostream &strm, const LA_Filler_Fitter::Result &r)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const double ensembleLow_
iterator end(string_t re=".*")