Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t > Class Template Referenceabstract

Histogram in 1D. More...

#include <JHistogram1D.hh>

Inheritance diagram for JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >:
JTOOLS::JHistogram< JElement_t::abscissa_type, JElement_t::ordinate_type > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

enum  { NUMBER_OF_DIMENSIONS = 1 }
 
typedef JContainer_t
< JElement_t, JDistance_t > 
collection_type
 
typedef
collection_type::abscissa_type 
abscissa_type
 
typedef
collection_type::ordinate_type 
ordinate_type
 
typedef collection_type::value_type value_type
 
typedef
collection_type::const_iterator 
const_iterator
 
typedef
collection_type::const_reverse_iterator 
const_reverse_iterator
 
typedef collection_type::iterator iterator
 
typedef
collection_type::reverse_iterator 
reverse_iterator
 
typedef JHistogram
< abscissa_type, ordinate_type
histogram_type
 
typedef
histogram_type::contents_type 
contents_type
 
typedef JTOOLS::JRebin
< value_type
JRebin
 
typedef JTOOLS::JContent
< value_type
JContent
 

Public Member Functions

 JHistogram1D ()
 Default constructor. More...
 
 JHistogram1D (const JAbstractHistogram< abscissa_type > &bounds)
 Constructor. More...
 
 JHistogram1D (const JAbstractCollection< abscissa_type > &bounds)
 Constructor. More...
 
void reset ()
 Reset. More...
 
virtual void evaluate (const abscissa_type *pX, typename JClass< contents_type >::argument_type w)
 Fill histogram. More...
 
void fill (typename JClass< abscissa_type >::argument_type x, typename JClass< contents_type >::argument_type w)
 Fill histogram. More...
 
template<class JRebin_t >
void rebin (JRebin_t merge)
 Rebin histogram. More...
 
JHistogram1Dadd (const JHistogram1D &histogram)
 Add histogram. More...
 
JHistogram1Dsub (const JHistogram1D &histogram)
 Subtract histogram. More...
 
JHistogram1Dmul (const double value)
 Scale contents. More...
 
JHistogram1Ddiv (const double value)
 Scale contents. More...
 
virtual void evaluate (const abscissa_type *pX, typename JLANG::JClass< contents_type >::argument_type w)=0
 Histogram filling. More...
 
JHistogramadd (const JHistogram &histogram)
 Add histogram. More...
 
JHistogramsub (const JHistogram &histogram)
 Subtract histogram. More...
 
const contents_typegetUnderflow () const
 Get contents below lower limit. More...
 
const contents_typegetOverflow () const
 Get contents above upper limit. More...
 
const contents_typegetIntegral () const
 Get contents above upper limit. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 

Protected Attributes

contents_type underflow
 
contents_type overflow
 
contents_type integral
 

Friends

JReaderoperator>> (JReader &in, JHistogram1D &object)
 Read histogram from input. More...
 
JWriteroperator<< (JWriter &out, const JHistogram1D &object)
 Write histogram to output. More...
 

Detailed Description

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
class JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >

Histogram in 1D.

This class implements the JHistogram interface.

Definition at line 111 of file JHistogram1D.hh.

Member Typedef Documentation

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef JContainer_t<JElement_t, JDistance_t> JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::collection_type

Definition at line 120 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef collection_type::abscissa_type JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::abscissa_type

Definition at line 122 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef collection_type::ordinate_type JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::ordinate_type

Definition at line 123 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef collection_type::value_type JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::value_type

Definition at line 124 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef collection_type::const_iterator JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::const_iterator

Definition at line 126 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef collection_type::const_reverse_iterator JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::const_reverse_iterator

Definition at line 127 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef collection_type::iterator JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::iterator

Definition at line 128 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef collection_type::reverse_iterator JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::reverse_iterator

Definition at line 129 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef JHistogram<abscissa_type, ordinate_type> JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::histogram_type

Definition at line 131 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef histogram_type::contents_type JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::contents_type

Definition at line 133 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef JTOOLS::JRebin<value_type> JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::JRebin

Definition at line 135 of file JHistogram1D.hh.

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
typedef JTOOLS::JContent<value_type> JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::JContent

Definition at line 136 of file JHistogram1D.hh.

Member Enumeration Documentation

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
anonymous enum
Enumerator
NUMBER_OF_DIMENSIONS 

Definition at line 118 of file JHistogram1D.hh.

Constructor & Destructor Documentation

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::JHistogram1D ( )
inline

Default constructor.

Definition at line 142 of file JHistogram1D.hh.

143  {}
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::JHistogram1D ( const JAbstractHistogram< abscissa_type > &  bounds)
inline

Constructor.

Parameters
boundsbounds

Definition at line 151 of file JHistogram1D.hh.

152  {
153  this->configure(bounds);
154  }
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::JHistogram1D ( const JAbstractCollection< abscissa_type > &  bounds)
inline

Constructor.

Parameters
boundsbounds

Definition at line 162 of file JHistogram1D.hh.

163  {
164  this->configure(bounds);
165  }
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.

Member Function Documentation

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
void JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::reset ( )
inline

Reset.

Definition at line 171 of file JHistogram1D.hh.

172  {
174 
175  for (iterator i = this->begin(); i != this->end(); ++i) {
176  i->getY() = JMATH::zero;
177  }
178  }
static const JZero zero
Function object to assign zero value.
Definition: JZero.hh:105
collection_type::iterator iterator
void reset()
Reset.
Definition: JHistogram.hh:56
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
virtual void JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::evaluate ( const abscissa_type pX,
typename JClass< contents_type >::argument_type  w 
)
inlinevirtual

Fill histogram.

Parameters
pXpointer to abscissa values
wweight

Definition at line 187 of file JHistogram1D.hh.

189  {
190  this->fill(*pX, w);
191  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
void fill(typename JClass< abscissa_type >::argument_type x, typename JClass< contents_type >::argument_type w)
Fill histogram.
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
void JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::fill ( typename JClass< abscissa_type >::argument_type  x,
typename JClass< contents_type >::argument_type  w 
)
inline

Fill histogram.

Parameters
xabscissa value
wweight

Definition at line 200 of file JHistogram1D.hh.

202  {
203  this->integral += w;
204 
205  iterator p = this->lower_bound(x);
206 
207  if (p == this->begin())
208  this->underflow += w;
209  else if (p == this->end())
210  this->overflow += w;
211  else
212  (--p)->getY() += w;
213  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
collection_type::iterator iterator
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
template<class JRebin_t >
void JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::rebin ( JRebin_t  merge)
inline

Rebin histogram.

Parameters
mergerebin evaluator

Definition at line 222 of file JHistogram1D.hh.

223  {
224  if (this->size() > 1u) {
225 
226  iterator out = this->begin();
227 
228  for (const_iterator i = this->begin(); i != this->end(); ) {
229 
230  *out = *i;
231 
232  while (++i != this->end() && merge(*out,*i)) {
233  out->getY() += i->getY();
234  }
235 
236  ++out;
237  }
238 
239  const_reverse_iterator __rbegin(out);
240 
241  if (this->getDistance(__rbegin->getX(), this->rbegin()->getX()) > 0.0) {
242 
243  *out = *(this->rbegin());
244 
245  ++out;
246  }
247 
248  this->resize(std::distance(this->begin(), out));
249  }
250  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
collection_type::const_iterator const_iterator
collection_type::const_reverse_iterator const_reverse_iterator
collection_type::iterator iterator
double u[N+1]
Definition: JPolint.hh:865
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JHistogram1D& JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::add ( const JHistogram1D< JElement_t, JContainer_t, JDistance_t > &  histogram)
inline

Add histogram.

Parameters
histogramhistogram
Returns
this histogram

Definition at line 259 of file JHistogram1D.hh.

260  {
261  collection_type::add(static_cast<const collection_type&>(histogram));
262  histogram_type ::add(static_cast<const histogram_type&> (histogram));
263 
264  return *this;
265  }
JHistogram & add(const JHistogram &histogram)
Add histogram.
Definition: JHistogram.hh:80
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JHistogram1D& JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::sub ( const JHistogram1D< JElement_t, JContainer_t, JDistance_t > &  histogram)
inline

Subtract histogram.

Parameters
histogramhistogram
Returns
this histogram

Definition at line 274 of file JHistogram1D.hh.

275  {
276  collection_type::sub(static_cast<const collection_type&>(histogram));
277  histogram_type ::sub(static_cast<const histogram_type&> (histogram));
278 
279  return *this;
280  }
JHistogram & sub(const JHistogram &histogram)
Subtract histogram.
Definition: JHistogram.hh:96
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JHistogram1D& JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::mul ( const double  value)
inline

Scale contents.

Parameters
valuemultiplication factor
Returns
this histogram

Definition at line 289 of file JHistogram1D.hh.

290  {
291  collection_type::mul(value);
292  histogram_type ::mul(value);
293 
294  return *this;
295  }
JHistogram & mul(const double value)
Scale histogram.
Definition: JHistogram.hh:112
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JHistogram1D& JTOOLS::JHistogram1D< JElement_t, JContainer_t, JDistance_t >::div ( const double  value)
inline

Scale contents.

Parameters
valuedivision factor
Returns
this histogram

Definition at line 304 of file JHistogram1D.hh.

305  {
306  collection_type::div(value);
307  histogram_type ::div(value);
308 
309  return *this;
310  }
JHistogram & div(double value)
Scale histogram.
Definition: JHistogram.hh:128
virtual void JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::evaluate ( const abscissa_type pX,
typename JLANG::JClass< contents_type >::argument_type  w 
)
pure virtualinherited

Histogram filling.

Parameters
pXpointer to abscissa values
wweight
JHistogram& JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::add ( const JHistogram< JElement_t::abscissa_type, JElement_t::ordinate_type > &  histogram)
inlineinherited

Add histogram.

Parameters
histogramhistogram
Returns
this histogram

Definition at line 80 of file JHistogram.hh.

JHistogram& JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::sub ( const JHistogram< JElement_t::abscissa_type, JElement_t::ordinate_type > &  histogram)
inlineinherited

Subtract histogram.

Parameters
histogramhistogram
Returns
this histogram

Definition at line 96 of file JHistogram.hh.

const contents_type& JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::getUnderflow ( ) const
inlineinherited

Get contents below lower limit.

Returns
contents

Definition at line 143 of file JHistogram.hh.

const contents_type& JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::getOverflow ( ) const
inlineinherited

Get contents above upper limit.

Returns
contents

Definition at line 154 of file JHistogram.hh.

const contents_type& JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::getIntegral ( ) const
inlineinherited

Get contents above upper limit.

Returns
contents

Definition at line 165 of file JHistogram.hh.

template<class JFirst_t, class JSecond_t = JNullType>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }

Friends And Related Function Documentation

template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JReader& operator>> ( JReader in,
JHistogram1D< JElement_t, JContainer_t, JDistance_t > &  object 
)
friend

Read histogram from input.

Parameters
inreader
objecthistogram
Returns
reader

Definition at line 320 of file JHistogram1D.hh.

321  {
322  in >> static_cast<histogram_type&> (object);
323  in >> static_cast<collection_type&>(object);
324 
325  return in;
326  }
JContainer_t< JElement_t, JDistance_t > collection_type
JHistogram< abscissa_type, ordinate_type > histogram_type
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
template<class JElement_t, template< class, class > class JContainer_t, class JDistance_t = JDistance<typename JElement_t::abscissa_type>>
JWriter& operator<< ( JWriter out,
const JHistogram1D< JElement_t, JContainer_t, JDistance_t > &  object 
)
friend

Write histogram to output.

Parameters
outwriter
objecthistogram
Returns
writer

Definition at line 336 of file JHistogram1D.hh.

337  {
338  out << static_cast<const histogram_type&> (object);
339  out << static_cast<const collection_type&>(object);
340 
341  return out;
342  }

Member Data Documentation

contents_type JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::underflow
protectedinherited

Definition at line 206 of file JHistogram.hh.

contents_type JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::overflow
protectedinherited

Definition at line 207 of file JHistogram.hh.

contents_type JTOOLS::JHistogram< JElement_t::abscissa_type , JElement_t::ordinate_type >::integral
protectedinherited

Definition at line 208 of file JHistogram.hh.


The documentation for this class was generated from the following file: