1416 bpmpd_problem_t *
p =
reinterpret_cast<bpmpd_problem_t *
>(lp_problem);
1437 p->set_objective_sense(bpmpd_problem_t::minimize);
1441 static const size_t nsector_azimuth = 12;
1446 static const size_t ncms_hcal_edge_pseudorapidity = 19 + 1;
1447 static const double cms_hcal_edge_pseudorapidity[
1448 ncms_hcal_edge_pseudorapidity] = {
1449 -5.191, -4.538, -4.013,
1450 -3.489, -2.853, -2.322, -1.830, -1.305, -0.783, -0.261,
1451 0.261, 0.783, 1.305, 1.830, 2.322, 2.853, 3.489,
1456 const double *edge_pseudorapidity;
1458 nedge_pseudorapidity = ncms_hcal_edge_pseudorapidity;
1459 edge_pseudorapidity = cms_hcal_edge_pseudorapidity;
1461 const size_t nsuperblock = (nedge_pseudorapidity - 2) *
1464 size_t index_row = 0;
1465 for (
size_t index_pseudorapidity = 0;
1466 index_pseudorapidity < nedge_pseudorapidity - 2;
1467 index_pseudorapidity++) {
1468 for (
size_t index_azimuth = 0;
1469 index_azimuth < nsector_azimuth - 1;
1471 const size_t index_column =
1472 index_pseudorapidity * nsector_azimuth +
1475 bpmpd_problem_t::greater_equal, 0);
1476 p->push_back_coefficient(
1477 index_row, index_column, 1);
1478 p->push_back_coefficient(
1479 index_row, nsuperblock + index_column, -1);
1482 bpmpd_problem_t::greater_equal, 0);
1483 p->push_back_coefficient(
1484 index_row, index_column, 1);
1485 p->push_back_coefficient(
1486 index_row, nsuperblock + index_column + 1, -1);
1489 bpmpd_problem_t::greater_equal, 0);
1490 p->push_back_coefficient(
1491 index_row, index_column, 1);
1492 p->push_back_coefficient(
1494 nsuperblock + index_column + nsector_azimuth, -1);
1497 bpmpd_problem_t::greater_equal, 0);
1498 p->push_back_coefficient(
1499 index_row, index_column, 1);
1500 p->push_back_coefficient(
1502 nsuperblock + index_column + nsector_azimuth + 1,
1506 const size_t index_column =
1507 index_pseudorapidity * nsector_azimuth +
1508 nsector_azimuth - 1;
1510 bpmpd_problem_t::greater_equal, 0);
1511 p->push_back_coefficient(
1512 index_row, index_column, 1);
1513 p->push_back_coefficient(
1514 index_row, nsuperblock + index_column, -1);
1517 bpmpd_problem_t::greater_equal, 0);
1518 p->push_back_coefficient(
1519 index_row, index_column, 1);
1520 p->push_back_coefficient(
1522 nsuperblock + index_column - (nsector_azimuth - 1),
1526 bpmpd_problem_t::greater_equal, 0);
1527 p->push_back_coefficient(
1528 index_row, index_column, 1);
1529 p->push_back_coefficient(
1531 nsuperblock + index_column + nsector_azimuth, -1);
1534 bpmpd_problem_t::greater_equal, 0);
1535 p->push_back_coefficient(
1536 index_row, index_column, 1);
1537 p->push_back_coefficient(
1539 nsuperblock + index_column + nsector_azimuth -
1540 (nsector_azimuth - 1),
1545 const size_t nstaggered_block =
1546 (nedge_pseudorapidity - 1) * nsector_azimuth;
1547 const size_t nblock = nsuperblock + 2 * nstaggered_block;
1553 size_t positive_count = 0;
1555 for (std::vector<particle_t>::const_iterator iterator =
1557 iterator !=
_event.end(); iterator++) {
1558 if (iterator->momentum_perp_subtracted >= 0) {
1559 positive_index[iterator -
_event.begin()] =
1565 _ncost = nblock + positive_count;
1572 std::vector<particle_t>::const_iterator
1573 iterator_particle =
_event.begin();
1574 std::vector<bool>::const_iterator iterator_active =
1576 std::vector<std::vector<size_t> >::const_iterator
1577 iterator_recombine_index_outer =
1579 std::vector<std::vector<size_t> >::const_iterator
1580 iterator_recombine_unsigned_outer =
1582 size_t index_column_max =
_ncost - 1;
1583 for (; iterator_particle !=
_event.end();
1584 iterator_particle++, iterator_active++,
1585 iterator_recombine_index_outer++,
1586 iterator_recombine_unsigned_outer++) {
1587 if (*iterator_active) {
1588 int index_pseudorapidity = -1;
1592 if (iterator_particle->momentum.Eta() >= edge_pseudorapidity[
i - 1] &&
1593 iterator_particle->momentum.Eta() < edge_pseudorapidity[
i]) {
1594 index_pseudorapidity =
i - 1;
1598 const int index_azimuth = floor(
1599 (iterator_particle->momentum.Phi() +
M_PI) *
1600 ((nsector_azimuth >> 1) /
M_PI));
1602 if (index_pseudorapidity != -1) {
1610 iterator_particle->momentum_perp_subtracted >= 0 ?
1612 bpmpd_problem_t::greater_equal,
1613 iterator_particle->momentum_perp_subtracted);
1616 const double sign = iterator_particle->momentum_perp_subtracted >= 0 ? 1 : -1;
1617 const size_t index_column_block_subtract =
1619 (nedge_pseudorapidity - 1) * nsector_azimuth +
1620 index_pseudorapidity * nsector_azimuth +
1624 index_column_block_subtract;
1626 if (iterator_particle->momentum_perp_subtracted >= 0) {
1627 const size_t index_column_cost =
1628 nblock + positive_index[iterator_particle -
_event.begin()];
1630 p->push_back_coefficient(
1631 index_row, index_column_cost, 1);
1633 std::max(index_column_max, index_column_cost);
1635 p->push_back_coefficient(
1636 index_row, index_column_block_subtract, 1);
1638 std::max(index_column_max, index_column_block_subtract);
1640 for (std::vector<size_t>::const_iterator
1641 iterator_recombine_index_inner =
1642 iterator_recombine_index_outer->begin();
1643 iterator_recombine_index_inner !=
1644 iterator_recombine_index_outer->end();
1645 iterator_recombine_index_inner++) {
1646 const size_t index_column =
1647 *iterator_recombine_index_inner +
1650 p->push_back_coefficient(
1651 index_row, index_column, sign);
1653 std::max(index_column_max, index_column);
1657 const size_t index_column_block =
1659 index_pseudorapidity * nsector_azimuth +
1667 double sum_unequalized;
1669 sum_unequalized = 0;
1670 for (std::vector<size_t>::const_iterator
1671 iterator_recombine_unsigned_inner =
1672 iterator_recombine_unsigned_outer->begin();
1673 iterator_recombine_unsigned_inner !=
1674 iterator_recombine_unsigned_outer->end();
1675 iterator_recombine_unsigned_inner++) {
1677 _event[*iterator_recombine_unsigned_inner].momentum_perp_subtracted;
1679 sum_unequalized =
std::max(0.0, sum_unequalized);
1681 if (sum_unequalized >= sum_unequalized_3 ||
1682 (sum_unequalized >= sum_unequalized_2 &&
1683 (iterator_particle -
_event.begin()) % 2 == 0) ||
1684 (sum_unequalized >= sum_unequalized_1 &&
1685 (iterator_particle -
_event.begin()) % 4 == 0) ||
1686 (sum_unequalized >= sum_unequalized_0 &&
1687 (iterator_particle -
_event.begin()) % 8 == 0)) {
1689 const double weight = sum_unequalized *
1691 iterator_particle->area));
1695 bpmpd_problem_t::greater_equal,
1698 p->push_back_coefficient(
1699 index_row, index_column_block, 1.0 / weight);
1701 for (std::vector<size_t>::const_iterator
1702 iterator_recombine_unsigned_inner =
1703 iterator_recombine_unsigned_outer->begin();
1704 iterator_recombine_unsigned_inner !=
1705 iterator_recombine_unsigned_outer->end();
1706 iterator_recombine_unsigned_inner++) {
1707 if (
_event[*iterator_recombine_unsigned_inner].momentum_perp_subtracted >= 0) {
1708 const size_t index_column_cost =
1710 positive_index[*iterator_recombine_unsigned_inner];
1712 p->push_back_coefficient(
1713 index_row, index_column_cost, 1);
1715 std::max(index_column_max, index_column_cost);
1721 bpmpd_problem_t::greater_equal,
1724 p->push_back_coefficient(
1727 for (std::vector<size_t>::const_iterator iterator_recombine_unsigned_inner = iterator_recombine_unsigned_outer->begin();
1728 iterator_recombine_unsigned_inner != iterator_recombine_unsigned_outer->end();
1729 iterator_recombine_unsigned_inner++) {
1730 if (
_event[*iterator_recombine_unsigned_inner].momentum_perp_subtracted >= 0) {
1731 const size_t index_column_cost =
1733 positive_index[*iterator_recombine_unsigned_inner];
1735 p->push_back_coefficient(
1736 index_row, index_column_cost, -1);
1738 std::max(index_column_max, index_column_cost);
1752 static const double epsilon_degeneracy = 1
e-2;
1758 for (
size_t i = 0;
i < nsuperblock;
i++) {
1759 p->push_back_column(
1762 for (
size_t i = nsuperblock;
i < nsuperblock + nstaggered_block;
i++) {
1763 p->push_back_column(
1766 for (
size_t i = nsuperblock + nstaggered_block;
i < nsuperblock + 2 * nstaggered_block;
i++) {
1767 p->push_back_column(
1770 for (
size_t i = nsuperblock + 2 * nstaggered_block;
i <
_ncost;
i++) {
1771 p->push_back_column(
1777 for (
size_t i = _ncost;
i <= index_column_max;
i++) {
1778 p->push_back_column(
std::vector< bool > _active
std::vector< std::vector< size_t > > _recombine_index
double _positive_bound_scale
std::vector< double > _recombine_tie
bool equal(const T &first, const T &second)
std::vector< size_t > _nblock_subtract
std::vector< std::vector< size_t > > _recombine_unsigned
std::pair< double, double > _equalization_threshold
size_t nedge_pseudorapidity(void) const