1#ifndef __JCALIBRATE_JTDC_t__
2#define __JCALIBRATE_JTDC_t__
29 using KM3NETDAQ::NUMBER_OF_PMTS;
65 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
66 multimap_type::insert(value_type(value.first, pmt));
71 multimap_type::insert(value);
85 void insert(
const int id,
const int tdc)
87 this->
insert(value_type(
id, tdc));
102 range_type range = multimap_type::equal_range(
id);
104 if (range.first == range.second) {
105 range = multimap_type::equal_range(
WILDCARD);
119 bool has(
const int id,
const int tdc)
123 for (JTDC_t::const_iterator i = range.first; i != range.second; ++i) {
124 if (tdc == i->second) {
140 for (JTDC_t::const_iterator p = this->begin(); p != this->end(); ) {
142 JTDC_t::const_iterator q = p;
144 for ( ; q != this->end() && q->first == p->first; ++q) {}
146 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
148 JTDC_t::const_iterator i = p;
150 for ( ; i != q && i->second != pmt; ++i) {}
153 buffer.
insert(value_type(p->first, pmt));
172 for (const_iterator i = this->begin(); i != this->end(); ++i) {
183 if (i->second < 0 || i->second >= NUMBER_OF_PMTS) {
213 for (
int id, pmt; is >>
id >> pmt; ) {
214 tdc.
insert(JTDC_t::value_type(
id, pmt));
234 for (JTDC_t::const_iterator i = tdc.begin(); i != tdc.end(); ++i) {
235 out << setw(10) << i->first <<
' ' << setw(2) << i->second << endl;
KM3NeT DAQ constants, bit handling, etc.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
Exception for accessing a value in a collection that is outside of its range.
Auxiliary classes and methods for PMT calibration.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for TDC constraints.
std::multimap< int, int > multimap_type
range_type equal_range(const int id)
Get range of constraints for given module.
void reverse()
Reverse constraints.
void insert(const value_type &value)
Insert constraint.
std::pair< const_iterator, const_iterator > range_type
Type definition for range of TDC constraints of a given module identfier.
friend std::ostream & operator<<(std::ostream &out, const JTDC_t &tdc)
Write TDC constraints to output.
friend std::istream & operator>>(std::istream &in, JTDC_t &tdc)
Read TDC constraints from input.
bool has(const int id, const int tdc)
Check if TDC is constraint.
bool is_valid(const bool option=false) const
Check validity of TDC constrants.
void insert(const int id, const int tdc)
Insert constraint.