29int main(
const int argc,
const char *
const argv[])
46 JParser<> zap(
"Auxiliary program to set PMT thresholds according DAQ configuration of a given data taking run.");
48 zap[
's'] =
make_field(server) = getServernames();
54 zap[
'P'] =
make_field(pmtFile,
"PMT parameters file") =
"";
55 zap[
'F'] =
make_field(formula,
"transfer function") =
"((x * 1.0)/255.0 * 1.6 + 0.8 - 0.989) / 0.44";
60 catch(
const exception& error) {
61 FATAL(error.what() << endl);
67 if (pmtFile !=
"" && filesystem::is_regular_file(pmtFile)) {
68 parameters.
load(pmtFile.c_str());
72 TF1 f1(
"user", formula.c_str());
75 FATAL(
"Formula <" << formula <<
"> invalid." << endl);
87 JDB::reset(usr, pwd, cookie);
89 const int id = getDetector<int>(detid);
93 DEBUG(getPMTThreshold);
103 catch(
const exception& error) {
104 FATAL(error.what() << endl);
108 for (vector<JDetectorIntegration>::const_iterator i =
detector.begin(); i !=
detector.end(); ++i) {
110 if (i->PMTID != -1) {
114 const JPMTThreshold::result_type threshold = getPMTThreshold(i->PMTUPI);
116 const double value = f1.Eval((
double) threshold.value);
118 if (
debug >= debug_t) {
120 cout <<
FILL(4,
'0') << i->DUID <<
FILL() <<
'.'
121 <<
FILL(2,
'0') << i->FLOORID <<
FILL() <<
'['
122 <<
FILL(2,
'0') << i->CABLEPOS <<
FILL() <<
']'
124 << setw(3) << threshold.value <<
' '
125 <<
FIXED(5,2) << value <<
' ';
127 if (threshold.is_default) {
134 if (!threshold.is_default) {
138 parameters[id].threshold = value;
141 catch(
const exception& error) {
143 <<
FILL(4,
'0') << i->DUID <<
FILL() <<
'.'
144 <<
FILL(2,
'0') << i->FLOORID <<
FILL() <<
'['
145 <<
FILL(2,
'0') << i->CABLEPOS <<
FILL() <<
']'
147 << error.what() << endl);
156 parameters.
store(pmtFile.c_str());
160 cout << parameters << endl;
General purpose messaging.
#define DEBUG(A)
Message macros.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for PMT thresholds.
void configure(const int id, const int run)
Configure PMT thresholds for given detector and run.
Auxiliary class for map of PMT parameters.
Data structure for PMT parameters.
double threshold
threshold [npe]
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
Wrapper class for server name.
Template definition for getting table specific selector.
void store(const char *file_name) const
Store to output file.
void load(const char *file_name)
Load from input file.