1#ifndef __JTOOLS__JTOOLSTOOLKIT__
2#define __JTOOLS__JTOOLSTOOLKIT__
48 template<
class JContainer_t,
51 inline typename JContainer_t::ordinate_type
54 const typename JContainer_t::ordinate_type eps =
JMATH::zero)
56 typedef typename JContainer_t::ordinate_type ordinate_type;
57 typedef typename JContainer_t::abscissa_type abscissa_type;
62 if (input.getSize() > 1) {
66 const ordinate_type V =
integrate(input, buffer);
74 typename buffer_type::const_iterator i = buffer.begin();
76 for ( ; i != buffer.end() && i->getY() <= 0.5 * eps * V; ++i) {}
78 if (i != buffer.end()) {
83 JValue_t y = i->getX();
90 for (++i; i != buffer.end(); ++i) {
133 template<
class JContainer_t>
134 inline typename JContainer_t::ordinate_type
getIntegral(
const JContainer_t& input)
149 template<
class JContainer_t>
150 inline typename JContainer_t::ordinate_type
getIntegral(
const JContainer_t& input,
171 template<
class JFunction_t,
172 template<
class,
class,
class>
class JMap_t,
174 inline typename JFunction_t::ordinate_type
177 typedef typename JFunction_t::abscissa_type abscissa_type;
178 typedef typename JFunction_t::ordinate_type ordinate_type;
179 typedef typename JFunction_t::distance_type distance_type;
183 distance_type> buffer_type;
186 static buffer_type buffer;
188 buffer.configure(input);
190 typename buffer_type::iterator out = buffer.begin();
192 for (
typename multimap_type::const_iterator in = input.begin(); in != input.end(); ++in, ++out) {
208 template<
class JFunction_t,
209 template<
class,
class,
class>
class JMap_t,
211 inline typename JFunction_t::ordinate_type
214 typedef typename JFunction_t::abscissa_type abscissa_type;
215 typedef typename JFunction_t::ordinate_type ordinate_type;
216 typedef typename JFunction_t::distance_type distance_type;
220 distance_type> buffer_type;
225 for (
typename multifunction_type::const_iterator i = input.begin(); i != input.end(); ++i) {
254 template<
class JElement_t,
class JDistance_t>
259 for (iterator i = collection.begin(); i != collection.end(); ++i) {
274 inline void copy(
const T& input, T& output)
286 template<
class JElement_t,
class JDistance_t,
class JKey_t,
class JValue_t>
293 for (const_iterator i = input.begin(); i != input.end(); ++i) {
294 copy(i->getY(), output.
get(i->getX()));
308 template<
class T,
class JAbscissa_t>
320 template<
class JElement_t,
class JDistance_t>
330 for (iterator i = collection.begin(); i != collection.end(); ++i) {
355 template<
class JElement_t,
class JDistance_t>
361 for (iterator i = collection.begin(); i != collection.end(); ++i) {
365 if (collection.
getSize() > 1) {
367 for (iterator
j = collection.begin(), i =
j++;
j != collection.end(); ++i, ++
j) {
368 j->getY() += i->getY();
General purpose class for a collection of sorted elements.
The elements in a collection are sorted according to their abscissa values and a given distance opera...
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Auxiliary class to define a range between two values.
Definition of zero value for any class.
Exception for division by zero.
Exception for an empty collection.
T getZero()
Get zero value for a given data type.
static const JZero zero
Function object to assign zero value.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary template class for type bool.