CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

Sigma.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id:
4 #include <assert.h>
5 
6 namespace Genfun {
8 
9 void Sigma::accumulate( const AbsFunction & fcn) {
10  _fcn.push_back(fcn.clone());
11 }
12 
14 {
15 }
16 
17 Sigma::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 
24 unsigned 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 
36 double 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 
44 double 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 
53 Derivative 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