144 for(
int graph_idx = 1; graph_idx < graph_list->GetSize();
146 Double_t closest_dist = 99999.;
147 Int_t closest_loop_idx = 0;
148 Int_t closest_fixed_idx = 0;
150 auto* loop_graph =
static_cast<TEfficiencyGraph*
>(graph_list->At(graph_idx));
151 Double_t* fixed_x = fixed_graph->GetX();
152 for(
int i = 0; i < fixed_graph->GetN(); ++i) {
153 if(loop_graph->FindDistToClosestPointX(fixed_x[i]) < closest_dist) {
154 closest_dist = loop_graph->FindDistToClosestPointX(fixed_x[i]);
155 closest_fixed_idx = i;
156 closest_loop_idx = loop_graph->FindClosestPointX(fixed_x[i]);
160 std::cout <<
"Scaling " << graph_idx <<
" graph by "
161 << fixed_graph->GetY()[closest_fixed_idx] / loop_graph->GetY()[closest_loop_idx] << std::endl;
162 loop_graph->Scale((fixed_graph->GetY()[closest_fixed_idx]) / (loop_graph->GetY()[closest_loop_idx]));
174 for(
int mapIdx = 0; mapIdx < static_cast<int>(
fGraphMap.size()); ++mapIdx) {
175 fRelativeFit->SetParName(mapIdx, Form(
"Scale_%d", mapIdx));
187 for(Int_t i = 0; i < 8; ++i) {
188 fRelativeFit->SetParName(i + n_rel_graphs, Form(
"a_%d", i));
203 for(
size_t i = 1; i < n_rel_graphs; ++i) {
216 for(
size_t i = 0; i < 7 + n_rel_graphs; ++i) {
223 for(
size_t i = n_rel_graphs; i < n_rel_graphs + 7; ++i) {
230 for(
size_t i = n_rel_graphs; i < 7 + n_rel_graphs; ++i) {
269 Int_t closest_graph = 0;
270 Double_t dist_to_closest = 99999.;
273 for(Int_t i = 0; i < gList->GetSize(); ++i) {
274 if((
static_cast<TEfficiencyGraph*
>(gList->At(i)))->FindDistToClosestPointX(x[0]) < dist_to_closest) {
275 dist_to_closest = (
static_cast<TEfficiencyGraph*
>(gList->At(i)))->FindDistToClosestPointX(x[0]);
282 for(
int i = 0; i < 9; ++i) {
283 sum += par[i +
fRelativeEffGraph->GetListOfGraphs()->GetSize()] * TMath::Power(TMath::Log(x[0]), i);
286 return TMath::Exp(sum) / par[closest_graph];
288 return TMath::Exp(sum);
305 "TEfficiencyCalibration",
"AbsoluteEfficiency");
308 for(
int i = 0; i < 8; ++i) {
319 Double_t w_avg_numer = 0.0;
320 Double_t w_avg_denom = 0.0;
321 Double_t semi_w_uncert = 0.0;
323 Double_t* y_val = abs_graph->GetY();
324 Double_t* ey_val = abs_graph->GetEY();
325 Double_t* x_val = abs_graph->GetX();
326 for(
int i = 0; i < abs_graph->GetN(); ++i) {
327 Double_t scale = y_val[i] /
fRelativeFit->Eval(x_val[i]);
328 w_avg_numer += scale / TMath::Power(ey_val[i], 2.0);
329 w_avg_denom += 1. / TMath::Power(ey_val[i], 2.0);
331 semi_w_uncert += 1. / TMath::Power(ey_val[0] / y_val[0], 2.0);
334 Double_t w_avg = w_avg_numer / w_avg_denom;
338 fAbsoluteFunc->SetParError(0, TMath::Sqrt(1. / semi_w_uncert) * w_avg);