CMS 3D CMS Logo

DataFrameContainer.cc
Go to the documentation of this file.
2 
3 #include <boost/iterator/permutation_iterator.hpp>
4 
5 #include <algorithm>
6 #include <numeric>
7 #include <cstring>
8 
9 namespace edm {
10  namespace {
11  struct TypeCompare {
12  typedef DataFrameContainer::id_type id_type;
13  std::vector<id_type> const& ids_;
14  TypeCompare(std::vector<id_type> const& iType) : ids_(iType) {}
15  bool operator()(id_type const& iLHS, id_type const& iRHS) const { return ids_[iLHS] < ids_[iRHS]; }
16  };
17  } // namespace
18 
20  if (size() < 2)
21  return;
22  std::vector<int> indices(size(), 1);
23  indices[0] = 0;
24  std::partial_sum(indices.begin(), indices.end(), indices.begin());
25  std::sort(indices.begin(), indices.end(), TypeCompare(m_ids));
26  {
27  IdContainer tmp(m_ids.size());
28  std::copy(boost::make_permutation_iterator(m_ids.begin(), indices.begin()),
29  boost::make_permutation_iterator(m_ids.end(), indices.end()),
30  tmp.begin());
31  tmp.swap(m_ids);
32  }
33  {
34  // std::transform(indices.begin(),indices.end(),indices.begin(),
35  // std::bind(std::multiplies<int>(),m_stride,std::placeholders::_1));
36  DataContainer tmp(m_data.size());
37  size_type s = m_stride * sizeof(data_type);
38  for (size_type j = 0, i = 0; i != indices.size(); ++i, j += m_stride)
39  ::memcpy(&tmp[j], &m_data[indices[i] * m_stride], s);
40  tmp.swap(m_data);
41  }
42  }
43 
44 } // namespace edm
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
edm::DataFrameContainer::m_data
DataContainer m_data
Definition: DataFrameContainer.h:187
mps_fire.i
i
Definition: mps_fire.py:428
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
edm::DataFrameContainer::IdContainer
std::vector< id_type > IdContainer
Definition: DataFrameContainer.h:38
edm::DataFrameContainer::sort
void sort()
Definition: DataFrameContainer.cc:19
edm
HLT enums.
Definition: AlignableModifier.h:19
DataFrameContainer.h
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::DataFrameContainer::DataContainer
std::vector< data_type > DataContainer
Definition: DataFrameContainer.h:39
edm::DataFrameContainer::id_type
unsigned int id_type
Definition: DataFrameContainer.h:36
edm::DataFrameContainer::m_ids
IdContainer m_ids
Definition: DataFrameContainer.h:186
edm::DataFrameContainer::data_type
unsigned short data_type
Definition: DataFrameContainer.h:37
edm::DataFrameContainer::size_type
unsigned int size_type
Definition: DataFrameContainer.h:35
edm::DataFrameContainer::m_stride
size_type m_stride
Definition: DataFrameContainer.h:184
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::DataFrameContainer::size
size_type size() const
Definition: DataFrameContainer.h:162