27{
30
32 int numberOfEvents;
33 double precision;
34 ULong_t seed;
36
37 try {
38
39 JParser<> zap(
"Example program to test angle of incidence of a photon from a muon on a PMT.");
40
46
47 zap(argc, argv);
48 }
49 catch(const exception &error) {
50 FATAL(error.what() << endl);
51 }
52
53 gRandom->SetSeed(seed);
54
55
57
58 int number_of_errors = 0;
59 int number_of_events = 0;
60
61 for (int i = 0; i != numberOfEvents; ++i) {
62
64
65 const double x = gRandom->Uniform(-1.0, +1.0);
66 const double y = gRandom->Uniform(-1.0, +1.0);
67 const double z = gRandom->Uniform(-1.0, +1.0);
68
69 const double dx = gRandom->Uniform(-1.0, +1.0);
70 const double dy = gRandom->Uniform(-1.0, +1.0);
71 const double dz = gRandom->Uniform(-1.0, +1.0);
72
75
76 tb.transform(ta);
77
78 if (ta.getDistance(pmt) > precision) {
79
80 ++number_of_events;
81
82
83
84 if (fabs(tb.getDirection().getDot(U) - ta.getDot(pmt)) > precision) {
85 ++number_of_errors;
86 }
87 }
88
89 DEBUG(
"distance " << ta.getDistance(pmt) << endl);
90 DEBUG(
"dot (1) " << tb.getDirection().getDot(U) << endl);
91 DEBUG(
"dot (2) " << ta.getDot(pmt) << endl);
92 }
94
95 NOTICE(
"Number of errors: " << number_of_errors <<
" out of " << number_of_events <<
" events." << endl);
96
97 ASSERT(number_of_events > 0);
98 ASSERT(number_of_errors == 0);
99
100 return 0;
101}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for vector in three dimensions.
Data structure for normalised vector in three dimensions.
Utility class to parse command line options.
double getCosThetaC()
Get average cosine of Cherenkov angle of water corresponding to group velocity.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).