Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00038 #include "TopQuarkAnalysis/TopHitFit/interface/Constrained_Z.h"
00039 #include "TopQuarkAnalysis/TopHitFit/interface/Fourvec_Event.h"
00040 #include "TopQuarkAnalysis/TopHitFit/interface/Lepjets_Event.h"
00041 #include "TopQuarkAnalysis/TopHitFit/interface/Defaults.h"
00042 #include <ostream>
00043 #include <cassert>
00044 #include <stdio.h>
00045
00046
00047 namespace hitfit {
00048
00049
00050
00051
00052
00053
00054
00055 Constrained_Z_Args::Constrained_Z_Args (const Defaults& defs)
00056
00057
00058
00059
00060
00061
00062 : _zmass (defs.get_float ("zmass")),
00063 _fourvec_constrainer_args (defs)
00064 {
00065 }
00066
00067
00068 double Constrained_Z_Args::zmass () const
00069
00070
00071
00072
00073 {
00074 return _zmass;
00075 }
00076
00077
00078 const Fourvec_Constrainer_Args&
00079 Constrained_Z_Args::fourvec_constrainer_args () const
00080
00081
00082
00083 {
00084 return _fourvec_constrainer_args;
00085 }
00086
00087
00088
00089
00090
00091 Constrained_Z::Constrained_Z (const Constrained_Z_Args& args)
00092
00093
00094
00095
00096
00097
00098 : _args (args),
00099 _constrainer (args.fourvec_constrainer_args())
00100 {
00101 char buf[256];
00102 sprintf (buf, "(%d) = %f", lepton_label, _args.zmass());
00103 _constrainer.add_constraint (buf);
00104 }
00105
00106
00107 namespace {
00108
00109
00124 FE_Obj make_fe_obj (const Lepjets_Event_Lep& obj, double mass, int type)
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136 {
00137 return FE_Obj (obj.p(), mass, type,
00138 obj.p_sigma(), obj.eta_sigma(), obj.phi_sigma(),
00139 obj.res().p_res().inverse());
00140 }
00141
00142
00158 void do_import (const Lepjets_Event& ev, Fourvec_Event& fe)
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 {
00169 assert (ev.nleps() >= 2);
00170 fe.add (make_fe_obj (ev.lep(0), 0, lepton_label));
00171 fe.add (make_fe_obj (ev.lep(1), 0, lepton_label));
00172
00173 for (std::vector<Lepjets_Event_Jet>::size_type j=0; j < ev.njets(); j++)
00174 fe.add (make_fe_obj (ev.jet(j), 0, isr_label));
00175
00176 Fourvec kt = ev.kt ();
00177 fe.set_kt_error (ev.kt_res().sigma (kt.x()),
00178 ev.kt_res().sigma (kt.y()),
00179 0);
00180 fe.set_x_p (ev.met());
00181 }
00182
00183
00200 void do_export (const Fourvec_Event& fe, Lepjets_Event& ev)
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211 {
00212 ev.lep(0).p() = fe.obj(0).p;
00213 ev.lep(1).p() = fe.obj(1).p;
00214
00215 for (std::vector<Lepjets_Event_Jet>::size_type j=0, k=1; j < ev.njets(); j++)
00216 ev.jet(j).p() = fe.obj(k++).p;
00217
00218 Fourvec nu;
00219 ev.met() = nu;
00220 }
00221
00222
00223 }
00224
00225
00226 double Constrained_Z::constrain (Lepjets_Event& ev, Column_Vector& pull)
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 {
00244 Fourvec_Event fe;
00245 do_import (ev, fe);
00246 Column_Vector pully;
00247 double m, sigm;
00248 double chisq = _constrainer.constrain (fe, m, sigm, pull, pully);
00249 do_export (fe, ev);
00250
00251 return chisq;
00252 }
00253
00254
00262 std::ostream& operator<< (std::ostream& s, const Constrained_Z& cz)
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 {
00274 return s << cz._constrainer;
00275 }
00276
00277
00278 }