Handle and fit jet permutations of an event. This is the primary interface between user's Lepjets_Event and HitFit kinematic fitting algorithm. More...
#include <Top_Fit.h>
Public Member Functions | |
const Top_Fit_Args & | args () const |
Return a constant reference to the fit arguments. | |
Fit_Results | fit (const Lepjets_Event &ev) |
Fit all jets permutations in ev. This function returns a Fit_Results object, which is not easy to extract information from. Users are recommended to use the class RunHitFit as interface to fit all permutations of all event. | |
double | fit_one_perm (Lepjets_Event &ev, bool &nuz, double &umwhad, double &utmass, double &mt, double &sigmt, Column_Vector &pullx, Column_Vector &pully) |
Fit for a single jet permutation. | |
Top_Fit (const Top_Fit_Args &args, double lepw_mass, double hadw_mass, double top_mass) | |
Constructor. | |
Private Attributes | |
const Top_Fit_Args | _args |
Constrained_Top | _constrainer |
double | _hadw_mass |
double | _lepw_mass |
Friends | |
std::ostream & | operator<< (std::ostream &s, const Top_Fit &fitter) |
Output stream operator, print the content of this Top_Fit object to an output stream. |
Handle and fit jet permutations of an event. This is the primary interface between user's Lepjets_Event and HitFit kinematic fitting algorithm.
hitfit::Top_Fit::Top_Fit | ( | const Top_Fit_Args & | args, |
double | lepw_mass, | ||
double | hadw_mass, | ||
double | top_mass | ||
) |
Constructor.
args | The parameter settings. |
lepw_mass | The mass to which the leptonic boson should be constrained to. A value of zero means this constraint will be removed. |
hadw_mass | The mass to which the hadronic boson should be constrained to. A value of zero means this constraint will be removed. |
top_mass | The mass to which the top quark should be constrained to. A value of zero means this constraint will be removed. |
Definition at line 368 of file Top_Fit.cc.
: _args (args), _constrainer (args.constrainer_args(), lepw_mass, hadw_mass, top_mass), _lepw_mass(lepw_mass), _hadw_mass (hadw_mass) { }
const Top_Fit_Args & hitfit::Top_Fit::args | ( | ) | const |
Return a constant reference to the fit arguments.
Definition at line 609 of file Top_Fit.cc.
References _args.
Referenced by hitfit::RunHitFit< AElectron, AMuon, AJet, AMet >::FitAllPermutation().
{ return _args; }
Fit_Results hitfit::Top_Fit::fit | ( | const Lepjets_Event & | ev | ) |
Fit all jets permutations in ev. This function returns a Fit_Results object, which is not easy to extract information from. Users are recommended to use the class RunHitFit as interface to fit all permutations of all event.
ev | Input: The event to fit, Output: the event after the fit. |
Definition at line 499 of file Top_Fit.cc.
References _args, gather_cfg::cout, hitfit::Top_Fit_Args::do_higgs_flag(), fit_one_perm(), hitfit::hadb_label, hitfit::hadw1_label, hitfit::higgs_label, i, hitfit::isr_label, hitfit::lepb_label, hitfit::n_lists, hitfit::Lepjets_Event::njets(), hitfit::Top_Fit_Args::nkeep(), hitfit::noperm_list, and hitfit::Top_Fit_Args::print_event_flag().
{ // Make a new Fit_Results object. Fit_Results res (_args.nkeep(), n_lists); // Set up the vector of jet types. vector<int> jet_types (ev.njets(), isr_label); assert (ev.njets() >= 4); jet_types[0] = lepb_label; jet_types[1] = hadb_label; jet_types[2] = hadw1_label; jet_types[3] = hadw1_label; if (_args.do_higgs_flag() && ev.njets() >= 6) { jet_types[4] = higgs_label; jet_types[5] = higgs_label; } // Must be in sorted order. stable_sort (jet_types.begin(), jet_types.end()); do { // Loop over the two possible neutrino solution for (int nusol = 0 ; nusol != 2 ; nusol++) { // Set up the neutrino solution to be used bool nuz = bool(nusol); // Copy the event. Lepjets_Event fev = ev; // Install the new jet types. set_jet_types (jet_types, fev); // Figure out on what lists this permutation should go. vector<int> list_flags = classify_jetperm (jet_types, ev); // Set up the output variables for fit results. double umwhad, utmass, mt, sigmt; Column_Vector pullx; Column_Vector pully; double chisq; // Tracing. cout << "Top_Fit::fit(): Before fit: ("; for (vector<int>::size_type i=0; i < jet_types.size(); i++) { if (i) cout << " "; cout << jet_types[i]; } cout << " nuz = " << nuz ; cout << ") " << std::endl; // Do the fit. chisq = fit_one_perm (fev, nuz, umwhad, utmass, mt, sigmt, pullx, pully); // Print the result, if requested. if (_args.print_event_flag()) { cout << "Top_Fit::fit(): After fit:\n"; char buf[256]; sprintf (buf, "chisq: %8.3f mt: %6.2f pm %5.2f %c\n", chisq, mt, sigmt, (list_flags[noperm_list] ? '*' : ' ')); cout << buf; } // Add it to the results. res.push (chisq, fev, pullx, pully, umwhad, utmass, mt, sigmt, list_flags); } // end of for loop over the two neutrino solution // Step to the next permutation. } while (next_permutation (jet_types.begin(), jet_types.end())); return res; }
double hitfit::Top_Fit::fit_one_perm | ( | Lepjets_Event & | ev, |
bool & | nuz, | ||
double & | umwhad, | ||
double & | utmass, | ||
double & | mt, | ||
double & | sigmt, | ||
Column_Vector & | pullx, | ||
Column_Vector & | pully | ||
) |
Fit for a single jet permutation.
ev | Input: The event to fit, Output: the event after the fit. |
nuz | Input: A flag to indicate which neutrino solution to be used. FALSE means use solution with smaller absolute value. TRUE means use solution with larger absolute value. |
umwhad | The mass of hadronic boson before the fit. |
utmass | The mass of the top quarks before fitting, averaged from the values of leptonic and hadronic top quark mass. |
mt | The mass of the top quark after fitting. |
sigmt | The uncertainty of the mass of the top quark after fitting. |
pullx | Pull quantities for well-measured variables. |
pully | Pull quantities for poorly-measured variables. |
Definition at line 393 of file Top_Fit.cc.
References _args, _constrainer, _hadw_mass, _lepw_mass, hitfit::adjust_e_for_mass(), hitfit::Constrained_Top::constrain(), gather_cfg::cout, hitfit::Top_Decaykin::dump_ev(), hitfit::Top_Decaykin::hadt(), hitfit::Top_Decaykin::hadw(), hitfit::Top_Decaykin::lept(), m, hitfit::Lepjets_Event::met(), hitfit::Top_Fit_Args::print_event_flag(), hitfit::Top_Decaykin::solve_nu(), hitfit::Top_Fit_Args::solve_nu_tmass(), and hitfit::Top_Decaykin::solve_nu_tmass().
Referenced by fit(), and hitfit::RunHitFit< AElectron, AMuon, AJet, AMet >::FitAllPermutation().
{ mt = 0; sigmt = 0; // Find the neutrino solutions by requiring either: // 1) that the leptonic top have the same mass as the hadronic top. // 2) that the mass of the lepton and neutrino is equal to the W mass umwhad = Top_Decaykin::hadw (ev) . m(); double umthad = Top_Decaykin::hadt (ev) . m(); double nuz1, nuz2; if (_args.solve_nu_tmass()) { Top_Decaykin::solve_nu_tmass (ev, umthad, nuz1, nuz2); } else { Top_Decaykin::solve_nu (ev, _lepw_mass, nuz1, nuz2); } // Set up to use the selected neutrino solution if (!nuz) { ev.met().setZ(nuz1); } else { ev.met().setZ(nuz2); } // Note: We have set the neutrino Pz, but we haven't set the neutrino energy. // Remember that originally the neutrino energy was equal to // sqrt(nu_px*nu_px + nu_py*nu_py). Calculating the invariant mass squared // for the neutrino will give negative mass squared. // Therefore we need to adjust (increase) the neutrino energy in order to // make its mass remain zero. adjust_e_for_mass(ev.met(),0); // Find the unfit top mass as the average of the two sides. double umtlep = Top_Decaykin::lept (ev) . m(); utmass = (umthad + umtlep) / 2; // Trace, if requested. if (_args.print_event_flag()) { cout << "Top_Fit::fit_one_perm() : Before fit:\n"; Top_Decaykin::dump_ev (cout, ev); } // Maybe reject this event. if (_hadw_mass > 0 && test_for_bad_masses (ev, _args, umwhad, umthad, umtlep)) { cout << "Top_Fit: bad mass comb.\n"; return -999; } // Do the fit. double chisq = _constrainer.constrain (ev, mt, sigmt, pullx, pully); // Trace, if requested. if (_args.print_event_flag()) { cout << "Top_Fit::fit_one_perm() : After fit:\n"; cout << "chisq: " << chisq << " mt: " << mt << " "; Top_Decaykin::dump_ev (cout, ev); } // Done! return chisq; }
std::ostream& operator<< | ( | std::ostream & | s, |
const Top_Fit & | fitter | ||
) | [friend] |
Output stream operator, print the content of this Top_Fit object to an output stream.
s | The output stream to which to write. |
fitter | The instance of Top_Fit to be printed. |
Definition at line 593 of file Top_Fit.cc.
{ return s << fitter._constrainer; }
const Top_Fit_Args hitfit::Top_Fit::_args [private] |
Definition at line 327 of file Top_Fit.h.
Referenced by args(), fit(), and fit_one_perm().
Constrained_Top hitfit::Top_Fit::_constrainer [private] |
Definition at line 328 of file Top_Fit.h.
Referenced by fit_one_perm(), and hitfit::operator<<().
double hitfit::Top_Fit::_hadw_mass [private] |
Definition at line 330 of file Top_Fit.h.
Referenced by fit_one_perm().
double hitfit::Top_Fit::_lepw_mass [private] |
Definition at line 329 of file Top_Fit.h.
Referenced by fit_one_perm().