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

Sigma.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: 
00003 #include "CLHEP/GenericFunctions/Sigma.hh"
00004 #include <assert.h>
00005 
00006 namespace Genfun {
00007 FUNCTION_OBJECT_IMP(Sigma)
00008 
00009 void Sigma::accumulate( const AbsFunction & fcn) {
00010   _fcn.push_back(fcn.clone());
00011 }
00012 
00013 Sigma::Sigma()
00014 {
00015 }
00016 
00017 Sigma::Sigma(const Sigma & right) : AbsFunction(right)
00018 {
00019   for (size_t i=0; i<right._fcn.size();i++) {
00020     _fcn.push_back(right._fcn[i]->clone());
00021   }
00022 }
00023 
00024 unsigned int Sigma::dimensionality() const {
00025   assert (_fcn.size()!=0);
00026   return _fcn[0]->dimensionality();
00027 }
00028 
00029 Sigma::~Sigma()
00030 {
00031   for (size_t i=0; i<_fcn.size();i++) {
00032     delete _fcn[i];
00033   }
00034 }
00035 
00036 double Sigma::operator ()(double x) const
00037 {
00038   double retVal=0.0;
00039   for (size_t i=0;i<_fcn.size();i++) retVal += (*_fcn[i])(x);
00040   return retVal;
00041 }
00042 
00043 
00044 double Sigma::operator ()(const Argument & x) const
00045 {
00046   double retVal=0.0;
00047   for (size_t i=0;i<_fcn.size();i++) retVal += (*_fcn[i])(x);
00048   return retVal;
00049 }
00050 
00051 
00052 
00053 Derivative Sigma::partial(unsigned int index) const {
00054   Sigma fPrime;
00055   for (size_t i=0;i<_fcn.size();i++) {
00056     fPrime.accumulate(_fcn[i]->partial(index));
00057   }
00058   return Derivative(&fPrime);
00059 }
00060 
00061 
00062 
00063 } // namespace Genfun

Generated on 15 Nov 2012 for CLHEP by  doxygen 1.4.7