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/Objpair.h
0004 // Purpose: Helper class for Pair_Table.
0005 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0006 //
0007 // An `Objpair' consists of two object indices in a Fourvec_Event,
0008 // plus a value for each constraint.  This value is +1 if these two objects
0009 // are used on the lhs of that constraint, -1 if they are used on the rhs
0010 // of that constraint, and 0 if they are not used by that constraint.
0011 //
0012 // CMSSW File      : interface/Objpair.h
0013 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
0014 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0015 //
0016 
0017 /**
0018     @file Objpair.h
0019 
0020     @brief Represent a pair of objects in Pair_Table.
0021 
0022     @author Scott Stuart Snyder <snyder@bnl.gov>
0023 
0024     @par Creation date:
0025     Jul 2000.
0026 
0027     @par Modification History:
0028     Apr 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0029     Imported to CMSSW.<br>
0030     Nov 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0031     Added doxygen tags for automatic generation of documentation.
0032 
0033     @par Terms of Usage:
0034     With consent for the original author (Scott Snyder).
0035 
0036  */
0037 
0038 #ifndef HITFIT_OBJPAIR_H
0039 #define HITFIT_OBJPAIR_H
0040 
0041 #include <vector>
0042 #include <iosfwd>
0043 
0044 namespace hitfit {
0045 
0046   /**
0047     @brief Represent a pair of objects in Pair_Table.
0048 
0049     An Objpair consists of two object indices in a Fourvec_Event,
0050     plua a value for each constraint.  This value is defined as:
0051     - +1 if these two objects are used on the left-hand side of the
0052     constraint.
0053     - -1 if these two objects are used on the right-hand side of the
0054     constraint.
0055     0 if these two objects are not used by that constraint.
0056 
0057  */
0058   class Objpair
0059   //
0060   // Purpose: Helper class for Pair_Table.
0061   //
0062   {
0063   public:
0064     // Constructor.  I and J are the two object indices, and NCONSTRAINTS
0065     // is the number of constraints in the problem.
0066     /**
0067      @brief Constructor
0068 
0069      @param i Index of the first object.
0070 
0071      @param j Index of the second object.
0072 
0073      @param nconstraints The number of constraints in the problem.
0074    */
0075     Objpair(int i, int j, int nconstraints);
0076 
0077     // Set the value for constraint K (0-based) to VAL.
0078     /**
0079      @brief Set the value for a constraint to a value.
0080 
0081      @param k The index of the constraint, index starts from 0.
0082 
0083      @param val The value to set for this constraint.
0084    */
0085     void has_constraint(std::vector<signed char>::size_type k, int val);
0086 
0087     // Get back the indices in this pair.
0088     /**
0089      @brief Return the index of the first object.
0090    */
0091     int i() const;
0092 
0093     /**
0094      @brief Return the index of the second object.
0095    */
0096     int j() const;
0097 
0098     // Retrieve the value set for constraint K.
0099     /**
0100      @brief Retrieve the value set for a constraint.
0101 
0102      @param k The index of the constraint, index starts from 0.
0103    */
0104     int for_constraint(std::vector<signed char>::size_type k) const;
0105 
0106     // Print this object.
0107 
0108     friend std::ostream& operator<<(std::ostream& s, const Objpair& o);
0109 
0110   private:
0111     // The object indices for this pair.
0112 
0113     /**
0114      Index of the first object.
0115    */
0116     int _i;
0117 
0118     /**
0119      Index of the second object.
0120    */
0121     int _j;
0122 
0123     // The list of values for each constraint.
0124     /**
0125      The list of values for each constraint.
0126    */
0127     std::vector<signed char> _for_constraint;
0128   };
0129 
0130 }  // namespace hitfit
0131 
0132 #include "TopQuarkAnalysis/TopHitFit/interface/Objpair.i"
0133 
0134 #endif  // not HITFIT_OBJPAIR_H