CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/TopQuarkAnalysis/TopHitFit/src/Objpair.cc

Go to the documentation of this file.
00001 //
00002 // $Id: Objpair.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
00003 //
00004 // File: src/Objpair.cc
00005 // Purpose: Helper class for Pair_Table.
00006 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
00007 //
00008 // CMSSW File      : src/Objpair.cc
00009 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
00010 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
00011 //
00012 
00013 
00037 #include "TopQuarkAnalysis/TopHitFit/interface/Objpair.h"
00038 #include <ostream>
00039 #include <cassert>
00040 
00041 
00042 using std::ostream;
00043 
00044 
00045 namespace hitfit {
00046 
00047 
00048 Objpair::Objpair (int i, int j, int nconstraints)
00049 //
00050 // Purpose: Constructor.
00051 //
00052 // Inputs:
00053 //   i -           The first object index.
00054 //   j -           The second object index.
00055 //   nconstraints- The number of constraints in the problem.
00056 //
00057   : _i (i),
00058     _j (j),
00059     _for_constraint (nconstraints)
00060 {
00061 }
00062 
00063 
00064 void Objpair::has_constraint (std::vector<signed char>::size_type k, int val)
00065 //
00066 // Purpose: Set the value for constraint K (0-based) to VAL.
00067 //
00068 // Inputs:
00069 //   k -           The constraint number (0-based).
00070 //   val -         The value to set for this constraint.
00071 //
00072 {
00073   assert (k < _for_constraint.size());
00074   _for_constraint[k] = static_cast<signed char> (val);
00075 }
00076 
00077 
00086 std::ostream& operator<< (std::ostream& s, const Objpair& o)
00087 //
00088 // Purpose: Print the object to S.
00089 //
00090 // Inputs:
00091 //   s -           The stream to which to write.
00092 //   o -           The object to write.
00093 //
00094 // Returns:
00095 //   The stream S.
00096 //
00097 {
00098   s << o._i << " " << o._j;
00099   for (unsigned k = 0; k < o._for_constraint.size(); ++k)
00100     s << " " << static_cast<int> (o._for_constraint[k]);
00101   return s;
00102 }
00103 
00104 
00105 } // namespace hitfit