From 0090cdbf6802a967ed64ad54a976560ff529105c Mon Sep 17 00:00:00 2001 From: Lucio Anderlini Date: Sun, 20 Aug 2023 16:20:00 +0200 Subject: [PATCH] Added sigma_{xyz} to Vertices table --- src/PVReconstruction.cpp | 20 ++++++++++++++++++-- src/schema.sql | 3 +++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/PVReconstruction.cpp b/src/PVReconstruction.cpp index be4074c..b857e65 100644 --- a/src/PVReconstruction.cpp +++ b/src/PVReconstruction.cpp @@ -164,14 +164,18 @@ namespace SQLamarr INSERT INTO Vertices ( mcvertex_id, genevent_id, vertex_type, - x, y, z + x, y, z, + sigma_x, sigma_y, sigma_z ) SELECT mcv.mcvertex_id, mcv.genevent_id, ? AS vertex_type, mcv.x + rnd_ggg(?, ?, ?, ?, ?, ?), mcv.y + rnd_ggg(?, ?, ?, ?, ?, ?), - mcv.z + rnd_ggg(?, ?, ?, ?, ?, ?) + mcv.z + rnd_ggg(?, ?, ?, ?, ?, ?), + ? AS sigma_x, + ? AS sigma_y, + ? AS sigma_z FROM MCVertices AS mcv WHERE mcv.is_primary == TRUE )"); @@ -189,6 +193,18 @@ namespace SQLamarr sqlite3_bind_double(reco_pv, slot_id++, m_parametrization.data[iCoord].sigma3); } + for (int iCoord = 0; iCoord < 3; ++iCoord) + { + float min_sigma = m_parametrization.data[iCoord].sigma1; + if (min_sigma < m_parametrization.data[iCoord].sigma2) + min_sigma = m_parametrization.data[iCoord].sigma2; + if (min_sigma < m_parametrization.data[iCoord].sigma3) + min_sigma = m_parametrization.data[iCoord].sigma3; + + sqlite3_bind_double(reco_pv, slot_id++, min_sigma); + } + + exec_stmt(reco_pv); } } diff --git a/src/schema.sql b/src/schema.sql index 26b4fed..fa24907 100644 --- a/src/schema.sql +++ b/src/schema.sql @@ -98,6 +98,9 @@ constexpr char SQL_CREATE_SCHEMA[] = R"( x REAL, y REAL, z REAL, + sigma_x REAL, + sigma_y REAL, + sigma_z REAL, vertex_type INTEGER, FOREIGN KEY(mcvertex_id) REFERENCES MCVertices(mcvertex_id), FOREIGN KEY(genevent_id) REFERENCES GenEvents(genevent_id)