Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //
0002 //
0003 // File: hitfit/private/Constraint.h
0004 // Purpose: Represent a mass constraint equation.
0005 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0006 //
0007 // This class represents a mass constraint equation.
0008 // Mass constraints come in two varieties, either saying that the sum
0009 // of a set of labels should equal a constant:
0010 //
0011 //     (1 + 2) = 80
0012 //
0013 // or that two such sums should equal each other:
0014 //
0015 //     (1 + 2) = (3 + 4)
0016 //
0017 // We represent such a constraint equation by two Constraint_Intermed
0018 // instances, each of which represents one side of the equation.
0019 //
0020 // CMSSW File      : interface/Constraint.h
0021 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
0022 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0023 
0024 /**
0025     @file Constraint.h
0026 
0027     @brief Represent a mass constraint equation.
0028 
0029     @par Creation date:
0030     July 2000.
0031 
0032     @author
0033     Scott Stuart Snyder <snyder@bnl.gov>.
0034 
0035     @par Modification History:
0036     Apr 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0037     Imported to CMSSW.<br>
0038     Oct 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0039     Added Doxygen tags for automatic generation of documentation.
0040 
0041     @par Terms of Usage:
0042     With consent from the original author (Scott Snyder).
0043  */
0044 
0045 #ifndef HITFIT_CONSTRAINT_H
0046 #define HITFIT_CONSTRAINT_H
0047 
0048 #include <memory>
0049 #include <string>
0050 #include "TopQuarkAnalysis/TopHitFit/interface/Constraint_Intermed.h"
0051 
0052 namespace hitfit {
0053 
0054   class Fourvec_Event;
0055 
0056   /**
0057     @class Constraint.
0058 
0059     @brief Represent a mass constraint equation.  Mass constraints
0060     come in two varieties, either saying that the sum of a set of labels
0061     should equal a constant:<br>
0062 
0063     \f$(1 + 2) = C\f$.<br>
0064 
0065     or that two such sums should be equal to each other:<br>
0066 
0067     \f$(1 + 2) =  (3 + 4)\f$.<br>
0068 
0069     We represent such a constraint equation by two Constraint_Intermed
0070     instances, each of which represents one side of the equation.
0071 
0072      */
0073   class Constraint
0074   //
0075   // Purpose: Represent a mass constraint equation.
0076   //
0077   {
0078   public:
0079     // Constructor, destructor.  S is the string to parse describing
0080     // the constraint.
0081 
0082     /**
0083      Constructor.
0084 
0085      @param s The string to parse describing the constraint.
0086    */
0087     Constraint(std::string s);
0088 
0089     /**
0090      Copy constructor.
0091 
0092      @param c The original object to be copied.
0093    */
0094     Constraint(const Constraint& c);
0095 
0096     /**
0097      Destructor.
0098    */
0099     ~Constraint() {}
0100 
0101     // Assignment.
0102     /**
0103      Assignment operator.
0104 
0105      @param c The original object to be copied.
0106    */
0107     Constraint& operator=(const Constraint& c);
0108 
0109     // See if this guy references both labels ILABEL and JLABEL
0110     // on a single side of the constraint equation.
0111 
0112     /**
0113      See if this guy references both labels <i>ilabel</i> and <i>jlabel</i>
0114      on a single single side of the constraint equation.
0115 
0116      @param ilabel The first label to test.
0117      @param jlabel The second label to test.
0118 
0119      @par Return:
0120      - +1 if the LHS references both.
0121      - -1 if the RHS references both.
0122      -  0 if neither reference both.
0123    */
0124     int has_labels(int ilabel, int jlabel) const;
0125 
0126     // Evaluate the mass constraint, using the data in EV.
0127     // Return m(lhs)^2/2 - m(rhs)^2/2.
0128     /**
0129      Evaluate the mass constraint, using the data in <i>ev</i>.
0130 
0131      @param ev The event for which the constraint should be evaluated.
0132 
0133      @par Return:
0134      \f$ \frac{m(\rm{lhs})^{2}}{2} - \frac{m(\rm{rhs})^{2}}{2}\f$
0135    */
0136     double sum_mass_terms(const Fourvec_Event& ev) const;
0137 
0138     // Print this object.
0139     friend std::ostream& operator<<(std::ostream& s, const Constraint& c);
0140 
0141   private:
0142     // The two sides of the constraint.
0143 
0144     /**
0145      Left hand side of the constraint.
0146    */
0147     std::unique_ptr<Constraint_Intermed> _lhs;
0148 
0149     /**
0150      Right hand side of the constraint.
0151    */
0152     std::unique_ptr<Constraint_Intermed> _rhs;
0153   };
0154 
0155 }  // namespace hitfit
0156 
0157 #endif  // not HITFIT_CONSTRAINT_H