Skip to content

Commit d6524c8

Browse files
committed
restore features removed by branch-related shenanigans
1 parent 5024a27 commit d6524c8

3 files changed

Lines changed: 52 additions & 6 deletions

File tree

PWGCF/GenericFramework/Core/FlowPtContainer.cxx

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec& axis, co
398398
LOGF(warning, "Multiplicity axis does not exist");
399399
return;
400400
}
401-
402401
delete fSubList;
403402
fSubList = new TList();
404403
fSubList->SetOwner(kTRUE);
@@ -426,7 +425,6 @@ void FlowPtContainer::initialiseSubevent(const o2::framework::AxisSpec& axis, co
426425
for (const auto& name : histnames) {
427426
fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nMultiBins, multiBins.data()));
428427
}
429-
430428
delete fSubCMList;
431429
fSubCMList = new TList();
432430
fSubCMList->SetOwner(kTRUE);
@@ -475,7 +473,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m
475473
if (mpar == 0) {
476474
mpar = maxOrder;
477475
}
478-
479476
delete fSubList;
480477
fSubList = new TList();
481478
fSubList->SetOwner(kTRUE);
@@ -503,7 +500,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double* xbins, const int& m
503500
for (const auto& name : histnames) {
504501
fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nbinsx, xbins));
505502
}
506-
507503
delete fSubCMList;
508504
fSubCMList = new TList();
509505
fSubCMList->SetOwner(kTRUE);
@@ -579,7 +575,6 @@ void FlowPtContainer::initialiseSubevent(int nbinsx, double xlow, double xhigh,
579575
for (const auto& name : histnames) {
580576
fSubList->Add(new BootstrapProfile(name.c_str(), this->GetTitle(), nbinsx, xlow, xhigh));
581577
}
582-
583578
delete fSubCMList;
584579
fSubCMList = new TList();
585580
fSubCMList->SetOwner(kTRUE);
@@ -694,6 +689,45 @@ void FlowPtContainer::fillPtProfiles(const double& centmult, const double& rn)
694689
}
695690
}
696691
}
692+
bool FlowPtContainer::addPtProfile(const char* name, int observableOrder)
693+
{
694+
if (!fCorrList || !name || (name[0] == 0) || observableOrder < 1 || observableOrder > mpar) {
695+
LOGF(error, "Cannot add pT profile %s for order %d", name ? name : "(null)", observableOrder);
696+
return false;
697+
}
698+
const std::string profileName{name};
699+
if (fCorrList->FindObject(profileName.c_str())) {
700+
LOGF(error, "pT profile %s already exists", profileName.c_str());
701+
return false;
702+
}
703+
auto* original = dynamic_cast<BootstrapProfile*>(fCorrList->At(observableOrder - 1));
704+
const auto* axis = original->GetXaxis();
705+
BootstrapProfile* profile = nullptr;
706+
if (axis->GetXbins()->GetSize() != 0) {
707+
profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXbins()->GetArray());
708+
} else {
709+
profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
710+
}
711+
if (original->fListOfEntries) {
712+
profile->InitializeSubsamples(original->fListOfEntries->GetEntries());
713+
}
714+
fCorrList->Add(profile);
715+
return true;
716+
}
717+
bool FlowPtContainer::fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn)
718+
{
719+
if (!fCorrList || !name || observableOrder < 1 || observableOrder > mpar ||
720+
static_cast<size_t>(observableOrder) >= corrDen.size() || corrDen[observableOrder] == 0. || eventWeight == 0.) {
721+
return false;
722+
}
723+
auto* profile = dynamic_cast<BootstrapProfile*>(fCorrList->FindObject(name));
724+
if (!profile) {
725+
LOGF(error, "pT profile %s has not been booked", name);
726+
return false;
727+
}
728+
profile->FillProfile(mult, corrNum[observableOrder] / corrDen[observableOrder], eventWeight, rn);
729+
return true;
730+
}
697731
void FlowPtContainer::fillSubeventPtProfiles(const double& centmult, const double& rn)
698732
{
699733
int histCounter = 0;

PWGCF/GenericFramework/Core/FlowPtContainer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ class FlowPtContainer : public TNamed
6868
void calculateSubeventCorrelations();
6969
void calculateCMTerms();
7070
void fillPtProfiles(const double& centmult, const double& rn);
71+
// Book and fill a separate pT observable with a weight calculated by the task.
72+
// The task can supply a separate event weight for the same observable.
73+
bool addPtProfile(const char* name, int observableOrder);
74+
bool fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn);
7175
void fillSubeventPtProfiles(const double& centmult, const double& rn);
7276
void fillVnPtCorrProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask);
7377
void fillVnDeltaPtProfiles(const double& centmult, const double& flowval, const double& flowtuples, const double& rn, uint8_t mask);

PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ struct FlowGenericFramework {
878878
if (resonance ? !cfgFill.cfgAnalyseK0Lambda : !cfgFill.cfgAnalyseChargedHadrons) {
879879
continue;
880880
}
881-
const std::string target = source + (source.rfind("npt_v02_", 0) == 0 ? "_w3pc" : "_w2pc");
881+
const std::string target = source + (source.starts_with("npt_v02_") ? "_w3pc" : "_w2pc");
882882
if (doprocessData || doprocessRun2 || doprocessMCReco || doprocessMC) {
883883
registry.addClone(source, target);
884884
}
@@ -1685,6 +1685,8 @@ struct FlowGenericFramework {
16851685
case 5:
16861686
fillFractionProfile<dt>(HIST("npt_v02_Lambda_sb2_w3pc"), HIST("MCGen/npt_v02_Lambda_sb2_w3pc"), pt, centmult, fraction, weight);
16871687
break;
1688+
default:
1689+
return;
16881690
}
16891691
} else {
16901692
switch (index) {
@@ -1700,6 +1702,8 @@ struct FlowGenericFramework {
17001702
case 3:
17011703
fillFractionProfile<dt>(HIST("npt_v02_pr_w3pc"), HIST("MCGen/npt_v02_pr_w3pc"), pt, centmult, fraction, weight);
17021704
break;
1705+
default:
1706+
return;
17031707
}
17041708
}
17051709
} else {
@@ -1723,6 +1727,8 @@ struct FlowGenericFramework {
17231727
case 5:
17241728
fillFractionProfile<dt>(HIST("npt_v0_Lambda_sb2_w2pc"), HIST("MCGen/npt_v0_Lambda_sb2_w2pc"), pt, centmult, fraction, weight);
17251729
break;
1730+
default:
1731+
return;
17261732
}
17271733
} else {
17281734
switch (index) {
@@ -1738,6 +1744,8 @@ struct FlowGenericFramework {
17381744
case 3:
17391745
fillFractionProfile<dt>(HIST("npt_v0_pr_w2pc"), HIST("MCGen/npt_v0_pr_w2pc"), pt, centmult, fraction, weight);
17401746
break;
1747+
default:
1748+
return;
17411749
}
17421750
}
17431751
}

0 commit comments

Comments
 (0)