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::Pair_Table Class Reference

A lookup table to speed up constraint evaluation using Fourvec_Constrainer. More...

#include <Pair_Table.h>

Public Member Functions

const Objpairget_pair (std::vector< Objpair >::size_type pairno) const
 Get one of the pairs from the table, index starts from 0. More...
 
int npairs () const
 Return the number of pairs in the table. More...
 
 Pair_Table (const std::vector< Constraint > &cv, const Fourvec_Event &ev)
 Constructor, give it the event and the list of constraints. More...
 

Private Attributes

std::vector< Objpair_pairs
 

Detailed Description

A lookup table to speed up constraint evaluation using Fourvec_Constrainer.

We have a set of constraints, which reference labels, like

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

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

We also have a Fourvec_Event, which has a set of objects, each of which has a label. A label may correspond to multiple objects.

We'll be evaluating the mass constraints by considering each pair of objects $o_{1}$ and $o_{2}$ and finding its contribution to each constraint. We get pairs because the constraints are quadratic in the objects.

We build a Pair_Table by calling the constructor, giving it the event, and the set of constraints. We can then get back from it a list of Objpair's each representing a pair of objects that are used in some constraint. The Objpair will be able to tell us in which constraints the pair is used and on which side of the equation.

Definition at line 99 of file Pair_Table.h.

Constructor & Destructor Documentation

hitfit::Pair_Table::Pair_Table ( const std::vector< Constraint > &  cv,
const Fourvec_Event ev 
)

Constructor, give it the event and the list of constraints.

Parameters
cvThe list of constraints for the problem.
evThe event.

Definition at line 48 of file Pair_Table.cc.

References _pairs, hitfit::Objpair::has_constraint(), i, j, relval_2017::k, hitfit::FE_Obj::label, hitfit::Fourvec_Event::nobjs_all(), hitfit::Fourvec_Event::obj(), AlCaHLTBitMon_ParallelJobs::p, and SpecificationBuilder_cfi::val().

57 {
58  // The number of objects in the event, including any neutrino.
59  int nobjs = ev.nobjs_all();
60 
61  // Number of constraints.
62  int nc = cv.size();
63 
64  // Loop over pairs of objects.
65  for (int i=0; i < nobjs-1; i++)
66  for (int j=i+1; j < nobjs; j++) {
67  // Make an Objpair instance out of it.
68  Objpair p (i, j, nc);
69 
70  // Loop over constraints.
71  bool wanted = false;
72  for (int k=0; k < nc; k++) {
73  int val = cv[k].has_labels (ev.obj (i).label, ev.obj (j).label);
74  if (val) {
75  // This pair is used by this constraint. Record it.
76  p.has_constraint (k, val);
77  wanted = true;
78  }
79  }
80 
81  // Was this pair used by any constraint?
82  if (wanted)
83  _pairs.push_back (p);
84  }
85 }
int i
Definition: DBlmapReader.cc:9
bool ev
int j
Definition: DBlmapReader.cc:9
std::vector< Objpair > _pairs
Definition: Pair_Table.h:137
dictionary cv
Definition: cuy.py:362

Member Function Documentation

const Objpair & hitfit::Pair_Table::get_pair ( std::vector< Objpair >::size_type  pairno) const

Get one of the pairs from the table, index starts from 0.

Parameters
pairnoThe index of the pair, index starts from 0.

Definition at line 100 of file Pair_Table.cc.

References assert().

Referenced by hitfit::operator<<().

110 {
111  assert (pairno < _pairs.size());
112  return _pairs[pairno];
113 }
assert(m_qm.get())
std::vector< Objpair > _pairs
Definition: Pair_Table.h:137
int hitfit::Pair_Table::npairs ( ) const

Return the number of pairs in the table.

Definition at line 88 of file Pair_Table.cc.

References _pairs.

Referenced by hitfit::operator<<().

95 {
96  return _pairs.size();
97 }
std::vector< Objpair > _pairs
Definition: Pair_Table.h:137

Member Data Documentation

std::vector<Objpair> hitfit::Pair_Table::_pairs
private

The list of pairs.

Definition at line 137 of file Pair_Table.h.

Referenced by npairs(), and Pair_Table().