30 int main(
const int argc,
const char *
const argv[])
47 JParser<> zap(
"Auxiliary program to set PMT thresholds according DAQ configuration of a given data taking run.");
55 zap[
'P'] =
make_field(pmtFile,
"PMT parameters file") =
"";
56 zap[
'F'] =
make_field(formula,
"transfer function") =
"((x * 1.0)/255.0 * 1.6 + 0.8 - 0.989) / 0.44";
61 catch(
const exception& error) {
62 FATAL(error.what() << endl);
69 parameters.
load(pmtFile.c_str());
73 TF1
f1(
"user", formula.c_str());
76 FATAL(
"Formula <" << formula <<
"> invalid." << endl);
90 const int id = getDetector<int>(detid);
94 DEBUG(getPMTThreshold);
104 catch(
const exception& error) {
105 FATAL(error.what() << endl);
111 if (i->PMTID != -1) {
115 const JPMTThreshold::result_type threshold = getPMTThreshold(i->PMTUPI);
117 const double value =
f1.Eval((
double) threshold.value);
121 cout <<
FILL(4,
'0') << i->DUID <<
FILL() <<
'.'
122 <<
FILL(2,
'0') << i->FLOORID <<
FILL() <<
'['
123 <<
FILL(2,
'0') << i->CABLEPOS <<
FILL() <<
']'
125 << setw(3) << threshold.value <<
' '
126 <<
FIXED(5,2) << value <<
' ';
128 if (threshold.is_default) {
135 if (!threshold.is_default) {
139 parameters[id].threshold = value;
142 catch(
const exception& error) {
144 <<
FILL(4,
'0') << i->DUID <<
FILL() <<
'.'
145 <<
FILL(2,
'0') << i->FLOORID <<
FILL() <<
'['
146 <<
FILL(2,
'0') << i->CABLEPOS <<
FILL() <<
']'
148 << error.what() << endl);
157 parameters.
store(pmtFile.c_str());
161 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.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
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).
static JStat getFileStatus
Function object for file status.
int main(const int argc, const char *const argv[])
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.