From 3611ba9e64e595ffaf592a4300eb8697968e1376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Wed, 2 Nov 2022 21:32:38 +0100 Subject: [PATCH 1/2] Extend V0 tracking QC - catch runtime errors of secondary vertexer --- .../AOTTrack/qaK0sTrackingEfficiency.cxx | 71 +++++++++++++++++-- PWGLF/TableProducer/cascadebuilder.cxx | 11 ++- 2 files changed, 76 insertions(+), 6 deletions(-) diff --git a/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx b/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx index 2d964595cdc..c63a1a85726 100644 --- a/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx +++ b/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx @@ -25,18 +25,24 @@ using namespace o2; using namespace o2::framework; -using PIDTracks = soa::Join; +using PIDTracks = soa::Join; +using PIDTracksIU = soa::Join; using SelectedCollisions = soa::Join; struct qaK0sTrackingEfficiency { + ConfigurableAxis nSigmaBins{"nSigmaBins", {1000, -100.f, 100.f}, "Binning for the nSigma histograms"}; HistogramRegistry registry{"K0sTrackingEfficiency"}; +#define fillHistogram(name, ...) registry.fill(HIST(name), __VA_ARGS__) void init(InitContext const&) { const AxisSpec RAxis{500, 0.f, 50.f, "#it{R} (cm)"}; const AxisSpec pTAxis{200, 0.f, 10.f, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec mAxis{200, 0.4f, 0.6f, "#it{m} (GeV/#it{c}^{2})"}; + const AxisSpec etaAxis{200, -1.f, 1.0f, "#it{#eta}"}; + const AxisSpec phiAxis{200, -1.f, 1.0f, "#it{#phi}"}; + const AxisSpec nsigmaAxis{200, -1.f, 1.0f, "#it{#phi}"}; const AxisSpec statusAxis{2, -0.5f, 1.5f, ""}; const AxisSpec hitMapAxis{128, -0.5f, 127.5f, ""}; @@ -49,10 +55,30 @@ struct qaK0sTrackingEfficiency { registry.add("Test/h_R", "h_R", {HistType::kTH1D, {RAxis}}); registry.add("Test/h_pT", "h_pT", {HistType::kTH1D, {pTAxis}}); registry.add("Test/h_mass", "h_mass", {HistType::kTH1D, {mAxis}}); + registry.add("Lambda/h_mass", "h_mass", {HistType::kTH1D, {mAxisLambda}}); + registry.add("AntiLambda/h_mass", "h_mass", {HistType::kTH1D, {mAxisLambda}}); registry.add("Test/h_negITSStatus", "h_negITSStatus", {HistType::kTH1I, {statusAxis}}); registry.add("Test/h_posITSStatus", "h_posITSStatus", {HistType::kTH1I, {statusAxis}}); registry.add("Test/h_negITSHitMap", "h_negITSHitMap", {HistType::kTH1I, {hitMapAxis}}); registry.add("Test/h_posITSHitMap", "h_posITSHitMap", {HistType::kTH1I, {hitMapAxis}}); + registry.add("VsPt/h_mass", "h_mass", HistType::kTH2F, {pTAxis, mAxis}); + registry.add("VsPt/h_tofnsigma", "h_tofnsigma", HistType::kTH2F, {pTAxis, nSigmaBins}); + registry.add("VsPt/h_tpcnsigma", "h_tpcnsigma", HistType::kTH2F, {pTAxis, nSigmaBins}); + registry.add("VsEta/h_mass", "h_mass", HistType::kTH2F, {etaAxis, mAxis}); + registry.add("VsPhi/h_mass", "h_mass", HistType::kTH2F, {phiAxis, mAxis}); + registry.add("VsRadius/h_mass", "h_mass", HistType::kTH2F, {RAxis, mAxis}); + + if (!doprocessIU) { + return; + } + // IU info + registry.add("VsRadiusPosIU/h_mass", "h_mass", HistType::kTH2F, {RAxis, mAxis}); + registry.add("VsRadiusPosIU/h_radius", "IU Radius of the negative track", HistType::kTH2F, {RAxis, RAxis}); + registry.add("VsRadiusPosIU/h_phi", "Phi", HistType::kTH2F, {RAxis, phiAxis}); + + registry.add("VsRadiusNegIU/h_mass", "h_mass", HistType::kTH2F, {RAxis, mAxis}); + registry.add("VsRadiusNegIU/h_radius", "IU Radius of the positive track", HistType::kTH2F, {RAxis, RAxis}); + registry.add("VsRadiusNegIU/h_phi", "Phi", HistType::kTH2F, {RAxis, phiAxis}); } // Selection criteria @@ -62,7 +88,7 @@ struct qaK0sTrackingEfficiency { Configurable eventSelection{"eventSelection", true, "event selection"}; template - bool acceptV0(T1 v0, T2 ntrack, T2 ptrack, C collision) + bool acceptV0(const T1& v0, const T2& ntrack, const T2& ptrack, const C& collision) { // Apply selections on V0 if (v0.v0cosPA(collision.posX(), collision.posY(), collision.posZ()) < v0cospa) @@ -89,13 +115,19 @@ struct qaK0sTrackingEfficiency { for (auto& v0 : fullV0s) { - auto reconegtrack = v0.negTrack_as(); - auto recopostrack = v0.posTrack_as(); + const auto& recopostrack = v0.posTrack_as(); + const auto& reconegtrack = v0.negTrack_as(); if (acceptV0(v0, reconegtrack, recopostrack, collision)) { registry.fill(HIST("Test/h_R"), v0.v0radius()); registry.fill(HIST("Test/h_pT"), v0.pt()); registry.fill(HIST("Test/h_mass"), v0.mK0Short()); + registry.fill(HIST("VsPt/h_mass"), v0.pt(), v0.mK0Short()); + registry.fill(HIST("VsPt/h_tpcnsigma"), v0.pt(), recopostrack.tpcNSigmaPi()); + registry.fill(HIST("VsPt/h_tofnsigma"), v0.pt(), recopostrack.tofNSigmaPi()); + registry.fill(HIST("VsEta/h_mass"), v0.eta(), v0.mK0Short()); + registry.fill(HIST("VsPhi/h_mass"), v0.phi(), v0.mK0Short()); + registry.fill(HIST("VsRadius/h_mass"), v0.v0radius(), v0.mK0Short()); registry.fill(HIST("Test/h_negITSStatus"), reconegtrack.hasITS()); registry.fill(HIST("Test/h_posITSStatus"), recopostrack.hasITS()); @@ -108,6 +140,37 @@ struct qaK0sTrackingEfficiency { } } } + + void processIU(SelectedCollisions::iterator const& collision, + aod::V0Datas const& fullV0s, + PIDTracksIU const&) + // TODO: add centrality + { + if (eventSelection && !collision.sel8()) { + return; + } + + float posRadius = 0.f; + float negRadius = 0.f; + for (auto& v0 : fullV0s) { + const auto& posTrackIU = v0.posTrack_as(); + const auto& negTrackIU = v0.negTrack_as(); + if (!acceptV0(v0, negTrackIU, posTrackIU, collision)) { + continue; + } + posRadius = sqrt(posTrackIU.x() * posTrackIU.x() + posTrackIU.y() * posTrackIU.y()); + negRadius = sqrt(negTrackIU.x() * negTrackIU.x() + negTrackIU.y() * negTrackIU.y()); + + fillHistogram("VsRadiusPosIU/h_mass", posRadius, v0.mK0Short()); + fillHistogram("VsRadiusPosIU/h_radius", posRadius, negRadius); + fillHistogram("VsRadiusPosIU/h_phi", posRadius, posTrackIU.phi()); + + fillHistogram("VsRadiusNegIU/h_mass", negRadius, v0.mK0Short()); + fillHistogram("VsRadiusNegIU/h_radius", negRadius, posRadius); + fillHistogram("VsRadiusNegIU/h_phi", negRadius, posTrackIU.phi()); + } + } + PROCESS_SWITCH(qaK0sTrackingEfficiency, processIU, "Run also on IU", true); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) diff --git a/PWGLF/TableProducer/cascadebuilder.cxx b/PWGLF/TableProducer/cascadebuilder.cxx index 7c6eb1aa85d..7b816b08ad1 100644 --- a/PWGLF/TableProducer/cascadebuilder.cxx +++ b/PWGLF/TableProducer/cascadebuilder.cxx @@ -356,8 +356,15 @@ struct cascadeBuilder { // Act on copies for minimization auto tV0Copy = o2::track::TrackParCov(tV0); auto bTrackCopy = o2::track::TrackParCov(bTrack); - - int nCand2 = fitterCasc.process(tV0Copy, bTrackCopy); + int nCand2 = 0; + try { + nCand2 = fitterCasc.process(tV0Copy, bTrackCopy); + } catch (...) { + LOG(error) << "Exception caught in fitterCasc.process"; + }; + if(nCand2 == 0){ + continue; + } double finalXv0 = fitterCasc.getTrack(0).getX(); double finalXbach = fitterCasc.getTrack(1).getX(); From d08be25a29ec77f57e03e1666b2b9341032d9a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Jacazio?= Date: Mon, 14 Nov 2022 11:14:45 +0100 Subject: [PATCH 2/2] Fix --- DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx | 2 -- PWGLF/TableProducer/cascadebuilder.cxx | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx b/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx index c63a1a85726..355c9423f9e 100644 --- a/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx +++ b/DPG/Tasks/AOTTrack/qaK0sTrackingEfficiency.cxx @@ -55,8 +55,6 @@ struct qaK0sTrackingEfficiency { registry.add("Test/h_R", "h_R", {HistType::kTH1D, {RAxis}}); registry.add("Test/h_pT", "h_pT", {HistType::kTH1D, {pTAxis}}); registry.add("Test/h_mass", "h_mass", {HistType::kTH1D, {mAxis}}); - registry.add("Lambda/h_mass", "h_mass", {HistType::kTH1D, {mAxisLambda}}); - registry.add("AntiLambda/h_mass", "h_mass", {HistType::kTH1D, {mAxisLambda}}); registry.add("Test/h_negITSStatus", "h_negITSStatus", {HistType::kTH1I, {statusAxis}}); registry.add("Test/h_posITSStatus", "h_posITSStatus", {HistType::kTH1I, {statusAxis}}); registry.add("Test/h_negITSHitMap", "h_negITSHitMap", {HistType::kTH1I, {hitMapAxis}}); diff --git a/PWGLF/TableProducer/cascadebuilder.cxx b/PWGLF/TableProducer/cascadebuilder.cxx index 7b816b08ad1..8f472a183f3 100644 --- a/PWGLF/TableProducer/cascadebuilder.cxx +++ b/PWGLF/TableProducer/cascadebuilder.cxx @@ -362,7 +362,7 @@ struct cascadeBuilder { } catch (...) { LOG(error) << "Exception caught in fitterCasc.process"; }; - if(nCand2 == 0){ + if (nCand2 == 0) { continue; } double finalXv0 = fitterCasc.getTrack(0).getX();