SQLamarr
The stand-alone ultra-fast simulation option for the LHCb experiment
GenerativePlugin.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 {
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  unsigned int n_random,
69  const std::vector<std::string> reference_keys = {"ref_id"}
71  )
72  : BasePlugin(db, library, function_name, select_query,
73  output_table, outputs, reference_keys)
74  , m_func(load_func<genfunc>(function_name))
75  , m_n_random (n_random)
76  {}
77 
78 
79  private:
80  virtual
81  void eval_parametrization (float* output, const float* input) override;
83 
84  typedef float *(*genfunc)(float *, const float*, const float*);
85  genfunc m_func;
86 
87  unsigned int m_n_random;
88  };
89 }
90 
91 
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
Wrapper to a compiled parametrization taking conditions and noise as input.
GenerativePlugin(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, unsigned int n_random, const std::vector< std::string > reference_keys={"ref_id"})
Constructor.
A database connection handler easying sharing the DB between C++ and Python.
Definition: db_functions.py:24