diff --git a/Common/Core/PID/PIDTOF.h b/Common/Core/PID/PIDTOF.h index ff24db14140..5ecd32cbbd0 100644 --- a/Common/Core/PID/PIDTOF.h +++ b/Common/Core/PID/PIDTOF.h @@ -250,6 +250,136 @@ class TOFResoParamsV2 : public o2::tof::Parameters<13> TGraph* gNegEtaTimeCorr = nullptr; /// Time shift correction for negative tracks }; +/// \brief Next implementation class to store TOF response parameters for exp. times +class TOFResoParamsV3 : public o2::tof::Parameters<13> +{ + public: + TOFResoParamsV3() : Parameters(std::array{"TrkRes.Pi.P0", "TrkRes.Pi.P1", "TrkRes.Pi.P2", "TrkRes.Pi.P3", "time_resolution", + "TrkRes.Ka.P0", "TrkRes.Ka.P1", "TrkRes.Ka.P2", "TrkRes.Ka.P3", + "TrkRes.Pr.P0", "TrkRes.Pr.P1", "TrkRes.Pr.P2", "TrkRes.Pr.P3"}, + "TOFResoParamsV3") + { + setParameters(std::array{0.008, 0.008, 0.002, 40.0, 60.0, + 0.008, 0.008, 0.002, 40.0, + 0.008, 0.008, 0.002, 40.0}); + } // Default constructor with default parameters + + ~TOFResoParamsV3() = default; + + // Momentum shift for charge calibration + void setMomentumChargeShiftParameters(std::unordered_map const& pars) + { + if (pars.count("Shift.etaN") == 0) { // If the map does not contain the number of eta bins, we assume that no correction has to be applied + mEtaN = 0; + return; + } + mEtaN = static_cast(pars.at("Shift.etaN")); + if (mEtaN <= 0) { + LOG(fatal) << "TOFResoParamsV3 shift: etaN must be positive"; + } + mEtaStart = pars.at("Shift.etaStart"); + mEtaStop = pars.at("Shift.etaStop"); + if (mEtaStart >= mEtaStop) { + LOG(fatal) << "TOFResoParamsV3 shift: etaStart must be smaller than etaStop"; + } + mInvEtaWidth = 1.f / ((mEtaStop - mEtaStart) / mEtaN); + mContent.clear(); + mContent.resize(mEtaN); + for (int i = 0; i < mEtaN; ++i) { + mContent[i] = pars.at(Form("Shift.etaC%i", i)); + } + } + + float getMomentumChargeShift(float eta) const + { + if (mEtaN == 0) { // No correction + // LOG(info) << "TOFResoParamsV3 shift: no correction mEtaN is " << mEtaN; + return 0.f; + } + const int& etaIndex = (eta <= mEtaStart) ? 0 : (eta >= mEtaStop ? (mEtaN - 1) : (eta - mEtaStart) * mInvEtaWidth); + // LOG(info) << "TOFResoParamsV3 shift: correction for eta " << eta << " is for index " << etaIndex << " = " << shift; + return mContent.at(etaIndex); + } + + void printMomentumChargeShiftParameters() const + { + LOG(info) << "TOF momentum shift parameters"; + LOG(info) << "etaN: " << mEtaN; + LOG(info) << "etaStart: " << mEtaStart; + LOG(info) << "etaStop: " << mEtaStop; + LOG(info) << "content size " << mContent.size(); + for (int i = 0; i < mEtaN; ++i) { + LOG(info) << "etaC" << i << ": " << mContent[i]; + } + } + + // Time shift for post calibration + void setTimeShiftParameters(std::unordered_map const& pars, bool positive) + { + std::string baseOpt = positive ? "TimeShift.Pos." : "TimeShift.Neg."; + + if (pars.count(baseOpt + "GetN") == 0) { // If the map does not contain the number of eta bins, we assume that no correction has to be applied + return; + } + const int nPoints = static_cast(pars.at(baseOpt + "GetN")); + if (nPoints <= 0) { + LOG(fatal) << "TOFResoParamsV3 shift: time must be positive"; + } + TGraph graph; + for (int i = 0; i < nPoints; ++i) { + graph.AddPoint(pars.at(Form("TimeShift.eta%i", i)), pars.at(Form("TimeShift.cor%i", i))); + } + setTimeShiftParameters(&graph, positive); + } + void setTimeShiftParameters(std::string const& filename, std::string const& objname, bool positive) + { + TFile f(filename.c_str(), "READ"); + if (f.IsOpen()) { + if (positive) { + f.GetObject(objname.c_str(), gPosEtaTimeCorr); + } else { + f.GetObject(objname.c_str(), gNegEtaTimeCorr); + } + f.Close(); + } + LOG(info) << "Set the Time Shift parameters from file " << filename << " and object " << objname << " for " << (positive ? "positive" : "negative"); + } + void setTimeShiftParameters(TGraph* g, bool positive) + { + if (positive) { + gPosEtaTimeCorr = g; + } else { + gNegEtaTimeCorr = g; + } + LOG(info) << "Set the Time Shift parameters from object " << g->GetName() << " " << g->GetTitle() << " for " << (positive ? "positive" : "negative"); + } + float getTimeShift(float eta, int16_t sign) const + { + if (sign > 0) { + if (!gPosEtaTimeCorr) { + return 0.f; + } + return gPosEtaTimeCorr->Eval(eta); + } + if (!gNegEtaTimeCorr) { + return 0.f; + } + return gNegEtaTimeCorr->Eval(eta); + } + + private: + // Charge calibration + int mEtaN = 0; // Number of eta bins, 0 means no correction + float mEtaStart = 0.f; + float mEtaStop = 0.f; + float mInvEtaWidth = 9999.f; + std::vector mContent; + + // Time shift for post calibration + TGraph* gPosEtaTimeCorr = nullptr; /// Time shift correction for positive tracks + TGraph* gNegEtaTimeCorr = nullptr; /// Time shift correction for negative tracks +}; + /// \brief Class to handle the the TOF detector response for the expected time template class ExpTimes @@ -279,16 +409,17 @@ class ExpTimes /// Gets the expected signal of the track of interest under the PID assumption corrected for shifts in expected momentum /// \param parameters Parameters to correct for the momentum shift /// \param track Track of interest - static float GetCorrectedExpectedSignal(const TOFResoParamsV2& parameters, const TrackType& track) + template + static float GetCorrectedExpectedSignal(const ParamType& parameters, const TrackType& track) { if (!track.hasTOF()) { return defaultReturnValue; } if (track.trackType() == o2::aod::track::Run2Track) { - return ComputeExpectedTime(track.tofExpMom() * kCSPEDDInv / (1.f + track.sign() * parameters.getShift(track.eta())), track.length()); + return ComputeExpectedTime(track.tofExpMom() * kCSPEDDInv / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())), track.length()); } - LOG(debug) << "TOF exp. mom. " << track.tofExpMom() << " shifted = " << track.tofExpMom() / (1.f + track.sign() * parameters.getShift(track.eta())); - return ComputeExpectedTime(track.tofExpMom() / (1.f + track.sign() * parameters.getShift(track.eta())), track.length()) + parameters.getTimeShift(track.eta(), track.sign()); + LOG(debug) << "TOF exp. mom. " << track.tofExpMom() << " shifted = " << track.tofExpMom() / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())); + return ComputeExpectedTime(track.tofExpMom() / (1.f + track.sign() * parameters.getMomentumChargeShift(track.eta())), track.length()) + parameters.getTimeShift(track.eta(), track.sign()); } /// Gets the expected resolution of the t-texp-t0 @@ -297,7 +428,8 @@ class ExpTimes /// \param track Track of interest /// \param tofSignal TOF signal of the track of interest /// \param collisionTimeRes Collision time resolution of the track of interest - static float GetExpectedSigma(const TOFResoParamsV2& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes) + template + static float GetExpectedSigma(const ParamType& parameters, const TrackType& track, const float tofSignal, const float collisionTimeRes) { const float& mom = track.p(); if (mom <= 0) { @@ -323,29 +455,49 @@ class ExpTimes /// Gets the expected resolution of the t-texp-t0 /// \param parameters Detector response parameters /// \param track Track of interest - static float GetExpectedSigma(const TOFResoParamsV2& parameters, const TrackType& track) { return GetExpectedSigma(parameters, track, track.tofSignal(), track.tofEvTimeErr()); } + template + static float GetExpectedSigma(const ParamType& parameters, const TrackType& track) + { + return GetExpectedSigma(parameters, track, track.tofSignal(), track.tofEvTimeErr()); + } /// Gets the expected resolution of the time measurement, uses the expected time and no event time resolution /// \param parameters Parameters to use to compute the expected resolution /// \param track Track of interest - static float GetExpectedSigmaTracking(const TOFResoParamsV2& parameters, const TrackType& track) { return GetExpectedSigma(parameters, track, GetCorrectedExpectedSignal(parameters, track), 0.f); } + template + static float GetExpectedSigmaTracking(const ParamType& parameters, const TrackType& track) + { + return GetExpectedSigma(parameters, track, GetCorrectedExpectedSignal(parameters, track), 0.f); + } /// Gets the number of sigmas with respect the expected time /// \param parameters Detector response parameters /// \param track Track of interest /// \param collisionTime Collision time /// \param collisionTimeRes Collision time resolution of the track of interest - static float GetSeparation(const TOFResoParamsV2& parameters, const TrackType& track, const float collisionTime, const float resolution) { return track.hasTOF() ? (track.tofSignal() - collisionTime - GetCorrectedExpectedSignal(parameters, track)) / resolution : defaultReturnValue; } + template + static float GetSeparation(const ParamType& parameters, const TrackType& track, const float collisionTime, const float resolution) + { + return track.hasTOF() ? (track.tofSignal() - collisionTime - GetCorrectedExpectedSignal(parameters, track)) / resolution : defaultReturnValue; + } /// Gets the number of sigmas with respect the expected time /// \param parameters Detector response parameters /// \param track Track of interest - static float GetSeparation(const TOFResoParamsV2& parameters, const TrackType& track, const float resolution) { return GetSeparation(parameters, track, track.tofEvTime(), resolution); } + template + static float GetSeparation(const ParamType& parameters, const TrackType& track, const float resolution) + { + return GetSeparation(parameters, track, track.tofEvTime(), resolution); + } /// Gets the number of sigmas with respect the expected time /// \param parameters Detector response parameters /// \param track Track of interest - static float GetSeparation(const TOFResoParamsV2& parameters, const TrackType& track) { return GetSeparation(parameters, track, track.tofEvTime(), GetExpectedSigma(parameters, track)); } + template + static float GetSeparation(const ParamType& parameters, const TrackType& track) + { + return GetSeparation(parameters, track, track.tofEvTime(), GetExpectedSigma(parameters, track)); + } }; /// \brief Class to convert the trackTime to the tofSignal used for PID diff --git a/Common/DataModel/PIDResponse.h b/Common/DataModel/PIDResponse.h index e48aa6d15d6..f815381d4c6 100644 --- a/Common/DataModel/PIDResponse.h +++ b/Common/DataModel/PIDResponse.h @@ -403,7 +403,10 @@ DECLARE_SOA_DYNAMIC_COLUMN(IsEvTimeTOFT0AC, isEvTimeTOFT0AC, //! True if the Eve namespace pidtofsignal { -DECLARE_SOA_COLUMN(TOFSignal, tofSignal, float); //! TOF signal from track time +DECLARE_SOA_COLUMN(TOFSignal, tofSignal, float); //! TOF signal from track time +DECLARE_SOA_DYNAMIC_COLUMN(EventCollisionTime, eventCollisionTime, //! Event collision time used for the track. Needs the TOF + [](float signal, float tMinusTexp, float texp) -> float { return texp + tMinusTexp - signal; }); + } // namespace pidtofsignal namespace pidtofbeta @@ -528,7 +531,8 @@ DEFINE_UNWRAP_NSIGMA_COLUMN(TOFNSigmaAl, tofNSigmaAl); //! Unwrapped (float) nsi } // namespace pidtof_tiny DECLARE_SOA_TABLE(TOFSignal, "AOD", "TOFSignal", //! Table of the TOF signal - pidtofsignal::TOFSignal); + pidtofsignal::TOFSignal, + pidtofsignal::EventCollisionTime); DECLARE_SOA_TABLE(pidTOFFlags, "AOD", "pidTOFFlags", //! Table of the flags for TOF signal quality on the track level pidflags::GoodTOFMatch); diff --git a/Common/TableProducer/PID/pidTOFBase.cxx b/Common/TableProducer/PID/pidTOFBase.cxx index 47047a82035..e82ea651304 100644 --- a/Common/TableProducer/PID/pidTOFBase.cxx +++ b/Common/TableProducer/PID/pidTOFBase.cxx @@ -30,6 +30,8 @@ #include "Common/DataModel/EventSelection.h" #include "Common/DataModel/FT0Corrected.h" #include "Common/DataModel/Multiplicity.h" +#include "Framework/HistogramRegistry.h" +#include "Framework/runDataProcessing.h" #include "TableHelper.h" #include "pidTOFBase.h" @@ -39,15 +41,6 @@ using namespace o2::pid; using namespace o2::framework::expressions; using namespace o2::track; -void customize(std::vector& workflowOptions) -{ - std::vector options{{"add-qa", VariantType::Int, 0, {"Legacy. No effect."}}, - {"evtime", VariantType::Int, 1, {"Produce the table for the Event Time"}}}; - std::swap(workflowOptions, options); -} - -#include "Framework/runDataProcessing.h" - /// Selection criteria for tracks used for TOF event time float trackDistanceForGoodMatch = 999.f; float trackDistanceForGoodMatchLowMult = 999.f; @@ -69,6 +62,8 @@ bool isTrackGoodMatchForTOFPID(const Run3Trks::iterator& tr, const Run3Cols& /*e struct tofSignal { o2::framework::Produces table; o2::framework::Produces tableFlags; + HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject}; + bool enableTable = false; // Flag to check if the TOF signal table is requested or not bool enableTableFlags = false; // Flag to check if the TOF signal flags table is requested or not // CCDB configuration @@ -78,6 +73,7 @@ struct tofSignal { Configurable distanceForGoodMatch{"distanceForGoodMatch", 999.f, "Maximum distance to consider a good match"}; Configurable distanceForGoodMatchLowMult{"distanceForGoodMatchLowMult", 999.f, "Maximum distance to consider a good match for low multiplicity events"}; Configurable multThreshold{"multThreshold", 0, "Multiplicity threshold to consider a low multiplicity event"}; + Configurable enableQaHistograms{"enableQaHistograms", false, "Flag to enable the QA histograms"}; void init(o2::framework::InitContext& initContext) { @@ -101,6 +97,13 @@ struct tofSignal { trackDistanceForGoodMatchLowMult = distanceForGoodMatchLowMult; multiplicityThreshold = multThreshold; LOG(info) << "Configuring selections for good match: " << trackDistanceForGoodMatch << " low mult " << trackDistanceForGoodMatchLowMult << " mult. threshold " << multiplicityThreshold; + if (!enableQaHistograms) { + return; + } + histos.add("tofSignal", "tofSignal", kTH1D, {{1000, -1000, 1000000, "tofSignal (ps)"}}); + if (enableTableFlags) { + histos.add("goodForPIDFlags", "goodForPIDFlags", kTH1D, {{3, 0, 3, "flags"}}); + } } void processRun3(Run3Trks const& tracks, Run3Cols const& collisions) { @@ -112,11 +115,19 @@ struct tofSignal { tableFlags.reserve(tracks.size()); } for (auto& t : tracks) { - table(o2::pid::tof::TOFSignal::GetTOFSignal(t)); + const auto s = o2::pid::tof::TOFSignal::GetTOFSignal(t); + if (enableQaHistograms) { + histos.fill(HIST("tofSignal"), s); + } + table(s); if (!enableTableFlags) { continue; } - tableFlags(isTrackGoodMatchForTOFPID(t, collisions)); + const auto b = isTrackGoodMatchForTOFPID(t, collisions); + if (enableQaHistograms) { + histos.fill(HIST("goodForPIDFlags"), s); + } + tableFlags(b); } } PROCESS_SWITCH(tofSignal, processRun3, "Process Run3 data i.e. input is TrackIU", true); @@ -537,9 +548,6 @@ struct tofEventTime { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { auto workflow = WorkflowSpec{adaptAnalysisTask(cfgc)}; - if (!cfgc.options().get("evtime")) { - return workflow; - } workflow.push_back(adaptAnalysisTask(cfgc)); return workflow; } diff --git a/Common/TableProducer/PID/pidTOFMerge.cxx b/Common/TableProducer/PID/pidTOFMerge.cxx index ae59f60a160..d07db9f467d 100644 --- a/Common/TableProducer/PID/pidTOFMerge.cxx +++ b/Common/TableProducer/PID/pidTOFMerge.cxx @@ -194,7 +194,7 @@ struct tofEventTime { bool enableTable = false; bool enableTableTOFOnly = false; // Detector response and input parameters - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; Service ccdb; Configurable inheritFromBaseTask{"inheritFromBaseTask", true, "Flag to iherit all common configurables from the TOF base task"}; // CCDB configuration (inherited from TOF signal task) @@ -291,36 +291,36 @@ struct tofEventTime { o2::tof::ParameterCollection paramCollection; paramCollection.loadParamFromFile(fname, parametrizationPath.value); LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, passName.value)) { + if (!paramCollection.retrieveParameters(mRespParamsV3, passName.value)) { if (fatalOnPassNotAvailable) { LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } else { LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } } else { - mRespParamsV2.setMomentumChargeShiftParameters(paramCollection.getPars(passName.value)); - mRespParamsV2.printMomentumChargeShiftParameters(); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(passName.value)); + mRespParamsV3.printMomentumChargeShiftParameters(); } } else { - mRespParamsV2.loadParamFromFile(fname.data(), parametrizationPath.value); + mRespParamsV3.loadParamFromFile(fname.data(), parametrizationPath.value); } } else if (loadResponseFromCCDB) { // Loading it from CCDB LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << parametrizationPath.value << " for timestamp " << timestamp.value; o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value); paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, passName.value)) { + if (!paramCollection->retrieveParameters(mRespParamsV3, passName.value)) { if (fatalOnPassNotAvailable) { LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } else { LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } } else { - mRespParamsV2.setMomentumChargeShiftParameters(paramCollection->getPars(passName.value)); - mRespParamsV2.printMomentumChargeShiftParameters(); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(passName.value)); + mRespParamsV3.printMomentumChargeShiftParameters(); } } - mRespParamsV2.print(); + mRespParamsV3.print(); o2::tof::eventTimeContainer::setMaxNtracksInSet(maxNtracksInSet.value); o2::tof::eventTimeContainer::printConfig(); } @@ -389,7 +389,7 @@ struct tofEventTime { const auto& tracksInCollision = tracks.sliceBy(perCollision, lastCollisionId); // First make table for event time - const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond); + const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); int nGoodTracksForTOF = 0; float et = evTimeTOF.mEventTime; float erret = evTimeTOF.mEventTimeError; @@ -452,7 +452,7 @@ struct tofEventTime { const auto& collision = t.collision_as(); // Compute the TOF event time - const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV2, diamond); + const auto evTimeTOF = evTimeMakerForTracks(tracksInCollision, mRespParamsV3, diamond); float t0AC[2] = {.0f, 999.f}; // Value and error of T0A or T0C or T0AC float t0TOF[2] = {static_cast(evTimeTOF.mEventTime), static_cast(evTimeTOF.mEventTimeError)}; // Value and error of TOF @@ -602,7 +602,7 @@ struct tofPidMerge { Produces tablePIDFullAl; // Detector response parameters - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; Service ccdb; Configurable inheritFromBaseTask{"inheritFromBaseTask", true, "Flag to iherit all common configurables from the TOF base task"}; // CCDB configuration (inherited from TOF base task) @@ -721,42 +721,42 @@ struct tofPidMerge { o2::tof::ParameterCollection paramCollection; paramCollection.loadParamFromFile(fname, parametrizationPath.value); LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, passName.value)) { + if (!paramCollection.retrieveParameters(mRespParamsV3, passName.value)) { if (fatalOnPassNotAvailable) { LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } else { LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } } else { - mRespParamsV2.setMomentumChargeShiftParameters(paramCollection.getPars(passName.value)); - mRespParamsV2.printMomentumChargeShiftParameters(); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(passName.value)); + mRespParamsV3.printMomentumChargeShiftParameters(); } } else { - mRespParamsV2.loadParamFromFile(fname.data(), parametrizationPath.value); + mRespParamsV3.loadParamFromFile(fname.data(), parametrizationPath.value); } } else if (loadResponseFromCCDB) { // Loading it from CCDB LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << parametrizationPath.value << " for timestamp " << timestamp.value; o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value); paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, passName.value)) { // Attempt at loading the parameters with the pass defined + if (!paramCollection->retrieveParameters(mRespParamsV3, passName.value)) { // Attempt at loading the parameters with the pass defined if (fatalOnPassNotAvailable) { LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } else { LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } } else { // Pass is available, load non standard parameters - mRespParamsV2.setMomentumChargeShiftParameters(paramCollection->getPars(passName.value)); - mRespParamsV2.printMomentumChargeShiftParameters(); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(passName.value)); + mRespParamsV3.printMomentumChargeShiftParameters(); } } - mRespParamsV2.print(); + mRespParamsV3.print(); if (timeShiftCCDBPath.value != "") { if (timeShiftCCDBPath.value.find(".root") != std::string::npos) { - mRespParamsV2.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Pos", true); - mRespParamsV2.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Neg", false); + mRespParamsV3.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Pos", true); + mRespParamsV3.setTimeShiftParameters(timeShiftCCDBPath.value, "gmean_Neg", false); } else { - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/pos", timeShiftCCDBPath.value.c_str()), timestamp.value), true); - mRespParamsV2.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/neg", timeShiftCCDBPath.value.c_str()), timestamp.value), false); + mRespParamsV3.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/pos", timeShiftCCDBPath.value.c_str()), timestamp.value), true); + mRespParamsV3.setTimeShiftParameters(ccdb->getForTimeStamp(Form("%s/neg", timeShiftCCDBPath.value.c_str()), timestamp.value), false); } } } @@ -947,7 +947,7 @@ struct tofPidMerge { timestamp.value = track.collision().bc_as().timestamp(); if (enableTimeDependentResponse) { LOG(debug) << "Updating parametrization from path '" << parametrizationPath.value << "' and timestamp " << timestamp.value; - if (!ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value)->retrieveParameters(mRespParamsV2, passName.value)) { + if (!ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value)->retrieveParameters(mRespParamsV3, passName.value)) { if (fatalOnPassNotAvailable) { LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } else { @@ -982,47 +982,47 @@ struct tofPidMerge { for (auto const& pidId : mEnabledParticles) { // Loop on enabled particle hypotheses switch (pidId) { case idxEl: { - nsigma = responseEl.GetSeparation(mRespParamsV2, trk); + nsigma = responseEl.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDEl); break; } case idxMu: { - nsigma = responseMu.GetSeparation(mRespParamsV2, trk); + nsigma = responseMu.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDMu); break; } case idxPi: { - nsigma = responsePi.GetSeparation(mRespParamsV2, trk); + nsigma = responsePi.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDPi); break; } case idxKa: { - nsigma = responseKa.GetSeparation(mRespParamsV2, trk); + nsigma = responseKa.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDKa); break; } case idxPr: { - nsigma = responsePr.GetSeparation(mRespParamsV2, trk); + nsigma = responsePr.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDPr); break; } case idxDe: { - nsigma = responseDe.GetSeparation(mRespParamsV2, trk); + nsigma = responseDe.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDDe); break; } case idxTr: { - nsigma = responseTr.GetSeparation(mRespParamsV2, trk); + nsigma = responseTr.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDTr); break; } case idxHe: { - nsigma = responseHe.GetSeparation(mRespParamsV2, trk); + nsigma = responseHe.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDHe); break; } case idxAl: { - nsigma = responseAl.GetSeparation(mRespParamsV2, trk); + nsigma = responseAl.GetSeparation(mRespParamsV3, trk); aod::pidutils::packInTable(nsigma, tablePIDAl); break; } @@ -1037,56 +1037,56 @@ struct tofPidMerge { for (auto const& pidId : mEnabledParticlesFull) { // Loop on enabled particle hypotheses with full tables switch (pidId) { case idxEl: { - resolution = responseEl.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responseEl.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responseEl.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseEl.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullEl(resolution, nsigma); break; } case idxMu: { - resolution = responseMu.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responseMu.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responseMu.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseMu.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullMu(resolution, nsigma); break; } case idxPi: { - resolution = responsePi.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responsePi.GetSeparation(mRespParamsV2, trk); + resolution = responsePi.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responsePi.GetSeparation(mRespParamsV3, trk); tablePIDFullPi(resolution, nsigma); break; } case idxKa: { - resolution = responseKa.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responseKa.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responseKa.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseKa.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullKa(resolution, nsigma); break; } case idxPr: { - resolution = responsePr.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responsePr.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responsePr.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responsePr.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullPr(resolution, nsigma); break; } case idxDe: { - resolution = responseDe.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responseDe.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responseDe.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseDe.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullDe(resolution, nsigma); break; } case idxTr: { - resolution = responseTr.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responseTr.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responseTr.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseTr.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullTr(resolution, nsigma); break; } case idxHe: { - resolution = responseHe.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responseHe.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responseHe.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseHe.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullHe(resolution, nsigma); break; } case idxAl: { - resolution = responseAl.GetExpectedSigma(mRespParamsV2, trk); - nsigma = responseAl.GetSeparation(mRespParamsV2, trk, resolution); + resolution = responseAl.GetExpectedSigma(mRespParamsV3, trk); + nsigma = responseAl.GetSeparation(mRespParamsV3, trk, resolution); tablePIDFullAl(resolution, nsigma); break; } @@ -1107,7 +1107,7 @@ struct tofPidBeta { Produces tablePIDTOFMass; Configurable expreso{"tof-expreso", 80, "Expected resolution for the computation of the expected beta"}; // Detector response and input parameters - o2::pid::tof::TOFResoParamsV2 mRespParamsV2; + o2::pid::tof::TOFResoParamsV3 mRespParamsV3; Service ccdb; Configurable paramFileName{"paramFileName", "", "Path to the parametrization object. If empty the parametrization is not taken from file"}; Configurable url{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; @@ -1154,36 +1154,36 @@ struct tofPidBeta { o2::tof::ParameterCollection paramCollection; paramCollection.loadParamFromFile(fname, parametrizationPath.value); LOG(info) << "+++ Loaded parameter collection from file +++"; - if (!paramCollection.retrieveParameters(mRespParamsV2, passName.value)) { + if (!paramCollection.retrieveParameters(mRespParamsV3, passName.value)) { if (fatalOnPassNotAvailable) { LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } else { LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } } else { - mRespParamsV2.setMomentumChargeShiftParameters(paramCollection.getPars(passName.value)); - mRespParamsV2.printMomentumChargeShiftParameters(); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection.getPars(passName.value)); + mRespParamsV3.printMomentumChargeShiftParameters(); } } else { - mRespParamsV2.loadParamFromFile(fname.data(), parametrizationPath.value); + mRespParamsV3.loadParamFromFile(fname.data(), parametrizationPath.value); } } else { // Loading it from CCDB LOG(info) << "Loading exp. sigma parametrization from CCDB, using path: " << parametrizationPath.value << " for timestamp " << timestamp.value; o2::tof::ParameterCollection* paramCollection = ccdb->getForTimeStamp(parametrizationPath.value, timestamp.value); paramCollection->print(); - if (!paramCollection->retrieveParameters(mRespParamsV2, passName.value)) { + if (!paramCollection->retrieveParameters(mRespParamsV3, passName.value)) { if (fatalOnPassNotAvailable) { LOGF(fatal, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } else { LOGF(warning, "Pass '%s' not available in the retrieved CCDB object", passName.value.data()); } } else { - mRespParamsV2.setMomentumChargeShiftParameters(paramCollection->getPars(passName.value)); - mRespParamsV2.printMomentumChargeShiftParameters(); + mRespParamsV3.setMomentumChargeShiftParameters(paramCollection->getPars(passName.value)); + mRespParamsV3.printMomentumChargeShiftParameters(); } } - mRespParamsV2.print(); + mRespParamsV3.print(); } using Trks = soa::Join; @@ -1205,7 +1205,7 @@ struct tofPidBeta { } if (enableTableMass) { if (enableTOFParams) { - tablePIDTOFMass(o2::pid::tof::TOFMass::GetTOFMass(trk.tofExpMom() / (1.f + trk.sign() * mRespParamsV2.getMomentumChargeShift(trk.eta())), beta)); + 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)); }