Jpp
18.3.0-rc.1
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
string
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
const
int
ID
= getDetector<int> (detid);
70
detid = getDetector<string>(detid);
71
72
string
rs_oid;
73
74
try
{
75
76
JRuns
buffer;
77
78
ResultSet& rs =
getResultSet
(getTable<JRuns>(),
getSelector<JRuns>
(
ID
, run));
79
80
if
(rs >> buffer) {
81
rs_oid = buffer.
RUNSETUPID
;
82
}
83
84
rs.Close();
85
}
86
catch
(
const
exception& error) {
87
FATAL
(error.what() << endl);
88
}
89
90
91
map<string, string>
zmap;
92
93
try
{
94
95
JAllParams
buffer;
96
97
ResultSet& rs =
getResultSet
(getTable<JAllParams>(),
getSelector<JAllParams>
(
"DATAACQUISITION"
));
98
99
while
(rs >> buffer) {
100
101
string::size_type pos = buffer.
NAME
.find(
PREFIX_DATAFILTER
);
102
103
if
(pos != string::npos) {
104
105
pos = buffer.
NAME
.find(
'='
, pos +
PREFIX_DATAFILTER
.length());
106
107
zmap[buffer.
OID
] = buffer.
NAME
.erase(0, pos + 1);
108
}
109
}
110
111
rs.Close();
112
}
113
catch
(
const
exception& error) {
114
FATAL
(error.what() << endl);
115
}
116
117
118
stringstream
data
;
119
120
try
{
121
122
JRunsetupParams
buffer;
123
124
ResultSet& rs =
getResultSet
(getTable<JRunsetupParams>(),
getSelector<JRunsetupParams>
(detid, rs_oid));
125
126
while
(rs >> buffer) {
127
128
map<string, string>::const_iterator
i
= zmap.find(buffer.
PAR_OID
);
129
130
if
(i != zmap.end()) {
131
data
<< i->second <<
"="
<< buffer.
VALUE
<<
";\n"
;
132
}
133
}
134
135
rs.Close();
136
}
137
catch
(
const
exception& error) {
138
FATAL
(error.what() << endl);
139
}
140
141
data
>>
parameters
;
142
143
parameters
.set(Dmax_m);
144
parameters
.actionAtFileRead();
145
146
cout <<
parameters
;
147
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
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::JRunsetupParams::VALUE
JDBString VALUE
Definition:
JRunsetupParams.hh:32
JDBToolkit.hh
JRunsetupParams.hh
i
then rm i
Definition:
JEvtReweightMupageParameterScan.sh:309
JSelector.hh
JAllParams.hh
ID
Definition:
raw_data_converter.cpp:43
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
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:182
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:436
JDATABASE::getServernames
std::vector< JServer > getServernames()
Get list of names of available database servers.
Definition:
JDB.hh:106
JDATABASE::JServer
Wrapper class for server name.
Definition:
JDB.hh:50
applications.data
tuple data
Definition:
applications.py:8
JSelectorSupportkit.hh
JDB.hh
JDATABASE::getSelector
Template definition for getting table specific selector.
Definition:
JSelectorSupportkit.hh:33
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
JTriggerParameters.hh
JDATABASE::JRuns::RUNSETUPID
std::string RUNSETUPID
Definition:
JRuns.hh:26
Generated by
1.8.5