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
hitfit::Fourvec_Constraint_Calculator Class Reference

Concrete realization of the Constraint_Calculator class. Evaluate constraints at the point described by x and y (well-measured and poorly-measured variables, respectively). The results should be stored in F. Bx and By should be set to the gradients of F with respect to x and y, respectively. More...

Inheritance diagram for hitfit::Fourvec_Constraint_Calculator:
hitfit::Constraint_Calculator

Public Member Functions

bool calculate_constraints (Row_Vector &F, Matrix &Bx, Matrix &By) const
 Calculate the constraint functions and gradients. More...
 
virtual bool eval (const Column_Vector &x, const Column_Vector &y, Row_Vector &F, Matrix &Bx, Matrix &By) override
 Evaluate constraints at the point described by x and y (well-measured and poorly-measured variables, respectively). The results should be stored in F. Bx and By should be set to the gradients of F with respect to x and y, respectively. More...
 
 Fourvec_Constraint_Calculator (Fourvec_Event &ev, const vector< Constraint > &constraints, const Fourvec_Constrainer_Args &args)
 Constructor. More...
 
virtual ~Fourvec_Constraint_Calculator ()
 
- Public Member Functions inherited from hitfit::Constraint_Calculator
 Constraint_Calculator (int nconstraints)
 
int nconstraints () const
 
virtual ~Constraint_Calculator ()
 

Private Attributes

const Fourvec_Constrainer_Args_args
 
const vector< Constraint > & _constraints
 
Fourvec_Event_ev
 
Pair_Table _pt
 

Detailed Description

Concrete realization of the Constraint_Calculator class. Evaluate constraints at the point described by x and y (well-measured and poorly-measured variables, respectively). The results should be stored in F. Bx and By should be set to the gradients of F with respect to x and y, respectively.

Parameters
xColumn_Vector of well-measured variables.
yColumn_Vector of poorly-measured variables.
FRow_Vector contains the results of the constraint evaluation.
BxGradients of F with respect to x
ByGradients of F with respect to y
Return:
true if the point (x,y) is accepted.
false if the point (x,y) is rejected (i.e., in an unphysical region). The constraints need not be evaluated in that case.

Definition at line 1375 of file Fourvec_Constrainer.cc.

Constructor & Destructor Documentation

hitfit::Fourvec_Constraint_Calculator::Fourvec_Constraint_Calculator ( Fourvec_Event ev,
const vector< Constraint > &  constraints,
const Fourvec_Constrainer_Args args 
)

Constructor.

Parameters
evThe event we are fitting.
constraintsThe list of constraints.
argsThe parameter settings for this instance.

Definition at line 1433 of file Fourvec_Constrainer.cc.

1446  ((ev.has_neutrino() || args.ignore_met()) ? 0 : 2)),
1447  _ev (ev),
1449  _args (args),
1450  _pt (constraints, ev)
1451 
1452 {
1453 }
bool ev
Constraint_Calculator(int nconstraints)
const Fourvec_Constrainer_Args & _args
const vector< Constraint > & _constraints
virtual hitfit::Fourvec_Constraint_Calculator::~Fourvec_Constraint_Calculator ( )
inlinevirtual

Definition at line 1386 of file Fourvec_Constrainer.cc.

1386 {}

Member Function Documentation

bool hitfit::Fourvec_Constraint_Calculator::calculate_constraints ( Row_Vector F,
Matrix Bx,
Matrix By 
) const

Calculate the constraint functions and gradients.

Parameters
FVector of constraint values.
BxThe gradient of well-measured variables.
ByThe gradient of poorly-measured variables.
Output:
  • F.
  • Bx.
  • By.

Definition at line 1471 of file Fourvec_Constrainer.cc.

References hitfit::eta_offs, F(), relval_steps::k, hitfit::FE_Obj::muon_p, hitfit::FE_Obj::p, and hitfit::p_offs.

Referenced by eval().

1482 {
1483  // Clear the matrices.
1484  Bx = Matrix (Bx.num_row(), Bx.num_col(), 0);
1485  By = Matrix (By.num_row(), By.num_col(), 0);
1486  F = Row_Vector (F.num_col(), 0);
1487 
1488  const double p_eps = 1e-10;
1489 
1490  if (_ev.has_neutrino() && _ev.nu().z() > _args.e_com()) {
1491  return false;
1492  }
1493 
1494  int nobjs = _ev.nobjs ();
1495 
1496  // Reject the point if any of the momenta get too small.
1497  for (int j=0; j<nobjs; j++) {
1498  if (_ev.obj(j).p.perp() <= p_eps || _ev.obj(j).p.e() <= p_eps) {
1499  return false;
1500  }
1501  }
1502 
1503  if (! calculate_mass_constraints (_ev, _pt, _constraints, _args.use_e(),
1504  F, Bx, By))
1505  return false;
1506 
1507  if (_ev.has_neutrino())
1508  convert_neutrino (_ev, _args.use_e(), Bx, By);
1509  else if (!_args.ignore_met())
1510  {
1511  /* kt constraints */
1512  calculate_kt_constraints (_ev, _args.use_e(), F, Bx);
1513  }
1514 
1515  /* convert d/dtheta to d/deta */
1516  for (int j=0; j<nobjs; j++) {
1517  ddtheta_to_ddeta (obj_index (j) + eta_offs,
1518  _ev.obj(j).p.cosTheta(),
1519  Bx);
1520  }
1521 
1522  /* handle muons */
1523  for (int j=0; j<nobjs; j++) {
1524  const FE_Obj& obj = _ev.obj (j);
1525  if (obj.muon_p) {
1526  // Again, E vs. P doesn't matter here since we assume muons to be massless.
1527  double pmu2 = obj.p.vect().mag2();
1528  int ndx = obj_index (j) + p_offs;
1529  for (int k=1; k<=Bx.num_col(); k++)
1530  Bx(ndx, k) = - Bx(ndx, k) * pmu2;
1531  }
1532  }
1533 
1534  return true;
1535 }
const FE_Obj & obj(std::vector< FE_Obj >::size_type i) const
Access object at index i, with the convention that the index starts at 0.
int nobjs() const
Return the number of objects in the event not including any neutrinos.
CLHEP::HepMatrix Matrix
Definition: matutil.h:65
int j
Definition: DBlmapReader.cc:9
const Fourvec_Constrainer_Args & _args
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
const vector< Constraint > & _constraints
const Fourvec & nu() const
Access the neutrino four-momentum.
bool has_neutrino() const
Return TRUE is this event contains a neutrino, otherwise returns FALSE.
bool hitfit::Fourvec_Constraint_Calculator::eval ( const Column_Vector x,
const Column_Vector y,
Row_Vector F,
Matrix Bx,
Matrix By 
)
overridevirtual

Evaluate constraints at the point described by x and y (well-measured and poorly-measured variables, respectively). The results should be stored in F. Bx and By should be set to the gradients of F with respect to x and y, respectively.

Parameters
xColumn_Vector of well-measured variables.
yColumn_Vector of poorly-measured variables.
FRow_Vector contains the results of the constraint evaluation.
BxGradients of F with respect to x
ByGradients of F with respect to y
Output:
  • F.
  • Bx.
  • By.
Return:
true if the point (x,y) is accepted.
false if the point (x,y) is rejected (i.e., in an unphysical region). The constraints need not be evaluated in that case.

Implements hitfit::Constraint_Calculator.

Definition at line 1567 of file Fourvec_Constrainer.cc.

References _args, _ev, calculate_constraints(), hitfit::eta_offs, hitfit::Fourvec_Event::has_neutrino(), hitfit::Fourvec_Constrainer_Args::ignore_met(), hitfit::Fourvec_Event::nobjs(), hitfit::p_offs, and hitfit::Fourvec_Constrainer_Args::use_e().

1587 {
1588  int nobjs = _ev.nobjs();
1589 
1590  const double p_eps = 1e-10;
1591  const double eta_max = 10;
1592 
1593  // Give up if we've gone into an obviously unphysical region.
1594  for (int j=0; j<nobjs; j++)
1595  if (x(obj_index (j) + p_offs) < p_eps ||
1596  fabs(x(obj_index (j) + eta_offs)) > eta_max) {
1597  return false;
1598  }
1599 
1600  unpack_event (_ev, x, y, _args.use_e(),
1601  _ev.has_neutrino() || !_args.ignore_met());
1602 
1603  return calculate_constraints (F, Bx, By);
1604 }
int nobjs() const
Return the number of objects in the event not including any neutrinos.
bool calculate_constraints(Row_Vector &F, Matrix &Bx, Matrix &By) const
Calculate the constraint functions and gradients.
int j
Definition: DBlmapReader.cc:9
const Fourvec_Constrainer_Args & _args
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
bool has_neutrino() const
Return TRUE is this event contains a neutrino, otherwise returns FALSE.

Member Data Documentation

const Fourvec_Constrainer_Args& hitfit::Fourvec_Constraint_Calculator::_args
private
const vector<Constraint>& hitfit::Fourvec_Constraint_Calculator::_constraints
private

Definition at line 1413 of file Fourvec_Constrainer.cc.

Fourvec_Event& hitfit::Fourvec_Constraint_Calculator::_ev
private

Definition at line 1410 of file Fourvec_Constrainer.cc.

Referenced by eval().

Pair_Table hitfit::Fourvec_Constraint_Calculator::_pt
private

Definition at line 1419 of file Fourvec_Constrainer.cc.