00001
00002
00003
00004
00005
00006
00007
00008 #include <iostream.h>
00009 using std::cout;
00010 using std::endl;
00011
00012 #include "jbltools/kinfit/JetFitObject.h"
00013 #include "jbltools/kinfit/PxConstraint.h"
00014 #include "jbltools/kinfit/PyConstraint.h"
00015 #include "jbltools/kinfit/MassConstraint.h"
00016 #include "jbltools/kinfit/WWFitter.h"
00017 #include "jbltools/kinfit/FourJetPairing.h"
00018
00019
00020 int main(int argc, char** argv) {
00021
00022
00023
00024
00025
00026 bool equal_mass_constraint = false;
00027
00028 enum {NJETS = 4};
00029
00030
00031 JetFitObject j1 (47., 0.84 , 0.64, 5.0, 0.1, 0.1, 0.);
00032 JetFitObject j2 (45., 2.30 , 2.50, 5.0, 0.1, 0.1, 0.);
00033 JetFitObject j3 (46., 0.996, 3.83, 5.0, 0.1, 0.1, 0.);
00034 JetFitObject j4 (42., 2.21 , 5.82, 5.0, 0.1, 0.1, 0.);
00035
00036
00037 JetFitObject fitjets[NJETS] = {j1, j2, j3, j4};
00038
00039
00040 JetFitObject *jets[NJETS];
00041 for (int i = 0; i < NJETS; ++i) jets[i] = &fitjets[i];
00042
00043 FourJetPairing pairing (jets);
00044 JetFitObject *permutedjets[NJETS];
00045
00046 for (int iperm = 0; iperm < pairing.getNPerm(); iperm++) {
00047
00048 cout << "=================================================" << endl;
00049 cout << " iperm = " << iperm << endl;
00050
00051
00052 fitjets[0] = j1;
00053 fitjets[1] = j2;
00054 fitjets[2] = j3;
00055 fitjets[3] = j4;
00056
00057 pairing.nextPermutation (permutedjets);
00058
00059 for (int i = 0; i < NJETS; ++i)
00060 cout << "start four-vector of jet " << i << ": " << *(permutedjets[i]) << endl;
00061
00062 PxConstraint pxc;
00063 for (int i = 0; i < NJETS; ++i)
00064 pxc.addToFOList (*(permutedjets[i]));
00065
00066 PyConstraint pyc;
00067 for (int i = 0; i < NJETS; ++i)
00068 pyc.addToFOList (*(permutedjets[i]));
00069
00070 MassConstraint w(0.);
00071 MassConstraint w1(80.4);
00072 MassConstraint w2(80.4);
00073
00074 if (equal_mass_constraint) {
00075
00076 w.addToFOList (*(permutedjets[0]), 1);
00077 w.addToFOList (*(permutedjets[1]), 1);
00078 w.addToFOList (*(permutedjets[2]), 2);
00079 w.addToFOList (*(permutedjets[3]), 2);
00080 cout << "start mass of W 1: " << w.getMass(1) << endl;
00081 cout << "start mass of W 2: " << w.getMass(2) << endl;
00082
00083 }
00084 else {
00085
00086 w1.addToFOList (*(permutedjets[0]));
00087 w1.addToFOList (*(permutedjets[1]));
00088 cout << "start mass of W 1: " << w1.getMass() << endl;
00089
00090 w2.addToFOList (*(permutedjets[2]));
00091 w2.addToFOList (*(permutedjets[3]));
00092 cout << "start mass of W 2: " << w2.getMass() << endl;
00093
00094 }
00095
00096 WWFitter fitter;
00097 for (int i = 0; i < NJETS; ++i)
00098 fitter.addFitObject (*(permutedjets[i]));
00099 fitter.addConstraint (pxc);
00100 fitter.addConstraint (pyc);
00101 if (equal_mass_constraint) fitter.addConstraint (w);
00102 else {
00103 fitter.addConstraint (w1);
00104 fitter.addConstraint (w2);
00105 }
00106
00107 double prob = fitter.fit();
00108 cout << "fit probability = " << prob << endl;
00109 for (int i = 0; i < NJETS; ++i)
00110 cout << "final four-vector of jet " << i << ": " << *(permutedjets[i]) << endl;
00111 if (equal_mass_constraint) {
00112 cout << "final mass of W 1: " << w.getMass(1) << endl;
00113 cout << "final mass of W 2: " << w.getMass(2) << endl;
00114 }
00115 else {
00116 cout << "final mass of W 1: " << w1.getMass() << endl;
00117 cout << "final mass of W 2: " << w2.getMass() << endl;
00118 }
00119
00120 }
00121
00122 return 0;
00123
00124
00125
00126 }