CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Constraint_Intermed.h
Go to the documentation of this file.
1 //
2 //
3 // File: hitfit/private/Constraint_Intermed.h
4 // Purpose: Represent one side of a mass constraint equation.
5 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
6 //
7 // Mass constraints come in two varieties, either saying that the sum
8 // of a set of labels should equal a constant:
9 //
10 // (1 + 2) = 80
11 //
12 // or that two such sums should equal each other:
13 //
14 // (1 + 2) = (3 + 4)
15 //
16 // These classes represent one side of such an equation.
17 // There is an abstract base class Constraint_Intermed, and then concrete
18 // implementations for the two cases, Constraint_Intermed_Constant
19 // and Constraint_Intermed_Labels. There is also a free function
20 // make_constraint_intermed() to parse a string representing one
21 // side of a constraint and return the appropriate Constraint_Intermed
22 // instance.
23 //
24 // CMSSW File : interface/Constraint_Intermed.h
25 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
26 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
27 //
28 
70 #ifndef HITFIT_CONSTRAINT_INTERMED_H
71 #define HITFIT_CONSTRAINT_INTERMED_H
72 
73 #include <iosfwd>
74 #include <vector>
75 #include <string>
76 #include <memory>
77 
78 namespace hitfit {
79 
80  class Fourvec_Event;
81 
82  //************************************************************************
83 
90  //
91  // Purpose: Abstract base class for describing one side of a mass constraint.
92  //
93  {
94  public:
95  // Constructor, destructor.
96 
101 
105  virtual ~Constraint_Intermed() {}
106 
107  // Return true if this guy references both labels ILABEL and JLABEL.
121  virtual bool has_labels(int ilabel, int jlabel) const = 0;
122 
123  // Evaluate this half of the mass constraint, using the data in EV.
124  // Return m^2/2.
133  virtual double sum_mass_terms(const Fourvec_Event& ev) const = 0;
134 
135  // Print out this object.
141  virtual void print(std::ostream& s) const = 0;
142 
143  // Copy this object.
147  virtual std::unique_ptr<Constraint_Intermed> clone() const = 0;
148  };
149 
150  //************************************************************************
151 
159  //
160  // Purpose: Concrete base class for a constant mass constraint half.
161  //
162  {
163  public:
164  // Constructor, destructor.
170  Constraint_Intermed_Constant(double constant);
171 
176 
177  // Copy constructor.
183 
184  // Return true if this guy references both labels ILABEL and JLABEL.
198  bool has_labels(int ilabel, int jlabel) const override;
199 
200  // Evaluate this half of the mass constraint, using the data in EV.
201  // Return m^2/2.
210  double sum_mass_terms(const Fourvec_Event& ev) const override;
211 
212  // Print out this object.
218  void print(std::ostream& s) const override;
219 
220  // Copy this object.
224  std::unique_ptr<Constraint_Intermed> clone() const override;
225 
226  private:
227  // Store c^2 / 2.
231  double _c2;
232  };
233 
234  //************************************************************************
235 
246  public:
251  Constraint_Intermed_Labels(const std::vector<int>& labels);
252 
262 
263  // Return true if this guy references both labels ILABEL and JLABEL.
277  bool has_labels(int ilabel, int jlabel) const override;
278 
279  // Evaluate this half of the mass constraint, using the data in EV.
280  // Return m^2/2.
289  double sum_mass_terms(const Fourvec_Event& ev) const override;
290 
291  // Print out this object.
297  void print(std::ostream& s) const override;
298 
299  // Copy this object.
303  std::unique_ptr<Constraint_Intermed> clone() const override;
304 
305  private:
306  // Test to see if LABEL is used by this constraint half.
314  bool has_label(int label) const;
315 
316  // List of the labels for this constraint half, kept in sorted order.
321  std::vector<int> _labels;
322 
323  // Disallow assignment
328  };
329 
330  //************************************************************************
331 
332  // Print out a Constraint_Intermed object.
333  std::ostream& operator<<(std::ostream& s, const Constraint_Intermed& ci);
334 
335  // Parse the string S and construct the appropriate Constraint_Intermed
336  // instance.
362  std::unique_ptr<Constraint_Intermed> make_constraint_intermed(std::string s);
363 
364 } // namespace hitfit
365 
366 #endif // not HITFIT_CONSTRAINT_INTERMED_H
const edm::EventSetup & c
Concrete class for one side of mass constraint equation of the type: .
std::unique_ptr< Constraint_Intermed > make_constraint_intermed(std::string s)
Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented ...
Concrete class for one side of mass constraint equation of the type: .
virtual void print(std::ostream &s) const =0
std::unique_ptr< Constraint_Intermed > clone() const override
char const * label
double sum_mass_terms(const Fourvec_Event &ev) const override
Constraint_Intermed_Labels(const std::vector< int > &labels)
bool has_labels(int ilabel, int jlabel) const override
virtual double sum_mass_terms(const Fourvec_Event &ev) const =0
void print(std::ostream &s) const override
void print(std::ostream &s) const override
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
Abstract base classes for describing one side of a mass constraint.
std::unique_ptr< Constraint_Intermed > clone() const override
virtual std::unique_ptr< Constraint_Intermed > clone() const =0
bool has_labels(int ilabel, int jlabel) const override
double sum_mass_terms(const Fourvec_Event &ev) const override
virtual bool has_labels(int ilabel, int jlabel) const =0
Constraint_Intermed & operator=(const Constraint_Intermed &)