Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
CorrFitKisiel.cxx
1/*
2 * CorrFitKisiel.cxx
3 *
4 * Created on: 27 lis 2015
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "CorrFitKisiel.h"
11
12#include "AnaFile.h"
13#include "CorrFit.h"
14#include "CorrFitMapKstarRstar.h"
15#include "Cout.h"
16#include "DividedHisto.h"
17#include "Package.h"
18#include "Parameter.h"
19
20#include <TAttFill.h>
21#include <TAttMarker.h>
22#include <TAxis.h>
23#include <TClonesArray.h>
24#include <TF1.h>
25#include <TH1.h>
26#include <TH2.h>
27#include <TLegend.h>
28#include <TList.h>
29#include <TObjArray.h>
30#include <TVirtualPad.h>
31
32#include "Std.h"
33#include "StdString.h"
34
35namespace Hal {
36 CorrFitKisiel::CorrFitKisiel(Int_t params) : CorrFit1DCF(params), fSkipError(kFALSE) {}
37
38 void CorrFitKisiel::Check() {
39 CorrFit1DCF::Check();
40 if (fMaps.size() == 0) { Cout::PrintInfo("No maps loaded ", EInfo::kCriticalError); }
41 if (IsParFixed(RadiusID())) {
42 Cout::Text(Form("Radius fixed at %4.3f", GetRadius()));
43 } else {
44 Cout::Text(Form("Radius between %4.3f and %4.3f", fParameters[RadiusID()].GetMin(), fParameters[RadiusID()].GetMax()));
45 }
46 for (unsigned int i = 0; i < fMaps.size(); i++) {
47 fMaps[i]->Recalc();
48 }
49
50 Double_t kstarMin = fDenominatorHistogram->GetXaxis()->GetBinLowEdge(1);
51 Double_t kstarMax = fDenominatorHistogram->GetXaxis()->GetBinUpEdge(fDenominatorHistogram->GetNbinsX());
52 Double_t kstarBins = fDenominatorHistogram->GetNbinsX();
53 Double_t rMin = fParameters[RadiusID()].GetMin();
54 Double_t rMax = fParameters[RadiusID()].GetMax();
55 if (fKinematics == Femto::EKinematics::kLCMS) {
56 kstarMin *= 0.5;
57 kstarMax *= 0.5;
58 }
59 Double_t kstarDx = (kstarMax - kstarMin) / kstarBins;
60
61 Cout::SetLineLenght(150);
62 Cout::Text("CorrFitKisiel::Check test", "M", kWhite);
63 Cout::Database({"ID", "Rmin", "Rmax", "Rstep", "KStarMin", "KstarMax", "KstarStep"});
64 Cout::Database({"Req.",
65 Form("%4.3f", rMin),
66 Form("%4.3f", rMax),
67 "-",
68 Form("%4.3f", kstarMin),
69 Form("%4.3f", kstarMax),
70 Form("%4.3f", kstarDx)});
71
72 auto colEn = [](Color_t Color) {
73#ifdef __linux__
74 if (Color == kRed) {
75 std::cout << "\e[0;31m" << std::endl;
76 } else if (Color == kGreen) {
77 std::cout << "\e[0;32m" << std::endl;
78 }
79#endif
80 };
81
82
83 for (unsigned int i = 0; i < fMaps.size(); i++) {
84 fMaps[i]->SetFrameScale(fKinematics);
85 Double_t R_min = fMaps[i]->GetRmin();
86 Double_t R_max = fMaps[i]->GetRmax();
87 fParameters[RadiusID()].SetMapMin(R_min);
88 fParameters[RadiusID()].SetMapMax(R_max);
89 Int_t R_bins = fMaps[i]->GetNRbins();
90 Double_t Kmin = fMaps[i]->GetKstarMin();
91 Double_t Kmax = fMaps[i]->GetKstarMax();
92 Double_t Kbins = fMaps[i]->GetNKstrbins();
93 if (fMaps[i]->GetFrame() == Femto::EKinematics::kLCMS) {
94 Kmin *= 0.5;
95 Kmax *= 0.5;
96 }
97 Bool_t good = kTRUE;
98 if (R_min > rMin) good = kFALSE;
99 if (R_max < rMax) good = kFALSE;
100 if (Kmin > kstarMin) good = kFALSE;
101 if (Kmax < kstarMax) good = kFALSE;
102 if (good) {
103 colEn(kGreen);
104 } else {
105 colEn(kRed);
106 }
107 TString id = Form("%i", i);
108 TString txtRmin = Form("%4.3f", R_min);
109 TString txtRmax = Form("%4.3f", R_max);
110 TString txtRstep = Form("%4.3f", (R_max - R_min) / R_bins);
111 TString txtKstarmin = Form("%4.3f", Kmin);
112 TString txtKstarmax = Form("%4.3f", Kmax);
113 TString txtKstardelta = Form("%4.3f", (Kmax - Kmin) / Kbins);
114 Cout::Database({id, txtRmin, txtRmax, txtRstep, txtKstarmin, txtKstarmax, txtKstardelta});
115 }
116#ifdef __linux__
117 std::cout << "\e[0;0m" << std::endl;
118#endif
119 Cout::SetLineLenght(100);
120 }
121
122 Double_t CorrFitKisiel::CalculateCF(const Double_t* x, const Double_t* params) const {
123 Double_t r = params[RadiusID()];
124 Double_t l = params[LambdaID()];
125 Double_t n = params[NormID()];
126 Double_t cf = fMaps[0]->Eval(x[0], r);
127 return n * ((cf - 1.0) * l + 1);
128 }
129
130 Double_t CorrFitKisiel::CalculateCFExtrapolated(const Double_t* x, const Double_t* params) const {
131 return CalculateCF(x, params);
132 }
133
134 void CorrFitKisiel::Paint(Bool_t repaint, Bool_t refresh) {
135 return; /*
136CorrFit1DCF::Paint(repaint, kFALSE);
137if (fDrawOptions.DrawNumErr() && fDrawOptions.DrawCf()) {
138 if (fOldNumErr == nullptr) { fOldNumErr = (TH1D*) fDrawHistograms[0]->Clone("sys_err"); }
139 fOldNumErr->SetFillStyle(3001);
140 fOldNumErr->SetFillColor(kGray + 2);
141 Double_t norm = 1;
142 if (fDrawOptions.AutoNorm()) { norm = GetNorm(); }
143 for (int iX = 1; iX <= fDrawHistograms[0]->GetNbinsX(); iX++) {
144 fOldNumErr->SetBinContent(iX, fDrawHistograms[0]->GetBinContent(iX));
145 fOldNumErr->SetBinError(iX, fMaps[0]->EvalNumErrorBin(iX, 1) * norm);
146 }
147
148 fOldNumErr->SetMarkerSize(0);
149 fOldNumErr->SetMinimum(0);
150 if (fDrawOptions.DrawMinMax()) {
151 fOldNumErr->SetMinimum(fDrawOptions.GetMin());
152 fOldNumErr->SetMaximum(fDrawOptions.GetMax());
153 }
154 fOldNumErr->Draw("SAME+E2");
155}
156if (refresh) {
157 fTempPad->Modified(kTRUE);
158 fTempPad->Update();
159}*/
160 }
161
162 CorrFitKisiel::~CorrFitKisiel() {
163 for (unsigned int i = 0; i < fMaps.size(); i++) {
164 delete fMaps[i];
165 }
166 }
167
168 void CorrFitKisiel::LoadMap(TH2D* h, Femto::EKinematics mapFrame) {
169 TString name = Form("CF_map_%i", (int) fMaps.size());
170 CorrFitMapKstarRstar* map = new CorrFitMapKstarRstar(*h, mapFrame);
171 map->SetName(name);
172 fMaps.push_back(map);
173 }
174
175 void CorrFitKisiel::AddMap(CorrFitMapKstarRstar* map) { fMaps.push_back(map); }
176} // namespace Hal