15 #include "SQLamarr/HepMC2DataLoader.h"
16 #include "SQLamarr/PVFinder.h"
17 #include "SQLamarr/db_functions.h"
18 #include "SQLamarr/MCParticleSelector.h"
19 #include "SQLamarr/PVReconstruction.h"
20 #include "SQLamarr/Plugin.h"
21 #include "SQLamarr/GenerativePlugin.h"
22 #include "SQLamarr/GlobalPRNG.h"
23 #include "SQLamarr/TemporaryTable.h"
24 #include "SQLamarr/CleanEventStore.h"
25 #include "SQLamarr/EditEventStore.h"
26 #include "SQLamarr/UpdateDBConnection.h"
27 #include "SQLamarr/SQLiteError.h"
53 std::vector<std::string> tokenize (
const char*);
59 void *make_database(
const char* db_file)
62 return reinterpret_cast<void *
>(db);
69 void del_database(
void *db)
78 void GlobalPRNG_get_or_create(
void* db,
int seed)
90 void* new_HepMC2DataLoader (
void *db)
97 void del_HepMC2DataLoader (
void *
self)
103 void HepMC2DataLoader_load (
105 const char* file_path,
112 loader->sync_database(db_uri);
113 loader->load(file_path, runNumber, evtNumber);
114 loader->invalidate_cache();
115 loader->sync_database(db_uri);
127 return {PVFinder, p};
149 const char* file_path,
150 const char* table_name,
151 const char* condition
156 file_path, table_name, condition);
167 const char* library_path,
168 const char* function_name,
170 const char* output_table,
171 const char* semicolon_separated_outputs,
172 const char* semicolon_separated_references
182 tokenize(semicolon_separated_outputs),
183 tokenize(semicolon_separated_references)
193 const char* library_path,
194 const char* function_name,
196 const char* output_table,
197 const char* semicolon_separated_outputs,
199 const char* semicolon_separated_references
209 tokenize(semicolon_separated_outputs),
211 tokenize(semicolon_separated_references)
222 const char* output_table,
223 const char* semicolon_separated_outputs,
224 const char* semicolon_separated_queries,
232 tokenize(semicolon_separated_outputs),
233 tokenize(semicolon_separated_queries),
255 const char* semicolon_separated_queries
260 tokenize(semicolon_separated_queries)
288 case MCParticleSelector:
291 case PVReconstruction:
297 case GenerativePlugin:
303 case CleanEventStore:
309 case UpdateDBConnection:
313 throw std::bad_cast();
327 case MCParticleSelector:
329 case PVReconstruction:
333 case GenerativePlugin:
337 case CleanEventStore:
341 case UpdateDBConnection:
345 throw std::bad_cast();
358 case MCParticleSelector:
361 case PVReconstruction:
367 case GenerativePlugin:
373 case CleanEventStore:
379 case UpdateDBConnection:
392 for (iAlg = 0; iAlg < algc; ++iAlg)
398 clear_cache_if_any(algv[iAlg]);
402 std::cerr <<
"Caught SQL error processing #alg: " << iAlg <<
"\n";
403 std::cerr << e.what() << std::endl;
406 catch (
const std::logic_error& e)
408 std::cerr <<
"Caught logic error processing #alg: " << iAlg <<
"\n";
409 std::cerr << e.what() << std::endl;
421 std::vector<std::string> tokenize (
const char* input_str)
424 std::vector<std::string> ret;
428 strcpy(buf, input_str);
431 char *token = strtok(buf,
";");
433 while (token != NULL)
435 ret.push_back(token);
436 token = strtok(NULL,
";");
static SmearingParametrization load_parametrization(const std::string file_path, const std::string table_name, const std::string condition)
Instanciate a SmearingParametrization object from an SQLite file.
static PRNG * get_or_create(const sqlite3_context *db, uint64_t seed=no_seed)
Return a pointer to an initialized generator.
A database connection handler easying sharing the DB between C++ and Python.
SQLite3DB make_database(std::string filename, int flags=SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_URI, std::string init=std::string())
Initialize the database.
std::unique_ptr< sqlite3, void(*)(sqlite3 *)> SQLite3DB
Unique pointer to the sqlite3 connection.