CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Fourvec_Constrainer.h
Go to the documentation of this file.
1 //
2 //
3 // File: hitfit/Fourvec_Constrainer.h
4 // Purpose: Do a kinematic fit for a set of 4-vectors, given a set
5 // of mass constraints.
6 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
7 //
8 // Do a constrained fit on a set of 4-vectors.
9 // The input is in a Fourvec_Event instance. This consists
10 // of a collection of objects, each of which has a 4-momentum
11 // and an integer label. (Also uncertainties, etc.)
12 //
13 // We also have a set of mass constraints, based on sums of objects
14 // with specified labels. A constraint can either require that the
15 // invariant mass of a set of objects is constant, or that the masses
16 // of two sets be equal to each other. For example, the constraint
17 //
18 // (1 2) = 80
19 //
20 // says that the sum of all objects with labels 1 and 2 should have
21 // a mass of 80. And the constraint
22 //
23 // (1 2) = (3 4)
24 //
25 // says that the sum of all objects with labels 1 and 2 should
26 // have an invariant mass the same as the sum of all objects with
27 // labels 3 and 4.
28 //
29 // All the objects are fixed to constant masses for the fit.
30 // (These masses are attributes of the objects in the Fourvec_Event.)
31 // This is done by scaling either the 4-vector's 3-momentum or energy,
32 // depending on the setting of the `use_e' parameter.
33 //
34 // If there is no neutrino present in the event, two additional constraints
35 // are automatically added for total pt balance, unless the parameter
36 // ignore_met has been set.
37 //
38 // When the fit completes, this object can compute an invariant mass
39 // out of some combination of the objects, including an uncertainty.
40 // The particular combination is specified through the method mass_contraint();
41 // it gets a constraint string like normal; the lhs of the constraint
42 // is the mass that will be calculated. (The rhs should be zero.)
43 //
44 // CMSSW File : interface/Fourvec_Constrainer.h
45 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
46 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
47 //
48 
72 #ifndef HITFIT_FOURVEC_CONSTRAINER_H
73 #define HITFIT_FOURVEC_CONSTRAINER_H
74 
75 #include <string>
76 #include <vector>
77 #include <iosfwd>
81 
82 namespace hitfit {
83 
84  class Defaults;
85  class Fourvec_Event;
86  class Pair_Table;
87 
94  //
95  // Purpose: Hold on to parameters for the Fourvec_Constrainer class.
96  //
97  // Parameters controlling the operation of the fitter:
98  // bool use_e - If true, then when rescaling the 4-vectors
99  // for a given mass, keep the measured energy
100  // and scale the 3-momentum. Otherwise, keep
101  // the 3-momentum and scale the energy.
102  // float e_com - The center-of-mass energy.
103  // (Used only to keep the fit from venturing
104  // into completely unphysical regions.)
105  // bool ignore_met - If this is true and the event does not
106  // have a neutrino, then the fit will be done
107  // without the overall transverse momentum
108  // constraint (and thus the missing Et information
109  // will be ignored). If the event does have
110  // a neutrino, this parameter is ignored.
111  //
112  {
113  public:
114  // Constructor. Initialize from a Defaults object.
124  Fourvec_Constrainer_Args(const Defaults& defs);
125 
126  // Retrieve parameter values.
130  bool use_e() const;
131 
135  double e_com() const;
136 
140  bool ignore_met() const;
141 
142  // Arguments for subobjects.
144 
145  private:
146  // Hold on to parameter values.
152  bool _use_e;
153 
158  double _e_com;
159 
168 
173  };
174 
175  //*************************************************************************
176 
221  //
222  // Purpose: Do a kinematic fit for a set of 4-vectors, given a set
223  // of mass constraints.
224  //
225  {
226  public:
227  // Constructor.
228  // ARGS holds the parameter settings for this instance.
235 
236  // Specify an additional constraint S for the problem.
237  // The format for S is described above.
245 
246  // Specify the combination of objects that will be returned by
247  // constrain() as the mass. The format of S is the same as for
248  // normal constraints. The LHS specifies the mass to calculate;
249  // the RHS should be zero.
250  // This should only be called once.
261 
262  // Do a constrained fit for EV. Returns the requested mass and
263  // its error in M and SIGM, and the pull quantities in PULLX and
264  // PULLY. Returns the chisq; this will be < 0 if the fit failed
265  // to converge.
296  double constrain(Fourvec_Event& ev, double& m, double& sigm, Column_Vector& pullx, Column_Vector& pully);
297 
298  // Dump the internal state.
299  friend std::ostream& operator<<(std::ostream& s, const Fourvec_Constrainer& c);
300 
301  private:
302  // Parameter settings.
307 
308  // The constraints for this problem.
312  std::vector<Constraint> _constraints;
313 
314  // The constraint giving the mass to be calculated. This
315  // should have no more than one entry.
320  std::vector<Constraint> _mass_constraint;
321  };
322 
323 } // namespace hitfit
324 
325 #endif // not HITFIT_FOURVEC_CONSTRAINER_H
const edm::EventSetup & c
friend std::ostream & operator<<(std::ostream &s, const Fourvec_Constrainer &c)
Output stream operator, print the content of this Fourvec_Constrainer to an output stream...
Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented ...
Fourvec_Constrainer(const Fourvec_Constrainer_Args &args)
Constructor.
CLHEP::HepVector Column_Vector
Definition: matutil.h:63
bool ev
Define matrix types for the HitFit package, and supply a few additional operations.
Fourvec_Constrainer_Args(const Defaults &defs)
Constructor, initialize from a Defaults object.
Minimize a subject to a set of constraints, based on the SQUAW algorithm.
const Chisq_Constrainer_Args & chisq_constrainer_args() const
Hold on to parameters for the Chisq_Constrainer class.
const Fourvec_Constrainer_Args _args
std::vector< Constraint > _mass_constraint
Represent a mass constraint equation.
Chisq_Constrainer_Args _chisq_constrainer_args
std::vector< Constraint > _constraints
double constrain(Fourvec_Event &ev, double &m, double &sigm, Column_Vector &pullx, Column_Vector &pully)
Do a constrained fit for event ev. Returns the requested mass and its uncertainty in m and sigm...
Define an interface for getting parameter settings.
Definition: Defaults.h:57
void mass_constraint(std::string s)
Specify a combination of objects that will be returned by the constrain() method as mass...
void add_constraint(std::string s)
Specify an additional constraint s for the problem. The format for s is described in the class descri...
Do a kinematic fit for a set of four-momenta, given a set of mass constraints.
Hold on to parameters for the Fourvec_Constrainer class.