diff --git a/PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.cc b/PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.cc index bf1d33ab70929..7cc8852284722 100644 --- a/PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.cc +++ b/PhysicsTools/CandAlgos/plugins/EventShapeVarsProducer.cc @@ -22,8 +22,7 @@ EventShapeVarsProducer::EventShapeVarsProducer(const edm::ParameterSet& cfg) void put(edm::Event& evt, double value, const char* instanceName) { - std::auto_ptr eventShapeVarPtr(new double(value)); - evt.put(eventShapeVarPtr, instanceName); + evt.put(std::make_unique(value), instanceName); } void EventShapeVarsProducer::produce(edm::Event& evt, const edm::EventSetup&) diff --git a/PhysicsTools/HepMCCandAlgos/interface/MCTruthCompositeMatcher.h b/PhysicsTools/HepMCCandAlgos/interface/MCTruthCompositeMatcher.h index 5470abf90d0e7..3d03c542a85f0 100755 --- a/PhysicsTools/HepMCCandAlgos/interface/MCTruthCompositeMatcher.h +++ b/PhysicsTools/HepMCCandAlgos/interface/MCTruthCompositeMatcher.h @@ -52,7 +52,7 @@ void MCTruthCompositeMatcher::produce( edm::Event & evt , const edm::Eve maps.push_back( & * matchMap ); } MCCandMatcher match( maps ); - auto_ptr matchMap( new map_type ); + auto matchMap = std::make_unique(); for( size_t i = 0; i != cands->size(); ++ i ) { const typename C1::value_type & cand = ( * cands )[ i ]; reference_type mc(match( cand )); @@ -61,7 +61,7 @@ void MCTruthCompositeMatcher::produce( edm::Event & evt , const edm::Eve } } - evt.put( matchMap ); + evt.put(std::move(matchMap) ); } #endif diff --git a/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryFilter.cc b/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryFilter.cc index 4814ef9528283..8070b45b21a44 100644 --- a/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryFilter.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryFilter.cc @@ -184,7 +184,7 @@ FlavorHistoryFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) Handle cFlavorHistoryEvent; iEvent.getByToken(csrcToken_,cFlavorHistoryEvent); - std::auto_ptr selection ( new unsigned int() ); + auto selection = std::make_unique(0); // Get the number of matched b-jets in the event unsigned int nb = bFlavorHistoryEvent->nb(); @@ -238,7 +238,7 @@ FlavorHistoryFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) pass = true; } - iEvent.put( selection ); + iEvent.put(std::move(selection) ); return pass; diff --git a/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryProducer.cc b/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryProducer.cc index 79cc893f7926c..76335f0de5f33 100644 --- a/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryProducer.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/FlavorHistoryProducer.cc @@ -80,7 +80,7 @@ void FlavorHistoryProducer::produce( Event& evt, const EventSetup& ) vector flavorSources; // Make a new flavor history vector - auto_ptr flavorHistoryEvent ( new FlavorHistoryEvent () ) ; + auto flavorHistoryEvent = std::make_unique(); // ------------------------------------------------------------ // Loop over partons @@ -321,7 +321,7 @@ void FlavorHistoryProducer::produce( Event& evt, const EventSetup& ) } // Now add the flavor history to the event record - evt.put( flavorHistoryEvent, flavorHistoryName_ ); + evt.put(std::move(flavorHistoryEvent), flavorHistoryName_ ); } diff --git a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleDecaySelector.cc b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleDecaySelector.cc index aa521bee63048..d1e2023232310 100755 --- a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleDecaySelector.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleDecaySelector.cc @@ -52,13 +52,13 @@ void GenParticleDecaySelector::produce(edm::Event& evt, const edm::EventSetup& e Handle genParticles; evt.getByToken(srcToken_, genParticles); - auto_ptr decay(new GenParticleCollection); + auto decay = std::make_unique(); const GenParticleRefProd ref = evt.getRefBeforePut(); for(GenParticleCollection::const_iterator g = genParticles->begin(); g != genParticles->end(); ++g) if(g->pdgId() == particle_.pdgId() && g->status() == status_) add(*decay, *g, ref); - evt.put(decay); + evt.put(std::move(decay)); } pair GenParticleDecaySelector::add(GenParticleCollection & decay, const GenParticle & p, diff --git a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc index 8e8243866bfc0..e8885dad4127f 100755 --- a/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/GenParticleProducer.cc @@ -176,8 +176,8 @@ void GenParticleProducer::produce( Event& evt, const EventSetup& es ) { // initialise containers const size_t size = totalSize; vector particles( size ); - auto_ptr candsPtr( new GenParticleCollection( size ) ); - auto_ptr > barCodeVector( new vector( size ) ); + auto candsPtr = std::make_unique(size); + auto barCodeVector = std::make_unique>(size); ref_ = evt.getRefBeforePut(); GenParticleCollection & cands = * candsPtr; size_t offset = 0; @@ -257,8 +257,8 @@ void GenParticleProducer::produce( Event& evt, const EventSetup& es ) { } } - evt.put( candsPtr ); - if(saveBarCodes_) evt.put( barCodeVector ); + evt.put(std::move(candsPtr)); + if(saveBarCodes_) evt.put(std::move(barCodeVector)); if(cfhepmcprod) delete cfhepmcprod; } diff --git a/PhysicsTools/HepMCCandAlgos/plugins/GenParticlePruner.cc b/PhysicsTools/HepMCCandAlgos/plugins/GenParticlePruner.cc index d1918349112a0..dfe793ad215da 100644 --- a/PhysicsTools/HepMCCandAlgos/plugins/GenParticlePruner.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/GenParticlePruner.cc @@ -231,7 +231,7 @@ void GenParticlePruner::produce(Event& evt, const EventSetup& es) { } } - auto_ptr out(new GenParticleCollection); + auto out = std::make_unique(); GenParticleRefProd outRef = evt.getRefBeforePut(); out->reserve(counter); @@ -261,12 +261,12 @@ void GenParticlePruner::produce(Event& evt, const EventSetup& es) { } - edm::OrphanHandle oh = evt.put(out); - std::auto_ptr > orig2new(new edm::Association(oh )); + edm::OrphanHandle oh = evt.put(std::move(out)); + auto orig2new = std::make_unique>(oh); edm::Association::Filler orig2newFiller(*orig2new); orig2newFiller.insert(src, flags_.begin(), flags_.end()); orig2newFiller.fill(); - evt.put(orig2new); + evt.put(std::move(orig2new)); } diff --git a/PhysicsTools/HepMCCandAlgos/plugins/GenPlusSimParticleProducer.cc b/PhysicsTools/HepMCCandAlgos/plugins/GenPlusSimParticleProducer.cc index f43e910f2f8ff..84251f880204f 100644 --- a/PhysicsTools/HepMCCandAlgos/plugins/GenPlusSimParticleProducer.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/GenPlusSimParticleProducer.cc @@ -53,7 +53,7 @@ class GenPlusSimParticleProducer : public edm::EDProducer { std::vector pdts_; // these are needed before we get the EventSetup typedef StringCutObjectSelector StrFilter; - std::auto_ptr filter_; + std::unique_ptr filter_; /// Collection of GenParticles I need to make refs to. It must also have its associated vector of barcodes, aligned with them. edm::EDGetTokenT gensToken_; @@ -113,7 +113,7 @@ GenPlusSimParticleProducer::GenPlusSimParticleProducer(const ParameterSet& cfg) if (cfg.existsAs("filter")) { string filter = cfg.getParameter("filter"); if (!filter.empty()) { - filter_ = auto_ptr(new StrFilter(filter)); + filter_ = std::make_unique(filter); } } produces(); @@ -197,7 +197,7 @@ void GenPlusSimParticleProducer::produce(Event& event, event.getByToken(simtracksToken_, simtracks); // Need to check that SimTrackContainer is sorted; otherwise, copy and sort :-( - std::auto_ptr simtracksTmp; + std::unique_ptr simtracksTmp; const SimTrackContainer * simtracksSorted = &* simtracks; if (!__gnu_cxx::is_sorted(simtracks->begin(), simtracks->end(), LessById())) { simtracksTmp.reset(new SimTrackContainer(*simtracks)); @@ -218,7 +218,7 @@ void GenPlusSimParticleProducer::produce(Event& event, if (gens->size() != genBarcodes->size()) throw cms::Exception("Corrupt data") << "Barcodes not of the same size as GenParticles!\n"; // make the output collection - auto_ptr candsPtr(new GenParticleCollection); + auto candsPtr = std::make_unique(); GenParticleCollection & cands = * candsPtr; const GenParticleRefProd ref = event.getRefBeforePut(); @@ -230,7 +230,7 @@ void GenPlusSimParticleProducer::produce(Event& event, } // make new barcodes vector and fill it with the original list - auto_ptr > newGenBarcodes( new vector() ); + auto newGenBarcodes = std::make_unique>(); for (unsigned int i = 0; i < genBarcodes->size(); ++i) { newGenBarcodes->push_back((*genBarcodes)[i]); } @@ -300,8 +300,8 @@ void GenPlusSimParticleProducer::produce(Event& event, } } - event.put(candsPtr); - event.put(newGenBarcodes); + event.put(std::move(candsPtr)); + event.put(std::move(newGenBarcodes)); } DEFINE_FWK_MODULE(GenPlusSimParticleProducer); diff --git a/PhysicsTools/HepMCCandAlgos/plugins/MCTruthCompositeMatcherNew.cc b/PhysicsTools/HepMCCandAlgos/plugins/MCTruthCompositeMatcherNew.cc index fcc21eada341d..f813086ffd8f5 100755 --- a/PhysicsTools/HepMCCandAlgos/plugins/MCTruthCompositeMatcherNew.cc +++ b/PhysicsTools/HepMCCandAlgos/plugins/MCTruthCompositeMatcherNew.cc @@ -53,7 +53,7 @@ namespace reco { maps.push_back(& * matchMap); } utilsNew::CandMatcher match(maps); - auto_ptr matchMap(new GenParticleMatch(match.ref())); + auto matchMap = std::make_unique(match.ref()); int size = cands->size(); vector::const_iterator begin = pdgId_.begin(), end = pdgId_.end(); if(size != 0) { @@ -74,7 +74,7 @@ namespace reco { filler.insert(ref, indices.begin(), indices.end()); filler.fill(); } - evt.put(matchMap); + evt.put(std::move(matchMap)); } } diff --git a/PhysicsTools/IsolationAlgos/interface/EventDependentAbsVetos.h b/PhysicsTools/IsolationAlgos/interface/EventDependentAbsVetos.h index 504af7cdc9fbb..be495ef757e81 100644 --- a/PhysicsTools/IsolationAlgos/interface/EventDependentAbsVetos.h +++ b/PhysicsTools/IsolationAlgos/interface/EventDependentAbsVetos.h @@ -58,7 +58,7 @@ namespace reco { private: edm::EDGetTokenT > src_; std::vector items_; - std::auto_ptr veto_; + std::unique_ptr veto_; }; class OtherJetConstituentsDeltaRVeto : public EventDependentAbsVeto { diff --git a/PhysicsTools/IsolationAlgos/interface/IsolationProducer.h b/PhysicsTools/IsolationAlgos/interface/IsolationProducer.h index 4785b07f6d4df..3573d6da52fb1 100755 --- a/PhysicsTools/IsolationAlgos/interface/IsolationProducer.h +++ b/PhysicsTools/IsolationAlgos/interface/IsolationProducer.h @@ -70,14 +70,14 @@ void IsolationProducer::produce( edm::Even Setup::init( alg_, es ); typename OutputCollection::refprod_type ref( src ); - auto_ptr isolations( new OutputCollection( ref ) ); + auto isolations = std::make_unique( ref ); size_t i = 0; for( typename C1::const_iterator lep = src->begin(); lep != src->end(); ++ lep ) { typename Alg::value_type iso= alg_(*lep,*elements); isolations->setValue( i++, iso ); } - evt.put( isolations ); + evt.put(std::move(isolations) ); } #endif diff --git a/PhysicsTools/IsolationAlgos/interface/IsolationProducerNew.h b/PhysicsTools/IsolationAlgos/interface/IsolationProducerNew.h index a39ead3099c0b..c6732c90aedeb 100755 --- a/PhysicsTools/IsolationAlgos/interface/IsolationProducerNew.h +++ b/PhysicsTools/IsolationAlgos/interface/IsolationProducerNew.h @@ -73,7 +73,7 @@ namespace reco { Setup::init(alg_, es); ::helper::MasterCollection master(src, evt); - auto_ptr isolations(new OutputCollection); + auto isolations = std::make_unique(); if(src->size()!= 0) { typename OutputCollection::Filler filler(*isolations); vector iso(master.size(),-1); @@ -83,7 +83,7 @@ namespace reco { filler.insert(master.get(), iso.begin(), iso.end()); filler.fill(); } - evt.put( isolations ); + evt.put(std::move(isolations) ); } } diff --git a/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducer.cc b/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducer.cc index c1b69fd4d31a0..7803c6db874a4 100644 --- a/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducer.cc +++ b/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducer.cc @@ -114,7 +114,7 @@ namespace citk { void PFIsolationSumProducer:: produce(edm::Event& ev, const edm::EventSetup& es) { - typedef std::auto_ptr > product_type; + typedef std::unique_ptr > product_type; typedef std::vector product_values; edm::Handle to_isolate; edm::Handle isolate_with; @@ -167,7 +167,7 @@ namespace citk { the_values[i][j].begin(), the_values[i][j].end()); fillerprod.fill(); - ev.put(the_product,_product_names[i][j]); + ev.put(std::move(the_product),_product_names[i][j]); } } } diff --git a/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducerForPUPPI.cc b/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducerForPUPPI.cc index 0327c326b9568..9a1c2f64ddf01 100644 --- a/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducerForPUPPI.cc +++ b/PhysicsTools/IsolationAlgos/plugins/CITKPFIsolationSumProducerForPUPPI.cc @@ -116,7 +116,7 @@ namespace citk { void PFIsolationSumProducerForPUPPI:: produce(edm::Event& ev, const edm::EventSetup& es) { - typedef std::auto_ptr > product_type; + typedef std::unique_ptr > product_type; typedef std::vector product_values; edm::Handle to_isolate; edm::Handle isolate_with; @@ -175,7 +175,7 @@ namespace citk { the_values[i][j].begin(), the_values[i][j].end()); fillerprod.fill(); - ev.put(the_product,_product_names[i][j]); + ev.put(std::move(the_product),_product_names[i][j]); } } } diff --git a/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc b/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc index ef36d9e86753a..831b8f71e287c 100755 --- a/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc +++ b/PhysicsTools/IsolationAlgos/plugins/CandIsoDepositProducer.cc @@ -149,7 +149,7 @@ void CandIsoDepositProducer::produce(Event& event, const EventSetup& eventSetup) } //! fill the maps here - std::unique_ptr depMap(new reco::IsoDepositMap()); + auto depMap = std::make_unique(); reco::IsoDepositMap::Filler filler(*depMap); filler.insert(hCands, deps2D[iDep].begin(), deps2D[iDep].end()); deps2D[iDep].clear(); diff --git a/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc b/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc index f17d6959986e1..9e20096eb2c82 100755 --- a/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc +++ b/PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.cc @@ -140,10 +140,10 @@ void CandIsolatorFromDeposits::produce(Event& event, const EventSetup& eventSetu const IsoDepositMap & map = begin->map(); if (map.size()==0) { // !!??? - event.put(std::auto_ptr(new CandDoubleMap())); + event.put(std::make_unique()); return; } - std::auto_ptr ret(new CandDoubleMap()); + auto ret = std::make_unique(); CandDoubleMap::Filler filler(*ret); typedef reco::IsoDepositMap::const_iterator iterator_i; @@ -167,7 +167,7 @@ void CandIsolatorFromDeposits::produce(Event& event, const EventSetup& eventSetu filler.insert(candH, retV.begin(), retV.end()); } filler.fill(); - event.put(ret); + event.put(std::move(ret)); } DEFINE_FWK_MODULE( CandIsolatorFromDeposits ); diff --git a/PhysicsTools/IsolationAlgos/plugins/IsolationProducerForTracks.cc b/PhysicsTools/IsolationAlgos/plugins/IsolationProducerForTracks.cc index 58caf4e710841..4b792824ffcba 100644 --- a/PhysicsTools/IsolationAlgos/plugins/IsolationProducerForTracks.cc +++ b/PhysicsTools/IsolationAlgos/plugins/IsolationProducerForTracks.cc @@ -47,7 +47,7 @@ IsolationProducerForTracks::IsolationProducerForTracks(const ParameterSet & pset } void IsolationProducerForTracks::produce(Event & event, const EventSetup & setup) { - std::auto_ptr caloIsolations(new TkIsoMap); + auto caloIsolations = std::make_unique(); TkIsoMap::Filler filler(*caloIsolations); { Handle tracks; @@ -86,7 +86,7 @@ void IsolationProducerForTracks::produce(Event & event, const EventSetup & setup // really fill the association map filler.fill(); - event.put(caloIsolations); + event.put(std::move(caloIsolations)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/IsolationAlgos/src/IsoDepositVetoFactory.cc b/PhysicsTools/IsolationAlgos/src/IsoDepositVetoFactory.cc index b81a3af69dc9e..5c2d2fca5958f 100644 --- a/PhysicsTools/IsolationAlgos/src/IsoDepositVetoFactory.cc +++ b/PhysicsTools/IsolationAlgos/src/IsoDepositVetoFactory.cc @@ -19,7 +19,7 @@ namespace reco { namespace isodeposit { veto_->centerOn(eta,phi); } private: - std::auto_ptr veto_; + std::unique_ptr veto_; bool barrel_; }; @@ -72,7 +72,7 @@ namespace reco { namespace isodeposit { reco::isodeposit::AbsVeto * IsoDepositVetoFactory::make(const char *string, edm::ConsumesCollector& iC) { reco::isodeposit::EventDependentAbsVeto * evdep = 0; - std::auto_ptr ret(make(string,evdep, iC)); + std::unique_ptr ret(make(string,evdep, iC)); if (evdep != 0) { throw cms::Exception("Configuration") << "The resulting AbsVeto depends on the edm::Event.\n" << "Please use the two-arguments IsoDepositVetoFactory::make.\n"; diff --git a/PhysicsTools/JetCharge/plugins/JetChargeProducer.cc b/PhysicsTools/JetCharge/plugins/JetChargeProducer.cc index 91457853b990a..ad2fca2be272e 100644 --- a/PhysicsTools/JetCharge/plugins/JetChargeProducer.cc +++ b/PhysicsTools/JetCharge/plugins/JetChargeProducer.cc @@ -14,11 +14,10 @@ void JetChargeProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::Ev if (hJTAs->keyProduct().isNull()) { // need to work around this bug someway, altough it's not stricly my fault - std::auto_ptr ret(new JetChargeCollection()); - iEvent.put(ret); + iEvent.put(std::make_unique()); return; } - std::auto_ptr ret(new JetChargeCollection(hJTAs->keyProduct())); + auto ret = std::make_unique(hJTAs->keyProduct()); for (IT it = hJTAs->begin(), ed = hJTAs->end(); it != ed; ++it) { const JetRef &jet = it->first; const reco::TrackRefVector &tracks = it->second; @@ -26,5 +25,5 @@ void JetChargeProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::Ev reco::JetFloatAssociation::setValue(*ret, jet, val); } - iEvent.put(ret); + iEvent.put(std::move(ret)); } diff --git a/PhysicsTools/JetMCAlgos/interface/BasePartonSelector.h b/PhysicsTools/JetMCAlgos/interface/BasePartonSelector.h index 965b3ed24f10a..8dd0ee3cc7eaf 100644 --- a/PhysicsTools/JetMCAlgos/interface/BasePartonSelector.h +++ b/PhysicsTools/JetMCAlgos/interface/BasePartonSelector.h @@ -17,7 +17,7 @@ class BasePartonSelector ~BasePartonSelector(); virtual void run(const edm::Handle & particles, - std::auto_ptr & partons); + std::unique_ptr & partons); }; #endif diff --git a/PhysicsTools/JetMCAlgos/interface/Herwig6PartonSelector.h b/PhysicsTools/JetMCAlgos/interface/Herwig6PartonSelector.h index 3398b4a9b9c26..0dc641ac5daee 100644 --- a/PhysicsTools/JetMCAlgos/interface/Herwig6PartonSelector.h +++ b/PhysicsTools/JetMCAlgos/interface/Herwig6PartonSelector.h @@ -15,7 +15,7 @@ class Herwig6PartonSelector : public BasePartonSelector virtual ~Herwig6PartonSelector(); void run(const edm::Handle & particles, - std::auto_ptr & partons); + std::unique_ptr & partons); }; #endif diff --git a/PhysicsTools/JetMCAlgos/interface/HerwigppPartonSelector.h b/PhysicsTools/JetMCAlgos/interface/HerwigppPartonSelector.h index c728efd47e80d..a722cef3e0a33 100644 --- a/PhysicsTools/JetMCAlgos/interface/HerwigppPartonSelector.h +++ b/PhysicsTools/JetMCAlgos/interface/HerwigppPartonSelector.h @@ -15,7 +15,7 @@ class HerwigppPartonSelector : public BasePartonSelector virtual ~HerwigppPartonSelector(); void run(const edm::Handle & particles, - std::auto_ptr & partons); + std::unique_ptr & partons); }; #endif diff --git a/PhysicsTools/JetMCAlgos/interface/Pythia6PartonSelector.h b/PhysicsTools/JetMCAlgos/interface/Pythia6PartonSelector.h index f1968438b514a..7150108cd5c98 100644 --- a/PhysicsTools/JetMCAlgos/interface/Pythia6PartonSelector.h +++ b/PhysicsTools/JetMCAlgos/interface/Pythia6PartonSelector.h @@ -15,7 +15,7 @@ class Pythia6PartonSelector : public BasePartonSelector virtual ~Pythia6PartonSelector(); void run(const edm::Handle & particles, - std::auto_ptr & partons); + std::unique_ptr & partons); }; #endif diff --git a/PhysicsTools/JetMCAlgos/interface/Pythia8PartonSelector.h b/PhysicsTools/JetMCAlgos/interface/Pythia8PartonSelector.h index 88ed19096ad03..5fccc69b9923f 100644 --- a/PhysicsTools/JetMCAlgos/interface/Pythia8PartonSelector.h +++ b/PhysicsTools/JetMCAlgos/interface/Pythia8PartonSelector.h @@ -15,7 +15,7 @@ class Pythia8PartonSelector : public BasePartonSelector virtual ~Pythia8PartonSelector(); void run(const edm::Handle & particles, - std::auto_ptr & partons); + std::unique_ptr & partons); }; #endif diff --git a/PhysicsTools/JetMCAlgos/interface/SherpaPartonSelector.h b/PhysicsTools/JetMCAlgos/interface/SherpaPartonSelector.h index e707f4bfa0c1f..2317b336a4f96 100644 --- a/PhysicsTools/JetMCAlgos/interface/SherpaPartonSelector.h +++ b/PhysicsTools/JetMCAlgos/interface/SherpaPartonSelector.h @@ -15,7 +15,7 @@ class SherpaPartonSelector : public BasePartonSelector virtual ~SherpaPartonSelector(); void run(const edm::Handle & particles, - std::auto_ptr & partons); + std::unique_ptr & partons); }; #endif diff --git a/PhysicsTools/JetMCAlgos/plugins/CandOneToManyDeltaRMatcher.cc b/PhysicsTools/JetMCAlgos/plugins/CandOneToManyDeltaRMatcher.cc index 1b38a25beeb8d..411ce73440e1b 100644 --- a/PhysicsTools/JetMCAlgos/plugins/CandOneToManyDeltaRMatcher.cc +++ b/PhysicsTools/JetMCAlgos/plugins/CandOneToManyDeltaRMatcher.cc @@ -90,9 +90,9 @@ void CandOneToManyDeltaRMatcher::produce( Event& evt, const EventSetup& es ) { } - auto_ptr matchMap( new CandMatchMapMany( CandMatchMapMany::ref_type( CandidateRefProd( source ), - CandidateRefProd( matched ) - ) ) ); + auto matchMap = std::make_unique( CandMatchMapMany::ref_type( CandidateRefProd( source ), + CandidateRefProd( matched ) + ) ); for( size_t c = 0; c != source->size(); ++ c ) { const Candidate & src = (*source)[ c ]; if (printdebug_) cout << "[CandOneToManyDeltaRMatcher] source (Et,Eta,Phi) =(" << src.et() << "," << @@ -116,7 +116,7 @@ void CandOneToManyDeltaRMatcher::produce( Event& evt, const EventSetup& es ) { } } - evt.put( matchMap ); + evt.put(std::move(matchMap) ); } diff --git a/PhysicsTools/JetMCAlgos/plugins/CandOneToOneDeltaRMatcher.cc b/PhysicsTools/JetMCAlgos/plugins/CandOneToOneDeltaRMatcher.cc index 2fb185b49e7a1..282978ce0887b 100644 --- a/PhysicsTools/JetMCAlgos/plugins/CandOneToOneDeltaRMatcher.cc +++ b/PhysicsTools/JetMCAlgos/plugins/CandOneToOneDeltaRMatcher.cc @@ -161,14 +161,14 @@ void CandOneToOneDeltaRMatcher::produce( Event& evt, const EventSetup& es ) { for(int i1=0; i1 matchMapSrMt( new CandViewMatchMap( CandViewMatchMap::ref_type( CandidateRefProd( source ), - CandidateRefProd( matched ) ) ) ); - auto_ptr matchMapMtSr( new CandViewMatchMap( CandViewMatchMap::ref_type( CandidateRefProd( matched ), - CandidateRefProd( source ) ) ) ); + auto matchMapSrMt = std::make_unique(CandViewMatchMap::ref_type( CandidateRefProd( source ), + CandidateRefProd( matched ) ) ); + auto matchMapMtSr = std::make_unique(CandViewMatchMap::ref_type( CandidateRefProd( matched ), + CandidateRefProd( source ) ) ); */ - auto_ptr matchMapSrMt( new CandViewMatchMap() ); - auto_ptr matchMapMtSr( new CandViewMatchMap() ); + auto matchMapSrMt = std::make_unique(); + auto matchMapMtSr = std::make_unique(); for( int c = 0; c != nMin; c ++ ) { if( source->size() <= matched->size() ) { @@ -191,8 +191,8 @@ void CandOneToOneDeltaRMatcher::produce( Event& evt, const EventSetup& es ) { } } */ - evt.put( matchMapSrMt, "src2mtc" ); - evt.put( matchMapMtSr, "mtc2src" ); + evt.put(std::move(matchMapSrMt), "src2mtc" ); + evt.put(std::move(matchMapMtSr), "mtc2src" ); AllDist.clear(); } diff --git a/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc b/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc index a42d0fbdff953..f2a123758ba55 100644 --- a/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc +++ b/PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc @@ -207,30 +207,30 @@ void GenHFHadronMatcher::produce ( edm::Event& evt, const edm::EventSetup& setup evt.getByToken(jetFlavourInfosToken_, jetFlavourInfos); // Defining adron matching variables - std::auto_ptr > hadMothers ( new std::vector ); - std::auto_ptr > > hadMothersIndices ( new std::vector > ); - std::auto_ptr > hadIndex ( new std::vector ); - std::auto_ptr > hadFlavour ( new std::vector ); - std::auto_ptr > hadJetIndex ( new std::vector ); - std::auto_ptr > hadLeptonIndex ( new std::vector ); - std::auto_ptr > hadLeptonHadIndex ( new std::vector ); - std::auto_ptr > hadLeptonViaTau( new std::vector ); - std::auto_ptr > hadFromTopWeakDecay ( new std::vector ); - std::auto_ptr > hadBHadronId ( new std::vector ); + auto hadMothers = std::make_unique >(); + auto hadMothersIndices = std::make_unique > >(); + auto hadIndex = std::make_unique >(); + auto hadFlavour = std::make_unique >(); + auto hadJetIndex = std::make_unique >(); + auto hadLeptonIndex = std::make_unique >(); + auto hadLeptonHadIndex = std::make_unique >(); + auto hadLeptonViaTau = std::make_unique >(); + auto hadFromTopWeakDecay = std::make_unique >(); + auto hadBHadronId = std::make_unique >(); *hadJetIndex = findHadronJets (genParticles.product(), jetFlavourInfos.product(), *hadIndex, *hadMothers, *hadMothersIndices, *hadLeptonIndex, *hadLeptonHadIndex, *hadLeptonViaTau, *hadFlavour, *hadFromTopWeakDecay, *hadBHadronId ); // Putting products to the event - evt.put ( hadMothers, "gen"+flavourStr_+"HadPlusMothers" ); - evt.put ( hadMothersIndices, "gen"+flavourStr_+"HadPlusMothersIndices" ); - evt.put ( hadIndex, "gen"+flavourStr_+"HadIndex" ); - evt.put ( hadFlavour, "gen"+flavourStr_+"HadFlavour" ); - evt.put ( hadJetIndex, "gen"+flavourStr_+"HadJetIndex" ); - evt.put ( hadLeptonIndex, "gen"+flavourStr_+"HadLeptonIndex" ); - evt.put ( hadLeptonHadIndex, "gen"+flavourStr_+"HadLeptonHadronIndex" ); - evt.put ( hadLeptonViaTau, "gen"+flavourStr_+"HadLeptonViaTau" ); - evt.put ( hadFromTopWeakDecay,"gen"+flavourStr_+"HadFromTopWeakDecay" ); - evt.put ( hadBHadronId, "gen"+flavourStr_+"HadBHadronId" ); + evt.put(std::move(hadMothers), "gen"+flavourStr_+"HadPlusMothers" ); + evt.put(std::move(hadMothersIndices), "gen"+flavourStr_+"HadPlusMothersIndices" ); + evt.put(std::move(hadIndex), "gen"+flavourStr_+"HadIndex" ); + evt.put(std::move(hadFlavour), "gen"+flavourStr_+"HadFlavour" ); + evt.put(std::move(hadJetIndex), "gen"+flavourStr_+"HadJetIndex" ); + evt.put(std::move(hadLeptonIndex), "gen"+flavourStr_+"HadLeptonIndex" ); + evt.put(std::move(hadLeptonHadIndex), "gen"+flavourStr_+"HadLeptonHadronIndex" ); + evt.put(std::move(hadLeptonViaTau), "gen"+flavourStr_+"HadLeptonViaTau" ); + evt.put(std::move(hadFromTopWeakDecay),"gen"+flavourStr_+"HadFromTopWeakDecay" ); + evt.put(std::move(hadBHadronId), "gen"+flavourStr_+"HadBHadronId" ); } // ------------ method called once each job just before starting event loop ------------ diff --git a/PhysicsTools/JetMCAlgos/plugins/GenJetBCEnergyRatio.cc b/PhysicsTools/JetMCAlgos/plugins/GenJetBCEnergyRatio.cc index 2e34b9f8689a5..f8dd862fabeb5 100644 --- a/PhysicsTools/JetMCAlgos/plugins/GenJetBCEnergyRatio.cc +++ b/PhysicsTools/JetMCAlgos/plugins/GenJetBCEnergyRatio.cc @@ -98,8 +98,8 @@ void GenJetBCEnergyRatio::produce( Event& iEvent, const EventSetup& iEs ) jtc2 = new JetBCEnergyRatioCollection(); } - std::auto_ptr bRatioColl(jtc1); - std::auto_ptr cRatioColl(jtc2); + std::unique_ptr bRatioColl(jtc1); + std::unique_ptr cRatioColl(jtc2); for( size_t j = 0; j != genjets->size(); ++j ) { @@ -114,8 +114,8 @@ void GenJetBCEnergyRatio::produce( Event& iEvent, const EventSetup& iEs ) } - iEvent.put(bRatioColl, "bRatioCollection"); - iEvent.put(cRatioColl, "cRatioCollection"); + iEvent.put(std::move(bRatioColl), "bRatioCollection"); + iEvent.put(std::move(cRatioColl), "cRatioCollection"); } diff --git a/PhysicsTools/JetMCAlgos/plugins/HadronAndPartonSelector.cc b/PhysicsTools/JetMCAlgos/plugins/HadronAndPartonSelector.cc index 17a31a7d1c4ea..7297402de332b 100644 --- a/PhysicsTools/JetMCAlgos/plugins/HadronAndPartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/plugins/HadronAndPartonSelector.cc @@ -203,11 +203,11 @@ HadronAndPartonSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSet edm::Handle particles; iEvent.getByToken(particlesToken_, particles); - std::auto_ptr bHadrons ( new reco::GenParticleRefVector ); - std::auto_ptr cHadrons ( new reco::GenParticleRefVector ); - std::auto_ptr partons ( new reco::GenParticleRefVector ); - std::auto_ptr physicsPartons ( new reco::GenParticleRefVector ); - std::auto_ptr leptons ( new reco::GenParticleRefVector ); + auto bHadrons = std::make_unique(); + auto cHadrons = std::make_unique(); + auto partons = std::make_unique(); + auto physicsPartons = std::make_unique(); + auto leptons = std::make_unique(); // loop over particles and select b and c hadrons and leptons for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) @@ -260,11 +260,11 @@ HadronAndPartonSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSet } } - iEvent.put( bHadrons, "bHadrons" ); - iEvent.put( cHadrons, "cHadrons" ); - iEvent.put( partons, "algorithmicPartons" ); - iEvent.put( physicsPartons, "physicsPartons" ); - iEvent.put( leptons, "leptons" ); + iEvent.put(std::move(bHadrons), "bHadrons" ); + iEvent.put(std::move(cHadrons), "cHadrons" ); + iEvent.put(std::move(partons), "algorithmicPartons" ); + iEvent.put(std::move(physicsPartons), "physicsPartons" ); + iEvent.put(std::move(leptons), "leptons" ); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/PhysicsTools/JetMCAlgos/plugins/JetFlavourClustering.cc b/PhysicsTools/JetMCAlgos/plugins/JetFlavourClustering.cc index 0f67773ef0865..4c29427798630 100644 --- a/PhysicsTools/JetMCAlgos/plugins/JetFlavourClustering.cc +++ b/PhysicsTools/JetMCAlgos/plugins/JetFlavourClustering.cc @@ -287,10 +287,10 @@ JetFlavourClustering::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) if( useLeptons_ ) iEvent.getByToken(leptonsToken_, leptons); - std::auto_ptr jetFlavourInfos( new reco::JetFlavourInfoMatchingCollection(reco::JetRefBaseProd(jets)) ); - std::auto_ptr subjetFlavourInfos; + auto jetFlavourInfos = std::make_unique(reco::JetRefBaseProd(jets)); + std::unique_ptr subjetFlavourInfos; if( useSubjets_ ) - subjetFlavourInfos = std::auto_ptr( new reco::JetFlavourInfoMatchingCollection(reco::JetRefBaseProd(subjets)) ); + subjetFlavourInfos = std::make_unique(reco::JetRefBaseProd(subjets)); // vector of constituents for reclustering jets and "ghosts" std::vector fjInputs; @@ -474,10 +474,10 @@ JetFlavourClustering::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } // put jet flavour infos in the event - iEvent.put( jetFlavourInfos ); + iEvent.put(std::move(jetFlavourInfos)); // put subjet flavour infos in the event if( useSubjets_ ) - iEvent.put( subjetFlavourInfos, "SubJets" ); + iEvent.put(std::move(subjetFlavourInfos), "SubJets" ); } // ------------ method that inserts "ghost" particles in the vector of jet constituents ------------ diff --git a/PhysicsTools/JetMCAlgos/plugins/JetFlavourIdentifier.cc b/PhysicsTools/JetMCAlgos/plugins/JetFlavourIdentifier.cc index 225058fabd4fa..900b8fc725d14 100644 --- a/PhysicsTools/JetMCAlgos/plugins/JetFlavourIdentifier.cc +++ b/PhysicsTools/JetMCAlgos/plugins/JetFlavourIdentifier.cc @@ -152,7 +152,7 @@ void JetFlavourIdentifier::produce( Event& iEvent, const EventSetup& iEs ) } else { jfmc = new JetFlavourMatchingCollection(); } - auto_ptr jetFlavMatching(jfmc); + std::unique_ptr jetFlavMatching(jfmc); // Loop over the matched partons and see which match. for ( JetMatchedPartonsCollection::const_iterator j = theTagByRef->begin(); @@ -278,7 +278,7 @@ void JetFlavourIdentifier::produce( Event& iEvent, const EventSetup& iEs ) // Put the object into the event. - iEvent.put( jetFlavMatching ); + iEvent.put(std::move(jetFlavMatching)); } diff --git a/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc b/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc index 0d6f7a30eac5c..9772b37574912 100644 --- a/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc +++ b/PhysicsTools/JetMCAlgos/plugins/JetPartonMatcher.cc @@ -164,7 +164,7 @@ void JetPartonMatcher::produce( Event& iEvent, const EventSetup& iEs ) aParton.phi() << endl; } - auto_ptr jetMatchedPartons( new JetMatchedPartonsCollection(reco::JetRefBaseProd(jets_h))); + auto jetMatchedPartons = std::make_unique(reco::JetRefBaseProd(jets_h)); for (size_t j = 0; j < jets_h->size(); j++) { @@ -186,7 +186,7 @@ void JetPartonMatcher::produce( Event& iEvent, const EventSetup& iEs ) (*jetMatchedPartons)[jets_h->refAt(j)]=MatchedPartons(pHV,pN2,pN3,pPH,pAL); } - iEvent.put( jetMatchedPartons ); + iEvent.put(std::move(jetMatchedPartons)); } diff --git a/PhysicsTools/JetMCAlgos/plugins/PartonSelector.cc b/PhysicsTools/JetMCAlgos/plugins/PartonSelector.cc index 88f8b8949928f..9cb4c927da428 100644 --- a/PhysicsTools/JetMCAlgos/plugins/PartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/plugins/PartonSelector.cc @@ -89,7 +89,7 @@ void PartonSelector::produce( Event& iEvent, const EventSetup& iEs ) edm::LogVerbatim("PartonSelector") << "=== GenParticle size:" << particles->size(); int nPart=0; - auto_ptr thePartons ( new GenParticleRefVector); + auto thePartons = std::make_unique(); for (size_t m = 0; m < particles->size(); m++) { @@ -152,7 +152,7 @@ void PartonSelector::produce( Event& iEvent, const EventSetup& iEs ) } edm::LogVerbatim("PartonSelector") << "=== GenParticle selected:" << nPart; - iEvent.put( thePartons ); + iEvent.put(std::move(thePartons) ); } diff --git a/PhysicsTools/JetMCAlgos/plugins/TauGenJetProducer.cc b/PhysicsTools/JetMCAlgos/plugins/TauGenJetProducer.cc index 3784134ba8dc1..44270c6425bf0 100644 --- a/PhysicsTools/JetMCAlgos/plugins/TauGenJetProducer.cc +++ b/PhysicsTools/JetMCAlgos/plugins/TauGenJetProducer.cc @@ -44,8 +44,7 @@ void TauGenJetProducer::produce(edm::StreamID, Event& iEvent, throw cms::Exception( "MissingProduct", err.str()); } - std::auto_ptr - pOutVisTaus(new GenJetCollection()); + auto pOutVisTaus = std::make_unique(); using namespace GenParticlesHelper; @@ -109,7 +108,7 @@ void TauGenJetProducer::produce(edm::StreamID, Event& iEvent, pOutVisTaus->push_back( jet ); } - iEvent.put( pOutVisTaus ); + iEvent.put(std::move(pOutVisTaus) ); } diff --git a/PhysicsTools/JetMCAlgos/src/BasePartonSelector.cc b/PhysicsTools/JetMCAlgos/src/BasePartonSelector.cc index d2c6c26fd87c4..db8317b6a3eae 100644 --- a/PhysicsTools/JetMCAlgos/src/BasePartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/src/BasePartonSelector.cc @@ -10,6 +10,6 @@ BasePartonSelector::~BasePartonSelector() void BasePartonSelector::run(const edm::Handle & particles, - std::auto_ptr & partons) + std::unique_ptr & partons) { } diff --git a/PhysicsTools/JetMCAlgos/src/Herwig6PartonSelector.cc b/PhysicsTools/JetMCAlgos/src/Herwig6PartonSelector.cc index d4217495774ba..e33eb1c653110 100644 --- a/PhysicsTools/JetMCAlgos/src/Herwig6PartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/src/Herwig6PartonSelector.cc @@ -18,7 +18,7 @@ Herwig6PartonSelector::~Herwig6PartonSelector() void Herwig6PartonSelector::run(const edm::Handle & particles, - std::auto_ptr & partons) + std::unique_ptr & partons) { // loop over particles and select partons for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) diff --git a/PhysicsTools/JetMCAlgos/src/HerwigppPartonSelector.cc b/PhysicsTools/JetMCAlgos/src/HerwigppPartonSelector.cc index d190c809b42e4..f542b8b213ed8 100644 --- a/PhysicsTools/JetMCAlgos/src/HerwigppPartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/src/HerwigppPartonSelector.cc @@ -19,7 +19,7 @@ HerwigppPartonSelector::~HerwigppPartonSelector() void HerwigppPartonSelector::run(const edm::Handle & particles, - std::auto_ptr & partons) + std::unique_ptr & partons) { // loop over particles and select partons for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) diff --git a/PhysicsTools/JetMCAlgos/src/Pythia6PartonSelector.cc b/PhysicsTools/JetMCAlgos/src/Pythia6PartonSelector.cc index 2be73ed5eeb65..b9f5e1c0a50dd 100644 --- a/PhysicsTools/JetMCAlgos/src/Pythia6PartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/src/Pythia6PartonSelector.cc @@ -18,7 +18,7 @@ Pythia6PartonSelector::~Pythia6PartonSelector() void Pythia6PartonSelector::run(const edm::Handle & particles, - std::auto_ptr & partons) + std::unique_ptr & partons) { // loop over particles and select partons for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) diff --git a/PhysicsTools/JetMCAlgos/src/Pythia8PartonSelector.cc b/PhysicsTools/JetMCAlgos/src/Pythia8PartonSelector.cc index 2b6025e100322..29a43a0a080df 100644 --- a/PhysicsTools/JetMCAlgos/src/Pythia8PartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/src/Pythia8PartonSelector.cc @@ -19,7 +19,7 @@ Pythia8PartonSelector::~Pythia8PartonSelector() void Pythia8PartonSelector::run(const edm::Handle & particles, - std::auto_ptr & partons) + std::unique_ptr & partons) { // loop over particles and select partons for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) diff --git a/PhysicsTools/JetMCAlgos/src/SherpaPartonSelector.cc b/PhysicsTools/JetMCAlgos/src/SherpaPartonSelector.cc index 5845ec5e6e784..c6cfb69cbcc9a 100644 --- a/PhysicsTools/JetMCAlgos/src/SherpaPartonSelector.cc +++ b/PhysicsTools/JetMCAlgos/src/SherpaPartonSelector.cc @@ -17,7 +17,7 @@ SherpaPartonSelector::~SherpaPartonSelector() void SherpaPartonSelector::run(const edm::Handle & particles, - std::auto_ptr & partons) + std::unique_ptr & partons) { // loop over particles and select partons for(reco::GenParticleCollection::const_iterator it = particles->begin(); it != particles->end(); ++it) diff --git a/PhysicsTools/PatAlgos/plugins/CandidateSummaryTable.cc b/PhysicsTools/PatAlgos/plugins/CandidateSummaryTable.cc index eefbcc71b818d..bc21baf02d240 100644 --- a/PhysicsTools/PatAlgos/plugins/CandidateSummaryTable.cc +++ b/PhysicsTools/PatAlgos/plugins/CandidateSummaryTable.cc @@ -79,7 +79,7 @@ namespace pat { ~CandidateSummaryTable(); static std::unique_ptr initializeGlobalCache(edm::ParameterSet const& conf) { - return std::unique_ptr(new pathelpers::RecordCache(conf)); + return std::make_unique(conf); } virtual void analyze(const edm::Event & iEvent, const edm::EventSetup& iSetup) override; diff --git a/PhysicsTools/PatAlgos/plugins/DuplicatedElectronCleaner.cc b/PhysicsTools/PatAlgos/plugins/DuplicatedElectronCleaner.cc index e2b428699e8a4..182c5e8847e2c 100644 --- a/PhysicsTools/PatAlgos/plugins/DuplicatedElectronCleaner.cc +++ b/PhysicsTools/PatAlgos/plugins/DuplicatedElectronCleaner.cc @@ -66,10 +66,10 @@ pat::DuplicatedElectronCleaner::produce(edm::StreamID, edm::Event & iEvent, cons iEvent.getByToken(electronSrcToken_, electrons); try_ += electrons->size(); - //std::auto_ptr > result(new RefVector()); - std::auto_ptr > result(new RefToBaseVector()); - //std::auto_ptr > result(new PtrVector()); - std::auto_ptr< std::vector > duplicates = duplicateRemover_.duplicatesToRemove(*electrons); + //auto result = std::make_unique>(); + auto result = std::make_unique>(); + //auto result = std::make_unique>(); + std::unique_ptr< std::vector > duplicates = duplicateRemover_.duplicatesToRemove(*electrons); std::vector::const_iterator itdup = duplicates->begin(), enddup = duplicates->end(); for (size_t i = 0, n = electrons->size(); i < n; ++i) { @@ -80,7 +80,7 @@ pat::DuplicatedElectronCleaner::produce(edm::StreamID, edm::Event & iEvent, cons //result->push_back(electrons->ptrAt(i)); } pass_ += result->size(); - iEvent.put(result); + iEvent.put(std::move(result)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/GenMETExtractor.cc b/PhysicsTools/PatAlgos/plugins/GenMETExtractor.cc index 77fb447ab8e72..6eb13d9e0174f 100644 --- a/PhysicsTools/PatAlgos/plugins/GenMETExtractor.cc +++ b/PhysicsTools/PatAlgos/plugins/GenMETExtractor.cc @@ -34,8 +34,8 @@ void GenMETExtractor::produce(edm::StreamID streamID, edm::Event & iEvent, std::vector *genMetCol = new std::vector(); genMetCol->push_back( (*genMet) ); - std::auto_ptr > genMETs(genMetCol); - iEvent.put(genMETs); + std::unique_ptr > genMETs(genMetCol); + iEvent.put(std::move(genMETs)); } diff --git a/PhysicsTools/PatAlgos/plugins/JetCorrFactorsProducer.cc b/PhysicsTools/PatAlgos/plugins/JetCorrFactorsProducer.cc index 34db11f63cf47..40a5f2839bef2 100644 --- a/PhysicsTools/PatAlgos/plugins/JetCorrFactorsProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/JetCorrFactorsProducer.cc @@ -284,13 +284,13 @@ JetCorrFactorsProducer::produce(edm::Event& event, const edm::EventSetup& setup) jcfs.push_back(corrFactors); } // build the value map - std::auto_ptr jetCorrsMap(new JetCorrFactorsMap()); + auto jetCorrsMap = std::make_unique(); JetCorrFactorsMap::Filler filler(*jetCorrsMap); // jets and jetCorrs have their indices aligned by construction filler.insert(jets, jcfs.begin(), jcfs.end()); filler.fill(); // do the actual filling // put our produced stuff in the event - event.put(jetCorrsMap); + event.put(std::move(jetCorrsMap)); } void diff --git a/PhysicsTools/PatAlgos/plugins/ModifiedObjectProducer.h b/PhysicsTools/PatAlgos/plugins/ModifiedObjectProducer.h index 2e1eb3fdde352..4316b212907c6 100644 --- a/PhysicsTools/PatAlgos/plugins/ModifiedObjectProducer.h +++ b/PhysicsTools/PatAlgos/plugins/ModifiedObjectProducer.h @@ -39,7 +39,7 @@ namespace pat { virtual void produce(edm::Event& evt,const edm::EventSetup& evs) override final { edm::Handle > input; - std::auto_ptr output(new Collection); + auto output = std::make_unique(); evt.getByToken(src_,input); output->reserve(input->size()); @@ -52,7 +52,7 @@ namespace pat { modifier_->modify(obj); } - evt.put(output); + evt.put(std::move(output)); } private: diff --git a/PhysicsTools/PatAlgos/plugins/PATCleaner.h b/PhysicsTools/PatAlgos/plugins/PATCleaner.h index b5a42ac48741b..8718e57866c7e 100644 --- a/PhysicsTools/PatAlgos/plugins/PATCleaner.h +++ b/PhysicsTools/PatAlgos/plugins/PATCleaner.h @@ -101,7 +101,7 @@ pat::PATCleaner::produce(edm::Event & iEvent, const edm::EventSetup iEvent.getByToken(srcToken_, candidates); // Prepare a collection for the output - std::auto_ptr< std::vector > output(new std::vector()); + auto output = std::make_unique>(); // initialize the overlap tests for (auto& itov : overlapTests_) { @@ -134,7 +134,7 @@ pat::PATCleaner::produce(edm::Event & iEvent, const edm::EventSetup if (!finalCut_(obj)) output->pop_back(); } - iEvent.put(output); + iEvent.put(std::move(output)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATConversionProducer.cc b/PhysicsTools/PatAlgos/plugins/PATConversionProducer.cc index 5a92f8f630967..c727674a17d6a 100755 --- a/PhysicsTools/PatAlgos/plugins/PATConversionProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATConversionProducer.cc @@ -107,8 +107,8 @@ void PATConversionProducer::produce(edm::StreamID, edm::Event & iEvent, const ed } // add the electrons to the event output - std::auto_ptr > ptr(patConversions); - iEvent.put(ptr); + std::unique_ptr > ptr(patConversions); + iEvent.put(std::move(ptr)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc index 1b14ae9724f0d..5c1a7953a9acf 100755 --- a/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronProducer.cc @@ -688,8 +688,8 @@ void PATElectronProducer::produce(edm::Event & iEvent, const edm::EventSetup & i std::sort(patElectrons->begin(), patElectrons->end(), pTComparator_); // add the electrons to the event output - std::auto_ptr > ptr(patElectrons); - iEvent.put(ptr); + std::unique_ptr > ptr(patElectrons); + iEvent.put(std::move(ptr)); // clean up if (isolator_.enabled()) isolator_.endEvent(); diff --git a/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc index ff2d52516d782..d4cf06e1da813 100644 --- a/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATElectronSlimmer.cc @@ -108,7 +108,7 @@ pat::PATElectronSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iS } noZS::EcalClusterLazyTools lazyToolsNoZS(iEvent, iSetup, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_); - auto_ptr > out(new vector()); + auto out = std::make_unique>(); out->reserve(src->size()); if( modifyElectron_ ) { electronModifier_->setEvent(iEvent); } @@ -158,7 +158,7 @@ pat::PATElectronSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iS } } - iEvent.put(out); + iEvent.put(std::move(out)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/PATGenCandsFromSimTracksProducer.cc b/PhysicsTools/PatAlgos/plugins/PATGenCandsFromSimTracksProducer.cc index 8116723fcc34c..1b4e948810b81 100644 --- a/PhysicsTools/PatAlgos/plugins/PATGenCandsFromSimTracksProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATGenCandsFromSimTracksProducer.cc @@ -246,7 +246,7 @@ void PATGenCandsFromSimTracksProducer::produce(Event& event, event.getByToken(simTracksToken_, simtracks); // Need to check that SimTrackContainer is sorted; otherwise, copy and sort :-( - std::auto_ptr simtracksTmp; + std::unique_ptr simtracksTmp; const SimTrackContainer * simtracksSorted = &* simtracks; if (makeMotherLink_ || writeAncestors_) { if (!__gnu_cxx::is_sorted(simtracks->begin(), simtracks->end(), LessById())) { @@ -273,7 +273,7 @@ void PATGenCandsFromSimTracksProducer::produce(Event& event, // make the output collection - auto_ptr cands(new GenParticleCollection); + auto cands = std::make_unique(); edm::RefProd refprod = event.getRefBeforePut(); GlobalContext globals(*simtracksSorted, *simvertices, gens, genBarcodes, barcodesAreSorted, *cands, refprod); @@ -312,7 +312,7 @@ void PATGenCandsFromSimTracksProducer::produce(Event& event, } // Write to the Event, and get back a handle (which can be useful for debugging) - edm::OrphanHandle orphans = event.put(cands); + edm::OrphanHandle orphans = event.put(std::move(cands)); #ifdef DEBUG_PATGenCandsFromSimTracksProducer std::cout << "Produced a list of " << orphans->size() << " genParticles." << std::endl; diff --git a/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc index 16954e81642a8..5ea422e74ee1a 100644 --- a/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc @@ -61,7 +61,7 @@ pat::PATGenJetSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSet Handle > src; iEvent.getByToken(src_, src); - auto_ptr > out(new vector()); + auto out = std::make_unique>(); out->reserve(src->size()); Handle > > gp2pgp; @@ -102,7 +102,7 @@ pat::PATGenJetSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSet } } - iEvent.put(out); + iEvent.put(std::move(out)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc b/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc index dddcee520df3f..8c037f11d8600 100755 --- a/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATGenericParticleProducer.cc @@ -187,8 +187,8 @@ void PATGenericParticleProducer::produce(edm::Event & iEvent, const edm::EventSe std::sort(PATGenericParticles->begin(), PATGenericParticles->end(), eTComparator_); // put genEvt object in Event - std::auto_ptr > myGenericParticles(PATGenericParticles); - iEvent.put(myGenericParticles); + std::unique_ptr > myGenericParticles(PATGenericParticles); + iEvent.put(std::move(myGenericParticles)); if (isolator_.enabled()) isolator_.endEvent(); } diff --git a/PhysicsTools/PatAlgos/plugins/PATHemisphereProducer.cc b/PhysicsTools/PatAlgos/plugins/PATHemisphereProducer.cc index 4b61ebd004df0..d5c8efbefa423 100644 --- a/PhysicsTools/PatAlgos/plugins/PATHemisphereProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATHemisphereProducer.cc @@ -159,7 +159,7 @@ PATHemisphereProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::Eve } // create product - std::auto_ptr< std::vector > hemispheres(new std::vector);; + auto hemispheres = std::make_unique>(); hemispheres->reserve(2); //calls HemiAlgorithm for seed method 3 (transv. inv. Mass) and association method 3 (Lund algo) @@ -188,7 +188,7 @@ PATHemisphereProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::Eve } - iEvent.put(hemispheres); + iEvent.put(std::move(hemispheres)); } //define this as a plug-in diff --git a/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc b/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc index 2b8fa66a89738..1fda22111d495 100755 --- a/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATJetProducer.cc @@ -208,12 +208,12 @@ void PATJetProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup if ( addJetID_ ) iEvent.getByToken( jetIDMapToken_, hJetIDMap ); // loop over jets - std::auto_ptr< std::vector > patJets ( new std::vector() ); + auto patJets = std::make_unique>(); - std::auto_ptr genJetsOut ( new reco::GenJetCollection() ); - std::auto_ptr > caloTowersOut( new std::vector () ); - std::auto_ptr pfCandidatesOut( new reco::PFCandidateCollection() ); - std::auto_ptr > tagInfosOut ( new edm::OwnVector() ); + auto genJetsOut = std::make_unique(); + auto caloTowersOut = std::make_unique>(); + auto pfCandidatesOut = std::make_unique(); + auto tagInfosOut = std::make_unique>(); edm::RefProd h_genJetsOut = iEvent.getRefBeforePut( "genJets" ); @@ -408,12 +408,12 @@ void PATJetProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup std::sort(patJets->begin(), patJets->end(), pTComparator_); // put genEvt in Event - iEvent.put(patJets); + iEvent.put(std::move(patJets)); - iEvent.put( genJetsOut, "genJets" ); - iEvent.put( caloTowersOut, "caloTowers" ); - iEvent.put( pfCandidatesOut, "pfCandidates" ); - iEvent.put( tagInfosOut, "tagInfos" ); + iEvent.put(std::move(genJetsOut), "genJets" ); + iEvent.put(std::move(caloTowersOut), "caloTowers" ); + iEvent.put(std::move(pfCandidatesOut), "pfCandidates" ); + iEvent.put(std::move(tagInfosOut), "tagInfos" ); } diff --git a/PhysicsTools/PatAlgos/plugins/PATJetSelector.h b/PhysicsTools/PatAlgos/plugins/PATJetSelector.h index b79d6897a6eac..faeb14bef60b6 100644 --- a/PhysicsTools/PatAlgos/plugins/PATJetSelector.h +++ b/PhysicsTools/PatAlgos/plugins/PATJetSelector.h @@ -45,12 +45,12 @@ namespace pat { virtual bool filter(edm::Event& iEvent, const edm::EventSetup& iSetup) override { - std::auto_ptr< std::vector > patJets ( new std::vector() ); + auto patJets = std::make_unique>(); - std::auto_ptr genJetsOut ( new reco::GenJetCollection() ); - std::auto_ptr > caloTowersOut( new std::vector () ); - std::auto_ptr pfCandidatesOut( new reco::PFCandidateCollection() ); - std::auto_ptr > tagInfosOut ( new edm::OwnVector() ); + auto genJetsOut = std::make_unique(); + auto caloTowersOut = std::make_unique >(); + auto pfCandidatesOut = std::make_unique(); + auto tagInfosOut = std::make_unique>(); edm::RefProd h_genJetsOut = iEvent.getRefBeforePut( "genJets" ); @@ -103,10 +103,10 @@ namespace pat { // Output the secondary collections. - edm::OrphanHandle oh_genJetsOut = iEvent.put( genJetsOut, "genJets" ); - edm::OrphanHandle > oh_caloTowersOut = iEvent.put( caloTowersOut, "caloTowers" ); - edm::OrphanHandle oh_pfCandidatesOut = iEvent.put( pfCandidatesOut, "pfCandidates" ); - edm::OrphanHandle > oh_tagInfosOut = iEvent.put( tagInfosOut, "tagInfos" ); + edm::OrphanHandle oh_genJetsOut = iEvent.put(std::move(genJetsOut), "genJets" ); + edm::OrphanHandle > oh_caloTowersOut = iEvent.put(std::move(caloTowersOut), "caloTowers" ); + edm::OrphanHandle oh_pfCandidatesOut = iEvent.put(std::move(pfCandidatesOut), "pfCandidates" ); + edm::OrphanHandle > oh_tagInfosOut = iEvent.put(std::move(tagInfosOut), "tagInfos" ); @@ -182,7 +182,7 @@ namespace pat { // put genEvt in Event bool pass = patJets->size() > 0; - iEvent.put(patJets); + iEvent.put(std::move(patJets)); if ( filter_ ) return pass; diff --git a/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc index 544fd6b37afe0..d8f505dec2f92 100644 --- a/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATJetSlimmer.cc @@ -79,7 +79,7 @@ pat::PATJetSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) Handle > pf2pc; iEvent.getByToken(pf2pc_,pf2pc); - auto_ptr > out(new vector()); + auto out = std::make_unique>(); out->reserve(src->size()); if( modifyJet_ ) { jetModifier_->setEvent(iEvent); } @@ -136,7 +136,7 @@ pat::PATJetSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) // } } - iEvent.put(out); + iEvent.put(std::move(out)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/PATJetUpdater.cc b/PhysicsTools/PatAlgos/plugins/PATJetUpdater.cc index 147cb01eb372e..9b513c431d797 100755 --- a/PhysicsTools/PatAlgos/plugins/PATJetUpdater.cc +++ b/PhysicsTools/PatAlgos/plugins/PATJetUpdater.cc @@ -115,9 +115,9 @@ void PATJetUpdater::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) } // loop over jets - std::auto_ptr< std::vector > patJets ( new std::vector() ); + auto patJets = std::make_unique>(); - std::auto_ptr > tagInfosOut ( new edm::OwnVector() ); + auto tagInfosOut = std::make_unique>(); edm::RefProd > h_tagInfosOut = iEvent.getRefBeforePut > ( "tagInfos" ); @@ -209,9 +209,9 @@ void PATJetUpdater::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) std::sort(patJets->begin(), patJets->end(), pTComparator_); // put genEvt in Event - iEvent.put(patJets); + iEvent.put(std::move(patJets)); - iEvent.put( tagInfosOut, "tagInfos" ); + iEvent.put(std::move(tagInfosOut), "tagInfos" ); } diff --git a/PhysicsTools/PatAlgos/plugins/PATLostTracks.cc b/PhysicsTools/PatAlgos/plugins/PATLostTracks.cc index 39e34746d9373..192b910c441ba 100644 --- a/PhysicsTools/PatAlgos/plugins/PATLostTracks.cc +++ b/PhysicsTools/PatAlgos/plugins/PATLostTracks.cc @@ -90,10 +90,10 @@ void pat::PATLostTracks::produce(edm::StreamID, edm::Event& iEvent, const edm::E iEvent.getByToken( PVOrigs_, PVOrigs ); const reco::Vertex & PVOrig = (*PVOrigs)[0]; - std::auto_ptr< std::vector > outPtrP( new std::vector ); + auto outPtrP = std::make_unique>(); std::vector used(tracks->size(),0); - std::auto_ptr< std::vector > outPtrC( new std::vector ); + auto outPtrC = std::make_unique>(); //Mark all tracks used in candidates for(unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) { @@ -136,13 +136,13 @@ void pat::PATLostTracks::produce(edm::StreamID, edm::Event& iEvent, const edm::E j++; } } - iEvent.put(outPtrP); - edm::OrphanHandle oh = iEvent.put(outPtrC); - std::auto_ptr > tk2pc(new edm::Association(oh )); + iEvent.put(std::move(outPtrP)); + edm::OrphanHandle oh = iEvent.put(std::move(outPtrC)); + auto tk2pc = std::make_unique>(oh); edm::Association::Filler tk2pcFiller(*tk2pc); tk2pcFiller.insert(tracks, mapping.begin(), mapping.end()); tk2pcFiller.fill() ; - iEvent.put(tk2pc); + iEvent.put(std::move(tk2pc)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc b/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc index 918068f7db3ca..8a6f673f752d5 100755 --- a/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMETProducer.cc @@ -126,8 +126,8 @@ void PATMETProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup // std::sort(patMETs->begin(), patMETs->end(), eTComparator_); // put genEvt object in Event - std::auto_ptr > myMETs(patMETs); - iEvent.put(myMETs); + std::unique_ptr > myMETs(patMETs); + iEvent.put(std::move(myMETs)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATMETSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATMETSlimmer.cc index f24977d2ea3d1..a930cb9452fc7 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMETSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMETSlimmer.cc @@ -144,14 +144,14 @@ pat::PATMETSlimmer::produce(edm::StreamID, edm::Event & iEvent, const edm::Event iEvent.getByToken(src_, src); if (src->size() != 1) throw cms::Exception("CorruptData", "More than one MET in the collection"); - auto_ptr > out(new vector(1, src->front())); + auto out = std::make_unique>(1, src->front()); pat::MET & met = out->back(); for (const OneMETShift &shift : shifts_) { shift.readAndSet(iEvent, met); } - iEvent.put(out); + iEvent.put(std::move(out)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATMHTProducer.cc b/PhysicsTools/PatAlgos/plugins/PATMHTProducer.cc index 4e9be09ae0596..388d61166989e 100755 --- a/PhysicsTools/PatAlgos/plugins/PATMHTProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMHTProducer.cc @@ -85,7 +85,7 @@ pat::PATMHTProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup double met_set=0; - std::auto_ptr themetsigcoll (new pat::MHTCollection); + auto themetsigcoll = std::make_unique(); if(physobjvector_.size() >= 1) { // Only when the vector is not empty @@ -115,7 +115,7 @@ pat::PATMHTProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup } // If the vector is empty, just put empty product. - iEvent.put( themetsigcoll); + iEvent.put(std::move(themetsigcoll)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc index cf37f6e036345..f6c2ef4522cf0 100755 --- a/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMuonProducer.cc @@ -360,8 +360,8 @@ void PATMuonProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetu std::sort(patMuons->begin(), patMuons->end(), pTComparator_); // put genEvt object in Event - std::auto_ptr > ptr(patMuons); - iEvent.put(ptr); + std::unique_ptr > ptr(patMuons); + iEvent.put(std::move(ptr)); if (isolator_.enabled()) isolator_.endEvent(); } diff --git a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc index af940b6d81571..36d170829d1d2 100644 --- a/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATMuonSlimmer.cc @@ -74,7 +74,7 @@ pat::PATMuonSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup Handle src; iEvent.getByToken(src_, src); - auto_ptr > out(new vector()); + auto out = std::make_unique>(); out->reserve(src->size()); if( modifyMuon_ ) { muonModifier_->setEvent(iEvent); } @@ -103,7 +103,7 @@ pat::PATMuonSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup } } - iEvent.put(out); + iEvent.put(std::move(out)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc index 3bcbc64e9d201..bb81e835d3603 100755 --- a/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPFParticleProducer.cc @@ -128,8 +128,8 @@ void PATPFParticleProducer::produce(edm::Event & iEvent, std::sort(patPFParticles->begin(), patPFParticles->end(), pTComparator_); // put genEvt object in Event - std::auto_ptr > ptr(patPFParticles); - iEvent.put(ptr); + std::unique_ptr > ptr(patPFParticles); + iEvent.put(std::move(ptr)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc index 36a09d4762583..edfde97077ddf 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPackedCandidateProducer.cc @@ -178,7 +178,7 @@ void pat::PATPackedCandidateProducer::produce(edm::StreamID, edm::Event& iEvent, edm::Handle TKOrigs; iEvent.getByToken( TKOrigs_, TKOrigs ); - std::auto_ptr< std::vector > outPtrP( new std::vector ); + auto outPtrP = std::make_unique>(); std::vector mapping(cands->size()); std::vector mappingReverse(cands->size()); std::vector mappingTk(TKOrigs->size(), -1); @@ -296,7 +296,7 @@ void pat::PATPackedCandidateProducer::produce(edm::StreamID, edm::Event& iEvent, } - std::auto_ptr< std::vector > outPtrPSorted( new std::vector ); + auto outPtrPSorted = std::make_unique>(); std::vector order=sort_indexes(*outPtrP); std::vector reverseOrder(order.size()); for(size_t i=0,nc=cands->size();i oh = iEvent.put( outPtrPSorted ); + edm::OrphanHandle oh = iEvent.put(std::move(outPtrPSorted)); // now build the two maps - std::auto_ptr > pf2pc(new edm::Association(oh )); - std::auto_ptr > pc2pf(new edm::Association(cands)); + auto pf2pc = std::make_unique>(oh); + auto pc2pf = std::make_unique>(cands); edm::Association::Filler pf2pcFiller(*pf2pc); edm::Association::Filler pc2pfFiller(*pc2pf); pf2pcFiller.insert(cands, mappingReverse.begin(), mappingReverse.end()); @@ -330,8 +330,8 @@ void pat::PATPackedCandidateProducer::produce(edm::StreamID, edm::Event& iEvent, pf2pcFiller.fill(); pc2pfFiller.fill(); - iEvent.put(pf2pc); - iEvent.put(pc2pf); + iEvent.put(std::move(pf2pc)); + iEvent.put(std::move(pc2pf)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATPackedGenParticleProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPackedGenParticleProducer.cc index 2200ef36e0b5b..2191f3b7b5826 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPackedGenParticleProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPackedGenParticleProducer.cc @@ -104,7 +104,7 @@ void pat::PATPackedGenParticleProducer::produce(edm::StreamID, edm::Event& iEven reverseMap.insert(std::pair,edm::Ref>(newRef,originalRef)); } - std::auto_ptr< std::vector > outPtrP( new std::vector ); + auto outPtrP = std::make_unique>(); unsigned int packed=0; for(unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) { @@ -128,13 +128,13 @@ void pat::PATPackedGenParticleProducer::produce(edm::StreamID, edm::Event& iEven } - edm::OrphanHandle > oh= iEvent.put( outPtrP ); + edm::OrphanHandle > oh= iEvent.put(std::move(outPtrP)); - std::auto_ptr > > gp2pgp(new edm::Association< std::vector > (oh )); + auto gp2pgp = std::make_unique>>(oh); edm::Association< std::vector >::Filler gp2pgpFiller(*gp2pgp); gp2pgpFiller.insert(genOrigs, mapping.begin(), mapping.end()); gp2pgpFiller.fill(); - iEvent.put(gp2pgp); + iEvent.put(std::move(gp2pgp)); } diff --git a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc index 0aa97930e6cf3..8f47bf3785e33 100755 --- a/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPhotonProducer.cc @@ -373,8 +373,8 @@ void PATPhotonProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSe std::sort(PATPhotons->begin(), PATPhotons->end(), eTComparator_); // put genEvt object in Event - std::auto_ptr > myPhotons(PATPhotons); - iEvent.put(myPhotons); + std::unique_ptr > myPhotons(PATPhotons); + iEvent.put(std::move(myPhotons)); if (isolator_.enabled()) isolator_.endEvent(); } diff --git a/PhysicsTools/PatAlgos/plugins/PATPhotonSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATPhotonSlimmer.cc index 99b1410634f9d..9fefae787dad3 100644 --- a/PhysicsTools/PatAlgos/plugins/PATPhotonSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATPhotonSlimmer.cc @@ -108,7 +108,7 @@ pat::PATPhotonSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSet } noZS::EcalClusterLazyTools lazyToolsNoZS(iEvent, iSetup, reducedBarrelRecHitCollectionToken_, reducedEndcapRecHitCollectionToken_); - auto_ptr > out(new vector()); + auto out = std::make_unique>(); out->reserve(src->size()); if( modifyPhoton_ ) { photonModifier_->setEvent(iEvent); } @@ -172,7 +172,7 @@ pat::PATPhotonSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSet } - iEvent.put(out); + iEvent.put(std::move(out)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/PATSecondaryVertexSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATSecondaryVertexSlimmer.cc index 0f248add1c6d9..dc5ff48eb4eb7 100644 --- a/PhysicsTools/PatAlgos/plugins/PATSecondaryVertexSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATSecondaryVertexSlimmer.cc @@ -42,7 +42,7 @@ pat::PATSecondaryVertexSlimmer::~PATSecondaryVertexSlimmer() {} void pat::PATSecondaryVertexSlimmer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - std::auto_ptr outPtr(new reco::VertexCompositePtrCandidateCollection); + auto outPtr = std::make_unique(); edm::Handle candVertices; iEvent.getByToken(src_, candVertices); @@ -100,7 +100,7 @@ void pat::PATSecondaryVertexSlimmer::produce(edm::StreamID, edm::Event& iEvent, } } - iEvent.put(outPtr); + iEvent.put(std::move(outPtr)); } using pat::PATSecondaryVertexSlimmer; diff --git a/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.cc b/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.cc index 802842585370d..ca55dd178d8ee 100644 --- a/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.cc +++ b/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.cc @@ -97,7 +97,7 @@ PATSingleVertexSelector::filter(edm::Event & iEvent, const edm::EventSetup & iSe } bool passes = false; - auto_ptr > result; + std::unique_ptr > result; // Run main mode + possible fallback modes for (std::vector::const_iterator itm = modes_.begin(), endm = modes_.end(); itm != endm; ++itm) { result = filter_(*itm, iEvent, iSetup); @@ -107,18 +107,18 @@ PATSingleVertexSelector::filter(edm::Event & iEvent, const edm::EventSetup & iSe break; } } - iEvent.put(result); + iEvent.put(std::move(result)); // Check if we want to apply the EDFilter if (doFilterEvents_) return passes; else return true; } -std::auto_ptr > +std::unique_ptr > PATSingleVertexSelector::filter_(Mode mode, const edm::Event &iEvent, const edm::EventSetup & iSetup) { using namespace edm; using namespace std; - std::auto_ptr > result(new std::vector()); + auto result = std::make_unique>(); switch(mode) { case First: { if (selVtxs_.empty()) return result; diff --git a/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.h b/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.h index b798bf4573eb3..385ef9408c27c 100644 --- a/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.h +++ b/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.h @@ -41,7 +41,7 @@ namespace pat { Mode parseMode(const std::string &name) const; - std::auto_ptr > + std::unique_ptr > filter_(Mode mode, const edm::Event & iEvent, const edm::EventSetup & iSetup); bool hasMode_(Mode mode) const ; // configurables diff --git a/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc index 538cd86b5dd5a..168be338ac625 100755 --- a/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTauProducer.cc @@ -160,8 +160,8 @@ void PATTauProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup iEvent.getByToken(baseTauToken_, anyTaus); } catch (const edm::Exception &e) { edm::LogWarning("DataSource") << "WARNING! No Tau collection found. This missing input will not block the job. Instead, an empty tau collection is being be produced."; - std::auto_ptr > patTaus(new std::vector()); - iEvent.put(patTaus); + auto patTaus = std::make_unique>(); + iEvent.put(std::move(patTaus)); return; } @@ -196,7 +196,7 @@ void PATTauProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup } } - std::auto_ptr > patTaus(new std::vector()); + auto patTaus = std::make_unique>(); bool first=true; // this is introduced to issue warnings only for the first tau-jet for (size_t idx = 0, ntaus = anyTaus->size(); idx < ntaus; ++idx) { @@ -421,7 +421,7 @@ void PATTauProducer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup std::sort(patTaus->begin(), patTaus->end(), pTTauComparator_); // put genEvt object in Event - iEvent.put(patTaus); + iEvent.put(std::move(patTaus)); // clean up if (isolator_.enabled()) isolator_.endEvent(); diff --git a/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc index 1894e552a8365..2d75398d16517 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTauSlimmer.cc @@ -74,7 +74,7 @@ pat::PATTauSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) Handle> pf2pc; if (linkToPackedPF_) iEvent.getByToken(pf2pc_, pf2pc); - auto_ptr > out(new vector()); + auto out = std::make_unique>(); out->reserve(src->size()); if( modifyTau_ ) { tauModifier_->setEvent(iEvent); } @@ -136,7 +136,7 @@ pat::PATTauSlimmer::produce(edm::Event & iEvent, const edm::EventSetup & iSetup) } - iEvent.put(out); + iEvent.put(std::move(out)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/PATTriggerEventProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTriggerEventProducer.cc index 72dd6a669d480..bb3f7b79cac02 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTriggerEventProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTriggerEventProducer.cc @@ -212,7 +212,7 @@ void PATTriggerEventProducer::produce( Event& iEvent, const EventSetup& iSetup ) // produce trigger event - std::auto_ptr< TriggerEvent > triggerEvent( new TriggerEvent( handleL1GtTriggerMenu->gtTriggerMenuName(), std::string( hltConfig_.tableName() ), handleTriggerResults->wasrun(), handleTriggerResults->accept(), handleTriggerResults->error(), physDecl ) ); + auto triggerEvent = std::make_unique( handleL1GtTriggerMenu->gtTriggerMenuName(), std::string( hltConfig_.tableName() ), handleTriggerResults->wasrun(), handleTriggerResults->accept(), handleTriggerResults->error(), physDecl ); // set product references to trigger collections if ( handleTriggerAlgorithms.isValid() ) { triggerEvent->setAlgorithms( handleTriggerAlgorithms ); @@ -282,13 +282,13 @@ void PATTriggerEventProducer::produce( Event& iEvent, const EventSetup& iSetup ) indices.push_back( it->second.key() ); ++it; } - std::auto_ptr< TriggerObjectMatch > triggerObjectMatch( new TriggerObjectMatch( handleTriggerObjects ) ); + auto triggerObjectMatch = std::make_unique(handleTriggerObjects); TriggerObjectMatch::Filler matchFiller( *triggerObjectMatch ); if ( handleCands.isValid() ) { matchFiller.insert( handleCands, indices.begin(), indices.end() ); } matchFiller.fill(); - OrphanHandle< TriggerObjectMatch > handleTriggerObjectMatch( iEvent.put( triggerObjectMatch, labelTriggerObjectMatcher ) ); + OrphanHandle< TriggerObjectMatch > handleTriggerObjectMatch( iEvent.put(std::move(triggerObjectMatch), labelTriggerObjectMatcher ) ); // set product reference to trigger match association if ( ! handleTriggerObjectMatch.isValid() ) { LogError( "triggerMatchValid" ) << "pat::TriggerObjectMatch product with InputTag '" << labelTriggerObjectMatcher << "' not in event"; @@ -300,7 +300,7 @@ void PATTriggerEventProducer::produce( Event& iEvent, const EventSetup& iSetup ) } } - iEvent.put( triggerEvent ); + iEvent.put(std::move(triggerEvent) ); } diff --git a/PhysicsTools/PatAlgos/plugins/PATTriggerMatchEmbedder.cc b/PhysicsTools/PatAlgos/plugins/PATTriggerMatchEmbedder.cc index 1b091fd0951c5..50f80dfcfa99f 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTriggerMatchEmbedder.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTriggerMatchEmbedder.cc @@ -83,7 +83,7 @@ PATTriggerMatchEmbedder< PATObjectType >::PATTriggerMatchEmbedder( const edm::Pa template< class PATObjectType > void PATTriggerMatchEmbedder< PATObjectType >::produce( edm::StreamID, edm::Event & iEvent, const edm::EventSetup& iSetup) const { - std::auto_ptr< std::vector< PATObjectType > > output( new std::vector< PATObjectType >() ); + auto output = std::make_unique>(); edm::Handle< edm::View< PATObjectType > > candidates; iEvent.getByToken( srcToken_, candidates ); @@ -113,7 +113,7 @@ void PATTriggerMatchEmbedder< PATObjectType >::produce( edm::StreamID, edm::Even output->push_back( cand ); } - iEvent.put( output ); + iEvent.put(std::move(output) ); } diff --git a/PhysicsTools/PatAlgos/plugins/PATTriggerObjectStandAloneUnpacker.cc b/PhysicsTools/PatAlgos/plugins/PATTriggerObjectStandAloneUnpacker.cc index 17b6f65a2e091..8d25285b66c0e 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTriggerObjectStandAloneUnpacker.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTriggerObjectStandAloneUnpacker.cc @@ -61,7 +61,7 @@ void PATTriggerObjectStandAloneUnpacker::produce( edm::StreamID, edm::Event & iE edm::Handle< edm::TriggerResults > triggerResults; iEvent.getByToken( triggerResultsToken_, triggerResults ); - std::auto_ptr< TriggerObjectStandAloneCollection > patTriggerObjectsStandAloneUnpacked( new TriggerObjectStandAloneCollection ); + auto patTriggerObjectsStandAloneUnpacked = std::make_unique(); for ( size_t iTrigObj = 0; iTrigObj < patTriggerObjectsStandAlone->size(); ++iTrigObj ) { TriggerObjectStandAlone patTriggerObjectStandAloneUnpacked( patTriggerObjectsStandAlone->at( iTrigObj ) ); @@ -70,7 +70,7 @@ void PATTriggerObjectStandAloneUnpacker::produce( edm::StreamID, edm::Event & iE patTriggerObjectsStandAloneUnpacked->push_back( patTriggerObjectStandAloneUnpacked ); } - iEvent.put( patTriggerObjectsStandAloneUnpacked ); + iEvent.put(std::move(patTriggerObjectsStandAloneUnpacked) ); } diff --git a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc index 6abf5c8614e70..95b65901fd101 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc @@ -317,9 +317,9 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) // Terminate, if auto process name determination failed if ( nameProcess_ == "*" ) return; - std::auto_ptr< TriggerObjectCollection > triggerObjects( new TriggerObjectCollection() ); - std::auto_ptr< TriggerObjectStandAloneCollection > triggerObjectsStandAlone( new TriggerObjectStandAloneCollection() ); - std::auto_ptr< PackedTriggerPrescales > packedPrescales, packedPrescalesL1min, packedPrescalesL1max; + auto triggerObjects = std::make_unique(); + auto triggerObjectsStandAlone = std::make_unique(); + std::unique_ptr packedPrescales, packedPrescalesL1min, packedPrescalesL1max; // HLT HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); @@ -402,7 +402,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) std::map< std::string, int > moduleStates; if ( ! onlyStandAlone_ ) { - std::auto_ptr< TriggerPathCollection > triggerPaths( new TriggerPathCollection() ); + auto triggerPaths = std::make_unique(); triggerPaths->reserve( sizePaths ); const std::vector & pathNames = hltConfig.triggerNames(); for ( size_t indexPath = 0; indexPath < sizePaths; ++indexPath ) { @@ -454,7 +454,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } } // Put HLT paths to event - iEvent.put( triggerPaths ); + iEvent.put(std::move(triggerPaths)); } // Store used trigger objects and their types for HLT filters @@ -525,7 +525,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) // Re-iterate HLT filters and finally produce them in order to account for optionally skipped objects if ( ! onlyStandAlone_ ) { - std::auto_ptr< TriggerFilterCollection > triggerFilters( new TriggerFilterCollection() ); + auto triggerFilters = std::make_unique(); triggerFilters->reserve( sizeFilters ); for ( size_t iF = 0; iF < sizeFilters; ++iF ) { const std::string nameFilter( handleTriggerEvent->filterTag( iF ).label() ); @@ -561,7 +561,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) triggerFilters->push_back( triggerFilter ); } // put HLT filters to event - iEvent.put( triggerFilters ); + iEvent.put(std::move(triggerFilters)); } if (packPrescales_) { @@ -589,9 +589,9 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) packedPrescales->addPrescaledTrigger(i, pvdet.second); //assert( hltprescale == pvdet.second ); } - iEvent.put( packedPrescales ); - iEvent.put( packedPrescalesL1max, "l1max" ); - iEvent.put( packedPrescalesL1min, "l1min" ); + iEvent.put(std::move(packedPrescales)); + iEvent.put(std::move(packedPrescalesL1max), "l1max"); + iEvent.put(std::move(packedPrescalesL1min), "l1min"); } } // if ( goodHlt ) @@ -803,12 +803,12 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } // Put trigger objects to event - if ( ! onlyStandAlone_ ) iEvent.put( triggerObjects ); + if ( ! onlyStandAlone_ ) iEvent.put(std::move(triggerObjects)); // L1 algorithms if ( ! onlyStandAlone_ ) { - std::auto_ptr< TriggerAlgorithmCollection > triggerAlgos( new TriggerAlgorithmCollection() ); - std::auto_ptr< TriggerConditionCollection > triggerConditions( new TriggerConditionCollection() ); + auto triggerAlgos = std::make_unique(); + auto triggerConditions = std::make_unique(); if ( addL1Algos_ ) { // create trigger object types transalation map (yes, it's ugly!) std::map< L1GtObject, trigger::TriggerObjectType > mapObjectTypes; @@ -1013,8 +1013,8 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } // Put L1 algorithms and conditions to event - iEvent.put( triggerAlgos ); - iEvent.put( triggerConditions ); + iEvent.put(std::move(triggerAlgos)); + iEvent.put(std::move(triggerConditions)); } @@ -1025,7 +1025,7 @@ void PATTriggerProducer::produce( Event& iEvent, const EventSetup& iSetup ) } } // Put (finally) stand-alone trigger objects to event - iEvent.put( triggerObjectsStandAlone ); + iEvent.put(std::move(triggerObjectsStandAlone)); firstInRun_ = false; diff --git a/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc index 5a929b19d23bb..8936554460c7d 100644 --- a/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATVertexSlimmer.cc @@ -41,7 +41,7 @@ pat::PATVertexSlimmer::~PATVertexSlimmer() {} void pat::PATVertexSlimmer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { edm::Handle > vertices; iEvent.getByToken(src_, vertices); - std::auto_ptr > outPtr(new std::vector()); + auto outPtr = std::make_unique>(); outPtr->reserve(vertices->size()); for (unsigned int i = 0, n = vertices->size(); i < n; ++i) { @@ -57,11 +57,11 @@ void pat::PATVertexSlimmer::produce(edm::StreamID, edm::Event& iEvent, const edm outPtr->push_back(reco::Vertex(v.position(), co, v.chi2(), v.ndof(), 0)); } - auto oh = iEvent.put(outPtr); + auto oh = iEvent.put(std::move(outPtr)); if(rekeyScores_) { edm::Handle > scores; iEvent.getByToken(score_, scores); - std::auto_ptr > vertexScoreOutput( new edm::ValueMap ); + auto vertexScoreOutput = std::make_unique>(); edm::ValueMap::const_iterator idIt=scores->begin(); for(;idIt!=scores->end();idIt++) { if(idIt.id() == vertices.id()) break; @@ -70,7 +70,7 @@ void pat::PATVertexSlimmer::produce(edm::StreamID, edm::Event& iEvent, const edm edm::ValueMap::Filler vertexScoreFiller(*vertexScoreOutput); vertexScoreFiller.insert(oh,idIt.begin(),idIt.end()); vertexScoreFiller.fill(); - iEvent.put( vertexScoreOutput ); + iEvent.put(std::move(vertexScoreOutput)); } } diff --git a/PhysicsTools/PatAlgos/plugins/PileupSummaryInfoSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PileupSummaryInfoSlimmer.cc index 47e367f477fcd..d96f7817a6f44 100644 --- a/PhysicsTools/PatAlgos/plugins/PileupSummaryInfoSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PileupSummaryInfoSlimmer.cc @@ -26,7 +26,7 @@ void PileupSummaryInfoSlimmer::produce(edm::StreamID, edm::Event& evt, const edm::EventSetup& es ) const { edm::Handle > input; - std::auto_ptr > output( new std::vector ); + auto output = std::make_unique>(); evt.getByToken(src_,input); @@ -69,7 +69,7 @@ void PileupSummaryInfoSlimmer::produce(edm::StreamID, bunchSpacing); } - evt.put(output); + evt.put(std::move(output)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/RecoMETExtractor.cc b/PhysicsTools/PatAlgos/plugins/RecoMETExtractor.cc index f22071b5a2f0a..983e8980f42b9 100644 --- a/PhysicsTools/PatAlgos/plugins/RecoMETExtractor.cc +++ b/PhysicsTools/PatAlgos/plugins/RecoMETExtractor.cc @@ -53,8 +53,8 @@ void RecoMETExtractor::produce(edm::StreamID streamID, edm::Event & iEvent, reco::MET met(src->front().corP4(corLevel_), src->front().vertex() ); metCol->push_back( met ); - std::auto_ptr > recoMETs(metCol); - iEvent.put(recoMETs); + std::unique_ptr > recoMETs(metCol); + iEvent.put(std::move(recoMETs)); } diff --git a/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc b/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc index 26ab7a90233a5..3a9ce123c9e02 100644 --- a/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/TauJetCorrFactorsProducer.cc @@ -135,14 +135,14 @@ TauJetCorrFactorsProducer::produce(edm::Event& evt, const edm::EventSetup& es) } // build the valuemap - std::auto_ptr jecMapping(new TauJetCorrFactorsMap()); + auto jecMapping = std::make_unique(); TauJetCorrFactorsMap::Filler filler(*jecMapping); // tauJets and tauJetCorrections vectors have their indices aligned by construction filler.insert(tauJets, tauJetCorrections.begin(), tauJetCorrections.end()); filler.fill(); // do the actual filling // add valuemap to the event - evt.put(jecMapping); + evt.put(std::move(jecMapping)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatAlgos/plugins/TrackAndVertexUnpacker.cc b/PhysicsTools/PatAlgos/plugins/TrackAndVertexUnpacker.cc index a779b2234aeae..2f8e2b1ea1dd3 100644 --- a/PhysicsTools/PatAlgos/plugins/TrackAndVertexUnpacker.cc +++ b/PhysicsTools/PatAlgos/plugins/TrackAndVertexUnpacker.cc @@ -77,7 +77,7 @@ void PATTrackAndVertexUnpacker::produce(edm::StreamID, edm::Event & iEvent, cons Handle > addTracks; iEvent.getByToken(AdditionalTracks_, addTracks); - std::auto_ptr< std::vector > outTks( new std::vector ); + auto outTks = std::make_unique>(); std::map > asso; std::map trackKeys; unsigned int j=0; @@ -104,9 +104,9 @@ void PATTrackAndVertexUnpacker::produce(edm::StreamID, edm::Event & iEvent, cons j++; } - edm::OrphanHandle< std::vector > oh = iEvent.put( outTks ); + edm::OrphanHandle< std::vector > oh = iEvent.put(std::move(outTks)); - std::auto_ptr< std::vector > outPv( new std::vector ); + auto outPv = std::make_unique>(); for(size_t ipv=0;ipv< pvs->size(); ++ipv) { reco::Vertex pv = (*pvs)[ipv]; @@ -118,9 +118,9 @@ void PATTrackAndVertexUnpacker::produce(edm::StreamID, edm::Event & iEvent, cons } outPv->push_back(pv); } - iEvent.put(outPv); + iEvent.put(std::move(outPv)); - std::auto_ptr< std::vector > outSv( new std::vector ); + auto outSv = std::make_unique>(); for(size_t i=0;i< svs->size(); i++) { const reco::VertexCompositePtrCandidate &sv = (*svs)[i]; outSv->push_back(reco::Vertex(sv.vertex(),sv.vertexCovariance(),sv.vertexChi2(),sv.vertexNdof(),0)); @@ -138,7 +138,7 @@ void PATTrackAndVertexUnpacker::produce(edm::StreamID, edm::Event & iEvent, cons } } - iEvent.put(outSv,"secondary"); + iEvent.put(std::move(outSv),"secondary"); } diff --git a/PhysicsTools/PatAlgos/plugins/VertexAssociationProducer.cc b/PhysicsTools/PatAlgos/plugins/VertexAssociationProducer.cc index e1f81df754609..c074d3380dfbe 100644 --- a/PhysicsTools/PatAlgos/plugins/VertexAssociationProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/VertexAssociationProducer.cc @@ -73,7 +73,7 @@ void PATVertexAssociationProducer::produce(edm::Event & iEvent, const edm::Event vertexing_.newEvent(iEvent, iSetup); // prepare room and tools for output - auto_ptr result(new VertexAssociationMap()); + auto result = std::make_unique(); VertexAssociationMap::Filler filler(*result); vector assos; @@ -95,7 +95,7 @@ void PATVertexAssociationProducer::produce(edm::Event & iEvent, const edm::Event filler.fill(); // put our produced stuff in the event - iEvent.put(result); + iEvent.put(std::move(result)); } diff --git a/PhysicsTools/PatAlgos/test/private/PATUserDataTestModule.cc b/PhysicsTools/PatAlgos/test/private/PATUserDataTestModule.cc index 959628a35207d..25b0b82231f71 100644 --- a/PhysicsTools/PatAlgos/test/private/PATUserDataTestModule.cc +++ b/PhysicsTools/PatAlgos/test/private/PATUserDataTestModule.cc @@ -171,26 +171,26 @@ PATUserDataTestModule::produce(edm::Event& iEvent, const edm::EventSetup& iSetup std::cout << "Got " << recoMuons->size() << " muons" << std::endl; vector ints(recoMuons->size(), 42); - auto_ptr > answers(new ValueMap()); + auto answers = std::make_unique>(); ValueMap::Filler intfiller(*answers); intfiller.insert(recoMuons, ints.begin(), ints.end()); intfiller.fill(); - iEvent.put(answers, label_); + iEvent.put(std::move(answers), label_); std::cout << "Filled in the answer" << std::endl; vector floats(recoMuons->size(), 3.14); - auto_ptr > pis(new ValueMap()); + auto pis = std::make_unique>(); ValueMap::Filler floatfiller(*pis); floatfiller.insert(recoMuons, floats.begin(), floats.end()); floatfiller.fill(); - iEvent.put(pis); + iEvent.put(std::move(pis)); std::cout << "Wrote useless floats into the event" << std::endl; - auto_ptr > halfp4s(new OwnVector()); + auto halfp4s = std::make_unique>(); for (size_t i = 0; i < recoMuons->size(); ++i) { halfp4s->push_back( pat::UserData::make( 0.5 * (*recoMuons)[i].p4() ) ); } - OrphanHandle > handle = iEvent.put(halfp4s); + OrphanHandle > handle = iEvent.put(std::move(halfp4s)); std::cout << "Wrote OwnVector of useless objects into the event" << std::endl; vector > halfp4sPtr; for (size_t i = 0; i < recoMuons->size(); ++i) { @@ -198,12 +198,12 @@ PATUserDataTestModule::produce(edm::Event& iEvent, const edm::EventSetup& iSetup halfp4sPtr.push_back(Ptr(handle, i)); } std::cout << " Made edm::Ptr<> to those useless objects" << std::endl; - auto_ptr > > vmhalfp4s(new ValueMap >()); + auto vmhalfp4s = std::make_unique>>(); ValueMap >::Filler filler(*vmhalfp4s); filler.insert(recoMuons, halfp4sPtr.begin(), halfp4sPtr.end()); filler.fill(); std::cout << " Filled the ValueMap of edm::Ptr<> to those useless objects" << std::endl; - iEvent.put(vmhalfp4s); + iEvent.put(std::move(vmhalfp4s)); std::cout << " Wrote the ValueMap of edm::Ptr<> to those useless objects" << std::endl; std::cout << "So long, and thanks for all the muons.\n" << std::endl; diff --git a/PhysicsTools/PatAlgos/test/private/TestEventHypothesisWriter.cc b/PhysicsTools/PatAlgos/test/private/TestEventHypothesisWriter.cc index 16e40356d2479..96ec8b677de91 100644 --- a/PhysicsTools/PatAlgos/test/private/TestEventHypothesisWriter.cc +++ b/PhysicsTools/PatAlgos/test/private/TestEventHypothesisWriter.cc @@ -78,7 +78,7 @@ TestEventHypothesisWriter::produce(edm::Event &iEvent, const edm::EventSetup &iS using reco::Candidate; using reco::CandidatePtr; - auto_ptr > hyps(new vector());; + auto hyps = std::make_unique>();; vector deltaRs; Handle > hMu; @@ -124,14 +124,14 @@ TestEventHypothesisWriter::produce(edm::Event &iEvent, const edm::EventSetup &iS std::cout << "Found " << deltaRs.size() << " possible options" << std::endl; // work done, save results - OrphanHandle > handle = iEvent.put(hyps); - auto_ptr > deltaRMap(new ValueMap()); + OrphanHandle > handle = iEvent.put(std::move(hyps)); + auto deltaRMap = std::make_unique>(); //if (deltaRs.size() > 0) { ValueMap::Filler filler(*deltaRMap); filler.insert(handle, deltaRs.begin(), deltaRs.end()); filler.fill(); //} - iEvent.put(deltaRMap, "deltaR"); + iEvent.put(std::move(deltaRMap), "deltaR"); } DEFINE_FWK_MODULE(TestEventHypothesisWriter); diff --git a/PhysicsTools/PatExamples/plugins/JetEnergyShift.cc b/PhysicsTools/PatExamples/plugins/JetEnergyShift.cc index 386637ff62adb..ea115535e2369 100644 --- a/PhysicsTools/PatExamples/plugins/JetEnergyShift.cc +++ b/PhysicsTools/PatExamples/plugins/JetEnergyShift.cc @@ -85,8 +85,8 @@ JetEnergyShift::produce(edm::Event& event, const edm::EventSetup& setup) edm::Handle > mets; event.getByToken(inputMETsToken_, mets); - std::auto_ptr > pJets(new std::vector); - std::auto_ptr > pMETs(new std::vector); + auto pJets = std::make_unique>(); + auto pMETs = std::make_unique>(); double dPx = 0.; double dPy = 0.; @@ -112,8 +112,8 @@ JetEnergyShift::produce(edm::Event& event, const edm::EventSetup& setup) double scaledMETPy = met.py() - dPy; pat::MET scaledMET(reco::MET(met.sumEt()+dSumEt, reco::MET::LorentzVector(scaledMETPx, scaledMETPy, 0, sqrt(scaledMETPx*scaledMETPx+scaledMETPy*scaledMETPy)), reco::MET::Point(0,0,0))); pMETs->push_back( scaledMET ); - event.put(pJets, outputJets_); - event.put(pMETs, outputMETs_); + event.put(std::move(pJets), outputJets_); + event.put(std::move(pMETs), outputMETs_); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatExamples/plugins/PatJPsiProducer.cc b/PhysicsTools/PatExamples/plugins/PatJPsiProducer.cc index bc0ef561c1679..f497b8ecf5ace 100644 --- a/PhysicsTools/PatExamples/plugins/PatJPsiProducer.cc +++ b/PhysicsTools/PatExamples/plugins/PatJPsiProducer.cc @@ -97,7 +97,7 @@ void PatJPsiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - std::auto_ptr > jpsiCands( new std::vector ); + auto jpsiCands = std::make_unique>(); edm::Handle > h_muons; iEvent.getByToken( muonSrcToken_, h_muons ); @@ -137,7 +137,7 @@ PatJPsiProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) } } - iEvent.put( jpsiCands ); + iEvent.put(std::move(jpsiCands)); } diff --git a/PhysicsTools/PatUtils/interface/DuplicatedElectronRemover.h b/PhysicsTools/PatUtils/interface/DuplicatedElectronRemover.h index 219e9361fc1d4..1f4cb337c069c 100644 --- a/PhysicsTools/PatUtils/interface/DuplicatedElectronRemover.h +++ b/PhysicsTools/PatUtils/interface/DuplicatedElectronRemover.h @@ -40,15 +40,15 @@ namespace pat { // List of duplicate electrons to remove // Among those that share the same cluster or track, the one with E/P nearer to 1 is kept - std::auto_ptr< std::vector > duplicatesToRemove(const std::vector &electrons) const ; + std::unique_ptr< std::vector > duplicatesToRemove(const std::vector &electrons) const ; // List of duplicate electrons to remove // Among those that share the same cluster or track, the one with E/P nearer to 1 is kept - std::auto_ptr< std::vector > duplicatesToRemove(const edm::View &electrons) const ; + std::unique_ptr< std::vector > duplicatesToRemove(const edm::View &electrons) const ; // Generic method. Collection can be vector, view or whatever you like template - std::auto_ptr< std::vector > duplicatesToRemove(const Collection &electrons) const ; + std::unique_ptr< std::vector > duplicatesToRemove(const Collection &electrons) const ; private: }; // class @@ -56,7 +56,7 @@ namespace pat { // implemented here because is templated template -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedElectronRemover::duplicatesToRemove(const Collection &electrons) const { pat::GenericDuplicateRemover dups; return dups.duplicates(electrons); diff --git a/PhysicsTools/PatUtils/interface/DuplicatedPhotonRemover.h b/PhysicsTools/PatUtils/interface/DuplicatedPhotonRemover.h index e47cfb2fe2c9e..166639d4829e5 100644 --- a/PhysicsTools/PatUtils/interface/DuplicatedPhotonRemover.h +++ b/PhysicsTools/PatUtils/interface/DuplicatedPhotonRemover.h @@ -38,50 +38,50 @@ namespace pat { /// PhotonCollection can be anything that has a "begin()" and "end()", and that hold things which have a "superCluster()" method /// notable examples are std::vector and edm::View (but GsfElectrons work too) template - std::auto_ptr< std::vector > duplicatesBySuperCluster(const PhotonCollection &photons) const ; + std::unique_ptr< std::vector > duplicatesBySuperCluster(const PhotonCollection &photons) const ; /// Indices of duplicated photons (same supercluster) to remove. It keeps the photons with highest energy. /// PhotonCollection can be anything that has a "begin()" and "end()", and that hold things which have a "superCluster()" method /// notable examples are std::vector and edm::View (but GsfElectrons work too) template - std::auto_ptr< std::vector > duplicatesBySeed(const PhotonCollection &photons) const ; + std::unique_ptr< std::vector > duplicatesBySeed(const PhotonCollection &photons) const ; /// Indices of photons which happen to be also electrons (that is, they share the same SC seed) template - std::auto_ptr< pat::OverlapList > + std::unique_ptr< pat::OverlapList > electronsBySeed(const PhotonCollection &photons, const ElectronCollection &electrons) const ; /// Indices of photons which happen to be also electrons (that is, they share the same SC) template - std::auto_ptr< pat::OverlapList > + std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const PhotonCollection &photons, const ElectronCollection &electrons) const ; // ===== Concrete versions for users (and to get it compiled, so I can see if there are errors) === - std::auto_ptr< std::vector > duplicatesBySeed(const reco::PhotonCollection &photons) const ; - std::auto_ptr< std::vector > duplicatesBySeed(const edm::View &photons) const ; - std::auto_ptr< std::vector > duplicatesBySuperCluster(const edm::View &photons) const ; - std::auto_ptr< std::vector > duplicatesBySuperCluster(const reco::PhotonCollection &photons) const ; - std::auto_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons, + std::unique_ptr< std::vector > duplicatesBySeed(const reco::PhotonCollection &photons) const ; + std::unique_ptr< std::vector > duplicatesBySeed(const edm::View &photons) const ; + std::unique_ptr< std::vector > duplicatesBySuperCluster(const edm::View &photons) const ; + std::unique_ptr< std::vector > duplicatesBySuperCluster(const reco::PhotonCollection &photons) const ; + std::unique_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons, const reco::GsfElectronCollection& electrons) const ; - std::auto_ptr< pat::OverlapList > electronsBySeed(const edm::View &photons, + std::unique_ptr< pat::OverlapList > electronsBySeed(const edm::View &photons, const reco::GsfElectronCollection& electrons) const ; - std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View &photons, + std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View &photons, const reco::GsfElectronCollection& electrons) const ; - std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons, + std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons, const reco::GsfElectronCollection& electrons) const ; - std::auto_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons, + std::unique_ptr< pat::OverlapList > electronsBySeed(const reco::PhotonCollection &photons, const edm::View& electrons) const ; - std::auto_ptr< pat::OverlapList > electronsBySeed(const edm::View &photons, + std::unique_ptr< pat::OverlapList > electronsBySeed(const edm::View &photons, const edm::View& electrons) const ; - std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View &photons, + std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const edm::View &photons, const edm::View& electrons) const ; - std::auto_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons, + std::unique_ptr< pat::OverlapList > electronsBySuperCluster(const reco::PhotonCollection &photons, const edm::View& electrons) const ; }; } template -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(const PhotonCollection &photons) const { typedef typename PhotonCollection::value_type PhotonType; pat::GenericDuplicateRemover > dups; @@ -89,7 +89,7 @@ pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(const PhotonCollection &p } template -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedPhotonRemover::duplicatesBySeed(const PhotonCollection &photons) const { typedef typename PhotonCollection::value_type PhotonType; pat::GenericDuplicateRemover > dups; @@ -98,7 +98,7 @@ pat::DuplicatedPhotonRemover::duplicatesBySeed(const PhotonCollection &photons) /// Indices of photons which happen to be also electrons (that is, they share the same SC) template -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySuperCluster(const PhotonCollection &photons, const ElectronCollection &electrons) const { pat::GenericOverlapFinder< pat::OverlapDistance > ovl; return ovl.find(photons, electrons); @@ -106,7 +106,7 @@ pat::DuplicatedPhotonRemover::electronsBySuperCluster(const PhotonCollection &ph /// Indices of photons which happen to be also electrons (that is, they share the same SC) template -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySeed(const PhotonCollection &photons, const ElectronCollection &electrons) const { pat::GenericOverlapFinder< pat::OverlapDistance > ovl; return ovl.find(photons, electrons); diff --git a/PhysicsTools/PatUtils/interface/GenericDuplicateRemover.h b/PhysicsTools/PatUtils/interface/GenericDuplicateRemover.h index 0a3c95c44816c..468cf3f8482be 100644 --- a/PhysicsTools/PatUtils/interface/GenericDuplicateRemover.h +++ b/PhysicsTools/PatUtils/interface/GenericDuplicateRemover.h @@ -24,7 +24,7 @@ namespace pat { /// arbitrator(x1, x2) should return true if x1 is better, that is we want to keep x1 and delete x2 /// Collection can be vector, View, or anything with the same interface template - std::auto_ptr< std::vector > + std::unique_ptr< std::vector > duplicates(const Collection &items) const ; private: @@ -36,7 +36,7 @@ namespace pat { template template -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::GenericDuplicateRemover::duplicates(const Collection &items) const { size_t size = items.size(); @@ -57,7 +57,7 @@ pat::GenericDuplicateRemover::duplicates(const Collection } } - std::auto_ptr< std::vector > ret(new std::vector()); + auto ret = std::make_unique>(); for (size_t i = 0; i < size; ++i) { if (bad[i]) ret->push_back(i); diff --git a/PhysicsTools/PatUtils/interface/GenericOverlapFinder.h b/PhysicsTools/PatUtils/interface/GenericOverlapFinder.h index 82155f283387d..301a015ad65fd 100644 --- a/PhysicsTools/PatUtils/interface/GenericOverlapFinder.h +++ b/PhysicsTools/PatUtils/interface/GenericOverlapFinder.h @@ -59,7 +59,7 @@ namespace pat { /// Items are considered to overlap if distance(x1,x2) < 1 /// both Collections can be vectors, Views, or anything with the same interface template - std::auto_ptr< OverlapList > + std::unique_ptr< OverlapList > find(const Collection &items, const OtherCollection &other) const ; private: @@ -70,12 +70,12 @@ namespace pat { template template -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::GenericOverlapFinder::find(const Collection &items, const OtherCollection &other) const { size_t size = items.size(), size2 = other.size(); - std::auto_ptr< OverlapList > ret(new OverlapList()); + auto ret = std::make_unique(); for (size_t ie = 0; ie < size; ++ie) { double dmin = 1.0; diff --git a/PhysicsTools/PatUtils/interface/JetSelector.h b/PhysicsTools/PatUtils/interface/JetSelector.h index 390f5c1e294db..a3c17dd98a88a 100644 --- a/PhysicsTools/PatUtils/interface/JetSelector.h +++ b/PhysicsTools/PatUtils/interface/JetSelector.h @@ -57,8 +57,8 @@ namespace pat { JetSelection config_; - std::auto_ptr CaloJetSelector_;///Selects CaloJets - //std::auto_ptr PFSelector_;///Selects PFJets + std::unique_ptr CaloJetSelector_;///Selects CaloJets + //std::unique_ptr PFSelector_;///Selects PFJets }; // class diff --git a/PhysicsTools/PatUtils/interface/JetSelector.icc b/PhysicsTools/PatUtils/interface/JetSelector.icc index b40f5917e91df..a462b047b54b4 100644 --- a/PhysicsTools/PatUtils/interface/JetSelector.icc +++ b/PhysicsTools/PatUtils/interface/JetSelector.icc @@ -10,10 +10,8 @@ pat::JetSelector::JetSelector( const pat::JetSelection& config ) : { if (config_.selectionType=="custom") { - CaloJetSelector_ = std::auto_ptr( - new CaloJetSelector(config) ); - //PFJetSelector_ = std::auto_ptr( - // new PFJetSelector(config) ); + CaloJetSelector_ = std::make_unique(config); + //PFJetSelector_ = std::make_unique(config); } } diff --git a/PhysicsTools/PatUtils/interface/ShiftedJetProducerT.h b/PhysicsTools/PatUtils/interface/ShiftedJetProducerT.h index 90a5ac2f0a4b3..f4c00e7836ae9 100644 --- a/PhysicsTools/PatUtils/interface/ShiftedJetProducerT.h +++ b/PhysicsTools/PatUtils/interface/ShiftedJetProducerT.h @@ -107,7 +107,7 @@ template if ( evt.isRealData() && addResidualJES_ ) { evt.getByToken(jetCorrTokenUpToL3Res_, jetCorrUpToL3Res); } - std::auto_ptr shiftedJets(new JetCollection); + auto shiftedJets = std::make_unique(); if ( jetCorrPayloadName_ != "" ) { edm::ESHandle jetCorrParameterSet; @@ -170,7 +170,7 @@ template shiftedJets->push_back(shiftedJet); } - evt.put(shiftedJets); + evt.put(std::move(shiftedJets)); } std::string moduleLabel_; diff --git a/PhysicsTools/PatUtils/interface/ShiftedParticleProducerT.h b/PhysicsTools/PatUtils/interface/ShiftedParticleProducerT.h index 140c0dfdaa873..85c22b62693fb 100644 --- a/PhysicsTools/PatUtils/interface/ShiftedParticleProducerT.h +++ b/PhysicsTools/PatUtils/interface/ShiftedParticleProducerT.h @@ -70,7 +70,7 @@ class ShiftedParticleProducerT : public edm::stream::EDProducer<> edm::Handle originalParticles; evt.getByToken(srcToken_, originalParticles); - std::auto_ptr shiftedParticles(new ParticleCollection); + auto shiftedParticles = std::make_unique(); for ( typename ParticleCollection::const_iterator originalParticle = originalParticles->begin(); originalParticle != originalParticles->end(); ++originalParticle ) { @@ -96,7 +96,7 @@ class ShiftedParticleProducerT : public edm::stream::EDProducer<> shiftedParticles->push_back(shiftedParticle); } - evt.put(shiftedParticles); + evt.put(std::move(shiftedParticles)); } std::string moduleLabel_; diff --git a/PhysicsTools/PatUtils/interface/SmearedJetProducerT.h b/PhysicsTools/PatUtils/interface/SmearedJetProducerT.h index 62813220a1b9a..5bc1cb7bc9d8f 100644 --- a/PhysicsTools/PatUtils/interface/SmearedJetProducerT.h +++ b/PhysicsTools/PatUtils/interface/SmearedJetProducerT.h @@ -198,7 +198,7 @@ class SmearedJetProducerT : public edm::stream::EDProducer<> { if (m_genJetMatcher) m_genJetMatcher->getTokens(event); - std::unique_ptr smearedJets(new JetCollection()); + auto smearedJets = std::make_unique(); for (const auto& jet: jets) { diff --git a/PhysicsTools/PatUtils/plugins/BoostedJetMerger.cc b/PhysicsTools/PatUtils/plugins/BoostedJetMerger.cc index 3097e80f04002..df8125bb21d8c 100644 --- a/PhysicsTools/PatUtils/plugins/BoostedJetMerger.cc +++ b/PhysicsTools/PatUtils/plugins/BoostedJetMerger.cc @@ -21,8 +21,8 @@ void BoostedJetMerger::produce(edm::Event& iEvent, const edm::EventSetup&) { - std::auto_ptr< std::vector > outputs( new std::vector ); - std::auto_ptr< std::vector > outputSubjets( new std::vector ); + auto outputs = std::make_unique>(); + auto outputSubjets = std::make_unique>(); edm::RefProd< std::vector > h_subJetsOut = iEvent.getRefBeforePut< std::vector >( "SubJets" ); @@ -62,8 +62,8 @@ BoostedJetMerger::produce(edm::Event& iEvent, const edm::EventSetup&) } - iEvent.put(outputs); - iEvent.put(outputSubjets, "SubJets"); + iEvent.put(std::move(outputs)); + iEvent.put(std::move(outputSubjets), "SubJets"); } diff --git a/PhysicsTools/PatUtils/plugins/CorrectedPATMETProducer.cc b/PhysicsTools/PatUtils/plugins/CorrectedPATMETProducer.cc index 1d7aa8ef393d9..b804e1228b4a2 100644 --- a/PhysicsTools/PatUtils/plugins/CorrectedPATMETProducer.cc +++ b/PhysicsTools/PatUtils/plugins/CorrectedPATMETProducer.cc @@ -61,9 +61,9 @@ class CorrectedPATMETProducer : public edm::stream::EDProducer<> reco::MET corrMET = corrector.getCorrectedMET(srcMET, evt, es); pat::MET outMET(corrMET, srcMET); - std::auto_ptr product(new METCollection); + auto product = std::make_unique(); product->push_back(outMET); - evt.put(product); + evt.put(std::move(product)); } }; diff --git a/PhysicsTools/PatUtils/plugins/JetSubstructurePacker.cc b/PhysicsTools/PatUtils/plugins/JetSubstructurePacker.cc index 4dc7bcaa697c8..63019cd1dfbf9 100644 --- a/PhysicsTools/PatUtils/plugins/JetSubstructurePacker.cc +++ b/PhysicsTools/PatUtils/plugins/JetSubstructurePacker.cc @@ -29,7 +29,7 @@ void JetSubstructurePacker::produce(edm::Event& iEvent, const edm::EventSetup&) { - std::auto_ptr< std::vector > outputs( new std::vector ); + auto outputs = std::make_unique>(); edm::Handle< edm::View > jetHandle; std::vector< edm::Handle< edm::View > > algoHandles; @@ -121,7 +121,7 @@ JetSubstructurePacker::produce(edm::Event& iEvent, const edm::EventSetup&) } } - iEvent.put(outputs); + iEvent.put(std::move(outputs)); } diff --git a/PhysicsTools/PatUtils/plugins/ShiftedJetProducerByMatchedObject.cc b/PhysicsTools/PatUtils/plugins/ShiftedJetProducerByMatchedObject.cc index 325329239978c..c5a6e5bf7813b 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedJetProducerByMatchedObject.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedJetProducerByMatchedObject.cc @@ -80,7 +80,7 @@ void ShiftedJetProducerByMatchedObjectT::produce(edm::Event& evt, const edm:: match.assign(objects_.size(), false); - std::auto_ptr shiftedJets(new JetCollection); + auto shiftedJets = std::make_unique(); for ( typename JetCollection::const_iterator originalJet = originalJets->begin(); originalJet != originalJets->end(); ++originalJet ) { @@ -121,7 +121,7 @@ void ShiftedJetProducerByMatchedObjectT::produce(edm::Event& evt, const edm:: shiftedJets->push_back(shiftedJet); } - evt.put(shiftedJets); + evt.put(std::move(shiftedJets)); } #include "DataFormats/JetReco/interface/CaloJet.h" diff --git a/PhysicsTools/PatUtils/plugins/ShiftedMETcorrInputProducer.cc b/PhysicsTools/PatUtils/plugins/ShiftedMETcorrInputProducer.cc index 289fd837f2733..67dd64f3c76b5 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedMETcorrInputProducer.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedMETcorrInputProducer.cc @@ -63,14 +63,14 @@ void ShiftedMETcorrInputProducer::produce(edm::Event& evt, const edm::EventSetup double shift = shiftBy_*(*binningEntry)->binUncertainty_; - std::auto_ptr shiftedObject(new CorrMETData(*originalObject)); + auto shiftedObject = std::make_unique(*originalObject); //--- MET balances momentum of reconstructed particles, // hence variations of "unclustered energy" and MET are opposite in sign shiftedObject->mex = -shift*originalObject->mex; shiftedObject->mey = -shift*originalObject->mey; shiftedObject->sumet = shift*originalObject->sumet; - evt.put(shiftedObject, (*binningEntry)->getInstanceLabel_full(src_i->instance())); + evt.put(std::move(shiftedObject), (*binningEntry)->getInstanceLabel_full(src_i->instance())); } } } diff --git a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerByMatchedObject.cc b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerByMatchedObject.cc index 2181be1d1173c..fee913bb2f811 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerByMatchedObject.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerByMatchedObject.cc @@ -58,7 +58,7 @@ void ShiftedPFCandidateProducerByMatchedObject::produce(edm::Event& evt, const e } } - std::auto_ptr shiftedPFCandidates(new reco::PFCandidateCollection); + auto shiftedPFCandidates = std::make_unique(); for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin(); originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) { @@ -93,7 +93,7 @@ void ShiftedPFCandidateProducerByMatchedObject::produce(edm::Event& evt, const e shiftedPFCandidates->push_back(shiftedPFCandidate); } - evt.put(shiftedPFCandidates); + evt.put(std::move(shiftedPFCandidates)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForNoPileUpPFMEt.cc b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForNoPileUpPFMEt.cc index f1985191c78ca..fdad5ecef01f0 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForNoPileUpPFMEt.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForNoPileUpPFMEt.cc @@ -57,8 +57,7 @@ void ShiftedPFCandidateProducerForNoPileUpPFMEt::produce(edm::Event& evt, const jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters); } - std::auto_ptr shiftedPFCandidates(new reco::PFCandidateCollection); - + auto shiftedPFCandidates = std::make_unique(); for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin(); originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) { @@ -93,7 +92,7 @@ void ShiftedPFCandidateProducerForNoPileUpPFMEt::produce(edm::Event& evt, const shiftedPFCandidates->push_back(shiftedPFCandidate); } - evt.put(shiftedPFCandidates); + evt.put(std::move(shiftedPFCandidates)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFMVAMEt.cc b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFMVAMEt.cc index 299b32dc54f33..814745d3a09ad 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFMVAMEt.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFMVAMEt.cc @@ -72,7 +72,7 @@ void ShiftedPFCandidateProducerForPFMVAMEt::produce(edm::Event& evt, const edm:: match.assign(objects_.size(), false); - std::auto_ptr shiftedPFCandidates(new reco::PFCandidateCollection); + auto shiftedPFCandidates = std::make_unique(); for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin(); originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) { @@ -113,7 +113,7 @@ void ShiftedPFCandidateProducerForPFMVAMEt::produce(edm::Event& evt, const edm:: shiftedPFCandidates->push_back(shiftedPFCandidate); } - evt.put(shiftedPFCandidates); + evt.put(std::move(shiftedPFCandidates)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFNoPUMEt.cc b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFNoPUMEt.cc index da7119be58453..01d4525337900 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFNoPUMEt.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedPFCandidateProducerForPFNoPUMEt.cc @@ -71,7 +71,7 @@ void ShiftedPFCandidateProducerForPFNoPUMEt::produce(edm::Event& evt, const edm: jecUncertainty_ = new JetCorrectionUncertainty(jetCorrParameters); } - std::auto_ptr shiftedPFCandidates(new reco::PFCandidateCollection); + auto shiftedPFCandidates = std::make_unique(); for ( reco::PFCandidateCollection::const_iterator originalPFCandidate = originalPFCandidates->begin(); originalPFCandidate != originalPFCandidates->end(); ++originalPFCandidate ) { @@ -106,7 +106,7 @@ void ShiftedPFCandidateProducerForPFNoPUMEt::produce(edm::Event& evt, const edm: shiftedPFCandidates->push_back(shiftedPFCandidate); } - evt.put(shiftedPFCandidates); + evt.put(std::move(shiftedPFCandidates)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatUtils/plugins/ShiftedParticleMETcorrInputProducer.cc b/PhysicsTools/PatUtils/plugins/ShiftedParticleMETcorrInputProducer.cc index 1766f333f0424..a50c1b0e0e660 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedParticleMETcorrInputProducer.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedParticleMETcorrInputProducer.cc @@ -20,7 +20,7 @@ void ShiftedParticleMETcorrInputProducer::produce(edm::StreamID, edm::Event& evt edm::Handle shiftedParticles; evt.getByToken(srcShiftedToken_, shiftedParticles); - std::auto_ptr metCorrection(new CorrMETData()); + auto metCorrection = std::make_unique(); for ( CandidateView::const_iterator originalParticle = originalParticles->begin(); originalParticle != originalParticles->end(); ++originalParticle ) { @@ -36,7 +36,7 @@ void ShiftedParticleMETcorrInputProducer::produce(edm::StreamID, edm::Event& evt metCorrection->sumet -= shiftedParticle->et(); } - evt.put(metCorrection); + evt.put(std::move(metCorrection)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.cc b/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.cc index a92d71cc04a45..edd1807b86a58 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.cc +++ b/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.cc @@ -36,7 +36,7 @@ ShiftedParticleProducer::produce(edm::Event& evt, const edm::EventSetup& es) edm::Handle originalParticles; evt.getByToken(srcToken_, originalParticles); - std::auto_ptr shiftedParticles(new reco::CandidateCollection); + auto shiftedParticles = std::make_unique(); for(CandidateView::const_iterator originalParticle = originalParticles->begin(); originalParticle != originalParticles->end(); ++originalParticle ) { @@ -48,13 +48,13 @@ ShiftedParticleProducer::produce(edm::Event& evt, const edm::EventSetup& es) //leave 0*nan = 0 if (! (edm::isNotFinite(shift) && shiftedParticleP4.mag2()==0)) shiftedParticleP4 *= (1. + shift); - std::auto_ptr shiftedParticle( new reco::LeafCandidate( *originalParticle ) ); + std::unique_ptr shiftedParticle = std::make_unique(*originalParticle); shiftedParticle->setP4(shiftedParticleP4); shiftedParticles->push_back( shiftedParticle.release() ); } - evt.put(shiftedParticles); + evt.put(std::move(shiftedParticles)); } double diff --git a/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.h b/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.h index 2d226ac1f1d3a..5ccb96f693e9a 100644 --- a/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.h +++ b/PhysicsTools/PatUtils/plugins/ShiftedParticleProducer.h @@ -56,14 +56,14 @@ class ShiftedParticleProducer : public edm::stream::EDProducer<> binUncertainty_(uncertainty), energyDep_(false) { - binUncFormula_ = std::unique_ptr(new TF2(std::string(moduleLabel).append("_uncFormula").c_str(), binUncertainty_.c_str() ) ); + binUncFormula_ = std::make_unique(std::string(moduleLabel).append("_uncFormula").c_str(), binUncertainty_.c_str() ); } binningEntryType(const edm::ParameterSet& cfg, std::string moduleLabel) : binSelection_(new StringCutObjectSelector(cfg.getParameter("binSelection"))), binUncertainty_(cfg.getParameter("binUncertainty")), energyDep_(false) { - binUncFormula_ = std::unique_ptr(new TF2(std::string(moduleLabel).append("_uncFormula").c_str(), binUncertainty_.c_str() ) ); + binUncFormula_ = std::make_unique(std::string(moduleLabel).append("_uncFormula").c_str(), binUncertainty_.c_str() ); if(cfg.exists("energyDependency") ) {energyDep_=cfg.getParameter("energyDependency"); } } diff --git a/PhysicsTools/PatUtils/src/DuplicatedElectronRemover.cc b/PhysicsTools/PatUtils/src/DuplicatedElectronRemover.cc index 95416e56e700e..568107370fcb6 100644 --- a/PhysicsTools/PatUtils/src/DuplicatedElectronRemover.cc +++ b/PhysicsTools/PatUtils/src/DuplicatedElectronRemover.cc @@ -3,12 +3,12 @@ #include -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedElectronRemover::duplicatesToRemove(const std::vector &electrons) const { return duplicatesToRemove< std::vector >(electrons); } -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedElectronRemover::duplicatesToRemove(const edm::View &electrons) const { return duplicatesToRemove< edm::View >(electrons); } @@ -17,7 +17,7 @@ pat::DuplicatedElectronRemover::duplicatesToRemove(const edm::View > +std::unique_ptr< std::vector > pat::DuplicatedElectronRemover::duplicatesToRemove(const std::vector &electrons) { using namespace std; @@ -51,7 +51,7 @@ pat::DuplicatedElectronRemover::duplicatesToRemove(const std::vector > ret(new vector()); + auto ret = std::make_unique>(); for (size_t i = 0; i < size; ++i) { if (bad[i]) ret->push_back(i); diff --git a/PhysicsTools/PatUtils/src/DuplicatedPhotonRemover.cc b/PhysicsTools/PatUtils/src/DuplicatedPhotonRemover.cc index 10839897e3973..73b27c4fbfd2c 100644 --- a/PhysicsTools/PatUtils/src/DuplicatedPhotonRemover.cc +++ b/PhysicsTools/PatUtils/src/DuplicatedPhotonRemover.cc @@ -2,72 +2,72 @@ #include -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedPhotonRemover::duplicatesBySeed(const reco::PhotonCollection &photons) const { return duplicatesBySeed(photons); } -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedPhotonRemover::duplicatesBySeed(const edm::View &photons) const { return duplicatesBySeed< edm::View >(photons); } -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(const reco::PhotonCollection &photons) const { return duplicatesBySuperCluster(photons); } -std::auto_ptr< std::vector > +std::unique_ptr< std::vector > pat::DuplicatedPhotonRemover::duplicatesBySuperCluster(const edm::View &photons) const { return duplicatesBySuperCluster< edm::View >(photons); } // ================ ELECTRONS ============================= // ---------------- against EleCollection ----------------------------- -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySeed(const reco::PhotonCollection &photons, const reco::GsfElectronCollection& electrons) const { return electronsBySeed(photons, electrons); } -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySeed(const edm::View &photons, const reco::GsfElectronCollection& electrons) const { return electronsBySeed, reco::GsfElectronCollection>(photons, electrons); } -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySuperCluster(const edm::View &photons, const reco::GsfElectronCollection& electrons) const { return electronsBySuperCluster, reco::GsfElectronCollection>(photons, electrons); } -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySuperCluster(const reco::PhotonCollection &photons, const reco::GsfElectronCollection& electrons) const { return electronsBySuperCluster(photons, electrons); } // ---------------- against EleView ----------------------------- -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySeed(const reco::PhotonCollection &photons, const edm::View& electrons) const { return electronsBySeed >(photons, electrons); } -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySeed(const edm::View &photons, const edm::View& electrons) const { return electronsBySeed, edm::View >(photons, electrons); } -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySuperCluster(const edm::View &photons, const edm::View& electrons) const { return electronsBySuperCluster, edm::View >(photons, electrons); } -std::auto_ptr< pat::OverlapList > +std::unique_ptr< pat::OverlapList > pat::DuplicatedPhotonRemover::electronsBySuperCluster(const reco::PhotonCollection &photons, const edm::View& electrons) const { return electronsBySuperCluster >(photons, electrons); diff --git a/PhysicsTools/RecoAlgos/interface/MassKinFitterCandProducer.h b/PhysicsTools/RecoAlgos/interface/MassKinFitterCandProducer.h index 1de0e6168593b..2fe711c43a679 100755 --- a/PhysicsTools/RecoAlgos/interface/MassKinFitterCandProducer.h +++ b/PhysicsTools/RecoAlgos/interface/MassKinFitterCandProducer.h @@ -16,7 +16,7 @@ class MassKinFitterCandProducer : public edm::EDProducer { explicit MassKinFitterCandProducer(const edm::ParameterSet&, CandMassKinFitter * = 0); private: edm::EDGetTokenT srcToken_; - std::auto_ptr fitter_; + std::unique_ptr fitter_; void produce( edm::Event &, const edm::EventSetup & ); }; diff --git a/PhysicsTools/RecoAlgos/src/MassKinFitterCandProducer.cc b/PhysicsTools/RecoAlgos/src/MassKinFitterCandProducer.cc index 61bffc28477cf..d0b9dd5b88591 100755 --- a/PhysicsTools/RecoAlgos/src/MassKinFitterCandProducer.cc +++ b/PhysicsTools/RecoAlgos/src/MassKinFitterCandProducer.cc @@ -16,12 +16,12 @@ void MassKinFitterCandProducer::produce( edm::Event & evt, const edm::EventSetup using namespace reco; Handle cands; evt.getByToken(srcToken_, cands); - std::auto_ptr refitted( new CandidateCollection ); + auto refitted = std::make_unique(); for( CandidateCollection::const_iterator c = cands->begin(); c != cands->end(); ++ c ) { Candidate * clone = c->clone(); fitter_->set( * clone ); refitted->push_back( clone ); } - evt.put( refitted ); + evt.put(std::move(refitted)); } diff --git a/PhysicsTools/SelectorUtils/interface/VersionedIdProducer.h b/PhysicsTools/SelectorUtils/interface/VersionedIdProducer.h index b0e70b48958f1..192f350901285 100644 --- a/PhysicsTools/SelectorUtils/interface/VersionedIdProducer.h +++ b/PhysicsTools/SelectorUtils/interface/VersionedIdProducer.h @@ -139,12 +139,12 @@ produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { const Collection& physicsobjects = *physicsObjectsHandle; for( const auto& id : ids_ ) { - std::auto_ptr > outPass(new edm::ValueMap() ); - std::auto_ptr > outPassf(new edm::ValueMap() ); - std::auto_ptr > outHowFar(new edm::ValueMap() ); - std::auto_ptr > outBitmap(new edm::ValueMap() ); - std::auto_ptr > out_cfrs(new edm::ValueMap() ); - std::auto_ptr out_usrd(new pat::UserDataCollection); + auto outPass = std::make_unique>(); + auto outPassf = std::make_unique>(); + auto outHowFar = std::make_unique>(); + auto outBitmap = std::make_unique>(); + auto out_cfrs = std::make_unique>(); + auto out_usrd = std::make_unique(); std::vector passfail; std::vector passfailf; @@ -182,16 +182,16 @@ produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { fillercfr.insert(physicsObjectsHandle, cfrs.begin(), cfrs.end() ); fillercfr.fill(); - iEvent.put(outPass,id->name()); - iEvent.put(outPassf,id->name()); - iEvent.put(outHowFar,id->name()); - iEvent.put(outBitmap,id->name()+std::string(bitmap_label)); - iEvent.put(out_cfrs,id->name()); - iEvent.put(std::auto_ptr(new std::string(id->md5String())), + iEvent.put(std::move(outPass),id->name()); + iEvent.put(std::move(outPassf),id->name()); + iEvent.put(std::move(outHowFar),id->name()); + iEvent.put(std::move(outBitmap),id->name()+std::string(bitmap_label)); + iEvent.put(std::move(out_cfrs),id->name()); + iEvent.put(std::make_unique(id->md5String()), id->name()); - auto usrd_handle = iEvent.put(out_usrd,id->name()); + auto usrd_handle = iEvent.put(std::move(out_usrd),id->name()); //now add the value map of ptrs to user datas - std::auto_ptr > > out_usrdptrs(new edm::ValueMap >); + auto out_usrdptrs = std::make_unique>>(); std::vector > usrdptrs; for( unsigned i = 0; i < usrd_handle->size(); ++i ){ usrdptrs.push_back(edm::Ptr(usrd_handle,i)); @@ -201,7 +201,7 @@ produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { fillerusrdptrs.insert(physicsObjectsHandle, usrdptrs.begin(), usrdptrs.end()); fillerusrdptrs.fill(); - iEvent.put(out_usrdptrs,id->name()); + iEvent.put(std::move(out_usrdptrs),id->name()); } } diff --git a/PhysicsTools/TagAndProbe/plugins/AnythingToValueMap.h b/PhysicsTools/TagAndProbe/plugins/AnythingToValueMap.h index 3614d63032d5e..dea4b4ef593a4 100644 --- a/PhysicsTools/TagAndProbe/plugins/AnythingToValueMap.h +++ b/PhysicsTools/TagAndProbe/plugins/AnythingToValueMap.h @@ -47,11 +47,11 @@ void AnythingToValueMap::produce(edm::Event & iEv adaptor_.run(*handle, ret); - std::auto_ptr map(new Map()); + auto map = std::make_unique(); MapFiller filler(*map); filler.insert(handle, ret.begin(), ret.end()); filler.fill(); - iEvent.put(map, adaptor_.label()); + iEvent.put(std::move(map), adaptor_.label()); } template @@ -92,11 +92,11 @@ void ManyThingsToValueMaps::produce(edm::Event & for (typename std::vector::iterator it = adaptors_.begin(), ed = adaptors_.end(); it != ed; ++it) { ret.clear(); if (it->run(iEvent, *handle, ret)) { - std::auto_ptr map(new Map()); + auto map = std::make_unique(); MapFiller filler(*map); filler.insert(handle, ret.begin(), ret.end()); filler.fill(); - iEvent.put(map, it->label()); + iEvent.put(std::move(map), it->label()); } else { if (!failSilently_) throw cms::Exception("ManyThingsToValueMaps") << "Error in adapter " << it->label() << "\n"; } diff --git a/PhysicsTools/TagAndProbe/plugins/ColinsSoperVariablesComputer.cc b/PhysicsTools/TagAndProbe/plugins/ColinsSoperVariablesComputer.cc index de71a7a5475c2..eea8d1b6e1df7 100644 --- a/PhysicsTools/TagAndProbe/plugins/ColinsSoperVariablesComputer.cc +++ b/PhysicsTools/TagAndProbe/plugins/ColinsSoperVariablesComputer.cc @@ -111,26 +111,26 @@ ColinsSoperVariablesComputer::produce(edm::Event & iEvent, const edm::EventSetup // convert into ValueMap and store - std::auto_ptr > valMap(new ValueMap()); + auto valMap = std::make_unique>(); ValueMap::Filler filler(*valMap); filler.insert(bosons, values.begin(), values.end()); filler.fill(); - iEvent.put(valMap, "costheta"); + iEvent.put(std::move(valMap), "costheta"); // ---> same for sin2theta - std::auto_ptr > valMap2(new ValueMap()); + auto valMap2 = std::make_unique>(); ValueMap::Filler filler2(*valMap2); filler2.insert(bosons, values2.begin(), values2.end()); filler2.fill(); - iEvent.put(valMap2, "sin2theta"); + iEvent.put(std::move(valMap2), "sin2theta"); // ---> same for tanphi - std::auto_ptr > valMap3(new ValueMap()); + auto valMap3 = std::make_unique>(); ValueMap::Filler filler3(*valMap3); filler3.insert(bosons, values3.begin(), values3.end()); filler3.fill(); - iEvent.put(valMap3, "tanphi"); + iEvent.put(std::move(valMap3), "tanphi"); } diff --git a/PhysicsTools/TagAndProbe/plugins/DeltaRNearestObjectComputer.cc b/PhysicsTools/TagAndProbe/plugins/DeltaRNearestObjectComputer.cc index 560cb44c0fc83..fb4d3e1a7d8a5 100644 --- a/PhysicsTools/TagAndProbe/plugins/DeltaRNearestObjectComputer.cc +++ b/PhysicsTools/TagAndProbe/plugins/DeltaRNearestObjectComputer.cc @@ -98,11 +98,11 @@ DeltaRNearestObjectComputer::produce(edm::Event & iEvent, const edm::EventSet } // convert into ValueMap and store - std::auto_ptr > valMap(new ValueMap()); + auto valMap = std::make_unique>(); ValueMap::Filler filler(*valMap); filler.insert(probes, values.begin(), values.end()); filler.fill(); - iEvent.put(valMap); + iEvent.put(std::move(valMap)); } diff --git a/PhysicsTools/TagAndProbe/plugins/ElectronConversionRejectionVars.cc b/PhysicsTools/TagAndProbe/plugins/ElectronConversionRejectionVars.cc index 6029970fc888f..8a2d3dab4f1a7 100644 --- a/PhysicsTools/TagAndProbe/plugins/ElectronConversionRejectionVars.cc +++ b/PhysicsTools/TagAndProbe/plugins/ElectronConversionRejectionVars.cc @@ -113,34 +113,34 @@ ElectronConversionRejectionVars::produce(edm::Event & iEvent, const edm::EventSe // convert into ValueMap and store - std::auto_ptr > valMap(new ValueMap()); + auto valMap = std::make_unique>(); ValueMap::Filler filler(*valMap); filler.insert(probes, values.begin(), values.end()); filler.fill(); - iEvent.put(valMap, "dist"); + iEvent.put(std::move(valMap), "dist"); // ---> same for dcot - std::auto_ptr > valMap2(new ValueMap()); + auto valMap2 = std::make_unique>(); ValueMap::Filler filler2(*valMap2); filler2.insert(probes, values2.begin(), values2.end()); filler2.fill(); - iEvent.put(valMap2, "dcot"); + iEvent.put(std::move(valMap2), "dcot"); // ---> same for convradius - std::auto_ptr > valMap3(new ValueMap()); + auto valMap3 = std::make_unique>(); ValueMap::Filler filler3(*valMap3); filler3.insert(probes, values3.begin(), values3.end()); filler3.fill(); - iEvent.put(valMap3, "convradius"); + iEvent.put(std::move(valMap3), "convradius"); // ---> same for passConvRej - std::auto_ptr > valMap4(new ValueMap()); + auto valMap4 = std::make_unique>(); ValueMap::Filler filler4(*valMap4); filler4.insert(probes, values4.begin(), values4.end()); filler4.fill(); - iEvent.put(valMap4, "passConvRej"); + iEvent.put(std::move(valMap4), "passConvRej"); } diff --git a/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc b/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc index fc9e68b520a56..911b11f9e6c16 100644 --- a/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc +++ b/PhysicsTools/TagAndProbe/plugins/ElectronMatchedCandidateProducer.cc @@ -42,10 +42,8 @@ void ElectronMatchedCandidateProducer::produce(edm::Event &event, const edm::EventSetup &eventSetup) { // Create the output collection - std::auto_ptr< edm::RefToBaseVector > - outColRef( new edm::RefToBaseVector ); - std::auto_ptr< edm::PtrVector > - outColPtr( new edm::PtrVector ); + auto outColRef = std::make_unique>(); + auto outColPtr = std::make_unique>(); // Read electrons @@ -82,8 +80,8 @@ void ElectronMatchedCandidateProducer::produce(edm::Event &event, } // end candidate loop - event.put(outColRef); - event.put(outColPtr); + event.put(std::move(outColRef)); + event.put(std::move(outColPtr)); } diff --git a/PhysicsTools/TagAndProbe/plugins/NearbyCandCountComputer.cc b/PhysicsTools/TagAndProbe/plugins/NearbyCandCountComputer.cc index 4c55bf6101379..8a999259774ac 100644 --- a/PhysicsTools/TagAndProbe/plugins/NearbyCandCountComputer.cc +++ b/PhysicsTools/TagAndProbe/plugins/NearbyCandCountComputer.cc @@ -85,11 +85,11 @@ NearbyCandCountComputer::produce(edm::Event & iEvent, const edm::EventSetup & iS } // convert into ValueMap and store - std::auto_ptr > valMap(new ValueMap()); + auto valMap = std::make_unique>(); ValueMap::Filler filler(*valMap); filler.insert(probes, values.begin(), values.end()); filler.fill(); - iEvent.put(valMap); + iEvent.put(std::move(valMap)); } diff --git a/PhysicsTools/TagAndProbe/plugins/ObjectMultiplicityCounter.cc b/PhysicsTools/TagAndProbe/plugins/ObjectMultiplicityCounter.cc index b8418cb7be218..934a54e94b65c 100644 --- a/PhysicsTools/TagAndProbe/plugins/ObjectMultiplicityCounter.cc +++ b/PhysicsTools/TagAndProbe/plugins/ObjectMultiplicityCounter.cc @@ -75,11 +75,11 @@ ObjectMultiplicityCounter::produce(edm::Event & iEvent, const edm::EventSetup std::vector values(probes->size(), count); // convert into ValueMap and store - std::auto_ptr > valMap(new ValueMap()); + auto valMap = std::make_unique>(); ValueMap::Filler filler(*valMap); filler.insert(probes, values.begin(), values.end()); filler.fill(); - iEvent.put(valMap); + iEvent.put(std::move(valMap)); } diff --git a/PhysicsTools/TagAndProbe/plugins/ObjectViewCleaner.cc b/PhysicsTools/TagAndProbe/plugins/ObjectViewCleaner.cc index 998aa4d321021..9a5f18e55e1d6 100644 --- a/PhysicsTools/TagAndProbe/plugins/ObjectViewCleaner.cc +++ b/PhysicsTools/TagAndProbe/plugins/ObjectViewCleaner.cc @@ -117,8 +117,7 @@ ObjectViewCleaner::~ObjectViewCleaner() template void ObjectViewCleaner::produce(edm::Event& iEvent,const edm::EventSetup& iSetup) { - auto_ptr > - cleanObjects(new edm::RefToBaseVector()); + auto cleanObjects = std::make_unique>(); edm::Handle > candidates; iEvent.getByToken(srcCandsToken_,candidates); @@ -151,7 +150,7 @@ void ObjectViewCleaner::produce(edm::Event& iEvent,const edm::EventSetup& iSe nObjectsClean_+=cleanObjects->size(); delete [] isClean; - iEvent.put(cleanObjects); + iEvent.put(std::move(cleanObjects)); } diff --git a/PhysicsTools/TagAndProbe/plugins/ObjectViewMatcher.cc b/PhysicsTools/TagAndProbe/plugins/ObjectViewMatcher.cc index c3c2e1888ca9f..d8fbd4c1046fd 100644 --- a/PhysicsTools/TagAndProbe/plugins/ObjectViewMatcher.cc +++ b/PhysicsTools/TagAndProbe/plugins/ObjectViewMatcher.cc @@ -111,7 +111,7 @@ ObjectViewMatcher::~ObjectViewMatcher(){} template void ObjectViewMatcher::produce(edm::Event& iEvent,const edm::EventSetup& iSetup) { - std::auto_ptr > cleanObjects(new std::vector); + auto cleanObjects = std::make_unique>(); edm::Handle > candidates; iEvent.getByToken(srcCandsToken_,candidates); @@ -151,7 +151,7 @@ void ObjectViewMatcher::produce(edm::Event& iEvent,const edm::EventSetup nObjectsMatch_+=cleanObjects->size(); delete [] isMatch; - iEvent.put(cleanObjects); + iEvent.put(std::move(cleanObjects)); } diff --git a/PhysicsTools/TagAndProbe/plugins/OtherObjectVariableComputer.cc b/PhysicsTools/TagAndProbe/plugins/OtherObjectVariableComputer.cc index 8e90b9be6fd33..cebafb3fdd861 100644 --- a/PhysicsTools/TagAndProbe/plugins/OtherObjectVariableComputer.cc +++ b/PhysicsTools/TagAndProbe/plugins/OtherObjectVariableComputer.cc @@ -87,11 +87,11 @@ OtherObjectVariableComputer::produce(edm::Event & iEvent, const edm::EventSet std::vector values(probes->size(), (selected.empty() ? default_ : selected.back().second)); // convert into ValueMap and store - std::auto_ptr > valMap(new ValueMap()); + auto valMap = std::make_unique>(); ValueMap::Filler filler(*valMap); filler.insert(probes, values.begin(), values.end()); filler.fill(); - iEvent.put(valMap); + iEvent.put(std::move(valMap)); } diff --git a/PhysicsTools/TagAndProbe/plugins/ProbeMulteplicityProducer.cc b/PhysicsTools/TagAndProbe/plugins/ProbeMulteplicityProducer.cc index f891643471d32..c42d38c72712c 100644 --- a/PhysicsTools/TagAndProbe/plugins/ProbeMulteplicityProducer.cc +++ b/PhysicsTools/TagAndProbe/plugins/ProbeMulteplicityProducer.cc @@ -80,11 +80,11 @@ ProbeMulteplicityProducer::produce(edm::Event & iEvent, const edm::EventSetup & } // convert into ValueMap and store - std::auto_ptr > valMap(new ValueMap()); + auto valMap = std::make_unique>(); ValueMap::Filler filler(*valMap); filler.insert(pairs, values.begin(), values.end()); filler.fill(); - iEvent.put(valMap); + iEvent.put(std::move(valMap)); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/PhysicsTools/TagAndProbe/plugins/ProbeTreeProducer.cc b/PhysicsTools/TagAndProbe/plugins/ProbeTreeProducer.cc index 177c04bfcf886..5375895c6725c 100644 --- a/PhysicsTools/TagAndProbe/plugins/ProbeTreeProducer.cc +++ b/PhysicsTools/TagAndProbe/plugins/ProbeTreeProducer.cc @@ -53,7 +53,7 @@ class ProbeTreeProducer : public edm::EDFilter { int32_t maxProbes_; /// The object that actually computes variables and fills the tree for the probe - std::auto_ptr probeFiller_; + std::unique_ptr probeFiller_; }; ProbeTreeProducer::ProbeTreeProducer(const edm::ParameterSet& iConfig) : diff --git a/PhysicsTools/TagAndProbe/plugins/TagProbeFitTreeProducer.cc b/PhysicsTools/TagAndProbe/plugins/TagProbeFitTreeProducer.cc index b740e4c1f2833..028d91ee77c40 100644 --- a/PhysicsTools/TagAndProbe/plugins/TagProbeFitTreeProducer.cc +++ b/PhysicsTools/TagAndProbe/plugins/TagProbeFitTreeProducer.cc @@ -76,13 +76,13 @@ class TagProbeFitTreeProducer : public edm::EDAnalyzer { /// The object that produces pairs of tags and probes, making any arbitration needed tnp::TagProbePairMaker tagProbePairMaker_; /// The object that actually computes variables and fills the tree for T&P - std::auto_ptr treeFiller_; + std::unique_ptr treeFiller_; /// The object that actually computes variables and fills the tree for unbiased MC - std::auto_ptr mcUnbiasFiller_; - std::auto_ptr oldTagFiller_; - std::auto_ptr tagFiller_; - std::auto_ptr pairFiller_; - std::auto_ptr mcFiller_; + std::unique_ptr mcUnbiasFiller_; + std::unique_ptr oldTagFiller_; + std::unique_ptr tagFiller_; + std::unique_ptr pairFiller_; + std::unique_ptr mcFiller_; }; // diff --git a/PhysicsTools/TagAndProbe/src/TagProbeFitter.cc b/PhysicsTools/TagAndProbe/src/TagProbeFitter.cc index ddf965a2791ca..0bbf6bee9797f 100644 --- a/PhysicsTools/TagAndProbe/src/TagProbeFitter.cc +++ b/PhysicsTools/TagAndProbe/src/TagProbeFitter.cc @@ -381,10 +381,10 @@ void TagProbeFitter::doFitEfficiency(RooWorkspace* w, string pdfName, RooRealVar createPdf(w, pdfs[pdfName]); //set the initial values for the yields of signal and background setInitialValues(w); - std::auto_ptr res(0); + std::unique_ptr res; RooAbsData *data = w->data("data"); - std::auto_ptr bdata; + std::unique_ptr bdata; if (binnedFit) { // get variables from data, which contain also other binning or expression variables const RooArgSet *dataObs = data->get(0); @@ -617,7 +617,7 @@ void TagProbeFitter::saveFitPlot(RooWorkspace* w){ RooAbsData* dataPass = dataAll->reduce(Cut("_efficiencyCategory_==_efficiencyCategory_::Passed")); RooAbsData* dataFail = dataAll->reduce(Cut("_efficiencyCategory_==_efficiencyCategory_::Failed")); RooAbsPdf& pdf = *w->pdf("simPdf"); - std::auto_ptr obs(pdf.getObservables(*dataAll)); + std::unique_ptr obs(pdf.getObservables(*dataAll)); RooRealVar* mass = 0; RooLinkedListIter it = obs->iterator(); for(RooAbsArg* v = (RooAbsArg*)it.Next(); v!=0; v = (RooAbsArg*)it.Next() ){ @@ -742,7 +742,7 @@ void TagProbeFitter::saveEfficiencyPlots(RooDataSet& eff, const TString& effName }else{ RooDataSet myEff(eff); myEff.addColumn(allCats2D); - std::auto_ptr catIt(allCats2D.typeIterator()); + std::unique_ptr catIt(allCats2D.typeIterator()); for(RooCatType* t = (RooCatType*)catIt->Next(); t!=0; t = (RooCatType*)catIt->Next() ){ TString catName = t->GetName(); if(catName.Contains("NotMapped")) continue; @@ -757,7 +757,7 @@ void TagProbeFitter::saveEfficiencyPlots(RooDataSet& eff, const TString& effName }else{ RooDataSet myEff(eff); myEff.addColumn(allCats1D); - std::auto_ptr catIt(allCats1D.typeIterator()); + std::unique_ptr catIt(allCats1D.typeIterator()); for(RooCatType* t = (RooCatType*)catIt->Next(); t!=0; t = (RooCatType*)catIt->Next() ){ TString catName = t->GetName(); if(catName.Contains("NotMapped")) continue; diff --git a/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc b/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc index 1fc5613a5c28b..2e4e537290f53 100644 --- a/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc +++ b/PhysicsTools/TagAndProbe/src/TriggerCandProducer.icc @@ -76,15 +76,13 @@ void TriggerCandProducer::produce(edm::Event &event, const edm::EventSet HLTConfigProvider const& hltConfig = hltPrescaleProvider_.hltConfigProvider(); // Create the output collection - std::auto_ptr< edm::RefToBaseVector > - outColRef( new edm::RefToBaseVector ); - //std::auto_ptr< edm::PtrVector > - // outColPtr( new edm::PtrVector ); + auto outColRef = std::make_unique>(); + //auto outColPtr = std::make_unique>(); //skip event if HLT paths do not have identical process names if (skipEvent_) { - event.put(outColRef); - //event.put(outColPtr); + event.put(std::move(outColRef)); + //event.put(std::move(outColPtr)); return; } @@ -198,8 +196,8 @@ void TriggerCandProducer::produce(edm::Event &event, const edm::EventSet edm::LogInfo("info")<< "******** Following Trigger Summary Object Not Found: " << triggerEventTag_; - event.put(outColRef); - // event.put(outColPtr); + event.put(std::move(outColRef)); + // event.put(std::move(outColPtr)); return; } @@ -293,7 +291,7 @@ void TriggerCandProducer::produce(edm::Event &event, const edm::EventSet if (isTriggerOR_) continue; // edm::LogInfo("info")<< "******** Following TRIGGER Name Not in Dataset: " << // theRightHLTTag_.label(); - // event.put(outColRef); + // event.put(std::move(outColRef)); // return; } else { @@ -344,12 +342,12 @@ void TriggerCandProducer::produce(edm::Event &event, const edm::EventSet if(!foundPath) { edm::LogInfo("info")<< "******** Following TRIGGER Name Not in Dataset: " << theRightHLTTag_.label(); - event.put(outColRef); + event.put(std::move(outColRef)); return; } - event.put(outColRef); - // event.put(outColPtr); + event.put(std::move(outColRef)); + // event.put(std::move(outColPtr)); } diff --git a/PhysicsTools/UtilAlgos/interface/EDFilterObjectWrapper.h b/PhysicsTools/UtilAlgos/interface/EDFilterObjectWrapper.h index 87a8ff01ea490..6a6353d6e08a4 100644 --- a/PhysicsTools/UtilAlgos/interface/EDFilterObjectWrapper.h +++ b/PhysicsTools/UtilAlgos/interface/EDFilterObjectWrapper.h @@ -69,7 +69,7 @@ namespace edm { /// everything which has to be done during the event loop. NOTE: We can't use the eventSetup in FWLite so ignore it virtual bool filter(edm::Event& event, const edm::EventSetup& eventSetup) override { // create a collection of the objects to put into the event - std::auto_ptr objsToPut( new C() ); + auto objsToPut = std::make_unique(); // get the handle to the objects in the event. edm::Handle h_c; event.getByToken( src_, h_c ); @@ -81,7 +81,7 @@ namespace edm { } // put objs in the event bool pass = objsToPut->size() > 0; - event.put(objsToPut); + event.put(std::move(objsToPut)); if ( doFilter_ ) return pass; else diff --git a/PhysicsTools/UtilAlgos/interface/NtpProducer.h b/PhysicsTools/UtilAlgos/interface/NtpProducer.h index 195b7bcf045a6..5f0fab84a092f 100755 --- a/PhysicsTools/UtilAlgos/interface/NtpProducer.h +++ b/PhysicsTools/UtilAlgos/interface/NtpProducer.h @@ -62,12 +62,12 @@ void NtpProducer::produce( edm::Event& iEvent, const edm::EventSetup& ) { typename std::vector > >::const_iterator q = tags_.begin(), end = tags_.end(); for(;q!=end; ++q) { - std::auto_ptr > x(new std::vector); + auto x = std::make_unique>(); x->reserve(coll->size()); for (typename C::const_iterator elem=coll->begin(); elem!=coll->end(); ++elem ) { x->push_back(q->second(*elem)); } - iEvent.put(x, q->first); + iEvent.put(std::move(x), q->first); } } diff --git a/PhysicsTools/UtilAlgos/interface/StoreManagerTrait.h b/PhysicsTools/UtilAlgos/interface/StoreManagerTrait.h index 98f0ed92bf696..1896fc4cfbd16 100755 --- a/PhysicsTools/UtilAlgos/interface/StoreManagerTrait.h +++ b/PhysicsTools/UtilAlgos/interface/StoreManagerTrait.h @@ -28,7 +28,7 @@ namespace helper { template struct IteratorToObjectConverter > { - typedef std::auto_ptr value_type; + typedef std::unique_ptr value_type; template static value_type convert( const I & i ) { return value_type( (*i)->clone() ); @@ -66,15 +66,15 @@ namespace helper { /* template struct OutputCollectionCreator { - static std::auto_ptr createNewCollection( const edm::Handle & ) { - return std::auto_ptr( new OutputCollection ); + static std::unique_ptr createNewCollection( const edm::Handle & ) { + return std::make_unique(); } }; template struct OutputCollectionCreator, InputCollection> { - static std::auto_ptr > createNewCollection( const edm::Handle & h ) { - return std::auto_ptr >( new edm::RefToBaseVector(h) ); + static std::unique_ptr > createNewCollection( const edm::Handle & h ) { + return std::make_unique >(h); } }; */ @@ -105,12 +105,12 @@ namespace helper { selected_->push_back( v ); } } - edm::OrphanHandle put( edm::Event & evt ) { - return evt.put( selected_ ); + edm::OrphanHandle put(edm::Event & evt) { + return evt.put(selected_); } size_t size() const { return selected_->size(); } private: - std::auto_ptr selected_; + std::unique_ptr selected_; }; template diff --git a/PhysicsTools/UtilAlgos/interface/StringBasedNTupler.h b/PhysicsTools/UtilAlgos/interface/StringBasedNTupler.h index b65f12bb8335b..4ddf2b71f9410 100644 --- a/PhysicsTools/UtilAlgos/interface/StringBasedNTupler.h +++ b/PhysicsTools/UtilAlgos/interface/StringBasedNTupler.h @@ -69,7 +69,7 @@ class TreeBranch { return std::string(name.c_str());} const std::string & branchAlias()const{ return branchAlias_;} const std::string & branchTitle()const{ return branchTitle_;} - typedef std::auto_ptr > value; + typedef std::unique_ptr > value; value branch(const edm::Event& iEvent); std::vector** dataHolderPtrAdress() { return &dataHolderPtr_;} @@ -93,7 +93,7 @@ template class StringLeaveHelper { public: typedef TreeBranch::value value; - value operator()() { return value_;} + value operator()() { return std::move(value_);} StringLeaveHelper(const TreeBranch & B, const edm::Event& iEvent) { @@ -127,7 +127,7 @@ template > class StringBranchHelper { public: typedef TreeBranch::value value; - value operator()() { return value_;} + value operator()() { return std::move(value_);} StringBranchHelper(const TreeBranch & B, const edm::Event& iEvent) { @@ -385,12 +385,12 @@ class StringBasedNTupler : public NTupler { for(;iL!=iL_end;++iL){ TreeBranch & b=*iL; // grab the vector of values from the interpretation of expression for the associated collection - std::auto_ptr > branch(b.branch(iEvent)); + std::unique_ptr > branch(b.branch(iEvent)); // calculate the maximum index size. if (branch->size()>maxS) maxS=branch->size(); - // transfer of (no copy) pointer to the vector of float from the auto_ptr to the tree data pointer + // transfer of (no copy) pointer to the vector of float from the std::unique_ptr to the tree data pointer b.assignDataHolderPtr(branch.release()); - // for memory tracing, object b is holding the data (not auto_ptr) and should delete it for each event (that's not completely optimum) + // for memory tracing, object b is holding the data (not std::unique_ptr) and should delete it for each event (that's not completely optimum) } //assigne the maximum vector size for this collection indexDataHolder_[indexOfIndexInDataHolder]=maxS; @@ -442,13 +442,12 @@ class StringBasedNTupler : public NTupler { uint maxS=0; for(;iL!=iL_end;++iL){ TreeBranch & b=*iL; - std::auto_ptr > branch(b.branch(iEvent)); + std::unique_ptr > branch(b.branch(iEvent)); if (branch->size()>maxS) maxS=branch->size(); - iEvent.put(branch, b.branchName()); + iEvent.put(std::move(branch), b.branchName()); } //index should be put only once per branch. doe not really mattter for edm root files - std::auto_ptr maxN(new uint(maxS)); - iEvent.put(maxN, iB->first); + iEvent.put(std::make_unique(maxS), iB->first); } } } diff --git a/PhysicsTools/UtilAlgos/interface/VariableNTupler.h b/PhysicsTools/UtilAlgos/interface/VariableNTupler.h index 50be1838c91fe..2bb16bce98735 100644 --- a/PhysicsTools/UtilAlgos/interface/VariableNTupler.h +++ b/PhysicsTools/UtilAlgos/interface/VariableNTupler.h @@ -116,10 +116,10 @@ class VariableNTupler : public NTupler{ iterator i=leaves_.begin(); iterator i_end=leaves_.end(); for(;i!=i_end;++i){ - std::auto_ptr leafValue(new double((*i->second)(iEvent))); + auto leafValue = std::make_unique((*i->second)(iEvent)); std::string lName(i->first); std::replace(lName.begin(), lName.end(),'_','0'); - iEvent.put(leafValue, lName.c_str()); + iEvent.put(std::move(leafValue), lName.c_str()); } } } diff --git a/PhysicsTools/UtilAlgos/plugins/ConfigurableAnalysis.cc b/PhysicsTools/UtilAlgos/plugins/ConfigurableAnalysis.cc index 8c1c9ce26efeb..224fd6a96ec28 100644 --- a/PhysicsTools/UtilAlgos/plugins/ConfigurableAnalysis.cc +++ b/PhysicsTools/UtilAlgos/plugins/ConfigurableAnalysis.cc @@ -130,7 +130,7 @@ bool ConfigurableAnalysis::filter(edm::Event& iEvent, const edm::EventSetup& iSe //will the filter pass or not. bool majorGlobalAccept=false; - std::auto_ptr > passedProduct(new std::vector(flows_.size(),false)); + auto passedProduct = std::make_unique>(flows_.size(),false); bool filledOnce=false; // loop the requested selections @@ -205,7 +205,7 @@ bool ConfigurableAnalysis::filter(edm::Event& iEvent, const edm::EventSetup& iSe }//loop the different filter order/number: loop the Selections - iEvent.put(passedProduct); + iEvent.put(std::move(passedProduct)); if (workAsASelector_) return majorGlobalAccept; else diff --git a/PhysicsTools/UtilAlgos/plugins/NTuplingDevice.cc b/PhysicsTools/UtilAlgos/plugins/NTuplingDevice.cc index dfe01d97f4ebc..837f8c904f78b 100644 --- a/PhysicsTools/UtilAlgos/plugins/NTuplingDevice.cc +++ b/PhysicsTools/UtilAlgos/plugins/NTuplingDevice.cc @@ -82,8 +82,7 @@ void NTuplingDevice::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { ntupler_->fill(iEvent); - std::auto_ptr v(new double(0)); - iEvent.put(v,"dummy"); + iEvent.put(std::make_unique(0.),"dummy"); } // ------------ method called once each job just before starting event loop ------------