Jpp  18.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
JDETECTOR::JModuleMapper< JAttributes_t > Class Template Reference

Mapper for directly addressing of associated modules in the detector data structure. More...

#include <JModuleMapper.hh>

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

Public Types

typedef JModuleAttributes
< JAttributes_t > 
moduleattributes_type
 Type definition of module data. More...
 
typedef std::vector
< moduleattributes_type
container_type
 Type definition of a list with module data. More...
 
typedef JDetector::const_iterator const_iterator
 

Public Member Functions

 JModuleMapper (const JDetector &detector)
 Constructor. More...
 
 JModuleMapper (const JModuleRouter &router)
 Constructor. More...
 
template<class JMatch_t >
 JModuleMapper (const JDetector &detector, JMatch_t match)
 Constructor. More...
 
template<class JMatch_t >
 JModuleMapper (const JModuleRouter &router, JMatch_t match)
 Constructor. More...
 
const container_typegetList (const JObjectID &id) const
 Get list with module data matching given module. More...
 
template<class JMatch_t >
void configure (JMatch_t match)
 Configure this module mapper. More...
 
const JModuleRoutergetModuleRouter () const
 Get module router. More...
 
const JModuleAddressgetAddress (const JObjectID &id) const
 Get address of module. More...
 
const JModulegetModule (const JObjectID &id) const
 Get module parameters. More...
 
bool hasModule (const JObjectID &id) const
 Has module. More...
 
const int getIndex (const JObjectID &id) const
 Get index of module. More...
 
bool hasPMT (const JPMTIdentifier &id) const
 Has PMT. More...
 
const JPMTgetPMT (const JPMTIdentifier &id) const
 Get PMT parameters. More...
 
JUTMPosition getUTMPosition (const JObjectID &id) const
 Get UTM position of given module 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

std::vector< container_typezmap
 
JClass_t & __object
 

Detailed Description

template<class JAttributes_t = JNullType>
class JDETECTOR::JModuleMapper< JAttributes_t >

Mapper for directly addressing of associated modules in the detector data structure.

The template argument refers to the module attributes. Note that, by construction, a module will not be assiciated to itself.

Definition at line 162 of file JModuleMapper.hh.

Member Typedef Documentation

template<class JAttributes_t = JNullType>
typedef JModuleAttributes<JAttributes_t> JDETECTOR::JModuleMapper< JAttributes_t >::moduleattributes_type

Type definition of module data.

Definition at line 169 of file JModuleMapper.hh.

template<class JAttributes_t = JNullType>
typedef std::vector<moduleattributes_type> JDETECTOR::JModuleMapper< JAttributes_t >::container_type

Type definition of a list with module data.

Definition at line 174 of file JModuleMapper.hh.

typedef JDetector::const_iterator JDETECTOR::JModuleRouter::const_iterator
inherited

Definition at line 44 of file JModuleRouter.hh.

Constructor & Destructor Documentation

template<class JAttributes_t = JNullType>
JDETECTOR::JModuleMapper< JAttributes_t >::JModuleMapper ( const JDetector detector)
inline

Constructor.

Parameters
detectordetector

Definition at line 182 of file JModuleMapper.hh.

182  :
183  JModuleRouter(detector)
184  {
185  configure(JMaximalDistance(std::numeric_limits<double>::max()));
186  }
void configure(JMatch_t match)
Configure this module mapper.
JModuleRouter(const JDetector &detector)
Constructor.
Auxiliary class to match modules according maximal distance.
template<class JAttributes_t = JNullType>
JDETECTOR::JModuleMapper< JAttributes_t >::JModuleMapper ( const JModuleRouter router)
inline

Constructor.

Parameters
routermodule router

Definition at line 194 of file JModuleMapper.hh.

194  :
195  JModuleRouter(router)
196  {
197  configure(JMaximalDistance(std::numeric_limits<double>::max()));
198  }
void configure(JMatch_t match)
Configure this module mapper.
JModuleRouter(const JDetector &detector)
Constructor.
Auxiliary class to match modules according maximal distance.
template<class JAttributes_t = JNullType>
template<class JMatch_t >
JDETECTOR::JModuleMapper< JAttributes_t >::JModuleMapper ( const JDetector detector,
JMatch_t  match 
)
inline

Constructor.

The argument matchrefers to a template which should implement the following operator:

      bool operator()(const JModule& first, const JModule& second);
Parameters
detectordetector
matchmodule matcher

Definition at line 213 of file JModuleMapper.hh.

213  :
214  JModuleRouter(detector)
215  {
216  configure(match);
217  }
void configure(JMatch_t match)
Configure this module mapper.
JModuleRouter(const JDetector &detector)
Constructor.
template<class JAttributes_t = JNullType>
template<class JMatch_t >
JDETECTOR::JModuleMapper< JAttributes_t >::JModuleMapper ( const JModuleRouter router,
JMatch_t  match 
)
inline

Constructor.

The argument matchrefers to a template which should implement the following operator:

      bool operator()(const JModule& first, const JModule& second);
Parameters
routermodule router
matchmodule matcher

Definition at line 232 of file JModuleMapper.hh.

232  :
233  JModuleRouter(router)
234  {
235  configure(match);
236  }
void configure(JMatch_t match)
Configure this module mapper.
JModuleRouter(const JDetector &detector)
Constructor.

Member Function Documentation

template<class JAttributes_t = JNullType>
const container_type& JDETECTOR::JModuleMapper< JAttributes_t >::getList ( const JObjectID id) const
inline

Get list with module data matching given module.

Parameters
idmodule identifier
Returns
module data

Definition at line 245 of file JModuleMapper.hh.

246  {
247  return zmap[this->getAddress(id).first];
248  }
int first
index of module in detector data structure
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
std::vector< container_type > zmap
template<class JAttributes_t = JNullType>
template<class JMatch_t >
void JDETECTOR::JModuleMapper< JAttributes_t >::configure ( JMatch_t  match)
inline

Configure this module mapper.

The argument matchrefers to a template which should implement the following operator:

      bool operator()(const JModule& first, const JModule& second);
Parameters
matchmodule matcher

Definition at line 262 of file JModuleMapper.hh.

263  {
264  const JDetector& detector = this->getReference();
265 
266  zmap.resize(detector.size());
267 
268  for (typename std::vector<container_type>::iterator i = zmap.begin(); i != zmap.end(); ++i) {
269  i->clear();
270  }
271 
272  for (int i = 0; i != (int) detector.size(); ++i) {
273  for (int j = i; ++j != (int) detector.size(); ) {
274  if (match(detector[i], detector[j])) {
275  zmap[i].push_back(moduleattributes_type(j, detector[i], detector[j]));
276  zmap[j].push_back(moduleattributes_type(i, detector[j], detector[i]));
277  }
278  }
279  }
280  }
JModuleAttributes< JAttributes_t > moduleattributes_type
Type definition of module data.
Detector data structure.
Definition: JDetector.hh:89
const JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
int j
Definition: JPolint.hh:703
do set_variable DETECTOR_TXT $WORKDIR detector
std::vector< container_type > zmap
const JModuleRouter& JDETECTOR::JModuleRouter::getModuleRouter ( ) const
inlineinherited

Get module router.

Returns
module router

Definition at line 67 of file JModuleRouter.hh.

68  {
69  return static_cast<const JModuleRouter&>(*this);
70  }
Router for direct addressing of module data in detector data structure.
const JModuleAddress& JDETECTOR::JModuleRouter::getAddress ( const JObjectID id) const
inlineinherited

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  }
JTOOLS::JRouter< JModuleAddress > router
const JModule& JDETECTOR::JModuleRouter::getModule ( const JObjectID id) const
inlineinherited

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 JClass_t & getReference() const
Get reference to object.
Definition: JReference.hh:38
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
bool JDETECTOR::JModuleRouter::hasModule ( const JObjectID id) const
inlineinherited

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  }
JTOOLS::JRouter< JModuleAddress > router
const int JDETECTOR::JModuleRouter::getIndex ( const JObjectID id) const
inlineinherited

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
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
bool JDETECTOR::JModuleRouter::hasPMT ( const JPMTIdentifier id) const
inlineinherited

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  }
const JModule & getModule(const JObjectID &id) const
Get module parameters.
bool hasModule(const JObjectID &id) const
Has module.
const JPMT& JDETECTOR::JModuleRouter::getPMT ( const JPMTIdentifier id) const
inlineinherited

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 JModule & getModule(const JObjectID &id) const
Get module parameters.
const JPMT & getPMT(const int index) const
Get PMT.
Definition: JModule.hh:173
JUTMPosition JDETECTOR::JModuleRouter::getUTMPosition ( const JObjectID id) const
inlineinherited

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  }
const JModule & getModule(const JObjectID &id) const
Get module parameters.
JPosition3D getPosition(const JModule &first, const JModule &second)
Get position to go from first to second module.
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

template<class JAttributes_t = JNullType>
std::vector<container_type> JDETECTOR::JModuleMapper< JAttributes_t >::zmap
protected

Definition at line 284 of file JModuleMapper.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: