00001
00002
00003
00004
00005
00006
00007 #include <iostream>
00008 using std::cout;
00009 using std::endl;
00010
00011 #include "jbltools/kinfit/WWFitterFast.h"
00012 #include "jbltools/kinfit/WWFitter.h"
00013 #include "jbltools/kinfit/K0Event.h"
00014 #include "jbltools/kinfit/ftypes.h"
00015 #include "jbltools/kinfit/hbook.h"
00016 #include "jbltools/kinfit/TrackFitObject.h"
00017
00018
00019
00020 int main(int argc, char** argv) {
00021 int failed = 0;
00022 int total = 2;
00023
00024
00025 FInteger IERR;
00026 FReal FITPROB, CHI2;
00027 FReal V0TRUE[3], V1TRUE[3];
00028 FReal V0FIT[3], V1FIT[3], V2FIT[3];
00029 FReal P0TRUE[4], P1TRUE[4], P2TRUE[4];
00030 FReal P1SM[4], P2SM[4];
00031 FReal P0FIT[4], P1FIT[4], P2FIT[4];
00032 FReal PAR0TRUE[6], PAR1TRUE[6], PAR2TRUE[6];
00033 FReal PAR1SM[6], PAR2SM[6];
00034 FReal PAR1SMERR[6], PAR2SMERR[6];
00035 FReal PAR0FIT[6], PAR1FIT[6], PAR2FIT[6];
00036 FReal PAR0ERR[6], PAR1ERR[6], PAR2ERR[6];
00037 FReal DL2TRUE, DL2FIT, DL3TRUE, DL3FIT;
00038 FReal TTRUE, TFIT;
00039 FReal MTRUE, MFIT;
00040
00041
00042 FInteger LREC=1024, ISTAT=0;
00043 hropen (21, "K0FIT", "k0fit.hbook", "N", LREC, ISTAT);
00044 hbnt (999,"k0fit","");
00045 hbname (999, "FIT", IERR, "IERR:I");
00046 hbname (999, "FIT", FITPROB, "FITPROB:R");
00047 hbname (999, "FIT", CHI2, "CHI2:R");
00048 hbname (999, "FIT", V0TRUE[0], "V0TRUE(3):R");
00049 hbname (999, "FIT", V1TRUE[0], "V1TRUE(3):R");
00050 hbname (999, "FIT", V0FIT[0], "V0FIT(3):R");
00051 hbname (999, "FIT", V1FIT[0], "V1FIT(3):R");
00052 hbname (999, "FIT", V2FIT[0], "V2FIT(3):R");
00053 hbname (999, "FIT", P0TRUE[0], "P0TRUE(4):R");
00054 hbname (999, "FIT", P1TRUE[0], "P1TRUE(4):R");
00055 hbname (999, "FIT", P2TRUE[0], "P2TRUE(4):R");
00056 hbname (999, "FIT", P1SM[0], "P1SM(4):R");
00057 hbname (999, "FIT", P2SM[0], "P2SM(4):R");
00058 hbname (999, "FIT", P0FIT[0], "P0FIT(4):R");
00059 hbname (999, "FIT", P1FIT[0], "P1FIT(4):R");
00060 hbname (999, "FIT", P2FIT[0], "P2FIT(4):R");
00061 hbname (999, "FIT", PAR0TRUE[0], "PAR0TRUE(6):R");
00062 hbname (999, "FIT", PAR1TRUE[0], "PAR1TRUE(6):R");
00063 hbname (999, "FIT", PAR2TRUE[0], "PAR2TRUE(6):R");
00064 hbname (999, "FIT", PAR1SM[0], "PAR1SM(6):R");
00065 hbname (999, "FIT", PAR2SM[0], "PAR2SM(6):R");
00066 hbname (999, "FIT", PAR1SMERR[0], "PAR1SMERR(6):R");
00067 hbname (999, "FIT", PAR2SMERR[0], "PAR2SMERR(6):R");
00068 hbname (999, "FIT", PAR0FIT[0], "PAR0FIT(6):R");
00069 hbname (999, "FIT", PAR1FIT[0], "PAR1FIT(6):R");
00070 hbname (999, "FIT", PAR2FIT[0], "PAR2FIT(6):R");
00071 hbname (999, "FIT", PAR0ERR[0], "PAR0ERR(6):R");
00072 hbname (999, "FIT", PAR1ERR[0], "PAR1ERR(6):R");
00073 hbname (999, "FIT", PAR2ERR[0], "PAR2ERR(6):R");
00074
00075 hbname (999, "FIT", DL2TRUE, "DL2TRUE:R");
00076 hbname (999, "FIT", DL2FIT, "DL2FIT:R");
00077 hbname (999, "FIT", DL3TRUE, "DL3TRUE:R");
00078 hbname (999, "FIT", DL3FIT, "DL3FIT:R");
00079 hbname (999, "FIT", TTRUE, "TTRUE:R");
00080 hbname (999, "FIT", TFIT, "TFIT:R");
00081 hbname (999, "FIT", MTRUE, "MTRUE:R");
00082 hbname (999, "FIT", MFIT, "MFIT:R");
00083
00084
00085
00086 for (int i = 0; i < total; i++) {
00087 WWFitter fitter;
00088 K0Event evt;
00089 evt.genEvent();
00090
00091 if ((IERR = evt.fitEvent(fitter)) != 0) {
00092 failed++;
00093 cout << "IERR = " << IERR << endl;
00094 }
00095 FITPROB = fitter.getProbability();
00096 CHI2 = fitter.getChi2();
00097
00098
00099 for (int i = 0; i < 3; ++i) {
00100 V0TRUE[i] = evt.genvert[0]->getComponent(i);
00101 V1TRUE[i] = evt.genvert[1]->getComponent(i);
00102 V0FIT[i] = evt.rectrack[0]->getTrajectoryPoint(0).getComponent(i);
00103 V1FIT[i] = evt.rectrack[1]->getVertex(0).getComponent(i);
00104 V2FIT[i] = evt.rectrack[2]->getVertex(0).getComponent(i);
00105 }
00106
00107
00108 for (int i = 0; i < 4; ++i) {
00109 P0TRUE[i] = evt.gentrack[0]->getMomentum(0).getComponent(i);
00110 P1TRUE[i] = evt.gentrack[1]->getMomentum(0).getComponent(i);
00111 P2TRUE[i] = evt.gentrack[2]->getMomentum(0).getComponent(i);
00112 P1SM[i] = evt.smtrack[1]->getMomentum(0).getComponent(i);
00113 P2SM[i] = evt.smtrack[2]->getMomentum(0).getComponent(i);
00114 P0FIT[i] = evt.rectrack[0]->getMomentum(0).getComponent(i);
00115 P1FIT[i] = evt.rectrack[1]->getMomentum(0).getComponent(i);
00116 P2FIT[i] = evt.rectrack[2]->getMomentum(0).getComponent(i);
00117 }
00118
00119 for (int i = 0; i < 6; ++i) {
00120 PAR0TRUE[i] = evt.gentrack[0]->getParam(i);
00121 PAR1TRUE[i] = evt.gentrack[1]->getParam(i);
00122 PAR2TRUE[i] = evt.gentrack[2]->getParam(i);
00123 PAR1SM[i] = evt.smtrack[1]->getParam(i);
00124 PAR2SM[i] = evt.smtrack[2]->getParam(i);
00125 PAR1SMERR[i] = evt.smtrack[1]->getError(i);
00126 PAR2SMERR[i] = evt.smtrack[2]->getError(i);
00127 PAR0FIT[i] = evt.rectrack[0]->getParam(i);
00128 PAR1FIT[i] = evt.rectrack[1]->getParam(i);
00129 PAR2FIT[i] = evt.rectrack[2]->getParam(i);
00130 PAR0ERR[i] = evt.rectrack[0]->getError(i);
00131 PAR1ERR[i] = evt.rectrack[1]->getError(i);
00132 PAR2ERR[i] = evt.rectrack[2]->getError(i);
00133 }
00134
00135
00136
00137 DL2TRUE = (*evt.genvert[1]-*evt.genvert[0]).getPt();
00138 DL2FIT = (evt.rectrack[0]->getVertex(0)-evt.rectrack[0]->getTrajectoryPoint(0)).getPt();
00139 DL3TRUE = (*evt.genvert[1]-*evt.genvert[0]).getP();
00140 DL3FIT = (evt.rectrack[0]->getVertex(0)-evt.rectrack[0]->getTrajectoryPoint(0)).getP();
00141
00142 TTRUE = DL3TRUE/(2.998E-2*(evt.gentrack[0]->getMomentum(0).getBetaGamma().getMag()));
00143 TFIT = DL3FIT/(2.998E-2*(evt.rectrack[0]->getMomentum(0).getBetaGamma().getMag()));
00144
00145 MTRUE = (evt.gentrack[1]->getMomentum(0) + evt.gentrack[2]->getMomentum(0)).getM();
00146 MFIT = (evt.rectrack[1]->getMomentum(0) + evt.rectrack[2]->getMomentum(0)).getM();
00147
00148 hfnt(999);
00149 }
00150
00151 std::cerr << "Failed fits: " << failed
00152 << "(" << (100.0*failed)/total << "%)" << endl;
00153
00154 hrout(999);
00155 hrend("K0FIT");
00156
00157 return 0;
00158 }