Skip to content

Commit 9a02de3

Browse files
[PWGLF] Fix histogram axis names + add different encoding options (#12409)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 51e9a9d commit 9a02de3

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

PWGLF/Tasks/Strangeness/strangenessderivedbinnedinfo.cxx

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ struct strangenessderivedbinnedinfo {
124124
Configurable<float> maxIR{"maxIR", -1, "maximum IR collisions"};
125125
} eventSelections;
126126

127+
static constexpr float defaultSqrtScalingParameters[1][4] = {{0.1, 0.1, 0, 128}};
128+
129+
// preselection options
130+
struct : ConfigurableGroup {
131+
std::string prefix = "encodingOpts";
132+
Configurable<bool> useSqrtEncodingForOccupancy{"useSqrtEncodingForOccupancy", false, "Store sqrt(occupancy) instead of occupancy"};
133+
Configurable<bool> useSqrtEncodingForRadius{"useSqrtEncodingForRadius", false, "Store sqrt(radius) instead of radius"};
134+
Configurable<bool> useSqrtScalingForEncodingPt{"useSqrtScalingForEncodingPt", false, "Store sqrt scaling(pT) instead of pT"};
135+
Configurable<LabeledArray<float>> sqrtScalingParameters{"sqrtScalingParameters", {defaultSqrtScalingParameters[0], 4, {"sigma0", "sigma1", "clampMin", "clampMax"}}, "Sqrt scaling parameters"};
136+
} encodingOpts;
137+
127138
struct : ConfigurableGroup {
128139
Configurable<int> v0TypeSelection{"v0Selections.v0TypeSelection", 1, "select on a certain V0 type (leave negative if no selection desired)"};
129140

@@ -246,6 +257,22 @@ struct strangenessderivedbinnedinfo {
246257
// PDG database
247258
Service<o2::framework::O2DatabasePDG> pdgDB;
248259

260+
// Sqrt scaling function
261+
// Author: Marian Ivanov
262+
int codeSqrtScaling(float val, float sigma0, float sigma1, int clampMin, int clampMax)
263+
{
264+
float code_f = std::asinh((sigma1 * val) / sigma0) / sigma0;
265+
return std::clamp(static_cast<int>(std::round(code_f)), clampMin, clampMax);
266+
}
267+
268+
// Function to decode the sqrt scaling
269+
// Author: Marian Ivanov
270+
float decodeSqrtScaling(int code, float sigma0, float sigma1)
271+
{
272+
float code_f = static_cast<float>(code);
273+
return (sigma0 / sigma1) * std::sinh(sigma0 * code_f);
274+
}
275+
249276
void init(InitContext const&)
250277
{
251278
if (analyseK0Short + analyseLambda + analyseAntiLambda + analyseXi + analyseOmega > 1) {
@@ -287,7 +314,16 @@ struct strangenessderivedbinnedinfo {
287314
histos.add("hEventCentrality", "hEventCentrality", kTH1F, {{100, 0.0f, +100.0f}});
288315
histos.add("hEventOccupancy", "hEventOccupancy", kTH1F, {axisOccupancy});
289316

290-
histos.add("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0", "h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0", kTHnSparseF, {axisCentrality, axisOccupancy, axisPt, axisMass, axisRadius, axisPhi, axisEta, axisPtArmV0, axisAlphaV0});
317+
histos.add("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc", "h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc", kTHnSparseF, {axisMass, axisPt, axisPhi, axisEta, axisPtArmV0, axisAlphaV0, axisRadius, axisCentrality, axisOccupancy});
318+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(0)->SetName("Mass");
319+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(1)->SetName("Pt");
320+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(2)->SetName("Phi");
321+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(3)->SetName("Eta");
322+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(4)->SetName("V0PtArm");
323+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(5)->SetName("V0Alpha");
324+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(6)->SetName("Radius");
325+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(7)->SetName("Centrality");
326+
histos.get<THnSparse>(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"))->GetAxis(8)->SetName("Occupancy");
291327

292328
if (cfgSkimmedProcessing) {
293329
zorroSummary.setObject(zorro.getZorroSummary());
@@ -472,6 +508,8 @@ struct strangenessderivedbinnedinfo {
472508
} else {
473509
centrality = collision.centFT0C();
474510
occupancy = eventSelections.useFT0CbasedOccupancy ? collision.ft0cOccupancyInTimeRange() : collision.trackOccupancyInTimeRange();
511+
if (encodingOpts.useSqrtEncodingForOccupancy)
512+
occupancy = std::sqrt(occupancy);
475513
}
476514
histos.fill(HIST("hEventCentrality"), centrality);
477515
histos.fill(HIST("hEventOccupancy"), occupancy);
@@ -763,14 +801,17 @@ struct strangenessderivedbinnedinfo {
763801
if (v0.v0Type() != v0Selections.v0TypeSelection && v0Selections.v0TypeSelection > -1)
764802
continue; // skip V0s that are not standard
765803

804+
float pT = encodingOpts.useSqrtScalingForEncodingPt ? codeSqrtScaling(v0.pt(), encodingOpts.sqrtScalingParameters->get("sigma0"), encodingOpts.sqrtScalingParameters->get("sigma1"), encodingOpts.sqrtScalingParameters->get("clampMin"), encodingOpts.sqrtScalingParameters->get("clampMax")) : v0.pt();
805+
float decayRadius = encodingOpts.useSqrtEncodingForRadius ? std::sqrt(v0.v0radius()) : v0.v0radius();
806+
766807
if (analyseK0Short && isV0Selected(v0, collision, v0.yK0Short())) {
767-
histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mK0Short(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha());
808+
histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mK0Short(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy);
768809
}
769810
if (analyseLambda && isV0Selected(v0, collision, v0.yLambda())) {
770-
histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mLambda(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha());
811+
histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mLambda(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy);
771812
}
772813
if (analyseAntiLambda && isV0Selected(v0, collision, v0.yLambda())) {
773-
histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, v0.pt(), v0.mAntiLambda(), v0.v0radius(), v0.phi(), v0.eta(), v0.qtarm(), v0.alpha());
814+
histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), v0.mAntiLambda(), pT, v0.phi(), v0.eta(), v0.qtarm(), v0.alpha(), decayRadius, centrality, occupancy);
774815
}
775816
} // end v0 loop
776817
}
@@ -782,11 +823,14 @@ struct strangenessderivedbinnedinfo {
782823
std::abs(cascade.bacheloreta()) > cascSelections.daughterEtaCut)
783824
continue; // remove acceptance that's badly reproduced by MC / superfluous in future
784825

826+
float pT = encodingOpts.useSqrtScalingForEncodingPt ? codeSqrtScaling(cascade.pt(), encodingOpts.sqrtScalingParameters->get("sigma0"), encodingOpts.sqrtScalingParameters->get("sigma1"), encodingOpts.sqrtScalingParameters->get("clampMin"), encodingOpts.sqrtScalingParameters->get("clampMax")) : cascade.pt();
827+
float decayRadius = encodingOpts.useSqrtEncodingForRadius ? std::sqrt(cascade.cascradius()) : cascade.cascradius();
828+
785829
if (analyseXi && isCascadeSelected(cascade, collision, cascade.yXi())) {
786-
histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, cascade.pt(), cascade.m(1), cascade.cascradius(), cascade.phi(), cascade.eta(), 0., 0.);
830+
histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(1), pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy);
787831
}
788832
if (analyseOmega && isCascadeSelected(cascade, collision, cascade.yOmega())) {
789-
histos.fill(HIST("h9dCentOccQoverPtMassRadiusPhiEtaPtArmV0AlphaV0"), centrality, occupancy, cascade.pt(), cascade.m(2), cascade.cascradius(), cascade.phi(), cascade.eta(), 0., 0.);
833+
histos.fill(HIST("h9dMassPtPhiEtaPtArmV0AlphaV0RadiusCentOcc"), cascade.m(2), pT, cascade.phi(), cascade.eta(), 0., 0., decayRadius, centrality, occupancy);
790834
}
791835
} // end cascade loop
792836
}

0 commit comments

Comments
 (0)