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/Pair_Table.h
0004 // Purpose: Helper for Fourvec_Constrainer.
0005 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0006 //
0007 // Build a lookup table to speed up constraint evaluation.
0008 //
0009 // We have a set of constraints, which reference labels, like
0010 //
0011 //    (1 2) = 80
0012 //    (1 2) = (3 4)
0013 //
0014 // We also have a Fourvec_Event, which has a set of objects, each of which
0015 // has a label.  A label may correspond to multiple objects.
0016 //
0017 // We'll be evaluating the mass constraints by considering each
0018 // pair of objects o_1 o_2 and finding its contribution to each
0019 // constraint.  (We get pairs because the constraints are quadratic
0020 // in the objects.)
0021 //
0022 // We build a Pair_Table by calling the constructor, giving it the event
0023 // and the set of constraints.  We can then get back from it a list
0024 // of Objpair's, each representing a pair of objects that are
0025 // used in some constraint.  The Objpair will be able to tell us
0026 // in which constraints the pair is used (and on which side of the
0027 // equation).
0028 //
0029 // CMSSW File      : interface/Pair_Table.h
0030 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
0031 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0032 //
0033 
0034 /**
0035     @file Pair_Table.h
0036 
0037     @brief A lookup table to speed up constraint evaluation.
0038 
0039     @author Scott Stuart Snyder <snyder@bnl.gov>
0040 
0041     @par Creation date:
0042     Jul 2000.
0043 
0044     @par Modification History:
0045     Apr 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0046     Imported to CMSSW.<br>
0047     Nov 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0048     Added doxygen tags for automatic generation of documentation.
0049 
0050     @par Terms of Usage:
0051     With consent for the original author (Scott Snyder).
0052 
0053  */
0054 
0055 #ifndef HITFIT_PAIR_TABLE_H
0056 #define HITFIT_PAIR_TABLE_H
0057 
0058 #include <vector>
0059 #include <iosfwd>
0060 #include "TopQuarkAnalysis/TopHitFit/interface/Constraint.h"
0061 #include "TopQuarkAnalysis/TopHitFit/interface/Objpair.h"
0062 
0063 namespace hitfit {
0064 
0065   class Fourvec_Event;
0066 
0067   /**
0068     @brief A lookup table to speed up constraint evaluation using
0069     Fourvec_Constrainer.
0070 
0071     We have a set of constraints, which reference labels, like
0072 
0073     \f[
0074     (1~~2) = 80.4
0075     \f]
0076     \f[
0077     (1~~2) = (3~~4)
0078     \f]
0079 
0080     We also have a Fourvec_Event, which has a set of objects, each of
0081     which has a label.  A label may correspond to multiple objects.
0082 
0083     We'll be evaluating the mass constraints by considering each pair of
0084     objects \f$o_{1}\f$ and \f$o_{2}\f$ and finding its contribution to each
0085     constraint.  We get pairs because the constraints are quadratic in the
0086     objects.
0087 
0088     We build a Pair_Table by calling the constructor, giving it the event,
0089     and the set of constraints.  We can then get back from it a list
0090     of Objpair's each representing a pair of objects that are used
0091     in some constraint.  The Objpair will be able to tell us in which
0092     constraints the pair is used and on which side of the equation.
0093 
0094  */
0095   class Pair_Table
0096   //
0097   // Purpose: Helper for Fourvec_Constrainer.
0098   //
0099   {
0100   public:
0101     // Constructor.  Give it the event and the list of constraints.
0102     /**
0103      @brief Constructor, give it the event and the list of constraints.
0104 
0105      @param cv The list of constraints for the problem.
0106 
0107      @param ev The event.
0108    */
0109     Pair_Table(const std::vector<Constraint>& cv, const Fourvec_Event& ev);
0110 
0111     // The number of pairs in the table.
0112 
0113     /**
0114      @brief Return the number of pairs in the table.
0115    */
0116     int npairs() const;
0117 
0118     // Get one of the pairs from the table.
0119     /**
0120      @brief Get one of the pairs from the table, index starts from 0.
0121 
0122      @param pairno The index of the pair, index starts from 0.
0123    */
0124     const Objpair& get_pair(std::vector<Objpair>::size_type pairno) const;
0125 
0126   private:
0127     //The table of pairs.
0128     /**
0129      The list of pairs.
0130    */
0131     std::vector<Objpair> _pairs;
0132   };
0133 
0134   // Dump out the table.
0135   std::ostream& operator<<(std::ostream& s, const Pair_Table& p);
0136 
0137 }  // namespace hitfit
0138 
0139 #endif  // not PAIR_TABLE_H