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 #include <vector>
48 #include <iosfwd>
49 #include <memory>
50 
51 namespace hitfit {
52 
53  class Fit_Result;
54 
68  //
69  // Purpose: Hold a set of Fit_Result structures.
70  //
71  {
72  public:
73  // Constructor, destructor. The maximum length of the vector
74  // is specified here.
75 
81  Fit_Result_Vec(std::vector<std::shared_ptr<Fit_Result>>::size_type max_len);
82 
87 
88  // Copy constructor.
93  Fit_Result_Vec(const Fit_Result_Vec& vec);
94 
95  // Assignment.
101 
102  // Get back the number of results in the vector.
106  std::vector<std::shared_ptr<Fit_Result>>::size_type size() const;
107 
108  // Get back the Ith result in the vector.
114  const Fit_Result& operator[](std::vector<std::shared_ptr<Fit_Result>>::size_type i) const;
115 
116  // Add a new result to the list.
122  void push(std::shared_ptr<Fit_Result> res);
123 
124  // Dump out the vector.
125  friend std::ostream& operator<<(std::ostream& s, const Fit_Result_Vec& resvec);
126 
127  private:
128  // The object state.
129 
133  std::vector<std::shared_ptr<Fit_Result>> _v;
134 
138  std::vector<std::shared_ptr<Fit_Result>>::size_type _max_len;
139  };
140 
141 } // namespace hitfit
142 
143 #endif // not HITFIT_FIT_RESULT_H
Hold the result of one kinematic fit.
Definition: Fit_Result.h:50
Fit_Result_Vec & operator=(const Fit_Result_Vec &vec)
Assignment operator.
~Fit_Result_Vec()
Destructor.
uint16_t size_type
Definition: Electron.h:6
std::vector< std::shared_ptr< Fit_Result > >::size_type size() const
Return the number of Fit_Result objects in the list.
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.
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.
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...
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