14 #include "TApplication.h" 
   31 int main(
int argc, 
char* argv[])
 
   43     JParser<> zap(
"Example program to find smallest distance between two points.");
 
   53   catch(
const exception &error) {
 
   54     FATAL(error.what() << endl);
 
   57   gRandom->SetSeed(seed);
 
   67   if (inputFile != 
"") {
 
   69     ifstream 
in(inputFile.c_str());
 
   71     for (
double x, y; 
in >> x >> y; ) {
 
   72       buffer.push_back(JVector2D(x,y));
 
   79     NOTICE(
"Seed: " << gRandom->GetSeed() << endl);
 
   83       buffer.push_back(JVector2D(gRandom->Uniform(-1.0, +1.0),
 
   84                                  gRandom->Uniform(-1.0, +1.0)));
 
   91       for (const_iterator i = buffer.begin(); i != buffer.end(); ++i)
 
   92         out << setw(7) << i->getX() << 
' '  
   93             << setw(7) << i->getY() << endl;
 
   99   if (buffer.size() < 2) {
 
  100     FATAL(
"Not enough points." << endl);
 
  103   for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
 
  104     DEBUG(i->getX() << 
' ' << i->getY() << endl);
 
  109     JTimer timer(
"classic");
 
  113     double dmin = numeric_limits<double>::max();
 
  115     for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
 
  116       for (const_iterator 
j = i; ++
j != buffer.end(); ) {
 
  118         const double d = i->getDistance(*
j);
 
  128     cout << 
"Minimal distance " << 
SCIENTIFIC(12,5) << dmin << endl;
 
  133   JTimer timer(
"O(n log(n))");
 
  141   cout << 
"Minimal distance " << 
SCIENTIFIC(12,5) << dmin << endl;
 
  149        << 
"(" << 
FIXED(7,5) << 
result.second->getX() << 
"," << 
FIXED(7,5) << 
result.second->getY() << 
")" << endl; 
 
  153   TApplication* tp = 
new TApplication(
"user", NULL, NULL);
 
  155   TCanvas cv(
"cv", 
"", 400, 400);
 
  157   cv.SetFillStyle(4000);
 
  164   const Int_t MAX_BUFFER_SIZE = buffer.size() + 1;
 
  166   Double_t  x[MAX_BUFFER_SIZE];
 
  167   Double_t  y[MAX_BUFFER_SIZE];
 
  171   for (const_iterator i = buffer.begin(); i != buffer.end(); ++i, ++
N) {
 
  177   Double_t xmin = -1.1;
 
  178   Double_t xmax = +1.1;
 
  179   Double_t ymin = -1.1;
 
  180   Double_t ymax = +1.1;
 
  182   TH2D h2(
"h2", 
"", 1000, xmin, xmax, 1000, ymin, ymax);
 
  190   g.SetMarkerStyle(20);
 
  191   g.SetMarkerColor(kBlack);
 
  192   g.SetMarkerSize(0.7);
 
  195   TMarker m1(
result.first ->getX(), 
result.first ->getY(), 20);
 
  196   TMarker m2(
result.second->getX(), 
result.second->getY(), 20);
 
  198   m1.SetMarkerColor(kRed);
 
  199   m2.SetMarkerColor(kRed);
 
  201   m1.SetMarkerSize(0.7);
 
  202   m2.SetMarkerSize(0.7);
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
static const JSmallestDistance2D getSmallestDistance2D
Function object for smallest distance determination. 
 
Auxiliary data structure for floating point format specification. 
 
I/O formatting auxiliaries. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
General purpose messaging. 
 
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
 
Utility class to parse command line options. 
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
Auxiliary data structure for floating point format specification. 
 
then usage $script[input file[working directory[option]]] nWhere option can be N
 
#define DEBUG(A)
Message macros.