195 typedef JHVTable::JHVTableTypes JHVTableType_t;
208 double minHV = -1500;
209 double maxHV = - 800;
226 JParser<> zap(
"Auxiliary program to treat failed high-voltage tuning results.");
228 zap[
'f'] =
make_field(inputFile,
"input file");
238 }
catch(
const exception &error) {
240 FATAL(error.what() << endl);
243 if (login.empty() || locationID.empty()) {
244 FATAL(
"Missing user information (please specify via -#login and -#locationID).");
248 const JUUID& UUID = JUUID::rndm();
253 timer->tm_sec -= elapsedTime;
258 JDBAPIVersion DBAPIVersion;
260 string metaInfoStr =
MAKE_STRING(JMeta(argc, argv));
268 ifstream ifs(inputFile.c_str());
277 if (i0 != js.cend()) {
279 istringstream iss(i0->get<
string>());
286 json::const_iterator i1 = js.find(
Data_t);
288 if ((DBAPIVersion.getMajorVersion() == 2) &&
289 (i1 != js.cend() && i1->size() > 0)) {
291 DBTestType = (*i1)[0].at(
Test_t +
Type_t).get<
string>();
309 if (pmtSet.empty()) {
311 for (JHVCalibration::iterator it = HVcals.begin(); it != HVcals.end(); ++it) {
313 if (it->result !=
OK_t) {
314 toEdit.push_back(*it);
322 JHVCalibration::iterator pmt = find_if(HVcals.begin(), HVcals.end(),
324 if (pmt != HVcals.end()) {
326 if (pmt->result ==
OK_t) {
327 WARNING(
"Editing " <<
OK_t <<
" result for " << pmt->getUPI() << endl);
330 toEdit.push_back(*pmt);
337 ERROR(inputFile <<
" is not a JSON file." << endl);
341 if (!HVtable.second.empty()) {
343 NOTICE(
"Setting " << (HVtable.first == JHVTableType_t::VENDOR_HV ?
"vendor " :
"run-specific ") <<
344 "PMT high-voltages from file " << HVtable.second <<
"..." << endl);
346 JHVTable getHV(HVtable.second.c_str(), HVtable.first);
348 for (JHVCalibration::iterator i = toEdit.begin(); i != toEdit.end(); ++i) {
350 const JUPI_t& upi = i->getUPI();
351 const double HV = getHV(upi.getNumber());
353 if (HV > minHV && HV < maxHV) {
355 i->supplyVoltage = getHV(upi.getNumber());
360 WARNING(
"Invalid high-voltage for PMT " << upi <<
" (" <<
FIXED(7,1) << HV <<
361 " not within [ " <<
FIXED(7,1) << minHV <<
", " <<
FIXED(7,1) << maxHV <<
"]); skip." << endl);
367 NOTICE(
"Setting high-voltages manually..." << endl);
369 for (JHVCalibration::iterator i = toEdit.begin(); i != toEdit.end(); ++i) {
371 NOTICE(
"Please specify high-voltage for " <<
RIGHT(30) << i->getUPI() <<
":" << endl);
376 while (manualHV < minHV || manualHV > maxHV) {
378 WARNING(
"Specified high-voltage is not within range [" <<
379 FIXED(7,1) << minHV <<
", " <<
FIXED(7,1) << maxHV <<
380 "]; Please specify again." << endl);
385 i->supplyVoltage = manualHV;
393 if (DBAPIVersion.getMajorVersion() == 2) {
414 js[
Start_t] = timer.toString(format);
415 js[
End_t] = timer().toString(format);
431 ofs << setw(2) << setprecision(8);
static JDBTestTypesTuneHV & getDBVersionTuneHV
Function object for looking up the HV-tuning database version number corresponding to a specific test...
Utility class to parse command line options.
static const std::string UUID_t
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
static const std::string Time_t
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
static const std::string Tests_t
static const std::string OK_t
Utility class to parse parameter values.
static const std::string Location_t
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
JDateAndTimeFormat
Date and time formats.
Auxiliary data structure for floating point format specification.
static const std::string Encoding_t
#define MAKE_STRING(A)
Make string.
static const std::string Provenance_t
static const std::string Arguments_t
static const std::string Configuration_t
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< JHVCalibration_t > JHVCalibration
PMT high voltage calibration.
static const std::string Code_t
static const std::string Test_t
static const std::string Info_t
static const std::string Message_t
static const std::string Type_t
static const std::string APIVersion_t
static const std::string User_t
Detector calibration key words for JSON I/O.
static const std::string Error_t
static const std::string Data_t
static const std::string End_t
static const std::string Start_t
bool isJSONFile(const char *file_name)
Check file format.