Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JDETECTOR::JModuleRouter Class Reference

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

#include <JModuleRouter.hh>

Inheritance diagram for JDETECTOR::JModuleRouter:
JLANG::JReference< JClass_t > JDETECTOR::JModuleMapper< JAttributes > JDETECTOR::JDAQHitRouter JDETECTOR::JModuleMapper< JAttributes_t >

Public Types

typedef JDetector::const_iterator const_iterator
 

Public Member Functions

 JModuleRouter (const JDetector &detector)
 Constructor.
 
const JModuleRoutergetModuleRouter () const
 Get module router.
 
const JModuleAddressgetAddress (const JObjectID &id) const
 Get address of module.
 
const JModulegetModule (const JObjectID &id) const
 Get module parameters.
 
bool hasModule (const JObjectID &id) const
 Has module.
 
const int getIndex (const JObjectID &id) const
 Get index of module.
 
bool hasPMT (const JPMTIdentifier &id) const
 Has PMT.
 
const JPMTgetPMT (const JPMTIdentifier &id) const
 Get PMT parameters.
 
JUTMPosition getUTMPosition (const JObjectID &id) const
 Get UTM position of given module identifier.
 
const JClass_t & getReference () const
 Get reference to object.
 
JClass_t & getReference ()
 Get reference to object.
 
bool is_valid () const
 Check validity of reference.
 
const JClass_t * operator-> () const
 Smart pointer.
 
JClass_t * operator-> ()
 Smart pointer.
 
const JClass_t & operator* () const
 Dereference operator.
 
JClass_t & operator* ()
 Dereference operator.
 

Protected Attributes

JClass_t & __object
 

Private Types

typedef JReference< const JDetectorJReference_t
 

Private Attributes

JTOOLS::JRouter< JModuleAddressrouter
 

Detailed Description

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

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

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

Definition at line 36 of file JModuleRouter.hh.

Member Typedef Documentation

◆ JReference_t

◆ const_iterator

JDetector::const_iterator JDETECTOR::JModuleRouter::const_iterator

Definition at line 44 of file JModuleRouter.hh.

Constructor & Destructor Documentation

◆ JModuleRouter()

JDETECTOR::JModuleRouter::JModuleRouter ( const JDetector & detector)
inline

Constructor.

Parameters
detectordetector

Definition at line 52 of file JModuleRouter.hh.

52 :
53 JReference_t(detector),
54 router(JModuleAddress(-1))
55 {
56 for (const_iterator module = detector.begin(); module != detector.end(); ++module) {
57 router.put(module->getID(), JModuleAddress(std::distance(detector.begin(), module)));
58 }
59 }
JDetector::const_iterator const_iterator
JReference< const JDetector > JReference_t
JTOOLS::JRouter< JModuleAddress > router

Member Function Documentation

◆ getModuleRouter()

const JModuleRouter & JDETECTOR::JModuleRouter::getModuleRouter ( ) const
inline

Get module router.

Returns
module router

Definition at line 67 of file JModuleRouter.hh.

68 {
69 return static_cast<const JModuleRouter&>(*this);
70 }
JModuleRouter(const JDetector &detector)
Constructor.

◆ getAddress()

const JModuleAddress & JDETECTOR::JModuleRouter::getAddress ( const JObjectID & id) const
inline

Get address of module.

Parameters
idmodule identifier
Returns
address

Definition at line 79 of file JModuleRouter.hh.

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

◆ getModule()

const JModule & JDETECTOR::JModuleRouter::getModule ( const JObjectID & id) const
inline

Get module parameters.

Parameters
idmodule identifier
Returns
module parameters

Definition at line 91 of file JModuleRouter.hh.

92 {
93 return getReference().getModule(this->getAddress(id));
94 }
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
const JClass_t & getReference() const
Get reference to object.
Definition JReference.hh:38

◆ hasModule()

bool JDETECTOR::JModuleRouter::hasModule ( const JObjectID & id) const
inline

Has module.

Parameters
idmodule identifier
Returns
true if module present; else false

Definition at line 103 of file JModuleRouter.hh.

104 {
105 return router.has(id.getID());
106 }

◆ getIndex()

const int JDETECTOR::JModuleRouter::getIndex ( const JObjectID & id) const
inline

Get index of module.

Parameters
idmodule identifier
Returns
index

Definition at line 115 of file JModuleRouter.hh.

116 {
117 return getAddress(id).first;
118 }
int first
index of module in detector data structure

◆ hasPMT()

bool JDETECTOR::JModuleRouter::hasPMT ( const JPMTIdentifier & id) const
inline

Has PMT.

Parameters
idPMT identifier
Returns
true if PMT present; else false

Definition at line 127 of file JModuleRouter.hh.

128 {
129 return hasModule(id.getID()) && id.getPMTAddress() >= 0 && id.getPMTAddress() < (int) getModule(id.getID()).size();
130 }
bool hasModule(const JObjectID &id) const
Has module.
const JModule & getModule(const JObjectID &id) const
Get module parameters.

◆ getPMT()

const JPMT & JDETECTOR::JModuleRouter::getPMT ( const JPMTIdentifier & id) const
inline

Get PMT parameters.

Parameters
idPMT identifier
Returns
PMT parameters

Definition at line 139 of file JModuleRouter.hh.

140 {
141 return getModule(id.getID()).getPMT(id.getPMTAddress());
142 }
const JPMT & getPMT(const int index) const
Get PMT.
Definition JModule.hh:172

◆ getUTMPosition()

JUTMPosition JDETECTOR::JModuleRouter::getUTMPosition ( const JObjectID & id) const
inline

Get UTM position of given module identifier.

Parameters
idmodule identifier
Returns
UTM position

Definition at line 151 of file JModuleRouter.hh.

152 {
153 return JUTMPosition(getModule(id).getPosition() + getReference().getPosition());
154 }
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

◆ 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<JModuleAddress> JDETECTOR::JModuleRouter::router
private

Definition at line 157 of file JModuleRouter.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: