Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions PWGCF/GenericFramework/Core/FlowContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
if (nMultiBins <= 0)
nMultiBins = multiBins.size() - 1;
if (nMultiBins <= 0) {
printf("Multiplicity axis does not exist");

Check failure on line 57 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return;
}
if (!inputList) {
printf("Input list not specified\n");

Check failure on line 61 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return;
}
if (inputList->GetEntries() < 1) {
printf("Input list empty!\n");

Check failure on line 65 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return;
}
fProf = new TProfile2D(Form("%s_CorrProfile", this->GetName()), "CorrProfile", nMultiBins, &multiBins[0], inputList->GetEntries(), 0.5, inputList->GetEntries() + 0.5);
Expand All @@ -82,11 +82,11 @@
void FlowContainer::Initialize(TObjArray* inputList, int nMultiBins, double MultiMin, double MultiMax, int nRandom)
{
if (!inputList) {
printf("Input list not specified\n");

Check failure on line 85 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return;
}
if (inputList->GetEntries() < 1) {
printf("Input list empty!\n");

Check failure on line 89 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return;
}
fProf = new TProfile2D(Form("%s_CorrProfile", this->GetName()), "CorrProfile", nMultiBins, MultiMin, MultiMax, inputList->GetEntries(), 0.5, inputList->GetEntries() + 0.5);
Expand Down Expand Up @@ -119,7 +119,7 @@
fXAxis = dynamic_cast<TAxis*>(inax->Clone("pTAxis"));
bool success = CreateBinsFromAxis(fXAxis);
if (!success)
printf("Something went wrong setting the x axis!\n");

Check failure on line 122 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
}
void FlowContainer::SetXAxis()
{
Expand All @@ -142,7 +142,7 @@
return -1;
int yin = fProf->GetYaxis()->FindBin(hname);
if (!yin) {
printf("Could not find bin %s\n", hname);

Check failure on line 145 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return -1;
}
fProf->Fill(multi, yin, corr, w);
Expand All @@ -157,11 +157,11 @@
int nBinsX = fProf->GetNbinsX();
int nBinsY = fProf->GetNbinsY();
if ((inpf->GetNbinsX() != nBinsX) || (inpf->GetNbinsY() != nBinsY)) {
printf("Number of bins in two profiles do not match, not doing anything\n");

Check failure on line 160 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return;
}
if (!inpf->GetBinSumw2()->fArray) {
printf("Input profile has no BinSumw2()! Returning\n");

Check failure on line 164 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
return;
}
if (!fProf->GetBinSumw2()->fArray)
Expand All @@ -173,7 +173,7 @@
double* farrProf = fProf->fArray;
for (int ix = 1; ix <= nBinsX; ix++) {
double xval = fProf->GetXaxis()->GetBinCenter(ix);
printf("Processing x-bin %i\n", ix);

Check failure on line 176 in PWGCF/GenericFramework/Core/FlowContainer.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[logging]

Use O2 logging (LOG, LOGF, LOGP).
for (int iy = 1; iy <= nBinsY; iy++) {
double yval = fProf->GetYaxis()->GetBinCenter(iy);
int binno = fProf->FindBin(xval, yval);
Expand Down Expand Up @@ -395,7 +395,7 @@
}
return retSubset;
};
TProfile* FlowContainer::GetCorrXXVsPt(const char* order, double lminmulti, double lmaxmulti)
TH1D* FlowContainer::GetCorrXXVsPt(const char* order, double lminmulti, double lmaxmulti)
{
int minm = 1;
int maxm = fProf->GetXaxis()->GetNbins();
Expand All @@ -408,35 +408,27 @@
if (lmaxmulti > lminmulti)
maxm = fProf->GetXaxis()->FindBin(lmaxmulti - 0.001);
ProfileSubset* rhProfSub = new ProfileSubset(*fProf);
TProfile* retSubset = 0;
TString l_name("");
Ssiz_t l_pos = 0;
while (fIDName.Tokenize(l_name, l_pos)) {
TString ybl1(Form("%s%s_pt_1", l_name.Data(), order));
TString ybl2(Form("%s%s_pt_%i", l_name.Data(), order, fNbinsPt));
int ybn1 = fProf->GetYaxis()->FindBin(ybl1.Data());
int ybn2 = fProf->GetYaxis()->FindBin(ybl2.Data());
rhProfSub->GetYaxis()->SetRange(ybn1, ybn2);
TProfile* tempprof = rhProfSub->GetSubset(kFALSE, "tempprof", minm, maxm, fNbinsPt, fbinsPt);
if (!retSubset) {
TString profname = Form("%s_MultiB_%i_%i", order, minm, maxm);
retSubset = dynamic_cast<TProfile*>(tempprof->Clone(profname.Data()));
} else {
retSubset->Add(tempprof);
TProfile* profY = rhProfSub->ProfileY("profY", minm, maxm);
TH1D* histY = ProfToHist(profY);
TH1D* hist = new TH1D("temphist", "temphist", fNbinsPt, fbinsPt);
for (int ibin = 1; ibin < hist->GetNbinsX(); ibin++) {
TString bLabel = rhProfSub->GetYaxis()->GetBinLabel(ibin + ybn1 - 1);
hist->GetXaxis()->SetBinLabel(ibin, bLabel.Data());
hist->SetBinContent(ibin, histY->GetBinContent(ibin + ybn1 - 1));
hist->SetBinError(ibin, histY->GetBinError(ibin + ybn1 - 1));
}
delete tempprof;
}
delete rhProfSub;
if (fPtRebinEdges) {
TString pnbu(retSubset->GetName());
retSubset->SetName("TempName");
TProfile* tempprof = dynamic_cast<TProfile*>(retSubset->Rebin(fPtRebin, pnbu.Data(), fPtRebinEdges));
delete retSubset;
retSubset = tempprof;
} else {
retSubset->RebinX(fPtRebin);
delete histY;
delete rhProfSub;
return hist;
}
return retSubset;
return nullptr;
};
TH1D* FlowContainer::ProfToHist(TProfile* inpf)
{
Expand All @@ -462,16 +454,18 @@
}
TH1D* FlowContainer::GetHistCorrXXVsPt(const char* order, double lminmulti, double lmaxmulti)
{
TProfile* tpf = GetCorrXXVsPt(order, lminmulti, lmaxmulti);
TH1D* rethist = ProfToHist(tpf);
TH1D* rethist = GetCorrXXVsPt(order, lminmulti, lmaxmulti);
if (!rethist) {
printf("GetCorrXXVsPt return nullptr!");
return nullptr;
}
TProfile* refflow = GetRefFlowProfile(order, lminmulti, lmaxmulti);
if (refflow) {
refflow->RebinX(refflow->GetNbinsX());
rethist->SetBinContent(0, refflow->GetBinContent(1));
rethist->SetBinError(0, refflow->GetBinError(1));
}
delete refflow;
delete tpf;
return rethist;
}
TH1D* FlowContainer::GetVN2(TH1D* cn2)
Expand Down
2 changes: 1 addition & 1 deletion PWGCF/GenericFramework/Core/FlowContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FlowContainer : public TNamed
double* GetMultiRebin(int& nBins);
void SetPropagateErrors(bool newval) { fPropagateErrors = newval; }
TProfile* GetCorrXXVsMulti(const char* order, int l_pti = 0); // pti = 0 for pt-integrated
TProfile* GetCorrXXVsPt(const char* order, double lminmulti = -1, double lmaxmulti = -1); // 0 for multi. integrated
TH1D* GetCorrXXVsPt(const char* order, double lminmulti = -1, double lmaxmulti = -1); // 0 for multi. integrated
TH1D* GetHistCorrXXVsMulti(const char* order, int l_pti = 0); // pti = 0 for pt-integrated
TH1D* GetHistCorrXXVsPt(const char* order, double lminmulti = -1, double lmaxmulti = -1); // 0 for multi. integrated

Expand Down
Loading