1 #ifndef __JTOOLS__JSPLINE__ 
    2 #define __JTOOLS__JSPLINE__ 
   36   template<
class JOrdinate_t>
 
  122         throw JNoValue(
"JSplineBounds: missing 1st derivative.");
 
  136         throw JNoValue(
"JSplineBounds: missing 1st derivative.");
 
  152   template<
class JOrdinate_t>
 
  154                                                        const JOrdinate_t fpAtXmax)
 
  176   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  178     public JCollection_t<JElement_t, JDistance_t>,
 
  191     typedef typename collection_type::iterator                                   
iterator;
 
  204       const int numberOfElements = this->size();
 
  208       if (numberOfElements > 2) {
 
  217           const double        dx = this->
getDistance(i->getX(),  
j->getX());
 
  233         for (
iterator k = this->begin(), i = k++, 
j = k++; k != this->end(); ++i, ++
j, ++k, ++index) {
 
  244           const double h   = sig * buffer[index-1] + 2.0;
 
  246           buffer[index]    = (sig - 1.0) / h;
 
  251           j->setU((6.0 * 
j->getU() / this->
getDistance(x1, x3)  -  sig * i->getU()) / h);
 
  260           index = numberOfElements - 2;
 
  262           const double        dx = this->
getDistance(i->getX(),  
j->getX());
 
  267           i->setU((i->getU() - 0.5*
j->getU()) / (0.5*buffer[index] + 1.0));
 
  278         index = numberOfElements - 2;
 
  280         for ( ; 
j != this->rend(); ++i, ++
j, --index) {
 
  281           j->setU(
j->getU() + i->getU() * buffer[index]);
 
  286         for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  314   template<
class JElement_t, 
 
  315            template<
class, 
class> 
class JCollection_t,
 
  324   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  330     public virtual JFunction<typename JElement_t::abscissa_type, 
 
  331                              typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
  344     typedef typename collection_type::iterator                                   
iterator;
 
  372       if (this->size() > 1u) {
 
  376         if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  377             (p == this->end()   && this->
getDistance((--p)->getX(), 
x) > distance_type::precision)) {
 
  384             std::ostringstream os;
 
  386             os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range "  
  388                << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  389                << 
STREAM(
"?") << this->rbegin()->getX();
 
  397         const double dx = this->
getDistance(p->getX(), q->getX());
 
  399         const double b  = 1.0 - 
a;
 
  401         return (
a * p->getY() + b * q->getY()
 
  402                 - 
a*b * ((
a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6);
 
  404       } 
else if (this->size() == 1u && this->
getDistance(x, this->begin()->getX()) <= distance_type::precision) {
 
  406         return this->begin()->getY();
 
  415           std::ostringstream os;
 
  417           os << __FILE__ << 
':' << __LINE__ << 
" not enough data " << 
STREAM(
"?") << 
x;
 
  429   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  435     public virtual JFunction<typename JElement_t::abscissa_type, 
 
  436                              JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  449     typedef typename collection_type::iterator                                   
iterator;
 
  479       if (this->size() <= 1u) {
 
  486           std::ostringstream os;
 
  488           os << __FILE__ << 
':' << __LINE__ << 
" not enough data " << 
STREAM(
"?") << 
x;
 
  497       if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  498           (p == this->end()   && this->
getDistance((--p)->getX(), 
x) > distance_type::precision)) {
 
  505           std::ostringstream os;
 
  507           os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range "  
  509              << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  510              << 
STREAM(
"?") << this->rbegin()->getX();
 
  518       const double dx = this->
getDistance(p->getX(), q->getX());
 
  520       const double b  = 1.0 - 
a;
 
  522       result.f   = 
a * p->getY() + b * q->getY()
 
  523         - 
a*b * ((
a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6;
 
  525       result.fp  = (q->getY() - p->getY() + (p->getU()*(1.0 - 3*
a*
a) -
 
  526                                              q->getU()*(1.0 - 3*b*b)) * dx*dx/6) / dx;
 
  547   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  553     public virtual JFunction<typename JElement_t::abscissa_type, 
 
  554                              JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  567     typedef typename collection_type::iterator                                   
iterator;
 
  594       if (this->size() >= 2u) {
 
  596         collection_type::compile(bounds);
 
  600         for (
iterator j = this->begin(), i = 
j++; 
j != this->end(); ++i, ++
j) {
 
  602           const double        dx = this->
getDistance(i->getX(), 
j->getX());
 
  609           j->setIntegral(i->getIntegral() + 
v - 
w);
 
  625       if (this->size() <= 1u) {
 
  632           std::ostringstream os;
 
  634           os << __FILE__ << 
':' << __LINE__ << 
" not enough data " << 
STREAM(
"?") << 
x;
 
  642       if        (p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) {
 
  651           result.V = this->rbegin()->getIntegral();
 
  655           std::ostringstream os;
 
  657           os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range " << 
STREAM(
"?") << 
x << 
" < " << 
STREAM(
"?") << this->begin() ->getX();
 
  664       } 
else if (p == this->end()   && this->
getDistance((--p)->getX(), 
x) > distance_type::precision) {
 
  672           result.v = this->rbegin()->getIntegral();
 
  673           result.V = this->rbegin()->getIntegral();
 
  677           std::ostringstream os;
 
  679           os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range " << 
STREAM(
"?") << 
x << 
" > " << 
STREAM(
"?") << this->rbegin()->getX();
 
  689       const double dx = this->
getDistance(p->getX(), q->getX());
 
  691       const double b  = 1.0 - 
a;
 
  693       result.f  = 
a * p->getY() + b * q->getY()
 
  694         - 
a*b * ((
a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6;
 
  696       result.fp = (q->getY() - p->getY() + (p->getU()*(1.0 - 3*
a*
a) -
 
  697                                             q->getU()*(1.0 - 3*b*b)) * dx*dx/6) / dx;
 
  699       result.v  = p->getIntegral()
 
  700         + 0.5*dx * (p->getY() - 0.5*p->getU()*dx*dx/6)
 
  701         - 0.5*dx * ((
a*
a*p->getY() - b*b*q->getY()) +
 
  702                     (p->getU() * 
a*
a*(0.5*
a*
a - 1.0) -
 
  703                      q->getU() * b*b*(0.5*b*b - 1.0)) * dx*dx/6);
 
  705       result.V  = this->rbegin()->getIntegral();
 
  731   template<
class JElement_t,
 
  732            template<
class, 
class> 
class JCollection_t,
 
  733            class JResult_t   = 
typename JElement_t::ordinate_type,
 
  736     public JSplineFunction<JElement_t, JCollection_t, JResult_t, JDistance_t>,
 
  737     public JFunction1D<typename JElement_t::abscissa_type, JResult_t> 
 
  773   template<
class JAbscissa_t, 
class JOrdinate_t>
 
  776   template<
template<
class, 
class, 
class> 
class JMap_t>
 
  783   template<
class JKey_t,
 
  785            template<
class, 
class, 
class> 
class JMap_t,
 
  789     public JMap_t<JKey_t, JValue_t, JDistance_t>,
 
  804     typedef typename collection_type::iterator                                   
iterator;
 
  856       for (
iterator i = this->begin(); i != this->end(); ++i) {
 
  875   template<
class JElement_t,
 
  876            template<
class, 
class> 
class JCollection_t,
 
  879   inline typename JElement_t::ordinate_type 
 
  888     if (input.getSize() > 1) {
 
  890       output.
put(input.begin()->getX(), V);
 
  894         const double        dx = input.getDistance(i->getX(), 
j->getX());
 
  902         output.
put(
j->getX(), V);
 
  919   template<
class JElement_t,
 
  920            template<
class, 
class> 
class JCollection_t,
 
  922   inline typename JElement_t::ordinate_type
 
  930     if (input.getSize() > 1) {
 
  933         output.
put(i->getX(), i->getIntegral());
 
  936       return input.rbegin()->getIntegral();
 
This include file containes various data structures that can be used as specific return types for the...
 
Definition of zero value for any class.
 
Exception for division by zero.
 
Exception for a functional operation.
 
Exception for missing value.
 
Exception for accessing a value in a collection that is outside of its range.
 
static const JZero zero
Function object to assign zero value.
 
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
std::vector< event_type > data_type
 
JArgument< T >::argument_type argument_type
 
Auxiliary data structure for handling std::ostream.