Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

testtrackfit.C

Go to the documentation of this file.
00001 // testtrackfit
00002 // Test program to test fitter classes for tracks 
00003 // B. List, J. List, 17.11.04
00004 
00005 
00006 #include <iostream>              // - cout
00007 using std::cout;
00008 using std::endl;
00009 
00010 #include "jbltools/kinfit/ChargedParticleTrack.h"
00011 #include "jbltools/kinfit/TTVertexConstraint.h"
00012 #include "jbltools/kinfit/ThreeVector.h"
00013 #include "jbltools/kinfit/FourVector.h"
00014 #include "jbltools/kinfit/WWFitter.h"
00015 
00016 
00017 int main(int argc, char** argv) {
00018 
00019   TrackFitObject::setBfield (11.4);
00020    
00021   ChargedParticleTrack t1 ("pi1", 0.01, 1.57, 1.1, 1.0, 5.0, 0.135, 1, 0.0, 100.);
00022   
00023   cout << t1 << endl;
00024   
00025   for (double s = 0; s < 50; s += 1.0) {
00026     cout << "s=" << s << ", track=" << t1.getTrajectoryPoint (s) << endl;
00027   
00028   }
00029 
00030   ChargedParticleTrack t2 ("pi2", -0.015, 1.7, 1.3, 0.5, 4.0, 0.135, 1, 0.0, 100.);
00031   
00032   TTVertexConstraint vc_x (t1, 0, t2, 0, 0);
00033   TTVertexConstraint vc_y (t1, 0, t2, 0, 1);
00034   TTVertexConstraint vc_z (t1, 0, t2, 0, 2);
00035   
00036   cout << "t1 = " << t1 << "\nt2 = " << t2 << endl;
00037   cout << "p1 = " << t1.getMomentum(0) 
00038        << "\np2 = " << t2.getMomentum(0) << endl;
00039   
00040   WWFitter fitter;
00041   fitter.addFitObject (t1);
00042   fitter.addFitObject (t2);
00043   fitter.addConstraint (vc_x);
00044   fitter.addConstraint (vc_y);
00045   fitter.addConstraint (vc_z);
00046     
00047   double prob = fitter.fit();
00048   cout << "fit probability = " << prob << endl;
00049   cout << "error code: " << fitter.getError() << endl;
00050   cout << "t1 = " << t1 << "\nt2 = " << t2 << endl;
00051   cout << "t1.startvertex = " << t1.getVertex(0)
00052        << "\nt2.startvertex = " << t2.getVertex(0) << endl;
00053   cout << "p1 = " << t1.getMomentum(0) 
00054        << "\np2 = " << t2.getMomentum(0) << endl;
00055   
00056   return 0;
00057   
00058    
00059 }

Generated on Fri Sep 14 17:38:21 2007 for Kinfit by doxygen 1.3.2