CMS 3D CMS Logo

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 95 of file Pair_Table.h.

Constructor & Destructor Documentation

◆ Pair_Table()

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

51  {
52  // The number of objects in the event, including any neutrino.
53  int nobjs = ev.nobjs_all();
54 
55  // Number of constraints.
56  int nc = cv.size();
57 
58  // Loop over pairs of objects.
59  for (int i = 0; i < nobjs - 1; i++)
60  for (int j = i + 1; j < nobjs; j++) {
61  // Make an Objpair instance out of it.
62  Objpair p(i, j, nc);
63 
64  // Loop over constraints.
65  bool wanted = false;
66  for (int k = 0; k < nc; k++) {
67  int val = cv[k].has_labels(ev.obj(i).label, ev.obj(j).label);
68  if (val) {
69  // This pair is used by this constraint. Record it.
70  p.has_constraint(k, val);
71  wanted = true;
72  }
73  }
74 
75  // Was this pair used by any constraint?
76  if (wanted)
77  _pairs.push_back(p);
78  }
79  }

References _pairs, cuy::cv, ev, mps_fire::i, dqmiolumiharvest::j, dqmdumpme::k, AlCaHLTBitMon_ParallelJobs::p, and heppy_batch::val.

Member Function Documentation

◆ get_pair()

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

102  {
103  assert(pairno < _pairs.size());
104  return _pairs[pairno];
105  }

References cms::cuda::assert().

◆ npairs()

int hitfit::Pair_Table::npairs ( ) const

Return the number of pairs in the table.

Definition at line 81 of file Pair_Table.cc.

88  {
89  return _pairs.size();
90  }

References _pairs.

Member Data Documentation

◆ _pairs

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

The list of pairs.

Definition at line 131 of file Pair_Table.h.

Referenced by npairs(), and Pair_Table().

mps_fire.i
i
Definition: mps_fire.py:355
cuy.cv
cv
Definition: cuy.py:364
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::assert
assert(be >=bs)
dqmdumpme.k
k
Definition: dqmdumpme.py:60
hitfit::Pair_Table::_pairs
std::vector< Objpair > _pairs
Definition: Pair_Table.h:131
heppy_batch.val
val
Definition: heppy_batch.py:351
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66