Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JAHRSCalibration.cc File Reference

Auxiliary program to store AHRS calibration data on local disk. More...

#include <iostream>
#include <iomanip>
#include "JDB/JDB.hh"
#include "JDB/JDBToolkit.hh"
#include "JDB/JSelector.hh"
#include "JDB/JSelectorSupportkit.hh"
#include "JDB/JAHRSCalibration_t.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to store AHRS calibration data on local disk.

Author
mdejong

Definition in file JAHRSCalibration.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file JAHRSCalibration.cc.

21 {
22  using namespace std;
23  using namespace JPP;
24 
25  JServer server;
26  string usr;
27  string pwd;
28  string cookie;
29  int option;
30  string detid;
31  string outputFile;
32  int debug;
33 
34  try {
35 
36  JParser<> zap("Auxiliary program to store AHRS calibration data on local disk.");
37 
38  zap['s'] = make_field(server) = getServernames();
39  zap['u'] = make_field(usr) = "";
40  zap['!'] = make_field(pwd) = "";
41  zap['C'] = make_field(cookie) = "";
42  zap['O'] = make_field(option) = 0;
43  zap['D'] = make_field(detid);
44  zap['o'] = make_field(outputFile) = "ahrs_calibration.txt";
45  zap['d'] = make_field(debug) = 2;
46 
47  zap(argc, argv);
48  }
49  catch(const exception &error) {
50  FATAL(error.what() << endl);
51  }
52 
53 
54  try {
55 
56  JDB::reset(usr, pwd, cookie);
57 
58  STATUS("Reading AHRS calibration data... " << flush);
59 
60  const JAHRSCalibration_t calibration(getDetector<int>(detid), option);
61 
62  STATUS("OK" << endl);
63 
64  if (outputFile != "") {
65 
66  STATUS("Storing AHRS calibration data to " << outputFile << "... " << flush);
67 
68  calibration.store(outputFile.c_str());
69 
70  STATUS("OK" << endl);
71 
72  } else {
73 
74  cout << calibration << endl;
75  }
76  }
77  catch(const exception& error) {
78  FATAL(error.what() << endl);
79  }
80 }
Utility class to parse command line options.
Definition: JParser.hh:1517
#define STATUS(A)
Definition: JMessage.hh:63
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
#define FATAL(A)
Definition: JMessage.hh:67
void reset(T &value)
Reset value.
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition: JDB.hh:101
int debug
debug level