Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:17

0001 //
0002 //
0003 // File: hitfit/Top_Fit.h
0004 // Purpose: Handle jet permutations.
0005 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0006 //
0007 // CMSSW File      : interface/Top_Fit.h
0008 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
0009 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0010 //
0011 
0012 /**
0013     @file Top_Fit.h
0014 
0015     @brief Handle and fit jet permutations of an event.  This is the
0016     primary interface between user's Lepjets_Event and HitFit kinematic
0017     fitting algorithm.
0018 
0019     @author Scott Stuart Snyder <snyder@bnl.gov>
0020 
0021     @par Creation date:
0022     Jul 2000.
0023 
0024     @par Modification History:
0025     Apr 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0026     Imported to CMSSW.<br>
0027     Nov 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0028     Added doxygen tags for automatic generation of documentation.
0029 
0030     @par Terms of Usage:
0031     With consent for the original author (Scott Snyder).
0032 
0033  */
0034 
0035 #ifndef HITFIT_TOP_FIT_H
0036 #define HITFIT_TOP_FIT_H
0037 
0038 #include "TopQuarkAnalysis/TopHitFit/interface/Constrained_Top.h"
0039 #include "TopQuarkAnalysis/TopHitFit/interface/matutil.h"
0040 #include <iosfwd>
0041 
0042 namespace hitfit {
0043 
0044   class Lepjets_Event;
0045   class Fit_Results;
0046 
0047   //
0048   // Indices for the various results lists we make in Fit_Results.
0049   //
0050   /**
0051     Indices for the various results lists we store in Fit_Results.
0052  */
0053   enum Lists {
0054     all_list = 0,          // All events.
0055     noperm_list = 1,       // All jet assignments are correct.
0056     semicorrect_list = 2,  // Jets assigned to the correct top.
0057     limited_isr_list = 3,  // Top three jets are not ISR.
0058     topfour_list = 4,      // Top four jets are not ISR, any other jets are ISR.
0059     btag_list = 5,         // All tagged jets were assigned as b-jets.
0060     htag_list = 6,         // All tagged jets were assigned as b-jets or higgs.
0061     n_lists = 7
0062   };
0063 
0064   //*************************************************************************
0065 
0066   /**
0067     @brief Hold on to parameters for the Top_Fit class.
0068 */
0069   class Top_Fit_Args
0070   //
0071   // Purpose: Hold on to parameters for the Top_Fit class.
0072   //
0073   //   bool print_event_flag - If true, print the event after the fit.
0074   //   bool do_higgs_flag    - If true, fit ttH events.
0075   //   double jet_mass_cut   - Reject events with jet masses larger than this.
0076   //   double mwhad_min_cut  - Reject events with hadronic W mass before
0077   //                           fitting smaller than this.
0078   //   double mwhad_max_cut  - Reject events with hadronic W mass before
0079   //                           fitting larger than this.
0080   //   double mtdiff_max_cut - Reject events where the difference between
0081   //                           leptonic and hadronic top masses before fitting
0082   //                           is larger than this.
0083   //   int nkeep             - Number of results to keep in each list.
0084   //   bool solve_nu_tmass   - If true, use hadronic top mass to constrain
0085   //                           the neutrino pz.  Otherwise constrain the
0086   //                           neutrino + lepton mass to W mass.
0087   //
0088   {
0089   public:
0090     // Constructor.  Initialize from a Defaults object.
0091     /**
0092      @brief Constructor, initialize an instance of Top_Fit_Args
0093      from an instance of Defaults object.
0094 
0095      @param defs The Defaults instance from which to initialize.  The
0096      instance must contain the following parameters with types and names:
0097      - bool <i>print_event_flag</i>.
0098      - bool <i>do_higgs_flag</i>.
0099      - double <i>jet_mass_cut</i>.
0100      - double <i>mwhad_min_cut</i>.
0101      - double <i>mwhad_max_cut</i>.
0102      - double <i>mtdiff_max_cut</i>.
0103      - int <i>nkeep</i>.
0104      - bool <i>solve_nu_tmass</i>.
0105 
0106    */
0107     Top_Fit_Args(const Defaults& defs);
0108 
0109     // Retrieve parameter values.
0110     /**
0111      @brief Return the <i>print_event_flag</i> parameter.
0112    */
0113     bool print_event_flag() const;
0114 
0115     /**
0116      @brief Return the <i>do_higgs_flag</i> parameter.
0117    */
0118     bool do_higgs_flag() const;
0119 
0120     /**
0121      @brief Return the <i>jet_mass_cut</i> parameter.
0122    */
0123     double jet_mass_cut() const;
0124 
0125     /**
0126      @brief Return the <i>mwhad_min_cut</i> parameter.
0127    */
0128     double mwhad_min_cut() const;
0129 
0130     /**
0131      @brief Return the <i>mwhad_min_cut</i> parameter.
0132    */
0133     double mwhad_max_cut() const;
0134 
0135     /**
0136      @brief Return the <i>mwhad_max_cut</i> parameter.
0137    */
0138     double mtdiff_max_cut() const;
0139 
0140     /**
0141      @brief Return the <i>nkeep</i> parameter.
0142    */
0143     int nkeep() const;
0144 
0145     /**
0146      @brief Return the <i>solve_nu_tmass</i> parameter.
0147    */
0148     bool solve_nu_tmass() const;
0149 
0150     // Arguments for subobjects.
0151     const Constrained_Top_Args& constrainer_args() const;
0152 
0153   private:
0154     // Hold on to parameter values.
0155     /**
0156      If <b>TRUE</b>, then print the event after the fit.  Otherwise don't
0157      print.
0158    */
0159     bool _print_event_flag;
0160 
0161     /**
0162      If <b>TRUE</b>, then fit a  \f$ t\bar{t}H \f$  events. Otherwise fit
0163       \f$ t\bar{t} \f$  event.
0164    */
0165     bool _do_higgs_flag;
0166 
0167     /**
0168      Reject event before fit if there is at least one jet which have mass
0169      larger than this value, in GeV.
0170    */
0171     double _jet_mass_cut;
0172 
0173     /**
0174      Reject event before fit if the mass of the hadronic  \f$ W- \f$ boson
0175      is smaller than this value, in GeV.
0176    */
0177     double _mwhad_min_cut;
0178 
0179     /**
0180      Reject event before fit if the mass of the hadronic  \f$ W- \f$ boson
0181      is larger than this value, in GeV.
0182    */
0183     double _mwhad_max_cut;
0184 
0185     /**
0186      Reject event before fit if the mass difference between leptonic top
0187      and hadronic top is larger than this value, in GeV.
0188    */
0189     double _mtdiff_max_cut;
0190 
0191     /**
0192      The number of Fit_Results from different jet permutations to keep.
0193      It is recommended that the number is set accordingly to the maximally
0194      allowed number of jets in the event.  The number for possible
0195      permutations,  \f$ N_{t\bar{t}} \f$ , as a function of number of jets,
0196       \f$ n \f$ , for  \f$ t\bar{t} \f$  event is given by:
0197      \f[
0198      N_{t\bar{t}}(n) = \frac{n!}{(n-4)!};~ n \ge 4
0199      \f]
0200      The number for possible permutations,  \f$ N_{t\bar{t}H} \f$ , as a
0201      function of number of jets,  \f$ n \f$ , for  \f$ t\bar{t}H \f$  is given by:
0202      \f[
0203      N_{t\bar{t}}(n) = \frac{n!}{(n-6)!2!};~ n \ge 6
0204      \f]
0205 
0206    */
0207     int _nkeep;
0208 
0209     /**
0210      If <b>TRUE</b>, then solve the neutrino longitudinal  \f$ z- \f$ component
0211      by requiring the leptonic top have the same mass as the hadronic top.
0212      If <b>FALSE</b>, then solve the neutrino longitudinal  \f$ z- \f$ component
0213      by requiring the lepton and neutrino mass to equal to the mass of
0214      the  \f$ W- \f$ boson  \f$ m_{W} \f$ .
0215    */
0216     bool _solve_nu_tmass;
0217 
0218     /**
0219      The internal state, parameter settings for the Constrained_Top instance
0220      within an instance of Top_Fit.
0221    */
0222     Constrained_Top_Args _args;
0223   };
0224 
0225   //*************************************************************************
0226 
0227   /**
0228     @brief Handle and fit jet permutations of an event.  This is the
0229     primary interface between user's Lepjets_Event and HitFit kinematic
0230     fitting algorithm.
0231 */
0232   class Top_Fit
0233   //
0234   // Purpose: Handle jet permutations.
0235   //
0236   {
0237   public:
0238     // Constructor.
0239     // LEPW_MASS, HADW_MASS, and TOP_MASS are the masses to which
0240     // those objects should be constrained.  To remove a constraint,
0241     // set the mass to 0.
0242     /**
0243      @brief Constructor.
0244 
0245      @param args The parameter settings.
0246 
0247      @param lepw_mass The mass to which the leptonic  \f$ W- \f$ boson should be
0248      constrained to.  A value of zero means this constraint will be removed.
0249 
0250      @param hadw_mass The mass to which the hadronic  \f$ W- \f$ boson should be
0251      constrained to.  A value of zero means this constraint will be removed.
0252 
0253      @param top_mass The mass to which the top quark should be constrained to.
0254      A value of zero means this constraint will be removed.
0255    */
0256     Top_Fit(const Top_Fit_Args& args, double lepw_mass, double hadw_mass, double top_mass);
0257 
0258     // Fit a single jet permutation.  Return the results for that fit.
0259     /**
0260       @brief Fit for a single jet permutation.
0261 
0262       @param ev Input: The event to fit, Output: the event after the fit.
0263 
0264       @param nuz Input: A flag to indicate which neutrino solution to be used.
0265       <br>
0266       <b>FALSE</b> means use solution with smaller absolute value.<br>
0267       <b>TRUE</b> means use solution with larger absolute value.
0268 
0269       @param umwhad The mass of hadronic  \f$ W- \f$ boson before the fit.
0270 
0271       @param utmass The mass of the top quarks before fitting, averaged from
0272       the values of leptonic and hadronic top quark mass.
0273 
0274       @param mt The mass of the top quark after fitting.
0275 
0276       @param sigmt The uncertainty of the mass of the top quark after fitting.
0277 
0278       @param pullx Pull quantities for well-measured variables.
0279 
0280       @param pully Pull quantities for poorly-measured variables.
0281    */
0282     double fit_one_perm(Lepjets_Event& ev,
0283                         bool& nuz,
0284                         double& umwhad,
0285                         double& utmass,
0286                         double& mt,
0287                         double& sigmt,
0288                         Column_Vector& pullx,
0289                         Column_Vector& pully);
0290 
0291     // Fit all jet permutations in EV.
0292     /**
0293      @brief Fit all jets permutations in ev.  This function returns
0294      a Fit_Results object, which is not easy to extract information from.
0295      Users are recommended to use the class RunHitFit as interface to fit
0296      all permutations of all event.
0297 
0298      @param ev Input: The event to fit, Output: the event after the fit.
0299    */
0300     Fit_Results fit(const Lepjets_Event& ev);
0301 
0302     // Print.
0303     friend std::ostream& operator<<(std::ostream& s, const Top_Fit& fitter);
0304 
0305     /**
0306      @brief Return a constant reference to the fit arguments.
0307    */
0308     const Top_Fit_Args& args() const;
0309 
0310   private:
0311     // The object state.
0312     const Top_Fit_Args _args;
0313     Constrained_Top _constrainer;
0314     double _lepw_mass;
0315     double _hadw_mass;
0316   };
0317 
0318 }  // namespace hitfit
0319 
0320 #endif  // not HITFIT_TOP_FIT_H