8#include "FemtoSHCFPainter.h"
10#include <RtypesCore.h>
11#include <TAttMarker.h>
15#include <TVirtualPad.h>
16#include <initializer_list>
21#include "HistoStyle.h"
28 const int FemtoSHCFPainter::kReBit = 16;
29 const int FemtoSHCFPainter::kImBit = 17;
30 const int FemtoSHCFPainter::kShortBit = 18;
31 const int FemtoSHCFPainter::kSepBit = 19;
37 std::vector<double> yrange;
40 if (!TESTBIT(newFlags, kNumBit) && TESTBIT(newFlags, kDenBit)) { SETBIT(newFlags, kCFBit); }
41 if (Hal::Std::FindParam(opts,
"fit", kTRUE)) {
42 SETBIT(newFlags, kCFBit);
43 CLRBIT(newFlags, kDenBit);
44 CLRBIT(newFlags, kNumBit);
46 if (Hal::Std::FindParam(opts,
"sep", kTRUE)) SETBIT(newFlags, kSepBit);
48 SETBIT(newFlags, kReBit);
49 SETBIT(newFlags, kImBit);
51 if (Hal::Std::FindParam(opts,
"short", kTRUE)) SETBIT(newFlags, kShortBit);
57 SetGlobalPadStyle(style);
60 std::pair<TH1*, TH1*> FemtoSHCFPainter::GetNewHistPair(Int_t l, Int_t m) {
61 std::pair<TH1*, TH1*> res(
nullptr,
nullptr);
82 res.first = fSHCF->
GetCFIm(l, m);
84 res.first = fSHCF->
GetCFRe(l, m);
86 res.first = fSHCF->
GetCFRe(l, m);
87 res.second = fSHCF->
GetCFIm(l, m);
91 res.first = CloneHist(res.first);
92 Hal::Std::CopyHistProp(*fSHCF->
GetNum(), *res.first,
"!tit");
93 if (res.first) SetHistRanges(res.first, l);
96 res.second = CloneHist(res.second);
97 Hal::Std::CopyHistProp(*fSHCF->
GetNum(), *res.second,
"!tit");
98 if (res.second) SetHistRanges(res.second, l);
102 Hal::Std::SetColor(*res.first, fColorIm);
104 Hal::Std::SetColor(*res.first, fColorRe);
106 Hal::Std::SetColor(*res.second, fColorIm);
107 Hal::Std::SetColor(*res.first, fColorRe);
113 void FemtoSHCFPainter::SetHistRanges(TH1* hist, Int_t l) {
115 double max = hist->GetBinContent(hist->GetMaximumBin());
116 double min = hist->GetBinContent(hist->GetMinimumBin());
118 hist->SetMinimum(-1);
122 if (fRangesYY.size() == 4) {
124 hist->SetMinimum(fRangesYY[0]);
125 hist->SetMaximum(fRangesYY[1]);
127 hist->SetMinimum(fRangesYY[2]);
128 hist->SetMaximum(fRangesYY[3]);
131 if (max < 1) { hist->SetMaximum(1); }
135 void FemtoSHCFPainter::MakeHistograms() {
136 fColorIm = fSHCF->fColIm;
137 fColorRe = fSHCF->fColRe;
139 Hal::Std::ResizeVector2D(fHistograms, (lx + 1) * (lx + 1), 2);
140 for (
auto x : fHistograms)
143 for (
int l = 0; l <= fSHCF->
GetLMax(); l++) {
144 for (
int m = -l; m <= l; m++) {
145 auto histos = GetNewHistPair(l, m);
146 int padid = fSHCF->fLmVals.
GetPadId(l, m) - 1;
147 if (fRangesYY.size() == 4) {
148 if (l == 0 && histos.first) {
149 histos.first->SetMinimum(fRangesYY[0]);
150 histos.first->SetMaximum(fRangesYY[1]);
153 histos.first->SetMinimum(fRangesYY[2]);
154 histos.first->SetMaximum(fRangesYY[3]);
157 histos.second->SetMinimum(fRangesYY[2]);
158 histos.second->SetMaximum(fRangesYY[3]);
162 fHistograms[padid][0] = histos.first;
163 fHistograms[padid][1] = histos.second;
164 if (
CheckOpt(kSepBit) && m >= 0) fHistograms[padid][1] =
nullptr;
165 if (
CheckOpt(kSepBit) && m < 0) fHistograms[padid][0] =
nullptr;
167 fHistograms[padid][0] =
nullptr;
168 fHistograms[padid][1] =
nullptr;
170 if (histos.first && !fHistograms[padid][0])
delete histos.first;
171 if (histos.second && !fHistograms[padid][1])
delete histos.second;
176 void FemtoSHCFPainter::AddHistograms(TH1* re, TH1* im) {
177 std::vector<TH1*> pairHist;
178 pairHist.push_back(re);
179 pairHist.push_back(im);
180 fHistograms.push_back(pairHist);
186 if (padsNo != req)
return kFALSE;
191 if (
CheckOpt(kShortBit)) {
return "fit1"; }
192 if (
CheckOpt(kSepBit)) {
return "fit3"; }
196 void FemtoSHCFPainter::ScaleHistograms() {
197 FemtoCFPainter::ScaleHistograms();
199 for (
auto x : fHistograms) {
201 if (y && fRangesYY.size() == 4) {
203 if (count != 0) step = 2;
204 y->SetMinimum(fRangesYY[step]);
205 y->SetMaximum(fRangesYY[step + 1]);
virtual ULong64_t SetOptionInternal(TString opt, ULong64_t prev=0)
virtual TString GetOptionForCorrFit() const
virtual ULong64_t SetOptionInternal(TString opts, ULong64_t prev=0)
virtual void MakePadsAndCanvases()
TH1D * GetCFRe(int el, int em) const
TH1D * GetNumRe(int el, int em) const
TH1D * GetDenRe(int el, int em) const
TH1D * GetNumIm(int el, int em) const
TH1D * GetDenIm(int el, int em) const
TH1D * GetCFIm(int el, int em) const
Int_t GetPadId(Int_t l, Int_t m) const
Bool_t CheckOpt(Int_t opt) const
void MakeCanvasPads(Int_t x=1, Int_t y=1, Int_t canvasNo=0)
Int_t GetPadsNo(Int_t canvasNo=0) const
void ContitionalPattern(TString &option, TString pattern, ULong64_t &drawOpt, Int_t bit, Bool_t remove=kTRUE) const
Bool_t GetPatterns(TString opt, TString flag, std::vector< double > &vals) const