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 //
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 
29 
72 #ifndef HITFIT_CONSTRAINT_INTERMED_H
73 #define HITFIT_CONSTRAINT_INTERMED_H
74 
75 
76 #include <iosfwd>
77 #include <vector>
78 #include <string>
79 #include <memory>
80 
81 
82 namespace hitfit {
83 
84 
85 class Fourvec_Event;
86 
87 
88 //************************************************************************
89 
90 
97 //
98 // Purpose: Abstract base class for describing one side of a mass constraint.
99 //
100 {
101 public:
102  // Constructor, destructor.
103 
108 
112  virtual ~Constraint_Intermed () {}
113 
114  // Return true if this guy references both labels ILABEL and JLABEL.
128  virtual bool has_labels (int ilabel, int jlabel) const = 0;
129 
130  // Evaluate this half of the mass constraint, using the data in EV.
131  // Return m^2/2.
140  virtual double sum_mass_terms (const Fourvec_Event& ev) const = 0;
141 
142  // Print out this object.
148  virtual void print (std::ostream& s) const = 0;
149 
150  // Copy this object.
154  virtual std::auto_ptr<Constraint_Intermed> clone () const = 0;
155 };
156 
157 
158 //************************************************************************
159 
160 
168  : public Constraint_Intermed
169 //
170 // Purpose: Concrete base class for a constant mass constraint half.
171 //
172 {
173 public:
174  // Constructor, destructor.
180  Constraint_Intermed_Constant (double constant);
181 
186 
187  // Copy constructor.
193 
194  // Return true if this guy references both labels ILABEL and JLABEL.
208  virtual bool has_labels (int ilabel, int jlabel) const;
209 
210  // Evaluate this half of the mass constraint, using the data in EV.
211  // Return m^2/2.
220  virtual double sum_mass_terms (const Fourvec_Event& ev) const;
221 
222  // Print out this object.
228  virtual void print (std::ostream& s) const;
229 
230  // Copy this object.
234  virtual std::auto_ptr<Constraint_Intermed> clone () const;
235 
236 private:
237  // Store c^2 / 2.
241  double _c2;
242 };
243 
244 
245 //************************************************************************
246 
247 
258  : public Constraint_Intermed
259 {
260 public:
261 
266  Constraint_Intermed_Labels (const std::vector<int>& labels);
267 
277 
278  // Return true if this guy references both labels ILABEL and JLABEL.
292  virtual bool has_labels (int ilabel, int jlabel) const;
293 
294  // Evaluate this half of the mass constraint, using the data in EV.
295  // Return m^2/2.
304  virtual double sum_mass_terms (const Fourvec_Event& ev) const;
305 
306  // Print out this object.
312  virtual void print (std::ostream& s) const;
313 
314  // Copy this object.
318  virtual std::auto_ptr<Constraint_Intermed> clone () const;
319 
320 private:
321  // Test to see if LABEL is used by this constraint half.
329  bool has_label (int label) const;
330 
331  // List of the labels for this constraint half, kept in sorted order.
336  std::vector<int> _labels;
337 
338  // Disallow assignment
343 };
344 
345 
346 
347 //************************************************************************
348 
349 
350 // Print out a Constraint_Intermed object.
351 std::ostream& operator<< (std::ostream& s, const Constraint_Intermed& ci);
352 
353 
354 // Parse the string S and construct the appropriate Constraint_Intermed
355 // instance.
381 std::auto_ptr<Constraint_Intermed> make_constraint_intermed (std::string s);
382 
383 
384 } // namespace hitfit
385 
386 
387 #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
bool ev
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 &)