38 template<
class JAddress_t>
60 if (this->action ==
"set") {
64 }
else if (this->action ==
"add") {
68 }
else if (this->action ==
"sub") {
72 }
else if (this->action ==
"mul") {
76 }
else if (this->action ==
"div") {
85 catch(
const std::exception& error) {
86 cerr << error.what() << endl;
101 friend inline std::istream&
operator>>(std::istream& in, JModifier& modifier)
103 return in >> modifier.address
117 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
119 return out << modifier.address <<
' '
120 << modifier.action <<
' '
121 << modifier.key <<
' '
152 int main(
int argc,
char **argv)
157 typedef JModifier<JPMTPhysicalAddress> JModifier_t;
170 JParser<> zap(
"Auxiliary program to edit PMT parameters map.");
172 zap[
'a'] =
make_field(detectorFile,
"detector file.") =
"";
173 zap[
'D'] =
make_field(detectorID,
"detector identifier (in absence of detector file).") = 0;
176 zap[
'T'] =
make_field(T_ns,
"time-over-threshold range.") = JRange_t();
182 catch(
const exception &error) {
183 FATAL(error.what() << endl);
187 if (detectorFile !=
"") {
200 if (detectorID == 0) {
204 }
else if (detectorID !=
detector.getID()) {
206 FATAL(
"Inconsistent detector identifier " << detectorID <<
" != " <<
detector.getID() << endl);
210 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
212 for (
unsigned int pmt = 0; pmt != module->size(); ++pmt) {
216 if (parameters.find(
id) == parameters.end()) {
218 NOTICE(
"Setting default parameters for PMT " <<
id << endl);
226 if (!modifier.empty()) {
229 FATAL(
"Invalid detector identifier " << detectorID << endl);
234 for (JPMTParametersMap::iterator ps = parameters.begin(); ps != parameters.end(); ++ps) {
240 if (i->address == address || i->address == WILDCARD) {
242 NOTICE(
"Modifying parameters for PMT " << ps->first << endl);
244 if (!i->apply(ps->second)) {
245 ERROR(
"No valid action: " << *i << endl);
253 if (T_ns != JRange_t()) {
257 for (JPMTParametersMap::iterator i = parameters.begin(); i != parameters.end(); ++i) {
262 cpu.
getNPE(T_ns.getUpperLimit(), NPE),
266 cpu.
getNPE(T_ns.getUpperLimit(), NPE),
278 out << parameters << endl;