Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions PWGHF/TableProducer/mcPidTof.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@
Produces<o2::aod::TOFEvTime> tableEvTime;
Produces<o2::aod::EvTimeTOFOnly> tableEvTimeTOFOnly;
Produces<o2::aod::pidEvTimeFlags> tableFlags;
static constexpr bool removeTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF

Check failure on line 450 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
static constexpr float diamond = 6.0; // Collision diamond used in the estimation of the TOF event time

Check failure on line 451 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
static constexpr float errDiamond = diamond * 33.356409f;

Check failure on line 452 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
static constexpr float weightDiamond = 1.f / (errDiamond * errDiamond);

Check failure on line 453 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".

bool enableTableTOFEvTime = false;
bool enableTableEvTimeTOFOnly = false;
Expand Down Expand Up @@ -701,9 +701,9 @@

// Part 3 Nsigma computation

static constexpr int idxPi = 2;

Check failure on line 704 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
static constexpr int idxKa = 3;

Check failure on line 705 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
static constexpr int idxPr = 4;

Check failure on line 706 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".

/// Task to produce the response table
struct mcPidTof {
Expand Down Expand Up @@ -737,6 +737,10 @@
Configurable<std::string> ccdbPath{"ccdbPath", "Users/f/fgrosa/RecalibmcPidTof/", "path for MC recalibration objects in CCDB"};
} mcRecalib;

// list of productions for which the postcalibrations must be turned off (FT0 digitisation fixed)
const std::vector<std::string> prodNoPostCalib = {"LHC24h1c"};
bool enableMcRecalib{false};

HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};

// Running variables
Expand Down Expand Up @@ -793,6 +797,8 @@
}
hnSigmaFull[iSpecie] = histos.add<TH2>(Form("nSigmaFull/%s", particleNames[iSpecie].c_str()), Form("N_{#sigma}^{TOF}(%s)", particleNames[iSpecie].c_str()), kTH2F, {pAxis, nSigmaAxis});
}

enableMcRecalib = mcRecalib.enable;
}

// Reserves an empty table for the given particle ID with size of the given track table
Expand Down Expand Up @@ -870,6 +876,10 @@
std::map<std::string, std::string> metadata;
if (metadataInfo.isFullyDefined()) {
metadata["RecoPassName"] = metadataInfo.get("AnchorPassName");
if (std::find(prodNoPostCalib.begin(), prodNoPostCalib.end(), metadataInfo.get("LPMProductionTag")) != prodNoPostCalib.end()) {
enableMcRecalib = false;
LOGP(warn, "Nsigma postcalibrations turned off for {} (new MC productions have FT0 digitisation fixed)", metadataInfo.get("LPMProductionTag"));
}
} else {
LOGP(error, "Impossible to read metadata! Using default calibrations (2022 apass7)");
metadata["RecoPassName"] = "";
Expand All @@ -896,7 +906,7 @@
template <typename T>
T applyMcRecalib(int pidId, T trackPt, T nSigma)
{
if (nSigma < -998) {

Check failure on line 909 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
return nSigma;
}

Expand Down Expand Up @@ -929,8 +939,8 @@
aod::BCsWithTimestamps const& bcs,
aod::McParticles const&)
{
constexpr auto responsePi = ResponseImplementation<PID::Pion>();

Check failure on line 942 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
constexpr auto responseKa = ResponseImplementation<PID::Kaon>();

Check failure on line 943 in PWGHF/TableProducer/mcPidTof.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/constexpr-constant]

Use UpperCamelCase for names of constexpr constants. Names of special constants may be prefixed with "k".
constexpr auto responsePr = ResponseImplementation<PID::Proton>();

mTOFCalibConfig.processSetup(mRespParamsV3, ccdb, bcs.iteratorAt(0)); // Update the calibration parameters
Expand All @@ -956,7 +966,7 @@
continue;
}

if (mcRecalib.enable) {
if (enableMcRecalib) {
auto runNumber = trk.collision().bc_as<aod::BCsWithTimestamps>().runNumber();
if (runNumber != currentRun) {
// update postcalibration files
Expand All @@ -970,7 +980,7 @@
switch (pidId) {
case idxPi: {
nSigma = responsePi.GetSeparation(mRespParamsV3, trk);
if (mcRecalib.enable && trk.has_mcParticle()) {
if (enableMcRecalib && trk.has_mcParticle()) {
if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
}
Expand All @@ -980,7 +990,7 @@
}
case idxKa: {
nSigma = responseKa.GetSeparation(mRespParamsV3, trk);
if (mcRecalib.enable && trk.has_mcParticle()) {
if (enableMcRecalib && trk.has_mcParticle()) {
if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
}
Expand All @@ -990,7 +1000,7 @@
}
case idxPr: {
nSigma = responsePr.GetSeparation(mRespParamsV3, trk);
if (mcRecalib.enable && trk.has_mcParticle()) {
if (enableMcRecalib && trk.has_mcParticle()) {
if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
}
Expand All @@ -1012,7 +1022,7 @@
case idxPi: {
resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk);
nSigma = responsePi.GetSeparation(mRespParamsV3, trk);
if (mcRecalib.enable && trk.has_mcParticle()) {
if (enableMcRecalib && trk.has_mcParticle()) {
if (std::abs(trk.mcParticle().pdgCode()) == kPiPlus) { // we rescale only true signal
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
}
Expand All @@ -1023,7 +1033,7 @@
case idxKa: {
resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk);
nSigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution);
if (mcRecalib.enable && trk.has_mcParticle()) {
if (enableMcRecalib && trk.has_mcParticle()) {
if (std::abs(trk.mcParticle().pdgCode()) == kKPlus) { // we rescale only true signal
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
}
Expand All @@ -1034,7 +1044,7 @@
case idxPr: {
resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk);
nSigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution);
if (mcRecalib.enable && trk.has_mcParticle()) {
if (enableMcRecalib && trk.has_mcParticle()) {
if (std::abs(trk.mcParticle().pdgCode()) == kProton) { // we rescale only true signal
nSigma = applyMcRecalib(pidId, trk.pt(), nSigma);
}
Expand Down
Loading