1#ifndef __JTOOLS__JTOOLSTOOLKIT__
2#define __JTOOLS__JTOOLSTOOLKIT__
49 template<
class JContainer_t,
52 inline typename JContainer_t::ordinate_type
55 const typename JContainer_t::ordinate_type eps =
JMATH::zero)
57 typedef typename JContainer_t::ordinate_type ordinate_type;
58 typedef typename JContainer_t::abscissa_type abscissa_type;
63 if (input.getSize() > 1) {
67 const ordinate_type V =
integrate(input, buffer);
75 typename buffer_type::const_iterator i = buffer.begin();
77 for ( ; i != buffer.end() && i->getY() <= 0.5 * eps * V; ++i) {}
79 if (i != buffer.end()) {
84 JValue_t y = i->getX();
91 for (++i; i != buffer.end(); ++i) {
100 if (x > xmax + eps) {
134 template<
class JContainer_t>
135 inline typename JContainer_t::ordinate_type
getIntegral(
const JContainer_t& input)
150 template<
class JContainer_t>
151 inline typename JContainer_t::ordinate_type
getIntegral(
const JContainer_t& input,
172 template<
class JFunction_t,
173 template<
class,
class,
class>
class JMap_t,
175 inline typename JFunction_t::ordinate_type
178 typedef typename JFunction_t::abscissa_type abscissa_type;
179 typedef typename JFunction_t::ordinate_type ordinate_type;
180 typedef typename JFunction_t::distance_type distance_type;
184 distance_type> buffer_type;
187 static buffer_type buffer;
189 buffer.configure(input);
191 typename buffer_type::iterator out = buffer.begin();
193 for (
typename multimap_type::const_iterator in = input.begin(); in != input.end(); ++in, ++out) {
209 template<
class JFunction_t,
210 template<
class,
class,
class>
class JMap_t,
212 inline typename JFunction_t::ordinate_type
215 typedef typename JFunction_t::abscissa_type abscissa_type;
216 typedef typename JFunction_t::ordinate_type ordinate_type;
217 typedef typename JFunction_t::distance_type distance_type;
221 distance_type> buffer_type;
226 for (
typename multifunction_type::const_iterator i = input.begin(); i != input.end(); ++i) {
255 template<
class JElement_t,
class JDistance_t>
260 for (iterator i = collection.begin(); i != collection.end(); ++i) {
275 inline void copy(
const T& input, T& output)
287 template<
class JElement_t,
class JDistance_t,
class JKey_t,
class JValue_t>
294 for (const_iterator i = input.begin(); i != input.end(); ++i) {
295 copy(i->getY(), output.
get(i->getX()));
309 template<
class T,
class JAbscissa_t>
321 template<
class JElement_t,
class JDistance_t>
324 std::true_type option = std::true_type())
331 for (iterator i = collection.begin(); i != collection.end(); ++i) {
356 template<
class JElement_t,
class JDistance_t>
362 for (iterator i = collection.begin(); i != collection.end(); ++i) {
366 if (collection.
getSize() > 1) {
368 for (iterator
j = collection.begin(), i =
j++;
j != collection.end(); ++i, ++
j) {
369 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).