Skip to content

Commit 946d0d8

Browse files
committed
megalinter
1 parent fede4e2 commit 946d0d8

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

PWGCF/TwoParticleCorrelations/Tasks/twoParticleCorrelationsMpi.cxx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ struct TwoParticleCorrelationsMpi {
102102
Configurable<float> cfgCutVertex{"cfgCutVertex", 7.0f, "Accepted z-vertex range"};
103103
Configurable<float> cfgCutPt{"cfgCutPt", 0.5f, "Minimal pT for tracks"};
104104
Configurable<float> cfgCutEta{"cfgCutEta", 0.8f, "Eta range for tracks"};
105+
Configurable<std::pair<float, float>> cfgFlowPtRef{"cfgFlowPtRef", {0.5f, 3.0f}, "Minimum and maximum pT for reference flow particles"};
106+
Configurable<std::pair<float, float>> cfgFlowPtPOI{"cfgFlowPtPOI", {0.5f, 10.0f}, "Minimum and maximum pT for particles of interest in flow correlations"};
105107

106108
Configurable<int> cfgPtOrder{"cfgPtOrder", 1, "Only consider pairs for which pT,1 < pT,2 (0 = OFF, 1 = ON)"};
107109
Configurable<int> cfgTriggerCharge{"cfgTriggerCharge", 0, "Select on charge of trigger particle: 0 = all; 1 = positive; -1 = negative"};
@@ -608,6 +610,17 @@ struct TwoParticleCorrelationsMpi {
608610

609611
// Generic Framework init
610612
AxisSpec ptAxisSpec = axisPtTrigger;
613+
const auto validateFlowPtRange = [&ptAxisSpec](const std::pair<float, float>& range, const char* name) {
614+
if (!std::isfinite(range.first) || !std::isfinite(range.second) || range.first >= range.second) {
615+
LOGF(fatal, "%s must define a finite, increasing pT range; received {%g, %g}", name, range.first, range.second);
616+
}
617+
if (range.first < ptAxisSpec.binEdges.front() || range.second > ptAxisSpec.binEdges.back()) {
618+
LOGF(fatal, "%s={%g, %g} must be contained in axisPtTrigger={%g, %g}",
619+
name, range.first, range.second, ptAxisSpec.binEdges.front(), ptAxisSpec.binEdges.back());
620+
}
621+
};
622+
validateFlowPtRange(cfgFlowPtRef.value, "cfgFlowPtRef");
623+
validateFlowPtRange(cfgFlowPtPOI.value, "cfgFlowPtPOI");
611624
const int nPtBins = static_cast<int>(ptAxisSpec.binEdges.size()) - 1;
612625
fPtAxis = std::make_unique<TAxis>(nPtBins, ptAxisSpec.binEdges.data());
613626
if (cfgRegions->GetSize() < 0) {
@@ -849,9 +862,9 @@ struct TwoParticleCorrelationsMpi {
849862
template <DataType dt, typename TTrack>
850863
inline void fillGFW(const TTrack& track, const float& centMult, const double& posZ)
851864
{
852-
const bool withinPtRef = track.pt() > fPtAxis->GetXmin() && track.pt() < fPtAxis->GetXmax();
853-
const bool withinPtPOI = withinPtRef;
854-
if (!withinPtPOI && !withinPtRef) {
865+
const bool withinPtRef = track.pt() > cfgFlowPtRef->first && track.pt() < cfgFlowPtRef->second;
866+
const bool withinPtPOI = track.pt() > cfgFlowPtPOI->first && track.pt() < cfgFlowPtPOI->second;
867+
if (!withinPtRef && !withinPtPOI) {
855868
return;
856869
}
857870
double wacc = 1.;
@@ -866,14 +879,15 @@ struct TwoParticleCorrelationsMpi {
866879
return;
867880
}
868881
const double weight = weff * wacc;
882+
const int ptBin = fPtAxis->FindBin(track.pt()) - 1;
869883
if (withinPtRef) {
870-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), weight, ReferenceMask);
884+
fGFW->Fill(track.eta(), ptBin, track.phi(), weight, ReferenceMask);
871885
}
872886
if (withinPtPOI) {
873-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), weight, PoiMask);
887+
fGFW->Fill(track.eta(), ptBin, track.phi(), weight, PoiMask);
874888
}
875889
if (withinPtRef && withinPtPOI) {
876-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), weight, OverlapMask);
890+
fGFW->Fill(track.eta(), ptBin, track.phi(), weight, OverlapMask);
877891
}
878892
}
879893

0 commit comments

Comments
 (0)