27int main(
int argc,
char**argv)
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;
60 catch(
const exception &error) {
71 TH1D h0(
"tilt",
NULL, 100, 0.0, 2.0);
72 TH1D h1(
"twist",
NULL, 100, 0.0, 0.1);
86 JSimplex<JModel> simplex;
88 JSimplex<JModel>::MAXIMUM_ITERATIONS = 10000;
90 simplex.debug =
debug;
92 const JChi2 getChi2(EM_NORMAL);
95 for (
int counter = 0; counter != numberOfEvents; ++counter) {
102 const double z1 = 30.0;
103 const double dz = 10.0;
104 const double eps = 1.0e-6;
108 for (
int i = 1; i <= N; ++i) {
110 const double z =
z1 + (i - 1) *
dz;
128 JModel result(data.begin(), data.end());
130 DEBUG(
"R0 " <<
FIXED(12,8) << result.Q0 <<
' ' << getAngle(model.Q0, result.Q0) <<
endl);
131 DEBUG(
"R1 " <<
FIXED(12,8) << result.Q1 <<
' ' << getAngle(model.Q1, result.Q1) <<
endl);
135 simplex.value = result;
137 simplex.step.resize(4);
144 const double chi2 = simplex(getChi2, data.begin(), data.end());
145 const int ndf = data.size() * 4 - simplex.step.size();
147 DEBUG(
"number of iterations " << simplex.numberOfIterations <<
endl);
149 result = simplex.value;
151 DEBUG(
"chi2 " << chi2 <<
'/' << ndf <<
endl);
152 DEBUG(
"R0 " <<
FIXED(12,8) << simplex.value.Q0 <<
' ' << getAngle(model.Q0, result.Q0) <<
endl);
153 DEBUG(
"R1 " <<
FIXED(12,8) << simplex.value.Q1 <<
' ' << getAngle(model.Q1, result.Q1) <<
endl);
159 h0.Fill(getAngle(
JDirection3D(0.0, 0.0, 1.0).rotate(model .Q0),
161 h1.Fill(getAngle(model.Q1, result.Q1));