39{
42
44 string usr;
45 string pwd;
46 string cookie;
48 string detid;
50 long long int numberOfRows;
51 double precision;
53
54 try {
55
56 JParser<> zap(
"Auxiliary program to check HV.");
57
63 zap[
'D'] =
make_field(detid,
"Detector identifier");
65 zap[
'n'] =
make_field(numberOfRows,
"Maximal number of rows") = numeric_limits<long long int>::max();
68
69 zap(argc, argv);
70 }
71 catch(const exception &error) {
72 FATAL(error.what() << endl);
73 }
74
75
77 JManager<JLocation_t, TH1D> H1(new TH1D("HV[%]", NULL, 201, -1500.0, +1500.0));
78
80
81 try {
82
83 JDB::reset(usr, pwd, cookie);
84
85 const int ID = getDetector<int> (detid);
86 detid = getDetector<string>(detid);
87
89
91
92 {
94
96
97 if (parameters.PMTUPI.getPBS() == PBS::PMT) {
98 detector[parameters.PMTUPI] =
JLocation_t(parameters.DUID, parameters.FLOORID, parameters.CABLEPOS);
99 }
100 }
101
102 rs.Close();
103 }
104
105 for (const int run : runs) {
106
108
109 {
111
113
114 const JLocation_t location(parameters.DUID, parameters.FLOORID, parameters.CABLEPOS);
115
116 if (parameters.CABLEPOS != parameters.PMTINTID) {
117 WARNING(
"PMT " << location <<
" position " << parameters.PMTINTID << endl);
118 }
119
120 HV[location] = parameters.HV_VALUE;
121 }
122
123 rs.Close();
124 }
125
126 if (
debug >= debug_t) {
127
128 cout << "HV settings " << setw(8) << run << endl;
129
131 cout << i->first <<
' ' <<
FIXED(6,1) << i->second << endl;
132 }
133 }
134
135 JSelector selection(&JDatalogNumbers::PARAMETER_NAME, "pmt_highvolt@");
136
138
139 ResultSet& rs =
getResultSet(getTable<JDatalogNumbers>(), selection);
140
141 long long int counter = 0;
142
143 for (
JDatalogNumbers parameters; rs >> parameters && counter != numberOfRows; ++counter) {
144
146
147 const JUPI_t upi = parameters.SOURCE_NAME;
149
150 DEBUG(location <<
' ' <<
FIXED(7,1) << HV[location] <<
' ' <<
FIXED(7,1) << parameters.DATA_VALUE << endl);
151
153
154 G1[location].put(parameters.getTime(), parameters.DATA_VALUE);
155
156 H1[location]->Fill(HV[location] - parameters.DATA_VALUE);
157
158 if (fabs(HV[location] - parameters.DATA_VALUE) > precision) {
159 ERROR(
"HV " << location <<
" set/read " <<
FIXED(7,1) << HV[location] <<
"/" <<
FIXED(7,1) << parameters.DATA_VALUE << endl);
160 }
161
162 } else {
163
164 errors[upi] += 1;
165 }
166
168 }
169
170 rs.Close();
171 }
172 }
173 catch(const exception& error) {
174 FATAL(error.what() << endl);
175 }
176
177
179 ERROR(
"Alien UPI " << setw(24) << i->first <<
' ' << i->second << endl);
180 }
181
183
186 }
187
188 out << H1;
189
190 out.Write();
191 out.Close();
192}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Double_t G1(const Double_t x)
Integral of method g1.
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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Auxiliary data structure for location of product in detector.
bool is_valid() const
Check validity of location.
Wrapper class for server name.
Universal product identifier (UPI).
Template definition for getting table specific selector.
Auxiliary data structure to build TGraph.