CMS 3D CMS Logo

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
hitfit::Constraint_Intermed::sum_mass_terms
virtual double sum_mass_terms(const Fourvec_Event &ev) const =0
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
hitfit
Definition: Base_Constrainer.h:43
hitfit::Constraint_Intermed_Labels::~Constraint_Intermed_Labels
~Constraint_Intermed_Labels() override
Definition: Constraint_Intermed.h:261
hitfit::Constraint_Intermed_Labels::operator=
Constraint_Intermed & operator=(const Constraint_Intermed &)
hitfit::Constraint_Intermed_Constant::_c2
double _c2
Definition: Constraint_Intermed.h:231
hitfit::Constraint_Intermed::~Constraint_Intermed
virtual ~Constraint_Intermed()
Definition: Constraint_Intermed.h:105
hitfit::Constraint_Intermed::clone
virtual std::unique_ptr< Constraint_Intermed > clone() const =0
hitfit::Constraint_Intermed_Labels::Constraint_Intermed_Labels
Constraint_Intermed_Labels(const std::vector< int > &labels)
Definition: Constraint_Intermed.cc:133
hitfit::Constraint_Intermed_Labels::has_label
bool has_label(int label) const
Definition: Constraint_Intermed.cc:230
hitfit::Constraint_Intermed_Constant::print
void print(std::ostream &s) const override
Definition: Constraint_Intermed.cc:109
hitfit::Fourvec_Event
Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented ...
Definition: Fourvec_Event.h:193
hitfit::Constraint_Intermed_Constant::sum_mass_terms
double sum_mass_terms(const Fourvec_Event &ev) const override
Definition: Constraint_Intermed.cc:94
alignCSCRings.s
s
Definition: alignCSCRings.py:92
hitfit::Constraint_Intermed_Constant::Constraint_Intermed_Constant
Constraint_Intermed_Constant(double constant)
Definition: Constraint_Intermed.cc:59
hitfit::Constraint_Intermed::has_labels
virtual bool has_labels(int ilabel, int jlabel) const =0
hitfit::make_constraint_intermed
std::unique_ptr< Constraint_Intermed > make_constraint_intermed(std::string s)
hitfit::Constraint_Intermed_Constant::has_labels
bool has_labels(int ilabel, int jlabel) const override
Definition: Constraint_Intermed.cc:77
hitfit::operator<<
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream.
Definition: Constraint_Intermed.cc:268
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hitfit::Constraint_Intermed_Labels::sum_mass_terms
double sum_mass_terms(const Fourvec_Event &ev) const override
Definition: Constraint_Intermed.cc:190
hitfit::Constraint_Intermed_Labels::clone
std::unique_ptr< Constraint_Intermed > clone() const override
Definition: Constraint_Intermed.cc:244
hitfit::Constraint_Intermed_Labels::print
void print(std::ostream &s) const override
Definition: Constraint_Intermed.cc:213
hitfit::Constraint_Intermed_Labels
Concrete class for one side of mass constraint equation of the type: .
Definition: Constraint_Intermed.h:245
hitfit::Constraint_Intermed::Constraint_Intermed
Constraint_Intermed()
Definition: Constraint_Intermed.h:100
hitfit::Constraint_Intermed_Constant::clone
std::unique_ptr< Constraint_Intermed > clone() const override
Definition: Constraint_Intermed.cc:120
hitfit::Constraint_Intermed_Constant
Concrete class for one side of mass constraint equation of the type: .
Definition: Constraint_Intermed.h:158
hitfit::Constraint_Intermed
Abstract base classes for describing one side of a mass constraint.
Definition: Constraint_Intermed.h:89
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
hitfit::Constraint_Intermed::print
virtual void print(std::ostream &s) const =0
hitfit::Constraint_Intermed_Constant::~Constraint_Intermed_Constant
~Constraint_Intermed_Constant() override
Definition: Constraint_Intermed.h:175
hitfit::Constraint_Intermed_Labels::has_labels
bool has_labels(int ilabel, int jlabel) const override
Definition: Constraint_Intermed.cc:154
hitfit::Constraint_Intermed_Labels::_labels
std::vector< int > _labels
Definition: Constraint_Intermed.h:321
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:46
label
const char * label
Definition: PFTauDecayModeTools.cc:11