48 long long int numberOfRows;
54 JParser<> zap(
"Auxiliary program to check HV.");
61 zap[
'D'] =
make_field(detid,
"Detector identifier");
63 zap[
'n'] =
make_field(numberOfRows,
"Maximal number of rows") = numeric_limits<long long int>::max();
69 catch(
const exception &error) {
70 FATAL(error.what() << endl);
74 JManager<JLocation_t, TH1D> manager(
new TH1D(
"HV[%]", NULL, 200, -1500.0, +1500.0));
87 DEBUG(
"Reading database table " << getTable<JDetectorIntegration_t>() << endl);
89 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration_t>());
91 if (! (rs >> detector)) {
92 THROW(JDatabaseException,
"Error reading " << getTable<JDetectorIntegration_t>());
96 DEBUG(
"Number of integrated products (before) " << right << detector.size() << endl);
98 detector.configure(detid);
100 DEBUG(
"Number of integrated products (after) " << right << detector.size() << endl);
107 ResultSet& rs =
getResultSet(getTable<JPMTHVRunSettings>(), getSelector<JPMTHVRunSettings>(detid, run));
111 const JLocation_t location(parameters.DUID, parameters.FLOORID, parameters.PMTINTID);
113 HV[location] = parameters.HV_VALUE;
121 cout <<
"HV settings:" << endl;
124 cout << i->first <<
' ' <<
FIXED(6,1) << i->second << endl;
128 JSelector selection(&JDatalogNumbers::PARAMETER_NAME,
"pmt_highvolt@");
130 selection += getSelector<JDatalogNumbers>(detid, run, run);
132 ResultSet& rs =
getResultSet(getTable<JDatalogNumbers>(), selection);
134 long long int counter = 0;
136 for (JDatalogNumbers parameters; rs >> parameters && counter != numberOfRows; ++counter) {
140 const JUPI_t upi = parameters.SOURCE_NAME;
141 const JLocation_t& location = router.getLocation(upi);
143 DEBUG(location <<
' ' <<
FIXED(6,1) << HV[location] <<
' ' <<
FIXED(6,1) << parameters.DATA_VALUE << endl);
145 if (location.is_valid()) {
147 const double hv = HV[location] - parameters.DATA_VALUE ;
149 manager[location]->Fill(hv);
151 if (fabs(hv) > precision) {
152 WARNING(
"HV " << location <<
" set/read " <<
FIXED(6,1) << HV[location] <<
"/" <<
FIXED(6,1) << parameters.DATA_VALUE << endl);
158 catch(
const exception& error) {
159 FATAL(error.what() << endl);
Utility class to parse command line options.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
*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
Auxiliary data structure for floating point format specification.
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
bool is_integer(const std::string &buffer)
Check if string is an integer.
static const JPBSSequences CLB_SEQUENCES
PBS sequences for central-logic board.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
ResultSet & getResultSet(const std::string &query)
Get result set.
std::vector< JServer > getServernames()
Get list of names of available database servers.
do set_variable DETECTOR_TXT $WORKDIR detector