Jpp  master_rocky-40-g5f0272dcd
the software that should make you happy
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Friends | List of all members
JDETECTOR::JMonteCarloDetector Class Reference

Monte Carlo detector (i.e. ".det" file). More...

#include <JMonteCarloDetector.hh>

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

Classes

class  LCM_logic
 Auxiliary class for LCM logic parameters. More...
 
class  LCM_reverse_logic
 Auxiliary class for LCM logic parameters. More...
 
class  OM
 Auxiliary class for OM. More...
 
class  OM_cluster
 Auxiliary class for OM cluster parameters. More...
 
class  OM_cluster_data
 Auxiliary class for OM cluster data. More...
 
class  OM_position
 Auxiliary class for OM position. More...
 
class  String
 Auxiliary class for string parameters. More...
 

Public Types

enum  start_of_comment_type { OLD_START_OF_COMMENT , NEW_START_OF_COMMENT }
 Enumeration for different lengths of start of comment in binary I/O. More...
 
enum  JVersion_t {
  V1 = 1 , V2 = 2 , V3 = 3 , V4 = 4 ,
  V5 = 5
}
 Enumeration of version types. More...
 
typedef std::pair< T, T > pair_type
 
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

 JMonteCarloDetector ()
 Default constructor. More...
 
 JMonteCarloDetector (const bool useLogic)
 Constructor. More...
 
void setUseLogic (const bool useLogic)
 Set usage of logic. More...
 
void setVersion (const JVersion &version)
 Set version. More...
 
bool setVersion (const JDetectorVersion::JVersion_t &version, const bool force=false)
 Set version. More...
 
void setVersion (const std::string &version)
 Set version. More...
 
bool setToLatestVersion ()
 Set to latest version. More...
 
void setModuleStatus (const int bit)
 Set status of all modules. More...
 
void resetModuleStatus (const int bit)
 Reset status of all modules. More...
 
void setPMTStatus (const int bit)
 Set status of all PMTs. More...
 
void resetPMTStatus (const int bit)
 Reset status of all PMTs. 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 JLocation &location) const
 Get module parameters. More...
 
JModulegetModule (const JLocation &location)
 Get module parameters. More...
 
bool hasModule (const JLocation &location) const
 Check availability of 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) override
 Read from input. More...
 
virtual JWriterwrite (JWriter &out) const override
 Write to output. More...
 
int getID () const
 Get identifier. More...
 
int & getID ()
 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 less (const JVersion &version) const
 Less-than method. More...
 
bool more (const int id) const
 More than method. More...
 
bool hasVersion () const
 Check validity of version. More...
 
const std::string & getVersion () const
 Get version. More...
 
const JDetectorHeadergetDetectorHeader () const
 Get detector header. More...
 
bool equals (const JDetectorHeader &header, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
bool equals (const range_type &range) const
 Equal method. More...
 
bool equals (const JUTMGrid &grid) const
 Check equality. 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 JUTCTimeRangegetUTCTimeRange () const
 Get UTC time range. More...
 
JUTCTimeRangegetUTCTimeRange ()
 Get UTC time range. More...
 
void setUTCTimeRange (const JRange< double > &timerange)
 Set UTC time range. 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...
 
template<class R >
void setRange (R first, R second)
 Set range. More...
 
template<class JElement_t , class JAllocator_t >
void setRange (const array_type< JElement_t, JAllocator_t > &buffer)
 Set lower and upper limit according to input data. 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...
 
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 is_valid () const
 Check validity of range. More...
 
bool in_range (argument_type x) const
 Test whether value is inside 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...
 
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_typeinclude (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...
 
JUTMPositionadd (const JUTMPosition &pos)
 Add UTM position. More...
 
range_typesub (argument_type x)
 Subtract offset. More...
 
range_typesub (const range_type &range)
 Subtract offsets. More...
 
JUTMPositionsub (const JUTMPosition &pos)
 Subtract UTM position. More...
 
range_typemul (const double factor)
 Multiply range. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JUTMPositionmul (const double factor)
 Scale UTM position. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
range_typediv (const double factor)
 Divide range. More...
 
JUTMPositiondiv (const double factor)
 Scale UTM position. More...
 
const key_typegetKey () const
 
const std::string & getKey () const
 Get key. More...
 
const mapped_typegetValue () const
 
mapped_typegetValue ()
 
const JUTMGridgetUTMGrid () const
 Get UTM grid. More...
 
void setUTMGrid (const JUTMGrid &grid)
 Set UTM grid. More...
 
const std::string & getWGS () const
 Get WGS. More...
 
const std::string & getUTMZone () const
 Get UTM zone. More...
 
int getUTMValue () const
 Get UTM zone by numerical value. More...
 
std::string toString () const
 Convert UTM grid. More...
 
const JUTMPositiongetUTMPosition () const
 Get UTM position. More...
 
void setUTMPosition (const JUTMPosition &position)
 Set UTM position. More...
 
JPosition3D getPosition () const
 Get position. More...
 
 operator JPosition3D () const
 Type conversion operator. More...
 
double getUTMEast () const
 Get UTM east. More...
 
double getUTMNorth () const
 Get UTM north. More...
 
double getUTMZ () const
 Get UTM Z. More...
 
double getX () const
 Get x. More...
 
double getY () const
 Get y. More...
 
double getZ () const
 Get z. More...
 
JUTMPositionnegate ()
 Negate UTM position. More...
 
double getDisplacement (const JUTMPosition &position) const
 Get displacement to position. More...
 

Static Public Member Functions

static start_of_comment_type getStartOfComment ()
 Get option for short start of comment in binary I/O. More...
 
static void setStartOfComment (const start_of_comment_type option)
 Set option for short start of comment in binary I/O. More...
 
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 JRange< T, JComparator_t > DEFAULT_RANGE ()
 Default range. More...
 
static JUTMGrid valueOf (const std::string &buffer)
 Extract UTM grid. More...
 

Public Attributes

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

Protected Member Functions

JDetectorput (const int moduleID, const int pmtAddress, const JLocation &location, const JPMT &pmt)
 Set PMT. More...
 
void setVersion () const
 Set version. More...
 
template<class R >
void setRange (R first, R second, const JLANG::JBool< false > &option)
 Set range. More...
 
template<class R >
void setRange (R first, R second, const JLANG::JBool< true > &option)
 Set range. More...
 

Static Protected Member Functions

template<class T >
static T find (T __begin, T __end, const int id)
 Binary search method. More...
 
static bool compare (const JModule &first, const JModule &second)
 Module comparator. More...
 
static start_of_comment_typeget_start_of_comment ()
 Get option for short start of comment in binary I/O. More...
 

Protected Attributes

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

Static Protected Attributes

static const size_t LENGTH_START_OF_COMMENT = sizeof(JDetectorID)
 Length of start of comment in binary I/O. More...
 

Private Attributes

bool use_logic
 

Friends

std::istream & operator>> (std::istream &in, JMonteCarloDetector &detector)
 Read detector from input. More...
 

Detailed Description

Monte Carlo detector (i.e. ".det" file).

Definition at line 43 of file JMonteCarloDetector.hh.

Member Typedef Documentation

◆ pair_type

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

Definition at line 45 of file JRange.hh.

◆ range_type

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

◆ argument_type

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

◆ key_type

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

Definition at line 32 of file JPair.hh.

◆ mapped_type

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

Definition at line 33 of file JPair.hh.

Member Enumeration Documentation

◆ start_of_comment_type

Enumeration for different lengths of start of comment in binary I/O.

Enumerator
OLD_START_OF_COMMENT 
NEW_START_OF_COMMENT 

Definition at line 567 of file JDetector.hh.

◆ JVersion_t

Enumeration of version types.


Note that 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.

V4 

Version with quaternion and time offset per module.

V5 

Version with module status field.

Definition at line 48 of file JDetectorVersion.hh.

48  {
49  V1 = 1, //!< First version
50  V2 = 2, //!< Version with UTC time and UTM position data
51  V3 = 3, //!< Version with PMT status field and comments
52  V4 = 4, //!< Version with quaternion and time offset per module
53  V5 = 5 //!< Version with module status field
54  };
@ V2
Version with UTC time and UTM position data.
@ V5
Version with module status field.
@ V4
Version with quaternion and time offset per module.
@ V3
Version with PMT status field and comments.

Constructor & Destructor Documentation

◆ JMonteCarloDetector() [1/2]

JDETECTOR::JMonteCarloDetector::JMonteCarloDetector ( )
inline

Default constructor.

Definition at line 256 of file JMonteCarloDetector.hh.

256  :
257  JDetector(),
258  use_logic(false)
259  {}
JDetector()
Default constructor.
Definition: JDetector.hh:101

◆ JMonteCarloDetector() [2/2]

JDETECTOR::JMonteCarloDetector::JMonteCarloDetector ( const bool  useLogic)
inline

Constructor.

Parameters
useLogicapply logic data in file

Definition at line 267 of file JMonteCarloDetector.hh.

267  :
268  JDetector(),
269  use_logic(useLogic)
270  {}

Member Function Documentation

◆ setUseLogic()

void JDETECTOR::JMonteCarloDetector::setUseLogic ( const bool  useLogic)
inline

Set usage of logic.

Parameters
useLogicapply logic data in file

Definition at line 527 of file JMonteCarloDetector.hh.

528  {
529  use_logic = useLogic;
530  }

◆ put()

JDetector& JDETECTOR::JMonteCarloDetector::put ( const int  moduleID,
const int  pmtAddress,
const JLocation location,
const JPMT pmt 
)
inlineprotected

Set PMT.

Parameters
moduleIDmodule identifier
pmtAddressPMT address
locationmodule location
pmtJPMT
Returns
this JDetector

Definition at line 543 of file JMonteCarloDetector.hh.

547  {
548  JDetector::iterator p = std::lower_bound(this->begin(), this->end(), moduleID);
549 
550  if (p == this->end() || p->getID() != moduleID) {
551 
552  JModule module(moduleID, location);
553 
554  module.resize(pmtAddress + 1);
555 
556  module[pmtAddress] = pmt;
557 
558  module.setPosition(pmt.getPosition());
559 
560  this->insert(p, module);
561 
562  } else {
563 
564  // average position
565 
566  int n = 0;
567 
568  for (JModule::const_iterator i = p->begin(); i != p->end(); ++i) {
569  if (i->getID() != getUndefinedObjectID().getID()) {
570  ++n;
571  }
572  }
573 
574  if (pmtAddress + 1 > (int) p->size()) {
575  p->resize(pmtAddress + 1);
576  }
577 
578  JPosition3D& P = static_cast<JPosition3D&>(*p);
579 
580  P.mul(n);
581 
582  if (p->at(pmtAddress).getID() != getUndefinedObjectID().getID())
583  P.sub(p->at(pmtAddress).getPosition());
584  else
585  ++n;
586 
587  P.add(pmt.getPosition());
588  P.div(n);
589 
590  p->at(pmtAddress) = pmt;
591  }
592 
593  return *this;
594  }
Data structure for a composite optical module.
Definition: JModule.hh:75
void setPosition(const JVector3D &pos)
Set position.
Definition: JPosition3D.hh:152
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
int getID() const
Get identifier.
Definition: JObjectID.hh:50
const JObjectID & getUndefinedObjectID()
Get undefined object identifier.
Definition: JObjectID.hh:149
const int n
Definition: JPolint.hh:786

◆ find()

template<class T >
static T JDETECTOR::JMonteCarloDetector::find ( __begin,
__end,
const int  id 
)
inlinestaticprotected

Binary search method.

Parameters
__beginbegin of data
__endend of data
idtarget value
Returns
pointer to corresponding element

Definition at line 606 of file JMonteCarloDetector.hh.

607  {
608  T i = std::lower_bound(__begin, __end, id);
609 
610  if (i != __end && *i != id)
611  return __end;
612  else
613  return i;
614  }

◆ compare()

static bool JDETECTOR::JMonteCarloDetector::compare ( const JModule first,
const JModule second 
)
inlinestaticprotected

Module comparator.


The comparison is based on:

  1. string identifier;
  2. z-position.
Parameters
firstfirst module
secondsecond module
Returns
true if first module before second; else false

Definition at line 627 of file JMonteCarloDetector.hh.

628  {
629  if (first.getString() == second.getString())
630  return first.getZ() < second.getZ();
631  else
632  return first.getString() < second.getString();
633  }

◆ setVersion() [1/4]

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

Set version.

Parameters
versionversion

Definition at line 135 of file JDetector.hh.

136  {
137  static_cast<JDetectorVersion&>(*this).setVersion(version.getVersion());
138 
139  setVersion();
140  }
void setVersion() const
Set version.
Definition: JDetector.hh:600
void setVersion(const std::string &version)
Set version.

◆ setVersion() [2/4]

bool JDETECTOR::JDetector::setVersion ( const JDetectorVersion::JVersion_t version,
const bool  force = false 
)
inlineinherited

Set version.

Note that the version is only set to a higher version or when forced to set it.

Parameters
versionversion
forceforce setting of version
Returns
true if set; else false

Definition at line 152 of file JDetector.hh.

153  {
154  if (this->getVersion() == JDetectorVersion() || version > getDetectorVersion(this->getVersion()) || force) {
155 
157 
158  return true;
159  }
160 
161  return false;
162  }
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
static const JPutDetectorVersion putDetectorVersion(getDetectorVersion)
Function object to map numerical value to detector version.
JDetectorVersion()
Default constructor.
const std::string & getVersion() const
Get version.

◆ setVersion() [3/4]

void JDETECTOR::JDetector::setVersion ( ) const
inlineprotectedinherited

Set version.

This method should be called to set up the handling of detector version specific module and PMT I/O.

Definition at line 600 of file JDetector.hh.

601  {
603  JPMT ::setVersion(this->getVersion());
604  }
static void setVersion(const JVersion &version)
Set detector version.
Definition: JModule.hh:130
static void setVersion(const JVersion &version)
Set detector version.
Definition: JPMT.hh:114

◆ setVersion() [4/4]

void JDETECTOR::JVersion::setVersion ( const std::string &  version)
inlineinherited

Set version.

Parameters
versionversion

Definition at line 61 of file JDetector/JVersion.hh.

62  {
63  this->version = version;
64  }

◆ setToLatestVersion()

bool JDETECTOR::JDetector::setToLatestVersion ( )
inlineinherited

Set to latest version.

Returns
true if set; else false

Definition at line 170 of file JDetector.hh.

171  {
172  return setVersion(getLatestDetectorVersion<JDetectorVersion::JVersion_t>());
173  }

◆ setModuleStatus()

void JDETECTOR::JDetector::setModuleStatus ( const int  bit)
inlineinherited

Set status of all modules.

Parameters
bitbit

Definition at line 181 of file JDetector.hh.

182  {
183  for (iterator module = this->begin(); module != this->end(); ++module) {
184  module->getStatus().set(bit);
185  }
186  }

◆ resetModuleStatus()

void JDETECTOR::JDetector::resetModuleStatus ( const int  bit)
inlineinherited

Reset status of all modules.

Parameters
bitbit

Definition at line 194 of file JDetector.hh.

195  {
196  for (iterator module = this->begin(); module != this->end(); ++module) {
197  module->getStatus().reset(bit);
198  }
199  }

◆ setPMTStatus()

void JDETECTOR::JDetector::setPMTStatus ( const int  bit)
inlineinherited

Set status of all PMTs.

Parameters
bitbit

Definition at line 207 of file JDetector.hh.

208  {
209  for (iterator module = this->begin(); module != this->end(); ++module) {
210  for (JModule::iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
211  pmt->getStatus().set(bit);
212  }
213  }
214  }

◆ resetPMTStatus()

void JDETECTOR::JDetector::resetPMTStatus ( const int  bit)
inlineinherited

Reset status of all PMTs.

Parameters
bitbit

Definition at line 222 of file JDetector.hh.

223  {
224  for (iterator module = this->begin(); module != this->end(); ++module) {
225  for (JModule::iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
226  pmt->getStatus().reset(bit);
227  }
228  }
229  }

◆ operator+=()

JDetector& JDETECTOR::JDetector::operator+= ( const JVector3D pos)
inlineinherited

Move detector elements.

Parameters
posoffset position
Returns
this JDetector

Definition at line 238 of file JDetector.hh.

239  {
240  for (iterator i = begin(); i != end(); ++i) {
241  i->add(pos);
242  }
243 
244  return *this;
245  }

◆ operator-=()

JDetector& JDETECTOR::JDetector::operator-= ( const JVector3D pos)
inlineinherited

Move detector elements.

Parameters
posoffset position
Returns
this JDetector

Definition at line 254 of file JDetector.hh.

255  {
256  for (iterator i = begin(); i != end(); ++i) {
257  i->sub(pos);
258  }
259 
260  return *this;
261  }

◆ getModule() [1/4]

const JModule& JDETECTOR::JDetector::getModule ( const JModuleAddress address) const
inlineinherited

Get module parameters.

Parameters
addressmodule address
Returns
module parameters

Definition at line 270 of file JDetector.hh.

271  {
272  return at(address.first);
273  }
int first
index of module in detector data structure

◆ getModule() [2/4]

JModule& JDETECTOR::JDetector::getModule ( const JModuleAddress address)
inlineinherited

Get module parameters.

Parameters
addressmodule address
Returns
module parameters

Definition at line 282 of file JDetector.hh.

283  {
284  return at(address.first);
285  }

◆ getModule() [3/4]

const JModule& JDETECTOR::JDetector::getModule ( const JLocation location) const
inlineinherited

Get module parameters.

Parameters
locationmodule location
Returns
module parameters

Definition at line 312 of file JDetector.hh.

313  {
314  for (JDetector::const_iterator module = this->begin(); module != this->end(); ++module) {
315  if (module->getLocation() == location) {
316  return *module;
317  }
318  }
319 
320  THROW(JIndexOutOfRange, "Invalid location " << location);
321  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for accessing an index in a collection that is outside of its range.
Definition: JException.hh:108

◆ getModule() [4/4]

JModule& JDETECTOR::JDetector::getModule ( const JLocation location)
inlineinherited

Get module parameters.

Parameters
locationmodule location
Returns
module parameters

Definition at line 330 of file JDetector.hh.

331  {
332  for (JDetector::iterator module = this->begin(); module != this->end(); ++module) {
333  if (module->getLocation() == location) {
334  return *module;
335  }
336  }
337 
338  THROW(JIndexOutOfRange, "Invalid location " << location);
339  }

◆ hasModule()

bool JDETECTOR::JDetector::hasModule ( const JLocation location) const
inlineinherited

Check availability of module parameters.

Parameters
locationmodule location
Returns
true if available; else false

Definition at line 294 of file JDetector.hh.

295  {
296  for (JDetector::const_iterator module = this->begin(); module != this->end(); ++module) {
297  if (module->getLocation() == location) {
298  return true;
299  }
300  }
301 
302  return false;
303  }

◆ getPMT() [1/2]

const JPMT& JDETECTOR::JDetector::getPMT ( const JPMTAddress address) const
inlineinherited

Get PMT parameters.

Parameters
addressJPMTAddress
Returns
JPMT

Definition at line 348 of file JDetector.hh.

349  {
350  return at(address.first).at(address.second);
351  }
int second
index of PMT in module data structure.
Definition: JPMTAddress.hh:100

◆ getPMT() [2/2]

JPMT& JDETECTOR::JDetector::getPMT ( const JPMTAddress address)
inlineinherited

Get PMT parameters.

Parameters
addressJPMTAddress
Returns
JPMT

Definition at line 360 of file JDetector.hh.

361  {
362  return at(address.first).at(address.second);
363  }

◆ read()

virtual JReader& JDETECTOR::JDetector::read ( JReader in)
inlineoverridevirtualinherited

Read from input.

Parameters
inreader
Returns
reader

Implements JIO::JSerialisable.

Definition at line 473 of file JDetector.hh.

474  {
475  using namespace std;
476  using namespace JPP;
477 
478  this->clear();
479 
481 
482  char prefix[sizeof(JDetectorID)];
483 
484  for (string buffer; in.read(prefix, N) == N && count(prefix, prefix + N, JComment::START_COMMENT) == N; ) {
485 
486  in >> buffer;
487 
488  this->comment.add(buffer);
489  }
490 
491  if (this->comment.empty()) {
492  THROW(JIOException, "Missing comments");
493  }
494 
495  in.read(&prefix[N], sizeof(JDetectorID) - N);
496 
497  JByteArrayReader is(prefix, N);
498 
499  int number_of_modules;
500 
501  is >> static_cast<JDetectorID&> (*this);
502  in >> static_cast<JDetectorVersion&>(*this);
503  in >> static_cast<JDetectorHeader&> (*this);
504  in >> number_of_modules;
505 
506  this->setVersion();
507  this->resize(number_of_modules);
508 
509  for (JDetector::iterator out = this->begin(); number_of_modules != 0; --number_of_modules, ++out) {
510  in >> *out;
511  }
512 
513  return in;
514  }
Data structure for detector header.
static const size_t LENGTH_START_OF_COMMENT
Length of start of comment in binary I/O.
Definition: JDetector.hh:623
static start_of_comment_type getStartOfComment()
Get option for short start of comment in binary I/O.
Definition: JDetector.hh:578
Byte array binary input.
Definition: JByteArrayIO.hh:27
virtual int read(char *buffer, const int length)=0
Read byte array.
Exception for I/O.
Definition: JException.hh:342
Auxiliary class for object identification.
Definition: JObjectID.hh:25
JLANG::JObjectID JDetectorID
Type definition of detector identifier.
Definition: JDetectorID.hh:19
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
static constexpr char START_COMMENT
start comment
Definition: JComment.hh:48
JComment & add(const std::string &comment)
Add comment.
Definition: JComment.hh:100

◆ write()

virtual JWriter& JDETECTOR::JDetector::write ( JWriter out) const
inlineoverridevirtualinherited

Write to output.

Parameters
outwriter
Returns
writer

Implements JIO::JSerialisable.

Definition at line 523 of file JDetector.hh.

524  {
525  using namespace std;
526  using namespace JPP;
527 
528  if (getDetectorVersion(this->getVersion()) < V3 || this->comment.empty()) {
529  THROW(JIOException, "Version " << getDetectorVersion(this->getVersion()) << " < " << V3 << " or missing comments.");
530  }
531 
532  this->setVersion();
533 
534  if (getDetectorVersion(this->getVersion()) >= V3) {
535 
536  for (JComment::const_iterator i = this->comment.begin(); i != this->comment.end(); ++i) {
537 
538  for (size_t i = 0; i != LENGTH_START_OF_COMMENT; ++i) {
540  }
541 
542  out << *i;
543  }
544  }
545 
546  const int number_of_modules = this->size();
547 
548  out << static_cast<const JDetectorID&> (*this);
549  out << static_cast<const JDetectorVersion&>(*this);
550  out << static_cast<const JDetectorHeader&> (*this);
551  out << number_of_modules;
552 
553  for (const_iterator module = this->begin(); module != this->end(); ++module) {
554  out << *module;
555  }
556 
557  return out;
558  }

◆ getStartOfComment()

static start_of_comment_type JDETECTOR::JDetector::getStartOfComment ( )
inlinestaticinherited

Get option for short start of comment in binary I/O.

Returns
option

Definition at line 578 of file JDetector.hh.

579  {
580  return get_start_of_comment();
581  }
static start_of_comment_type & get_start_of_comment()
Get option for short start of comment in binary I/O.
Definition: JDetector.hh:612

◆ setStartOfComment()

static void JDETECTOR::JDetector::setStartOfComment ( const start_of_comment_type  option)
inlinestaticinherited

Set option for short start of comment in binary I/O.

Parameters
optionoption

Definition at line 589 of file JDetector.hh.

590  {
591  get_start_of_comment() = option;
592  }

◆ get_start_of_comment()

static start_of_comment_type& JDETECTOR::JDetector::get_start_of_comment ( )
inlinestaticprotectedinherited

Get option for short start of comment in binary I/O.

Returns
option

Definition at line 612 of file JDetector.hh.

613  {
614  static start_of_comment_type start_of_comment = NEW_START_OF_COMMENT;
615 
616  return start_of_comment;
617  }
start_of_comment_type
Enumeration for different lengths of start of comment in binary I/O.
Definition: JDetector.hh:567

◆ getID() [1/2]

int JLANG::JObjectID::getID ( ) const
inlineinherited

Get identifier.

Returns
identifier

Definition at line 50 of file JObjectID.hh.

51  {
52  return __id;
53  }

◆ getID() [2/2]

int& JLANG::JObjectID::getID ( )
inlineinherited

Get identifier.

Returns
identifier

Definition at line 61 of file JObjectID.hh.

62  {
63  return __id;
64  }

◆ setID()

void JLANG::JObjectID::setID ( const int  id)
inlineinherited

Set identifier.

Parameters
ididentifier

Definition at line 72 of file JObjectID.hh.

73  {
74  this->__id = id;
75  }

◆ less() [1/3]

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 84 of file JObjectID.hh.

85  {
86  return this->getID() < object.getID();
87  }

◆ less() [2/3]

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 96 of file JObjectID.hh.

97  {
98  return this->getID() < id;
99  }

◆ less() [3/3]

bool JDETECTOR::JVersion::less ( const JVersion version) const
inlineinherited

Less-than method.

Parameters
versionversion
Returns
true if this version less than given version; else false

Definition at line 73 of file JDetector/JVersion.hh.

74  {
75  return this->getVersion() < version.getVersion();
76  }

◆ more()

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 108 of file JObjectID.hh.

109  {
110  return this->getID() > id;
111  }

◆ hasVersion()

bool JDETECTOR::JDetectorVersion::hasVersion ( ) const
inlineinherited

Check validity of version.

Returns
true if valid; else false

Definition at line 80 of file JDetectorVersion.hh.

81  {
82  return (!this->version.empty() && (this->version[0] == 'v' || this->version[0] == 'V'));
83  }

◆ getVersion()

const std::string& JDETECTOR::JVersion::getVersion ( ) const
inlineinherited

Get version.

Returns
version

Definition at line 50 of file JDetector/JVersion.hh.

51  {
52  return this->version;
53  }

◆ getDetectorHeader()

const JDetectorHeader& JDETECTOR::JDetectorHeader::getDetectorHeader ( ) const
inlineinherited

Get detector header.

Returns
header

Definition at line 76 of file JDetectorHeader.hh.

77  {
78  return static_cast<const JDetectorHeader&>(*this);
79  }

◆ equals() [1/3]

bool JDETECTOR::JDetectorHeader::equals ( const JDetectorHeader header,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check equality.

Parameters
headerheader
precisionprecision
Returns
true if headers are equal; else false

Definition at line 89 of file JDetectorHeader.hh.

91  {
92  return (this->getUTMGrid() == header.getUTMGrid() && this->getDisplacement(header.getUTMPosition()) < precision);
93  }
const JUTMGrid & getUTMGrid() const
Get UTM grid.
Definition: JUTMGrid.hh:73
const JUTMPosition & getUTMPosition() const
Get UTM position.
Definition: JUTMPosition.hh:84

◆ equals() [2/3]

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 range is equal to given 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  }
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:202
JComparator_t compare
Function object for comparisons.
Definition: JRange.hh:565

◆ equals() [3/3]

bool JUTM::JUTMGrid::equals ( const JUTMGrid grid) const
inlineinherited

Check equality.

Parameters
gridUTM grid
Returns
true if grids are equal; else false

Definition at line 151 of file JUTMGrid.hh.

152  {
153  return (this->getKey() == grid.getKey() &&
154  this->getWGS() == grid.getWGS() &&
155  this->getUTMValue() == grid.getUTMValue());
156  }
int getUTMValue() const
Get UTM zone by numerical value.
Definition: JUTMGrid.hh:128
const std::string & getKey() const
Get key.
Definition: JUTMGrid.hh:95
const std::string & getWGS() const
Get WGS.
Definition: JUTMGrid.hh:106

◆ getEquationParameters()

static JEquationParameters& JDETECTOR::JDetectorHeader::getEquationParameters ( )
inlinestaticinherited

Get equation parameters.

Returns
equation parameters

Definition at line 173 of file JDetectorHeader.hh.

174  {
175  static JEquationParameters equation;
176 
177  return equation;
178  }
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ setEquationParameters()

static void JDETECTOR::JDetectorHeader::setEquationParameters ( const JEquationParameters equation)
inlinestaticinherited

Set equation parameters.

Parameters
equationequation parameters

Definition at line 187 of file JDetectorHeader.hh.

188  {
189  getEquationParameters() = equation;
190  }
static JEquationParameters & getEquationParameters()
Get equation parameters.

◆ getProperties() [1/2]

JProperties JDETECTOR::JDetectorHeader::getProperties ( const JEquationParameters equation = JDetectorHeader::getEquationParameters())
inlineinherited

Get properties of this class.

Parameters
equationequation parameters

Definition at line 198 of file JDetectorHeader.hh.

199  {
200  return JDetectorHeaderHelper(*this, equation);
201  }

◆ getProperties() [2/2]

JProperties JDETECTOR::JDetectorHeader::getProperties ( const JEquationParameters equation = JDetectorHeader::getEquationParameters()) const
inlineinherited

Get properties of this class.

Parameters
equationequation parameters

Definition at line 209 of file JDetectorHeader.hh.

210  {
211  return JDetectorHeaderHelper(*this, equation);
212  }

◆ getUTCTimeRange() [1/2]

const JUTCTimeRange& JUTC::JUTCTimeRange::getUTCTimeRange ( ) const
inlineinherited

Get UTC time range.

Returns
UTC time range

Definition at line 63 of file JUTCTimeRange.hh.

64  {
65  return static_cast<const JUTCTimeRange&>(*this);
66  }
UTC time range [s].

◆ getUTCTimeRange() [2/2]

JUTCTimeRange& JUTC::JUTCTimeRange::getUTCTimeRange ( )
inlineinherited

Get UTC time range.

Returns
UTC time range

Definition at line 74 of file JUTCTimeRange.hh.

75  {
76  return static_cast<JUTCTimeRange&>(*this);
77  }

◆ setUTCTimeRange()

void JUTC::JUTCTimeRange::setUTCTimeRange ( const JRange< double > &  timerange)
inlineinherited

Set UTC time range.

Parameters
timerangeUTC time range

Definition at line 85 of file JUTCTimeRange.hh.

86  {
87  static_cast<JUTCTimeRange&>(*this) = timerange;
88  }

◆ operator pair_type()

template<class T , class JComparator_t = std::less<T>>
JTOOLS::JRange< T, JComparator_t >::operator pair_type ( ) const
inlineinherited

Type conversion operator.

Returns
piar

Definition at line 124 of file JRange.hh.

125  {
127  }
std::pair< T, T > pair_type
Definition: JRange.hh:45
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:213

◆ getRange()

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

136  {
137  return static_cast<const range_type&>(*this);
138  }
JRange< T, JComparator_t > range_type
Definition: JRange.hh:46

◆ setRange() [1/6]

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

147  {
148  static_cast<range_type&>(*this) = range;
149  }

◆ setRange() [2/6]

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 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  }

◆ setRange() [3/6]

template<class T , class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( first,
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  }
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:146
Auxiliary classes and methods for language specific functionality.
Auxiliary template class for type bool.
Definition: JBool.hh:21
Data structure to check whether given data type is an iterator.
Definition: JClass.hh:62

◆ setRange() [4/6]

template<class T , class JComparator_t = std::less<T>>
template<class JElement_t , class JAllocator_t >
void JTOOLS::JRange< T, JComparator_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:397
static T getMaximum()
Get maximum possible value.
Definition: JRange.hh:545
static T getMinimum()
Get minimum possible value.
Definition: JRange.hh:534
Auxiliary data structure for return type of make methods.
Definition: JVectorize.hh:28

◆ setRange() [5/6]

template<class T , class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( first,
second,
const JLANG::JBool< false > &  option 
)
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optionfalse

Definition at line 576 of file JRange.hh.

577  {
579  }
JLANG::JClass< T >::argument_type argument_type
Definition: JRange.hh:47

◆ setRange() [6/6]

template<class T , class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( first,
second,
const JLANG::JBool< true > &  option 
)
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optiontrue

Definition at line 590 of file JRange.hh.

591  {
593 
594  for (R i = first; i != second; ++i) {
595  include(*i);
596  }
597  }

◆ getLowerLimit()

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

203  {
204  return this->first;
205  }

◆ getUpperLimit()

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

214  {
215  return this->second;
216  }

◆ setLowerLimit()

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

225  {
226  this->first = x;
227  }

◆ setUpperLimit()

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

236  {
237  this->second = y;
238  }

◆ fixLowerLimit()

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

249  {
250  this->second += x - this->first;
251  this->first = x;
252  }

◆ fixUpperLimit()

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

263  {
264  this->first += y - this->second;
265  this->second = y;
266  }

◆ getLength()

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

290  {
291  return getUpperLimit() - getLowerLimit();
292  }

◆ setLength()

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_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  }
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:235

◆ is_valid()

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

312  {
313  return !compare(getUpperLimit(), getLowerLimit());
314  }

◆ in_range()

template<class T , class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::in_range ( 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  }

◆ operator()()

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

337  {
338  return in_range(x);
339  }
bool in_range(argument_type x) const
Test whether value is inside range.
Definition: JRange.hh:323

◆ constrain()

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

351  {
352  if (compare(x, getLowerLimit())) { return getLowerLimit(); }
353  if (compare(getUpperLimit(), x)) { return getUpperLimit(); }
354 
355  return x;
356  }

◆ mod()

template<class T , class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::mod ( argument_type  x) const
inlineinherited

Modulo value with respect to range.


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

Definition at line 365 of file JRange.hh.

366  {
367  if (compare(x, getLowerLimit()))
368  return x + getLength() * floor((getUpperLimit() - x) / getLength());
369  else if (compare(getUpperLimit(), x))
370  return x - getLength() * floor((x - getLowerLimit()) / getLength());
371  else
372  return x;
373  }
T getLength() const
Get length (difference between upper and lower limit).
Definition: JRange.hh:289

◆ overlap()

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.


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

Definition at line 382 of file JRange.hh.

383  {
384  return (!compare(range.getUpperLimit(), getLowerLimit()) &&
385  !compare(getUpperLimit(), range.getLowerLimit()));
386  }

◆ include()

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

398  {
399  if (compare(x, getLowerLimit())) { setLowerLimit(x); }
400  if (compare(getUpperLimit(), x)) { setUpperLimit(x); }
401 
402  return *this;
403  }
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:224

◆ join()

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

416  {
417  if (compare(getLowerLimit(), range.getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
418  if (compare(range.getUpperLimit(), getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
419 
420  return *this;
421  }

◆ combine()

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

433  {
434  if (compare(range.getLowerLimit(), getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
435  if (compare(getUpperLimit(), range.getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
436 
437  return *this;
438  }

◆ add() [1/3]

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

447  {
448  this->first += x;
449  this->second += x;
450 
451  return *this;
452  }

◆ add() [2/3]

template<class T , class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_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 476 of file JRange.hh.

477  {
478  this->first += range.getLowerLimit();
479  this->second += range.getUpperLimit();
480 
481  return *this;
482  }

◆ add() [3/3]

JUTMPosition& JUTM::JUTMPosition::add ( const JUTMPosition pos)
inlineinherited

Add UTM position.

Parameters
posUTM position
Returns
this UTM position

Definition at line 210 of file JUTMPosition.hh.

211  {
212  east += pos.getUTMEast();
213  north += pos.getUTMNorth();
214  z += pos.getUTMZ();
215 
216  return *this;
217  }
double getUTMNorth() const
Get UTM north.
double getUTMEast() const
Get UTM east.
double getUTMZ() const
Get UTM Z.

◆ sub() [1/3]

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

461  {
462  this->first -= x;
463  this->second -= x;
464 
465  return *this;
466  }

◆ sub() [2/3]

template<class T , class JComparator_t = std::less<T>>
range_type& JTOOLS::JRange< T, JComparator_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 492 of file JRange.hh.

493  {
494  this->first -= range.getLowerLimit();
495  this->second -= range.getUpperLimit();
496 
497  return *this;
498  }

◆ sub() [3/3]

JUTMPosition& JUTM::JUTMPosition::sub ( const JUTMPosition pos)
inlineinherited

Subtract UTM position.

Parameters
posUTM position
Returns
this UTM position

Definition at line 226 of file JUTMPosition.hh.

227  {
228  east -= pos.getUTMEast();
229  north -= pos.getUTMNorth();
230  z -= pos.getUTMZ();
231 
232  return *this;
233  }

◆ mul() [1/4]

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

507  {
508  this->first *= factor;
509  this->second *= factor;
510 
511  return *this;
512  }

◆ mul() [2/4]

template<class JFirst_t , class JSecond_t >
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  }

◆ mul() [3/4]

JUTMPosition& JUTM::JUTMPosition::mul ( const double  factor)
inlineinherited

Scale UTM position.

Parameters
factormultiplication factor
Returns
this UTM position

Definition at line 242 of file JUTMPosition.hh.

243  {
244  east *= factor;
245  north *= factor;
246  z *= factor;
247 
248  return *this;
249  }

◆ mul() [4/4]

template<class JFirst_t , class JSecond_t >
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  }

◆ div() [1/2]

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

521  {
522  this->first /= factor;
523  this->second /= factor;
524 
525  return *this;
526  }

◆ div() [2/2]

JUTMPosition& JUTM::JUTMPosition::div ( const double  factor)
inlineinherited

Scale UTM position.

Parameters
factordivision factor
Returns
this UTM position

Definition at line 258 of file JUTMPosition.hh.

259  {
260  east /= factor;
261  north /= factor;
262  z /= factor;
263 
264  return *this;
265  }

◆ getMinimum()

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

535  {
536  return JMATH::JLimits<T>::min();
537  }
float min()
Get minimum possible value.
Definition: JLimits.hh:96

◆ getMaximum()

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

546  {
547  return JMATH::JLimits<T>::max();
548  }
TTimeStamp max()
Get maximum possible value.

◆ DEFAULT_RANGE()

template<class T , class JComparator_t = std::less<T>>
static JRange<T, JComparator_t> JTOOLS::JRange< T, JComparator_t >::DEFAULT_RANGE ( )
inlinestaticinherited

Default range.

This range corresponds to an unphysical range.

Definition at line 555 of file JRange.hh.

◆ getKey() [1/2]

const key_type& JTOOLS::JPair< T , T >::getKey ( ) const
inlineinherited

Definition at line 123 of file JPair.hh.

123 { return this->first; }

◆ getKey() [2/2]

const std::string& JUTM::JUTMGrid::getKey ( ) const
inlineinherited

Get key.

Returns
key

Definition at line 95 of file JUTMGrid.hh.

96  {
97  return key;
98  }
std::string key
Definition: JUTMGrid.hh:246

◆ getValue() [1/2]

const mapped_type& JTOOLS::JPair< T , T >::getValue ( ) const
inlineinherited

Definition at line 124 of file JPair.hh.

124 { return this->second; }

◆ getValue() [2/2]

mapped_type& JTOOLS::JPair< T , T >::getValue ( )
inlineinherited

Definition at line 126 of file JPair.hh.

126 { return this->second; }

◆ getUTMGrid()

const JUTMGrid& JUTM::JUTMGrid::getUTMGrid ( ) const
inlineinherited

Get UTM grid.

Returns
UTM grid

Definition at line 73 of file JUTMGrid.hh.

74  {
75  return static_cast<const JUTMGrid&>(*this);
76  }
Data structure for UTM grid.
Definition: JUTMGrid.hh:39

◆ setUTMGrid()

void JUTM::JUTMGrid::setUTMGrid ( const JUTMGrid grid)
inlineinherited

Set UTM grid.

Parameters
gridUTM grid

Definition at line 84 of file JUTMGrid.hh.

85  {
86  static_cast<JUTMGrid&>(*this) = grid;
87  }

◆ getWGS()

const std::string& JUTM::JUTMGrid::getWGS ( ) const
inlineinherited

Get WGS.

Returns
WGS

Definition at line 106 of file JUTMGrid.hh.

107  {
108  return wgs;
109  }
std::string wgs
Definition: JUTMGrid.hh:247

◆ getUTMZone()

const std::string& JUTM::JUTMGrid::getUTMZone ( ) const
inlineinherited

Get UTM zone.

Returns
UTM zone

Definition at line 117 of file JUTMGrid.hh.

118  {
119  return zone;
120  }
std::string zone
Definition: JUTMGrid.hh:248

◆ getUTMValue()

int JUTM::JUTMGrid::getUTMValue ( ) const
inlineinherited

Get UTM zone by numerical value.

Returns
UTM zone

Definition at line 128 of file JUTMGrid.hh.

129  {
130  using namespace std;
131 
132  int value = 0;
133 
134  for (string::const_iterator i = zone.begin(); i != zone.end(); ++i) {
135  if (isdigit(*i))
136  value = 10 * value + (*i - '0');
137  else
138  break;
139  }
140 
141  return value;
142  }

◆ toString()

std::string JUTM::JUTMGrid::toString ( ) const
inlineinherited

Convert UTM grid.

Returns
UTM grid

Definition at line 164 of file JUTMGrid.hh.

165  {
166  return (key + " " + wgs + " " + zone);
167  }

◆ valueOf()

static JUTMGrid JUTM::JUTMGrid::valueOf ( const std::string &  buffer)
inlinestaticinherited

Extract UTM grid.

Parameters
bufferWGS and UTM zone
Returns
UTM grid

Definition at line 176 of file JUTMGrid.hh.

177  {
178  JUTMGrid grid;
179 
180  std::istringstream is(buffer);
181 
182  if (is >> grid)
183  return grid;
184  else
185  throw JParseError("JUTMGrid::valueOf()");
186  }

◆ getUTMPosition()

const JUTMPosition& JUTM::JUTMPosition::getUTMPosition ( ) const
inlineinherited

Get UTM position.

Returns
position

Definition at line 84 of file JUTMPosition.hh.

85  {
86  return static_cast<const JUTMPosition&>(*this);
87  }
Data structure for UTM position.
Definition: JUTMPosition.hh:38

◆ setUTMPosition()

void JUTM::JUTMPosition::setUTMPosition ( const JUTMPosition position)
inlineinherited

Set UTM position.

Parameters
positionposition

Definition at line 95 of file JUTMPosition.hh.

96  {
97  static_cast<JUTMPosition&>(*this) = position;
98  }

◆ getPosition()

JPosition3D JUTM::JUTMPosition::getPosition ( ) const
inlineinherited

Get position.

Returns
position

Definition at line 106 of file JUTMPosition.hh.

107  {
108  return JPosition3D(this->getX(), this->getY(), this->getZ());
109  }
double getZ() const
Get z.
double getY() const
Get y.
double getX() const
Get x.

◆ operator JPosition3D()

JUTM::JUTMPosition::operator JPosition3D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 117 of file JUTMPosition.hh.

118  {
119  return getPosition();
120  }
JPosition3D getPosition() const
Get position.

◆ getUTMEast()

double JUTM::JUTMPosition::getUTMEast ( ) const
inlineinherited

Get UTM east.

Returns
UTM East

Definition at line 128 of file JUTMPosition.hh.

129  {
130  return this->east;
131  }

◆ getUTMNorth()

double JUTM::JUTMPosition::getUTMNorth ( ) const
inlineinherited

Get UTM north.

Returns
UTM North

Definition at line 139 of file JUTMPosition.hh.

140  {
141  return this->north;
142  }

◆ getUTMZ()

double JUTM::JUTMPosition::getUTMZ ( ) const
inlineinherited

Get UTM Z.

Returns
UTM Z

Definition at line 150 of file JUTMPosition.hh.

151  {
152  return this->z;
153  }

◆ getX()

double JUTM::JUTMPosition::getX ( ) const
inlineinherited

Get x.

Returns
UTM East

Definition at line 161 of file JUTMPosition.hh.

162  {
163  return this->east;
164  }

◆ getY()

double JUTM::JUTMPosition::getY ( ) const
inlineinherited

Get y.

Returns
UTM North

Definition at line 172 of file JUTMPosition.hh.

173  {
174  return this->north;
175  }

◆ getZ()

double JUTM::JUTMPosition::getZ ( ) const
inlineinherited

Get z.

Returns
UTM Z

Definition at line 183 of file JUTMPosition.hh.

184  {
185  return this->z;
186  }

◆ negate()

JUTMPosition& JUTM::JUTMPosition::negate ( )
inlineinherited

Negate UTM position.

Returns
this UTM position

Definition at line 194 of file JUTMPosition.hh.

195  {
196  east = -east;
197  north = -north;
198  z = -z;
199 
200  return *this;
201  }

◆ getDisplacement()

double JUTM::JUTMPosition::getDisplacement ( const JUTMPosition position) const
inlineinherited

Get displacement to position.

The displacement corresponds to the 2D distance in the (East,North) plane.

Parameters
positionposition
Returns
displacement

Definition at line 276 of file JUTMPosition.hh.

277  {
278  const double x = this->getUTMEast() - position.getUTMEast();
279  const double y = this->getUTMNorth() - position.getUTMNorth();
280 
281  return sqrt(x*x + y*y);
282  }

Friends And Related Function Documentation

◆ operator>>

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

Read detector from input.

Parameters
ininput stream
detectordetector
Returns
input stream

Definition at line 281 of file JMonteCarloDetector.hh.

282  {
283  using namespace std;
284 
285  detector.clear();
286 
287 
288  vector<OM> OMaddress;
289  vector<OM_cluster> OMcluster;
290  vector<OM_position> OMposition;
291  vector<String> DetectorString;
292  vector<OM_cluster_data> OMclusterdata;
293  vector<LCM_logic> LCMlogic;
294 
295 
296  for (string key, buffer; in >> key; ) {
297 
298  if (key == "OM:")
299 
300  OMaddress.push_back(OM(in));
301 
302  else if (key == "OM_cluster:")
303 
304  OMcluster.push_back(OM_cluster(in));
305 
306  else if (key == "OM_position:")
307 
308  OMposition.push_back(OM_position(in));
309 
310  else if (key == "string:")
311 
312  DetectorString.push_back(String(in));
313 
314  else if (key == "OM_cluster_data:")
315 
316  OMclusterdata.push_back(OM_cluster_data(in));
317 
318  else if (key == "LCM_logic:")
319 
320  LCMlogic.push_back(LCM_logic(in));
321 
322  else
323 
324  getline(in, buffer);
325  }
326 
327 
328  // invert LCM_Logic data for fast lookup
329 
330  vector<LCM_reverse_logic> LCMreverselogic;
331 
332  for (vector<LCM_logic>::const_iterator i = LCMlogic.begin(); i != LCMlogic.end(); ++i) {
333 
334  const int lcm_id = i->getID();
335 
336  for (LCM_logic::const_iterator j = i->begin(); j != i->end(); ++j) {
337 
338  const int id = *j;
339  const int pmt_id = distance(i->begin(),j) + 1;
340 
341  LCMreverselogic.push_back(LCM_reverse_logic(id, lcm_id, pmt_id));
342  }
343  }
344 
345 
346  // sort data according to identifier
347 
348  sort(OMaddress .begin(), OMaddress .end());
349  sort(OMcluster .begin(), OMcluster .end());
350  sort(OMposition .begin(), OMposition .end());
351  sort(DetectorString .begin(), DetectorString .end());
352  sort(LCMreverselogic.begin(), LCMreverselogic.end());
353 
354 
355  vector<OM_cluster> ::const_iterator OMclusterIterator;
356  vector<String> ::const_iterator StringIterator;
357  vector<int> ::const_iterator addressIterator;
358  vector<OM> ::const_iterator OMIterator;
359  vector<OM_position> ::const_iterator OMpositionIterator;
360  vector<OM_cluster_data>::const_iterator OMclusterdataIterator;
361 
362 
363  for (OMclusterIterator = OMcluster.begin();
364  OMclusterIterator != OMcluster.end();
365  OMclusterIterator++) {
366 
367  StringIterator = find(DetectorString.begin(),
368  DetectorString.end(),
369  OMclusterIterator->string_id);
370 
371  if (StringIterator != DetectorString.end()) {
372 
373  const JLocation location(StringIterator->getID(), -1);
374 
375  for (addressIterator = OMclusterIterator->begin();
376  addressIterator != OMclusterIterator->end();
377  addressIterator++) {
378 
379  OMIterator = find(OMaddress.begin(),
380  OMaddress.end(),
381  *addressIterator);
382 
383  if (OMIterator != OMaddress.end()) {
384 
385  OMpositionIterator = find(OMposition.begin(),
386  OMposition.end(),
387  OMIterator->address);
388 
389  if (OMpositionIterator != OMposition.end()) {
390 
391  // rotate string
392 
393  double ct = cos(StringIterator->twist * PI / 180.0);
394  double st = sin(StringIterator->twist * PI / 180.0);
395 
396  double x = ct * OMpositionIterator->x - st * OMpositionIterator->y;
397  double y = st * OMpositionIterator->x + ct * OMpositionIterator->y;
398 
399  JPosition3D pos(StringIterator->x + x,
400  StringIterator->y + y,
401  StringIterator->z + OMpositionIterator->z + OMclusterIterator->z);
402 
403  JDirection3D dir(JAngle3D(OMpositionIterator->theta,
404  StringIterator->twist * PI / 180.0 + OMpositionIterator->phi));
405 
406  int lcm_id = OMclusterIterator->getID();
407  int pmt_id = OMIterator->address;
408 
409  if (detector.use_logic) {
410 
411  vector<LCM_reverse_logic>::const_iterator p = find(LCMreverselogic.begin(),
412  LCMreverselogic.end(),
413  OMIterator->getID());
414 
415  if (p != LCMreverselogic.end()) {
416  lcm_id = p->lcm_id;
417  pmt_id = p->pmt_id;
418  }
419  }
420 
421  detector.put(lcm_id, pmt_id - 1, location, JPMT(OMIterator->getID(), JAxis3D(pos, dir)));
422  }
423  }
424  }
425  }
426  }
427 
428 
429  // 'event' data
430 
431  for (OMclusterdataIterator = OMclusterdata.begin();
432  OMclusterdataIterator != OMclusterdata.end();
433  OMclusterdataIterator++) {
434 
435  const JPosition3D P(OMclusterdataIterator->x,
436  OMclusterdataIterator->y,
437  OMclusterdataIterator->z);
438 
439  const JEulerMatrix3D R(JEulerAngle3D(OMclusterdataIterator->theta,
440  OMclusterdataIterator->phi,
441  OMclusterdataIterator->psi));
442 
443  OMclusterIterator = find(OMcluster.begin(),
444  OMcluster.end(),
445  OMclusterdataIterator->getID());
446 
447  if (OMclusterIterator != OMcluster.end()) {
448 
449  const JLocation location(OMclusterIterator->string_id, -1);
450 
451  for (addressIterator = OMclusterIterator->begin();
452  addressIterator != OMclusterIterator->end();
453  addressIterator++) {
454 
455  OMIterator = find(OMaddress.begin(),
456  OMaddress.end(),
457  *addressIterator);
458 
459  if (OMIterator != OMaddress.end()) {
460 
461  OMpositionIterator = find(OMposition.begin(),
462  OMposition.end(),
463  OMIterator->address);
464 
465  if (OMpositionIterator != OMposition.end()) {
466 
467  JPosition3D pos(OMpositionIterator->x,
468  OMpositionIterator->y,
469  OMpositionIterator->z);
470 
471  JDirection3D dir(JAngle3D(OMpositionIterator->theta,
472  OMpositionIterator->phi));
473 
474  pos.transform(R);
475  dir.transform(R);
476 
477  pos += P;
478 
479  int lcm_id = OMclusterIterator->getID();
480  int pmt_id = OMIterator->address;
481 
482  if (detector.use_logic) {
483 
484  vector<LCM_reverse_logic>::const_iterator p = find(LCMreverselogic.begin(),
485  LCMreverselogic.end(),
486  OMIterator->getID());
487 
488  if (p != LCMreverselogic.end()) {
489  lcm_id = p->lcm_id;
490  pmt_id = p->pmt_id;
491  }
492  }
493 
494  detector.put(lcm_id, pmt_id - 1, location, JPMT(OMIterator->getID(), JAxis3D(pos, dir)));
495  }
496  }
497  }
498  }
499  }
500 
501  // set floor identifier
502 
503  sort(detector.begin(), detector.end(), JMonteCarloDetector::compare);
504 
505  int string = -1;
506  int floor = -1;
507 
508  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
509 
510  if (module->getString() != string) {
511  string = module->getString();
512  floor = 0;
513  }
514 
515  module->setLocation(JLocation(string,++floor));
516  }
517 
518  return in;
519  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Logical location of module.
Definition: JLocation.hh:40
static T find(T __begin, T __end, const int id)
Binary search method.
JDetector & put(const int moduleID, const int pmtAddress, const JLocation &location, const JPMT &pmt)
Set PMT.
Data structure for PMT geometry, calibration and status.
Definition: JPMT.hh:49
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
static const double PI
Mathematical constants.
int j
Definition: JPolint.hh:792

Member Data Documentation

◆ use_logic

bool JDETECTOR::JMonteCarloDetector::use_logic
private

Definition at line 636 of file JMonteCarloDetector.hh.

◆ comment

JComment JDETECTOR::JDetector::comment
inherited

Definition at line 561 of file JDetector.hh.

◆ LENGTH_START_OF_COMMENT

const size_t JDETECTOR::JDetector::LENGTH_START_OF_COMMENT = sizeof(JDetectorID)
staticprotectedinherited

Length of start of comment in binary I/O.

Definition at line 623 of file JDetector.hh.

◆ __id

int JLANG::JObjectID::__id
protectedinherited

Definition at line 140 of file JObjectID.hh.

◆ version

std::string JDETECTOR::JVersion::version
protectedinherited

Definition at line 79 of file JDetector/JVersion.hh.

◆ compare

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

Function object for comparisons.

Definition at line 565 of file JRange.hh.

◆ first

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

Definition at line 128 of file JPair.hh.

◆ second

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

Definition at line 129 of file JPair.hh.

◆ key

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

Definition at line 246 of file JUTMGrid.hh.

◆ wgs

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

Definition at line 247 of file JUTMGrid.hh.

◆ zone

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

Definition at line 248 of file JUTMGrid.hh.

◆ east

double JUTM::JUTMPosition::east
protectedinherited

Definition at line 344 of file JUTMPosition.hh.

◆ north

double JUTM::JUTMPosition::north
protectedinherited

Definition at line 345 of file JUTMPosition.hh.

◆ z

double JUTM::JUTMPosition::z
protectedinherited

Definition at line 346 of file JUTMPosition.hh.


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