Jpp
 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  string usr;
26  string pwd;
27  string cookie;
28  int option;
29  string detid;
30  string outputFile;
31  int debug;
32 
33  try {
34 
35  JParser<> zap("Auxiliary program to store AHRS calibration data on local disk.");
36 
37  zap['u'] = make_field(usr) = "";
38  zap['!'] = make_field(pwd) = "";
39  zap['C'] = make_field(cookie) = "";
40  zap['O'] = make_field(option) = 0;
41  zap['D'] = make_field(detid);
42  zap['o'] = make_field(outputFile) = "ahrs_calibration.txt";
43  zap['d'] = make_field(debug) = 2;
44 
45  zap(argc, argv);
46  }
47  catch(const exception &error) {
48  FATAL(error.what() << endl);
49  }
50 
51 
52  try {
53  JDB::reset(usr, pwd, cookie);
54  }
55  catch(const exception& error) {
56  FATAL(error.what() << endl);
57  }
58 
59  STATUS("Reading AHRS calibration data... " << flush);
60 
61  const JAHRSCalibration_t calibration(is_integer(detid) ? to_value<int>(detid) : getDetector(detid), option);
62 
63  STATUS("OK" << endl);
64 
65  if (outputFile != "") {
66 
67  STATUS("Storing AHRS calibration data to " << outputFile << "... " << flush);
68 
69  calibration.store(outputFile.c_str());
70 
71  STATUS("OK" << endl);
72 
73  } else {
74 
75  cout << calibration << endl;
76  }
77 }
Utility class to parse command line options.
Definition: JParser.hh:1500
#define STATUS(A)
Definition: JMessage.hh:63
string outputFile
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
Definition: JDBToolkit.cc:5
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
bool is_integer(const std::string &buffer)
Check if string is an integer.
Definition: JLangToolkit.hh:58
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
void reset(T &value)
Reset value.