49 JParser<> zap(
"Auxiliary program to set PMT thresholds according DAQ configuration.");
56 zap[
'P'] =
make_field(pmtFile,
"PMT parameters file") =
"";
57 zap[
'F'] =
make_field(formula,
"transfer function") =
"((x * 1.0)/255.0 * 1.6 + 0.8 - 0.989) / 0.44";
62 catch(
const exception& error) {
63 FATAL(error.what() << endl);
74 TF1 f1(
"user", formula.c_str());
77 FATAL(
"Formula <" << formula <<
"> invalid." << endl);
84 catch(
const exception& error) {
85 FATAL(error.what() << endl);
97 if (rs >> parameters) {
98 rs_oid = parameters.RUNSETUPID;
103 DEBUG(
"Run setup " << rs_oid << endl);
105 catch(
const exception& error) {
106 FATAL(error.what() << endl);
116 ResultSet& rs =
getResultSet(getTable<JAllParams>(), getSelector<JAllParams>(
"OPTICS"));
118 while (rs >> parameters) {
119 if (parameters.NAME.find(
"PMT_THRESHOLD") != string::npos) {
126 catch(
const exception& error) {
127 FATAL(error.what() << endl);
139 while (rs >> parameters) {
141 if (parameters.PAR_OID == upars.OID && parameters.ISINPUT ==
'Y') {
142 if (parameters.VALUE !=
"") {
143 umap[parameters.UPIFILTER] = to_value<int>(parameters.VALUE);
150 catch(
const exception& error) {
151 FATAL(error.what() << endl);
155 DEBUG(left << setw(20) << i->first <<
' ' << right << setw(3) << i->second << endl);
165 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration>(), getSelector<JDetectorIntegration>(
is_integer(detid) ? to_value<int>(detid) :
getDetector(detid)));
167 while (rs >> parameters) {
173 catch(
const exception& error) {
174 FATAL(error.what() << endl);
181 if (i->PMTID != -1) {
183 const JUPI_t upi = i->PMTUPI;
187 bool is_default = (p == umap.end());
189 if (p == umap.end()) {
193 os << upi.getPBS() << JUPI_t::SEPARATOR
194 << upi.getVariant() << JUPI_t::SEPARATOR
197 p = umap.find(os.str());
200 if (p != umap.end()) {
202 const double threshold = f1.Eval((
double) p->second);
206 cout << setw(4) << i->DUID <<
' '
207 << setw(2) << i->FLOORID <<
' '
208 << setw(2) << i->CABLEPOS <<
' '
209 << setw(3) << p->second <<
' '
210 <<
FIXED(5,2) << threshold <<
' ';
213 cout <<
"* (" <<
FIXED(5,2) << JPMTParameters().threshold <<
")";
221 const JPMTIdentifier id(i->DOMID, i->CABLEPOS);
223 parameters[id].threshold = threshold;
228 ERROR(
"Missing threshold data PMT " << upi << endl);
235 parameters.comment.add(JMeta(argc, argv));
237 parameters.store(pmtFile.c_str());
241 cout << parameters << endl;
Utility class to parse command line options.
*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 JStat getFileStatus
Function object for file status.
ResultSet & getResultSet(const std::string &query)
Get result set.
do set_variable DETECTOR_TXT $WORKDIR detector
#define DEBUG(A)
Message macros.