50 JParser<> zap(
"Auxiliary program to set PMT thresholds according DAQ configuration.");
58 zap[
'P'] =
make_field(pmtFile,
"PMT parameters file") =
"";
59 zap[
'F'] =
make_field(formula,
"transfer function") =
"((x * 1.0)/255.0 * 1.6 + 0.8 - 0.989) / 0.44";
64 catch(
const exception& error) {
65 FATAL(error.what() << endl);
76 TF1 f1(
"user", formula.c_str());
79 FATAL(
"Formula <" << formula <<
"> invalid." << endl);
86 catch(
const exception& error) {
87 FATAL(error.what() << endl);
99 if (rs >> parameters) {
100 rs_oid = parameters.RUNSETUPID;
105 DEBUG(
"Run setup " << rs_oid << endl);
107 catch(
const exception& error) {
108 FATAL(error.what() << endl);
118 ResultSet& rs =
getResultSet(getTable<JAllParams>(), getSelector<JAllParams>(
"OPTICS"));
120 while (rs >> parameters) {
121 if (parameters.NAME.find(
"PMT_THRESHOLD") != string::npos) {
128 catch(
const exception& error) {
129 FATAL(error.what() << endl);
141 while (rs >> parameters) {
143 if (parameters.PAR_OID == upars.OID && parameters.ISINPUT ==
'Y') {
144 if (parameters.VALUE !=
"") {
145 umap[parameters.UPIFILTER] = to_value<int>(parameters.VALUE);
152 catch(
const exception& error) {
153 FATAL(error.what() << endl);
157 DEBUG(left << setw(20) << i->first <<
' ' << right << setw(3) << i->second << endl);
167 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration>(), getSelector<JDetectorIntegration>(
is_integer(detid) ? to_value<int>(detid) :
getDetector(detid)));
169 while (rs >> parameters) {
175 catch(
const exception& error) {
176 FATAL(error.what() << endl);
183 if (i->PMTID != -1) {
185 const JUPI_t upi = i->PMTUPI;
189 bool is_default = (p == umap.end());
191 if (p == umap.end()) {
195 os << upi.getPBS() << JUPI_t::SEPARATOR
196 << upi.getVariant() << JUPI_t::SEPARATOR
199 p = umap.find(os.str());
202 if (p != umap.end()) {
204 const double threshold = f1.Eval((
double) p->second);
208 cout << setw(4) << i->DUID <<
' '
209 << setw(2) << i->FLOORID <<
' '
210 << setw(2) << i->CABLEPOS <<
' '
211 << setw(3) << p->second <<
' '
212 <<
FIXED(5,2) << threshold <<
' ';
215 cout <<
"* (" <<
FIXED(5,2) << JPMTParameters().threshold <<
")";
223 const JPMTIdentifier id(i->DOMID, i->CABLEPOS);
225 parameters[id].threshold = threshold;
230 ERROR(
"Missing threshold data PMT " << upi << endl);
237 parameters.comment.add(JMeta(argc, argv));
239 parameters.store(pmtFile.c_str());
243 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.
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