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

TopEvent.C

Go to the documentation of this file.
00001 
00002 // Class TopEvent
00003 //
00004 // Author: Benno List, Jenny Boehme
00005 // Last update: $Date: 2005/01/12 10:11:46 $
00006 //          by: $Author: blist $
00007 // 
00008 // Description: class to generate and fit top pair events
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>              // - cout
00018 using std::cout;
00019 using std::endl;
00020 
00021 // constructor: 
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 //destructor: 
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 // generate x value
00042 double TopEvent::genX(double lambda, double xmin) {
00043   // Generate an x value between xmin and 1 distributed like x^-lambda,
00044   // lambda mustnot be -1!
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 // generate four vectors
00057 void TopEvent::genEvent(){
00058   // generate 4-vectors of top-decay:
00059   // 0: top-top-system -> top1 top2
00060   // 1: top 1 -> W1 b1
00061   // 2: top 2 -> W2 b2
00062   // 3: W1 -> j11 j12
00063   // 4: W2 -> j21 j22
00064   // 5: b1
00065   // 6: j11
00066   // 7: j12
00067   // 8: b2
00068   // 9: j21
00069   //10: j22
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   // x1, x2 are distributed according to x^-lambda
00083   double x1, x2, shat;
00084   do {
00085     x1 = genX (lambda, xmin);
00086     x2 = genX (lambda, xmin);
00087     shat = x1*x2*s;
00088 //    std::cout << "x1=" << x1 << ", x2=" << x2 << ", shat=" << shat << endl;
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;     // 35% / sqrt (E)
00114   double thetaResol = 0.1;  // rad
00115   double phiResol = 0.1;    // rad
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     // Create fit object with true quantities for later comparisons
00125     bfo[j] = new JetFitObject (E, theta, phi, EError, thetaResol, phiResol, 0.);
00126     
00127     FReal randoms[3];
00128     rnorml (randoms, 3);
00129     
00130     // Create fit object with smeared quantities as fit input
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 // fit it!
00150 int TopEvent::fitEvent (BaseFitter& fitter){
00151   
00152 //   for (int i = 0; i < 6; ++i) 
00153 //     cout << "true four-vector of jet " << i << ": " << *bfo[i] << endl;
00154 //   for (int i = 0; i < 6; ++i) 
00155 //     cout << "initial four-vector of jet " << i << ": " << *bfosmear[i] << endl;
00156   
00157   
00158   // reset lists of constraints and fitobjects
00159   fitter.reset();
00160    
00161   for (int i = 0; i < 6; i++) {
00162     assert (bfosmear[i]);
00163     fitter.addFitObject (*bfosmear[i]);
00164 //     pxc.addToFOList (*bfosmear[i]);
00165 //     pyc.addToFOList (*bfosmear[i]);
00166 //     w.addToFOList (*bfosmear[i], i<3?1:2);
00167   }
00168 //   
00169 //   w1.addToFOList (*bfosmear[1]);
00170 //   w1.addToFOList (*bfosmear[2]);
00171 //   w2.addToFOList (*bfosmear[4]);
00172 //   w2.addToFOList (*bfosmear[5]);
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 //   cout << "fit probability = " << prob << endl;
00183 //   for (int i = 0; i < 6; ++i) 
00184 //     cout << "final four-vector of jet " << i << ": " << *bfosmear[i] << endl;
00185 //   cout << "Constraint pxc: " << pxc.getValue() << endl;
00186 //   cout << "Constraint pxc: " << pxc.getValue() << endl;
00187 //   cout << "Constraint w:   " << w.getValue() << ", top mass: " << w.getMass() << endl;
00188 //   cout << "Constraint w1:  " << w1.getValue() << ", W mass: " << w1.getMass() << endl;
00189 //   cout << "Constraint w2:  " << w2.getValue() << ", W mass: " << w2.getMass() << endl;
00190    cout << "fit probability = " << prob << ", top mass: " << w.getMass() << endl;
00191 
00192    
00193    return fitter.getError();
00194 
00195 
00196 };

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