Test program for fit of quaternions. 
   28{
   31 
   33  int          numberOfEvents;
   34  double       X;
   35  double       Y;
   36  double       Z;
   37  double       alpha;
   39  ULong_t      seed;
   40  bool         fit;
   42 
   43  try {
   44 
   45    JParser<> zap(
"Test program for fit of quaternions.");
 
   46 
   49    zap[
'x'] = 
make_field(X,               
"tilt angle around x-axis [deg]") = 0.0;
 
   50    zap[
'y'] = 
make_field(Y,               
"tilt angle around y-axis [deg]") = 0.0;
 
   51    zap[
'z'] = 
make_field(Z,               
"tilt angle around z-axis [deg]") = 0.0;
 
   52    zap[
'a'] = 
make_field(alpha,           
"twist angle [deg/m]");
 
   53    zap[
's'] = 
make_field(sigma,           
"(x,y,z) resolution [deg]");
 
   57 
   58    zap(argc, argv);
   59  }
   60  catch(const exception &error) {
   61    FATAL(error.what() << endl);
 
   62  }
   63 
   64 
   65  gRandom->SetSeed(seed);
   66 
   67 
   69 
   70  TH1D hc("chi2/NDF", NULL, 100, 0.0,  2.0);
   71  TH1D h0("tilt",     NULL, 100, 0.0,  2.0);
   72  TH1D h1("twist",    NULL, 100, 0.0,  0.1);
   73 
   74 
   75  
   76 
   81 
   84  
   85 
   87 
   89 
   91 
   93 
   94 
   95  for (int counter = 0; counter != numberOfEvents; ++counter) {
   96 
   97    STATUS(
"event: " << setw(10) << counter << 
'\r'); 
DEBUG(endl);
 
   98 
   99    
  100 
  101    const int    N   = 18;                         
  102    const double z1  = 30.0;                       
  103    const double dz  = 10.0;                       
  104    const double eps = 1.0e-6;                     
  105 
  107 
  108    for (int i = 1; i <= N; ++i) {
  109 
  110      const double z = z1 + (i - 1) * dz;          
  111 
  113    }
  114 
  115    
  116 
  121    }
  122 
  123    for (vector<JHit>::const_iterator i = 
data.begin(); i != 
data.end(); ++i) {
 
  124      DEBUG(
FIXED(4,1) << i->getZ() << 
' ' << 
FIXED(12,8) << i->getQuaternion() << endl);
 
  125    }
  126 
  127 
  129 
  132 
  133    if (fit) {
  134 
  136 
  137      simplex.
step.resize(4);
 
  138 
  143 
  144      const double chi2 = simplex(getChi2, 
data.begin(), 
data.end());  
 
  145      const int    ndf  = 
data.size() * 4 - simplex.
step.size();
 
  146 
  148 
  150 
  151      DEBUG(
"chi2 " << chi2 << 
'/' << ndf << endl);
 
  154 
  155      hc.Fill(chi2 / ndf);
  156    }
  157 
  158    
  162  }
  164 
  165  out.Write();
  166  out.Close();
  167}
#define DEBUG(A)
Message macros.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Simple fit method based on Powell's algorithm, see reference: Numerical Recipes in C++,...
 
std::vector< JModel_t > step
 
Data structure for direction in three dimensions.
 
Data structure for position in three dimensions.
 
Data structure for unit quaternion in three dimensions.
 
Utility class to parse command line options.
 
double getChi2(const double P)
Get chi2 corresponding to given probability.
 
double getAngle(const JQuaternion3D &first, const JQuaternion3D &second)
Get space angle between quanternions.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
Auxiliary data structure for floating point format specification.
 
Model for fit to acoustics data.
 
Auxiliary data structure for chi2 evaluation.
 
static int debug
debug level (default is off).
 
This class represents a rotation around the x-axis.
 
This class represents a rotation around the y-axis.
 
This class represents a rotation around the z-axis.