00001
00002
00003
00004
00005
00006
00007
00008
00009
00011 #include "jbltools/kinfit/TopEvent.h"
00012
00013 #include "jbltools/kinfit/JetFitObject.h"
00014 #include "jbltools/kinfit/MassConstraint.h"
00015 #include "jbltools/kinfit/cernlib.h"
00016
00017 #include <iostream>
00018 using std::cout;
00019 using std::endl;
00020
00021
00022 TopEvent::TopEvent()
00023 : pxc (1, 0),
00024 pyc (0, 1)
00025 {
00026 for (int i = 0; i < NFV; ++i) fv[i] = 0;
00027 for (int i = 0; i < NBFO; ++i) bfo[i] = bfosmear[i] = 0;
00028 w1.setMass(80.4);
00029 w2.setMass(80.4);
00030 };
00031
00032
00033 TopEvent::~TopEvent() {
00034 for (int i = 0; i < NFV; ++i) delete fv[i];
00035 for (int i = 0; i < NBFO; ++i) {
00036 delete bfo[i];
00037 delete bfosmear[i];
00038 }
00039 };
00040
00041
00042 double TopEvent::genX(double lambda, double xmin) {
00043
00044
00045 assert (lambda != -1);
00046 using std::pow;
00047 FReal randoms[1];
00048 ranmar (randoms, 1);
00049
00050 double ymin = pow (xmin, 1-lambda);
00051 return pow (randoms[0]*(1-ymin)+ymin, 1./(1-lambda));
00052 };
00053
00054
00055
00056
00057 void TopEvent::genEvent(){
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 double mtop = 174;
00072 double mW = 80.4;
00073 double mb = 5.0;
00074 double mj = 1.0;
00075
00076 double lambda = 1.5;
00077 double Ebeam = 900;
00078 double s = 4*Ebeam*Ebeam;
00079 double shatmin = 4*mtop*mtop;
00080 double xmin = shatmin/s;
00081
00082
00083 double x1, x2, shat;
00084 do {
00085 x1 = genX (lambda, xmin);
00086 x2 = genX (lambda, xmin);
00087 shat = x1*x2*s;
00088
00089 } while (shat < shatmin);
00090
00091 FourVector *toppair = fv[0] = new FourVector ((x1+x2)*Ebeam, 0, 0, (x1-x2)*Ebeam);
00092 FourVector *top1 = fv[1] = new FourVector (mtop, 0, 0, 0);
00093 FourVector *top2 = fv[2] = new FourVector (mtop, 0, 0, 0);
00094
00095 toppair->decayto (*top1, *top2);
00096
00097 FourVector *W1 = fv[3] = new FourVector (mW, 0, 0, 0);
00098 FourVector *W2 = fv[4] = new FourVector (mW, 0, 0, 0);
00099 FourVector *b1 = fv[5] = new FourVector (mb, 0, 0, 0);
00100 FourVector *b2 = fv[8] = new FourVector (mb, 0, 0, 0);
00101
00102 top1->decayto (*W1, *b1);
00103 top2->decayto (*W2, *b2);
00104
00105 FourVector *j11 = fv[6] = new FourVector (mj, 0, 0, 0);
00106 FourVector *j12 = fv[7] = new FourVector (mj, 0, 0, 0);
00107 FourVector *j21 = fv[9] = new FourVector (mj, 0, 0, 0);
00108 FourVector *j22 = fv[10] = new FourVector (mj, 0, 0, 0);
00109
00110 W1->decayto (*j11, *j12);
00111 W2->decayto (*j21, *j22);
00112
00113 double Eresol = 0.35;
00114 double thetaResol = 0.1;
00115 double phiResol = 0.1;
00116
00117 for (int j = 0; j < 6; ++j) {
00118 int i = j+5;
00119 double E = fv[i]->getE();
00120 double theta = fv[i]->getTheta();
00121 double phi = fv[i]->getPhi();
00122 double EError = Eresol*sqrt(E);
00123
00124
00125 bfo[j] = new JetFitObject (E, theta, phi, EError, thetaResol, phiResol, 0.);
00126
00127 FReal randoms[3];
00128 rnorml (randoms, 3);
00129
00130
00131 double ESmear = E + EError*randoms[0];
00132 double thetaSmear = theta + thetaResol*randoms[1];
00133 double phiSmear = phi + phiResol*randoms[2];
00134
00135 bfosmear[j] = new JetFitObject (ESmear, thetaSmear, phiSmear, EError, thetaResol, phiResol, 0.);
00136 pxc.addToFOList (*bfosmear[j]);
00137 pyc.addToFOList (*bfosmear[j]);
00138 w.addToFOList (*bfosmear[j], j<3?1:2);
00139
00140 }
00141
00142 w1.addToFOList (*bfosmear[1]);
00143 w1.addToFOList (*bfosmear[2]);
00144 w2.addToFOList (*bfosmear[4]);
00145 w2.addToFOList (*bfosmear[5]);
00146
00147 };
00148
00149
00150 int TopEvent::fitEvent (BaseFitter& fitter){
00151
00152
00153
00154
00155
00156
00157
00158
00159 fitter.reset();
00160
00161 for (int i = 0; i < 6; i++) {
00162 assert (bfosmear[i]);
00163 fitter.addFitObject (*bfosmear[i]);
00164
00165
00166
00167 }
00168
00169
00170
00171
00172
00173
00174 fitter.addConstraint (pxc);
00175 fitter.addConstraint (pyc);
00176 fitter.addConstraint (w);
00177 fitter.addConstraint (w1);
00178 fitter.addConstraint (w2);
00179
00180 double prob = fitter.fit();
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190 cout << "fit probability = " << prob << ", top mass: " << w.getMass() << endl;
00191
00192
00193 return fitter.getError();
00194
00195
00196 };