Jpp
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
JDETECTOR::JMonteCarloDetector Class Reference

Monte Carlo detector (i.e. More...

#include <JMonteCarloDetector.hh>

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

 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...
 
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...
 
bool equals (const range_type &range) 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 upper limit. More...
 
template<class R >
void setRange (R first, R second)
 Set range. 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 upper limit according to minimal and maximal value in input data, respectively. 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 upper limit according to minimal and maximal value in input data, respectively. 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...
 
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...
 
mod (argument_type x) const
 Modulo value with respect to range. More...
 
bool overlap (const range_type &range) const
 Test overlap with given range. More...
 
range_type include (argument_type x)
 Include given value to range. More...
 
range_typejoin (const range_type &range)
 Join ranges. More...
 
range_typecombine (const range_type &range)
 Combine ranges. More...
 
range_typeadd (argument_type x)
 Add offset. More...
 
range_typeadd (const range_type &range)
 Add offsets. More...
 
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...
 
JUTMPositionmul (const JSecond_t &object)
 Multiply with object. More...
 
range_typediv (const double factor)
 Divide range. More...
 
JUTMPositiondiv (const double factor)
 Scale UTM position. 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...
 
const JUTMPositiongetUTMPosition () const
 Get UTM position. 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...
 
JUTMPositionnegate ()
 Negate UTM position. 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...
 

Protected Member Functions

JDetectorput (const int moduleID, const int pmtAddress, const JModuleLocation &location, const JPMT &pmt)
 Set PMT. 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...
 
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
 

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.

so-called .det file).

Definition at line 43 of file JMonteCarloDetector.hh.

Member Typedef Documentation

◆ 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 41 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 42 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

◆ JVersion_t

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 42 of file JDetectorVersion.hh.

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

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

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

◆ 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/2]

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

Set version.

Parameters
versionversion

Definition at line 126 of file JDetector.hh.

127  {
128  static_cast<JDetectorVersion&>(*this).setVersion(version);
129 
131  }

◆ setVersion() [2/2]

void JDETECTOR::JDetector::setVersion ( const JDetectorVersion::JVersion_t version)
inlineinherited

Set version.

Parameters
versionversion

Definition at line 139 of file JDetector.hh.

140  {
141  setVersion(putDetectorVersion(version));
142  }

◆ operator+=()

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

Move detector elements.

Parameters
posoffset position
Returns
this JDetector

Definition at line 151 of file JDetector.hh.

152  {
153  for (iterator i = begin(); i != end(); ++i) {
154  i->add(pos);
155  }
156 
157  return *this;
158  }

◆ operator-=()

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

Move detector elements.

Parameters
posoffset position
Returns
this JDetector

Definition at line 167 of file JDetector.hh.

168  {
169  for (iterator i = begin(); i != end(); ++i) {
170  i->sub(pos);
171  }
172 
173  return *this;
174  }

◆ 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 183 of file JDetector.hh.

184  {
185  return at(address.first);
186  }

◆ getModule() [2/4]

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

Get module parameters.

Parameters
addressmodule address
Returns
module parameters

Definition at line 195 of file JDetector.hh.

196  {
197  return at(address.first);
198  }

◆ getModule() [3/4]

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

Get module parameters.

Parameters
locationmodule location
Returns
module parameters

Definition at line 207 of file JDetector.hh.

208  {
209  for (JDetector::const_iterator module = this->begin(); module != this->end(); ++module) {
210  if (*module == location) {
211  return *module;
212  }
213  }
214 
215  THROW(JIndexOutOfRange, "JDetector::getModule()");
216  }

◆ getModule() [4/4]

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

Get module parameters.

Parameters
locationmodule location
Returns
module parameters

Definition at line 225 of file JDetector.hh.

226  {
227  for (JDetector::iterator module = this->begin(); module != this->end(); ++module) {
228  if (*module == location) {
229  return *module;
230  }
231  }
232 
233  THROW(JIndexOutOfRange, "JDetector::getModule()");
234  }

◆ getPMT() [1/2]

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

Get PMT parameters.

Parameters
addressJPMTAddress
Returns
JPMT

Definition at line 243 of file JDetector.hh.

244  {
245  return at(address.first).at(address.second);
246  }

◆ getPMT() [2/2]

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

Get PMT parameters.

Parameters
addressJPMTAddress
Returns
JPMT

Definition at line 255 of file JDetector.hh.

256  {
257  return at(address.first).at(address.second);
258  }

◆ read()

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

Read from input.

Parameters
inreader
Returns
reader

Implements JIO::JSerialisable.

Definition at line 370 of file JDetector.hh.

371  {
372  clear();
373 
374  int n;
375 
376  in >> static_cast<JObjectID&> (*this);
377  in >> static_cast<JDetectorVersion&>(*this);
378  in >> static_cast<JDetectorHeader&> (*this);
379  in >> n;
380 
382 
383  for (JModule module; n != 0; --n) {
384 
385  in >> module;
386 
387  push_back(module);
388  }
389 
390  return in;
391  }

◆ write()

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

Write to output.

Parameters
outwriter
Returns
writer

Implements JIO::JSerialisable.

Definition at line 400 of file JDetector.hh.

401  {
402  int n = size();
403 
404  out << static_cast<const JObjectID&> (*this);
405  out << static_cast<const JDetectorVersion&>(*this);
406  out << static_cast<const JDetectorHeader&> (*this);
407  out << n;
408 
409  for (const_iterator i = begin(); i != end(); ++i) {
410  out << *i;
411  }
412 
413  return out;
414  }

◆ getID()

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

Get identifier.

Returns
identifier

Definition at line 55 of file JObjectID.hh.

56  {
57  return __id;
58  }

◆ setID()

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

Set identifier.

Parameters
ididentifier

Definition at line 66 of file JObjectID.hh.

67  {
68  this->__id = id;
69  }

◆ less() [1/2]

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

79  {
80  return this->getID() < object.getID();
81  }

◆ less() [2/2]

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

91  {
92  return this->getID() < id;
93  }

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

103  {
104  return this->getID() > id;
105  }

◆ getVersion() [1/2]

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  }

◆ getVersion() [2/2]

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  }

◆ getVariant()

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  }

◆ setVariant()

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  }

◆ equals() [1/2]

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  }

◆ equals() [2/2]

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

289  {
290  return (!this->compare(this->getLowerLimit(), range.getLowerLimit()) &&
291  !this->compare(range.getLowerLimit(), this->getLowerLimit()) &&
292  !this->compare(this->getUpperLimit(), range.getUpperLimit()) &&
293  !this->compare(range.getUpperLimit(), this->getUpperLimit()));
294  }

◆ getEquationParameters()

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  }

◆ setEquationParameters()

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  }

◆ getProperties() [1/2]

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  }

◆ 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 180 of file JDetectorHeader.hh.

181  {
182  return JDetectorHeaderHelper(*this, equation);
183  }

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

129  {
130  return static_cast<const range_type&>(*this);
131  }

◆ setRange() [1/7]

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

140  {
141  static_cast<range_type&>(*this) = range;
142  }

◆ setRange() [2/7]

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

152  {
153  this->first = x;
154  this->second = y;
155  }

◆ setRange() [3/7]

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

167  {
168  using namespace JLANG;
169 
171  }

◆ setRange() [4/7]

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 upper limit according to minimal and maximal value in input data, respectively.

Parameters
__beginbegin of data
__endend of data
memberpointer to data member

Definition at line 182 of file JRange.hh.

183  {
185 
186  for (iterator_type i = __begin; i != __end; ++i) {
187  include((*i).*member);
188  }
189  }

◆ setRange() [5/7]

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 upper limit according to minimal and maximal value in input data, respectively.

Parameters
__beginbegin of data
__endend of data
functionpointer to member method

Definition at line 200 of file JRange.hh.

201  {
203 
204  for (iterator_type i = __begin; i != __end; ++i) {
205  include(((*i).*function)());
206  }
207  }

◆ setRange() [6/7]

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

580  {
582  }

◆ setRange() [7/7]

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

594  {
596 
597  for (R i = first; i != second; ++i) {
598  include(*i);
599  }
600  }

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

216  {
217  return this->first;
218  }

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

227  {
228  return this->second;
229  }

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

238  {
239  this->first = x;
240  }

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

249  {
250  this->second = y;
251  }

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

262  {
263  this->second += x - this->first;
264  this->first = x;
265  }

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

276  {
277  this->first += y - this->second;
278  this->second = y;
279  }

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

303  {
304  return getUpperLimit() - getLowerLimit();
305  }

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

314  {
315  return !compare(getUpperLimit(), getLowerLimit());
316  }

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

326  {
327  return (!compare(x, getLowerLimit()) &&
328  !compare(getUpperLimit(), x));
329  }

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

341  {
342  if (compare(x, getLowerLimit())) { return getLowerLimit(); }
343  if (compare(getUpperLimit(), x)) { return getUpperLimit(); }
344 
345  return x;
346  }

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

356  {
357  if (compare(x, getLowerLimit()))
358  return x + getLength() * floor((getUpperLimit() - x) / getLength());
359  else if (compare(getUpperLimit(), x))
360  return x - getLength() * floor((x - getLowerLimit()) / getLength());
361  else
362  return x;
363  }

◆ 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.


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

374  {
375  return (compare(getLowerLimit(), range.getUpperLimit()) &&
376  compare(range.getLowerLimit(), getUpperLimit()));
377  }

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

389  {
390  if (compare(x, getLowerLimit())) { setLowerLimit(x); }
391  if (compare(getUpperLimit(), x)) { setUpperLimit(x); }
392 
393  return *this;
394  }

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

407  {
408  if (compare(getLowerLimit(), range.getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
409  if (compare(range.getUpperLimit(), getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
410 
411  return *this;
412  }

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

424  {
425  if (compare(range.getLowerLimit(), getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
426  if (compare(getUpperLimit(), range.getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
427 
428  return *this;
429  }

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

438  {
439  this->first += x;
440  this->second += x;
441 
442  return *this;
443  }

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

468  {
469  this->first += range.getLowerLimit();
470  this->second += range.getUpperLimit();
471 
472  return *this;
473  }

◆ add() [3/3]

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

Add UTM position.

Parameters
posUTM position
Returns
this UTM position

Definition at line 153 of file JUTMPosition.hh.

154  {
155  east += pos.getUTMEast();
156  north += pos.getUTMNorth();
157  z += pos.getUTMZ();
158 
159  return *this;
160  }

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

452  {
453  this->first -= x;
454  this->second -= x;
455 
456  return *this;
457  }

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

484  {
485  this->first -= range.getLowerLimit();
486  this->second -= range.getUpperLimit();
487 
488  return *this;
489  }

◆ sub() [3/3]

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

Subtract UTM position.

Parameters
posUTM position
Returns
this UTM position

Definition at line 169 of file JUTMPosition.hh.

170  {
171  east -= pos.getUTMEast();
172  north -= pos.getUTMNorth();
173  z -= pos.getUTMZ();
174 
175  return *this;
176  }

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

498  {
499  this->first *= factor;
500  this->second *= factor;
501 
502  return *this;
503  }

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

◆ mul() [3/4]

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

Scale UTM position.

Parameters
factormultiplication factor
Returns
this UTM position

Definition at line 185 of file JUTMPosition.hh.

186  {
187  east *= factor;
188  north *= factor;
189  z *= factor;
190 
191  return *this;
192  }

◆ mul() [4/4]

JUTMPosition & JMATH::JMath< JUTMPosition , 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  }

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

512  {
513  this->first /= factor;
514  this->second /= factor;
515 
516  return *this;
517  }

◆ div() [2/2]

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

Scale UTM position.

Parameters
factordivision factor
Returns
this UTM position

Definition at line 201 of file JUTMPosition.hh.

202  {
203  east /= factor;
204  north /= factor;
205  z /= factor;
206 
207  return *this;
208  }

◆ getN()

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

527  {
528  return R * (getUpperLimit() - getLowerLimit());
529  }

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

538  {
539  return JMATH::JLimits<T>::min();
540  }

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

549  {
550  return JMATH::JLimits<T>::max();
551  }

◆ 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 68 of file JUTMGrid.hh.

69  {
70  return key;
71  }

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

◆ getWGS()

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  }

◆ getUTMZone()

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  }

◆ toString()

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  }

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

◆ getUTMPosition()

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

Get UTM position.

Returns
position

Definition at line 82 of file JUTMPosition.hh.

83  {
84  return static_cast<const JUTMPosition&>(*this);
85  }

◆ getPosition()

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

Get position.

Returns
position

Definition at line 93 of file JUTMPosition.hh.

94  {
95  return JPosition3D(east, north, z);
96  }

◆ getUTMEast()

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

Get UTM east.

Returns
UTM East

Definition at line 104 of file JUTMPosition.hh.

105  {
106  return this->east;
107  }

◆ getUTMNorth()

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

Get UTM north.

Returns
UTM North

Definition at line 115 of file JUTMPosition.hh.

116  {
117  return this->north;
118  }

◆ getUTMZ()

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

Get UTM Z.

Returns
UTM Z

Definition at line 126 of file JUTMPosition.hh.

127  {
128  return this->z;
129  }

◆ negate()

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

Negate UTM position.

Returns
this UTM position

Definition at line 137 of file JUTMPosition.hh.

138  {
139  east = -east;
140  north = -north;
141  z = -z;
142 
143  return *this;
144  }

◆ eq() [1/2]

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  }

◆ eq() [2/2]

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

◆ 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 JModuleLocation 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 JModuleLocation 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(JModuleLocation(string,++floor));
516  }
517 
518  return in;
519  }

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 418 of file JDetector.hh.

◆ __id

int JLANG::JObjectID::__id
protectedinherited

Definition at line 160 of file JObjectID.hh.

◆ __variant

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

Definition at line 171 of file JVersion.hh.

◆ DEFAULT_RANGE

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

◆ compare

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 568 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 183 of file JUTMGrid.hh.

◆ wgs

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

Definition at line 184 of file JUTMGrid.hh.

◆ zone

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

Definition at line 185 of file JUTMGrid.hh.

◆ east

double JUTM::JUTMPosition::east
protectedinherited

Definition at line 265 of file JUTMPosition.hh.

◆ north

double JUTM::JUTMPosition::north
protectedinherited

Definition at line 266 of file JUTMPosition.hh.

◆ z

double JUTM::JUTMPosition::z
protectedinherited

Definition at line 267 of file JUTMPosition.hh.


The documentation for this class was generated from the following file:
JDETECTOR::JDetectorVersion::V2
Version with UTC time and UTM position data.
Definition: JDetectorVersion.hh:44
JDETECTOR::JMonteCarloDetector::put
JDetector & put(const int moduleID, const int pmtAddress, const JModuleLocation &location, const JPMT &pmt)
Set PMT.
Definition: JMonteCarloDetector.hh:543
JTOOLS::JRange::getLowerLimit
T getLowerLimit() const
Get lower limit.
Definition: JRange.hh:215
std::iterator
Definition: JSTDTypes.hh:18
JDETECTOR::JModuleAddress::first
int first
index of module in detector data structure
Definition: JModuleAddress.hh:90
JTOOLS::JRange::include
range_type include(argument_type x)
Include given value to range.
Definition: JRange.hh:388
JTOOLS::JRange::getUpperLimit
T getUpperLimit() const
Get upper limit.
Definition: JRange.hh:226
JEEP::JVersion::getVersion
const JVersion & getVersion() const
Get version.
Definition: JVersion.hh:57
JLANG::getUndefinedObjectID
const JObjectID & getUndefinedObjectID()
Get undefined object identifier.
Definition: JObjectID.hh:169
JLANG::JType
Auxiliary class for a type holder.
Definition: JType.hh:19
JDETECTOR::putDetectorVersion
static const JPutDetectorVersion putDetectorVersion(getDetectorVersion)
Function object to map detector version to detector variant.
JEEP::JVersion::__variant
std::string __variant
Definition: JVersion.hh:171
JUTM::JUTMGrid
Data structure for UTM grid.
Definition: JUTMGrid.hh:34
JDETECTOR::JDetectorVersion::V3
Version with PMT status field and comments.
Definition: JDetectorVersion.hh:45
JUTM::JUTMPosition::east
double east
Definition: JUTMPosition.hh:265
JTOOLS::JPair< T, T >::first
T first
Definition: JPair.hh:128
JDETECTOR::JDetector::setVersion
void setVersion(const JVersion &version)
Set version.
Definition: JDetector.hh:126
JUTM::JUTMPosition::getUTMZ
double getUTMZ() const
Get UTM Z.
Definition: JUTMPosition.hh:126
JLANG::is_iterator
Data structure to check whether given data type is an iterator.
Definition: JClass.hh:62
JTOOLS::JRange::setRange
void setRange(const range_type &range)
Set range.
Definition: JRange.hh:139
JTOOLS::n
const int n
Definition: JPolint.hh:628
JTOOLS::JRange::getLength
T getLength() const
Get length (difference between upper and lower limit).
Definition: JRange.hh:302
std::vector
Definition: JSTDTypes.hh:12
JTOOLS::j
int j
Definition: JPolint.hh:634
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JTOOLS::JRange::getMinimum
static T getMinimum()
Get minimum possible value.
Definition: JRange.hh:537
JTOOLS::JRange::setLowerLimit
void setLowerLimit(argument_type x)
Set lower limit.
Definition: JRange.hh:237
JDETECTOR::JMonteCarloDetector::compare
static bool compare(const JModule &first, const JModule &second)
Module comparator.
Definition: JMonteCarloDetector.hh:627
JDETECTOR::JModuleLocation
Logical location of module.
Definition: JModuleLocation.hh:36
JTOOLS::JRange::getMaximum
static T getMaximum()
Get maximum possible value.
Definition: JRange.hh:548
JDETECTOR::JMonteCarloDetector::find
static T find(T __begin, T __end, const int id)
Binary search method.
Definition: JMonteCarloDetector.hh:606
JDETECTOR::JDetectorVersion::V1
First version.
Definition: JDetectorVersion.hh:43
JLANG::JMultiEquals::eq
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
JLANG::JObjectID::getID
int getID() const
Get identifier.
Definition: JObjectID.hh:55
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:669
JDETECTOR::JPMT::setVersion
static void setVersion(const JVersion &version)
Set detector version.
Definition: JPMT.hh:134
JDETECTOR::JModule
Data structure for a composite optical module.
Definition: JModule.hh:49
JTOOLS::JRange::setUpperLimit
void setUpperLimit(argument_type y)
Set upper limit.
Definition: JRange.hh:248
JUTM::JUTMGrid::key
std::string key
Definition: JUTMGrid.hh:183
JDETECTOR::JMonteCarloDetector::use_logic
bool use_logic
Definition: JMonteCarloDetector.hh:636
JUTM::JUTMGrid::wgs
std::string wgs
Definition: JUTMGrid.hh:184
JMATH::JLimits::max
TTimeStamp max()
Get maximum possible value.
Definition: JMathSupportkit.hh:33
JDETECTOR::JPMT
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:53
JTOOLS::JRange::compare
JComparator_t compare
Function object.
Definition: JRange.hh:568
JLANG::JBool
Auxiliary template class for type bool.
Definition: JBool.hh:20
JDETECTOR::JDetector::JDetector
JDetector()
Default constructor.
Definition: JDetector.hh:92
JUTM::JUTMGrid::zone
std::string zone
Definition: JUTMGrid.hh:185
JDETECTOR::JDetectorHeader::getEquationParameters
static JEquationParameters & getEquationParameters()
Get equation parameters.
Definition: JDetectorHeader.hh:144
JGEOMETRY3D::JPosition3D::setPosition
void setPosition(const JVector3D &pos)
Set position.
Definition: JPosition3D.hh:151
JLANG::JEquationParameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Definition: JEquationParameters.hh:20
JLANG::JObjectID::__id
int __id
Definition: JObjectID.hh:160
JGEOMETRY3D::JPosition3D::getPosition
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
JTOOLS::JRange::argument_type
JLANG::JClass< T >::argument_type argument_type
Definition: JRange.hh:42
std
Definition: jaanetDictionary.h:36
JTOOLS::PI
static const double PI
Constants.
Definition: JConstants.hh:20
JUTM::JUTMPosition::getUTMNorth
double getUTMNorth() const
Get UTM north.
Definition: JUTMPosition.hh:115
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JEEP::JVersion::getVariant
const std::string & getVariant() const
Get variant.
Definition: JVersion.hh:90
JUTM::JUTMPosition::north
double north
Definition: JUTMPosition.hh:266
JTOOLS::JPair< T, T >::second
T second
Definition: JPair.hh:129
JLANG
Auxiliary classes and methods for language specific functionality.
Definition: JAbstractClass.hh:10
JLANG::getline
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:468
JUTM::JUTMPosition::z
double z
Definition: JUTMPosition.hh:267
JUTM::JUTMPosition::getUTMEast
double getUTMEast() const
Get UTM east.
Definition: JUTMPosition.hh:104
JDETECTOR::JPMTAddress::second
int second
index of PMT in module data structure.
Definition: JPMTAddress.hh:100
JMATH::JLimits::min
float min()
Get minimum possible value.
Definition: JLimits.hh:96