26{
29
31 string usr;
32 string pwd;
33 string cookie;
34 string inputFile;
35 string detid;
39
40 try {
41
42 JParser<> zap(
"Example program to build detector from database.");
43
48 zap[
'f'] =
make_field(inputFile,
"output of JPrintDB -q \"integration\" -c \";\" -W1") =
"";
53
54 zap(argc, argv);
55 }
56 catch(const exception &error) {
57 FATAL(error.what() << endl);
58 }
59
60
62
63 if (inputFile != "") {
64
66
67 } else {
68
69 DEBUG(
"Reading database table " << getTable<JDetectorIntegration_t>() << endl);
70
71 try {
72
73 JDB::reset(usr, pwd, cookie);
74
75 detid = getDetector<string>(detid);
76
77 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration_t>());
78
81 }
82 }
83 catch(const exception& error) {
84 FATAL(error.what() << endl);
85 }
86 }
87
89 FATAL(
"Detector identifier must be object identifier." << endl);
90 }
91
93
94
96
98
100
102
104
105 cout <<
LEFT(32) << upi << right <<
' ' << router.getLocation(upi) << endl;
106 }
107
108 }
else if (upi !=
JUPI_t()) {
109
111
113
114 const JLocation_t location = router.getLocation(upi);
115
117 cout << location << endl;
118 }
119
120 } else {
121
122 cout << "Enter UPI." << endl;
123
124 for ( ; ; ) {
125
127
128 cout << "> " << flush;
129 cin >> upi;
130
132
134
135 const JLocation_t location = router.getLocation(upi);
136
138 cout << location << endl;
139 }
140 }
141 }
142}
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
ResultSet & getResultSet(const std::string &query)
Get result set.
std::vector< JServer > getServernames()
Get list of names of available database servers.
bool is_integer(const std::string &buffer)
Check if string is an integer.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
map_type::const_iterator range_const_iterator
Auxiliary data structure for location of product in detector.
bool is_valid() const
Check validity of location.
Product breakdown structure (PBS).
const JPBS_t & getPBS() const
Get PBS.
Auxiliary class to map UPI to location in detector.
Wrapper class for server name.
Universal product identifier (UPI).
Auxiliary data structure for alignment of data.