CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Constraint_Intermed.h
Go to the documentation of this file.
1 //
2 // $Id: Constraint_Intermed.h,v 1.1 2011/05/26 09:46:53 mseidel Exp $
3 //
4 // File: hitfit/private/Constraint_Intermed.h
5 // Purpose: Represent one side of a mass constraint equation.
6 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
7 //
8 // Mass constraints come in two varieties, either saying that the sum
9 // of a set of labels should equal a constant:
10 //
11 // (1 + 2) = 80
12 //
13 // or that two such sums should equal each other:
14 //
15 // (1 + 2) = (3 + 4)
16 //
17 // These classes represent one side of such an equation.
18 // There is an abstract base class Constraint_Intermed, and then concrete
19 // implementations for the two cases, Constraint_Intermed_Constant
20 // and Constraint_Intermed_Labels. There is also a free function
21 // make_constraint_intermed() to parse a string representing one
22 // side of a constraint and return the appropriate Constraint_Intermed
23 // instance.
24 //
25 // CMSSW File : interface/Constraint_Intermed.h
26 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
27 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
28 //
29 
30 
73 #ifndef HITFIT_CONSTRAINT_INTERMED_H
74 #define HITFIT_CONSTRAINT_INTERMED_H
75 
76 
77 #include <iosfwd>
78 #include <vector>
79 #include <string>
80 #include <memory>
81 
82 
83 namespace hitfit {
84 
85 
86 class Fourvec_Event;
87 
88 
89 //************************************************************************
90 
91 
98 //
99 // Purpose: Abstract base class for describing one side of a mass constraint.
100 //
101 {
102 public:
103  // Constructor, destructor.
104 
109 
113  virtual ~Constraint_Intermed () {}
114 
115  // Return true if this guy references both labels ILABEL and JLABEL.
129  virtual bool has_labels (int ilabel, int jlabel) const = 0;
130 
131  // Evaluate this half of the mass constraint, using the data in EV.
132  // Return m^2/2.
141  virtual double sum_mass_terms (const Fourvec_Event& ev) const = 0;
142 
143  // Print out this object.
149  virtual void print (std::ostream& s) const = 0;
150 
151  // Copy this object.
155  virtual std::auto_ptr<Constraint_Intermed> clone () const = 0;
156 };
157 
158 
159 //************************************************************************
160 
161 
169  : public Constraint_Intermed
170 //
171 // Purpose: Concrete base class for a constant mass constraint half.
172 //
173 {
174 public:
175  // Constructor, destructor.
181  Constraint_Intermed_Constant (double constant);
182 
187 
188  // Copy constructor.
194 
195  // Return true if this guy references both labels ILABEL and JLABEL.
209  virtual bool has_labels (int ilabel, int jlabel) const;
210 
211  // Evaluate this half of the mass constraint, using the data in EV.
212  // Return m^2/2.
221  virtual double sum_mass_terms (const Fourvec_Event& ev) const;
222 
223  // Print out this object.
229  virtual void print (std::ostream& s) const;
230 
231  // Copy this object.
235  virtual std::auto_ptr<Constraint_Intermed> clone () const;
236 
237 private:
238  // Store c^2 / 2.
242  double _c2;
243 };
244 
245 
246 //************************************************************************
247 
248 
259  : public Constraint_Intermed
260 {
261 public:
262 
267  Constraint_Intermed_Labels (const std::vector<int>& labels);
268 
278 
279  // Return true if this guy references both labels ILABEL and JLABEL.
293  virtual bool has_labels (int ilabel, int jlabel) const;
294 
295  // Evaluate this half of the mass constraint, using the data in EV.
296  // Return m^2/2.
305  virtual double sum_mass_terms (const Fourvec_Event& ev) const;
306 
307  // Print out this object.
313  virtual void print (std::ostream& s) const;
314 
315  // Copy this object.
319  virtual std::auto_ptr<Constraint_Intermed> clone () const;
320 
321 private:
322  // Test to see if LABEL is used by this constraint half.
330  bool has_label (int label) const;
331 
332  // List of the labels for this constraint half, kept in sorted order.
337  std::vector<int> _labels;
338 
339  // Disallow assignment
344 };
345 
346 
347 
348 //************************************************************************
349 
350 
351 // Print out a Constraint_Intermed object.
352 std::ostream& operator<< (std::ostream& s, const Constraint_Intermed& ci);
353 
354 
355 // Parse the string S and construct the appropriate Constraint_Intermed
356 // instance.
382 std::auto_ptr<Constraint_Intermed> make_constraint_intermed (std::string s);
383 
384 
385 } // namespace hitfit
386 
387 
388 #endif // not HITFIT_CONSTRAINT_INTERMED_H
Concrete class for one side of mass constraint equation of the type: .
std::auto_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
virtual double sum_mass_terms(const Fourvec_Event &ev) const
virtual void print(std::ostream &s) const
virtual std::auto_ptr< Constraint_Intermed > clone() const =0
Constraint_Intermed_Labels(const std::vector< int > &labels)
virtual bool has_labels(int ilabel, int jlabel) const
virtual void print(std::ostream &s) const
virtual double sum_mass_terms(const Fourvec_Event &ev) const =0
virtual std::auto_ptr< Constraint_Intermed > clone() const
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.
virtual double sum_mass_terms(const Fourvec_Event &ev) const
virtual bool has_labels(int ilabel, int jlabel) const =0
virtual std::auto_ptr< Constraint_Intermed > clone() const
virtual bool has_labels(int ilabel, int jlabel) const
Constraint_Intermed & operator=(const Constraint_Intermed &)