ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
c2_factory.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file c2_factory.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
36 //
37 
38 #ifndef __has_c2_factory_hh
39 #define __has_c2_factory_hh 1
40 
41 #include "c2_function.hh"
42 
56 template <typename float_type> class c2_factory {
57 public:
58 
61  &classic_function(float_type (*c_func)(float_type))
62  { return *new c2_classic_function_p<float_type>(c_func); }
65  { return *new c2_plugin_function_p<float_type>(); }
69  { return *new c2_plugin_function_p<float_type>(f); }
79  &scaled_function(const c2_function<float_type> &outer, float_type scale)
80  { return *new c2_scaled_function_p<float_type>(outer, scale); }
84  { return *new c2_cached_function_p<float_type>(func); }
87  &constant(float_type x) { return *new c2_constant_p<float_type>(x); }
91  { return *new interpolating_function_p<float_type>(); }
110  float_type x0, const c2_function<float_type> &f0, float_type x2,
111  const c2_function<float_type> &f2, bool auto_center, float_type y1)
112  {return *new c2_connector_function_p<float_type>(x0, f0, x2, f2,
113  auto_center, y1); }
116  const c2_fblock<float_type> &fb0, const c2_fblock<float_type> &fb2,
117  bool auto_center, float_type y1)
118  { return *new c2_connector_function_p<float_type>(fb0, fb2,
119  auto_center, y1); }
122  float_type x0, float_type y0, float_type yp0, float_type ypp0,
123  float_type x2, float_type y2, float_type yp2, float_type ypp2,
124  bool auto_center, float_type y1)
126  x0, y0, yp0, ypp0, x2, y2, yp2, ypp2, auto_center, y1); }
129  { return *new c2_piecewise_function_p<float_type>(); }
131 static c2_sin_p<float_type> &sin() { return *new c2_sin_p<float_type>(); }
133 static c2_cos_p<float_type> &cos() { return *new c2_cos_p<float_type>(); }
135 static c2_tan_p<float_type> &tan() { return *new c2_tan_p<float_type>(); }
137 static c2_log_p<float_type> &log() { return *new c2_log_p<float_type>(); }
139 static c2_exp_p<float_type> &exp() { return *new c2_exp_p<float_type>(); }
143 static c2_recip_p<float_type> &recip(float_type scale=1)
144  { return *new c2_recip_p<float_type>(scale); }
147  { return *new c2_identity_p<float_type>(); }
150  &linear(float_type x0, float_type y0, float_type slope)
151  { return *new c2_linear_p<float_type>(x0, y0, slope); }
154  float_type x0, float_type y0, float_type xcoef, float_type x2coef)
155  { return *new c2_quadratic_p<float_type>(x0, y0, xcoef, x2coef); }
157 static c2_power_law_p<float_type> &power_law(float_type scale, float_type power)
158  { return *new c2_power_law_p<float_type>(scale, power); }
162  { return *new c2_inverse_function_p<float_type>(source); }
163 
164 #if 0
165 
166 
167 template <template <typename f_t> class Final >
169  & inverse_integrated_density_bins(const std::vector<float_type> &bincenters,
170  const std::vector<float_type> &binheights)
171  throw(c2_exception)
172  {
173  return ::inverse_integrated_density_bins<float_type, Final<float_type> >
174  (bincenters, binheights);
175  }
178 template <template <typename f_t> class Final >
180  & inverse_integrated_density_function(
181  const std::vector<float_type> &bincenters,
182  const c2_function<float_type> &binheights)
183  throw(c2_exception)
184  {
185  return ::inverse_integrated_density_function<float_type,
186  Final<float_type> >
187  (bincenters, binheights);
188  }
189 #endif
190 
191 };
192 
193 #endif