Jpp
test_elongated_shower_pde
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JDB
examples/JDB/JPrintTriggerParameters.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <sstream>
4
#include <map>
5
6
#include "
JTrigger/JTriggerParameters.hh
"
7
8
#include "
JDB/JDB.hh
"
9
#include "
JDB/JDBToolkit.hh
"
10
#include "
JDB/JSelector.hh
"
11
#include "
JDB/JSelectorSupportkit.hh
"
12
#include "
JDB/JRuns.hh
"
13
#include "
JDB/JAllParams.hh
"
14
#include "
JDB/JRunsetupParams.hh
"
15
16
#include "
Jeep/JParser.hh
"
17
#include "
Jeep/JMessage.hh
"
18
19
20
/**
21
* \file
22
* Auxiliary program to print trigger parameters.
23
* \author lnauta
24
*/
25
int
main
(
const
int
argc,
const
char
*
const
argv[])
26
{
27
using namespace
std;
28
using namespace
JPP;
29
using namespace
KM3NETDAQ;
30
31
JServer
server;
32
string
usr;
33
string
pwd;
34
string
cookie;
35
int
detid;
36
int
run;
37
int
debug
;
38
39
try
{
40
41
JParser<>
zap(
"Auxiliary program to print trigger parameters."
);
42
43
zap[
's'
] =
make_field
(server) =
getServernames
();
44
zap[
'u'
] =
make_field
(usr) =
""
;
45
zap[
'!'
] =
make_field
(pwd) =
""
;
46
zap[
'C'
] =
make_field
(cookie) =
""
;
47
zap[
'D'
] =
make_field
(detid);
48
zap[
'r'
] =
make_field
(run);
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
58
const
double
Dmax_m = 9999.0;
59
60
JTriggerParameters
parameters
;
61
62
try
{
63
JDB::reset
(usr, pwd, cookie);
64
}
65
catch
(
const
exception& error) {
66
FATAL
(error.what() << endl);
67
}
68
69
string
rs_oid;
70
71
try
{
72
73
JRuns
buffer;
74
75
ResultSet& rs =
getResultSet
(getTable<JRuns>(),
getSelector<JRuns>
(detid, run));
76
77
if
(rs >> buffer) {
78
rs_oid = buffer.
RUNSETUPID
;
79
}
80
81
rs.Close();
82
}
83
catch
(
const
exception& error) {
84
FATAL
(error.what() << endl);
85
}
86
87
88
map<string, string>
zmap;
89
90
try
{
91
92
JAllParams
buffer;
93
94
ResultSet& rs =
getResultSet
(getTable<JAllParams>(),
getSelector<JAllParams>
(
"DATAACQUISITION"
));
95
96
while
(rs >> buffer) {
97
98
string::size_type pos = buffer.
NAME
.find(
PREFIX_DATAFILTER
);
99
100
if
(pos != string::npos) {
101
102
pos = buffer.
NAME
.find(
'='
, pos +
PREFIX_DATAFILTER
.length());
103
104
zmap[buffer.
OID
] = buffer.
NAME
.erase(0, pos + 1);
105
}
106
}
107
108
rs.Close();
109
}
110
catch
(
const
exception& error) {
111
FATAL
(error.what() << endl);
112
}
113
114
115
stringstream data;
116
117
try
{
118
119
JRunsetupParams
buffer;
120
121
ResultSet& rs =
getResultSet
(getTable<JRunsetupParams>(),
getSelector<JRunsetupParams>
(
getDetector
(detid), rs_oid));
122
123
while
(rs >> buffer) {
124
125
map<string, string>::const_iterator
i = zmap.find(buffer.
PAR_OID
);
126
127
if
(i != zmap.end()) {
128
data << i->second <<
"="
<< buffer.
VALUE
<<
";\n"
;
129
}
130
}
131
132
rs.Close();
133
}
134
catch
(
const
exception& error) {
135
FATAL
(error.what() << endl);
136
}
137
138
data >>
parameters
;
139
140
parameters
.set(Dmax_m);
141
parameters
.actionAtFileRead();
142
143
cout <<
parameters
;
144
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JDATABASE::JRunsetupParams::PAR_OID
std::string PAR_OID
Definition:
JRunsetupParams.hh:30
JACOUSTICS::JTriggerParameters
Trigger parameters.
Definition:
JAcoustics/JTriggerParameters.hh:26
std::map
Definition:
JSTDTypes.hh:16
JRuns.hh
JDATABASE::JRunsetupParams
Definition:
JRunsetupParams.hh:19
parameters
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition:
diff-Tuna.sh:38
JDATABASE::JRuns
Definition:
JRuns.hh:17
JDATABASE::JAllParams::NAME
std::string NAME
Definition:
JAllParams.hh:24
JDATABASE::getDetector
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
Definition:
JDBToolkit.hh:365
JDATABASE::JRunsetupParams::VALUE
JDBString VALUE
Definition:
JRunsetupParams.hh:32
JDBToolkit.hh
JRunsetupParams.hh
JSelector.hh
JAllParams.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
debug
int debug
debug level
Definition:
JSirene.cc:68
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JDATABASE::JAllParams::OID
std::string OID
Definition:
JAllParams.hh:23
JTOOLS::reset
void reset(T &value)
Reset value.
Definition:
JToolsToolkit.hh:219
JDATABASE::PREFIX_DATAFILTER
static const std::string PREFIX_DATAFILTER
This string is prepended to every parameter in the database output for the corresponding process...
Definition:
JDB.hh:174
JParser.hh
Utility class to parse command line options.
JDATABASE::JAllParams
Definition:
JAllParams.hh:18
JDATABASE::getResultSet
ResultSet & getResultSet(const std::string &query)
Get result set.
Definition:
JDB.hh:432
JDATABASE::getServernames
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition:
JDB.hh:98
JDATABASE::JServer
Wrapper class for server name.
Definition:
JDB.hh:42
JSelectorSupportkit.hh
JDB.hh
JDATABASE::getSelector
Template definition for getting table specific selector.
Definition:
JSelectorSupportkit.hh:31
JTriggerParameters.hh
JDATABASE::JRuns::RUNSETUPID
std::string RUNSETUPID
Definition:
JRuns.hh:26
Generated by
1.8.5