From e5f404017983711583098633513999f6ab3bc6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 17 Feb 2025 10:43:49 +0100 Subject: [PATCH 1/7] Update pidTOFMerge.cxx --- Common/TableProducer/PID/pidTOFMerge.cxx | 86 ++++++++++-------------- 1 file changed, 34 insertions(+), 52 deletions(-) diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index 845edc2c6e6..7ea5f25d612 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -869,11 +869,18 @@ struct tofPidMerge { Produces tablePIDFullHe; Produces tablePIDFullAl; + // Beta tables + Produces tablePIDBeta; + Produces tablePIDTOFMass; + bool enableTableBeta = false; + bool enableTableMass = false; + // Detector response parameters o2::pid::tof::TOFResoParamsV3 mRespParamsV3; Service ccdb; TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration Configurable enableQaHistograms{"enableQaHistograms", false, "Flag to enable the QA histograms"}; + Configurable enableTOFParamsForBetaMass{"enableTOFParamsForBetaMass", false, "Flag to use TOF parameters for TOF Beta and Mass"}; // Configuration flags to include and exclude particle hypotheses Configurable> enableParticle{"enableParticle", @@ -947,6 +954,27 @@ struct tofPidMerge { } hnsigmaFull[i] = histos.add(Form("nsigmaFull/%s", particleNames[i].c_str()), Form("N_{#sigma}^{TOF}(%s)", particleNames[i].c_str()), kTH2F, {pAxis, nSigmaAxis}); } + + // Checking the TOF mass and TOF beta tables + enableTableBeta = isTableRequiredInWorkflow(initContext, "pidTOFbeta"); + enableTableMass = isTableRequiredInWorkflow(initContext, "pidTOFmass"); + + if (!enableTableBeta && !enableTableMass) { + LOG(info) << "No table for TOF mass and beta is required. Disabling beta and mass tables"; + doprocessRun2.value = false; + doprocessRun3.value = false; + } else if (mTOFCalibConfig.autoSetProcessFunctions()) { + LOG(info) << "Autodetecting process functions for mass and beta"; + if (metadataInfo.isFullyDefined()) { + if (metadataInfo.isRun3()) { + doprocessRun3.value = true; + doprocessRun2.value = false; + } else { + doprocessRun2.value = true; + doprocessRun3.value = false; + } + } + } } // Reserves an empty table for the given particle ID with size of the given track table @@ -1438,54 +1466,9 @@ struct tofPidMerge { } } PROCESS_SWITCH(tofPidMerge, processRun2, "Produce tables. Set to off if the tables are not required", false); -}; - -// Part 4 Beta and TOF mass computation - -struct tofPidBeta { - Produces tablePIDBeta; - Produces tablePIDTOFMass; - Configurable expreso{"tof-expreso", 80, "Expected resolution for the computation of the expected beta"}; - // Detector response and input parameters - o2::pid::tof::TOFResoParamsV3 mRespParamsV3; - TOFCalibConfig mTOFCalibConfig; // TOF Calib configuration - Service ccdb; - Configurable enableTOFParams{"enableTOFParams", false, "Flag to use TOF parameters"}; - - bool enableTableBeta = false; - bool enableTableMass = false; - void init(o2::framework::InitContext& initContext) - { - mTOFCalibConfig.inheritFromBaseTask(initContext); - enableTableBeta = isTableRequiredInWorkflow(initContext, "pidTOFbeta"); - enableTableMass = isTableRequiredInWorkflow(initContext, "pidTOFmass"); - if (!enableTableBeta && !enableTableMass && !doprocessRun2 && !doprocessRun3) { - LOG(info) << "No table or process is enabled. Disabling task"; - return; - } - - if (mTOFCalibConfig.autoSetProcessFunctions()) { - LOG(info) << "Autodetecting process functions"; - if (metadataInfo.isFullyDefined()) { - if (metadataInfo.isRun3()) { - doprocessRun3.value = true; - } else { - doprocessRun2.value = true; - } - } - } - - responseBeta.mExpectedResolution = expreso.value; - if (!enableTOFParams) { - return; - } - mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters - } - - void process(aod::BCs const&) {} o2::pid::tof::Beta responseBetaRun2; - void processRun2(Run2TrksWtofWevTime const& tracks) + void processBetaMRun2(Run2TrksWtofWevTime const& tracks) { if (!enableTableBeta && !enableTableMass) { return; @@ -1498,7 +1481,7 @@ struct tofPidBeta { tablePIDBeta(beta, responseBetaRun2.GetExpectedSigma(trk)); } if (enableTableMass) { - if (enableTOFParams) { + if (enableTOFParamsForBetaMass) { tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV3.getMomentumChargeShift(trk.eta())), beta)); } else { tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); @@ -1506,10 +1489,10 @@ struct tofPidBeta { } } } - PROCESS_SWITCH(tofPidBeta, processRun2, "Process Run3 data i.e. input is TrackIU. If false, taken from metadata automatically", true); + PROCESS_SWITCH(tofPidMerge, processBetaMRun2, "Process Run3 data i.e. input is TrackIU. If false, taken from metadata automatically", true); o2::pid::tof::Beta responseBeta; - void processRun3(Run3TrksWtofWevTime const& tracks) + void processBetaMRun3(Run3TrksWtofWevTime const& tracks) { if (!enableTableBeta && !enableTableMass) { return; @@ -1523,7 +1506,7 @@ struct tofPidBeta { responseBeta.GetExpectedSigma(trk)); } if (enableTableMass) { - if (enableTOFParams) { + if (enableTOFParamsForBetaMass) { tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV3.getMomentumChargeShift(trk.eta())), beta)); } else { tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk, beta)); @@ -1531,7 +1514,7 @@ struct tofPidBeta { } } } - PROCESS_SWITCH(tofPidBeta, processRun3, "Process Run3 data i.e. input is TrackIU. If false, taken from metadata automatically", true); + PROCESS_SWITCH(tofPidMerge, processBetaMRun3, "Process Run3 data i.e. input is TrackIU. If false, taken from metadata automatically", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) @@ -1541,6 +1524,5 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; workflow.push_back(adaptAnalysisTask(cfgc)); workflow.push_back(adaptAnalysisTask(cfgc)); - workflow.push_back(adaptAnalysisTask(cfgc)); return workflow; } From 9492ab0e4f2b64f8b80e17f799abcda3bca8c8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 17 Feb 2025 13:58:39 +0100 Subject: [PATCH 2/7] Update pidTOFMerge.cxx --- Common/TableProducer/PID/pidTOFMerge.cxx | 64 +++++++++++------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index 7ea5f25d612..68c4d9dc645 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -8,7 +8,6 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. - /// /// \file tofPidMerge.cxx /// \author Nicolò Jacazio nicolo.jacazio@cern.ch @@ -516,9 +515,9 @@ struct tofEventTime { Produces tableEvTimeTOFOnly; Produces tableFlags; static constexpr bool removeTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF - static constexpr float diamond = 6.0; // Collision diamond used in the estimation of the TOF event time - static constexpr float errDiamond = diamond * 33.356409f; - static constexpr float weightDiamond = 1.f / (errDiamond * errDiamond); + static constexpr float kDiamond = 6.0; // Collision diamond used in the estimation of the TOF event time + static constexpr float kErrDiamond = kDiamond * 33.356409f; + static constexpr float kWeightDiamond = 1.f / (kErrDiamond * kErrDiamond); bool enableTableTOFEvTime = false; bool enableTableEvTimeTOFOnly = false; @@ -692,7 +691,7 @@ struct tofEventTime { const auto& collision = t.collision_as(); // Compute the TOF event time - const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, kDiamond); float t0AC[2] = {.0f, 999.f}; // Value and error of T0A or T0C or T0AC float t0TOF[2] = {static_cast(evTimeMakerTOF.mEventTime), static_cast(evTimeMakerTOF.mEventTimeError)}; // Value and error of TOF @@ -714,7 +713,7 @@ struct tofEventTime { if constexpr (removeTOFEvTimeBias) { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); } - if (t0TOF[1] < errDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { + if (t0TOF[1] < kErrDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; weight = 1.f / (t0TOF[1] * t0TOF[1]); @@ -735,9 +734,9 @@ struct tofEventTime { sumOfWeights += weight; } - if (sumOfWeights < weightDiamond) { // avoiding sumOfWeights = 0 or worse that diamond + if (sumOfWeights < kWeightDiamond) { // avoiding sumOfWeights = 0 or worse that kDiamond eventTime = 0; - sumOfWeights = weightDiamond; + sumOfWeights = kWeightDiamond; tableFlags(0); } else { tableFlags(flags); @@ -768,7 +767,7 @@ struct tofEventTime { const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); // First make table for event time - const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); + const auto evTimeMakerTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, kDiamond); int nGoodTracksForTOF = 0; float et = evTimeMakerTOF.mEventTime; float erret = evTimeMakerTOF.mEventTimeError; @@ -778,11 +777,11 @@ struct tofEventTime { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); } uint8_t flags = 0; - if (erret < errDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { + if (erret < kErrDiamond && (maxEvTimeTOF <= 0.f || std::abs(et) < maxEvTimeTOF)) { flags |= o2::aod::pidflags::enums::PIDFlags::EvTimeTOF; } else { et = 0.f; - erret = errDiamond; + erret = kErrDiamond; } tableFlags(flags); tableEvTime(et, erret); @@ -919,19 +918,16 @@ struct tofPidMerge { LOG(info) << "No PID tables are required, disabling the task"; doprocessRun3.value = false; doprocessRun2.value = false; - return; - } else if (doprocessRun3.value == false && doprocessRun2.value == false) { - LOG(fatal) << "PID tables are required but process data is disabled. Please enable it"; - } - if (doprocessRun3.value == true && doprocessRun2.value == true) { - LOG(fatal) << "Both processRun2 and processRun3 are enabled. Pick one of the two"; - } - if (metadataInfo.isFullyDefined()) { - if (metadataInfo.isRun3() && doprocessRun2) { - LOG(fatal) << "Run2 process function is enabled but the metadata says it is Run3"; - } - if (!metadataInfo.isRun3() && doprocessRun3) { - LOG(fatal) << "Run3 process function is enabled but the metadata says it is Run2"; + } else if (mTOFCalibConfig.autoSetProcessFunctions()) { + LOG(info) << "Autodetecting process functions for mass and beta"; + if (metadataInfo.isFullyDefined()) { + if (metadataInfo.isRun3()) { + doprocessRun3.value = true; + doprocessRun2.value = false; + } else { + doprocessRun2.value = true; + doprocessRun3.value = false; + } } } mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters @@ -961,17 +957,17 @@ struct tofPidMerge { if (!enableTableBeta && !enableTableMass) { LOG(info) << "No table for TOF mass and beta is required. Disabling beta and mass tables"; - doprocessRun2.value = false; - doprocessRun3.value = false; + doprocessBetaMRun2.value = false; + doprocessBetaMRun3.value = false; } else if (mTOFCalibConfig.autoSetProcessFunctions()) { LOG(info) << "Autodetecting process functions for mass and beta"; if (metadataInfo.isFullyDefined()) { if (metadataInfo.isRun3()) { - doprocessRun3.value = true; - doprocessRun2.value = false; + doprocessBetaMRun3.value = true; + doprocessBetaMRun2.value = false; } else { - doprocessRun2.value = true; - doprocessRun3.value = false; + doprocessBetaMRun2.value = true; + doprocessBetaMRun3.value = false; } } } @@ -1303,7 +1299,7 @@ struct tofPidMerge { } } } - PROCESS_SWITCH(tofPidMerge, processRun3, "Produce tables. Set to off if the tables are not required", true); + PROCESS_SWITCH(tofPidMerge, processRun3, "Produce Run 3 Nsigma table. Set to off if the tables are not required, or autoset is on", false); template using ResponseImplementationRun2 = o2::pid::tof::ExpTimes; @@ -1465,7 +1461,7 @@ struct tofPidMerge { } } } - PROCESS_SWITCH(tofPidMerge, processRun2, "Produce tables. Set to off if the tables are not required", false); + PROCESS_SWITCH(tofPidMerge, processRun2, "Produce Run 2 Nsigma table. Set to off if the tables are not required, or autoset is on", false); o2::pid::tof::Beta responseBetaRun2; void processBetaMRun2(Run2TrksWtofWevTime const& tracks) @@ -1489,7 +1485,7 @@ struct tofPidMerge { } } } - PROCESS_SWITCH(tofPidMerge, processBetaMRun2, "Process Run3 data i.e. input is TrackIU. If false, taken from metadata automatically", true); + PROCESS_SWITCH(tofPidMerge, processBetaMRun2, "Produce Run 2 Beta and Mass table. Set to off if the tables are not required, or autoset is on", false); o2::pid::tof::Beta responseBeta; void processBetaMRun3(Run3TrksWtofWevTime const& tracks) @@ -1514,7 +1510,7 @@ struct tofPidMerge { } } } - PROCESS_SWITCH(tofPidMerge, processBetaMRun3, "Process Run3 data i.e. input is TrackIU. If false, taken from metadata automatically", true); + PROCESS_SWITCH(tofPidMerge, processBetaMRun3, "Produce Run 3 Beta and Mass table. Set to off if the tables are not required, or autoset is on", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 2f100bab634c87521299e52e0c3431b14b4aad15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 17 Feb 2025 14:02:06 +0100 Subject: [PATCH 3/7] Update pidTOFMerge.cxx --- Common/TableProducer/PID/pidTOFMerge.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index 68c4d9dc645..aba6f5afb2e 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -929,6 +929,12 @@ struct tofPidMerge { doprocessRun3.value = false; } } + if (doprocessRun2 && doprocessRun3) { + LOG(fatal) << "Both processRun2 and processRun3 are enabled. Pick one of the two"; + } + if (!doprocessRun2 && !doprocessRun3) { + LOG(fatal) << "Neither processRun2 nor processRun3 are enabled. Pick one of the two"; + } } mTOFCalibConfig.initSetup(mRespParamsV3, ccdb); // Getting the parametrization parameters @@ -971,6 +977,12 @@ struct tofPidMerge { } } } + if (doprocessBetaMRun2 && doprocessBetaMRun3) { + LOG(fatal) << "Both processBetaMRun2 and processBetaMRun3 are enabled. Pick one of the two"; + } + if (!doprocessBetaMRun2 && !doprocessBetaMRun3) { + LOG(fatal) << "Neither processBetaMRun2 nor processBetaMRun3 are enabled. Pick one of the two"; + } } // Reserves an empty table for the given particle ID with size of the given track table From 7fcdc15d4bbb62177712fb53a7c2820238d43e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 17 Feb 2025 14:04:45 +0100 Subject: [PATCH 4/7] Update pidTOFMerge.cxx --- Common/TableProducer/PID/pidTOFMerge.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index aba6f5afb2e..bf209d210a4 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -9,10 +9,10 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// -/// \file tofPidMerge.cxx -/// \author Nicolò Jacazio nicolo.jacazio@cern.ch +/// \file pidTOFMerge.cxx /// \brief Task to produce PID tables for TOF split for each particle. /// Only the tables for the mass hypotheses requested are filled, the others are sent empty. +/// \author Nicolò Jacazio nicolo.jacazio@cern.ch /// #include @@ -514,7 +514,7 @@ struct tofEventTime { Produces tableEvTime; Produces tableEvTimeTOFOnly; Produces tableFlags; - static constexpr bool removeTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF + static constexpr bool kRemoveTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF static constexpr float kDiamond = 6.0; // Collision diamond used in the estimation of the TOF event time static constexpr float kErrDiamond = kDiamond * 33.356409f; static constexpr float kWeightDiamond = 1.f / (kErrDiamond * kErrDiamond); @@ -710,7 +710,7 @@ struct tofEventTime { sumOfWeights = 0.f; weight = 0.f; // Remove the bias on TOF ev. time - if constexpr (removeTOFEvTimeBias) { + if constexpr (kRemoveTOFEvTimeBias) { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, t0TOF[0], t0TOF[1], 2); } if (t0TOF[1] < kErrDiamond && (maxEvTimeTOF <= 0 || std::abs(t0TOF[0]) < maxEvTimeTOF)) { @@ -773,7 +773,7 @@ struct tofEventTime { float erret = evTimeMakerTOF.mEventTimeError; for (auto const& trk : tracksInCollision) { // Loop on Tracks - if constexpr (removeTOFEvTimeBias) { + if constexpr (kRemoveTOFEvTimeBias) { evTimeMakerTOF.removeBias(trk, nGoodTracksForTOF, et, erret, 2); } uint8_t flags = 0; From 6c2009a4fea0ce7618db89390bfc5ea93bf992fc Mon Sep 17 00:00:00 2001 From: ALICE Builder Date: Mon, 17 Feb 2025 14:05:52 +0100 Subject: [PATCH 5/7] Please consider the following formatting changes to #10008 (#10016) --- Common/TableProducer/PID/pidTOFMerge.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index bf209d210a4..75460e9e923 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -515,7 +515,7 @@ struct tofEventTime { Produces tableEvTimeTOFOnly; Produces tableFlags; static constexpr bool kRemoveTOFEvTimeBias = true; // Flag to subtract the Ev. Time bias for low multiplicity events with TOF - static constexpr float kDiamond = 6.0; // Collision diamond used in the estimation of the TOF event time + static constexpr float kDiamond = 6.0; // Collision diamond used in the estimation of the TOF event time static constexpr float kErrDiamond = kDiamond * 33.356409f; static constexpr float kWeightDiamond = 1.f / (kErrDiamond * kErrDiamond); From 019ba36b8723c674ab65c35c7e9bcbd07606bea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 17 Feb 2025 14:18:19 +0100 Subject: [PATCH 6/7] Update pidTOFMerge.cxx --- Common/TableProducer/PID/pidTOFMerge.cxx | 188 ++++++++++++----------- 1 file changed, 96 insertions(+), 92 deletions(-) diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index 75460e9e923..ab0245d764b 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -822,19 +822,19 @@ struct tofEventTime { // Part 3 Nsigma computation -static constexpr int nParameters2 = 2; -static const std::vector parameterNames2{"Enable", "EnableFull"}; -static constexpr int idxEl = 0; -static constexpr int idxMu = 1; -static constexpr int idxPi = 2; -static constexpr int idxKa = 3; -static constexpr int idxPr = 4; -static constexpr int idxDe = 5; -static constexpr int idxTr = 6; -static constexpr int idxHe = 7; -static constexpr int idxAl = 8; - -static constexpr int defaultParameters2[nSpecies][nParameters2]{{-1, -1}, +static constexpr int kParEnabledN = 2; +static constexpr int kIdxEl = 0; +static constexpr int kIdxMu = 1; +static constexpr int kIdxPi = 2; +static constexpr int kIdxKa = 3; +static constexpr int kIdxPr = 4; +static constexpr int kIdxDe = 5; +static constexpr int kIdxTr = 6; +static constexpr int kIdxHe = 7; +static constexpr int kIdxAl = 8; + +static const std::vector kParEnabledNames{"Enable", "EnableFull"}; +static constexpr int kDefaultParEnabled[nSpecies][kParEnabledN]{{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, @@ -883,7 +883,7 @@ struct tofPidMerge { // Configuration flags to include and exclude particle hypotheses Configurable> enableParticle{"enableParticle", - {defaultParameters2[0], nSpecies, nParameters2, particleNames, parameterNames2}, + {kDefaultParEnabled[0], nSpecies, kParEnabledN, particleNames, kParEnabledNames}, "Produce PID information for the various mass hypotheses. Values different than -1 override the automatic setup: the corresponding table can be set off (0) or on (1)"}; // Histograms for QA @@ -918,15 +918,17 @@ struct tofPidMerge { LOG(info) << "No PID tables are required, disabling the task"; doprocessRun3.value = false; doprocessRun2.value = false; - } else if (mTOFCalibConfig.autoSetProcessFunctions()) { - LOG(info) << "Autodetecting process functions for mass and beta"; - if (metadataInfo.isFullyDefined()) { - if (metadataInfo.isRun3()) { - doprocessRun3.value = true; - doprocessRun2.value = false; - } else { - doprocessRun2.value = true; - doprocessRun3.value = false; + } else { + if (mTOFCalibConfig.autoSetProcessFunctions()) { + LOG(info) << "Autodetecting process functions for mass and beta"; + if (metadataInfo.isFullyDefined()) { + if (metadataInfo.isRun3()) { + doprocessRun3.value = true; + doprocessRun2.value = false; + } else { + doprocessRun2.value = true; + doprocessRun3.value = false; + } } } if (doprocessRun2 && doprocessRun3) { @@ -965,23 +967,25 @@ struct tofPidMerge { LOG(info) << "No table for TOF mass and beta is required. Disabling beta and mass tables"; doprocessBetaMRun2.value = false; doprocessBetaMRun3.value = false; - } else if (mTOFCalibConfig.autoSetProcessFunctions()) { - LOG(info) << "Autodetecting process functions for mass and beta"; - if (metadataInfo.isFullyDefined()) { - if (metadataInfo.isRun3()) { - doprocessBetaMRun3.value = true; - doprocessBetaMRun2.value = false; - } else { - doprocessBetaMRun2.value = true; - doprocessBetaMRun3.value = false; + } else { + if (mTOFCalibConfig.autoSetProcessFunctions()) { + LOG(info) << "Autodetecting process functions for mass and beta"; + if (metadataInfo.isFullyDefined()) { + if (metadataInfo.isRun3()) { + doprocessBetaMRun3.value = true; + doprocessBetaMRun2.value = false; + } else { + doprocessBetaMRun2.value = true; + doprocessBetaMRun3.value = false; + } } } - } - if (doprocessBetaMRun2 && doprocessBetaMRun3) { - LOG(fatal) << "Both processBetaMRun2 and processBetaMRun3 are enabled. Pick one of the two"; - } - if (!doprocessBetaMRun2 && !doprocessBetaMRun3) { - LOG(fatal) << "Neither processBetaMRun2 nor processBetaMRun3 are enabled. Pick one of the two"; + if (doprocessBetaMRun2 && doprocessBetaMRun3) { + LOG(fatal) << "Both processBetaMRun2 and processBetaMRun3 are enabled. Pick one of the two"; + } + if (!doprocessBetaMRun2 && !doprocessBetaMRun3) { + LOG(fatal) << "Neither processBetaMRun2 nor processBetaMRun3 are enabled. Pick one of the two"; + } } } @@ -989,7 +993,7 @@ struct tofPidMerge { void reserveTable(const int id, const int64_t& size, const bool fullTable = false) { switch (id) { - case idxEl: { + case kIdxEl: { if (fullTable) { tablePIDFullEl.reserve(size); } else { @@ -997,7 +1001,7 @@ struct tofPidMerge { } break; } - case idxMu: { + case kIdxMu: { if (fullTable) { tablePIDFullMu.reserve(size); } else { @@ -1005,7 +1009,7 @@ struct tofPidMerge { } break; } - case idxPi: { + case kIdxPi: { if (fullTable) { tablePIDFullPi.reserve(size); } else { @@ -1013,7 +1017,7 @@ struct tofPidMerge { } break; } - case idxKa: { + case kIdxKa: { if (fullTable) { tablePIDFullKa.reserve(size); } else { @@ -1021,7 +1025,7 @@ struct tofPidMerge { } break; } - case idxPr: { + case kIdxPr: { if (fullTable) { tablePIDFullPr.reserve(size); } else { @@ -1029,7 +1033,7 @@ struct tofPidMerge { } break; } - case idxDe: { + case kIdxDe: { if (fullTable) { tablePIDFullDe.reserve(size); } else { @@ -1037,7 +1041,7 @@ struct tofPidMerge { } break; } - case idxTr: { + case kIdxTr: { if (fullTable) { tablePIDFullTr.reserve(size); } else { @@ -1045,7 +1049,7 @@ struct tofPidMerge { } break; } - case idxHe: { + case kIdxHe: { if (fullTable) { tablePIDFullHe.reserve(size); } else { @@ -1053,7 +1057,7 @@ struct tofPidMerge { } break; } - case idxAl: { + case kIdxAl: { if (fullTable) { tablePIDFullAl.reserve(size); } else { @@ -1071,7 +1075,7 @@ struct tofPidMerge { void makeTableEmpty(const int id, bool fullTable = false) { switch (id) { - case idxEl: + case kIdxEl: if (fullTable) { tablePIDFullEl(-999.f, -999.f); } else { @@ -1079,7 +1083,7 @@ struct tofPidMerge { tablePIDEl); } break; - case idxMu: + case kIdxMu: if (fullTable) { tablePIDFullMu(-999.f, -999.f); } else { @@ -1087,7 +1091,7 @@ struct tofPidMerge { tablePIDMu); } break; - case idxPi: + case kIdxPi: if (fullTable) { tablePIDFullPi(-999.f, -999.f); } else { @@ -1095,7 +1099,7 @@ struct tofPidMerge { tablePIDPi); } break; - case idxKa: + case kIdxKa: if (fullTable) { tablePIDFullKa(-999.f, -999.f); } else { @@ -1103,7 +1107,7 @@ struct tofPidMerge { tablePIDKa); } break; - case idxPr: + case kIdxPr: if (fullTable) { tablePIDFullPr(-999.f, -999.f); } else { @@ -1111,7 +1115,7 @@ struct tofPidMerge { tablePIDPr); } break; - case idxDe: + case kIdxDe: if (fullTable) { tablePIDFullDe(-999.f, -999.f); } else { @@ -1119,7 +1123,7 @@ struct tofPidMerge { tablePIDDe); } break; - case idxTr: + case kIdxTr: if (fullTable) { tablePIDFullTr(-999.f, -999.f); } else { @@ -1127,7 +1131,7 @@ struct tofPidMerge { tablePIDTr); } break; - case idxHe: + case kIdxHe: if (fullTable) { tablePIDFullHe(-999.f, -999.f); } else { @@ -1135,7 +1139,7 @@ struct tofPidMerge { tablePIDHe); } break; - case idxAl: + case kIdxAl: if (fullTable) { tablePIDFullAl(-999.f, -999.f); } else { @@ -1192,47 +1196,47 @@ struct tofPidMerge { for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses switch (pidId) { - case idxEl: { + case kIdxEl: { nsigma = responseEl.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDEl); break; } - case idxMu: { + case kIdxMu: { nsigma = responseMu.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDMu); break; } - case idxPi: { + case kIdxPi: { nsigma = responsePi.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDPi); break; } - case idxKa: { + case kIdxKa: { nsigma = responseKa.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDKa); break; } - case idxPr: { + case kIdxPr: { nsigma = responsePr.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDPr); break; } - case idxDe: { + case kIdxDe: { nsigma = responseDe.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDDe); break; } - case idxTr: { + case kIdxTr: { nsigma = responseTr.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDTr); break; } - case idxHe: { + case kIdxHe: { nsigma = responseHe.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDHe); break; } - case idxAl: { + case kIdxAl: { nsigma = responseAl.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDAl); break; @@ -1247,55 +1251,55 @@ struct tofPidMerge { } for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses with full tables switch (pidId) { - case idxEl: { + case kIdxEl: { resolution = responseEl.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseEl.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullEl(resolution, nsigma); break; } - case idxMu: { + case kIdxMu: { resolution = responseMu.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseMu.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullMu(resolution, nsigma); break; } - case idxPi: { + case kIdxPi: { resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk); nsigma = responsePi.GetSeparation(mRespParamsV3, trk); tablePIDFullPi(resolution, nsigma); break; } - case idxKa: { + case kIdxKa: { resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullKa(resolution, nsigma); break; } - case idxPr: { + case kIdxPr: { resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk); nsigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullPr(resolution, nsigma); break; } - case idxDe: { + case kIdxDe: { resolution = responseDe.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseDe.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullDe(resolution, nsigma); break; } - case idxTr: { + case kIdxTr: { resolution = responseTr.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseTr.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullTr(resolution, nsigma); break; } - case idxHe: { + case kIdxHe: { resolution = responseHe.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseHe.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullHe(resolution, nsigma); break; } - case idxAl: { + case kIdxAl: { resolution = responseAl.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseAl.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullAl(resolution, nsigma); @@ -1354,47 +1358,47 @@ struct tofPidMerge { for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses switch (pidId) { - case idxEl: { + case kIdxEl: { nsigma = responseEl.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDEl); break; } - case idxMu: { + case kIdxMu: { nsigma = responseMu.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDMu); break; } - case idxPi: { + case kIdxPi: { nsigma = responsePi.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDPi); break; } - case idxKa: { + case kIdxKa: { nsigma = responseKa.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDKa); break; } - case idxPr: { + case kIdxPr: { nsigma = responsePr.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDPr); break; } - case idxDe: { + case kIdxDe: { nsigma = responseDe.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDDe); break; } - case idxTr: { + case kIdxTr: { nsigma = responseTr.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDTr); break; } - case idxHe: { + case kIdxHe: { nsigma = responseHe.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDHe); break; } - case idxAl: { + case kIdxAl: { nsigma = responseAl.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDAl); break; @@ -1409,55 +1413,55 @@ struct tofPidMerge { } for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses with full tables switch (pidId) { - case idxEl: { + case kIdxEl: { resolution = responseEl.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseEl.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullEl(resolution, nsigma); break; } - case idxMu: { + case kIdxMu: { resolution = responseMu.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseMu.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullMu(resolution, nsigma); break; } - case idxPi: { + case kIdxPi: { resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk); nsigma = responsePi.GetSeparation(mRespParamsV3, trk); tablePIDFullPi(resolution, nsigma); break; } - case idxKa: { + case kIdxKa: { resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullKa(resolution, nsigma); break; } - case idxPr: { + case kIdxPr: { resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk); nsigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullPr(resolution, nsigma); break; } - case idxDe: { + case kIdxDe: { resolution = responseDe.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseDe.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullDe(resolution, nsigma); break; } - case idxTr: { + case kIdxTr: { resolution = responseTr.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseTr.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullTr(resolution, nsigma); break; } - case idxHe: { + case kIdxHe: { resolution = responseHe.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseHe.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullHe(resolution, nsigma); break; } - case idxAl: { + case kIdxAl: { resolution = responseAl.GetExpectedSigma(mRespParamsV3, trk); nsigma = responseAl.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullAl(resolution, nsigma); From af6d907a3ab29c6bcd8daee0b90f68e24b7ea67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 17 Feb 2025 16:38:24 +0100 Subject: [PATCH 7/7] Update pidTOFMerge.cxx --- Common/TableProducer/PID/pidTOFMerge.cxx | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index ab0245d764b..83b4546e81f 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -965,26 +965,26 @@ struct tofPidMerge { if (!enableTableBeta && !enableTableMass) { LOG(info) << "No table for TOF mass and beta is required. Disabling beta and mass tables"; - doprocessBetaMRun2.value = false; - doprocessBetaMRun3.value = false; + doprocessRun2BetaM.value = false; + doprocessRun3BetaM.value = false; } else { if (mTOFCalibConfig.autoSetProcessFunctions()) { LOG(info) << "Autodetecting process functions for mass and beta"; if (metadataInfo.isFullyDefined()) { if (metadataInfo.isRun3()) { - doprocessBetaMRun3.value = true; - doprocessBetaMRun2.value = false; + doprocessRun3BetaM.value = true; + doprocessRun2BetaM.value = false; } else { - doprocessBetaMRun2.value = true; - doprocessBetaMRun3.value = false; + doprocessRun2BetaM.value = true; + doprocessRun3BetaM.value = false; } } } - if (doprocessBetaMRun2 && doprocessBetaMRun3) { - LOG(fatal) << "Both processBetaMRun2 and processBetaMRun3 are enabled. Pick one of the two"; + if (doprocessRun2BetaM && doprocessRun3BetaM) { + LOG(fatal) << "Both processRun2BetaM and processRun3BetaM are enabled. Pick one of the two"; } - if (!doprocessBetaMRun2 && !doprocessBetaMRun3) { - LOG(fatal) << "Neither processBetaMRun2 nor processBetaMRun3 are enabled. Pick one of the two"; + if (!doprocessRun2BetaM && !doprocessRun3BetaM) { + LOG(fatal) << "Neither processRun2BetaM nor processRun3BetaM are enabled. Pick one of the two"; } } } @@ -1480,7 +1480,7 @@ struct tofPidMerge { PROCESS_SWITCH(tofPidMerge, processRun2, "Produce Run 2 Nsigma table. Set to off if the tables are not required, or autoset is on", false); o2::pid::tof::Beta responseBetaRun2; - void processBetaMRun2(Run2TrksWtofWevTime const& tracks) + void processRun2BetaM(Run2TrksWtofWevTime const& tracks) { if (!enableTableBeta && !enableTableMass) { return; @@ -1501,10 +1501,10 @@ struct tofPidMerge { } } } - PROCESS_SWITCH(tofPidMerge, processBetaMRun2, "Produce Run 2 Beta and Mass table. Set to off if the tables are not required, or autoset is on", false); + PROCESS_SWITCH(tofPidMerge, processRun2BetaM, "Produce Run 2 Beta and Mass table. Set to off if the tables are not required, or autoset is on", false); o2::pid::tof::Beta responseBeta; - void processBetaMRun3(Run3TrksWtofWevTime const& tracks) + void processRun3BetaM(Run3TrksWtofWevTime const& tracks) { if (!enableTableBeta && !enableTableMass) { return; @@ -1526,7 +1526,7 @@ struct tofPidMerge { } } } - PROCESS_SWITCH(tofPidMerge, processBetaMRun3, "Produce Run 3 Beta and Mass table. Set to off if the tables are not required, or autoset is on", false); + PROCESS_SWITCH(tofPidMerge, processRun3BetaM, "Produce Run 3 Beta and Mass table. Set to off if the tables are not required, or autoset is on", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)