Skip to content

Commit 32a0b2b

Browse files
committed
modify format and add PID meanpt calculation
1 parent ebcbb4c commit 32a0b2b

File tree

1 file changed

+99
-41
lines changed

1 file changed

+99
-41
lines changed

PWGCF/Flow/Tasks/pidFlowPtCorr.cxx

Lines changed: 99 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ using namespace o2::framework::expressions;
6666
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
6767

6868
struct PidFlowPtCorr {
69-
#pragma region // configurable
69+
// configurable
7070

7171
O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range")
7272
O2_DEFINE_CONFIGURABLE(cfgCutChi2prTPCcls, float, 2.5, "Chi2 per TPC clusters")
@@ -202,9 +202,9 @@ struct PidFlowPtCorr {
202202

203203
AxisSpec axisMultiplicity{{0, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90}, "Centrality (%)"};
204204

205-
#pragma endregion // configurable
205+
// configurable
206206

207-
#pragma region // filter
207+
// filter
208208
// filter and using
209209
// data
210210
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
@@ -227,9 +227,9 @@ struct PidFlowPtCorr {
227227
using FilteredCollisionsWithMCLabel = soa::Filtered<soa::Join<AodCollisions, aod::EvSels, aod::McCollisionLabels>>;
228228
// end using and filter
229229

230-
#pragma endregion // filter
230+
// filter
231231

232-
#pragma region // others
232+
// others
233233

234234
Preslice<aod::Tracks> perCollision = aod::track::collisionId;
235235

@@ -338,11 +338,11 @@ struct PidFlowPtCorr {
338338
std::vector<qaHist> qaHistVector;
339339
// end hists for QA runbyrun
340340

341-
#pragma endregion // others
341+
// others
342342

343343
void init(InitContext const&) // Initialization
344344
{
345-
#pragma region // init and add lots of graphs according to switch
345+
// init and add lots of graphs according to switch
346346
ccdb->setURL(cfgurl.value);
347347
ccdb->setCaching(true);
348348
ccdb->setCreatedNotAfter(cfgnolaterthan.value);
@@ -508,9 +508,8 @@ struct PidFlowPtCorr {
508508

509509
registry.add("hInteractionRate", "", {HistType::kTH1D, {{1000, 0, 1000}}});
510510
// end set bin label for eventcount
511-
#pragma endregion
512511

513-
#pragma region // flow container setup
512+
// flow container setup
514513
// cumulant of flow
515514
// fill TObjArray for charged
516515
TObjArray* oba4Ch = new TObjArray();
@@ -560,6 +559,7 @@ struct PidFlowPtCorr {
560559
// init tprofile3d for <2'> - meanpt
561560
// charged
562561
registry.add("meanptCentNbs/hCharged", "", {HistType::kTProfile3D, {cfgaxisMeanPt, axisMultiplicity, meanptC22GraphOpts.cfgaxisBootstrap}});
562+
registry.add("meanptCentNbs/hChargedMeanpt", "", {HistType::kTProfile3D, {cfgaxisMeanPt, axisMultiplicity, meanptC22GraphOpts.cfgaxisBootstrap}});
563563
// end charged
564564

565565
// pid
@@ -577,9 +577,7 @@ struct PidFlowPtCorr {
577577
// end pid
578578
// end init tprofile3d for <2'> - meanpt
579579

580-
#pragma endregion
581-
582-
#pragma region // fgfw set up and correlation config setup
580+
// fgfw set up and correlation config setup
583581
// Data stored in fGFW
584582
double etaMax = trkQualityOpts.cfgCutEta.value;
585583
double etaGap = cfgEtaGap;
@@ -670,9 +668,7 @@ struct PidFlowPtCorr {
670668

671669
fGFW->CreateRegions(); // finalize the initialization
672670

673-
#pragma endregion
674-
675-
#pragma region // params
671+
// params
676672
// used for event selection
677673
fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x - 3.5*([5]+[6]*x+[7]*x*x+[8]*x*x*x+[9]*x*x*x*x)", 0, 100);
678674
fMultPVCutLow->SetParameters(cfgMultPVCutPara[0], cfgMultPVCutPara[1], cfgMultPVCutPara[2], cfgMultPVCutPara[3], cfgMultPVCutPara[4], cfgMultPVCutPara[5], cfgMultPVCutPara[6], cfgMultPVCutPara[7], cfgMultPVCutPara[8], cfgMultPVCutPara[9]);
@@ -703,11 +699,9 @@ struct PidFlowPtCorr {
703699
funcV3->SetParameters(v3para[0], v3para[1], v3para[2], v3para[3], v3para[4]);
704700
funcV4 = new TF1("funcV4", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
705701
funcV4->SetParameters(v4para[0], v4para[1], v4para[2], v4para[3], v4para[4]);
706-
707-
#pragma endregion
708702
}
709703

710-
#pragma region // pid utils function
704+
// pid utils function
711705

712706
/**
713707
* @brief Identify whether the input track is a Pion
@@ -839,9 +833,9 @@ struct PidFlowPtCorr {
839833
return resultKaon;
840834
}
841835

842-
#pragma endregion // pid util function
836+
// pid util function
843837

844-
#pragma region // other utils
838+
// other utils
845839

846840
double getPidC22InOneEvent(const GFW::CorrConfig& corrconfA, const GFW::CorrConfig& corrconfB)
847841
{
@@ -890,9 +884,9 @@ struct PidFlowPtCorr {
890884
return false;
891885
}
892886

893-
#pragma endregion // other utils
887+
// other utils
894888

895-
#pragma region // fgfw filling helpers
889+
// fgfw filling helpers
896890

897891
/**
898892
* @brief this function is used to fill fFCCh4PtC22
@@ -917,6 +911,7 @@ struct PidFlowPtCorr {
917911
return;
918912

919913
registry.fill(HIST("meanptCentNbs/hCharged"), ptSum / nch, cent, rndm * cfgFlowNbootstrap, val, nch * dnx);
914+
registry.fill(HIST("meanptCentNbs/hChargedMeanpt"), ptSum / nch, cent, rndm * cfgFlowNbootstrap, ptSum / nch, nch * dnx);
920915
}
921916

922917
/**
@@ -1140,9 +1135,9 @@ struct PidFlowPtCorr {
11401135
return;
11411136
}
11421137

1143-
#pragma endregion // fill fgfw helper
1138+
// fill fgfw helper
11441139

1145-
#pragma region // correction apply functions
1140+
// correction apply functions
11461141

11471142
/**
11481143
* @brief load NUE(1D) NUE(2D) NUA graphs
@@ -1380,9 +1375,9 @@ struct PidFlowPtCorr {
13801375
return true;
13811376
}
13821377

1383-
#pragma endregion // correction apply function
1378+
// correction apply function
13841379

1385-
#pragma region // track cut functions
1380+
// track cut functions
13861381

13871382
/**
13881383
* @brief cut MC particles
@@ -1501,9 +1496,9 @@ struct PidFlowPtCorr {
15011496
return true;
15021497
}
15031498

1504-
#pragma endregion // track cut
1499+
// track cut
15051500

1506-
#pragma region // event selection functions
1501+
// event selection functions
15071502

15081503
/**
15091504
* @brief fill eventCount for different function
@@ -1647,13 +1642,13 @@ struct PidFlowPtCorr {
16471642
return true;
16481643
}
16491644

1650-
#pragma endregion // event selection
1645+
// event selection
16511646

1652-
#pragma region // main functions
1647+
// main functions
16531648

16541649
void processData(AodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, AodTracks const& tracks)
16551650
{
1656-
#pragma region // sub region, init
1651+
// sub region, init
16571652
// init
16581653
float rndm = fRndm->Rndm();
16591654
int nTot = tracks.size();
@@ -1730,15 +1725,28 @@ struct PidFlowPtCorr {
17301725
LOGF(info, "====================================");
17311726
}
17321727

1733-
#pragma endregion
1734-
1728+
// val for pid particles
17351729
double pionPtSum = 0;
17361730
double kaonPtSum = 0;
17371731
double protonPtSum = 0;
1732+
17381733
double nPionWeighted = 0;
17391734
double nKaonWeighted = 0;
17401735
double nProtonWeighted = 0;
17411736

1737+
double pionPtSumw2 = 0;
1738+
double kaonPtSumw2 = 0;
1739+
double protonPtSumw2 = 0;
1740+
1741+
double nPionSquare = 0;
1742+
double nKaonSquare = 0;
1743+
double nProtonSquare = 0;
1744+
1745+
double pionPtSquareSum = 0;
1746+
double kaonPtSquareSum = 0;
1747+
double protonPtSquareSum = 0;
1748+
// end val for pid particles
1749+
17421750
/// @note calculate pt
17431751
/// use ITS only
17441752
for (const auto& track : tracks) {
@@ -1783,16 +1791,25 @@ struct PidFlowPtCorr {
17831791
ptSquareSum += weff * weff * track.pt() * track.pt();
17841792

17851793
if (isPion(track)) {
1786-
pionPtSum += weff * track.pt();
17871794
nPionWeighted += weff;
1795+
nPionSquare += weff * weff;
1796+
pionPtSum += weff * track.pt();
1797+
pionPtSumw2 += weff * weff * track.pt();
1798+
pionPtSquareSum += weff * weff * track.pt() * track.pt();
17881799
}
17891800
if (isKaon(track)) {
1790-
kaonPtSum += weff * track.pt();
17911801
nKaonWeighted += weff;
1802+
nKaonSquare += weff * weff;
1803+
kaonPtSum += weff * track.pt();
1804+
kaonPtSumw2 += weff * weff * track.pt();
1805+
kaonPtSquareSum += weff * weff * track.pt() * track.pt();
17921806
}
17931807
if (isProton(track)) {
1794-
protonPtSum += weff * track.pt();
17951808
nProtonWeighted += weff;
1809+
nProtonSquare += weff * weff;
1810+
protonPtSum += weff * track.pt();
1811+
protonPtSumw2 += weff * weff * track.pt();
1812+
protonPtSquareSum += weff * weff * track.pt() * track.pt();
17961813
}
17971814
}
17981815
// end calculate nch and pt
@@ -1946,7 +1963,7 @@ struct PidFlowPtCorr {
19461963
// end fill GFW
19471964
} // end track loop for v2 calculation
19481965

1949-
#pragma region // sub region, fill graphs after 2 loop on all tracks
1966+
// sub region, fill graphs after 2 loop on all tracks
19501967
if (particleAbundanceOpts.cfgOutPutAbundanceDis) {
19511968
registry.fill(HIST("abundance/hNumOfPiEventCount"), numOfPi);
19521969
registry.fill(HIST("abundance/hNumOfKaEventCount"), numOfKa);
@@ -2084,8 +2101,17 @@ struct PidFlowPtCorr {
20842101

20852102
fFCCh->FillProfile("hMeanPt", cent, (ptSum / nch), nch, rndm);
20862103

2104+
if (nPionWeighted > 0)
2105+
fFCPi->FillProfile("hMeanPt", cent, (pionPtSum / nPionWeighted), nPionWeighted, rndm);
2106+
2107+
if (nKaonWeighted > 0)
2108+
fFCKa->FillProfile("hMeanPt", cent, (kaonPtSum / nKaonWeighted), nKaonWeighted, rndm);
2109+
2110+
if (nProtonWeighted > 0)
2111+
fFCPr->FillProfile("hMeanPt", cent, (protonPtSum / nProtonWeighted), nProtonWeighted, rndm);
2112+
20872113
double nchDiff = nch * nch - nchSquare;
2088-
if (nchDiff) {
2114+
if (nchDiff > 1e-3) {
20892115
fFCCh->FillProfile("ptSquareAve", cent,
20902116
(ptSum * ptSum - ptSquareSum) / nchDiff,
20912117
nchDiff, rndm);
@@ -2094,9 +2120,41 @@ struct PidFlowPtCorr {
20942120
(nch * ptSum - ptSumw2) / nchDiff,
20952121
nchDiff, rndm);
20962122
}
2097-
} // end fill hist using fillProfile
20982123

2099-
#pragma endregion
2124+
double pionDiff = nPionWeighted * nPionWeighted - nPionSquare;
2125+
if (pionDiff > 1e-3) {
2126+
fFCPi->FillProfile("ptSquareAve", cent,
2127+
(pionPtSum * pionPtSum - pionPtSquareSum) / pionDiff,
2128+
pionDiff, rndm);
2129+
2130+
fFCPi->FillProfile("ptAve", cent,
2131+
(nPionWeighted * pionPtSum - pionPtSumw2) / pionDiff,
2132+
pionDiff, rndm);
2133+
}
2134+
2135+
double kaonDiff = nKaonWeighted * nKaonWeighted - nKaonSquare;
2136+
if (kaonDiff > 1e-3) {
2137+
fFCKa->FillProfile("ptSquareAve", cent,
2138+
(kaonPtSum * kaonPtSum - kaonPtSquareSum) / kaonDiff,
2139+
kaonDiff, rndm);
2140+
2141+
fFCKa->FillProfile("ptAve", cent,
2142+
(nKaonWeighted * kaonPtSum - kaonPtSumw2) / kaonDiff,
2143+
kaonDiff, rndm);
2144+
}
2145+
2146+
double protonDiff = nProtonWeighted * nProtonWeighted - nProtonSquare;
2147+
if (protonDiff > 1e-3) {
2148+
fFCPr->FillProfile("ptSquareAve", cent,
2149+
(protonPtSum * protonPtSum - protonPtSquareSum) / protonDiff,
2150+
protonDiff, rndm);
2151+
2152+
fFCPr->FillProfile("ptAve", cent,
2153+
(nProtonWeighted * protonPtSum - protonPtSumw2) / protonDiff,
2154+
protonDiff, rndm);
2155+
}
2156+
2157+
} // end fill hist using fillProfile
21002158
}
21012159
PROCESS_SWITCH(PidFlowPtCorr, processData, "", true);
21022160

@@ -2409,7 +2467,7 @@ struct PidFlowPtCorr {
24092467
}
24102468
PROCESS_SWITCH(PidFlowPtCorr, processSim, "function used to do pt eff, NOTE (OutPutMc, processReco, processSim) should be open", true);
24112469

2412-
#pragma endregion // main function
2470+
// main function
24132471
};
24142472

24152473
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)