10#include "FemtoDoubleRatio1DCF.h"
19#include <TCollection.h>
27#include <TVirtualPad.h>
32 DividedHisto1D(name, 3), fFrame(kin), fNumSide(NULL), fDenSide(NULL), fNumLong(NULL), fDenLong(NULL) {}
38 fNum =
new TH1D(Form(
"%s_NumOut", name.Data()), Form(
"%s_NumOut", name.Data()), min, max);
39 fDen =
new TH1D(Form(
"%s_DenOut", name.Data()), Form(
"%s_DenOut", name.Data()), min, max);
40 fNumSide =
new TH1D(Form(
"%s_NumSide", name.Data()), Form(
"%s_NumSide", name.Data()), min, max);
41 fDenSide =
new TH1D(Form(
"%s_DenSide", name.Data()), Form(
"%s_DenSide", name.Data()), min, max);
42 fNumLong =
new TH1D(Form(
"%s_NumLong", name.Data()), Form(
"%s_NumLong", name.Data()), min, max);
43 fDenLong =
new TH1D(Form(
"%s_DenLong", name.Data()), Form(
"%s_DenLong", name.Data()), min, max);
45 SetAxisNames(fNumSide, fDenSide,
"out");
46 SetAxisNames(fNumLong, fDenLong,
"long");
51 TVirtualPad* c1 = gPad;
63 if (gPad == NULL)
new TCanvas();
64 TVirtualPad* c1 = gPad;
65 TVirtualPad* c2 = gPad;
68 if (Hal::Std::FindParam(option,
"same")) { same =
"SAME"; }
69 if (option ==
"num") {
70 if (c1->GetListOfPrimitives()->GetEntries() < 3) c2->Divide(3, 1);
78 }
else if (option ==
"den") {
79 if (c1->GetListOfPrimitives()->GetEntries() < 3) c2->Divide(3, 1);
87 if (c1->GetListOfPrimitives()->GetEntries() < 3) c2->Divide(3, 1);
102 Bool_t batch = gROOT->IsBatch();
103 TString path = Form(
"%s/divided_%i", dir.Data(), counter);
104 gSystem->MakeDirectory(path);
105 gROOT->SetBatch(kTRUE);
106 TCanvas* c1 =
new TCanvas(
"canvas",
"canvas", 0, 0, 1000, 1500);
110 cf1->SetObjectStat(kFALSE);
114 cf2->SetObjectStat(kFALSE);
118 cf3->SetObjectStat(kFALSE);
120 TH1D** nums =
new TH1D*[3];
121 TH1D** dens =
new TH1D*[3];
129 for (
int i = 0; i < 3; i++) {
131 nums[i]->SetLineColor(kGreen);
132 nums[i]->SetObjectStat(kFALSE);
135 for (
int i = 0; i < 3; i++) {
137 dens[i]->SetLineColor(kRed);
138 dens[i]->SetObjectStat(kFALSE);
141 gSystem->mkdir(path);
142 c1->SaveAs(Form(
"%s/divided.root", path.Data()));
147 for (
int i = 0; i < 3; i++) {
153 gROOT->SetBatch(batch);
159 TString option = opt;
160 if (option ==
"out") {
163 }
else if (option ==
"side") {
164 fNumSide->Rebin(ngroup);
165 fDenSide->Rebin(ngroup);
166 }
else if (option ==
"long") {
167 fNumLong->Rebin(ngroup);
168 fDenLong->Rebin(ngroup);
170 Rebin(ngroup,
"out");
171 Rebin(ngroup,
"side");
172 Rebin(ngroup,
"long");
176 void FemtoDoubleRatio1DCF::SetAxisNames(TH1* h1, TH1* h2, TString label) {
177 if (h1 == NULL || h2 == NULL)
return;
179 case Femto::EKinematics::kPRF:
180 h1->GetXaxis()->SetTitle(Form(
"k*^{%s} [GeV/c]", label.Data()));
181 h2->GetXaxis()->SetTitle(Form(
"k*^{%s} [GeV/c]", label.Data()));
184 case Femto::EKinematics::kLCMS:
185 h1->GetXaxis()->SetTitle(Form(
"q_{inv}^{%s} [GeV/c]", label.Data()));
186 h2->GetXaxis()->SetTitle(Form(
"q_{inv}^{%s} [GeV/c]", label.Data()));
198 fNumIsCloned = kTRUE;
199 fDenIsCloned = kTRUE;
200 fNum = (TH1D*) outnum->Clone();
201 fNumSide = (TH1D*) outnum->Clone();
202 fNumLong = (TH1D*) longnum->Clone();
204 fNumIsCloned = kFALSE;
213 fDenIsCloned = kTRUE;
214 fDen = (TH1D*) outden->Clone();
215 fDenSide = (TH1D*) outden->Clone();
216 fDenLong = (TH1D*) longden->Clone();
218 fDenIsCloned = kFALSE;
231 void FemtoDoubleRatio1DCF::Normalize(TH1D* h, TH1D* num, TH1D* den, Int_t dir)
const {
233 Int_t bin_min = h->GetXaxis()->FindBin(
fNormMin[dir]);
234 Int_t bin_max = h->GetXaxis()->FindBin(
fNormMax[dir]);
235 Double_t int_a = num->Integral(bin_min, bin_max);
236 Double_t int_b = den->Integral(bin_min, bin_max);
237 if (int_a != 0 && int_b != 0) { h->Scale(int_b / int_a); }
240 TH1D* FemtoDoubleRatio1DCF::GetCF(Bool_t normalized, Int_t dir)
const {
256 TString numname = num->GetName();
257 TString newname = numname.ReplaceAll(
"Num",
"CF");
258 TString numtitle = num->GetTitle();
259 TString newtitle = numtitle.ReplaceAll(
"Num",
"CF");
260 TH1D* cf = (TH1D) num->Clone(newname);
261 cf->SetTitle(newtitle);
263 if (normalized) Normalize(cf, (TH1D*) num, (TH1D*) den, dir);
270 fNumLong->Add(other->fNumLong);
271 fDenLong->Add(other->fDenLong);
272 fNumSide->Add(other->fNumSide);
273 fDenSide->Add(other->fDenSide);
277 fNumSide = (TH1D*) other.fNumSide->Clone();
278 fDenSide = (TH1D*) other.fDenSide->Clone();
279 fNumLong = (TH1D*) other.fNumLong->Clone();
280 fDenLong = (TH1D*) other.fDenLong->Clone();
281 fFrame = other.fFrame;
286 Double_t total = TMath::Abs(pair->
GetT());
288 if (pair->
GetX() >= 0) {
289 fNum->Fill(total, weight);
291 fNum->Fill(-total, weight);
293 if (pair->
GetY() >= 0) {
294 fNumSide->Fill(total, weight);
296 fNumSide->Fill(-total, weight);
298 if (pair->
GetZ() >= 0) {
299 fNumLong->Fill(total, weight);
301 fNumLong->Fill(-total, weight);
307 Double_t total = TMath::Abs(pair->
GetT());
309 if (pair->
GetX() >= 0) {
310 fDen->Fill(total, weight);
312 fDen->Fill(-total, weight);
314 if (pair->
GetY() >= 0) {
315 fDenSide->Fill(total, weight);
317 fDenSide->Fill(-total, weight);
319 if (pair->
GetZ() >= 0) {
320 fDenLong->Fill(total, weight);
322 fDenLong->Fill(-total, weight);
332 fFrame(Femto::EKinematics::kLCMS) {}
334 FemtoDoubleRatio1DCF::~FemtoDoubleRatio1DCF() {
void SetAxisName(TString name)
virtual TString CommonExtract(Int_t counter, TString dir) const
virtual void Add(const Object *h)
TString GetAxisName() const
TH1D * GetCFSide(Bool_t normalized=kTRUE) const
virtual TString HTMLExtract(Int_t counter=0, TString dir=" ") const
virtual void Draw(Option_t *opt="all")
TH1D * GetSideNum() const
void SetDen(TH1D *outden, TH1D *sideden, TH1D *longden, Bool_t clone=kFALSE)
TH1D * GetLongDen() const
virtual void Add(const Object *h)
TH1D * GetCFOut(Bool_t normalized=kTRUE) const
TH1D * GetSideDen() const
void FillNumObj(TObject *ob)
void FillDenObj(TObject *obj)
TH1D * GetCFLong(Bool_t normalized=kTRUE) const
virtual void Browse(TBrowser *b)
void SetNum(TH1D *outnum, TH1D *sidenum, TH1D *longnum, Bool_t clone=kFALSE)
TH1D * GetLongNum() const
virtual void Rebin(Int_t ngroup, Option_t *opt)
Double_t GetWeight() const