SQLamarr
The stand-alone ultra-fast simulation option for the LHCb experiment
Plugin.h
1 // (c) Copyright 2022 CERN for the benefit of the LHCb Collaboration.
2 //
3 // This software is distributed under the terms of the GNU General Public
4 // Licence version 3 (GPL Version 3), copied verbatim in the file "LICENCE".
5 //
6 // In applying this licence, CERN does not waive the privileges and immunities
7 // granted to it by virtue of its status as an Intergovernmental Organization
8 // or submit itself to any jurisdiction.
9 
10 
11 #pragma once
12 //STL
13 #include <vector>
14 #include <string>
15 
16 // SQLamarr
17 #include "SQLamarr/BasePlugin.h"
18 
19 namespace SQLamarr
20 {
45  class Plugin: public BasePlugin
46  {
47  public:
50  SQLite3DB& db,
52  const std::string& library,
54  const std::string& function_name,
56  const std::string& select_query,
60  const std::string& output_table,
62  const std::vector<std::string> outputs,
66  const std::vector<std::string> reference_keys = {"ref_id"}
68  )
69  : BasePlugin(db, library, function_name, select_query,
70  output_table, outputs, reference_keys)
71  , m_func (load_func<mlfunc>(function_name))
72  {}
73 
74 
75  private:
76  virtual
77  void eval_parametrization (float* output, const float* input) override;
79 
80  typedef float *(*mlfunc)(float *, const float*);
81  mlfunc m_func;
82  };
83 }
84 
85 
86 
Interface to dynamically linked parametrizations.
Definition: BasePlugin.h:60
BasePlugin(SQLite3DB &db, const std::string &library, const std::string &function_name, const std::string &select_query, const std::string &output_table, const std::vector< std::string > outputs, const std::vector< std::string > reference_keys={"ref_id"})
Constructor.
Definition: BasePlugin.cpp:29
Wrap an external function as defined in a compiled shared library.
Definition: Plugin.py:29
Plugin(SQLite3DB &db, const std::string &library, const std::string &function_name, const std::string &select_query, const std::string &output_table, const std::vector< std::string > outputs, const std::vector< std::string > reference_keys={"ref_id"})
Constructor.
Definition: Plugin.h:49
A database connection handler easying sharing the DB between C++ and Python.
Definition: db_functions.py:24