53 JHVTable(
const char*
const filename,
54 const JHVTableTypes type)
59 ifstream in(filename);
64 for (
string buffer;
getline(in, buffer); ) {
72 if (
entry.PMTSERIAL > 0 &&
73 entry.PMT_SUPPLY_VOLTAGE < 0) {
75 HVmap[
entry.PMTSERIAL] =
entry.PMT_SUPPLY_VOLTAGE;
85 for (
string buffer;
getline(in, buffer); ) {
96 if (
entry.PMTSERIAL > 0 &&
121 double operator()(
const int serialID)
128 if (p != HVmap.end()) {
147 inline std::istream&
operator>>(std::istream& in,
148 JHVTable::JHVTableTypes&
object) {
157 case int(JHVTable::VENDOR_HV):
158 object = JHVTable::VENDOR_HV;
160 case int(JHVTable::RUN_HV):
161 object = JHVTable::RUN_HV;
176 inline std::ostream&
operator<<(std::ostream& out,
177 JHVTable::JHVTableTypes
object) {
178 return out <<
int(
object);
207 double minHV = -1500;
208 double maxHV = - 800;
225 JParser<> zap(
"Auxiliary program to treat failed high-voltage tuning results.");
237 }
catch(
const exception &error) {
243 FATAL(
"Missing user information (please specify via -#login and -#locationID).");
247 const JUUID& UUID = JUUID::rndm();
262 if (isJSONFile(inputFile.c_str())) {
266 ifstream
ifs(inputFile.c_str());
273 json::const_iterator
i0 =
js.find(APIVersion_t);
275 if (
i0 !=
js.cend()) {
284 json::const_iterator
i1 =
js.find(Data_t);
287 (
i1 !=
js.cend() &&
i1->size() > 0)) {
289 DBTestType = (*i1)[0].at(Test_t + Type_t).get<
string>();
291 JHVCalibration_t::setVersion(getDBVersionTuneHV(
DBTestType));
294 metaInfoStr += (*i1)[0].at(Provenance_t + Info_t).at(Configuration_t).get<
string>();
300 JHVCalibration_t::setVersion(getDBVersionTuneHV(
DBTestType));
311 if (
it->result != OK_t) {
321 make_predicate(&JHVCalibration_t::getNumber,
it->getNumber()));
322 if (pmt !=
HVcals.end()) {
324 if (pmt->result == OK_t) {
325 WARNING(
"Editing " << OK_t <<
" result for " << pmt->getUPI() <<
endl);
335 ERROR(inputFile <<
" is not a JSON file." <<
endl);
341 NOTICE(
"Setting " << (
HVtable.first == JHVTableType_t::VENDOR_HV ?
"vendor " :
"run-specific ") <<
342 "PMT high-voltages from file " <<
HVtable.second <<
"..." <<
endl);
346 for (JHVCalibration::iterator i =
toEdit.begin(); i !=
toEdit.end(); ++i) {
349 const double HV = getHV(
upi.getNumber());
353 i->supplyVoltage = getHV(
upi.getNumber());
358 WARNING(
"Invalid high-voltage for PMT " <<
upi <<
" (" <<
FIXED(7,1) << HV <<
365 NOTICE(
"Setting high-voltages manually..." <<
endl);
367 for (JHVCalibration::iterator i =
toEdit.begin(); i !=
toEdit.end(); ++i) {
369 NOTICE(
"Please specify high-voltage for " <<
RIGHT(30) << i->getUPI() <<
":" <<
endl);
376 WARNING(
"Specified high-voltage is not within range [" <<
378 "]; Please specify again." <<
endl);
393 json error = { {Message_t,
"" },
395 {Arguments_t, json::array() } };
403 {Start_t + Time_t, timer.
toString() },
404 {End_t + Time_t, timer().
toString() },
411 js[Error_t] =
json(error);
414 js[Data_t][0] =
json(data);
KM3NeT DAQ constants, bit handling, etc.
int main(int argc, char **argv)
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Specifications of file name extensions.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
#define MAKE_STRING(A)
Make string.
Utility class to parse parameter values.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Exception for accessing a value in a collection that is outside of its range.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Universal product identifier (UPI).
Auxiliary data structure for general purpose version number.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for date and time.
std::string toString() const
Get ASCII formatted date and time.
void sub(const time_t t1)
Subtract given time.
Auxiliary data structure for alignment of data.