26{
28
29 string inputFile;
32 ULong_t seed;
34
35 try {
36
37 JParser<> zap(
"Example program to find smallest distance between two points.");
38
44
45 zap(argc, argv);
46 }
47 catch(const exception &error) {
48 FATAL(error.what() << endl);
49 }
50
51 gRandom->SetSeed(seed);
52
54
55
57
59
60
61 if (inputFile != "") {
62
63 ifstream in(inputFile.c_str());
64
65 for (
double x, y, z; in >>
x >>
y >> z; ) {
67 }
68
69 in.close();
70
72
74
76
80 }
81
83
85
86 for (const_iterator i = buffer.begin(); i != buffer.end(); ++i)
87 out <<
setw(7) << i->getX() <<
' '
88 <<
setw(7) << i->getX() <<
' '
90
91 out.close();
92 }
93 }
94
95 if (buffer.size() < 2) {
97 }
98
99 for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
100 DEBUG(i->getX() <<
' ' << i->getY() <<
' ' << i->getZ() <<
endl);
101 }
102
103
104 {
106
107 timer.start();
108
110
111 for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
112 for (const_iterator j = i; ++
j != buffer.end(); ) {
113
114 const double d = i->getDistance(*j);
115
116 if (d < dmin) {
117 dmin = d;
118 }
119 }
120 }
121
122 timer.stop();
123
126 }
127
128
129 JTimer timer(
"O(n log(n))");
130
131 timer.start();
132
133 const double dmin = getSmallestDistance3D(buffer.begin(), buffer.end());
134
135 timer.stop();
136
139}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Auxiliary class for CPU timing and usage.
Data structure for vector in three dimensions.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.