Example program to test PMT signal processor probability.
More...
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test PMT signal processor probability.
- Author
- mdejong
Definition in file JPMTSignalProcessor.cc.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 21 of file JPMTSignalProcessor.cc.
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;
73 for (
int i = 0; i != numberOfHits; ++i) {
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;
101 DEBUG(
"Number of generated hits " << setw(8) << right << numberOfHits << endl);
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.
*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.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define DEBUG(A)
Message macros.