1313#include " FWCore/ParameterSet/interface/ParameterSetDescription.h"
1414#include " FWCore/MessageLogger/interface/MessageLogger.h"
1515
16+ #include < vector>
17+
1618SiStripRecHitConverterAlgorithm::SiStripRecHitConverterAlgorithm (const edm::ParameterSet& conf,
1719 edm::ConsumesCollector iC)
1820 : useQuality(conf.getParameter<bool >(" useSiStripQuality" )),
@@ -50,11 +52,11 @@ void SiStripRecHitConverterAlgorithm::initialize(const edm::EventSetup& es) {
5052 }
5153}
5254
53- void SiStripRecHitConverterAlgorithm::run (edm::Handle<edmNew::DetSetVector<SiStripCluster> > input, products& output) {
55+ void SiStripRecHitConverterAlgorithm::run (edm::Handle<edmNew::DetSetVector<SiStripCluster>> input, products& output) {
5456 run (input, output, LocalVector (0 ., 0 ., 0 .));
5557}
5658
57- void SiStripRecHitConverterAlgorithm::run (edm::Handle<edmNew::DetSetVector<SiStripCluster> > inputhandle,
59+ void SiStripRecHitConverterAlgorithm::run (edm::Handle<edmNew::DetSetVector<SiStripCluster>> inputhandle,
5860 products& output,
5961 LocalVector trackdirection) {
6062 for (auto const & DS : *inputhandle) {
@@ -90,7 +92,7 @@ namespace {
9092 struct CollectorHelper {
9193 size_t nmatch;
9294
93- typedef edm::OwnVector< SiStripMatchedRecHit2D> CollectorMatched ;
95+ using CollectorMatched = std::vector<std::unique_ptr< SiStripMatchedRecHit2D>> ;
9496 typedef SiStripMatchedRecHit2DCollection::FastFiller Collector;
9597
9698 Collector& m_collector;
@@ -104,15 +106,9 @@ namespace {
104106
105107 static inline SiStripRecHit2D const & monoHit (edmNew::DetSet<SiStripRecHit2D>::const_iterator iter) { return *iter; }
106108
107- struct Add {
108- Add (CollectorHelper& ih) : h(ih) {}
109- CollectorHelper& h;
110- void operator ()(SiStripMatchedRecHit2D const & rh) { h.m_collectorMatched .push_back (rh); }
111- };
112-
113109 CollectorHelper& collector () { return *this ; }
114110
115- void operator ()(SiStripMatchedRecHit2D const & rh) { m_collectorMatched.push_back (rh); }
111+ void operator ()(SiStripMatchedRecHit2D const & rh) { m_collectorMatched.emplace_back (rh. clone () ); }
116112
117113 CollectorHelper (Collector& i_collector,
118114 CollectorMatched& i_collectorMatched,
@@ -127,10 +123,7 @@ namespace {
127123 void closure (edmNew::DetSet<SiStripRecHit2D>::const_iterator it) {
128124 if (!m_collectorMatched.empty ()) {
129125 nmatch += m_collectorMatched.size ();
130- for (edm::OwnVector<SiStripMatchedRecHit2D>::const_iterator itm = m_collectorMatched.begin (),
131- edm = m_collectorMatched.end ();
132- itm != edm;
133- ++itm) {
126+ for (auto const & itm : m_collectorMatched) {
134127 m_collector.push_back (*itm);
135128 // mark the stereo hit cluster as used, so that the hit won't go in the unmatched stereo ones
136129 m_matchedSteroClusters.push_back (itm->stereoClusterRef ().key ());
@@ -146,7 +139,7 @@ namespace {
146139
147140void SiStripRecHitConverterAlgorithm::match (products& output, LocalVector trackdirection) const {
148141 int nmatch = 0 ;
149- edm::OwnVector< SiStripMatchedRecHit2D> collectorMatched; // gp/FIXME: avoid this
142+ std::vector<std::unique_ptr< SiStripMatchedRecHit2D>> collectorMatched;
150143
151144 // Remember the ends of the collections, as we will use them a lot
152145 SiStripRecHit2DCollection::const_iterator edStereoDet = output.stereo ->end ();
@@ -218,10 +211,7 @@ void SiStripRecHitConverterAlgorithm::match(products& output, LocalVector trackd
218211 &(*it), stereoSimpleHits.begin (), stereoSimpleHits.end (), collectorMatched, gluedDet, trackdirection);
219212 if (collectorMatched.size () > 0 ) {
220213 nmatch += collectorMatched.size ();
221- for (edm::OwnVector<SiStripMatchedRecHit2D>::const_iterator itm = collectorMatched.begin (),
222- edm = collectorMatched.end ();
223- itm != edm;
224- ++itm) {
214+ for (auto const & itm : collectorMatched) {
225215 collector.push_back (*itm);
226216 // mark the stereo hit cluster as used, so that the hit won't go in the unmatched stereo ones
227217 matchedSteroClusters.push_back (itm->stereoClusterRef ().key ());
0 commit comments