CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Friends
hitfit::Fourvec_Constrainer Class Reference

Do a kinematic fit for a set of four-momenta, given a set of mass constraints. More...

#include <Fourvec_Constrainer.h>

Public Member Functions

void add_constraint (std::string s)
 Specify an additional constraint s for the problem. The format for s is described in the class description. More...
 
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, and the pull quantities in pullx and pully. Returns the $\chi^{2}$, the value will be negative if the fit failed to converge. More...
 
 Fourvec_Constrainer (const Fourvec_Constrainer_Args &args)
 Constructor. More...
 
void mass_constraint (std::string s)
 Specify a combination of objects that will be returned by the constrain() method as mass. The format of s is the same as for normal constraints. The left-hand side specifies the mass to calculate, the right-hand side should be zero. This combination of objects will be called only once. More...
 

Private Attributes

const Fourvec_Constrainer_Args _args
 
std::vector< Constraint_constraints
 
std::vector< Constraint_mass_constraint
 

Friends

std::ostream & operator<< (std::ostream &s, const Fourvec_Constrainer &c)
 Output stream operator, print the content of this Fourvec_Constrainer to an output stream. More...
 

Detailed Description

Do a kinematic fit for a set of four-momenta, given a set of mass constraints.

The input is in a Fourvec_Event instance. This consists of a collection of objects, each of which has a four-momentum, an uncertainty on the four-momentum, and an integer label.

There are also a set of mass constraints, based on sums of objects with specified labels. A constraint can either require that the invariant mass of a set of objects is constant, or that the mass of two sets of objects be equal to each other. For example, the constraint

\[ (1~~2) = 80 \]

says that the sum of all objects with labels 1 and 2 should have a mass of 80, where the unit of mass is always in GeV. And the constraint

\[ (1~~2) = (3~~4) \]

says that the sum of all objects with labels 1 and 2 should have an invariant mass equal as the invariant mass of the sum of all objects with label 3 and 4.

All the objects are fixed to constant masses for the fit. These masses are attributes of the objects in the Fourvec_Event. This is done by scaling either the four-momentum's three-momentum or energy, depending on the setting of the use_e parameter.

If there is no neutrino present in the event, two additional constraints are automatically added for total $p_{T}$ balance, unless the parameter ignore_met has been set to TRUE.

When the fit completes, this object can compute an invariant mass out of some combination of the objects, including and uncertainty. The particular combination is specified through the method mass_constraint((); it gets a constraint string like normal with the LHS of the constraint i s the mass which will be calculater, and the RHS of the oncstrant should be zero.

Definition at line 229 of file Fourvec_Constrainer.h.

Constructor & Destructor Documentation

hitfit::Fourvec_Constrainer::Fourvec_Constrainer ( const Fourvec_Constrainer_Args args)

Constructor.

Parameters
argsParameter settings for this instance.

Definition at line 202 of file Fourvec_Constrainer.cc.

209  : _args (args)
210 {
211 }
const Fourvec_Constrainer_Args _args

Member Function Documentation

void hitfit::Fourvec_Constrainer::add_constraint ( std::string  s)

Specify an additional constraint s for the problem. The format for s is described in the class description.

Parameters
sThe constraint to add.

Definition at line 214 of file Fourvec_Constrainer.cc.

References _constraints.

Referenced by hitfit::Constrained_Top::Constrained_Top(), and hitfit::Constrained_Z::Constrained_Z().

222 {
223  _constraints.push_back (Constraint (s));
224 }
std::vector< Constraint > _constraints
double hitfit::Fourvec_Constrainer::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, and the pull quantities in pullx and pully. Returns the $\chi^{2}$, the value will be negative if the fit failed to converge.

Parameters
evThe event to be fitted (input), and later after fitting (output).
mThe requested invariant mass to calculate.
sigmThe uncertainty in the requested invariant mass.
pullxPull quantities for well-measured variables.
pullyPull quantities for poorly-measured variables.
Input:
  • ev (before fit).
Output:
  • ev (after fit).
  • m.
  • sigm.
  • pullx
  • pully.
Returns:
The fit $\chi^{2}$, this value will be negative if the fit failed to converge.

Definition at line 1753 of file Fourvec_Constrainer.cc.

References _args, _constraints, _mass_constraint, hitfit::Fourvec_Constrainer_Args::chisq_constrainer_args(), hitfit::Fourvec_Event::has_neutrino(), hitfit::Fourvec_Constrainer_Args::ignore_met(), hitfit::Fourvec_Event::nobjs(), class-composition::Q, dttmaxenums::R, S(), and hitfit::Fourvec_Constrainer_Args::use_e().

Referenced by hitfit::Constrained_Z::constrain(), and hitfit::Constrained_Top::constrain().

1777 {
1778  adjust_fourvecs (ev, _args.use_e ());
1779 
1780  bool use_kt = ev.has_neutrino() || !_args.ignore_met();
1781  int nobjs = ev.nobjs ();
1782  int n_measured_vars = nobjs * 3;
1783  int n_unmeasured_vars = 0;
1784  int n_constraints = _constraints.size ();
1785 
1786  if (use_kt) {
1787  n_measured_vars += 2;
1788 
1789  if (ev.has_neutrino ())
1790  n_unmeasured_vars = 1;
1791  else
1792  n_constraints += 2;
1793  }
1794 
1795  Matrix G_i (n_measured_vars, n_measured_vars);
1796  Diagonal_Matrix Y (n_unmeasured_vars);
1797  Column_Vector x (n_measured_vars);
1798  Column_Vector y (n_unmeasured_vars);
1799  pack_event (ev, _args.use_e(), use_kt, x, y, G_i, Y);
1800 
1801  Column_Vector xm = x;
1802  Column_Vector ym = y;
1803 
1804  // ??? Should allow for using a different underlying fitter here.
1805  Chisq_Constrainer fitter (_args.chisq_constrainer_args());
1806 
1807  Fourvec_Constraint_Calculator cc (ev, _constraints, _args);
1808 
1809  Matrix Q;
1810  Matrix R;
1811  Matrix S;
1812  double chisq = fitter.fit (cc,
1813  xm, x, ym, y, G_i, Y,
1814  pullx, pully,
1815  Q, R, S);
1816 
1817  unpack_event (ev, x, y, _args.use_e (), use_kt);
1818 
1819  calculate_mass (ev, _mass_constraint, _args, chisq, Q, R, S, m, sigm);
1820 
1821  return chisq;
1822 }
CLHEP::HepVector Column_Vector
Definition: matutil.h:66
bool ev
CLHEP::HepMatrix Matrix
Definition: matutil.h:65
const Chisq_Constrainer_Args & chisq_constrainer_args() const
const Fourvec_Constrainer_Args _args
std::vector< Constraint > _mass_constraint
CLHEP::HepDiagMatrix Diagonal_Matrix
Definition: matutil.h:67
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
std::vector< Constraint > _constraints
void hitfit::Fourvec_Constrainer::mass_constraint ( std::string  s)

Specify a combination of objects that will be returned by the constrain() method as mass. The format of s is the same as for normal constraints. The left-hand side specifies the mass to calculate, the right-hand side should be zero. This combination of objects will be called only once.

Parameters
sThe constraint defining the mass.

Definition at line 227 of file Fourvec_Constrainer.cc.

References _mass_constraint, and assert().

Referenced by hitfit::Constrained_Top::Constrained_Top().

238 {
239  assert (_mass_constraint.size() == 0);
240  _mass_constraint.push_back (Constraint (s));
241 }
assert(m_qm.get())
std::vector< Constraint > _mass_constraint

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const Fourvec_Constrainer c 
)
friend

Output stream operator, print the content of this Fourvec_Constrainer to an output stream.

Parameters
sThe output stream to which to write.
cThe instance of Fourvec_Constrainer to be printed.

Definition at line 253 of file Fourvec_Constrainer.cc.

264 {
265  s << "Constraints: (e_com = " << c._args.e_com() << ") ";
266  if (c._args.use_e())
267  s << "(E)";
268  s << "\n";
269 
270  for (std::vector<Constraint>::size_type i=0; i < c._constraints.size(); i++)
271  s << " " << c._constraints[i] << "\n";
272 
273  if (c._mass_constraint.size() > 0) {
274  s << "Mass constraint:\n";
275  s << c._mass_constraint[0] << "\n";
276  }
277  return s;
278 }
int i
Definition: DBlmapReader.cc:9
uint16_t size_type
if(conf.exists("allCellsPositionCalc"))

Member Data Documentation

const Fourvec_Constrainer_Args hitfit::Fourvec_Constrainer::_args
private

Parameter settings for this instance.

Definition at line 321 of file Fourvec_Constrainer.h.

Referenced by Vispa.Main.Application.Application::_readCommandLineAttributes(), constrain(), and hitfit::operator<<().

std::vector<Constraint> hitfit::Fourvec_Constrainer::_constraints
private

The constraints for this problem.

Definition at line 327 of file Fourvec_Constrainer.h.

Referenced by add_constraint(), constrain(), and hitfit::operator<<().

std::vector<Constraint> hitfit::Fourvec_Constrainer::_mass_constraint
private

The constraint giving the mass to be calculated. This should have no more than one entry.

Definition at line 335 of file Fourvec_Constrainer.h.

Referenced by constrain(), mass_constraint(), and hitfit::operator<<().