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, -256.0, +256.0));
78
81
82 try {
83
84 JDB::reset(usr, pwd, cookie);
85
86 const int ID = getDetector<int> (detid);
87 detid = getDetector<string>(detid);
88
90
91 {
93
95
96 if (parameters.PMTUPI.getPBS() == PBS::PMT) {
97 detector[parameters.PMTUPI] =
JLocation_t(parameters.DUID, parameters.FLOORID, parameters.CABLEPOS);
98 }
99 }
100
101 rs.Close();
102 }
103
104 for (const int run : runs) {
105
107
108 JSelector selection(&JDatalogNumbers::PARAMETER_NAME, "pmt_highvolt");
109
111
112 ResultSet& rs =
getResultSet(getTable<JDatalogNumbers>(), selection);
113
114 long long int counter = 0;
115
116 for (
JDatalogNumbers parameters; rs >> parameters && counter != numberOfRows; ++counter) {
117
119
120 const JUPI_t upi = parameters.SOURCE_NAME;
122
123 DEBUG(location <<
' ' <<
FIXED(7,1) << HV(upi) <<
' ' <<
FIXED(7,1) << parameters.DATA_VALUE << endl);
124
126
127 G1[location].put(parameters.getTime(), parameters.DATA_VALUE);
128
129 H1[location]->Fill(HV(upi).value - parameters.DATA_VALUE);
130
131 if (fabs(HV(upi).value - parameters.DATA_VALUE) > precision) {
132
133 ERROR(
"HV " << location <<
" set/read " <<
FIXED(7,1) << HV(upi) <<
"/" <<
FIXED(7,1) << parameters.DATA_VALUE << endl);
134
135 errors[upi] += 1;
136 }
137
138 } else {
139
140 aliens[upi] += 1;
141 }
142
144 }
145
146 rs.Close();
147 }
148
149 if (
debug >= warning_t) {
151 cout <<
"Error HV " << setw(32) << left << i->first << right <<
' ' <<
detector[i->first] <<
' ' << setw(3) << i->second << endl;
152 }
154 cout << "Alien UPI " << setw(32) << left << i->first << right << ' ' << setw(3) << i->second << endl;
155 }
156 }
157 }
158 catch(const exception& error) {
159 FATAL(error.what() << endl);
160 }
161
162
164
167 }
168
169 out << H1;
170
171 out.Write();
172 out.Close();
173}
#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.
Auxiliary class for PMT HVs.
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.