Abstract Interface for loading data to the internal database. More...
#include <AbsDataLoader.h>
Public Member Functions | |
BaseSqlInterface (SQLite3DB &db) | |
Constructor, acquiring the database without ownership. More... | |
Public Member Functions inherited from SQLamarr::BaseSqlInterface | |
BaseSqlInterface (SQLite3DB &db) | |
Constructor, acquiring the database without ownership. More... | |
virtual | ~BaseSqlInterface () |
void | sync_database (const std::string &db_uri) |
void | invalidate_cache (void) |
Invalidate the cache of the queries. More... | |
Protected Member Functions | |
int | insert_event (const std::string &data_source, uint64_t run_number, uint64_t evt_number) |
Insert data source reference in the DataSources table. More... | |
int | insert_collision (int datasource_id, int collision, float t, float x, float y, float z) |
Insert a collision in the GenEvent table. More... | |
int | insert_vertex (int genevent_id, int hepmc_id, int status, float t, float x, float y, float z, bool is_primary) |
Insert a vertex in the GenVertices More... | |
int | insert_particle (int genevent_id, int hepmc_id, int production_vertex, int end_vertex, int pid, int status, float pe, float px, float py, float pz, float m) |
Insert a particle in the GenParticles table. More... | |
Protected Member Functions inherited from SQLamarr::BaseSqlInterface | |
sqlite3_stmt * | get_statement (const std::string &name, const std::string &query) |
Creates or retrieve from cache a statement. More... | |
void | begin_transaction () |
Begin an SQL transaction stopping update to disk util end_transaction() is issued More... | |
void | end_transaction () |
End an SQL transaction re-enabling disk updates. More... | |
int | last_insert_row () |
Return the index of the last rows inserted in any table. More... | |
void | using_sql_function (const std::string &name, int argc, void(*xFunc)(sqlite3_context *, int, sqlite3_value **)) |
Register a static function in DB, enabling usage from SQL. More... | |
bool | exec_stmt (sqlite3_stmt *) |
Execute a statement, possibly throwing an exception on failure. More... | |
Additional Inherited Members | |
Protected Attributes inherited from SQLamarr::BaseSqlInterface | |
SQLite3DB & | m_database |
Reference to the SQLite database (not owned). More... | |
Abstract Interface for loading data to the internal database.
AbsDataLoader
provides a generic interface to load generator-level data to the database from external sources.
The input data follows the schema of the HepMC data format with generator-level vertices (GenVertex
) nodes connected by generator-level particles (GenParticle
). Each particle connects at most two vertices:
production_vertex
representing the origin of the particle;end_vertex
representing the end of the particle trajectory.Each GenVertex
may have multiple input and multiple output particles.
In the HepMC standard, vertices and particles belonging to the same graph are grouped in a GenEvent
object. Unfortunately, in LHCb as in most experiments with accelerators, the word "event" refers to a time-slice corresponding to a bunch crossing and may include multiple concurrent collisions, each resulting in an independent graph.
In Lamarr, we stick to such a naming convention:
GenEvent
, in Lamarr is a collision
GenEvent
s due to pile-up, is an event
.AbsDataLoader
should be implemented to provide the logic for loading the data, without the need of re-implementing the interactions with the database.
Definition at line 53 of file AbsDataLoader.h.
SQLamarr::BaseSqlInterface::BaseSqlInterface |
Constructor, acquiring the database without ownership.
Definition at line 38 of file BaseSqlInterface.cpp.
|
protected |
Insert a collision in the GenEvent
table.
Coordinates represent the origin of the event enabling global and rigid translation of the whole decay tree.
datasource_id | Unique identifier of the HEP event |
collision | HepMC identifier of the `GenEvent` |
t | Time coordinate |
x | x coordinate |
y | y coordinate |
z | z coordinate |
|
protected |
Insert data source reference in the DataSources
table.
data_source | Unique identifer of the data source, e.g. a file path |
run_number | Unique identifier of the run |
evt_number | Unique identifier of the event |
|
protected |
Insert a particle in the GenParticles
table.
genevent_id | Global identifier of the collision |
hepmc_id | HepMC identifier of the particle |
production_vertex | Global identifier of the production vertex |
end_vertex | Global identifier of the end vertex |
pid | PDG Identifier of the particle type |
status | HepMC status value |
pe | Energy of the particle |
px | *x* coordinate of the momentum |
py | *y* coordinate of the momentum |
pz | *z* coordinate of the momentum |
m | Generated mass which in HepMC may differ from \(\sqrt{e^2-p^2}\) for resonances |
|
protected |
Insert a vertex in the GenVertices
genevent_id | Global identifier of the collision |
hepmc_id | HepMC identifier of the vertex |
status | HepMC status |
t | Vertex time coordinate |
x | Vertex *x* coordinate |
y | Vertex *y* coordinate |
z | Vertex *z* coordinate |
is_primary | Boolean flag identifying primary vertices |