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 100 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 49 of file Pair_Table.cc.

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

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

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 101 of file Pair_Table.cc.

Referenced by hitfit::operator<<().

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

Return the number of pairs in the table.

Definition at line 89 of file Pair_Table.cc.

References _pairs.

Referenced by hitfit::operator<<().

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

Member Data Documentation

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

The list of pairs.

Definition at line 138 of file Pair_Table.h.

Referenced by npairs(), and Pair_Table().