Example program to build detector from database.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include "JDB/JDB.hh"
#include "JDB/JSelector.hh"
#include "JDB/JSelectorSupportkit.hh"
#include "JDB/JDetectorIntegration_t.hh"
#include "JDB/JProductRouter.hh"
#include "JDB/JDBToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to build detector from database.
- Author
- mdejong
Definition in file JDetectorIntegration.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 22 of file JDetectorIntegration.cc.
37 JParser<> zap(
"Example program to build detector from database.");
49 catch(
const exception &error) {
50 FATAL(error.what() << endl);
56 DEBUG(
"Reading database table " << getTable<JDetectorIntegration_t>() << endl);
66 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration_t>());
69 THROW(JDatabaseException,
"Error reading " << getTable<JDetectorIntegration_t>());
72 catch(
const exception& error) {
73 FATAL(error.what() << endl);
79 const JProductRouter router(
detector);
83 JDetectorIntegration_t::range_type range =
detector.find(pbs);
85 for (JDetectorIntegration_t::range_const_iterator i = range.first; i != range.second; ++i) {
87 const JUPI upi =
detector[i->second].content.getUPI();
89 cout <<
LEFT(24) << upi << right <<
' ' << router.getLocation(upi) << endl;
92 }
else if (upi != JUPI()) {
96 cout << router.getLocation(upi) << endl;
100 cout <<
"Enter UPI." << endl;
106 cout <<
"> " << flush;
111 cout << router.getLocation(upi) << endl;
Utility class to parse command line options.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
bool is_integer(const std::string &buffer)
Check if string is an integer.
static const JDetectorsHelper & getDetector
Function object for mapping serial number and object identifier of detectors.
ResultSet & getResultSet(const std::string &query)
Get result set.
#define DEBUG(A)
Message macros.