Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDetectorDB.cc File Reference

Auxiliary program to print detector from database. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDB/JDB.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JSupport/JMeta.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 print detector from database.

Author
mdejong

Definition in file JDetectorDB.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

< tcal: t0 (time offsets) calibration set from DB

< pcal: position (x,y,z) calibration set from DB

< rcal: orientation (quarterions) calibration set from DB

Definition at line 20 of file JDetectorDB.cc.

21 {
22  using namespace std;
23  using namespace JPP;
24 
25  string usr;
26  string pwd;
27  string cookie;
28  string id;
29  string tcalset;
30  string pcalset;
31  string rcalset;
32  string outputFile;
33  int run;
34  int debug;
35 
36  try {
37 
38  JParser<> zap("Auxiliary program to print detector from database.");
39 
40  zap['u'] = make_field(usr) = "";
41  zap['!'] = make_field(pwd) = "";
42  zap['C'] = make_field(cookie) = "";
43  zap['D'] = make_field(id);
44  zap['r'] = make_field(run);
45  zap['t'] = make_field(tcalset) = ""; ///< tcal: t0 (time offsets) calibration set from DB
46  zap['p'] = make_field(pcalset) = ""; ///< pcal: position (x,y,z) calibration set from DB
47  zap['q'] = make_field(rcalset) = ""; ///< rcal: orientation (quarterions) calibration set from DB
48  zap['o'] = make_field(outputFile) = "";
49  zap['d'] = make_field(debug) = 1;
50 
51  zap(argc, argv);
52  }
53  catch(const exception &error) {
54  FATAL(error.what() << endl);
55  }
56 
57  try {
58 
59  JDB::reset(usr, pwd, cookie);
60 
62 
63  if (!tcalset.empty() && !pcalset.empty() && !rcalset.empty())
64  *(JDB::get()->DetX)(id.c_str(), tcalset.c_str(), pcalset.c_str(), rcalset.c_str()) >> detector;
65  else
66  *(JDB::get()->DetX)(id.c_str(), run) >> detector;
67 
68  detector.comment.add(JMeta(argc,argv));
69 
70  if (detector.setVersion(JDetectorVersion::V3)) {
71  NOTICE("Set detector version to " << JDetectorVersion::V3 << endl);
72  }
73 
74  if (outputFile != "")
75  store(outputFile, detector);
76  else
77  cout << detector;
78  }
79  catch(const exception& error) {
80  FATAL(error.what() << endl);
81  }
82 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:71
Utility class to parse command line options.
Definition: JParser.hh:1493
Detector data structure.
Definition: JDetector.hh:80
T get(const JHead &header)
Get object from header.
void setVersion(const JVersion &version)
Set version.
Definition: JDetector.hh:126
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
#define NOTICE(A)
Definition: JMessage.hh:64
int debug
debug level
Definition: JSirene.cc:61
#define FATAL(A)
Definition: JMessage.hh:67
void reset(T &value)
Reset value.
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
JComment & add(const std::string &comment)
Add comment.
Definition: JComment.hh:51