Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Private Types | Private Attributes | List of all members
JDETECTOR::JPMTRouter Class Reference

Router for direct addressing of PMT data in detector data structure. More...

#include <JPMTRouter.hh>

Inheritance diagram for JDETECTOR::JPMTRouter:
JLANG::JReference< JClass_t > JDETECTOR::JDetectorSimulator

Public Types

typedef JDetector::const_iterator const_iterator
 

Public Member Functions

 JPMTRouter (const JDetector &detector)
 Constructor. More...
 
const JPMTRoutergetPMTRouter () const
 Get PMT router. More...
 
const JPMTAddressgetAddress (const JObjectID &id) const
 Get address of PMT. More...
 
const JPMTgetPMT (const JPMTAddress &address) const
 Get PMT. More...
 
const JPMTgetPMT (const JObjectID &id) const
 Get PMT. More...
 
bool hasPMT (const JObjectID &id) const
 Has PMT. More...
 
JPMTIdentifier getIdentifier (const JPMTAddress &address) const
 Get identifier of PMT. More...
 
JPMTIdentifier getIdentifier (const JObjectID &id) const
 Get identifier of PMT. More...
 
const JModulegetModule (const JModuleAddress &address) const
 Get module. More...
 
const JModulegetParentModule (const JObjectID &id) const
 Get parent module. More...
 
int getParentModuleID (const JObjectID &id) const
 Get parent module identifier. More...
 
JPMTChannel getPMTChannel (const JPMTAddress &address) const
 Get PMT channel. More...
 
JPMTChannel getPMTChannel (const JObjectID &id) const
 Get PMT channel. More...
 
JUTMPosition getUTMPosition (const JObjectID &id) const
 Get UTM position of given PMT identifier. More...
 
const JClass_t & getReference () const
 Get reference to object. More...
 
JClass_t & getReference ()
 Get reference to object. More...
 
bool is_valid () const
 Check validity of reference. More...
 
const JClass_t * operator-> () const
 Smart pointer. More...
 
JClass_t * operator-> ()
 Smart pointer. More...
 
const JClass_t & operator* () const
 Dereference operator. More...
 
JClass_t & operator* ()
 Dereference operator. More...
 

Protected Attributes

JClass_t & __object
 

Private Types

typedef JReference< const
JDetector
JReference_t
 

Private Attributes

JTOOLS::JRouter< JPMTAddressrouter
 

Detailed Description

Router for direct addressing of PMT data in detector data structure.

This router can be used to directly map the PMT identifier (JObjectID) to the logical address of the PMT (JPMTAddress) in the detector data structure.

Definition at line 33 of file JPMTRouter.hh.

Member Typedef Documentation

Definition at line 37 of file JPMTRouter.hh.

typedef JDetector::const_iterator JDETECTOR::JPMTRouter::const_iterator

Definition at line 41 of file JPMTRouter.hh.

Constructor & Destructor Documentation

JDETECTOR::JPMTRouter::JPMTRouter ( const JDetector detector)
inline

Constructor.

Parameters
detectordetector

Definition at line 49 of file JPMTRouter.hh.

49  :
50  JReference_t(detector),
52  {
53  for (const_iterator module = detector.begin(); module != detector.end(); ++module) {
54  for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
55  router.put(pmt->getID(), JPMTAddress(JModuleAddress(std::distance(detector.begin(), module)), std::distance(module->begin(), pmt)));
56  }
57  }
58  }
JTOOLS::JRouter< JPMTAddress > router
Definition: JPMTRouter.hh:218
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Address of module in detector data structure.
JReference< const JDetector > JReference_t
Definition: JPMTRouter.hh:37
Address of PMT in detector data structure.
Definition: JPMTAddress.hh:32
JDetector::const_iterator const_iterator
Definition: JPMTRouter.hh:41

Member Function Documentation

const JPMTRouter& JDETECTOR::JPMTRouter::getPMTRouter ( ) const
inline

Get PMT router.

Returns
PMT router

Definition at line 66 of file JPMTRouter.hh.

67  {
68  return static_cast<const JPMTRouter&>(*this);
69  }
Router for direct addressing of PMT data in detector data structure.
Definition: JPMTRouter.hh:33
const JPMTAddress& JDETECTOR::JPMTRouter::getAddress ( const JObjectID id) const
inline

Get address of PMT.

Parameters
idPMT identifier
Returns
address

Definition at line 78 of file JPMTRouter.hh.

79  {
80  return router.get(id.getID());
81  }
JTOOLS::JRouter< JPMTAddress > router
Definition: JPMTRouter.hh:218
const JPMT& JDETECTOR::JPMTRouter::getPMT ( const JPMTAddress address) const
inline

Get PMT.

Parameters
addressPMT address
Returns
PMT

Definition at line 90 of file JPMTRouter.hh.

91  {
92  return getReference().getPMT(address);
93  }
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
const JPMT& JDETECTOR::JPMTRouter::getPMT ( const JObjectID id) const
inline

Get PMT.

Parameters
idPMT identifier
Returns
PMT

Definition at line 102 of file JPMTRouter.hh.

103  {
104  return getReference().getPMT(this->getAddress(id));
105  }
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
Definition: JPMTRouter.hh:78
bool JDETECTOR::JPMTRouter::hasPMT ( const JObjectID id) const
inline

Has PMT.

Parameters
idPMT identifier
Returns
true if PMT present; else false

Definition at line 114 of file JPMTRouter.hh.

115  {
116  return router.has(id.getID());
117  }
JTOOLS::JRouter< JPMTAddress > router
Definition: JPMTRouter.hh:218
JPMTIdentifier JDETECTOR::JPMTRouter::getIdentifier ( const JPMTAddress address) const
inline

Get identifier of PMT.

Parameters
addressPMT address
Returns
address

Definition at line 126 of file JPMTRouter.hh.

127  {
128  return JPMTIdentifier(getReference().getModule(address), address.second);
129  }
int second
index of PMT in module data structure.
Definition: JPMTAddress.hh:100
const JModule & getModule(const JModuleAddress &address) const
Get module.
Definition: JPMTRouter.hh:150
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
JPMTIdentifier JDETECTOR::JPMTRouter::getIdentifier ( const JObjectID id) const
inline

Get identifier of PMT.

Parameters
idPMT identifier
Returns
address

Definition at line 138 of file JPMTRouter.hh.

139  {
140  return getIdentifier(this->getAddress(id));
141  }
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
Definition: JPMTRouter.hh:126
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
Definition: JPMTRouter.hh:78
const JModule& JDETECTOR::JPMTRouter::getModule ( const JModuleAddress address) const
inline

Get module.

Parameters
addressmodule address
Returns
module

Definition at line 150 of file JPMTRouter.hh.

151  {
152  return getReference().getModule(address);
153  }
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
const JModule& JDETECTOR::JPMTRouter::getParentModule ( const JObjectID id) const
inline

Get parent module.

Parameters
idPMT identifier
Returns
module

Definition at line 162 of file JPMTRouter.hh.

163  {
164  return getModule(this->getAddress(id));
165  }
const JModule & getModule(const JModuleAddress &address) const
Get module.
Definition: JPMTRouter.hh:150
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
Definition: JPMTRouter.hh:78
int JDETECTOR::JPMTRouter::getParentModuleID ( const JObjectID id) const
inline

Get parent module identifier.

Parameters
idPMT identifier
Returns
module identifier

Definition at line 174 of file JPMTRouter.hh.

175  {
176  return getParentModule(id).getID();
177  }
const JModule & getParentModule(const JObjectID &id) const
Get parent module.
Definition: JPMTRouter.hh:162
int getID() const
Get identifier.
Definition: JObjectID.hh:50
JPMTChannel JDETECTOR::JPMTRouter::getPMTChannel ( const JPMTAddress address) const
inline

Get PMT channel.

Parameters
addressPMT address
Returns
PMT channel

Definition at line 186 of file JPMTRouter.hh.

187  {
188  return JPMTChannel(getReference().getID(),
189  JLocation(getReference().getModule(address)),
190  JPMTReadoutAddress(address.second));
191  }
Auxiliary class to uniquely identify PMT readout channel.
Definition: JPMTChannel.hh:28
int second
index of PMT in module data structure.
Definition: JPMTAddress.hh:100
const JModule & getModule(const JModuleAddress &address) const
Get module.
Definition: JPMTRouter.hh:150
Logical location of module.
Definition: JLocation.hh:37
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
Data structure for PMT readout address.
JPMTChannel JDETECTOR::JPMTRouter::getPMTChannel ( const JObjectID id) const
inline

Get PMT channel.

Parameters
idPMT identifier
Returns
PMT channel

Definition at line 200 of file JPMTRouter.hh.

201  {
202  return getPMTChannel(getAddress(id));
203  }
JPMTChannel getPMTChannel(const JPMTAddress &address) const
Get PMT channel.
Definition: JPMTRouter.hh:186
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
Definition: JPMTRouter.hh:78
JUTMPosition JDETECTOR::JPMTRouter::getUTMPosition ( const JObjectID id) const
inline

Get UTM position of given PMT identifier.

Parameters
idPMT identifier
Returns
UTM position

Definition at line 212 of file JPMTRouter.hh.

213  {
214  return JUTMPosition(getPMT(id).getPosition() + getReference().getPosition());
215  }
JPosition3D getPosition(const JModule &first, const JModule &second)
Get position to go from first to second module.
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT.
Definition: JPMTRouter.hh:90
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
template<class JClass_t>
const JClass_t& JLANG::JReference< JClass_t >::getReference ( ) const
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 38 of file JReference.hh.

39  {
40  return __object;
41  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
JClass_t& JLANG::JReference< JClass_t >::getReference ( )
inlineinherited

Get reference to object.

Returns
reference to object

Definition at line 49 of file JReference.hh.

50  {
51  return __object;
52  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
bool JLANG::JReference< JClass_t >::is_valid ( ) const
inlineinherited

Check validity of reference.

Returns
true

Definition at line 60 of file JReference.hh.

61  {
62  return true;
63  }
template<class JClass_t>
const JClass_t* JLANG::JReference< JClass_t >::operator-> ( ) const
inlineinherited

Smart pointer.

Returns
pointer to object

Definition at line 71 of file JReference.hh.

72  {
73  return &__object;
74  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
JClass_t* JLANG::JReference< JClass_t >::operator-> ( )
inlineinherited

Smart pointer.

Returns
pointer to object

Definition at line 82 of file JReference.hh.

83  {
84  return &__object;
85  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
const JClass_t& JLANG::JReference< JClass_t >::operator* ( ) const
inlineinherited

Dereference operator.

Returns
reference to object

Definition at line 93 of file JReference.hh.

94  {
95  return __object;
96  }
JClass_t & __object
Definition: JReference.hh:110
template<class JClass_t>
JClass_t& JLANG::JReference< JClass_t >::operator* ( )
inlineinherited

Dereference operator.

Returns
reference to object

Definition at line 104 of file JReference.hh.

105  {
106  return __object;
107  }
JClass_t & __object
Definition: JReference.hh:110

Member Data Documentation

JTOOLS::JRouter<JPMTAddress> JDETECTOR::JPMTRouter::router
private

Definition at line 218 of file JPMTRouter.hh.

template<class JClass_t>
JClass_t& JLANG::JReference< JClass_t >::__object
protectedinherited

Definition at line 110 of file JReference.hh.


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