CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Sigma.cc
Go to the documentation of this file.
1// -*- C++ -*-
2// $Id:
3#include "CLHEP/GenericFunctions/Sigma.hh"
4#include <assert.h>
5#include <vector>
6namespace Genfun {
8
9void Sigma::accumulate( const AbsFunction & fcn) {
10 _fcn.push_back(fcn.clone());
11}
12
14{
15}
16
17Sigma::Sigma(const Sigma & right) : AbsFunction(right)
18{
19 for (size_t i=0; i<right._fcn.size();i++) {
20 _fcn.push_back(right._fcn[i]->clone());
21 }
22}
23
24unsigned int Sigma::dimensionality() const {
25 assert (_fcn.size()!=0);
26 return _fcn[0]->dimensionality();
27}
28
30{
31 for (size_t i=0; i<_fcn.size();i++) {
32 delete _fcn[i];
33 }
34}
35
36double Sigma::operator ()(double x) const
37{
38 double retVal=0.0;
39 for (size_t i=0;i<_fcn.size();i++) retVal += (*_fcn[i])(x);
40 return retVal;
41}
42
43
44double Sigma::operator ()(const Argument & x) const
45{
46 double retVal=0.0;
47 for (size_t i=0;i<_fcn.size();i++) retVal += (*_fcn[i])(x);
48 return retVal;
49}
50
51
52
53Derivative Sigma::partial(unsigned int index) const {
54 Sigma fPrime;
55 for (size_t i=0;i<_fcn.size();i++) {
56 fPrime.accumulate(_fcn[i]->partial(index));
57 }
58 return Derivative(&fPrime);
59}
60
61
62
63} // namespace Genfun
#define FUNCTION_OBJECT_IMP(classname)
Definition: AbsFunction.hh:149
virtual unsigned int dimensionality() const override
Definition: Sigma.cc:24
Derivative partial(unsigned int) const override
Definition: Sigma.cc:53
virtual ~Sigma()
Definition: Sigma.cc:29
void accumulate(const AbsFunction &fcn)
Definition: Sigma.cc:9
virtual double operator()(double argument) const override
Definition: Sigma.cc:36
Definition: Abs.hh:14
FunctionNoop Derivative
Definition: AbsFunction.hh:42