CMS 3D CMS Logo

Fit_Result_Vec.h
Go to the documentation of this file.
1 //
2 //
3 // File: hitfit/Fit_Result_Vec.h
4 // Purpose: Hold a set of Fit_Result structures.
5 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
6 //
7 // This class holds pointers to a set of Fit_Result's, resulting from
8 // different jet permutation with some consistent selection.
9 // The results are ordered by increasing chisq values. A maximum
10 // length for the vector may be specified; when new results are added,
11 // those with the largest chisq fall off the end.
12 //
13 // The Fit_Result objects are reference counted, in order to allow them
14 // to be entered in multiple vectors.
15 //
16 // CMSSW File : interface/Fit_Result_Vec.h
17 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
18 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
19 //
20 
44 #ifndef HITFIT_FIT_RESULT_VEC_H
45 #define HITFIT_FIT_RESULT_VEC_H
46 
47 
48 #include <vector>
49 #include <iosfwd>
50 #include <memory>
51 
52 
53 namespace hitfit {
54 
55 
56 class Fit_Result;
57 
58 
72 //
73 // Purpose: Hold a set of Fit_Result structures.
74 //
75 {
76 public:
77  // Constructor, destructor. The maximum length of the vector
78  // is specified here.
79 
85  Fit_Result_Vec (std::vector<std::shared_ptr<Fit_Result>>::size_type max_len);
86 
90  ~Fit_Result_Vec ();
91 
92  // Copy constructor.
97  Fit_Result_Vec (const Fit_Result_Vec& vec);
98 
99  // Assignment.
105 
106  // Get back the number of results in the vector.
110  std::vector<std::shared_ptr<Fit_Result>>::size_type size () const;
111 
112  // Get back the Ith result in the vector.
118  const Fit_Result& operator[] (std::vector<std::shared_ptr<Fit_Result>>::size_type i) const;
119 
120  // Add a new result to the list.
126  void push (std::shared_ptr<Fit_Result> res);
127 
128  // Dump out the vector.
129  friend std::ostream& operator<< (std::ostream& s,
130  const Fit_Result_Vec& resvec);
131 
132 private:
133  // The object state.
134 
138  std::vector<std::shared_ptr<Fit_Result>> _v;
139 
143  std::vector<std::shared_ptr<Fit_Result>>::size_type _max_len;
144 };
145 
146 
147 } // namespace hitfit
148 
149 
150 #endif // not HITFIT_FIT_RESULT_H
Hold the result of one kinematic fit.
Definition: Fit_Result.h:52
Fit_Result_Vec & operator=(const Fit_Result_Vec &vec)
Assignment operator.
~Fit_Result_Vec()
Destructor.
uint16_t size_type
Definition: Electron.h:6
void push(std::shared_ptr< Fit_Result > res)
Add a new Fit_Result to the list.
Fit_Result_Vec(std::vector< std::shared_ptr< Fit_Result >>::size_type max_len)
Constructor.
std::vector< std::shared_ptr< Fit_Result > > _v
Holds pointers to a set of Fit_Result objects, resulting from different jet permutation with some con...
std::vector< std::shared_ptr< Fit_Result > >::size_type size() const
Return the number of Fit_Result objects in the list.
const Fit_Result & operator[](std::vector< std::shared_ptr< Fit_Result >>::size_type i) const
Return the i-th element of the Fit_Result objects in the vector.
friend std::ostream & operator<<(std::ostream &s, const Fit_Result_Vec &resvec)
Output stream operator, print the content of this Fit_Result_Vec to an output stream.
std::vector< std::shared_ptr< Fit_Result > >::size_type _max_len