1#ifndef __JDETECTOR__JMODULEADDRESSMAP__
2#define __JDETECTOR__JMODULEADDRESSMAP__
34 public JMultiComparable<JPMTAddressTranslator, JTYPELIST<JPMTReadoutAddress, JPMTPhysicalAddress>::typelist>
70 std::string
toString(
const std::string& fmt,
const std::string target =
"%")
const
107 bool has(
const int index)
const
109 return (index >= 0 && index < (
int) this->size());
121 return (tdc >= 0 && tdc < (
int)
router.size() &&
router[tdc] != -1);
135 const_iterator p = lower_bound(this->begin(), this->end(), address, less<JPMTPhysicalAddress>());
137 return (p != this->end() && *p == address);
148 sort(this->begin(), this->end(), less<JPMTPhysicalAddress>());
150 for (const_iterator i = this->begin(); i != this->end(); ++i) {
152 if (i->tdc >= (
int)
router.size()) {
153 router.resize(i->tdc + 1, -1);
156 router[i->tdc] = std::distance(const_iterator(this->begin()),i);
167 void swap(
const int i1,
const int i2)
169 std::swap(
router[at(i1).tdc],
285 const_iterator p = lower_bound(this->begin(), this->end(), address, less<JPMTPhysicalAddress>());
287 if (p != this->end() && *p == address)
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Lookup table for PMT addresses in optical module.
void rotateL(const char ring)
Swap readout addresses by left rotation of physical addresses of PMTs in a given ring.
void swapPMT(const JPMTPhysicalAddress &pmt1, const JPMTPhysicalAddress &pmt2)
Swap readout addresses corresponding to PMTs.
void swap(const int i1, const int i2)
Swap readout addresses corresponding to indices.
void swapTDC(const int tdc1, const int tdc2)
Swap physical addresses corresponding to TDCs.
const JPMTAddressTranslator & getAddressTranslator(const int tdc) const
Get PMT address translator.
JModuleAddressMap()
Default constructor.
bool hasPMT(const JPMTPhysicalAddress &address) const
Test whether PMT is available.
const JPMTPhysicalAddress & getPMTPhysicalAddress(const int tdc) const
Get PMT physical address.
void configure()
Configure internal router.
std::vector< int > router
const JPMTReadoutAddress & getPMTReadoutAddress(const JPMTPhysicalAddress &address) const
Get PMT readout address.
const JPMTAddressTranslator & getAddressTranslator(const JPMTPhysicalAddress &address) const
Get PMT address translator.
int getIndex(const int tdc) const
Get PMT logical index for given TDC channel.
bool hasTDC(const int tdc) const
Test whether TDC is available.
void rotateR(const char ring)
Swap readout addresses by right rotation of physical addresses of PMTs in a given ring.
bool has(const int index) const
Test whether index is available.
Data structure for PMT physical address.
char ring
ring number ['A','F']
int position
position within ring [1,6]
Data structure for PMT readout address.
Exception for accessing an index in a collection that is outside of its range.
Wrapper class around STL string class.
JString & replace(const char target, const char replacement, const std::size_t max=std::numeric_limits< std::size_t >::max())
Replace characters.
file Auxiliary data structures and methods for detector calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Data structure to translate PMT physical to readout address.
std::string toString(const std::string &fmt, const std::string target="%") const
Convert PMT address translator to string.
std::string toString() const
Convert PMT address translator to string.
JPMTAddressTranslator(const JPMTReadoutAddress &readout, const JPMTPhysicalAddress &address)
Constructor.
Template definition of auxiliary base class for composite data structures composed of base classes wi...
Auxiliary class for recursive type list generation.