1#ifndef __JCALIBRATE_JTDC_t__
2#define __JCALIBRATE_JTDC_t__
30 using KM3NETDAQ::NUMBER_OF_PMTS;
66 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
67 multimap_type::insert(value_type(value.first, pmt));
72 multimap_type::insert(value);
86 void insert(
const int id,
const int tdc)
88 this->
insert(value_type(
id, tdc));
103 range_type range = multimap_type::equal_range(
id);
105 if (range.first == range.second) {
106 range = multimap_type::equal_range(
WILDCARD);
120 bool has(
const int id,
const int tdc)
124 for (JTDC_t::const_iterator i = range.first; i != range.second; ++i) {
125 if (tdc == i->second) {
141 for (JTDC_t::const_iterator p = this->begin(); p != this->end(); ) {
143 JTDC_t::const_iterator q = p;
145 for ( ; q != this->end() && q->first == p->first; ++q) {}
147 for (
int pmt = 0; pmt != NUMBER_OF_PMTS; ++pmt) {
149 JTDC_t::const_iterator i = p;
151 for ( ; i != q && i->second != pmt; ++i) {}
154 buffer.
insert(value_type(p->first, pmt));
173 for (const_iterator i = this->begin(); i != this->end(); ++i) {
184 if (i->second < 0 || i->second >= NUMBER_OF_PMTS) {
212 if (getFileStatus(is.str().c_str())) {
218 for (
int id, pmt; is >>
id >> pmt; ) {
219 tdc.
insert(JTDC_t::value_type(
id, pmt));
239 for (JTDC_t::const_iterator i = tdc.begin(); i != tdc.end(); ++i) {
240 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.
void load()
Load data from file with name corresponding to current contents.
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.