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

testwwfit2.C

Go to the documentation of this file.
00001 // testwwfit
00002 // Test program to test fitter classes 
00003 // J. Boehme, B. List 3.4.04
00004 
00005 
00006 #include <iostream.h>              // - cout
00007 using std::cout;
00008 using std::endl;
00009 
00010 #include "jbltools/kinfit/JetFitObject.h"
00011 #include "jbltools/kinfit/PxConstraint.h"
00012 #include "jbltools/kinfit/PyConstraint.h"
00013 #include "jbltools/kinfit/MassConstraint.h"
00014 #include "jbltools/kinfit/WWFitter.h"
00015 
00016 
00017 int main(int argc, char** argv) {
00018  
00019   // W+W- -> 4 jets event
00020   
00021   // false: each W is constraint individually
00022   // true: equal mass constraint
00023   bool equal_mass_constraint = false;
00024    
00025   JetFitObject j1 (47., 0.84 , 0.64,  5.0, 0.1, 0.1, 0.);
00026   JetFitObject j2 (45., 2.30 , 2.50,  5.0, 0.1, 0.1, 0.);
00027   JetFitObject j3 (46., 0.996, 3.83,  5.0, 0.1, 0.1, 0.);
00028   JetFitObject j4 (42., 2.21 , 5.82,  5.0, 0.1, 0.1, 0.);
00029   
00030   cout << "start four-vector of jet 1: " << j1 << endl;
00031   cout << "start four-vector of jet 2: " << j2 << endl;
00032   cout << "start four-vector of jet 3: " << j3 << endl;
00033   cout << "start four-vector of jet 4: " << j4 << endl;
00034   
00035   PxConstraint pxc;
00036   pxc.addToFOList (j1);
00037   pxc.addToFOList (j2);
00038   pxc.addToFOList (j3);
00039   pxc.addToFOList (j4);
00040   
00041   PyConstraint pyc;
00042   pyc.addToFOList (j1);
00043   pyc.addToFOList (j2);
00044   pyc.addToFOList (j3);
00045   pyc.addToFOList (j4);
00046   
00047   MassConstraint w(0.);
00048   MassConstraint w1(80.4);
00049   MassConstraint w2(80.4);
00050  
00051   if (equal_mass_constraint) {
00052     
00053     w.addToFOList (j1, 1);
00054     w.addToFOList (j2, 1);
00055     w.addToFOList (j3, 2);
00056     w.addToFOList (j4, 2);
00057     cout << "start mass of W 1: " << w.getMass(1) << endl;
00058     cout << "start mass of W 2: " << w.getMass(2) << endl;
00059   
00060   }
00061   else {  
00062   
00063     w1.addToFOList (j1);
00064     w1.addToFOList (j2);
00065     cout << "start mass of W 1: " << w1.getMass() << endl;
00066   
00067     w2.addToFOList (j3);
00068     w2.addToFOList (j4);
00069     cout << "start mass of W 2: " << w2.getMass() << endl; 
00070      
00071   }
00072   
00073   WWFitter fitter;
00074   fitter.addFitObject (j1);
00075   fitter.addFitObject (j2);
00076   fitter.addFitObject (j3);
00077   fitter.addFitObject (j4);
00078   fitter.addConstraint (pxc);
00079   fitter.addConstraint (pyc);
00080   if (equal_mass_constraint) fitter.addConstraint (w);
00081   else {
00082     fitter.addConstraint (w1);
00083     fitter.addConstraint (w2);
00084   }
00085   
00086   double prob = fitter.fit();
00087   cout << "fit probability = " << prob << endl;
00088   cout << "final four-vector of jet 1: " << j1 << endl;
00089   cout << "final four-vector of jet 2: " << j2 << endl;
00090   cout << "final four-vector of jet 3: " << j3 << endl;
00091   cout << "final four-vector of jet 4: " << j4 << endl;
00092   if (equal_mass_constraint) {
00093     cout << "final mass of W 1: " << w.getMass(1) << endl;
00094     cout << "final mass of W 2: " << w.getMass(2) << endl;
00095   }  
00096   else {
00097     cout << "final mass of W 1: " << w1.getMass() << endl;
00098     cout << "final mass of W 2: " << w2.getMass() << endl;
00099   }
00100   
00101   return 0;
00102   
00103   
00104    
00105 }

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