27int main(
int argc, 
char **argv)
 
   41    JParser<> zap(
"Example program for compass calibration.");
 
   43    zap[
's'] = 
make_field(server)     = getServernames();
 
   47    zap[
'D'] = 
make_field(detid,        
"Detector identifier")  = 
"";
 
   52  catch(
const exception &error) {
 
   53    FATAL(error.what() << endl);
 
   61    JDB::reset(usr, pwd, cookie);
 
   63    ResultSet& rs  = getResultSet(getTable<JAHRSCalibration>());
 
   69  catch(
const exception& error) {
 
   70    FATAL(error.what() << endl);
 
   75  JDBToolkit::initialise(getUPI, PBS::AHRS);
 
   82    DEBUG(
"Reading database table " << getTable<JDetectorIntegration_t>() << endl);
 
   86      JDB::reset(usr, pwd, cookie);
 
   88      detid = getDetector<string>(detid);
 
   90      ResultSet& rs  = getResultSet(getTable<JDetectorIntegration_t>());
 
   96    catch(
const exception& error) {
 
   97      FATAL(error.what() << endl);
 
  113    vector<JAHRSCalibration>::const_iterator q = p; 
 
  115    for (++q; q != 
calibration.end() && q->SERIALNUMBER == p->SERIALNUMBER; ++q) {}
 
  117    const JUPI_t      upi      = getUPI(PBS::AHRS, p->SERIALNUMBER);
 
  122      for (vector<JAHRSCalibration>::const_iterator i = p; i != q; ++i) {
 
  127            WARNING(
"AHRS " << location << 
' ' << upi << 
' ' 
  128                    << 
"invalid calibration"          << 
' ' 
  129                    << p->TESTEND << 
" v" << getVersion(p->TESTNAME) << 
" -> " 
  130                    << i->TESTEND << 
" v" << getVersion(i->TESTNAME) << endl);
 
  141    for (vector<JAHRSCalibration>::const_iterator i = p; i != q; ++i) {
 
  143      const bool valid = is_valid(*i) || (i != p);
 
  145      if (
debug >= debug_t) {
 
  147        cout << setw(8)  << i->SERIALNUMBER         << 
' ' 
  148             << setw(22) << left << upi << right    << 
' ' 
  149             << setw(8)  << i->TESTEND              << 
' ' 
  150             << setw(8)  << i->FIRMWARE_VERSION     << 
' ' 
  151             << setw(2)  << getVersion(i->TESTNAME) << 
' ' 
  152             << setw(10) << i->TESTOPID             << 
' '  
  153             << (valid ? 
"" : 
"*") << endl;
 
  170    cout << location << 
"  ";
 
  176    if (
distance(r1.first, r1.second) == 1) {
 
  180      if (
distance(r2.first, r2.second) == 1) {
 
  181        cout << setw(22) << left << 
detector[r2.first->second].container.getUPI() << right << 
' ';
 
  182        cout << setw(22) << left << 
detector[r1.first->second].container.getUPI() << right << 
' ';
 
  183        cout << setw(22) << left << upi                                           << right << 
' ';
 
  187    cout << setw(3)  << (
calibration.FIRMWARE_VERSION != 
"" ?
 
  190    cout << setw(2)  << getVersion(
calibration.TESTNAME) << 
' ';
 
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.