CMS 3D CMS Logo

MtdSimLayerClusterToRecoClusterAssociationMap.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_Associations_MtdSimLayerClusterToRecoClusterAssociationMap_h
2 #define SimDataFormats_Associations_MtdSimLayerClusterToRecoClusterAssociationMap_h
3 
8 
9 #include <vector>
10 #include <utility>
11 #include <algorithm>
12 
18 public:
21  using value_type = std::pair<key_type, std::vector<mapped_type>>;
22  using map_type = std::vector<value_type>;
23  using const_iterator = typename map_type::const_iterator;
24  using range = std::pair<const_iterator, const_iterator>;
25 
30 
31  void emplace_back(const MtdSimLayerClusterRef& simClus, std::vector<FTLClusterRef>& recoClusVect) {
32  map_.emplace_back(simClus, recoClusVect);
33  }
34 
35  void post_insert() { std::sort(map_.begin(), map_.end(), compare); }
36 
37  bool empty() const { return map_.empty(); }
38  size_t size() const { return map_.size(); }
39 
40  const_iterator begin() const { return map_.begin(); }
41  const_iterator cbegin() const { return map_.cbegin(); }
42  const_iterator end() const { return map_.end(); }
43  const_iterator cend() const { return map_.cend(); }
44 
46  return std::equal_range(map_.begin(), map_.end(), value_type(key, std::vector<FTLClusterRef>()), compare);
47  }
48 
49  const map_type& map() const { return map_; }
50 
51 private:
52  static bool compare(const value_type& i, const value_type& j) {
53  const auto& i_hAndE = (i.first)->hits_and_energies();
54  const auto& j_hAndE = (j.first)->hits_and_energies();
55 
56  auto imin = std::min_element(i_hAndE.begin(),
57  i_hAndE.end(),
58  [](std::pair<uint64_t, float> a, std::pair<uint64_t, float> b) { return a < b; });
59 
60  auto jmin = std::min_element(j_hAndE.begin(),
61  j_hAndE.end(),
62  [](std::pair<uint64_t, float> a, std::pair<uint64_t, float> b) { return a < b; });
63 
64  return (*imin < *jmin);
65  }
66 
68 };
69 
70 #endif
void emplace_back(const MtdSimLayerClusterRef &simClus, std::vector< FTLClusterRef > &recoClusVect)
edm::Ref< MtdSimLayerClusterCollection > MtdSimLayerClusterRef
edm::Ref< FTLClusterCollection, FTLCluster > FTLClusterRef
key
prepare the HTCondor submission files and eventually submit them
static bool compare(const value_type &i, const value_type &j)
double b
Definition: hdecay.h:120
std::pair< key_type, std::vector< mapped_type > > value_type
double a
Definition: hdecay.h:121