File indexing completed on 2023-03-17 10:49:20
0001 #ifndef DataFormats_Common_DetSet2RangeMap_h
0002 #define DataFormats_Common_DetSet2RangeMap_h
0003
0004 #include "DataFormats/Common/interface/DetSetVectorNew.h"
0005 #include "DataFormats/Common/interface/RangeMap.h"
0006
0007
0008 #include <algorithm>
0009
0010
0011 namespace edmNew {
0012
0013 namespace dstvdetails {
0014
0015 template <typename B>
0016 struct ToRM {
0017 ToRM(edm::RangeMap<det_id_type, edm::OwnVector<B> >& irm) : rm(&irm) {}
0018 edm::RangeMap<det_id_type, edm::OwnVector<B> >* rm;
0019 template <typename T>
0020 void operator()(edmNew::DetSet<T> const& ds) {
0021
0022
0023
0024 if (!ds.empty())
0025 rm->put(ds.id(), ds.begin(), ds.end());
0026 }
0027 };
0028 }
0029
0030
0031 template <typename T, typename B>
0032 void copy(DetSetVector<T> const& dstv, edm::RangeMap<det_id_type, edm::OwnVector<B> >& rm) {
0033 dstvdetails::ToRM<B> torm(rm);
0034 std::for_each(dstv.begin(), dstv.end(), torm);
0035 }
0036
0037 }
0038
0039 #endif