39 int main(
int argc,
char **argv)
43 using namespace KM3NETDAQ;
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();
89 timer->tm_sec -= elapsedTime;
96 catch (
const exception& error) {
97 FATAL(error.what() << endl);
115 ifstream ifs(inputFile.c_str());
124 if (i0 != js.cend()) {
126 istringstream iss(i0->get<
string>());
133 json::const_iterator i1 = js.find(
Data_t);
135 if ((DBAPIVersion.getMajorVersion() == 2) &&
136 (i1 != js.cend() && i1->size() > 0)) {
138 DBTestType = (*i1)[0].at(
Test_t +
Type_t).get<
string>();
156 RIGHT(20) <<
"HV" <<
RIGHT (10) <<
"gain" <<
RIGHT(10) <<
"status" << endl);
158 for (JHVCalibration::const_iterator it = HVcals.cbegin(); it != HVcals.cend(); ++it) {
166 if (it->result !=
OK_t) {
170 NOTICE(
LEFT (30) << pmtUPI <<
"(a.k.a. " << pmtID <<
" / " << location <<
"):" <<
171 FIXED(20,1) << it->supplyVoltage <<
RIGHT(10) << it->result << endl);
178 ERROR(inputFile <<
" is not a JSON file." << endl);
187 NOTICE(endl <<
FILL(105,
'-') <<
" List of failures" << setfill(
' ') << endl);
191 Nfailed += i->second.size();
196 WARNING(
"No successful calibrations found for module " << i->first <<
" (dead module?)" << endl);
200 for (JHVCalibration::const_iterator
j = i->second.cbegin();
j != i->second.cend(); ++
j) {
202 const JUPI_t& pmtUPI =
j->getUPI();
208 NOTICE(
LEFT(30) << pmtUPI <<
"(a.k.a. " << pmtID <<
" / " << location <<
"):" <<
209 right <<
FIXED(20,1) <<
j->supplyVoltage <<
RIGHT(10) <<
j->result << endl);
216 NOTICE(endl <<
FILL(105,
'-') <<
" SUMMARY" << setfill(
' ') << endl);
217 NOTICE(
LEFT(40) <<
"Number of evaluated PMTs:" <<
RIGHT(20) << Ntotal << endl);
218 NOTICE(
LEFT(40) <<
"Number of successful evaluations:" <<
RIGHT(20) << Ntotal - Nfailed << endl);
219 NOTICE(
LEFT(40) <<
"Number of failed evaluations:" <<
RIGHT(20) << Nfailed << endl);
220 NOTICE(
RIGHT(20) <<
'-' <<
LEFT(20) <<
" in missing modules:" <<
RIGHT(20) << Nmissing << endl);
221 NOTICE(
RIGHT(20) <<
'-' <<
LEFT(20) <<
" other:" <<
RIGHT(20) << Nfailed - Nmissing << endl << endl);
228 if (DBAPIVersion.getMajorVersion() == 2) {
249 js[
Start_t] = timer.toString(format);
250 js[
End_t] = timer().toString(format);
265 ofs << setw(2) << setprecision(8);
static JDBTestTypesTuneHV & getDBVersionTuneHV
Function object for looking up the HV-tuning database version number corresponding to a specific test...
Router for direct addressing of PMT data in detector data structure.
then usage $script< detector file > minrun maxrun report nIn case of failures
Utility class to parse command line options.
static const std::string UUID_t
int main(int argc, char *argv[])
int getFloor() const
Get floor number.
Data structure for a composite optical module.
int getNumber() const
Get serial number.
static const std::string Time_t
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
static const std::string Tests_t
static const std::string OK_t
int getModuleID() const
Get module identifier.
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.
Universal product identifier (UPI).
Auxiliary data structure for floating point format specification.
static const std::string Encoding_t
Data structure for detector geometry and calibration.
#define MAKE_STRING(A)
Make string.
int getTDC() const
Get TDC.
const JUPI_t & getUPI() const
Get UPI.
static const std::string Provenance_t
Auxiliary data structure for alignment of data.
static const std::string Arguments_t
static const std::string Configuration_t
I/O formatting auxiliaries.
Auxiliary data structure for location of product in detector.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary data structure for I/O of database API versions.
const JModule & getParentModule(const JObjectID &id) const
Get parent module.
static const std::string Code_t
static const std::string Test_t
static const std::string Info_t
static const std::string Message_t
Direct access to PMT in detector data structure.
General purpose messaging.
Auxiliary data structure for sequence of same character.
int getString() const
Get string number.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxililary class to get date and time.
Utility class to parse command line options.
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
do set_variable DETECTOR_TXT $WORKDIR detector
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
static const std::string Data_t
static const std::string End_t
static const std::string Start_t
Specifications of file name extensions.
bool isJSONFile(const char *file_name)
Check file format.