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 | Static Protected Member Functions | Protected Attributes | Friends | List of all members
JDETECTOR::JDetector Class Reference

Detector data structure. More...

#include <JDetector.hh>

Inheritance diagram for JDETECTOR::JDetector:
JLANG::JObjectID JDETECTOR::JDetectorVersion JDETECTOR::JDetectorHeader std::vector< JModule > JLANG::JMultiEquals< JClass_t, JTypelist_t > JIO::JSerialisable JLANG::JComparable< JObjectID, int > JEEP::JVersion JUTC::JUTCTimeRange JUTM::JUTMGrid JUTM::JUTMPosition JLANG::JEquals< JFirst_t, JSecond_t > JTOOLS::JRange< T, JComparator_t > JTOOLS::JPair< T, T > JLANG::JEquals< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JDETECTOR::JMonteCarloDetector

Public Types

enum  JVersion_t { V1 = 1, V2 = 2, V3 = 3 }
 Enumeration of version types. More...
 
typedef JRange< T, JComparator_t > range_type
 
typedef JLANG::JClass< T >
::argument_type 
argument_type
 
typedef T key_type
 
typedef T mapped_type
 

Public Member Functions

 JDetector ()
 Default constructor. More...
 
 JDetector (const JObjectID &id, const JVersion &version, const JDetectorHeader &header)
 Constructor. More...
 
void setVersion (const JVersion &version)
 Set version. More...
 
void setVersion (const JDetectorVersion::JVersion_t &version)
 Set version. More...
 
JDetectoroperator+= (const JVector3D &pos)
 Move detector elements. More...
 
JDetectoroperator-= (const JVector3D &pos)
 Move detector elements. More...
 
const JModulegetModule (const JModuleAddress &address) const
 Get module parameters. More...
 
JModulegetModule (const JModuleAddress &address)
 Get module parameters. More...
 
const JModulegetModule (const JModuleLocation &location) const
 Get module parameters. More...
 
JModulegetModule (const JModuleLocation &location)
 Get module parameters. More...
 
const JPMTgetPMT (const JPMTAddress &address) const
 Get PMT parameters. More...
 
JPMTgetPMT (const JPMTAddress &address)
 Get PMT parameters. More...
 
virtual JReaderread (JReader &in)
 Read from input. More...
 
virtual JWriterwrite (JWriter &out) const
 Write to output. More...
 
int getID () const
 Get identifier. More...
 
void setID (const int id)
 Set identifier. More...
 
bool less (const JObjectID &object) const
 Less than method. More...
 
bool less (const int id) const
 Less than method. More...
 
bool more (const int id) const
 More than method. More...
 
const JVersiongetVersion () const
 Get version. More...
 
JVersiongetVersion ()
 Get version. More...
 
const std::string & getVariant () const
 Get variant. More...
 
void setVariant (const std::string &variant)
 Set variant. More...
 
bool equals (const JVersion &version) const
 Equal method. More...
 
JProperties getProperties (const JEquationParameters &equation=JDetectorHeader::getEquationParameters())
 Get properties of this class. More...
 
JProperties getProperties (const JEquationParameters &equation=JDetectorHeader::getEquationParameters()) const
 Get properties of this class. 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 uppper limit. More...
 
template<class iterator_type , class value_type , class result_type >
void setRange (iterator_type __begin, iterator_type __end, result_type value_type::*member)
 Set lower and uppper limit. More...
 
template<class iterator_type , class value_type , class result_type >
void setRange (iterator_type __begin, iterator_type __end, result_type(value_type::*function)() const)
 Set lower and uppper limit. More...
 
getLowerLimit () const
 Get lower limit. More...
 
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...
 
getLength () const
 Get length (difference between upper and lower limit). More...
 
bool is_valid () const
 Check validity of range. More...
 
bool operator() (argument_type x) const
 Test whether value is inside range. More...
 
constrain (argument_type x) const
 Constrain value 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 offset. More...
 
range_typesub (argument_type x)
 Subtract offset. More...
 
range_typesub (const range_type &range)
 Subtract offset. 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...
 
getN (const double R) const
 Get expected number of occurances of given rate within this interval. More...
 
const key_typegetKey () const
 
const std::string & getKey () const
 Get key. More...
 
const mapped_typegetValue () const
 
mapped_typegetValue ()
 
const std::string & getWGS () const
 Get WGS. More...
 
const std::string & getUTMZone () const
 Get UTM zone. More...
 
std::string toString () const
 Convert UTM grid. More...
 
JPosition3D getPosition () const
 Get position. More...
 
double getUTMEast () const
 Get UTM east. More...
 
double getUTMNorth () const
 Get UTM north. More...
 
double getUTMZ () const
 Get UTM Z. More...
 

Static Public Member Functions

static JEquationParametersgetEquationParameters ()
 Get equation parameters. More...
 
static void setEquationParameters (const JEquationParameters &equation)
 Set equation parameters. More...
 
static T getMinimum ()
 Get minimum possible value. More...
 
static T getMaximum ()
 Get maximum possible value. More...
 
static JUTMGrid valueOf (const std::string &buffer)
 Extract UTM grid. More...
 

Public Attributes

JComment comment
 
JComparator_t compare
 Function object. More...
 
first
 
second
 

Static Public Attributes

static const JRange< T,
JComparator_t > 
DEFAULT_RANGE
 Default range. More...
 

Static Protected Member Functions

template<class JHead_t , class JTail_t >
static bool eq (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
 Equals method for composite data types. More...
 
template<class JHead_t >
static bool eq (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JNullType > > &type)
 Equals method for composite data types. More...
 

Protected Attributes

int __id
 
std::string __variant
 
std::string key
 
std::string wgs
 
std::string zone
 
double east
 
double north
 
double z
 

Friends

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

Detailed Description

Detector data structure.

A detector consists of a header and a list of modules, each of which consists of a list of PMTs. Each PMT comprises position, orientation and time calibration data. Note that the index of the PMT in the module data structure corresponds to the readout channel (TDC).

The following formats and file name extension are supported:

extension format function
".detx" ASCII I/O
".gz" gzipped ASCII I/O
".dat" binary I/O
".det" ASCII I

The different formats can transparently be read and written using the methods:

   inline void load(const JString& file_name, JDetector& detector);
   inline void store(const JString& file_name, const JDetector& detector);

respectively. These methods are available in the include file JDetectorToolkit.hh.

The JDETECTOR::JModuleRouter and JDETECTOR::JPMTRouter classes provide for fast look-up methods of module and PMT calibration data for real data and Monte Carlo data, respectively.

Note that the (not) equal operator strictly applies to the detector identifier and version. For quantitative comparisons, use JCompareDetector.cc.

Definition at line 77 of file JDetector.hh.

Member Typedef Documentation

template<class T, class JComparator_t = std::less<T>>
typedef JRange<T, JComparator_t> JTOOLS::JRange< T, JComparator_t >::range_type
inherited

Definition at line 40 of file JRange.hh.

template<class T, class JComparator_t = std::less<T>>
typedef JLANG::JClass<T>::argument_type JTOOLS::JRange< T, JComparator_t >::argument_type
inherited

Definition at line 41 of file JRange.hh.

typedef T JTOOLS::JPair< T , T >::key_type
inherited

Definition at line 32 of file JPair.hh.

typedef T JTOOLS::JPair< T , T >::mapped_type
inherited

Definition at line 33 of file JPair.hh.

Member Enumeration Documentation

Enumeration of version types.


Additional version types should be included in JGetDetectorVersion::JGetDetectorVersion.

Enumerator
V1 

First version.

V2 

Version with UTC time and UTM position data.

V3 

Version with PMT status field and comments.

Definition at line 41 of file JDetectorVersion.hh.

41  {
42  V1 = 1, //!< First version
43  V2 = 2, //!< Version with UTC time and UTM position data
44  V3 = 3 //!< Version with PMT status field and comments
45  };
Version with UTC time and UTM position data.
Version with PMT status field and comments.

Constructor & Destructor Documentation

JDETECTOR::JDetector::JDetector ( )
inline

Default constructor.

Definition at line 89 of file JDetector.hh.

89  :
90  JObjectID(),
92  JDetectorHeader (),
94  JSerialisable()
95  {}
JDetectorVersion()
Default constructor.
JDetectorHeader()
Default constructor.
JObjectID()
Default constructor.
Definition: JObjectID.hh:34
JDETECTOR::JDetector::JDetector ( const JObjectID id,
const JVersion version,
const JDetectorHeader header 
)
inline

Constructor.

Parameters
iddetector identifier
versionversion
headerheader

Definition at line 105 of file JDetector.hh.

107  :
108  JObjectID(id),
109  JDetectorVersion(version),
110  JDetectorHeader (header),
112  JSerialisable()
113  {
115  }
JDetectorVersion()
Default constructor.
JDetectorHeader()
Default constructor.
JObjectID()
Default constructor.
Definition: JObjectID.hh:34
static void setVersion(const JVersion &version)
Set detector version.
Definition: JPMT.hh:132
const JVersion & getVersion() const
Get version.
Definition: JVersion.hh:57

Member Function Documentation

void JDETECTOR::JDetector::setVersion ( const JVersion version)
inline

Set version.

Parameters
versionversion

Definition at line 123 of file JDetector.hh.

124  {
125  static_cast<JDetectorVersion&>(*this).setVersion(version);
126 
128  }
void setVersion(const JVersion &version)
Set version.
Definition: JVersion.hh:79
static void setVersion(const JVersion &version)
Set detector version.
Definition: JPMT.hh:132
const JVersion & getVersion() const
Get version.
Definition: JVersion.hh:57
void JDETECTOR::JDetector::setVersion ( const JDetectorVersion::JVersion_t version)
inline

Set version.

Parameters
versionversion

Definition at line 136 of file JDetector.hh.

137  {
138  setVersion(putDetectorVersion(version));
139  }
void setVersion(const JVersion &version)
Set version.
Definition: JDetector.hh:123
static const JPutDetectorVersion putDetectorVersion(getDetectorVersion)
Function object to map detector version to detector variant.
JDetector& JDETECTOR::JDetector::operator+= ( const JVector3D pos)
inline

Move detector elements.

Parameters
posoffset position
Returns
this JDetector

Definition at line 148 of file JDetector.hh.

149  {
150  for (iterator i = begin(); i != end(); ++i) {
151  i->add(pos);
152  }
153 
154  return *this;
155  }
JDetector& JDETECTOR::JDetector::operator-= ( const JVector3D pos)
inline

Move detector elements.

Parameters
posoffset position
Returns
this JDetector

Definition at line 164 of file JDetector.hh.

165  {
166  for (iterator i = begin(); i != end(); ++i) {
167  i->sub(pos);
168  }
169 
170  return *this;
171  }
const JModule& JDETECTOR::JDetector::getModule ( const JModuleAddress address) const
inline

Get module parameters.

Parameters
addressmodule address
Returns
module parameters

Definition at line 180 of file JDetector.hh.

181  {
182  return at(address.first);
183  }
int first
index of module in detector data structure
JModule& JDETECTOR::JDetector::getModule ( const JModuleAddress address)
inline

Get module parameters.

Parameters
addressmodule address
Returns
module parameters

Definition at line 192 of file JDetector.hh.

193  {
194  return at(address.first);
195  }
int first
index of module in detector data structure
const JModule& JDETECTOR::JDetector::getModule ( const JModuleLocation location) const
inline

Get module parameters.

Parameters
locationmodule location
Returns
module parameters

Definition at line 204 of file JDetector.hh.

205  {
206  for (JDetector::const_iterator module = this->begin(); module != this->end(); ++module) {
207  if (*module == location) {
208  return *module;
209  }
210  }
211 
212  THROW(JIndexOutOfRange, "JDetector::getModule()");
213  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:633
JModule& JDETECTOR::JDetector::getModule ( const JModuleLocation location)
inline

Get module parameters.

Parameters
locationmodule location
Returns
module parameters

Definition at line 222 of file JDetector.hh.

223  {
224  for (JDetector::iterator module = this->begin(); module != this->end(); ++module) {
225  if (*module == location) {
226  return *module;
227  }
228  }
229 
230  THROW(JIndexOutOfRange, "JDetector::getModule()");
231  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:633
const JPMT& JDETECTOR::JDetector::getPMT ( const JPMTAddress address) const
inline

Get PMT parameters.

Parameters
addressJPMTAddress
Returns
JPMT

Definition at line 240 of file JDetector.hh.

241  {
242  return at(address.first).at(address.second);
243  }
int second
index of PMT in module data structure.
Definition: JPMTAddress.hh:100
int first
index of module in detector data structure
JPMT& JDETECTOR::JDetector::getPMT ( const JPMTAddress address)
inline

Get PMT parameters.

Parameters
addressJPMTAddress
Returns
JPMT

Definition at line 252 of file JDetector.hh.

253  {
254  return at(address.first).at(address.second);
255  }
int second
index of PMT in module data structure.
Definition: JPMTAddress.hh:100
int first
index of module in detector data structure
virtual JReader& JDETECTOR::JDetector::read ( JReader in)
inlinevirtual

Read from input.

Parameters
inreader
Returns
reader

Implements JIO::JSerialisable.

Definition at line 367 of file JDetector.hh.

368  {
369  clear();
370 
371  int n;
372 
373  in >> static_cast<JObjectID&> (*this);
374  in >> static_cast<JDetectorVersion&>(*this);
375  in >> static_cast<JDetectorHeader&> (*this);
376  in >> n;
377 
379 
380  for (JModule module; n != 0; --n) {
381 
382  in >> module;
383 
384  push_back(module);
385  }
386 
387  return in;
388  }
Data structure for a composite optical module.
Definition: JModule.hh:47
JObjectID()
Default constructor.
Definition: JObjectID.hh:34
Data structure for detector header.
static void setVersion(const JVersion &version)
Set detector version.
Definition: JPMT.hh:132
const JVersion & getVersion() const
Get version.
Definition: JVersion.hh:57
virtual JWriter& JDETECTOR::JDetector::write ( JWriter out) const
inlinevirtual

Write to output.

Parameters
outwriter
Returns
writer

Implements JIO::JSerialisable.

Definition at line 397 of file JDetector.hh.

398  {
399  int n = size();
400 
401  out << static_cast<const JObjectID&> (*this);
402  out << static_cast<const JDetectorVersion&>(*this);
403  out << static_cast<const JDetectorHeader&> (*this);
404  out << n;
405 
406  for (const_iterator i = begin(); i != end(); ++i) {
407  out << *i;
408  }
409 
410  return out;
411  }
int JLANG::JObjectID::getID ( ) const
inlineinherited

Get identifier.

Returns
identifier

Definition at line 54 of file JObjectID.hh.

55  {
56  return __id;
57  }
void JLANG::JObjectID::setID ( const int  id)
inlineinherited

Set identifier.

Parameters
ididentifier

Definition at line 65 of file JObjectID.hh.

66  {
67  this->__id = id;
68  }
bool JLANG::JObjectID::less ( const JObjectID object) const
inlineinherited

Less than method.

Parameters
objectobject identifier
Returns
true if this identifier less than given identifier; else false

Definition at line 77 of file JObjectID.hh.

78  {
79  return this->getID() < object.getID();
80  }
int getID() const
Get identifier.
Definition: JObjectID.hh:54
bool JLANG::JObjectID::less ( const int  id) const
inlineinherited

Less than method.

Parameters
ididentifier
Returns
true if this identifier less than given identifier; else false

Definition at line 89 of file JObjectID.hh.

90  {
91  return this->getID() < id;
92  }
int getID() const
Get identifier.
Definition: JObjectID.hh:54
bool JLANG::JObjectID::more ( const int  id) const
inlineinherited

More than method.

Parameters
ididentifier
Returns
true if this identifier greater than given identifier; else false

Definition at line 101 of file JObjectID.hh.

102  {
103  return this->getID() > id;
104  }
int getID() const
Get identifier.
Definition: JObjectID.hh:54
const JVersion& JEEP::JVersion::getVersion ( ) const
inlineinherited

Get version.

Returns
version

Definition at line 57 of file JVersion.hh.

58  {
59  return static_cast<const JVersion&>(*this);
60  }
Auxiliary class for version identifier.
Definition: JVersion.hh:30
JVersion& JEEP::JVersion::getVersion ( )
inlineinherited

Get version.

Returns
version

Definition at line 68 of file JVersion.hh.

69  {
70  return static_cast<JVersion&>(*this);
71  }
Auxiliary class for version identifier.
Definition: JVersion.hh:30
const std::string& JEEP::JVersion::getVariant ( ) const
inlineinherited

Get variant.

Returns
variant

Definition at line 90 of file JVersion.hh.

91  {
92  return this->__variant;
93  }
std::string __variant
Definition: JVersion.hh:171
void JEEP::JVersion::setVariant ( const std::string &  variant)
inlineinherited

Set variant.

Parameters
variantvariant

Definition at line 101 of file JVersion.hh.

102  {
103  this->__variant = variant;
104  }
std::string __variant
Definition: JVersion.hh:171
bool JEEP::JVersion::equals ( const JVersion version) const
inlineinherited

Equal method.

Parameters
versionversion
Returns
true if this version equal to given version; else false

Definition at line 113 of file JVersion.hh.

114  {
115  return this->getVariant() == version.getVariant();
116  }
const std::string & getVariant() const
Get variant.
Definition: JVersion.hh:90
static JEquationParameters& JDETECTOR::JDetectorHeader::getEquationParameters ( )
inlinestaticinherited

Get equation parameters.

Returns
equation parameters

Definition at line 144 of file JDetectorHeader.hh.

145  {
146  static JEquationParameters equation;
147 
148  return equation;
149  }
Simple data structure to support I/O of equations (see class JLANG::JEquation).
static void JDETECTOR::JDetectorHeader::setEquationParameters ( const JEquationParameters equation)
inlinestaticinherited

Set equation parameters.

Parameters
equationequation parameters

Definition at line 158 of file JDetectorHeader.hh.

159  {
160  getEquationParameters() = equation;
161  }
static JEquationParameters & getEquationParameters()
Get equation parameters.
JProperties JDETECTOR::JDetectorHeader::getProperties ( const JEquationParameters equation = JDetectorHeader::getEquationParameters())
inlineinherited

Get properties of this class.

Parameters
equationequation parameters

Definition at line 169 of file JDetectorHeader.hh.

170  {
171  return JDetectorHeaderHelper(*this, equation);
172  }
JProperties JDETECTOR::JDetectorHeader::getProperties ( const JEquationParameters equation = JDetectorHeader::getEquationParameters()) const
inlineinherited

Get properties of this class.

Parameters
equationequation parameters

Definition at line 180 of file JDetectorHeader.hh.

181  {
182  return JDetectorHeaderHelper(*this, equation);
183  }
template<class T, class JComparator_t = std::less<T>>
const range_type& JTOOLS::JRange< T, JComparator_t >::getRange ( ) const
inlineinherited

Get range.

Returns
range

Definition at line 109 of file JRange.hh.

110  {
111  return static_cast<const range_type&>(*this);
112  }
JRange< T, JComparator_t > range_type
Definition: JRange.hh:40
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setRange ( const range_type range)
inlineinherited

Set range.

Parameters
rangerange

Definition at line 120 of file JRange.hh.

121  {
122  static_cast<range_type&>(*this) = range;
123  }
JRange< T, JComparator_t > range_type
Definition: JRange.hh:40
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setRange ( argument_type  x,
argument_type  y 
)
inlineinherited

Set lower and uppper limit.

Parameters
xlower limit
yupper limit

Definition at line 132 of file JRange.hh.

133  {
134  this->first = x;
135  this->second = y;
136  }
template<class T, class JComparator_t = std::less<T>>
template<class iterator_type , class value_type , class result_type >
void JTOOLS::JRange< T, JComparator_t >::setRange ( iterator_type  __begin,
iterator_type  __end,
result_type value_type::*  member 
)
inlineinherited

Set lower and uppper limit.

Parameters
__beginbegin of data
__endend of data
memberpointer to data member

Definition at line 147 of file JRange.hh.

148  {
150 
151  for (iterator_type i = __begin; i != __end; ++i) {
152  include((*i).*member);
153  }
154  }
range_type include(argument_type x)
Include given value to range.
Definition: JRange.hh:336
static T getMinimum()
Get minimum possible value.
Definition: JRange.hh:485
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:120
static T getMaximum()
Get maximum possible value.
Definition: JRange.hh:496
template<class T, class JComparator_t = std::less<T>>
template<class iterator_type , class value_type , class result_type >
void JTOOLS::JRange< T, JComparator_t >::setRange ( iterator_type  __begin,
iterator_type  __end,
result_type(value_type::*)() const  function 
)
inlineinherited

Set lower and uppper limit.

Parameters
__beginbegin of data
__endend of data
functionpointer to member method

Definition at line 165 of file JRange.hh.

166  {
168 
169  for (iterator_type i = __begin; i != __end; ++i) {
170  include(((*i).*function)());
171  }
172  }
range_type include(argument_type x)
Include given value to range.
Definition: JRange.hh:336
static T getMinimum()
Get minimum possible value.
Definition: JRange.hh:485
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:120
static T getMaximum()
Get maximum possible value.
Definition: JRange.hh:496
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getLowerLimit ( ) const
inlineinherited

Get lower limit.

Returns
lower limit

Definition at line 180 of file JRange.hh.

181  {
182  return this->first;
183  }
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getUpperLimit ( ) const
inlineinherited

Get upper limit.

Returns
upper limit

Definition at line 191 of file JRange.hh.

192  {
193  return this->second;
194  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setLowerLimit ( argument_type  x)
inlineinherited

Set lower limit.

Parameters
xlower limit

Definition at line 202 of file JRange.hh.

203  {
204  this->first = x;
205  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setUpperLimit ( argument_type  y)
inlineinherited

Set upper limit.

Parameters
yupper limit

Definition at line 213 of file JRange.hh.

214  {
215  this->second = y;
216  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::fixLowerLimit ( argument_type  x)
inlineinherited

Fix lower limit.

The range is shifted to the given lower limit.

Parameters
xlower limit

Definition at line 226 of file JRange.hh.

227  {
228  this->second += x - this->first;
229  this->first = x;
230  }
template<class T, class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::fixUpperLimit ( argument_type  y)
inlineinherited

Fix upper limit.

The range is shifted to the given upper limit.

Parameters
yupper limit

Definition at line 240 of file JRange.hh.

241  {
242  this->first += y - this->second;
243  this->second = y;
244  }
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_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 253 of file JRange.hh.

254  {
255  return (!this->compare(this->getLowerLimit(), range.getLowerLimit()) &&
256  !this->compare(range.getLowerLimit(), this->getLowerLimit()) &&
257  !this->compare(this->getUpperLimit(), range.getUpperLimit()) &&
258  !this->compare(range.getUpperLimit(), this->getUpperLimit()));
259  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getLength ( ) const
inlineinherited

Get length (difference between upper and lower limit).

Returns
length

Definition at line 267 of file JRange.hh.

268  {
269  return getUpperLimit() - getLowerLimit();
270  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::is_valid ( ) const
inlineinherited

Check validity of range.

Returns
true if lower limit less than or equal to upper limit; else false

Definition at line 278 of file JRange.hh.

279  {
280  return !compare(getUpperLimit(), getLowerLimit());
281  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_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 290 of file JRange.hh.

291  {
292  return (!compare(x, getLowerLimit()) &&
293  !compare(getUpperLimit(), x));
294  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_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 305 of file JRange.hh.

306  {
307  if (compare(x, getLowerLimit())) return getLowerLimit();
308  if (compare(getUpperLimit(), x)) return getUpperLimit();
309 
310  return x;
311  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
template<class T, class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_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 321 of file JRange.hh.

322  {
323  return (compare(getLowerLimit(), range.getUpperLimit()) &&
324  compare(range.getLowerLimit(), getUpperLimit()));
325  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
template<class T, class JComparator_t = std::less<T>>
range_type JTOOLS::JRange< T, JComparator_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 336 of file JRange.hh.

337  {
338  if (compare(x, getLowerLimit())) setLowerLimit(x);
339  if (compare(getUpperLimit(), x)) setUpperLimit(x);
340 
341  return *this;
342  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:213
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:202
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_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 354 of file JRange.hh.

355  {
356  if (compare(getLowerLimit(), range.getLowerLimit())) setLowerLimit(range.getLowerLimit());
357  if (compare(range.getUpperLimit(), getUpperLimit())) setUpperLimit(range.getUpperLimit());
358 
359  return *this;
360  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:213
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:202
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_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 371 of file JRange.hh.

372  {
373  if (compare(range.getLowerLimit(), getLowerLimit())) setLowerLimit(range.getLowerLimit());
374  if (compare(getUpperLimit(), range.getUpperLimit())) setUpperLimit(range.getUpperLimit());
375 
376  return *this;
377  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
JComparator_t compare
Function object.
Definition: JRange.hh:516
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:213
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:202
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::add ( argument_type  x)
inlineinherited

Add offset.

Parameters
xoffset

Definition at line 385 of file JRange.hh.

386  {
387  this->first += x;
388  this->second += x;
389 
390  return *this;
391  }
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::add ( const range_type range)
inlineinherited

Add offset.

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 415 of file JRange.hh.

416  {
417  this->first += range.getLowerLimit();
418  this->second += range.getUpperLimit();
419 
420  return *this;
421  }
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::sub ( argument_type  x)
inlineinherited

Subtract offset.

Parameters
xoffset

Definition at line 399 of file JRange.hh.

400  {
401  this->first -= x;
402  this->second -= x;
403 
404  return *this;
405  }
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::sub ( const range_type range)
inlineinherited

Subtract offset.

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 431 of file JRange.hh.

432  {
433  this->first -= range.getLowerLimit();
434  this->second -= range.getUpperLimit();
435 
436  return *this;
437  }
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::mul ( const double  factor)
inlineinherited

Multiply range.

Parameters
factorfactor

Definition at line 445 of file JRange.hh.

446  {
447  this->first *= factor;
448  this->second *= factor;
449 
450  return *this;
451  }
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 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }
Auxiliary class for product evaluation of objects.
Definition: JCalculator.hh:18
template<class T, class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_t >::div ( const double  factor)
inlineinherited

Divide range.

Parameters
factorfactor

Definition at line 459 of file JRange.hh.

460  {
461  this->first /= factor;
462  this->second /= factor;
463 
464  return *this;
465  }
template<class T, class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_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 474 of file JRange.hh.

475  {
476  return R * (getUpperLimit() - getLowerLimit());
477  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:180
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:191
template<class T, class JComparator_t = std::less<T>>
static T JTOOLS::JRange< T, JComparator_t >::getMinimum ( )
inlinestaticinherited

Get minimum possible value.

Returns
minimum possible value

Definition at line 485 of file JRange.hh.

486  {
487  return JMATH::JLimits<T>::min();
488  }
float min()
Definition: JLimits.hh:96
template<class T, class JComparator_t = std::less<T>>
static T JTOOLS::JRange< T, JComparator_t >::getMaximum ( )
inlinestaticinherited

Get maximum possible value.

Returns
maximum possible value

Definition at line 496 of file JRange.hh.

497  {
498  return JMATH::JLimits<T>::max();
499  }
Auxiliary class for minimum and maximum values for any class.
Definition: JLimits.hh:21
const key_type& JTOOLS::JPair< T , T >::getKey ( ) const
inlineinherited

Definition at line 123 of file JPair.hh.

123 { return this->first; }
const std::string& JUTM::JUTMGrid::getKey ( ) const
inlineinherited

Get key.

Returns
key

Definition at line 68 of file JUTMGrid.hh.

69  {
70  return key;
71  }
std::string key
Definition: JUTMGrid.hh:183
const mapped_type& JTOOLS::JPair< T , T >::getValue ( ) const
inlineinherited

Definition at line 124 of file JPair.hh.

124 { return this->second; }
mapped_type& JTOOLS::JPair< T , T >::getValue ( )
inlineinherited

Definition at line 126 of file JPair.hh.

126 { return this->second; }
const std::string& JUTM::JUTMGrid::getWGS ( ) const
inlineinherited

Get WGS.

Returns
WGS

Definition at line 79 of file JUTMGrid.hh.

80  {
81  return wgs;
82  }
std::string wgs
Definition: JUTMGrid.hh:184
const std::string& JUTM::JUTMGrid::getUTMZone ( ) const
inlineinherited

Get UTM zone.

Returns
UTM zone

Definition at line 90 of file JUTMGrid.hh.

91  {
92  return zone;
93  }
std::string zone
Definition: JUTMGrid.hh:185
std::string JUTM::JUTMGrid::toString ( ) const
inlineinherited

Convert UTM grid.

Returns
UTM grid

Definition at line 101 of file JUTMGrid.hh.

102  {
103  return (key + " " + wgs + " " + zone);
104  }
std::string key
Definition: JUTMGrid.hh:183
std::string zone
Definition: JUTMGrid.hh:185
std::string wgs
Definition: JUTMGrid.hh:184
static JUTMGrid JUTM::JUTMGrid::valueOf ( const std::string &  buffer)
inlinestaticinherited

Extract UTM grid.

Parameters
bufferWGS and UTM zone
Returns
UTM grid

Definition at line 113 of file JUTMGrid.hh.

114  {
115  JUTMGrid grid;
116 
117  std::istringstream is(buffer);
118 
119  if (is >> grid)
120  return grid;
121  else
122  throw JParseError("JUTMGrid::valueOf()");
123  }
Data structure for UTM grid.
Definition: JUTMGrid.hh:34
JPosition3D JUTM::JUTMPosition::getPosition ( ) const
inlineinherited

Get position.

Returns
position

Definition at line 76 of file JUTMPosition.hh.

77  {
78  return JPosition3D(east, north, z);
79  }
double JUTM::JUTMPosition::getUTMEast ( ) const
inlineinherited

Get UTM east.

Returns
UTM East

Definition at line 87 of file JUTMPosition.hh.

88  {
89  return this->east;
90  }
double JUTM::JUTMPosition::getUTMNorth ( ) const
inlineinherited

Get UTM north.

Returns
UTM North

Definition at line 98 of file JUTMPosition.hh.

99  {
100  return this->north;
101  }
double JUTM::JUTMPosition::getUTMZ ( ) const
inlineinherited

Get UTM Z.

Returns
UTM Z

Definition at line 109 of file JUTMPosition.hh.

110  {
111  return this->z;
112  }
template<class JClass_t, class JTypelist_t>
template<class JHead_t , class JTail_t >
static bool JLANG::JMultiEquals< JClass_t, JTypelist_t >::eq ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JTail_t > > &  type 
)
inlinestaticprotectedinherited

Equals method for composite data types.

Parameters
firstfirst object
secondsecond object
typetype
Returns
true if two objects are equal; else false

Definition at line 42 of file JMultiEquals.hh.

45  {
46  return (static_cast<const JHead_t&>(first) ==
47  static_cast<const JHead_t&>(second) &&
48  eq(first, second, JType<JTail_t>()));
49  }
Auxiliary class for a type holder.
Definition: JType.hh:19
static bool eq(const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
Equals method for composite data types.
Definition: JMultiEquals.hh:42
template<class JClass_t, class JTypelist_t>
template<class JHead_t >
static bool JLANG::JMultiEquals< JClass_t, JTypelist_t >::eq ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JNullType > > &  type 
)
inlinestaticprotectedinherited

Equals method for composite data types.

Parameters
firstfirst object
secondsecond object
typetype
Returns
true if two objects are equal; else false

Definition at line 61 of file JMultiEquals.hh.

64  {
65  return (static_cast<const JHead_t&>(first) ==
66  static_cast<const JHead_t&>(second));
67  }

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JDetector detector 
)
friend

Read detector from input.

Parameters
ininput stream
detectordetector
Returns
input stream

Definition at line 265 of file JDetector.hh.

266  {
267  using namespace std;
268 
269  detector.clear();
270 
271  string buffer;
272 
273  if (in
274  >> detector.comment
275  >> static_cast<JObjectID&>(detector)
276  >> buffer) {
277 
278  int n;
279  int version = -1;
280 
281  try {
282  version = getDetectorVersion(buffer);
283  }
284  catch(std::exception&) {}
285 
286  switch (version) {
287 
288  case V3:
289  case V2:
290  in >> static_cast<JDetectorHeader&>(detector);
291 
292  case V1:
293  in >> n;
294  detector.setVersion(buffer);
295  break;
296 
297  default:
298  detector.setVersion(putDetectorVersion(V1));
299  istringstream(buffer) >> n;
300  break;
301  }
302 
303  for (JModule module; n != 0 && in >> module; --n) {
304  detector.push_back(module);
305  }
306  }
307 
308  return in;
309  }
Data structure for a composite optical module.
Definition: JModule.hh:47
void setVersion(const JVersion &version)
Set version.
Definition: JDetector.hh:123
Data structure for detector header.
Version with UTC time and UTM position data.
Version with PMT status field and comments.
static const JGetDetectorVersion getDetectorVersion
Function object to map detector variant to detector version.
static const JPutDetectorVersion putDetectorVersion(getDetectorVersion)
Function object to map detector version to detector variant.
std::ostream& operator<< ( std::ostream &  out,
const JDetector detector 
)
friend

Write detector to output.

Parameters
outoutput stream
detectordetector
Returns
output stream

Definition at line 319 of file JDetector.hh.

320  {
321  using namespace std;
322 
323  const ios::fmtflags format = out.flags();
324  const streamsize precision = out.precision();
325 
326  out.setf(ios::fixed);
327  out.precision(1);
328 
329  out << detector.comment;
330  out << static_cast<const JObjectID&>(detector);
331 
332  switch (getDetectorVersion(detector.getVariant())) {
333 
334  case V3:
335  case V2:
336  out << " ";
337  out << static_cast<const JDetectorVersion&>(detector) << endl;
338  out << static_cast<const JDetectorHeader&> (detector) << endl;
339  break;
340 
341  default:
342  out << " ";
343  break;
344  }
345 
346  out << detector.size() << endl;
347 
348  out.precision(3);
349 
350  for (const_iterator i = detector.begin(); i != detector.end(); ++i) {
351  out << *i << endl;
352  }
353 
354  out.flags(format);
355  out.precision(precision);
356 
357  return out;
358  }
Version with UTC time and UTM position data.
const std::string & getVariant() const
Get variant.
Definition: JVersion.hh:90
Version with PMT status field and comments.
static const JGetDetectorVersion getDetectorVersion
Function object to map detector variant to detector version.

Member Data Documentation

JComment JDETECTOR::JDetector::comment

Definition at line 415 of file JDetector.hh.

int JLANG::JObjectID::__id
protectedinherited

Definition at line 159 of file JObjectID.hh.

std::string JEEP::JVersion::__variant
protectedinherited

Definition at line 171 of file JVersion.hh.

template<class T, class JComparator_t = std::less<T>>
const JRange< T, JComparator_t > JTOOLS::JRange< T, JComparator_t >::DEFAULT_RANGE
staticinherited

Default range.

This range corresponds to an unphysical range.

Definition at line 506 of file JRange.hh.

template<class T, class JComparator_t = std::less<T>>
JComparator_t JTOOLS::JRange< T, JComparator_t >::compare
inherited

Function object.

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

Definition at line 516 of file JRange.hh.

T JTOOLS::JPair< T , T >::first
inherited

Definition at line 128 of file JPair.hh.

T JTOOLS::JPair< T , T >::second
inherited

Definition at line 129 of file JPair.hh.

std::string JUTM::JUTMGrid::key
protectedinherited

Definition at line 183 of file JUTMGrid.hh.

std::string JUTM::JUTMGrid::wgs
protectedinherited

Definition at line 184 of file JUTMGrid.hh.

std::string JUTM::JUTMGrid::zone
protectedinherited

Definition at line 185 of file JUTMGrid.hh.

double JUTM::JUTMPosition::east
protectedinherited

Definition at line 169 of file JUTMPosition.hh.

double JUTM::JUTMPosition::north
protectedinherited

Definition at line 170 of file JUTMPosition.hh.

double JUTM::JUTMPosition::z
protectedinherited

Definition at line 171 of file JUTMPosition.hh.


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