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();
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);
134 if ((DBAPIVersion.getMajorVersion() == 2) &&
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);
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);
227 if (DBAPIVersion.getMajorVersion() == 2) {
248 js[
Start_t] = timer.toString();
249 js[
End_t] = timer().toString();
264 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
static const std::string Arguments_t
Utility class to parse command line options.
static const std::string Start_t
static const std::string Location_t
int main(int argc, char *argv[])
static const std::string Code_t
int getFloor() const
Get floor number.
Data structure for a composite optical module.
static const std::string Encoding_t
int getNumber() const
Get serial number.
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
int getModuleID() const
Get module identifier.
static const std::string Error_t
Utility class to parse parameter values.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Universal product identifier (UPI).
Auxiliary data structure for floating point format specification.
Data structure for detector geometry and calibration.
void sub(const time_t t1)
Subtract given time.
#define MAKE_STRING(A)
Make string.
static const std::string Time_t
int getTDC() const
Get TDC.
const JUPI_t & getUPI() const
Get UPI.
Auxiliary data structure for alignment of data.
static const std::string APIVersion_t
I/O formatting auxiliaries.
static const std::string Configuration_t
Auxiliary data structure for location of product in detector.
static const std::string Test_t
#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.
Direct access to PMT in detector data structure.
static const std::string End_t
static const std::string Info_t
General purpose messaging.
Auxiliary data structure for sequence of same character.
static const std::string Message_t
int getString() const
Get string number.
static const std::string Data_t
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Auxiliary class for date and time.
Utility class to parse command line options.
static const std::string Type_t
static const std::string Provenance_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 UUID_t
Specifications of file name extensions.
static const std::string Tests_t
bool isJSONFile(const char *file_name)
Check file format.
static const std::string OK_t
static const std::string User_t