20 #include "JDB/JDBincludes.hh"
36 int main(
int argc,
char **argv)
52 JParser<> zap(
"Auxiliary program to merge high-voltage calibration results.");
57 zap[
'f'] =
make_field(inputFiles,
"input files");
63 }
catch(
const exception &error) {
65 FATAL(error.what() << endl);
77 JSelector selector = getSelector<JPersons>(
JDB::get()->User());
78 ResultSet& rs =
getResultSet(getTable<JPersons>(), selector);
82 }
catch (
const exception& error) {
84 FATAL(error.what() << endl);
96 ifstream ifs(fileIt->c_str());
103 if (DBtype != js.end()) {
105 testTypes.insert(DBtype->get<
string>());
109 WARNING(
"No database test type specified for " << *fileIt << endl);
114 json::const_iterator data = js.find(
Tests_t);
116 if (data != js.end()) {
122 WARNING(
"HV calibration data for " << *fileIt <<
"could not be found; skip." << endl);
126 for (JHVCalibration::const_iterator cal = HVcals.cbegin(); cal != HVcals.cend(); ++cal) {
128 if (find_if(merged.cbegin(), merged.cend(),
make_predicate(&JHVCalibration_t::getNumber, cal->getNumber())) == merged.cend()) {
129 merged.push_back(*cal);
135 WARNING(*fileIt <<
" is not a JSON file; skip" << endl);
140 if (testTypes.size() > 1) {
142 WARNING(
"Database test type is ambiguous; Assuming " << *testTypes.cbegin() << endl);
144 }
else if (testTypes.size() == 0) {
146 ERROR(
"No database test type specified.");
151 js[
User_t] = person.LOGIN;
160 ofs << setw(2) << setprecision(8);
Utility class to parse command line options.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
int main(int argc, char *argv[])
static const std::string Tests_t
T get(const JHead &header)
Get object from header.
static const std::string Location_t
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::vector< JHVCalibration_t > JHVCalibration
PMT high voltage calibration.
static const std::string Test_t
General purpose messaging.
static const std::string EndTime_t
Utility class to parse command line options.
static const std::string Type_t
ResultSet & getResultSet(const std::string &query)
Get result set.
static const std::string StartTime_t
static const std::string User_t
Detector calibration key words for JSON I/O.
Specifications of file name extensions.
bool isJSONFile(const char *file_name)
Check file format.