8#include "CorrFit3DCFPainter.h"
10#include <RtypesCore.h>
12#include <TVirtualPad.h>
16#include "CorrFit3DCF.h"
17#include "CorrFitFunc.h"
18#include "CorrFitFunc3D.h"
21#include "Femto3DCFPainter.h"
27 void CorrFit3DCFPainter::UpdateParameters() {
28 auto func = (CorrFit3DCF*) fFittedFunc;
30 func->fTempParamsEval[i] = func->GetParameter(i);
32 func->ParametersChanged();
33 for (
auto vec : fFunctions) {
35 if (fx) func->CopyParamsToTF1(fx, kTRUE, kTRUE);
40 TF1* CorrFit3DCFPainter::GetDrawableFunc(TString opt) {
41 if (!fFittedFunc)
return nullptr;
42 return ((CorrFit3DCF*) fFittedFunc)->GetDrawableFunc(opt);
45 void CorrFit3DCFPainter::MakeFunctions() {
46 auto addSingle = [&](TString opt) {
47 std::vector<TF1*> vec;
49 vec.push_back(
nullptr);
52 auto th = GetDrawableFunc(opt);
58 fFunctions.push_back(addSingle(
"x"));
59 fFunctions.push_back(addSingle(
"y"));
60 fFunctions.push_back(addSingle(
"z"));
61 fFunctions.push_back(addSingle(
""));
64 fFunctions.push_back(addSingle(
"x"));
65 fFunctions.push_back(addSingle(
"y"));
66 fFunctions.push_back(addSingle(
"z"));
68 fFunctions.push_back(addSingle(
"xy++"));
69 fFunctions.push_back(addSingle(
"xz++"));
70 fFunctions.push_back(addSingle(
"yz++"));
72 fFunctions.push_back(addSingle(
"xyz+++"));
78 fFunctions.push_back(addSingle(
"x"));
79 fFunctions.push_back(addSingle(
"y"));
80 fFunctions.push_back(addSingle(
"z"));
81 fFunctions.push_back(addSingle(
""));
83 fFunctions.push_back(addSingle(
"xy++"));
84 fFunctions.push_back(addSingle(
"xy+-"));
85 fFunctions.push_back(addSingle(
"yz++"));
86 fFunctions.push_back(addSingle(
""));
88 fFunctions.push_back(addSingle(
"yz+-"));
89 fFunctions.push_back(addSingle(
"xz++"));
90 fFunctions.push_back(addSingle(
"xz+-"));
91 fFunctions.push_back(addSingle(
""));
93 fFunctions.push_back(addSingle(
"xyz+++"));
94 fFunctions.push_back(addSingle(
"xyz+-+"));
95 fFunctions.push_back(addSingle(
"xyz+--"));
96 fFunctions.push_back(addSingle(
"xyz++-"));
99 fFunctions.push_back(addSingle(
"xy"));
100 fFunctions.push_back(addSingle(
"xz"));
101 fFunctions.push_back(addSingle(
"yz"));
104 fFunctions.push_back(addSingle(
"xy"));
105 fFunctions.push_back(addSingle(
"xz"));
106 fFunctions.push_back(addSingle(
"yz"));
111 CorrFit3DCFPainter::CorrFit3DCFPainter(CorrFit3DCF* fit, Femto3DCF* cf) : CorrFitPainter(fit), fCF(cf) {
112 fCFPainter = (Femto3DCFPainter*) fCF->GetPainter();
113 if (fCFPainter) fCFPainter->AddPainter(
this);
114 fLegendPos[0] = 0.05;
115 fLegendPos[1] = 0.05;
116 fLegendPos[2] = 0.95;
117 fLegendPos[3] = 0.95;
120 CorrFit3DCFPainter::~CorrFit3DCFPainter() {}
122 void CorrFit3DCFPainter::InnerPaint() {
124 TString opt = fCFPainter->GetOptionForCorrFit();
125 if (opt.EqualTo(
"")) {
126 Hal::Cout::PrintInfo(Form(
"%s %i not supported options for drawing histogram, corrfit cannot adapt", __FILE__, __LINE__),
127 EInfo::kCriticalError);
129 if (opt.EqualTo(
"fit1")) fDrawOpt = 1;
130 if (opt.EqualTo(
"fit2")) fDrawOpt = 2;
131 if (opt.EqualTo(
"fit3")) fDrawOpt = 3;
132 if (opt.EqualTo(
"fit4")) fDrawOpt = 4;
133 if (opt.EqualTo(
"fit5")) fDrawOpt = 5;
136 fLegendPad = GetPad(4);
137 fDefFuncDrawOpt =
"SAME";
140 fLegendPad = GetPad(9);
141 fDefFuncDrawOpt =
"SAME";
144 fLegendPad = GetPad(4);
145 fDefFuncDrawOpt =
"SAME";
148 fLegendPad = GetPad(4);
149 fDefFuncDrawOpt =
"SAME";
152 fLegendPad = GetPad(4);
153 fDefFuncDrawOpt =
"surf+same";
156 CorrFitPainter::InnerPaint();
159 void CorrFit3DCFPainter::DrawFunctions() {
161 CorrFitPainter::DrawFunctions();
166 auto painter3d = (Femto3DCFPainter*) fCF->GetPainter();
167 std::pair<Double_t, Double_t> range;
168 if (painter3d) { range = painter3d->GetMinMax(); }
169 for (
auto padfunc : fFunctions) {
171 for (
auto func : padfunc) {
173 func->SetMinimum(range.first);
174 func->SetMaximum(range.second);
175 func->Draw(fDefFuncDrawOpt);
Int_t GetParametersNo() const
static void PrintInfo(TString text, Hal::EInfo status)