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

testwwfit3.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/NeutrinoFitObject.h"
00012 #include "jbltools/kinfit/PxConstraint.h"
00013 #include "jbltools/kinfit/PyConstraint.h"
00014 #include "jbltools/kinfit/MassConstraint.h"
00015 #include "jbltools/kinfit/WWFitter.h"
00016 
00017 
00018 int main(int argc, char** argv) {
00019  
00020   // W+W- -> 2 jets, 1 lepton, 1 neutrino event
00021   
00022   // false: each W is constraint individually
00023   // true: equal mass constraint
00024   bool equal_mass_constraint = false;
00025    
00026   JetFitObject j1 (45.7, 0.837 , 0.647,  5.0, 0.1, 0.1, 0.);
00027   JetFitObject j2 (44.3, 2.293 , 2.501,  5.0, 0.1, 0.1, 0.);
00028   JetFitObject j3 (47.3,  0.998,  3.822,  5.0, 0.1, 0.5, 0.);
00029 //  NeutrinoFitObject n4 (42.6, 2.216 , 5.819,  5.0, 0.1, 0.1, 0.);
00030 //   NeutrinoFitObject n4 (35., 2. , 6.,  5.0, 0.1, 0.1, 0.);
00031    NeutrinoFitObject n4 (10., 1.5, 0.,  5.0, 0.1, 0.1, 0.);
00032   
00033   cout << "start four-vector of jet 1: " << j1 << endl;
00034   cout << "start four-vector of jet 2: " << j2 << endl;
00035   cout << "start four-vector of jet 3: " << j3 << endl;
00036   cout << "start four-vector of jet 4: " << n4 << endl;
00037   
00038   PxConstraint pxc;
00039   pxc.addToFOList (j1);
00040   pxc.addToFOList (j2);
00041   pxc.addToFOList (j3);
00042   pxc.addToFOList (n4);
00043   cout << "start value of px constraint: " << pxc.getValue() << endl;
00044   
00045   PyConstraint pyc;
00046   pyc.addToFOList (j1);
00047   pyc.addToFOList (j2);
00048   pyc.addToFOList (j3);
00049   pyc.addToFOList (n4);
00050   cout << "start value of py constraint: " << pyc.getValue() << endl;
00051   
00052   MassConstraint w(0.);
00053   MassConstraint w1(80.4);
00054   MassConstraint w2(80.4);
00055  
00056   if (equal_mass_constraint) {
00057     
00058     w.addToFOList (j1, 1);
00059     w.addToFOList (j2, 1);
00060     w.addToFOList (j3, 2);
00061     w.addToFOList (n4, 2);
00062     cout << "start mass of W 1: " << w.getMass(1) << endl;
00063     cout << "start mass of W 2: " << w.getMass(2) << endl;
00064   
00065   }
00066   else {  
00067   
00068     w1.addToFOList (j1);
00069     w1.addToFOList (j2);
00070     cout << "start mass of W 1: " << w1.getMass() << endl;
00071 //    cout << "start value of w1 constraint: " << w1.getValue() << endl;
00072   
00073     w2.addToFOList (j3);
00074     w2.addToFOList (n4);
00075     cout << "start mass of W 2: " << w2.getMass() << endl; 
00076     cout << "start value of w2 constraint: " << w2.getValue() << endl;
00077      
00078   }
00079   
00080   WWFitter fitter;
00081   fitter.addFitObject (j1);
00082   fitter.addFitObject (j2);
00083   fitter.addFitObject (j3);
00084   fitter.addFitObject (n4);
00085   fitter.addConstraint (pxc);
00086   fitter.addConstraint (pyc);
00087   if (equal_mass_constraint) fitter.addConstraint (w);
00088   else {
00089 //    fitter.addConstraint (w1);
00090     fitter.addConstraint (w2);
00091   }
00092   
00093   double prob = fitter.fit();
00094   cout << "fit probability = " << prob << endl;
00095   cout << "final four-vector of jet 1: " << j1 << endl;
00096   cout << "final four-vector of jet 2: " << j2 << endl;
00097   cout << "final four-vector of jet 3: " << j3 << endl;
00098   cout << "final four-vector of jet 4: " << n4 << endl;
00099   
00100   cout << "final value of px constraint: " << pxc.getValue() << endl;
00101   cout << "final value of py constraint: " << pyc.getValue() << endl;
00102   if (equal_mass_constraint) {
00103     cout << "final value of w  constraint: " << w.getValue() << endl;
00104     cout << "final mass of W 1: " << w.getMass(1) << endl;
00105     cout << "final mass of W 2: " << w.getMass(2) << endl;
00106   }  
00107   else {
00108     cout << "final value of w1 constraint: " << w1.getValue() << endl;
00109     cout << "final value of w2 constraint: " << w2.getValue() << endl;
00110     cout << "final mass of W 1: " << w1.getMass() << endl;
00111     cout << "final mass of W 2: " << w2.getMass() << endl;
00112   }
00113   
00114   return 0;
00115   
00116   
00117    
00118 }

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