Skip to content

Commit fa50e14

Browse files
committed
add meanPt and deltaPt
1 parent 4139c47 commit fa50e14

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

PWGCF/Flow/Tasks/flowTask.cxx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ struct FlowTask {
304304
registry.add("hDCAz", "DCAz after cuts; DCAz (cm); Pt", {HistType::kTH2D, {{200, -0.5, 0.5}, {200, 0, 5}}});
305305
registry.add("hDCAxy", "DCAxy after cuts; DCAxy (cm); Pt", {HistType::kTH2D, {{200, -0.5, 0.5}, {200, 0, 5}}});
306306
registry.add("hTrackCorrection2d", "Correlation table for number of tracks table; uncorrected track; corrected track", {HistType::kTH2D, {axisNch, axisNch}});
307+
registry.add("hMeanPt", "", {HistType::kTProfile, {axisIndependent}});
308+
registry.add("hDeltaPt", "", {HistType::kTProfile, {axisIndependent}});
309+
registry.add("hMeanPtWithinGap08", "", {HistType::kTProfile, {axisIndependent}});
310+
registry.add("c22_gap08_Weff", "", {HistType::kTProfile, {axisIndependent}});
311+
registry.add("c22_gap08_trackMeanPt", "", {HistType::kTProfile, {axisIndependent}});
312+
registry.add("PtVariance_partA_WithinGap08", "", {HistType::kTProfile, {axisIndependent}});
313+
registry.add("PtVariance_partB_WithinGap08", "", {HistType::kTProfile, {axisIndependent}});
307314
if (doprocessMCGen) {
308315
registry.add("MCGen/MChPhi", "#phi distribution", {HistType::kTH1D, {axisPhi}});
309316
registry.add("MCGen/MChEta", "#eta distribution", {HistType::kTH1D, {axisEta}});
@@ -555,6 +562,25 @@ struct FlowTask {
555562
return;
556563
}
557564

565+
template <char... chars, char... chars2>
566+
void fillpTvnProfile(const GFW::CorrConfig& corrconf, const double& sum_pt, const double& WeffEvent, const ConstStr<chars...>& vnWeff, const ConstStr<chars2...>& vnpT, const double& cent)
567+
{
568+
double meanPt = sum_pt / WeffEvent;
569+
double dnx, val;
570+
dnx = fGFW->Calculate(corrconf, 0, kTRUE).real();
571+
if (dnx == 0)
572+
return;
573+
if (!corrconf.pTDif) {
574+
val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx;
575+
if (std::fabs(val) < 1) {
576+
registry.fill(vnWeff, cent, val, dnx * WeffEvent);
577+
registry.fill(vnpT, cent, val * meanPt, dnx * WeffEvent);
578+
}
579+
return;
580+
}
581+
return;
582+
}
583+
558584
template <DataType dt>
559585
void fillFC(const GFW::CorrConfig& corrconf, const double& cent, const double& rndm)
560586
{
@@ -898,6 +924,10 @@ struct FlowTask {
898924

899925
// track weights
900926
float weff = 1, wacc = 1;
927+
double weffEvent = 0;
928+
double ptSum = 0., ptSum_Gap08 = 0.;
929+
double weffEventWithinGap08 = 0., weffEventSquareWithinGap08 = 0.;
930+
double sumPtsquareWsquareWithinGap08 = 0., sumPtWsquareWithinGap08 = 0.;
901931
double nTracksCorrected = 0;
902932
int magnetfield = 0;
903933
float independent = cent;
@@ -943,6 +973,7 @@ struct FlowTask {
943973
continue;
944974
bool withinPtPOI = (cfgCutPtPOIMin < track.pt()) && (track.pt() < cfgCutPtPOIMax); // within POI pT range
945975
bool withinPtRef = (cfgCutPtRefMin < track.pt()) && (track.pt() < cfgCutPtRefMax); // within RF pT range
976+
bool withinEtaGap08 = (std::abs(track.eta()) < cfgEtaPtPt);
946977
if (cfgOutputNUAWeights) {
947978
if (cfgOutputNUAWeightsRefPt) {
948979
if (withinPtRef)
@@ -978,7 +1009,16 @@ struct FlowTask {
9781009
registry.fill(HIST("hnTPCCrossedRow"), track.tpcNClsCrossedRows());
9791010
registry.fill(HIST("hDCAz"), track.dcaZ(), track.pt());
9801011
registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt());
1012+
weffEvent += weff;
1013+
ptSum += weff * track.pt();
9811014
nTracksCorrected += weff;
1015+
if (withinEtaGap08) {
1016+
ptSum_Gap08 += weff * track.pt();
1017+
sumPtWsquareWithinGap08 += weff * weff * track.pt();
1018+
sumPtsquareWsquareWithinGap08 += weff * weff * track.pt() * track.pt();
1019+
weffEventWithinGap08 += weff;
1020+
weffEventSquareWithinGap08 += weff * weff;
1021+
}
9821022
}
9831023
if (withinPtRef)
9841024
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc * weff, 1);
@@ -993,6 +1033,35 @@ struct FlowTask {
9931033
}
9941034
registry.fill(HIST("hTrackCorrection2d"), tracks.size(), nTracksCorrected);
9951035

1036+
// additional loop to calculate standard error of pT
1037+
double deltaPtSum = 0.;
1038+
double meanPt = ptSum / weffEvent;
1039+
for (const auto& track : tracks) {
1040+
if (!setCurrentParticleWeights(weff, wacc, track.phi(), track.eta(), track.pt(), vtxz))
1041+
continue;
1042+
deltaPtSum += weff * (track.pt() - meanPt) * (track.pt() - meanPt);
1043+
}
1044+
double weffEventDiffWithGap08 = weffEventWithinGap08 * weffEventWithinGap08 - weffEventSquareWithinGap08;
1045+
// MeanPt
1046+
if (weffEvent) {
1047+
registry.fill(HIST("hMeanPt"), independent, ptSum / weffEvent, weffEvent);
1048+
registry.fill(HIST("hDeltaPt"), independent, std::sqrt(deltaPtSum / (weffEvent - 1)), weffEvent);
1049+
}
1050+
if (weffEventWithinGap08)
1051+
registry.fill(HIST("hMeanPtWithinGap08"), independent, ptSum_Gap08 / weffEventWithinGap08, weffEventWithinGap08);
1052+
// c22_gap8 * pt_withGap8
1053+
if (weffEventWithinGap08)
1054+
fillpTvnProfile(corrconfigs.at(7), ptSum_Gap08, weffEventWithinGap08, HIST("c22_gap08_Weff"), HIST("c22_gap08_trackMeanPt"), independent);
1055+
// PtVariance
1056+
if (weffEventDiffWithGap08) {
1057+
registry.fill(HIST("PtVariance_partA_WithinGap08"), independent,
1058+
(ptSum_Gap08 * ptSum_Gap08 - sumPtsquareWsquareWithinGap08) / weffEventDiffWithGap08,
1059+
weffEventDiffWithGap08);
1060+
registry.fill(HIST("PtVariance_partB_WithinGap08"), independent,
1061+
(weffEventWithinGap08 * ptSum_Gap08 - sumPtWsquareWithinGap08) / weffEventDiffWithGap08,
1062+
weffEventDiffWithGap08);
1063+
}
1064+
9961065
// Filling Flow Container
9971066
for (uint l_ind = 0; l_ind < corrconfigs.size(); l_ind++) {
9981067
fillFC<kReco>(corrconfigs.at(l_ind), independent, lRandom);

0 commit comments

Comments
 (0)