Jpp  debug
the software that should make you happy
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 JDetectorJReference_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 to the logical address of the PMT (JPMTAddress) in the detector data structure.

Note that the required memory is determined by the range covered by the PMT identifiers.

Definition at line 35 of file JPMTRouter.hh.

Member Typedef Documentation

◆ JReference_t

Definition at line 39 of file JPMTRouter.hh.

◆ const_iterator

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

Definition at line 43 of file JPMTRouter.hh.

Constructor & Destructor Documentation

◆ JPMTRouter()

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

Constructor.

Parameters
detectordetector

Definition at line 51 of file JPMTRouter.hh.

51  :
52  JReference_t(detector),
54  {
55  for (const_iterator module = detector.begin(); module != detector.end(); ++module) {
56  for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
57  router.put(pmt->getID(), JPMTAddress(JModuleAddress(std::distance(detector.begin(), module)), std::distance(module->begin(), pmt)));
58  }
59  }
60  }
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.
Address of PMT in detector data structure.
Definition: JPMTAddress.hh:35
JTOOLS::JRouter< JPMTAddress > router
Definition: JPMTRouter.hh:218
JReference< const JDetector > JReference_t
Definition: JPMTRouter.hh:39
JDetector::const_iterator const_iterator
Definition: JPMTRouter.hh:43

Member Function Documentation

◆ getPMTRouter()

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

Get PMT router.

Returns
PMT router

Definition at line 68 of file JPMTRouter.hh.

69  {
70  return static_cast<const JPMTRouter&>(*this);
71  }
Router for direct addressing of PMT data in detector data structure.
Definition: JPMTRouter.hh:37

◆ getAddress()

const JPMTAddress& JDETECTOR::JPMTRouter::getAddress ( const JObjectID id) const
inline

Get address of PMT.

Parameters
idPMT identifier
Returns
address

Definition at line 80 of file JPMTRouter.hh.

81  {
82  return router.get(id.getID());
83  }

◆ getPMT() [1/2]

const JPMT& JDETECTOR::JPMTRouter::getPMT ( const JPMTAddress address) const
inline

Get PMT.

Parameters
addressPMT address
Returns
PMT

Definition at line 92 of file JPMTRouter.hh.

93  {
94  return getReference().getPMT(address);
95  }
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38

◆ getPMT() [2/2]

const JPMT& JDETECTOR::JPMTRouter::getPMT ( const JObjectID id) const
inline

Get PMT.

Parameters
idPMT identifier
Returns
PMT

Definition at line 104 of file JPMTRouter.hh.

105  {
106  return getReference().getPMT(this->getAddress(id));
107  }
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
Definition: JPMTRouter.hh:80

◆ hasPMT()

bool JDETECTOR::JPMTRouter::hasPMT ( const JObjectID id) const
inline

Has PMT.

Parameters
idPMT identifier
Returns
true if PMT present; else false

Definition at line 116 of file JPMTRouter.hh.

117  {
118  return router.has(id.getID());
119  }

◆ getIdentifier() [1/2]

JPMTIdentifier JDETECTOR::JPMTRouter::getIdentifier ( const JPMTAddress address) const
inline

Get identifier of PMT.

Parameters
addressPMT address
Returns
address

Definition at line 128 of file JPMTRouter.hh.

129  {
130  return JPMTIdentifier(getModule(address), address.second);
131  }
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:152

◆ getIdentifier() [2/2]

JPMTIdentifier JDETECTOR::JPMTRouter::getIdentifier ( const JObjectID id) const
inline

Get identifier of PMT.

Parameters
idPMT identifier
Returns
address

Definition at line 140 of file JPMTRouter.hh.

141  {
142  return getIdentifier(this->getAddress(id));
143  }
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
Definition: JPMTRouter.hh:128

◆ getModule()

const JModule& JDETECTOR::JPMTRouter::getModule ( const JModuleAddress address) const
inline

Get module.

Parameters
addressmodule address
Returns
module

Definition at line 152 of file JPMTRouter.hh.

153  {
154  return getReference().getModule(address);
155  }

◆ getParentModule()

const JModule& JDETECTOR::JPMTRouter::getParentModule ( const JObjectID id) const
inline

Get parent module.

Parameters
idPMT identifier
Returns
module

Definition at line 164 of file JPMTRouter.hh.

165  {
166  return getModule(this->getAddress(id));
167  }

◆ getParentModuleID()

int JDETECTOR::JPMTRouter::getParentModuleID ( const JObjectID id) const
inline

Get parent module identifier.

Parameters
idPMT identifier
Returns
module identifier

Definition at line 176 of file JPMTRouter.hh.

177  {
178  return getParentModule(id).getID();
179  }
const JModule & getParentModule(const JObjectID &id) const
Get parent module.
Definition: JPMTRouter.hh:164
int getID() const
Get identifier.
Definition: JObjectID.hh:50

◆ getPMTChannel() [1/2]

JPMTChannel JDETECTOR::JPMTRouter::getPMTChannel ( const JPMTAddress address) const
inline

Get PMT channel.

Parameters
addressPMT address
Returns
PMT channel

Definition at line 188 of file JPMTRouter.hh.

189  {
190  return JPMTChannel(getModule(address).getLocation(), address.second);
191  }
Auxiliary class to uniquely identify PMT readout channel.
Definition: JPMTChannel.hh:35

◆ getPMTChannel() [2/2]

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:188

◆ getUTMPosition()

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  }
const JPMT & getPMT(const JPMTAddress &address) const
Get PMT.
Definition: JPMTRouter.hh:92
JPosition3D getPosition(const JModule &first, const JModule &second)
Get position to go from first to second module.

◆ getReference() [1/2]

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

◆ getReference() [2/2]

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  }

◆ is_valid()

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  }

◆ operator->() [1/2]

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  }

◆ operator->() [2/2]

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  }

◆ operator*() [1/2]

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  }

◆ operator*() [2/2]

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  }

Member Data Documentation

◆ router

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

Definition at line 218 of file JPMTRouter.hh.

◆ __object

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: