5 #include <boost/algorithm/string/erase.hpp>
10 it->second->SetTitle(
"Mean Cluster Width;tan#theta_{t}");
11 TH1*
const p = it->second;
12 if (
p->GetEntries() < 400) {
14 book[it->first] =
nullptr;
17 p->SetTitle(
";tan#theta_{t};");
18 const float min =
p->GetMinimum();
19 const float max =
p->GetMaximum();
20 float xofmin =
p->GetBinCenter(
p->GetMinimumBin());
21 if (xofmin > 0.0 || xofmin < -0.15)
23 const float xofmax =
p->GetBinCenter(
p->GetMaximumBin());
25 TF1*
const fit =
new TF1(
"LA_profile_fit",
"[2]*(TMath::Abs(x-[0]))+[1]", -1, 1);
26 fit->SetParLimits(0, -0.15, 0.01);
27 fit->SetParLimits(1, 0.6 *
min, 1.25 *
min);
28 fit->SetParLimits(2, 0.1, 10);
29 fit->SetParameters(xofmin,
min, (
max -
min) / fabs(xofmax - xofmin));
31 int badfit =
p->Fit(
fit,
"IEQ",
"", -.5, .3);
33 badfit =
p->Fit(
fit,
"IEQ",
"", -.46, .26);
44 std::vector<Book::iterator> rebin_hists;
46 rebin_hists.push_back(
all);
48 rebin_hists.push_back(w1);
50 rebin_hists.push_back(var_w2);
52 rebin_hists.push_back(var_w3);
56 for (
const auto& it : rebin_hists)
58 it->second->Rebin(rebin > 1 ? rebin < 7 ? rebin : 6 : 1);
67 std::vector<TH1*> fit_hists;
70 fit_hists.push_back(prob_w1);
71 prob_w1->SetTitle(
"Width==1 Probability;tan#theta_{t}-(dx/dz)_{reco}");
73 if (var_w2 != book.
end()) {
75 fit_hists.push_back(var_w2->second);
76 var_w2->second->SetTitle(
"Width==2 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
77 fit_hists.push_back(rmsv_w2);
78 rmsv_w2->SetTitle(
"Width==2 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
80 if (var_w3 != book.
end()) {
82 fit_hists.push_back(var_w3->second);
83 var_w3->second->SetTitle(
"Width==3 Mean Variance;tan#theta_{t}-(dx/dz)_{reco}");
84 fit_hists.push_back(rmsv_w3);
85 rmsv_w3->SetTitle(
"Width==3 RMS Variance;tan#theta_{t}-(dx/dz)_{reco}");
88 if (fit_hists.empty())
90 const unsigned bins = fit_hists[0]->GetNbinsX();
91 const unsigned guess = fit_hists[0]->FindBin(0);
94 for (
auto const&
hist : fit_hists) {
98 chi2->SetTitle(
"Symmetry #chi^{2};tan#theta_{t}-(dx/dz)_{reco}");
105 const double mean =
hist->GetMean();
106 const double rms =
hist->GetRMS();
109 unsigned current_hole(0), max_hole(0);
110 for (
int i = begin;
i <
end;
i++) {
111 if (!
hist->GetBinError(
i))
113 else if (current_hole) {
114 max_hole =
std::max(current_hole, max_hole);
122 const int bins = prof->GetNbinsX();
124 new TH1F(
name.c_str(),
"",
bins, prof->GetBinLowEdge(1), prof->GetBinLowEdge(
bins) + prof->GetBinWidth(
bins));
125 for (
int i = 1;
i <=
bins;
i++) {
126 const double Me = prof->GetBinError(
i);
127 const double neff = prof->GetBinEntries(
129 rms->SetBinContent(
i, Me *
sqrt(neff));
136 const int bins = subset->GetNbinsX();
137 TH1*
const prob =
new TH1F(
138 name.c_str(),
"",
bins, subset->GetBinLowEdge(1), subset->GetBinLowEdge(
bins) + subset->GetBinWidth(
bins));
139 for (
int i = 1;
i <=
bins;
i++) {
140 const double s = subset->GetBinContent(
i);
141 const double T =
total->GetBinContent(
i);
142 const double B =
T -
s;
144 const double p =
T ?
s /
T : 0;
145 const double perr =
T ? ((
s &&
B) ?
sqrt(
s *
s *
B +
B *
B *
s) / (
T *
T) : 1 /
T) : 0;
147 prob->SetBinContent(
i,
p);
148 prob->SetBinError(
i, perr);