1 #ifndef __JTOOLS__JPOLINT__ 
    2 #define __JTOOLS__JPOLINT__ 
   25 namespace JPP { 
using namespace JTOOLS; }
 
   38   template<
unsigned int N, 
 
   40            template<
class, 
class> 
class JCollection_t,
 
   53   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
   59     public JCollection_t<JElement_t, JDistance_t>,
 
   60     public JFunction<typename JElement_t::abscissa_type,
 
   61                      typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
   74     typedef typename collection_type::iterator                                   
iterator;
 
  100       if (this->size() <= 1
u) {
 
  101         return this->getExceptionHandler().action(
JFunctionalException(
"JPolintFunction<>::evaluate() not enough data."));
 
  108       if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  109           (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  112                                                                  << 
STREAM(
"?") << x                      << 
" <> "  
  113                                                                  << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  114                                                                  << 
STREAM(
"?") << this->rbegin()->getX()));
 
  120       const int n = std::min((
int) (
N + 1), (
int) this->size());         
 
  122       for (
int i = n/2; i != 0 && p != this->end();   --i, ++p) {}       
 
  123       for (
int i = n  ; i != 0 && p != this->begin(); --i, --p) {}
 
  128       for (
int i = 0; i != 
n; ++p, ++i) {
 
  134         if (fabs(
u[i]) < fabs(
u[j])) {
 
  144       for (
int m = 1; m != 
n; ++m) {
 
  146         for (
int i = 0; i != n-m; ++i) {
 
  148           const double ho = 
u[ i ];
 
  149           const double hp = 
u[i+m];
 
  150           const double dx = ho - hp;
 
  178     mutable double      u[
N+1];
 
  188   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  194     public JCollection_t<JElement_t, JDistance_t>,
 
  195     public JFunction<typename JElement_t::abscissa_type,
 
  196                      typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
  209     typedef typename collection_type::iterator                                   
iterator;
 
  235       if (this->size() <= 1
u) {
 
  236         return this->getExceptionHandler().action(
JFunctionalException(
"JPolintFunction<>::evaluate() not enough data."));
 
  243       if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  244           (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  247                                                                  << 
STREAM(
"?") << x                      << 
" <> "  
  248                                                                  << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  249                                                                  << 
STREAM(
"?") << this->rbegin()->getX()));
 
  276   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  282     public JCollection_t<JElement_t, JDistance_t>,
 
  283     public JFunction<typename JElement_t::abscissa_type,
 
  284                      typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
  297     typedef typename collection_type::iterator                                   
iterator;
 
  323       if (this->size() <= 1
u) {
 
  324         return this->getExceptionHandler().action(
JFunctionalException(
"JPolintFunction<>::evaluate() not enough data."));
 
  331       if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  332           (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  335                                                                  << 
STREAM(
"?") << x                      << 
" <> "  
  336                                                                  << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  337                                                                  << 
STREAM(
"?") << this->rbegin()->getX()));
 
  345       const double dx = this->
getDistance(p->getX(), q->getX());
 
  347       const double b  = 1.0 - 
a;
 
  384   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  390     public JCollection_t<JElement_t, JDistance_t>,
 
  391     public JFunction<typename JElement_t::abscissa_type, 
 
  392                      JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  405     typedef typename collection_type::iterator                                   
iterator;
 
  433       if (this->size() <= 1
u) {
 
  434         return this->getExceptionHandler().action(
JFunctionalException(
"JPolintFunction<>::evaluate() not enough data."));
 
  441       if        (p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) {
 
  446                                                                        << 
STREAM(
"?") << x << 
" < " << 
STREAM(
"?") << this->begin() ->getX()));
 
  451           result.V = this->rbegin()->getIntegral();
 
  459       } 
else if (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision) {
 
  464                                                                        << 
STREAM(
"?") << x << 
" > " << 
STREAM(
"?") << this->rbegin() ->getX()));
 
  468           result.v = this->rbegin()->getIntegral();
 
  469           result.V = this->rbegin()->getIntegral();
 
  481         const int n = std::min((
int) (
N + 1), (
int) this->size());         
 
  483         for (
int i = n/2; i != 0 && p != this->end();   --i, ++p) {}       
 
  484         for (
int i = n  ; i != 0 && p != this->begin(); --i, --p) {}
 
  489         for (
int i = 0; i != 
n; ++p, ++i) {
 
  495           w[i][2] = 
v[i][2] = p->getIntegral();
 
  497           if (fabs(
u[i]) < fabs(
u[j])) {
 
  506         result.V  = this->rbegin()->getIntegral();
 
  510         for (
int m = 1; m != 
n; ++m) {
 
  512           for (
int i = 0; i != n-m; ++i) {
 
  514             const double ho = 
u[ i ];
 
  515             const double hp = 
u[i+m];
 
  516             const double dx = ho - hp;
 
  518             for (
int k = 0; 
k != 3; ++
k) {
 
  519               r[
k] = (
v[i+1][
k] - 
w[i][
k]) / dx;
 
  524             v[i][1] = ho * r[1] - r[0];
 
  525             w[i][1] = hp * r[1] - r[0];
 
  530           if (2*(j+1) < n - m) {
 
  562         this->begin()->setIntegral(V);
 
  564         for (
iterator j = this->begin(), i = 
j++; 
j != this->end(); ++i, ++
j) {
 
  571             const abscissa_type x = 0.5 * (xmax + xmin  +  m->getX() * (xmax - xmin));
 
  583     mutable double    u[
N+1];
 
  595   template<
unsigned int N,
 
  597            template<
class, 
class> 
class JCollection_t,
 
  608   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t, 
unsigned int M>
 
  614     public JCollection_t<JElement_t, JDistance_t>,
 
  620     typedef JCollection_t<JElement_t, JDistance_t>                               collection_type;
 
  622     typedef typename collection_type::abscissa_type                              abscissa_type;
 
  623     typedef typename collection_type::ordinate_type                              ordinate_type;
 
  624     typedef typename collection_type::value_type                                 value_type;
 
  625     typedef typename collection_type::distance_type                              distance_type;
 
  627     typedef typename collection_type::const_iterator                             const_iterator;
 
  628     typedef typename collection_type::const_reverse_iterator                     const_reverse_iterator;
 
  629     typedef typename collection_type::iterator                                   iterator;
 
  630     typedef typename collection_type::reverse_iterator                           reverse_iterator;
 
  632     typedef typename JResultType<ordinate_type>::result_type                     data_type;
 
  633     typedef JFunction<abscissa_type, JResultPolynome<M, data_type> >             function_type;
 
  635     typedef typename function_type::argument_type                                argument_type;
 
  636     typedef typename function_type::result_type                                  result_type;
 
  638     using JFunctional<>::compile;
 
  654     result_type evaluate(const argument_type* pX) const
 
  656       if (this->size() <= N) {
 
  657         THROW(JFunctionalException, "JPolintFunction<>::evaluate() not enough data.");
 
  660       const argument_type x = *pX;
 
  662       const_iterator p = this->lower_bound(x);
 
  664       if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  665           (p == this->end()   && 
this->
getDistance((--p)->getX(), 
x) > distance_type::precision)) {
 
  669               << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  670               << 
STREAM(
"?") << this->rbegin()->getX());
 
  676       const int n = std::min((
int) (
N + 1), (
int) this->size());         
 
  678       for (
int i = 
n/2; i != 0 && p != this->end();   --i, ++p) {}       
 
  679       for (
int i = 
n  ; i != 0 && p != this->begin(); --i, --p) {}
 
  684       for (
int i = 0; i != 
n; ++p, ++i) {
 
  690         for (
unsigned int k = 1; 
k != 
M+1; ++
k) {
 
  694         if (fabs(
u[i]) < fabs(
u[
j])) {
 
  700       for (
unsigned int k = 0; 
k != 
M+1; ++
k) {
 
  706       for (
int m = 1; m != 
n; ++m) {
 
  708         for (
int i = 0; i != 
n-m; ++i) {
 
  710           const double ho = 
u[ i ];
 
  711           const double hp = 
u[i+m];
 
  712           const double dx = ho - hp;
 
  714           for (
int k = 0; 
k != 
M+1; ++
k) {
 
  715             r[
k] = (
v[i+1][
k] - 
w[i][
k]) / dx;
 
  721           for (
int k = 1; 
k != 
M+1; ++
k) {
 
  722             v[i][
k] = ho * r[
k]  -  
k * r[
k-1];
 
  723             w[i][
k] = hp * r[
k]  -  
k * r[
k-1];
 
  727         if (2*(
j+1) < 
n - m) {
 
  729           for (
int k = 0; 
k != 
M+1; ++
k) {
 
  735           for (
int k = 0; 
k != 
M+1; ++
k) {
 
  755     mutable double    u[
N+1];
 
  756     mutable data_type 
v[
N+1][
M+1];
 
  757     mutable data_type 
w[
N+1][
M+1];
 
  758     mutable data_type 
r[
M+1];
 
  760     mutable result_type 
result;
 
  767   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t, 
unsigned int M>
 
  776                              JResultPolynome<M, typename JResultType<typename JElement_t::ordinate_type>::result_type>,
 
  778     public JFunction<typename JElement_t::abscissa_type, 
 
  779                      JResultPolynome<N, typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  796     typedef typename collection_type::iterator                                   
iterator;
 
  823         return collection_type::evaluate(pX);
 
  826         return this->getExceptionHandler().action(error);
 
  835   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  844                              JResultPolynome<1, typename JResultType<typename JElement_t::ordinate_type>::result_type>,
 
  846     public JFunction<typename JElement_t::abscissa_type,
 
  847                      JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  864     typedef typename collection_type::iterator                                   
iterator;
 
  893         return collection_type::evaluate(pX);
 
  896         return this->getExceptionHandler().action(error);
 
  905   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  914                              JResultPolynome<2, typename JResultType<typename JElement_t::ordinate_type>::result_type>,
 
  916     public JFunction<typename JElement_t::abscissa_type,
 
  917                      JResultHesse<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  934     typedef typename collection_type::iterator                                   
iterator;
 
  963         return collection_type::evaluate(pX);
 
  966         return this->getExceptionHandler().action(error);
 
  977   template<
unsigned int N,
 
  979            template<
class, 
class> 
class JCollection_t,
 
  980            class JResult_t   = 
typename JElement_t::ordinate_type,
 
  983     public JPolintFunction<N, JElement_t, JCollection_t, JResult_t, JDistance_t>,
 
  984     public JFunction1D<typename JElement_t::abscissa_type, JResult_t> 
 
 1020   template<
class JAbscissa_t, 
class JOrdinate_t>
 
 1023   template<
template<
class, 
class, 
class> 
class JMap_t>
 
 1030   template<
unsigned int N,
 
 1033            template<
class, 
class, 
class> 
class JMap_t,
 
 1038                            JElement2D<JKey_t, JValue_t>, 
 
 1039                            JMapCollection<JMap_t>::template collection_type, 
 
 1084   template<
unsigned int N,
 
 1086            template<
class, 
class> 
class JCollection_t,
 
 1089   inline typename JElement_t::ordinate_type
 
 1108   template<
unsigned int N,
 
 1110            template<
class, 
class> 
class JCollection_t,
 
 1113   inline typename JElement_t::ordinate_type
 
 1118     typedef typename JElement_t::abscissa_type                                                                abscissa_type;
 
 1119     typedef typename JElement_t::ordinate_type                                                                ordinate_type;
 
 1124     if (input.getSize() > 1) {
 
 1126       output.
put(input.begin()->getX(), 
V);
 
 1130       for (const_iterator 
j = input.begin(), i = 
j++; 
j != input.end(); ++i, ++
j) {
 
 1132         const abscissa_type xmin = i->getX();
 
 1133         const abscissa_type xmax = 
j->getX();
 
 1137           const abscissa_type 
x = 0.5 * (xmax + xmin  +  m->getX() * (xmax - xmin));
 
 1138           const ordinate_type 
v = 0.5 * (xmax - xmin) *  m->getY() * 
get_value(input(x));
 
 1143         output.
put(xmax, V);
 
 1161   template<
class JElement_t,
 
 1162            template<
class, 
class> 
class JCollection_t,
 
 1165   inline typename JElement_t::ordinate_type
 
 1170     typedef typename JElement_t::ordinate_type                                                                ordinate_type;
 
 1175     if (input.getSize() > 1) {
 
 1177       output.
put(input.begin()->getX(), 
V);
 
 1179       for (const_iterator 
j = input.begin(), i = 
j++; 
j != input.end(); ++i, ++
j) {
 
 1181         V += input.getDistance(i->getX(), 
j->getX()) * 
j->getY();
 
 1183         output.
put(
j->getX(), 
V);
 
 1201   template<
class JElement_t,
 
 1202            template<
class, 
class> 
class JCollection_t,
 
 1205   inline typename JElement_t::ordinate_type
 
 1210     typedef typename JElement_t::ordinate_type                                                                ordinate_type;
 
 1215     if (input.getSize() > 1) {
 
 1217       output.
put(input.begin()->getX(), 
V);
 
 1219       for (const_iterator 
j = input.begin(), i = 
j++; 
j != input.end(); ++i, ++
j) {
 
 1221         V += 0.5 * input.getDistance(i->getX(), 
j->getX()) * (i->getY() + 
j->getY());
 
 1223         output.
put(
j->getX(), 
V);
 
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
 
double getValue(const JScale_t scale)
Get numerical value corresponding to scale. 
 
Exception for a functional operation. 
 
The elements in a collection are sorted according to their abscissa values and a given distance opera...
 
This include file containes various data structures that can be used as specific return types for the...
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
 
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
 
static const JZero zero
Function object to assign zero value. 
 
Generation of compiler error. 
 
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
 
size_t getSize(T(&array)[N])
Get size of c-array. 
 
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects. 
 
Auxiliary template class for type bool. 
 
Auxiliary data structure for handling std::ostream. 
 
#define MAKE_EXCEPTION(JException_t, A)
Make exception. 
 
Exception for numerical precision error. 
 
Auxiliary classes for numerical integration. 
 
Exception for accessing a value in a collection that is outside of its range. 
 
do if[[!-f $ACOUSTICS_WORKDIR/${KEY}.txt]]