Skip to content

Commit 9ca8633

Browse files
committed
flowGenericFramework.cxx: Additional histograms for different event weightings
1 parent 0c9e90a commit 9ca8633

3 files changed

Lines changed: 330 additions & 51 deletions

File tree

PWGCF/GenericFramework/Core/FlowPtContainer.cxx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,45 @@ void FlowPtContainer::fillPtProfiles(const double& centmult, const double& rn)
707707
}
708708
return;
709709
}
710+
bool FlowPtContainer::addPtProfile(const char* name, int observableOrder)
711+
{
712+
if (!fCorrList || !name || !name[0] || observableOrder < 1 || observableOrder > mpar) {
713+
LOGF(error, "Cannot add pT profile %s for order %d", name ? name : "(null)", observableOrder);
714+
return false;
715+
}
716+
const std::string profileName{name};
717+
if (fCorrList->FindObject(profileName.c_str())) {
718+
LOGF(error, "pT profile %s already exists", profileName.c_str());
719+
return false;
720+
}
721+
auto* original = dynamic_cast<BootstrapProfile*>(fCorrList->At(observableOrder - 1));
722+
const auto* axis = original->GetXaxis();
723+
BootstrapProfile* profile = nullptr;
724+
if (axis->GetXbins()->GetSize()) {
725+
profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXbins()->GetArray());
726+
} else {
727+
profile = new BootstrapProfile(profileName.c_str(), profileName.c_str(), axis->GetNbins(), axis->GetXmin(), axis->GetXmax());
728+
}
729+
if (original->fListOfEntries) {
730+
profile->InitializeSubsamples(original->fListOfEntries->GetEntries());
731+
}
732+
fCorrList->Add(profile);
733+
return true;
734+
}
735+
bool FlowPtContainer::fillPtProfile(const char* name, int observableOrder, double mult, double eventWeight, double rn)
736+
{
737+
if (!fCorrList || !name || observableOrder < 1 || observableOrder > mpar ||
738+
static_cast<size_t>(observableOrder) >= corrDen.size() || corrDen[observableOrder] == 0. || eventWeight == 0.) {
739+
return false;
740+
}
741+
auto* profile = dynamic_cast<BootstrapProfile*>(fCorrList->FindObject(name));
742+
if (!profile) {
743+
LOGF(error, "pT profile %s has not been booked", name);
744+
return false;
745+
}
746+
profile->FillProfile(mult, corrNum[observableOrder] / corrDen[observableOrder], eventWeight, rn);
747+
return true;
748+
}
710749
void FlowPtContainer::fillSubeventPtProfiles(const double& centmult, const double& rn)
711750
{
712751
int histCounter = 0;

PWGCF/GenericFramework/Core/FlowPtContainer.h

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

0 commit comments

Comments
 (0)