CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Objpair.cc
Go to the documentation of this file.
1 //
2 // $Id: Objpair.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
3 //
4 // File: src/Objpair.cc
5 // Purpose: Helper class for Pair_Table.
6 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
7 //
8 // CMSSW File : src/Objpair.cc
9 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
10 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
11 //
12 
13 
38 #include <ostream>
39 #include <cassert>
40 
41 
42 using std::ostream;
43 
44 
45 namespace hitfit {
46 
47 
48 Objpair::Objpair (int i, int j, int nconstraints)
49 //
50 // Purpose: Constructor.
51 //
52 // Inputs:
53 // i - The first object index.
54 // j - The second object index.
55 // nconstraints- The number of constraints in the problem.
56 //
57  : _i (i),
58  _j (j),
59  _for_constraint (nconstraints)
60 {
61 }
62 
63 
65 //
66 // Purpose: Set the value for constraint K (0-based) to VAL.
67 //
68 // Inputs:
69 // k - The constraint number (0-based).
70 // val - The value to set for this constraint.
71 //
72 {
73  assert (k < _for_constraint.size());
74  _for_constraint[k] = static_cast<signed char> (val);
75 }
76 
77 
86 std::ostream& operator<< (std::ostream& s, const Objpair& o)
87 //
88 // Purpose: Print the object to S.
89 //
90 // Inputs:
91 // s - The stream to which to write.
92 // o - The object to write.
93 //
94 // Returns:
95 // The stream S.
96 //
97 {
98  s << o._i << " " << o._j;
99  for (unsigned k = 0; k < o._for_constraint.size(); ++k)
100  s << " " << static_cast<int> (o._for_constraint[k]);
101  return s;
102 }
103 
104 
105 } // namespace hitfit
int i
Definition: DBlmapReader.cc:9
Represent a pair of objects in Pair_Table.
uint16_t size_type
void has_constraint(std::vector< signed char >::size_type k, int val)
Set the value for a constraint to a value.
Definition: Objpair.cc:64
int j
Definition: DBlmapReader.cc:9
Objpair(int i, int j, int nconstraints)
Constructor.
Definition: Objpair.cc:48
int k[5][pyjets_maxn]
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
std::vector< signed char > _for_constraint
Definition: Objpair.h:133
Represent a pair of objects in Pair_Table.
Definition: Objpair.h:63