Skip to content

Commit

Permalink
Added sigma_{xyz} to Vertices table
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucio Anderlini authored and Lucio Anderlini committed Aug 20, 2023
1 parent e6005b9 commit 0090cdb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/PVReconstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
)");
Expand All @@ -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);
}
}
3 changes: 3 additions & 0 deletions src/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0090cdb

Please sign in to comment.