39 int main(
int argc,
char **argv)
63 JParser<> zap(
"Auxiliary program to print high-voltage tuning results.");
65 zap[
'f'] =
make_field(inputFile,
"input file (JSON output of JTuneHV)");
66 zap[
'a'] =
make_field(detectorFile,
"detector file");
67 zap[
'o'] =
make_field(
outputFile,
"output file (for writing failed evaluations to separate JSON output)") =
"";
73 }
catch(
const exception &error) {
75 FATAL(error.what() << endl);
78 if (!
outputFile.empty() && (login.empty() || locationID.empty())) {
80 FATAL(
"Missing user information (please specify via -#login and -#locationID).");
84 const JUUID& UUID = JUUID::rndm();
88 timer.
sub(elapsedTime);
95 catch (
const exception& error) {
96 FATAL(error.what() << endl);
114 ifstream ifs(inputFile.c_str());
123 if (i0 != js.cend()) {
125 istringstream iss(i0->get<
string>());
132 json::const_iterator i1 = js.find(
Data_t);
135 (i1 != js.cend() && i1->size() > 0)) {
137 DBTestType = (*i1)[0].at(
Test_t +
Type_t).get<
string>();
155 RIGHT(20) <<
"HV" <<
RIGHT (10) <<
"gain" <<
RIGHT(10) <<
"status" << endl);
157 for (JHVCalibration::const_iterator it = HVcals.cbegin(); it != HVcals.cend(); ++it) {
165 if (it->result !=
OK_t) {
169 NOTICE(
LEFT (30) << pmtUPI <<
"(a.k.a. " << pmtID <<
" / " << location <<
"):" <<
170 FIXED(20,1) << it->supplyVoltage <<
RIGHT(10) << it->result << endl);
177 ERROR(inputFile <<
" is not a JSON file." << endl);
186 NOTICE(endl <<
FILL(105,
'-') <<
" List of failures" << setfill(
' ') << endl);
190 Nfailed += i->second.size();
195 WARNING(
"No successful calibrations found for module " << i->first <<
" (dead module?)" << endl);
199 for (JHVCalibration::const_iterator
j = i->second.cbegin();
j != i->second.cend(); ++
j) {
201 const JUPI_t& pmtUPI =
j->getUPI();
207 NOTICE(
LEFT(30) << pmtUPI <<
"(a.k.a. " << pmtID <<
" / " << location <<
"):" <<
208 right <<
FIXED(20,1) <<
j->supplyVoltage <<
RIGHT(10) <<
j->result << endl);
210 failures.push_back(*
j);
215 NOTICE(endl <<
FILL(105,
'-') <<
" SUMMARY" << setfill(
' ') << endl);
216 NOTICE(
LEFT(40) <<
"Number of evaluated PMTs:" <<
RIGHT(20) << Ntotal << endl);
217 NOTICE(
LEFT(40) <<
"Number of successful evaluations:" <<
RIGHT(20) << Ntotal - Nfailed << endl);
218 NOTICE(
LEFT(40) <<
"Number of failed evaluations:" <<
RIGHT(20) << Nfailed << endl);
219 NOTICE(
RIGHT(20) <<
'-' <<
LEFT(20) <<
" in missing modules:" <<
RIGHT(20) << Nmissing << endl);
220 NOTICE(
RIGHT(20) <<
'-' <<
LEFT(20) <<
" other:" <<
RIGHT(20) << Nfailed - Nmissing << endl << endl);
264 ofs << setw(2) << setprecision(8);
KM3NeT DAQ constants, bit handling, etc.
Data structure for detector geometry and calibration.
Specifications of file name extensions.
General purpose messaging.
Direct access to PMT in detector data structure.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int main(int argc, char **argv)
I/O formatting auxiliaries.
#define MAKE_STRING(A)
Make string.
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
int getFloor() const
Get floor number.
int getString() const
Get string number.
Data structure for a composite optical module.
int getModuleID() const
Get module identifier.
int getTDC() const
Get TDC.
Router for direct addressing of PMT data in detector data structure.
const JModule & getParentModule(const JObjectID &id) const
Get parent module.
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
Utility class to parse parameter values.
Utility class to parse command line options.
static JDBTestTypesTuneHV & getDBVersionTuneHV
Function object for looking up the HV-tuning database version number corresponding to a specific test...
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const std::string Tests_t
static const std::string APIVersion_t
static const std::string User_t
static const std::string Encoding_t
static const std::string Message_t
static const std::string UUID_t
static const std::string Code_t
static const std::string Location_t
static const std::string Time_t
static const std::string Data_t
static const std::string Test_t
static const std::string OK_t
static const std::string Arguments_t
static const std::string Configuration_t
static const std::string End_t
static const std::string Provenance_t
static const std::string Info_t
static const std::string Error_t
static const std::string Type_t
static const std::string Start_t
bool isJSONFile(const char *file_name)
Check file format.
KM3NeT DAQ data structures and auxiliaries.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Auxiliary data structure for alignment of data.
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
Auxiliary data structure for location of product in detector.
Universal product identifier (UPI).
const JUPI_t & getUPI() const
Get UPI.
int getNumber() const
Get serial number.
Auxiliary data structure for general purpose version number.
version_type getMajorVersion() const
Get major version.
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.