30{
   33 
   34  string         inputFile;
   36  int            numberOfEvents;
   37  double         precision;
   39 
   40  try {
   41 
   42    JParser<> zap(
"Test program for vertex fit.");
 
   43 
   49 
   50    zap(argc, argv);
   51  }
   52  catch(const exception& error) {
   53    FATAL(error.what() << endl);
 
   54  }
   55 
   56 
   57  TH1D hx("hx", NULL, 101, -1.0, +1.0);
   58  TH1D hy("hy", NULL, 101, -1.0, +1.0);
   59  TH1D hz("hz", NULL, 101, -1.0, +1.0);
   60  TH1D ht("ht", NULL, 101, -1.0, +1.0);
   61 
   66 
   67 
   69 
   71 
   72  if (inputFile != "") {
   73 
   74    ifstream in(inputFile.c_str());
   75    
   76    for (
double x, y, z; in >> 
x >> 
y >> z; ) {
 
   78    }
   79    
   80    in.close();
   81 
   82  } else {
   83 
   84    for (
double x = -50.0; 
x < 100.0; 
x += 100.0) {
 
   85      for (
double y = -50.0; 
y < 100.0; 
y += 100.0) {
 
   86        for (double z = -50.0; z < 100.0; z += 100.0) {
   88        }
   89      }
   90    }
   91  }
   92 
   93 
   95 
   96  const double xmin = -1.0;
 
   97  const double xmax = +1.0;
 
   98 
   99  const double tmin = -1.0;
  100  const double tmax = +1.0;
  101 
  102 
  103  for (int i = 0; i != numberOfEvents; ++i) {
  104 
  105    
  106 
  107    const double x = gRandom->Uniform(xmin, xmax);
 
  108    const double y = gRandom->Uniform(xmin, xmax);
 
  109    const double z = gRandom->Uniform(xmin, xmax);
  110    const double t = gRandom->Uniform(tmin, tmax);
  111 
  113 
  115          << 
FIXED(7,3) << point.getX() << 
' '  
  116          << 
FIXED(7,3) << point.getY() << 
' '  
  117          << 
FIXED(7,3) << point.getZ() << 
' '  
  118          << 
FIXED(7,3) << point.getT() << endl);
 
  119 
  120    
  121    
  123 
  124    for (JDetector_t::const_iterator pos = 
detector.begin(); pos != 
detector.end(); ++pos) {
 
  125      data.push_back(
JHit_t(*pos, point.getT(*pos)));
 
  126    }
  127 
  128    for (vector<JHit_t>::const_iterator hit = 
data.begin(); hit != 
data.end(); ++hit) {
 
  130            << 
FIXED(7,3) << hit->getX() << 
' '  
  131            << 
FIXED(7,3) << hit->getY() << 
' '  
  132            << 
FIXED(7,3) << hit->getZ() << 
' '  
  133            << 
FIXED(7,3) << hit->getT() << endl);
 
  134    }
  135 
  136    
  137 
  139 
  145 
  146    hx.Fill(point.getX() - 
result.getX());
 
  147    hy.Fill(point.getY() - 
result.getY());
 
  148    hz.Fill(point.getZ() - 
result.getZ());
 
  149    ht.Fill(point.getT() - 
result.getT());
 
  150 
  151    Qx.put(point.getX() - 
result.getX());
 
  152    Qy.put(point.getY() - 
result.getY());
 
  153    Qz.put(point.getZ() - 
result.getZ());
 
  154    Qt.put(point.getT() - 
result.getT());
 
  155  }
  156 
  157  if (
debug >= debug_t) {
 
  158    Qx.print(cout);
  159    Qy.print(cout);
  160    Qz.print(cout);
  161    Qt.print(cout);
  162  }
  163 
  165 
  167    
  168    out << hx << hy << hz << ht;
  169 
  170    out.Write();
  171    out.Close();
  172  }
  173 
  174  ASSERT(numberOfEvents > 0);
 
  175 
  176  ASSERT(fabs(Qx.getMean()) <= precision);
 
  177  ASSERT(fabs(Qy.getMean()) <= precision);
 
  178  ASSERT(fabs(Qz.getMean()) <= precision);
 
  179  ASSERT(fabs(Qt.getMean()) <= precision);
 
  180 
  181  ASSERT(Qx.getSTDev() <= precision);
 
  182  ASSERT(Qy.getSTDev() <= precision);
 
  183  ASSERT(Qz.getSTDev() <= precision);
 
  184  ASSERT(Qt.getSTDev() <= precision);
 
  185 
  186  return 0;
  187}
#define DEBUG(A)
Message macros.
 
#define ASSERT(A,...)
Assert macro.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Template definition of linear fit.
 
Data structure for vertex fit.
 
Data structure for vector in three dimensions.
 
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.
 
Auxiliary class to set-up Hit.