Skip to content

Commit daf5b60

Browse files
authored
[Common] Sanitize power-law mapping in corner cases (#12827)
1 parent c7b30b4 commit daf5b60

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

Common/Tools/Multiplicity/MultModule.h

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ class MultModule
440440
internalOpts.mEnabledTables.resize(nTablesConst, 0);
441441

442442
LOGF(info, "Configuring tables to generate");
443+
LOGF(info, "Metadata information: isMC? %i", metadataInfo.isMC());
443444
const auto& workflows = context.services().template get<o2::framework::RunningWorkflowInfo const>();
444445

445446
TString listOfRequestors[nTablesConst];
@@ -505,16 +506,6 @@ class MultModule
505506
listOfRequestors[kPVMults].Append(Form("%s ", "dependency check"));
506507
}
507508

508-
// capture the need for PYTHIA calibration in Pb-Pb runs
509-
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {
510-
internalOpts.generatorName.value = "PYTHIA";
511-
}
512-
513-
// capture the need for PYTHIA calibration in light ion runs automatically
514-
if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) {
515-
internalOpts.generatorName.value = "PYTHIA";
516-
}
517-
518509
// list enabled tables
519510
for (int i = 0; i < nTablesConst; i++) {
520511
// printout to be improved in the future
@@ -1145,6 +1136,20 @@ class MultModule
11451136
{
11461137
if (bc.runNumber() != mRunNumberCentrality) {
11471138
mRunNumberCentrality = bc.runNumber(); // mark that this run has been attempted already regardless of outcome
1139+
LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());
1140+
1141+
// capture the need for PYTHIA calibration in Pb-Pb runs
1142+
if (metadataInfo.isMC() && mRunNumber >= 544013 && mRunNumber <= 545367) {
1143+
LOGF(info, "This is MC for Pb-Pb. Setting generatorName automatically to PYTHIA");
1144+
internalOpts.generatorName.value = "PYTHIA";
1145+
}
1146+
1147+
// capture the need for PYTHIA calibration in light ion runs automatically
1148+
if (metadataInfo.isMC() && mRunNumber >= 564250 && mRunNumber <= 564472) {
1149+
LOGF(info, "This is MC for light ion runs. Setting generatorName automatically to PYTHIA");
1150+
internalOpts.generatorName.value = "PYTHIA";
1151+
}
1152+
11481153
LOGF(info, "centrality loading procedure for timestamp=%llu, run number=%d", bc.timestamp(), bc.runNumber());
11491154
TList* callst = nullptr;
11501155
// Check if the ccdb path is a root file
@@ -1258,6 +1263,10 @@ class MultModule
12581263
auto populateTable = [&](auto& table, struct CalibrationInfo& estimator, float multiplicity, bool isInelGt0) {
12591264
const bool assignOutOfRange = internalOpts.embedINELgtZEROselection && !isInelGt0;
12601265
auto scaleMC = [](float x, const float pars[6]) {
1266+
float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4];
1267+
if (core < 0.0f) {
1268+
return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN
1269+
}
12611270
return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]);
12621271
};
12631272

@@ -1343,6 +1352,10 @@ class MultModule
13431352
ConfigureCentralityRun2(ccdb, metadataInfo, firstbc);
13441353

13451354
auto scaleMC = [](float x, const float pars[6]) {
1355+
float core = ((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4];
1356+
if (core < 0.0f) {
1357+
return 0.0f; // this should be marked as low multiplicity and not mapped, core^pars[5] would be NaN
1358+
}
13461359
return std::pow(((pars[0] + pars[1] * std::pow(x, pars[2])) - pars[3]) / pars[4], 1.0f / pars[5]);
13471360
};
13481361

0 commit comments

Comments
 (0)