41 JParser<> zap(
"Example program for compass calibration.");
47 zap[
'D'] =
make_field(detid,
"Detector identifier") =
"";
52 catch(
const exception &error) {
53 FATAL(error.what() << endl);
63 ResultSet& rs =
getResultSet(getTable<JAHRSCalibration>());
69 catch(
const exception& error) {
70 FATAL(error.what() << endl);
73 const JAHRSCalibrationValidity
is_valid;
82 DEBUG(
"Reading database table " << getTable<JDetectorIntegration_t>() << endl);
88 detid = getDetector<string>(detid);
90 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration_t>());
93 THROW(JDatabaseException,
"Error reading " << getTable<JDetectorIntegration_t>());
96 catch(
const exception& error) {
97 FATAL(error.what() << endl);
106 sort(calibration.begin(), calibration.end(), [](
const JAHRSCalibration&
first,
const JAHRSCalibration& second) {
return !JAHRSCalibrationComparator()(
first, second); });
115 for (++q; q != calibration.end() && q->SERIALNUMBER == p->SERIALNUMBER; ++q) {}
118 const JLocation_t location = router.getLocation(upi);
120 if (location.is_valid()) {
127 WARNING(
"AHRS " << location <<
' ' << upi <<
' '
128 <<
"invalid calibration" <<
' '
129 << p->TESTEND <<
" v" <<
getVersion(p->TESTNAME) <<
" -> "
130 << i->TESTEND <<
" v" <<
getVersion(i->TESTNAME) << endl);
142 const bool valid =
is_valid(*i) || (i != p);
146 cout << setw(8) << i->SERIALNUMBER <<
' '
147 << setw(22) << left << upi << right <<
' '
148 << setw(8) << i->TESTEND <<
' '
149 << setw(8) << i->FIRMWARE_VERSION <<
' '
151 << setw(10) << i->TESTOPID <<
' '
152 << (valid ?
"" :
"*") << endl;
165 const JLocation_t& location = i->first;
166 const JAHRSCalibration& calibration = i->second;
169 cout << location <<
" ";
171 JDetectorIntegration_t::range_type r1, r2;
175 if (
distance(r1.first, r1.second) == 1) {
179 if (
distance(r2.first, r2.second) == 1) {
180 cout << setw(22) << left <<
detector[r2.first->second].container.getUPI() << right <<
' ';
181 cout << setw(22) << left <<
detector[r1.first->second].container.getUPI() << right <<
' ';
182 cout << setw(22) << left << upi << right <<
' ';
186 cout << setw(3) << (calibration.FIRMWARE_VERSION !=
"" ?
187 calibration.FIRMWARE_VERSION :
189 cout << setw(2) <<
getVersion(calibration.TESTNAME) <<
' ';
190 cout << setw(10) << calibration.TESTOPID <<
' ';
Utility class to parse command line options.
static JGetPBSSequences getPBSSequences
Function object to get PBS sequences as a function of PBS.
int getVersion(const std::string &version)
Get numerical value of AHRS calibration version.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
bool is_valid(const json &js)
Check validity of JSon data.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JUPIHelper & getUPI()
Auxiliary function for helper object initialisation.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
ResultSet & getResultSet(const std::string &query)
Get result set.
std::vector< JServer > getServernames()
Get list of names of available database servers.
do set_variable DETECTOR_TXT $WORKDIR detector
static const JPBS_t AHRS(3, 4, 3, 4)
PBS of compass
#define DEBUG(A)
Message macros.