CMS 3D CMS Logo

Objpair.cc
Go to the documentation of this file.
1 //
2 //
3 // File: src/Objpair.cc
4 // Purpose: Helper class for Pair_Table.
5 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
6 //
7 // CMSSW File : src/Objpair.cc
8 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
9 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
10 //
11 
35 #include <ostream>
36 #include <cassert>
37 
38 using std::ostream;
39 
40 namespace hitfit {
41 
42  Objpair::Objpair(int i, int j, int nconstraints)
43  //
44  // Purpose: Constructor.
45  //
46  // Inputs:
47  // i - The first object index.
48  // j - The second object index.
49  // nconstraints- The number of constraints in the problem.
50  //
51  : _i(i), _j(j), _for_constraint(nconstraints) {}
52 
54  //
55  // Purpose: Set the value for constraint K (0-based) to VAL.
56  //
57  // Inputs:
58  // k - The constraint number (0-based).
59  // val - The value to set for this constraint.
60  //
61  {
62  assert(k < _for_constraint.size());
63  _for_constraint[k] = static_cast<signed char>(val);
64  }
65 
74  std::ostream& operator<<(std::ostream& s, const Objpair& o)
75  //
76  // Purpose: Print the object to S.
77  //
78  // Inputs:
79  // s - The stream to which to write.
80  // o - The object to write.
81  //
82  // Returns:
83  // The stream S.
84  //
85  {
86  s << o._i << " " << o._j;
87  for (unsigned k = 0; k < o._for_constraint.size(); ++k)
88  s << " " << static_cast<int>(o._for_constraint[k]);
89  return s;
90  }
91 
92 } // namespace hitfit
Represent a pair of objects in Pair_Table.
uint16_t size_type
friend std::ostream & operator<<(std::ostream &s, const Objpair &o)
Output stream operator, print the content of this Objpair to an output stream.
Definition: Objpair.cc:74
void has_constraint(std::vector< signed char >::size_type k, int val)
Set the value for a constraint to a value.
Definition: Objpair.cc:53
Objpair(int i, int j, int nconstraints)
Constructor.
Definition: Objpair.cc:42
std::vector< signed char > _for_constraint
Definition: Objpair.h:127
Represent a pair of objects in Pair_Table.
Definition: Objpair.h:58