From b32329ca89bdae1c65f9146b2330d5235470c298 Mon Sep 17 00:00:00 2001 From: maciacco Date: Wed, 17 Apr 2024 15:20:33 +0200 Subject: [PATCH 1/2] further improvements to task --- PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx | 62 ++++++++++---------------- 1 file changed, 24 insertions(+), 38 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx index 486900719eb..3421a55cfb5 100644 --- a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx +++ b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx @@ -51,17 +51,13 @@ namespace { constexpr int kNpart = 2; constexpr double betheBlochDefault[kNpart][6]{{-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}, {-1.e32, -1.e32, -1.e32, -1.e32, -1.e32, -1.e32}}; -constexpr double estimatorsCorrelationCoef[1][2]{{-0.669108, 1.04489}}; -constexpr double estimatorsSigmaPars[1][4]{{0.933321, 0.0416976, -0.000936344, 8.92179e-06}}; -constexpr double deltaEstimatorNsigma[1][2]{{5.5, 5.}}; +constexpr double estimatorsCorrelationCoef[2]{-0.669108, 1.04489}; +constexpr double estimatorsSigmaPars[4]{0.933321, 0.0416976, -0.000936344, 8.92179e-06}; +constexpr double deltaEstimatorNsigma[2]{5.5, 5.}; constexpr double partMass[kNpart]{o2::constants::physics::MassProton, o2::constants::physics::MassDeuteron}; constexpr double partPdg[kNpart]{2212, o2::constants::physics::kDeuteron}; static const std::vector betheBlochParNames{"p0", "p1", "p2", "p3", "p4", "resolution"}; static const std::vector particleNamesBB{"p", "d"}; -static const std::vector estimatorsCorrelationCoefParNames{"p0", "p1"}; -static const std::vector estimatorsSigmaParNames{"p0", "p1", "p2", "p3"}; -static const std::vector deltaEstimatorNsigmaParNames{"low", "high"}; -static const std::vector datasetNames{"LHC18qr"}; std::array, kNpart> tempTracks; std::shared_ptr tempAntiLambda; std::shared_ptr tempLambda; @@ -165,15 +161,12 @@ struct antidLambdaEbye { o2::vertexing::DCAFitterN<2> fitter; int nSubsamples; - + int mRunNumber; float d_bz; // o2::base::MatLayerCylSet* lut = nullptr; Configurable cfgMaterialCorrection{"cfgMaterialCorrection", static_cast(o2::base::Propagator::MatCorrType::USEMatCorrNONE), "Type of material correction"}; Configurable> cfgBetheBlochParams{"cfgBetheBlochParams", {betheBlochDefault[0], 2, 6, particleNamesBB, betheBlochParNames}, "TPC Bethe-Bloch parameterisation for deuteron"}; - Configurable> cfgEstimatorsCorrelationCoef{"cfgEstimatorsCorrelationCoef", {estimatorsCorrelationCoef[0], 1, 2, datasetNames, estimatorsCorrelationCoefParNames}, "estimators correlation parameters"}; - Configurable> cfgEstimatorsSigmaPars{"cfgEstimatorsSigmaPars", {estimatorsSigmaPars[0], 1, 4, datasetNames, estimatorsSigmaParNames}, "estimators sigma parameters"}; - Configurable> cfgDeltaEstimatorNsigma{"cfgDeltaEstimatorNsigma", {deltaEstimatorNsigma[0], 1, 2, datasetNames, deltaEstimatorNsigmaParNames}, "estimators nsigma cut"}; ConfigurableAxis centAxis{"centAxis", {106, 0, 106}, "binning for the centrality"}; ConfigurableAxis subsampleAxis{"subsampleAxis", {30, 0, 30}, "binning of the subsample axis"}; @@ -235,6 +228,7 @@ struct antidLambdaEbye { Configurable v0trackNsharedClusTpc{"v0trackNsharedClusTpc", 10, "Maximum number of shared TPC clusters for V0 daughter"}; Configurable v0requireITSrefit{"v0requireITSrefit", false, "require ITS refit for V0 daughter"}; Configurable vetoMassK0Short{"vetoMassK0Short", -999.f, "veto for V0 compatible with K0s mass"}; + Configurable v0radiusMax{"v0radiusMax", -999.f, "maximum V0 radius eccepted"}; Configurable antidNsigmaTpcCutLow{"antidNsigmaTpcCutLow", 4.f, "TPC PID cut low"}; Configurable antidNsigmaTpcCutUp{"antidNsigmaTpcCutUp", 4.f, "TPC PID cut up"}; @@ -370,6 +364,10 @@ struct antidLambdaEbye { template void initCCDB(Bc const& bc) { + if (mRunNumber == bc.runNumber()) { + return; + } + auto timestamp = bc.timestamp(); o2::parameters::GRPObject* grpo = 0x0; o2::parameters::GRPMagField* grpmag = 0x0; @@ -391,6 +389,7 @@ struct antidLambdaEbye { // Fetch magnetic field from ccdb for current collision d_bz = o2::base::Propagator::Instance()->getNominalBz(); LOG(info) << "Retrieved GRP for timestamp " << timestamp << " with magnetic field of " << d_bz << " kG"; + mRunNumber = bc.runNumber(); fitter.setBz(d_bz); // o2::base::Propagator::Instance()->setMatLUT(lut); @@ -399,6 +398,7 @@ struct antidLambdaEbye { void init(o2::framework::InitContext&) { + mRunNumber = 0; d_bz = 0; ccdb->setURL("http://alice-ccdb.cern.ch"); @@ -633,6 +633,12 @@ struct antidLambdaEbye { } } + auto posDcaToPv = std::hypot(posTrack.dcaXY(), posTrack.dcaZ()); + auto negDcaToPv = std::hypot(negTrack.dcaXY(), negTrack.dcaZ()); + if (std::abs(posDcaToPv) < v0setting_dcapostopv || std::abs(negDcaToPv) < v0setting_dcanegtopv) { + continue; + } + auto posTrackCov = getTrackParCov(posTrack); auto negTrackCov = getTrackParCov(negTrack); @@ -679,16 +685,6 @@ struct antidLambdaEbye { continue; } - // pid selections - double expBethePos{tpc::BetheBlochAleph(static_cast(posTrack.tpcInnerParam() / massPos), cfgBetheBlochParams->get("p0"), cfgBetheBlochParams->get("p1"), cfgBetheBlochParams->get("p2"), cfgBetheBlochParams->get("p3"), cfgBetheBlochParams->get("p4"))}; - double expSigmaPos{expBethePos * cfgBetheBlochParams->get("resolution")}; - auto nSigmaTPCPos = static_cast((posTrack.tpcSignal() - expBethePos) / expSigmaPos); - double expBetheNeg{tpc::BetheBlochAleph(static_cast(negTrack.tpcInnerParam() / massNeg), cfgBetheBlochParams->get("p0"), cfgBetheBlochParams->get("p1"), cfgBetheBlochParams->get("p2"), cfgBetheBlochParams->get("p3"), cfgBetheBlochParams->get("p4"))}; - double expSigmaNeg{expBetheNeg * cfgBetheBlochParams->get("resolution")}; - auto nSigmaTPCNeg = static_cast((negTrack.tpcSignal() - expBetheNeg) / expSigmaNeg); - - if (std::abs(nSigmaTPCPos) > v0setting_nsigmatpc || std::abs(nSigmaTPCNeg) > v0setting_nsigmatpc) - ; float dcaV0dau = std::sqrt(fitter.getChi2AtPCACandidate()); if (dcaV0dau > v0setting_dcav0dau) { @@ -697,28 +693,18 @@ struct antidLambdaEbye { std::array primVtx = {collision.posX(), collision.posY(), collision.posZ()}; const auto& vtx = fitter.getPCACandidate(); - double cosPA = RecoDecay::cpa(primVtx, vtx, momV0); - if (cosPA < v0setting_cospa) { - continue; - } float radiusV0 = std::hypot(vtx[0], vtx[1]); - if (radiusV0 < v0setting_radius) { + if (radiusV0 < v0setting_radius || radiusV0 > v0radiusMax) { continue; } - gpu::gpustd::array dcaInfo; - - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, posTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo); - auto posDcaToPv = dcaInfo[0]; - - o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, negTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo); - auto negDcaToPv = dcaInfo[0]; - - if (std::abs(posDcaToPv) < v0setting_dcapostopv || std::abs(negDcaToPv) < v0setting_dcanegtopv) { + double cosPA = RecoDecay::cpa(primVtx, vtx, momV0); + if (cosPA < v0setting_cospa) { continue; } + if (std::abs(mLambda - o2::constants::physics::MassLambda0) > lambdaMassCutQA) { // for QA histograms continue; } @@ -1022,9 +1008,9 @@ struct antidLambdaEbye { auto centralityCl0 = collision.centRun2CL0(); if (kUseEstimatorsCorrelationCut) { const auto& x = centralityCl0; - const double center = cfgEstimatorsCorrelationCoef->get("p0") + cfgEstimatorsCorrelationCoef->get("p1") * x; - const double sigma = cfgEstimatorsSigmaPars->get("p0") + cfgEstimatorsSigmaPars->get("p1") * x + cfgEstimatorsSigmaPars->get("p2") * std::pow(x, 2) + cfgEstimatorsSigmaPars->get("p3") * std::pow(x, 3); - if (centrality < center - cfgDeltaEstimatorNsigma->get("low") * sigma || centrality > center + cfgDeltaEstimatorNsigma->get("high") * sigma) { + const double center = estimatorsCorrelationCoef[0] + estimatorsCorrelationCoef[1] * x; + const double sigma = estimatorsSigmaPars[0] + estimatorsSigmaPars[1] * x + estimatorsSigmaPars[2] * std::pow(x, 2) + estimatorsSigmaPars[3] * std::pow(x, 3); + if (centrality < center - deltaEstimatorNsigma[0] * sigma || centrality > center + deltaEstimatorNsigma[1] * sigma) { continue; } } From 7c0477fba2499eed77e0e8605fc6f1fb6bd071f2 Mon Sep 17 00:00:00 2001 From: maciacco Date: Wed, 17 Apr 2024 22:17:20 +0200 Subject: [PATCH 2/2] do propagation in this task --- PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx index 3421a55cfb5..03e2368b57c 100644 --- a/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx +++ b/PWGLF/Tasks/Nuspex/antidLambdaEbye.cxx @@ -44,7 +44,7 @@ using namespace o2; using namespace o2::framework; using namespace o2::framework::expressions; -using TracksFull = soa::Join; +using TracksFull = soa::Join; using BCsWithRun2Info = soa::Join; namespace @@ -542,6 +542,7 @@ struct antidLambdaEbye { auto rnd = static_cast(gen32()) / static_cast(gen32.max()); auto subsample = static_cast(rnd * nSubsamples); + gpu::gpustd::array dcaInfo; for (const auto& track : tracks) { if (!selectTrack(track)) { continue; @@ -551,7 +552,9 @@ struct antidLambdaEbye { continue; } - if (std::hypot(track.dcaXY(), track.dcaZ()) > trackDcaCut) { + auto trackParCov = getTrackParCov(track); + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCov, 2.f, fitter.getMatCorrType(), &dcaInfo); + if (std::hypot(dcaInfo[0], dcaInfo[1]) > trackDcaCut) { continue; } @@ -633,12 +636,6 @@ struct antidLambdaEbye { } } - auto posDcaToPv = std::hypot(posTrack.dcaXY(), posTrack.dcaZ()); - auto negDcaToPv = std::hypot(negTrack.dcaXY(), negTrack.dcaZ()); - if (std::abs(posDcaToPv) < v0setting_dcapostopv || std::abs(negDcaToPv) < v0setting_dcanegtopv) { - continue; - } - auto posTrackCov = getTrackParCov(posTrack); auto negTrackCov = getTrackParCov(negTrack); @@ -685,7 +682,6 @@ struct antidLambdaEbye { continue; } - float dcaV0dau = std::sqrt(fitter.getChi2AtPCACandidate()); if (dcaV0dau > v0setting_dcav0dau) { continue; @@ -704,6 +700,17 @@ struct antidLambdaEbye { continue; } + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, posTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo); + auto posDcaToPv = std::hypot(dcaInfo[0], dcaInfo[1]); + if (posDcaToPv > v0setting_dcapostopv) { + continue; + } + + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, negTrackCov, 2.f, fitter.getMatCorrType(), &dcaInfo); + auto negDcaToPv = std::hypot(dcaInfo[0], dcaInfo[1]); + if (negDcaToPv > v0setting_dcanegtopv) { + continue; + } if (std::abs(mLambda - o2::constants::physics::MassLambda0) > lambdaMassCutQA) { // for QA histograms continue;