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);
99 const JPMTRouter PMTrouter(
detector);
104 string metaInfoStr =
MAKE_STRING(JMeta(argc, argv));
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) {
159 const JUPI_t& pmtUPI = it->getUPI();
160 const JModule& module = PMTrouter.getParentModule(pmtUPI.getNumber());
161 const JPMTIdentifier& pmtID = PMTrouter.getIdentifier (pmtUPI.getNumber());
163 const JLocation_t location(module.getString(), module.getFloor(), pmtID.getTDC());
165 if (it->result !=
OK_t) {
166 failureMap[pmtID.getModuleID()].push_back(*it);
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();
202 const JModule& module = PMTrouter.getParentModule(pmtUPI.getNumber());
203 const JPMTIdentifier& pmtID = PMTrouter.getIdentifier (pmtUPI.getNumber());
205 const JLocation_t location(module.getString(), module.getFloor(), pmtID.getTDC());
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...
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
static const std::string Encoding_t
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object
JEEP::JVersion JDBAPIVersion
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)...
Auxiliary data structure for floating point format specification.
Data structure for detector geometry and calibration.
#define MAKE_STRING(A)
Make string.
static const std::string Time_t
Auxiliary data structure for alignment of data.
static const std::string APIVersion_t
I/O formatting auxiliaries.
static const std::string Configuration_t
static const std::string Test_t
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< JHVCalibration_t > JHVCalibration
PMT high voltage calibration.
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
static const std::string Data_t
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
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