Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
JTOOLS::JAbstractHistogram< JAbscissa_t > Struct Template Reference

Simple data structure for histogram binning. More...

#include <JAbstractHistogram.hh>

Inheritance diagram for JTOOLS::JAbstractHistogram< JAbscissa_t >:
JTOOLS::JRange< JAbscissa_t > JTOOLS::JPair< JKey_t, JValue_t > JLANG::JEquals< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef JAbscissa_t abscissa_type
 
typedef JRange< abscissa_typerange_type
 
typedef std::pair< JAbscissa_t,
JAbscissa_t > 
pair_type
 
typedef JLANG::JClass
< JAbscissa_t >::argument_type 
argument_type
 
typedef JKey_t key_type
 
typedef JValue_t mapped_type
 

Public Member Functions

 JAbstractHistogram ()
 Default constructor. More...
 
 JAbstractHistogram (const int nx, const abscissa_type xmin, const abscissa_type xmax)
 Constructor. More...
 
 JAbstractHistogram (const abscissa_type xmin, const abscissa_type xmax)
 Constructor. More...
 
int getNumberOfBins () const
 Get number of bins. More...
 
void setBinWidth (const abscissa_type dx, int option=0)
 Set bin width. More...
 
bool is_valid () const
 Check validity of histogram binning. More...
 
 operator JGrid< abscissa_type > () const
 Type conversion operator. More...
 
 operator pair_type () const
 Type conversion operator. More...
 
const range_typegetRange () const
 Get range. More...
 
void setRange (const range_type &range)
 Set range. More...
 
void setRange (argument_type x, argument_type y)
 Set lower and upper limit. More...
 
void setRange (R first, R second)
 Set range. More...
 
void setRange (const array_type< JElement_t, JAllocator_t > &buffer)
 Set lower and upper limit according to input data. More...
 
JAbscissa_t getLowerLimit () const
 Get lower limit. More...
 
JAbscissa_t getUpperLimit () const
 Get upper limit. More...
 
void setLowerLimit (argument_type x)
 Set lower limit. More...
 
void setUpperLimit (argument_type y)
 Set upper limit. More...
 
void fixLowerLimit (argument_type x)
 Fix lower limit. More...
 
void fixUpperLimit (argument_type y)
 Fix upper limit. More...
 
bool equals (const range_type &range) const
 Equal method. More...
 
JAbscissa_t getLength () const
 Get length (difference between upper and lower limit). More...
 
void setLength (argument_type length)
 Set length (difference between upper and lower limit). More...
 
bool operator() (argument_type x) const
 Test whether value is inside range. More...
 
JAbscissa_t constrain (argument_type x) const
 Constrain value to range. More...
 
JAbscissa_t mod (argument_type x) const
 Modulo value with respect to range. More...
 
bool overlap (const range_type &range) const
 Test overlap with given range. More...
 
range_type include (argument_type x)
 Include given value to range. More...
 
range_typejoin (const range_type &range)
 Join ranges. More...
 
range_typecombine (const range_type &range)
 Combine ranges. More...
 
range_typeadd (argument_type x)
 Add offset. More...
 
range_typeadd (const range_type &range)
 Add offsets. More...
 
range_typesub (argument_type x)
 Subtract offset. More...
 
range_typesub (const range_type &range)
 Subtract offsets. More...
 
range_typemul (const double factor)
 Multiply range. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
range_typediv (const double factor)
 Divide range. More...
 
JAbscissa_t getN (const double R) const
 Get expected number of occurances of given rate within this interval. More...
 
const key_typegetKey () const
 
const mapped_typegetValue () const
 
mapped_typegetValue ()
 

Static Public Member Functions

static JAbscissa_t getMinimum ()
 Get minimum possible value. More...
 
static JAbscissa_t getMaximum ()
 Get maximum possible value. More...
 

Public Attributes

std::less< JAbscissa_t > compare
 Function object. More...
 
JKey_t first
 
JValue_t second
 

Static Public Attributes

static const JRange
< JAbscissa_t, std::less
< JAbscissa_t > > 
DEFAULT_RANGE
 Default range. More...
 

Protected Member Functions

void setRange (R first, R second, const JLANG::JBool< false > &option)
 Set range. More...
 
void setRange (R first, R second, const JLANG::JBool< true > &option)
 Set range. More...
 

Protected Attributes

int number_of_bins
 

Friends

std::istream & operator>> (std::istream &in, JAbstractHistogram< JAbscissa_t > &histogram)
 Read histogram from input. More...
 
std::ostream & operator<< (std::ostream &out, const JAbstractHistogram< JAbscissa_t > &histogram)
 Write histogram to output. More...
 

Detailed Description

template<class JAbscissa_t>
struct JTOOLS::JAbstractHistogram< JAbscissa_t >

Simple data structure for histogram binning.

Definition at line 24 of file JAbstractHistogram.hh.

Member Typedef Documentation

template<class JAbscissa_t>
typedef JAbscissa_t JTOOLS::JAbstractHistogram< JAbscissa_t >::abscissa_type

Definition at line 28 of file JAbstractHistogram.hh.

template<class JAbscissa_t>
typedef JRange<abscissa_type> JTOOLS::JAbstractHistogram< JAbscissa_t >::range_type

Definition at line 29 of file JAbstractHistogram.hh.

typedef std::pair<JAbscissa_t ,JAbscissa_t > JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::pair_type
inherited

Definition at line 45 of file JRange.hh.

typedef JLANG::JClass<JAbscissa_t >::argument_type JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::argument_type
inherited

Definition at line 47 of file JRange.hh.

template<class JKey_t, class JValue_t>
typedef JKey_t JTOOLS::JPair< JKey_t, JValue_t >::key_type
inherited

Definition at line 32 of file JPair.hh.

template<class JKey_t, class JValue_t>
typedef JValue_t JTOOLS::JPair< JKey_t, JValue_t >::mapped_type
inherited

Definition at line 33 of file JPair.hh.

Constructor & Destructor Documentation

template<class JAbscissa_t>
JTOOLS::JAbstractHistogram< JAbscissa_t >::JAbstractHistogram ( )
inline

Default constructor.

Definition at line 35 of file JAbstractHistogram.hh.

template<class JAbscissa_t>
JTOOLS::JAbstractHistogram< JAbscissa_t >::JAbstractHistogram ( const int  nx,
const abscissa_type  xmin,
const abscissa_type  xmax 
)
inline

Constructor.

Parameters
nxnumber of bins
xminlower limit
xmaxupper limit

Definition at line 48 of file JAbstractHistogram.hh.

template<class JAbscissa_t>
JTOOLS::JAbstractHistogram< JAbscissa_t >::JAbstractHistogram ( const abscissa_type  xmin,
const abscissa_type  xmax 
)
inline

Constructor.

Parameters
xminlower limit
xmaxupper limit

Definition at line 62 of file JAbstractHistogram.hh.

Member Function Documentation

template<class JAbscissa_t>
int JTOOLS::JAbstractHistogram< JAbscissa_t >::getNumberOfBins ( ) const
inline

Get number of bins.

Returns
number of bins

Definition at line 74 of file JAbstractHistogram.hh.

75  {
76  return number_of_bins;
77  }
template<class JAbscissa_t>
void JTOOLS::JAbstractHistogram< JAbscissa_t >::setBinWidth ( const abscissa_type  dx,
int  option = 0 
)
inline

Set bin width.

If option < 0, adjust lower limit; if option > 0, adjust upper limit; else no adjustments.

Parameters
dxbin width
optionoption

Definition at line 88 of file JAbstractHistogram.hh.

89  {
90  number_of_bins = (int) (this->getLength() / dx);
91 
92  if (option < 0) { this->setLowerLimit(this->getUpperLimit() - number_of_bins + dx); }
93  if (option > 0) { this->setUpperLimit(this->getLowerLimit() + number_of_bins + dx); }
94  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
JAbscissa_t getLength() const
Get length (difference between upper and lower limit).
Definition: JRange.hh:289
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224
template<class JAbscissa_t>
bool JTOOLS::JAbstractHistogram< JAbscissa_t >::is_valid ( ) const
inline

Check validity of histogram binning.

Returns
true if both range and number of bins are valid; else false

Definition at line 102 of file JAbstractHistogram.hh.

103  {
104  return static_cast<const range_type&>(*this).is_valid() && number_of_bins > 0;
105  }
JRange< abscissa_type > range_type
template<class JAbscissa_t>
JTOOLS::JAbstractHistogram< JAbscissa_t >::operator JGrid< abscissa_type > ( ) const
inline

Type conversion operator.

Returns
grid

Definition at line 113 of file JAbstractHistogram.hh.

114  {
115  return make_grid(this->getNumberOfBins() + 1, this->getLowerLimit(), this->getUpperLimit());
116  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
int getNumberOfBins() const
Get number of bins.
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
JGrid< JAbscissa_t > make_grid(const int nx, const JAbscissa_t Xmin, const JAbscissa_t Xmax)
Helper method for JGrid.
Definition: JGrid.hh:177
JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::operator pair_type ( ) const
inlineinherited

Type conversion operator.

Returns
piar

Definition at line 124 of file JRange.hh.

125  {
127  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::pair< JAbscissa_t, JAbscissa_t > pair_type
Definition: JRange.hh:45
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
const range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::getRange ( ) const
inlineinherited

Get range.

Returns
range

Definition at line 135 of file JRange.hh.

136  {
137  return static_cast<const range_type&>(*this);
138  }
JRange< JAbscissa_t, std::less< JAbscissa_t > > range_type
Definition: JRange.hh:46
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setRange ( const range_type range)
inlineinherited

Set range.

Parameters
rangerange

Definition at line 146 of file JRange.hh.

147  {
148  static_cast<range_type&>(*this) = range;
149  }
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
JRange< JAbscissa_t, std::less< JAbscissa_t > > range_type
Definition: JRange.hh:46
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setRange ( argument_type  x,
argument_type  y 
)
inlineinherited

Set lower and upper limit.

Parameters
xlower limit
yupper limit

Definition at line 158 of file JRange.hh.

159  {
160  this->first = x;
161  this->second = y;
162  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setRange ( R  first,
R  second 
)
inlineinherited

Set range.


The arguments could be values or iterators.

Parameters
firstfirst
secondsecond

Definition at line 173 of file JRange.hh.

174  {
175  using namespace JLANG;
176 
178  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
Auxiliary template class for type bool.
Definition: JBool.hh:20
Data structure to check whether given data type is an iterator.
Definition: JClass.hh:62
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setRange ( const array_type< JElement_t, JAllocator_t > &  buffer)
inlineinherited

Set lower and upper limit according to input data.

Parameters
bufferinput data

Definition at line 187 of file JRange.hh.

188  {
190 
191  for (typename array_type<JElement_t, JAllocator_t>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
192  include(*i);
193  }
194  }
range_type include(argument_type x)
Include given value to range.
Definition: JRange.hh:386
static JAbscissa_t getMinimum()
Get minimum possible value.
Definition: JRange.hh:535
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
static JAbscissa_t getMaximum()
Get maximum possible value.
Definition: JRange.hh:546
Auxiliary data structure for return type of make methods.
Definition: JVectorize.hh:25
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setRange ( R  first,
R  second,
const JLANG::JBool< false > &  option 
)
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optionfalse

Definition at line 577 of file JRange.hh.

578  {
580  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
JLANG::JClass< JAbscissa_t >::argument_type argument_type
Definition: JRange.hh:47
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setRange ( R  first,
R  second,
const JLANG::JBool< true > &  option 
)
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optiontrue

Definition at line 591 of file JRange.hh.

592  {
594 
595  for (R i = first; i != second; ++i) {
596  include(*i);
597  }
598  }
range_type include(argument_type x)
Include given value to range.
Definition: JRange.hh:386
JValue_t second
Definition: JPair.hh:129
static JAbscissa_t getMinimum()
Get minimum possible value.
Definition: JRange.hh:535
JKey_t first
Definition: JPair.hh:128
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
static JAbscissa_t getMaximum()
Get maximum possible value.
Definition: JRange.hh:546
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::getLowerLimit ( ) const
inlineinherited

Get lower limit.

Returns
lower limit

Definition at line 202 of file JRange.hh.

203  {
204  return this->first;
205  }
JKey_t first
Definition: JPair.hh:128
JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::getUpperLimit ( ) const
inlineinherited

Get upper limit.

Returns
upper limit

Definition at line 213 of file JRange.hh.

214  {
215  return this->second;
216  }
JValue_t second
Definition: JPair.hh:129
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setLowerLimit ( argument_type  x)
inlineinherited

Set lower limit.

Parameters
xlower limit

Definition at line 224 of file JRange.hh.

225  {
226  this->first = x;
227  }
JKey_t first
Definition: JPair.hh:128
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setUpperLimit ( argument_type  y)
inlineinherited

Set upper limit.

Parameters
yupper limit

Definition at line 235 of file JRange.hh.

236  {
237  this->second = y;
238  }
JValue_t second
Definition: JPair.hh:129
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::fixLowerLimit ( argument_type  x)
inlineinherited

Fix lower limit.

The range is shifted to the given lower limit.

Parameters
xlower limit

Definition at line 248 of file JRange.hh.

249  {
250  this->second += x - this->first;
251  this->first = x;
252  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::fixUpperLimit ( argument_type  y)
inlineinherited

Fix upper limit.

The range is shifted to the given upper limit.

Parameters
yupper limit

Definition at line 262 of file JRange.hh.

263  {
264  this->first += y - this->second;
265  this->second = y;
266  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
bool JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::equals ( const range_type range) const
inlineinherited

Equal method.

Parameters
rangerange
Returns
true if this module range equal to given module range; else false

Definition at line 275 of file JRange.hh.

276  {
277  return (!this->compare(this->getLowerLimit(), range.getLowerLimit()) &&
278  !this->compare(range.getLowerLimit(), this->getLowerLimit()) &&
279  !this->compare(this->getUpperLimit(), range.getUpperLimit()) &&
280  !this->compare(range.getUpperLimit(), this->getUpperLimit()));
281  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::getLength ( ) const
inlineinherited

Get length (difference between upper and lower limit).

Returns
length

Definition at line 289 of file JRange.hh.

290  {
291  return getUpperLimit() - getLowerLimit();
292  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
void JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::setLength ( argument_type  length)
inlineinherited

Set length (difference between upper and lower limit).

Parameters
lengthlength

Definition at line 300 of file JRange.hh.

301  {
302  setUpperLimit(getLowerLimit() + length);
303  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
bool JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::operator() ( argument_type  x) const
inlineinherited

Test whether value is inside range.

Parameters
xvalue
Returns
true if lower limit <= value <= upper limit; else false

Definition at line 323 of file JRange.hh.

324  {
325  return (!compare(x, getLowerLimit()) &&
326  !compare(getUpperLimit(), x));
327  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::constrain ( argument_type  x) const
inlineinherited

Constrain value to range.


This method returns the original value if it is in this range, else lower limit if value < lower limit or upper limit if value > upper limit.

Parameters
xvalue
Returns
lower limit <= x <= upper limit

Definition at line 338 of file JRange.hh.

339  {
340  if (compare(x, getLowerLimit())) { return getLowerLimit(); }
341  if (compare(getUpperLimit(), x)) { return getUpperLimit(); }
342 
343  return x;
344  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::mod ( argument_type  x) const
inlineinherited

Modulo value with respect to range.


Parameters
xvalue
Returns
lower limit <= x <= upper limit

Definition at line 353 of file JRange.hh.

354  {
355  if (compare(x, getLowerLimit()))
356  return x + getLength() * floor((getUpperLimit() - x) / getLength());
357  else if (compare(getUpperLimit(), x))
358  return x - getLength() * floor((x - getLowerLimit()) / getLength());
359  else
360  return x;
361  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
JAbscissa_t getLength() const
Get length (difference between upper and lower limit).
Definition: JRange.hh:289
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
bool JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::overlap ( const range_type range) const
inlineinherited

Test overlap with given range.


The result is equivalent to join(range).is_valid().

Parameters
rangerange
Returns
true if there is a non-zero overlap; else false

Definition at line 371 of file JRange.hh.

372  {
373  return (compare(getLowerLimit(), range.getUpperLimit()) &&
374  compare(range.getLowerLimit(), getUpperLimit()));
375  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
range_type JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::include ( argument_type  x)
inlineinherited

Include given value to range.


The new lower limit is the minimim of the original lower limit and given value and
the new upper limit is the maximum of the original upper limit and given value;

Parameters
xvalue
Returns
range

Definition at line 386 of file JRange.hh.

387  {
388  if (compare(x, getLowerLimit())) { setLowerLimit(x); }
389  if (compare(getUpperLimit(), x)) { setUpperLimit(x); }
390 
391  return *this;
392  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::join ( const range_type range)
inlineinherited

Join ranges.


The new lower limit is the maximim of the two lower limits and
the new upper limit is the minimum of the two upper limits.
This operation results in an equal or smaller range and may result in an unphysical range (i.e. lower limit > upper limit).

Parameters
rangerange

Definition at line 404 of file JRange.hh.

405  {
406  if (compare(getLowerLimit(), range.getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
407  if (compare(range.getUpperLimit(), getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
408 
409  return *this;
410  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::combine ( const range_type range)
inlineinherited

Combine ranges.


The new lower limit is the minimim of the two lower limits and
the new upper limit is the maximum of the two upper limits.
This operation results in an equal or larger range.

Parameters
rangerange

Definition at line 421 of file JRange.hh.

422  {
423  if (compare(range.getLowerLimit(), getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
424  if (compare(getUpperLimit(), range.getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
425 
426  return *this;
427  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
std::less< JAbscissa_t > compare
Function object.
Definition: JRange.hh:566
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::add ( argument_type  x)
inlineinherited

Add offset.

Parameters
xoffset

Definition at line 435 of file JRange.hh.

436  {
437  this->first += x;
438  this->second += x;
439 
440  return *this;
441  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::add ( const range_type range)
inlineinherited

Add offsets.


The new lower limit is the sum of the two lower limits and
the new upper limit is the sum of the two upper limits.

Parameters
rangeoffset

Definition at line 465 of file JRange.hh.

466  {
467  this->first += range.getLowerLimit();
468  this->second += range.getUpperLimit();
469 
470  return *this;
471  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::sub ( argument_type  x)
inlineinherited

Subtract offset.

Parameters
xoffset

Definition at line 449 of file JRange.hh.

450  {
451  this->first -= x;
452  this->second -= x;
453 
454  return *this;
455  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::sub ( const range_type range)
inlineinherited

Subtract offsets.


The new lower limit is the difference of the two lower limits and
the new upper limit is the difference of the two upper limits.

Parameters
rangeoffset

Definition at line 481 of file JRange.hh.

482  {
483  this->first -= range.getLowerLimit();
484  this->second -= range.getUpperLimit();
485 
486  return *this;
487  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi mv $WORKDIR/fit.root $MODULE_ROOT typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
Definition: module-Z:fit.sh:84
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::mul ( const double  factor)
inlineinherited

Multiply range.

Parameters
factorfactor

Definition at line 495 of file JRange.hh.

496  {
497  this->first *= factor;
498  this->second *= factor;
499 
500  return *this;
501  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
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 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
range_type& JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::div ( const double  factor)
inlineinherited

Divide range.

Parameters
factorfactor

Definition at line 509 of file JRange.hh.

510  {
511  this->first /= factor;
512  this->second /= factor;
513 
514  return *this;
515  }
JValue_t second
Definition: JPair.hh:129
JKey_t first
Definition: JPair.hh:128
JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::getN ( const double  R) const
inlineinherited

Get expected number of occurances of given rate within this interval.

Parameters
Rrate
Returns
expectation value

Definition at line 524 of file JRange.hh.

525  {
526  return R * (getUpperLimit() - getLowerLimit());
527  }
JAbscissa_t getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JAbscissa_t getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
static JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::getMinimum ( )
inlinestaticinherited

Get minimum possible value.

Returns
minimum possible value

Definition at line 535 of file JRange.hh.

536  {
537  return JMATH::JLimits<T>::min();
538  }
float min()
Definition: JLimits.hh:96
static JAbscissa_t JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::getMaximum ( )
inlinestaticinherited

Get maximum possible value.

Returns
maximum possible value

Definition at line 546 of file JRange.hh.

547  {
548  return JMATH::JLimits<T>::max();
549  }
template<class JKey_t, class JValue_t>
const key_type& JTOOLS::JPair< JKey_t, JValue_t >::getKey ( ) const
inlineinherited

Definition at line 123 of file JPair.hh.

123 { return this->first; }
JKey_t first
Definition: JPair.hh:128
template<class JKey_t, class JValue_t>
const mapped_type& JTOOLS::JPair< JKey_t, JValue_t >::getValue ( ) const
inlineinherited

Definition at line 124 of file JPair.hh.

124 { return this->second; }
JValue_t second
Definition: JPair.hh:129
template<class JKey_t, class JValue_t>
mapped_type& JTOOLS::JPair< JKey_t, JValue_t >::getValue ( )
inlineinherited

Definition at line 126 of file JPair.hh.

126 { return this->second; }
JValue_t second
Definition: JPair.hh:129

Friends And Related Function Documentation

template<class JAbscissa_t>
std::istream& operator>> ( std::istream &  in,
JAbstractHistogram< JAbscissa_t > &  histogram 
)
friend

Read histogram from input.

Parameters
ininput stream
histogramhistogram
Returns
input stream

Definition at line 126 of file JAbstractHistogram.hh.

127  {
128  return in >> histogram.number_of_bins >> static_cast<range_type&>(histogram);
129  }
JRange< abscissa_type > range_type
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36
template<class JAbscissa_t>
std::ostream& operator<< ( std::ostream &  out,
const JAbstractHistogram< JAbscissa_t > &  histogram 
)
friend

Write histogram to output.

Parameters
outoutput stream
histogramhistogram
Returns
output stream

Definition at line 139 of file JAbstractHistogram.hh.

140  {
141  return out << histogram.number_of_bins << ' ' << static_cast<const range_type&>(histogram);
142  }
JRange< abscissa_type > range_type

Member Data Documentation

template<class JAbscissa_t>
int JTOOLS::JAbstractHistogram< JAbscissa_t >::number_of_bins
protected

Definition at line 145 of file JAbstractHistogram.hh.

const JRange<JAbscissa_t , std::less<JAbscissa_t > > JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::DEFAULT_RANGE
staticinherited

Default range.

This range corresponds to an unphysical range.

Definition at line 556 of file JRange.hh.

std::less<JAbscissa_t > JTOOLS::JRange< JAbscissa_t , std::less<JAbscissa_t > >::compare
inherited

Function object.

Parameters
firstfirst argument
secondsecond argument
Returns
true if first < second; else false

Definition at line 566 of file JRange.hh.

template<class JKey_t, class JValue_t>
JKey_t JTOOLS::JPair< JKey_t, JValue_t >::first
inherited

Definition at line 128 of file JPair.hh.

template<class JKey_t, class JValue_t>
JValue_t JTOOLS::JPair< JKey_t, JValue_t >::second
inherited

Definition at line 129 of file JPair.hh.


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