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 
12 
37 #include <ostream>
38 #include <cassert>
39 
40 
41 using std::ostream;
42 
43 
44 namespace hitfit {
45 
46 
47 Objpair::Objpair (int i, int j, int nconstraints)
48 //
49 // Purpose: Constructor.
50 //
51 // Inputs:
52 // i - The first object index.
53 // j - The second object index.
54 // nconstraints- The number of constraints in the problem.
55 //
56  : _i (i),
57  _j (j),
58  _for_constraint (nconstraints)
59 {
60 }
61 
62 
64 //
65 // Purpose: Set the value for constraint K (0-based) to VAL.
66 //
67 // Inputs:
68 // k - The constraint number (0-based).
69 // val - The value to set for this constraint.
70 //
71 {
72  assert (k < _for_constraint.size());
73  _for_constraint[k] = static_cast<signed char> (val);
74 }
75 
76 
85 std::ostream& operator<< (std::ostream& s, const Objpair& o)
86 //
87 // Purpose: Print the object to S.
88 //
89 // Inputs:
90 // s - The stream to which to write.
91 // o - The object to write.
92 //
93 // Returns:
94 // The stream S.
95 //
96 {
97  s << o._i << " " << o._j;
98  for (unsigned k = 0; k < o._for_constraint.size(); ++k)
99  s << " " << static_cast<int> (o._for_constraint[k]);
100  return s;
101 }
102 
103 
104 } // 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:85
void has_constraint(std::vector< signed char >::size_type k, int val)
Set the value for a constraint to a value.
Definition: Objpair.cc:63
Objpair(int i, int j, int nconstraints)
Constructor.
Definition: Objpair.cc:47
int k[5][pyjets_maxn]
std::vector< signed char > _for_constraint
Definition: Objpair.h:132
Represent a pair of objects in Pair_Table.
Definition: Objpair.h:62