9#include "CorrFitMapKstarRstar.h"
12#include "DividedHisto.h"
16 CorrFitMapKstarRstar::CorrFitMapKstarRstar(TString name) :
17 fHisto2d(nullptr), fSplined(nullptr), fFrameScale(1), fFrame(Femto::EKinematics::kPRF) {
21 CorrFitMapKstarRstar::CorrFitMapKstarRstar(
const TH2D& h, Femto::EKinematics kin) :
22 fSplined(nullptr), fFrameScale(1), fFrame(kin) {
23 fHisto2d = (TH2D*) h.Clone();
24 fHisto2d->SetDirectory(
nullptr);
27 CorrFitMapKstarRstar::CorrFitMapKstarRstar(
const CorrFitMapKstarRstar& other) :
28 Object(other), fHisto2d(nullptr), fSplined(nullptr), fFrameScale(other.fFrameScale), fFrame(other.fFrame) {
29 if (other.fHisto2d) fHisto2d = (TH2D*) other.fHisto2d->Clone();
33 Double_t CorrFitMapKstarRstar::Eval(Double_t q, Double_t R)
const {
35 return fSplined->Eval(q, R);
38 CorrFitMapKstarRstar::CorrFitMapKstarRstar(TString name,
45 Femto::EKinematics kin) :
46 fSplined(nullptr), fFrameScale(1.0), fFrame(kin) {
47 fHisto2d =
new TH2D(
"CFMap",
"CFMap", binsKstar, minKstar, maxKstar, binsR, minR, maxR);
51 void CorrFitMapKstarRstar::Recalc(TString extrOpt) {
52 if (fSplined !=
nullptr) {
53 Cout::Text(
"Splinned already exist in CorrFitMap1D::BuildSpline");
57 fSplined =
new Spline2D(fHisto2d, extrOpt);
61 void CorrFitMapKstarRstar::SetFrameScale(Femto::EKinematics kin) {
62 if (kin == fFrame) fFrameScale = 1.0;
63 if (kin == Femto::EKinematics::kLCMS && fFrame == Femto::EKinematics::kPRF) { fFrameScale = 0.5; }
64 if (kin == Femto::EKinematics::kPRF && fFrame == Femto::EKinematics::kLCMS) { fFrameScale = 2.0; }
67 Double_t CorrFitMapKstarRstar::EvalNumError(Double_t q, Double_t R)
const {
69 return fSplined->GetError(q, R) * 1.5;
72 CorrFitMapKstarRstar::~CorrFitMapKstarRstar() {
73 if (fHisto2d)
delete fHisto2d;
74 if (fSplined)
delete fSplined;
77 CorrFitMapKstarRstar& CorrFitMapKstarRstar::operator=(
const CorrFitMapKstarRstar& other) {
78 if (
this == &other)
return *
this;
79 TNamed::operator=(other);
80 if (fHisto2d)
delete fHisto2d;
81 if (fSplined)
delete fSplined;
84 if (other.fHisto2d) { fHisto2d = (TH2D*) other.fHisto2d->Clone(); }
85 if (other.fSplined) { fSplined = (Spline2D*) fSplined->Clone(); }
86 fFrame = other.fFrame;
87 fFrameScale = other.fFrameScale;
91 void CorrFitMapKstarRstar::Add(
const Object* pack) {
93 if (fHisto2d) fHisto2d->
Add(other->fHisto2d);
97 CorrFitMapKstarRstarDiv::CorrFitMapKstarRstarDiv(TString name) :
CorrFitMapKstarRstar(name), fHistoDiv2d(nullptr) {}
99 CorrFitMapKstarRstarDiv::CorrFitMapKstarRstarDiv(
const CorrFitMapKstarRstarDiv& other) : CorrFitMapKstarRstar(other) {
100 fHistoDiv2d = (DividedHisto2D*) other.fHistoDiv2d->Clone();
103 CorrFitMapKstarRstarDiv::CorrFitMapKstarRstarDiv(
const DividedHisto2D& other, Femto::EKinematics kin) : CorrFitMapKstarRstar() {
105 fHistoDiv2d = (DividedHisto2D*) other.Clone();
106 fHisto2d = (TH2D*) fHistoDiv2d->GetHist(kFALSE);
109 CorrFitMapKstarRstarDiv& CorrFitMapKstarRstarDiv::operator=(
const CorrFitMapKstarRstarDiv& other) {
110 if (
this == &other)
return *
this;
111 CorrFitMapKstarRstar::operator=(other);
114 fHistoDiv2d =
nullptr;
116 fHistoDiv2d = (DividedHisto2D*) other.fHistoDiv2d->Clone();
123 fHistoDiv2d->
Add(other->fHistoDiv2d);
126 void CorrFitMapKstarRstarDiv::Recalc(TString opt) {
127 if (fHisto2d)
delete fHisto2d;
128 if (fSplined)
delete fSplined;
130 fHisto2d = (TH2D*) fHistoDiv2d->
GetHist(kFALSE);
131 CorrFitMapKstarRstar::Recalc(opt);
134 CorrFitMapKstarRstarDiv::~CorrFitMapKstarRstarDiv() {
135 if (fHistoDiv2d)
delete fHistoDiv2d;
virtual void Add(const Object *pack)
virtual void Add(const Object *pack)
TH1 * GetHist(Bool_t normalized=kTRUE) const
virtual void Add(const Object *h)
virtual void Add(const Object *pack)