Skip to content

Commit d36c174

Browse files
prottayCMTProttay Das
andauthored
[PWGLF] added option to equalise width of Q distributions vs centrality and a possible downscale factor for pions (#17482)
Co-authored-by: Prottay Das <prottay@alipap1.cern.ch>
1 parent 2f2c4e0 commit d36c174

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

PWGLF/TableProducer/Common/spvector.cxx

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,22 @@ struct spvector {
247247
Configurable<std::string> confRecentereVzTimeSp3{"confRecentereVzTimeSp3", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 3"};
248248
Configurable<std::string> confRecentereVzTimeSp4{"confRecentereVzTimeSp4", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 4"};
249249
Configurable<std::string> confRecentereVzTimeSp5{"confRecentereVzTimeSp5", "Users/p/prottay/My/Object/Testingwithsparse/NewPbPbpass4_17092024/recenter", "TH3F path for (Vz,time) recentering, cycle 5"};
250+
251+
Configurable<bool> useWidthEqualization{
252+
"useWidthEqualization",
253+
false,
254+
"Apply Q-vector width equalization"};
255+
256+
Configurable<std::string> confWidthSigma{
257+
"confWidthSigma",
258+
"Users/p/prottay/My/Object/ZDC/widthEq",
259+
"TH2F path for Q-vector width equalization"};
260+
261+
Configurable<std::string> confWidthMean{
262+
"confWidthMean",
263+
"Users/p/prottay/My/Object/ZDC/widthEq",
264+
"TH2F path for Q-vector mean equalization"};
265+
250266
} confignewpro;
251267

252268
struct : ConfigurableGroup {
@@ -503,6 +519,59 @@ struct spvector {
503519
std::array<TH3F*, 6> hrecenterecentvySpA{};
504520
std::array<TH3F*, 6> hrecenterecentvzSpA{};
505521
std::array<TH3F*, 5> hrecenterevztimeSpA{};
522+
TH2F* hWidthMean = nullptr;
523+
TH2F* hWidthSigma = nullptr;
524+
525+
bool CorrectWidthEqualization(TH2F* hMean,
526+
TH2F* hWidth,
527+
auto centrality,
528+
auto& qxZDCA,
529+
auto& qyZDCA,
530+
auto& qxZDCC,
531+
auto& qyZDCC)
532+
{
533+
534+
if (!hMean || !hWidth) {
535+
return false;
536+
}
537+
538+
const double meanQxA = hMean->GetBinContent(
539+
hMean->FindBin(centrality + 0.00001, 0.5));
540+
541+
const double meanQyA = hMean->GetBinContent(
542+
hMean->FindBin(centrality + 0.00001, 1.5));
543+
544+
const double meanQxC = hMean->GetBinContent(
545+
hMean->FindBin(centrality + 0.00001, 2.5));
546+
547+
const double meanQyC = hMean->GetBinContent(
548+
hMean->FindBin(centrality + 0.00001, 3.5));
549+
550+
const double sigmaQxA = hWidth->GetBinContent(
551+
hWidth->FindBin(centrality + 0.00001, 0.5));
552+
553+
const double sigmaQyA = hWidth->GetBinContent(
554+
hWidth->FindBin(centrality + 0.00001, 1.5));
555+
556+
const double sigmaQxC = hWidth->GetBinContent(
557+
hWidth->FindBin(centrality + 0.00001, 2.5));
558+
559+
const double sigmaQyC = hWidth->GetBinContent(
560+
hWidth->FindBin(centrality + 0.00001, 3.5));
561+
562+
if (sigmaQxA <= 0.0 || sigmaQyA <= 0.0 ||
563+
sigmaQxC <= 0.0 || sigmaQyC <= 0.0) {
564+
return false;
565+
}
566+
567+
qxZDCA = (qxZDCA - meanQxA) / sigmaQxA;
568+
qyZDCA = (qyZDCA - meanQyA) / sigmaQyA;
569+
570+
qxZDCC = (qxZDCC - meanQxC) / sigmaQxC;
571+
qyZDCC = (qyZDCC - meanQyC) / sigmaQyC;
572+
573+
return true;
574+
}
506575

507576
bool CorrectfineCent(TH2F* hrecenterecentSp,
508577
auto centrality,
@@ -1404,6 +1473,19 @@ struct spvector {
14041473
LOGF(fatal, "Cannot apply fine (cent,Vz) recentering, stage 6");
14051474
}
14061475
}
1476+
1477+
// -------------------- Width equalization --------------------
1478+
if (confignewpro.useWidthEqualization) {
1479+
if (currentRunNumber != lastRunNumber) {
1480+
1481+
hWidthMean = ccdb->getForTimeStamp<TH2F>(confignewpro.confWidthMean.value, bc.timestamp());
1482+
hWidthSigma = ccdb->getForTimeStamp<TH2F>(confignewpro.confWidthSigma.value, bc.timestamp());
1483+
}
1484+
1485+
if (!CorrectWidthEqualization(hWidthMean, hWidthSigma, centrality, qxZDCA, qyZDCA, qxZDCC, qyZDCC)) {
1486+
LOGF(fatal, "Cannot apply Q-vector width equalization");
1487+
}
1488+
}
14071489
}
14081490

14091491
histos.fill(HIST("hpQxZDCAvstime"), timeMin, qxZDCA);

PWGLF/TableProducer/Resonances/cksspinalignment.cxx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ struct cksspinalignment {
120120
Configurable<float> cfgK0sMassMin{"cfgK0sMassMin", 0.45f, "Minimum K0s invariant mass"};
121121
Configurable<float> cfgK0sMassMax{"cfgK0sMassMax", 0.55f, "Maximum K0s invariant mass"};
122122

123+
Configurable<float> cfgKeepFraction{"cfgKeepFraction", 0.4f, "Fraction of events to keep"};
124+
123125
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
124126
RCTFlagsChecker rctChecker;
125127

@@ -136,6 +138,26 @@ struct cksspinalignment {
136138
histos.add("hNStoredPions", "hNStoredPions;N_{#pi};Events", kTH1F, {{500, 0.0f, 500.0f}});
137139
}
138140

141+
bool keepEvent(uint64_t eventIndex) const
142+
{ /*
143+
if (cfgKeepFraction >= 1.0f) {
144+
return true;
145+
}
146+
*/
147+
// SplitMix64 pseudo-random hash
148+
uint64_t x = eventIndex + 0x9e3779b97f4a7c15ULL;
149+
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ULL;
150+
x = (x ^ (x >> 27)) * 0x94d049bb133111ebULL;
151+
x = x ^ (x >> 31);
152+
153+
// Convert hash to uniform random number in [0,1)
154+
const double u =
155+
static_cast<double>(x >> 11) *
156+
(1.0 / 9007199254740992.0);
157+
158+
return u < cfgKeepFraction.value;
159+
}
160+
139161
template <typename T>
140162
bool selectionTrack(const T& candidate)
141163
{
@@ -386,6 +408,10 @@ struct cksspinalignment {
386408
return;
387409
}
388410

411+
if (!keepEvent(static_cast<uint64_t>(collision.globalIndex()))) {
412+
return;
413+
}
414+
389415
histos.fill(HIST("hEvtSelInfo"), 2.5);
390416
histos.fill(HIST("hCent"), centrality);
391417

0 commit comments

Comments
 (0)