21 int main(
int argc,
char **argv)
35 JParser<> zap(
"Example program to test PMT signal processor probability.");
39 zap[
'p'] =
make_field(pmt) = JPMTIdentifier(-1,0);
46 catch(
const exception &error) {
47 FATAL(error.what() << endl);
51 const double QEmax = 1.0;
53 JPMTParameters buffer =
parameters.getPMTParameters(pmt);
55 DEBUG(
"PMT parameters:" << endl);
58 if (buffer.QE > QEmax) {
60 WARNING(
"PMT QE set to " << QEmax << endl);
67 for (JPMTSignalProcessorInterface* cpu : {
68 (JPMTSignalProcessorInterface*)
new JPMTSignalProcessorInterface(),
69 (JPMTSignalProcessorInterface*)
new JPMTAnalogueSignalProcessor(buffer) }) {
71 int number_of_hits = 0;
77 for (
int __i = 0; __i != NPE; ++__i) {
83 double x = cpu->getRandomCharge(npe);
87 if (cpu->applyThreshold(x)) {
91 }
catch (
const JValueOutOfRange& exception) {
93 DEBUG(exception.what());
99 const double P = (double) number_of_hits / (
double)
numberOfHits;
102 DEBUG(
"Number of accepted hits " << setw(8) << right << number_of_hits << endl);
103 DEBUG(
"Probability (real) " <<
FIXED(8,5) << P << endl);
104 DEBUG(
"Probability (calc) " <<
FIXED(8,5) << cpu->getSurvivalProbability(NPE) << endl);
106 ASSERT(fabs(P - cpu->getSurvivalProbability(NPE)) < precision * cpu->getSurvivalProbability(NPE));
Utility class to parse command line options.
int main(int argc, char *argv[])
*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
Simple data structure to support I/O of equations (see class JLANG::JEquation).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
#define ASSERT(A,...)
Assert macro.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Utility class to parse command line options.
PMT analogue signal processor.
#define DEBUG(A)
Message macros.