Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
hit::details::CompiledGausFitCacheBaseStruct Class Reference

#include <GausFitCache.h>

Inheritance diagram for hit::details::CompiledGausFitCacheBaseStruct:
hit::GausFitCache hit::CompiledGausFitCache< MaxGaus > hit::CompiledTruncatedGausFitCache< MaxGaus, CutOff >

Classes

struct  InitializeFuncSumVector
 A helper class initializing the function vector. More...
 
struct  InitializeFuncSumVector< 0U, Func >
 

Public Types

template<unsigned int NGaus, unsigned int CutOff>
using NGaussTruncClass = FuncSum< NGaus, gaus_trunc< CutOff >, 3U >
 Class around sum of NGaus Gaussian functions truncated at CutOff sigmas. More...
 

Public Member Functions

virtual TF1 * GetClone (size_t nGaus)
 Throws an exception (ROOT does not support cloning compiled functions) More...
 
virtual unsigned int MaxGaussians () const
 Returns the maximum number of Gaussians in a function that we support. More...
 
template<>
Double_t ngaus (Double_t const *x, Double_t const *params)
 
- Public Member Functions inherited from hit::GausFitCache
 GausFitCache (std::string new_name="GausFitCache")
 Constructor; optionally set the name of the repository. More...
 
virtual ~GausFitCache ()
 Destructor. More...
 
std::string GetName () const
 Return the name of this cache. More...
 
virtual TF1 * Get (size_t nFunc)
 Returns a function sum of nFunc base functions. More...
 
virtual std::string FunctionName (size_t nFunc) const
 Returns a name for the function with nFunc base functions. More...
 

Static Public Member Functions

static Double_t gaus (Double_t const *x, Double_t const *params)
 Single Gaussian function. More...
 
template<unsigned int CutOff>
static Double_t gaus_trunc (Double_t const *x, Double_t const *params)
 
template<unsigned int NGaus>
static Double_t ngaus (Double_t const *x, Double_t const *params)
 
template<unsigned int NGaus, unsigned int CutOff>
static Double_t ngaus_trunc (Double_t const *x, Double_t const *params)
 Sum of NGaus Gaussian functions truncated at CutOff sigmas. More...
 

Protected Member Functions

template<unsigned int NGaus>
void InitializeCompiledGausFitVector ()
 Returns a vector initialized with multigaussians. More...
 
template<unsigned int NGaus>
void AppendFunction ()
 Adds one function. More...
 
void CannotCreateFunction (size_t nGaus) const
 Throws an error asserting compiled functions can't be cretead run-time. More...
 
template<>
void InitializeCompiledGausFitVector ()
 
- Protected Member Functions inherited from hit::GausFitCache
virtual TF1 * CreateFunction (size_t nFunc) const
 Creates a new sum function. More...
 

Additional Inherited Members

- Protected Attributes inherited from hit::GausFitCache
std::string name
 name of the cache More...
 
std::vector< TF1 * > funcs
 

Detailed Description

Definition at line 148 of file GausFitCache.h.

Member Typedef Documentation

template<unsigned int NGaus, unsigned int CutOff>
using hit::details::CompiledGausFitCacheBaseStruct::NGaussTruncClass = FuncSum<NGaus, gaus_trunc<CutOff>, 3U>

Class around sum of NGaus Gaussian functions truncated at CutOff sigmas.

Definition at line 217 of file GausFitCache.h.

Member Function Documentation

template<unsigned int NGaus>
void hit::details::CompiledGausFitCacheBaseStruct::AppendFunction ( )
protected

Adds one function.

Definition at line 396 of file GausFitCache.h.

396  {
397  // create a function in the ficticious range [ 0, 1 ]:
398  funcs.push_back
399  (new TF1(FunctionName(NGaus).c_str(), &ngaus<NGaus>, 0., 1., 3*NGaus));
400  } // CompiledGausFitCacheBaseStruct::AppendFunction()
std::vector< TF1 * > funcs
Definition: GausFitCache.h:82
virtual std::string FunctionName(size_t nFunc) const
Returns a name for the function with nFunc base functions.
void hit::details::CompiledGausFitCacheBaseStruct::CannotCreateFunction ( size_t  nGaus) const
protected

Throws an error asserting compiled functions can't be cretead run-time.

Definition at line 104 of file GausFitCache.cxx.

105  {
107  << name << " function cache can't create functions at run-time; " << nFunc
108  << "-addend function was requested, but we have only functions with up to "
109  << MaxGaussians() << " addends available\n";
110  } // CompiledGausFitCache<>::CannotCreateFunction()
virtual unsigned int MaxGaussians() const
Returns the maximum number of Gaussians in a function that we support.
Definition: GausFitCache.h:188
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string name
name of the cache
Definition: GausFitCache.h:79
Double_t hit::details::CompiledGausFitCacheBaseStruct::gaus ( Double_t const *  x,
Double_t const *  params 
)
static

Single Gaussian function.

Parameters
xvector; [0] variable value
paramsvector: [0] coefficient of the exponent [1] mean [2] sigma
Returns
the Gaussian evaluated at *x

This function is equivalent to ROOT's "gaus".

Definition at line 91 of file GausFitCache.cxx.

92  {
93  return params[0] * std::exp(-0.5*sqr((x[0] - params[1])/params[2]));
94  } // details::CompiledGausFitCacheBaseStruct::gaus()
list x
Definition: train.py:276
template<unsigned int CutOff>
Double_t hit::details::CompiledGausFitCacheBaseStruct::gaus_trunc ( Double_t const *  x,
Double_t const *  params 
)
static

Definition at line 405 of file GausFitCache.h.

406  {
407  const Double_t z = (x[0] - params[1])/params[2];
408  return ((z > -((Double_t) CutOff)) && (z < (Double_t) CutOff))?
409  params[0] * std::exp(-0.5*sqr(z)): 0.;
410  } // CompiledGausFitCacheBaseStruct::gaus_trunc()
list x
Definition: train.py:276
TF1 * hit::details::CompiledGausFitCacheBaseStruct::GetClone ( size_t  nGaus)
virtual

Throws an exception (ROOT does not support cloning compiled functions)

Reimplemented from hit::GausFitCache.

Definition at line 97 of file GausFitCache.cxx.

97  {
99  << "CompiledGausFitCacheBaseStruct: compiled functions can't be cloned";
100  } // CompiledGausFitCacheBaseStruct::GetClone()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
template<unsigned int NGaus>
void hit::details::CompiledGausFitCacheBaseStruct::InitializeCompiledGausFitVector ( )
protected

Returns a vector initialized with multigaussians.

Definition at line 383 of file GausFitCache.h.

383  {
384  if (NGaus > 0) InitializeCompiledGausFitVector<NGaus-1>();
385  AppendFunction<NGaus>();
386  } // CompiledGausFitCacheBaseStruct::InitializeCompiledGausFitVector()
void InitializeCompiledGausFitVector()
Returns a vector initialized with multigaussians.
Definition: GausFitCache.h:383
template<>
void hit::details::CompiledGausFitCacheBaseStruct::InitializeCompiledGausFitVector ( )
inlineprotected

Definition at line 391 of file GausFitCache.h.

392  { AppendFunction<0>(); }
virtual unsigned int hit::details::CompiledGausFitCacheBaseStruct::MaxGaussians ( ) const
inlinevirtual

Returns the maximum number of Gaussians in a function that we support.

Reimplemented in hit::CompiledTruncatedGausFitCache< MaxGaus, CutOff >, and hit::CompiledGausFitCache< MaxGaus >.

Definition at line 188 of file GausFitCache.h.

188 { return funcs.size() - 1; }
std::vector< TF1 * > funcs
Definition: GausFitCache.h:82
template<unsigned int NGaus>
static Double_t hit::details::CompiledGausFitCacheBaseStruct::ngaus ( Double_t const *  x,
Double_t const *  params 
)
inlinestatic

Definition at line 206 of file GausFitCache.h.

207  { return gaus(x, params) + ngaus<NGaus-1>(x, params + 3); }
static Double_t gaus(Double_t const *x, Double_t const *params)
Single Gaussian function.
static Double_t ngaus(Double_t const *x, Double_t const *params)
Definition: GausFitCache.h:206
list x
Definition: train.py:276
template<>
Double_t hit::details::CompiledGausFitCacheBaseStruct::ngaus ( Double_t const *  x,
Double_t const *  params 
)
inline

Definition at line 415 of file GausFitCache.h.

416  { return 0.; }
template<unsigned int NGaus, unsigned int CutOff>
static Double_t hit::details::CompiledGausFitCacheBaseStruct::ngaus_trunc ( Double_t const *  x,
Double_t const *  params 
)
inlinestatic

Sum of NGaus Gaussian functions truncated at CutOff sigmas.

Definition at line 212 of file GausFitCache.h.

213  { return FuncSum<NGaus, gaus_trunc<CutOff>, 3U>::eval(x, params); }
list x
Definition: train.py:276

The documentation for this class was generated from the following files: