223 JParser<> zap(
"Auxiliary program to edit PMT parameters map.");
225 zap[
'a'] =
make_field(detectorFile,
"detector file.") =
"";
226 zap[
'D'] =
make_field(detectorID,
"detector identifier (in absence of detector file).") = 0;
231 zap[
'E'] =
make_field(mu,
"expectation value for npe given two-fold coincidence") = 0.0;
234 zap[
'q'] =
make_field(squash,
"squash meta data");
239 catch(
const exception &error) {
240 FATAL(error.what() << endl);
251 for (
vector< JModifier<> >::const_iterator i = hdr.begin(); i != hdr.end(); ++i) {
253 DEBUG(
"Modifying default PMT parameters " << i->action <<
' ' << i->key <<
' ' << i->value << endl);
255 if (!i->apply(
parameters.getDefaultPMTParameters())) {
256 ERROR(
"No valid action: " << *i << endl);
260 if (detectorFile !=
"") {
267 load(detectorFile, detector);
273 if (detectorID == 0) {
275 detectorID = detector.
getID();
277 }
else if (detectorID != detector.
getID()) {
279 FATAL(
"Inconsistent detector identifier " << detectorID <<
" != " << detector.
getID() << endl);
283 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
285 for (
unsigned int pmt = 0; pmt != module->size(); ++pmt) {
291 DEBUG(
"Setting default parameters for PMT " <<
id << endl);
302 FATAL(
"Invalid detector identifier " << detectorID << endl);
311 for (
vector< JModifier<JPMTPhysicalAddress> >::const_iterator i = mod.begin(); i != mod.end(); ++i) {
313 if (compare(i->address, address)) {
315 DEBUG(
"Modifying parameters for PMT " << ps->first <<
' ' << i->action <<
' ' << i->key <<
' ' << i->value << endl);
317 if (!i->apply(ps->second)) {
318 ERROR(
"No valid action: " << *i << endl);
329 for (
vector< JModifier<JPMTIdentifier> >::const_iterator i = daq.begin(); i != daq.end(); ++i) {
331 if (compare(ps->first, i->address)) {
333 DEBUG(
"Modifying parameters for PMT " << ps->first <<
' ' << i->action <<
' ' << i->key <<
' ' << i->value << endl);
335 if (!i->apply(ps->second)) {
336 ERROR(
"No valid action: " << *i << endl);
346 DEBUG(
"Correct measured QE for two-hit probability " << mu << endl);
355 }
else if (mu < 0.0) {
357 FATAL(
"Invalid expection value for two-hit probability " << mu << endl);
363 DEBUG(
"Correct measured QE for time-over-threshold range " << T_ns << endl);
371 i->second.QE *= (cpu.getIntegralOfChargeProbability(i->second.threshold,
372 cpu.getNPE(T_ns.getUpperLimit()),
375 cpu.getIntegralOfChargeProbability(cpu.getNPE(T_ns.getLowerLimit()),
376 cpu.getNPE(T_ns.getUpperLimit()),
Utility class to parse command line options.
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
*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
Lookup table for PMT addresses in detector.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
const JModuleAddressMap & get(const int id) const
Get module address map.
Type definition of range.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getID() const
Get identifier.
Auxiliary class for map of PMT parameters.
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
PMT analogue signal processor.
virtual const char * what() const override
Get error message.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Data structure for PMT physical address.
do set_variable DETECTOR_TXT $WORKDIR detector
#define DEBUG(A)
Message macros.