CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
HcalObjectAddons Namespace Reference

Functions

template<class Item , class Less >
const Item * findByT (const Item *target, const std::vector< const Item * > &itemsByT)
 
template<class Item , class Less >
static void sortByT (const std::vector< Item > &items, std::vector< const Item * > &itemsByT)
 

Function Documentation

template<class Item , class Less >
const Item* HcalObjectAddons::findByT ( const Item *  target,
const std::vector< const Item * > &  itemsByT 
)

Definition at line 10 of file HcalObjectAddons.h.

References B2GTnPMonitor_cfi::item, cuda_std::lower_bound(), and filterCSVwithJSON::target.

10  {
11  Less less;
12  auto item = std::lower_bound(itemsByT.begin(), itemsByT.end(), target, less);
13  if (item == itemsByT.end() || !less.equal(*item, target)) {
14  return nullptr;
15  }
16  return *item;
17  }
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
template<class Item , class Less >
static void HcalObjectAddons::sortByT ( const std::vector< Item > &  items,
std::vector< const Item * > &  itemsByT 
)
static

Definition at line 21 of file HcalObjectAddons.h.

References mps_fire::i.

21  {
22  itemsByT.clear();
23  itemsByT.reserve(items.size());
24  Less less;
25  for (const auto& i : items) {
26  if (less.good(i))
27  itemsByT.push_back(&i);
28  }
29  std::sort(itemsByT.begin(), itemsByT.end(), less);
30  }