CMS 3D CMS Logo

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
writedatasetfile.args
args
Definition: writedatasetfile.py:18
hitfit::Fourvec_Constrainer::mass_constraint
void mass_constraint(std::string s)
Specify a combination of objects that will be returned by the constrain() method as mass....
Definition: Fourvec_Constrainer.cc:195
hitfit::Column_Vector
CLHEP::HepVector Column_Vector
Definition: matutil.h:63
hitfit
Definition: Base_Constrainer.h:43
hitfit::Fourvec_Constrainer
Do a kinematic fit for a set of four-momenta, given a set of mass constraints.
Definition: Fourvec_Constrainer.h:220
Chisq_Constrainer.h
Minimize a subject to a set of constraints, based on the SQUAW algorithm.
Constraint.h
Represent a mass constraint equation.
hitfit::Fourvec_Constrainer::operator<<
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.
Definition: Fourvec_Constrainer.cc:220
hitfit::Fourvec_Constrainer_Args::chisq_constrainer_args
const Chisq_Constrainer_Args & chisq_constrainer_args() const
Definition: Fourvec_Constrainer.cc:100
hitfit::Fourvec_Event
Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented ...
Definition: Fourvec_Event.h:193
alignCSCRings.s
s
Definition: alignCSCRings.py:92
matutil.h
Define matrix types for the HitFit package, and supply a few additional operations.
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
hitfit::Fourvec_Constrainer_Args::Fourvec_Constrainer_Args
Fourvec_Constrainer_Args(const Defaults &defs)
Constructor, initialize from a Defaults object.
Definition: Fourvec_Constrainer.cc:61
hitfit::Fourvec_Constrainer_Args::use_e
bool use_e() const
Definition: Fourvec_Constrainer.cc:73
hitfit::Fourvec_Constrainer::_mass_constraint
std::vector< Constraint > _mass_constraint
Definition: Fourvec_Constrainer.h:320
hitfit::Fourvec_Constrainer_Args::_use_e
bool _use_e
Definition: Fourvec_Constrainer.h:152
hitfit::Fourvec_Constrainer::_args
const Fourvec_Constrainer_Args _args
Definition: Fourvec_Constrainer.h:306
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hitfit::Fourvec_Constrainer_Args::_ignore_met
bool _ignore_met
Definition: Fourvec_Constrainer.h:167
hitfit::Fourvec_Constrainer_Args::e_com
double e_com() const
Definition: Fourvec_Constrainer.cc:82
hitfit::Fourvec_Constrainer::constrain
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,...
Definition: Fourvec_Constrainer.cc:1612
hitfit::Fourvec_Constrainer_Args::_e_com
double _e_com
Definition: Fourvec_Constrainer.h:158
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
hitfit::Chisq_Constrainer_Args
Hold on to parameters for the Chisq_Constrainer class.
Definition: Chisq_Constrainer.h:80
hitfit::Fourvec_Constrainer_Args::_chisq_constrainer_args
Chisq_Constrainer_Args _chisq_constrainer_args
Definition: Fourvec_Constrainer.h:172
hitfit::Fourvec_Constrainer::_constraints
std::vector< Constraint > _constraints
Definition: Fourvec_Constrainer.h:312
hitfit::Fourvec_Constrainer_Args::ignore_met
bool ignore_met() const
Definition: Fourvec_Constrainer.cc:91
hitfit::Fourvec_Constrainer::add_constraint
void add_constraint(std::string s)
Specify an additional constraint s for the problem. The format for s is described in the class descri...
Definition: Fourvec_Constrainer.cc:183
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
hitfit::Defaults
Define an interface for getting parameter settings.
Definition: Defaults.h:57
hitfit::Fourvec_Constrainer_Args
Hold on to parameters for the Fourvec_Constrainer class.
Definition: Fourvec_Constrainer.h:93
hitfit::Fourvec_Constrainer::Fourvec_Constrainer
Fourvec_Constrainer(const Fourvec_Constrainer_Args &args)
Constructor.
Definition: Fourvec_Constrainer.cc:174