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);
92 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration_t>());
95 THROW(JDatabaseException,
"Error reading " << getTable<JDetectorIntegration_t>());
98 catch(
const exception& error) {
99 FATAL(error.what() << endl);
108 sort(calibration.begin(), calibration.end(), binary_negate<JAHRSCalibrationComparator>(JAHRSCalibrationComparator()));
117 for (++q; q != calibration.end() && q->SERIALNUMBER == p->SERIALNUMBER; ++q) {}
120 const JLocation_t location = router.getLocation(upi);
122 if (location.is_valid()) {
129 WARNING(
"AHRS " << location <<
' ' << upi <<
' '
130 <<
"invalid calibration" <<
' '
131 << p->TESTEND <<
" v" <<
getVersion(p->TESTNAME) <<
" -> "
132 << i->TESTEND <<
" v" <<
getVersion(i->TESTNAME) << endl);
144 const bool valid =
is_valid(*i) || (i != p);
148 cout << setw(8) << i->SERIALNUMBER <<
' '
149 << setw(22) << left << upi << right <<
' '
150 << setw(8) << i->TESTEND <<
' '
151 << setw(8) << i->FIRMWARE_VERSION <<
' '
153 << setw(10) << i->TESTOPID <<
' '
154 << (valid ?
"" :
"*") << endl;
167 const JLocation_t& location = i->first;
168 const JAHRSCalibration& calibration = i->second;
171 cout << location <<
" ";
173 JDetectorIntegration_t::range_type r1, r2;
177 if (
distance(r1.first, r1.second) == 1) {
181 if (
distance(r2.first, r2.second) == 1) {
182 cout << setw(22) << left <<
detector[r2.first->second].container.getUPI() << right <<
' ';
183 cout << setw(22) << left <<
detector[r1.first->second].container.getUPI() << right <<
' ';
184 cout << setw(22) << left << upi << right <<
' ';
188 cout << setw(3) << (calibration.FIRMWARE_VERSION !=
"" ?
189 calibration.FIRMWARE_VERSION :
191 cout << setw(2) <<
getVersion(calibration.TESTNAME) <<
' ';
192 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.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
bool is_valid(const json &js)
Check validity of JSon data.
bool is_integer(const std::string &buffer)
Check if string is an integer.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
ResultSet & getResultSet(const std::string &query)
Get result set.
std::vector< JServer > getServernames()
Get list of names of available database servers.
JUPIHelper getUPI
Function object for mapping PBS and serial number to UPI.
do set_variable DETECTOR_TXT $WORKDIR detector
static const JPBS_t AHRS(3, 4, 3, 4)
PBS of compass