Skip to content

Commit

Permalink
Use unique_ptr, not auto_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
wmtan committed Jun 2, 2016
1 parent d0b7bad commit 24c77f7
Show file tree
Hide file tree
Showing 116 changed files with 632 additions and 632 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SiStripProcessedRawDigiProducer::SiStripProcessedRawDigiProducer(edm::ParameterS
void SiStripProcessedRawDigiProducer::
produce(edm::Event& e, const edm::EventSetup& es) {

std::auto_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
std::unique_ptr< edm::DetSetVector<SiStripProcessedRawDigi> > output(new edm::DetSetVector<SiStripProcessedRawDigi>());
edm::Handle< edm::DetSetVector<SiStripDigi> > inputDigis;
edm::Handle< edm::DetSetVector<SiStripRawDigi> > inputRawdigis;

Expand All @@ -45,7 +45,7 @@ produce(edm::Event& e, const edm::EventSetup& es) {
else
edm::LogError("Input Not Found");

e.put(output);
e.put(std::move(output));
}

template<class T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class SiStripProcessedRawDigiProducer : public edm::EDProducer {
std::vector<edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > > inputTokensRawDigi;
edm::ESHandle<SiStripGain> gainHandle;

std::auto_ptr<SiStripPedestalsSubtractor> subtractorPed;
std::auto_ptr<SiStripCommonModeNoiseSubtractor> subtractorCMN;
std::unique_ptr<SiStripPedestalsSubtractor> subtractorPed;
std::unique_ptr<SiStripCommonModeNoiseSubtractor> subtractorCMN;

};
#endif
Expand Down
16 changes: 8 additions & 8 deletions AnalysisAlgos/TrackInfoProducer/src/TrackInfoProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set
// create empty output collections
//

std::auto_ptr<reco::TrackInfoCollection> outputColl (new reco::TrackInfoCollection);
std::unique_ptr<reco::TrackInfoCollection> outputColl (new reco::TrackInfoCollection);

edm::Handle<std::vector<Trajectory> > TrajectoryCollection;
edm::Handle<reco::TrackCollection > trackCollection;
Expand Down Expand Up @@ -65,19 +65,19 @@ void TrackInfoProducer::produce(edm::Event& theEvent, const edm::EventSetup& set
//put everything in the event
edm::OrphanHandle<reco::TrackInfoCollection> rTrackInfo;

// if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(outputFwdColl,forwardPredictedStateTag_ );
// if(backwardPredictedStateTag_!="") rTrackInfob = theEvent.put(outputBwdColl,backwardPredictedStateTag_);
// if(updatedStateTag_!="") rTrackInfou = theEvent.put(outputUpdatedColl,updatedStateTag_ );
// if(combinedStateTag_!="") rTrackInfoc = theEvent.put(outputCombinedColl,combinedStateTag_ );
rTrackInfo=theEvent.put(outputColl);
std::auto_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl (new reco::TrackInfoTrackAssociationCollection(assoMap->refProd().val, rTrackInfo));
// if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(std::move(outputFwdColl),forwardPredictedStateTag_ );
// if(backwardPredictedStateTag_!="") rTrackInfob = theEvent.put(std::move(outputBwdColl),backwardPredictedStateTag_);
// if(updatedStateTag_!="") rTrackInfou = theEvent.put(std::move(outputUpdatedColl),updatedStateTag_ );
// if(combinedStateTag_!="") rTrackInfoc = theEvent.put(std::move(outputCombinedColl),combinedStateTag_ );
rTrackInfo=theEvent.put(std::move(outputColl));
std::unique_ptr<reco::TrackInfoTrackAssociationCollection> TIassociationColl (new reco::TrackInfoTrackAssociationCollection(assoMap->refProd().val, rTrackInfo));

for(std::map<reco::TrackRef,unsigned int>::iterator ref_iter=trackid.begin();ref_iter!=trackid.end();++ref_iter){

TIassociationColl->insert( ref_iter->first,edm::Ref<reco::TrackInfoCollection>(rTrackInfo,ref_iter->second ));
}

theEvent.put(TIassociationColl);
theEvent.put(std::move(TIassociationColl));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ APVCyclePhaseProducerFromL1ABC::produce(edm::Event& iEvent, const edm::EventSetu

using namespace edm;

std::auto_ptr<APVCyclePhaseCollection> apvphases(new APVCyclePhaseCollection() );
std::unique_ptr<APVCyclePhaseCollection> apvphases(new APVCyclePhaseCollection() );


const std::vector<int>& phases = _defphases;
Expand Down Expand Up @@ -278,7 +278,7 @@ APVCyclePhaseProducerFromL1ABC::produce(edm::Event& iEvent, const edm::EventSetu
}


iEvent.put(apvphases);
iEvent.put(std::move(apvphases));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ APVCyclePhaseProducerFromL1TS::produce(edm::Event& iEvent, const edm::EventSetup

using namespace edm;

std::auto_ptr<APVCyclePhaseCollection> apvphases(new APVCyclePhaseCollection() );
std::unique_ptr<APVCyclePhaseCollection> apvphases(new APVCyclePhaseCollection() );


std::vector<int> phases(_defphases.size(),APVCyclePhaseCollection::invalid);
Expand Down Expand Up @@ -263,7 +263,7 @@ APVCyclePhaseProducerFromL1TS::produce(edm::Event& iEvent, const edm::EventSetup
}


iEvent.put(apvphases);
iEvent.put(std::move(apvphases));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ ByMultiplicityEventFilter<T>::filter(edm::Event& iEvent, const edm::EventSetup&
m_multiplicities.getEvent(iEvent,iSetup);

bool value = m_selector(m_multiplicities);
iEvent.put( std::auto_ptr<bool>(new bool(value)) );
iEvent.put(std::unique_ptr<bool>(new bool(value)));

if(m_taggedMode) return m_forcedValue;
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ ConfigurableAPVCyclePhaseProducer::produce(edm::Event& iEvent, const edm::EventS

using namespace edm;

std::auto_ptr<APVCyclePhaseCollection> apvphases(new APVCyclePhaseCollection(_currapvphases) );
std::unique_ptr<APVCyclePhaseCollection> apvphases(new APVCyclePhaseCollection(_currapvphases) );

iEvent.put(apvphases);
iEvent.put(std::move(apvphases));

}

Expand Down
4 changes: 2 additions & 2 deletions DPGAnalysis/SiStripTools/plugins/EventWithHistoryProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ EventWithHistoryProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe

using namespace edm;

std::auto_ptr<EventWithHistory> heOut(new EventWithHistory(iEvent.id().event(),iEvent.orbitNumber(),iEvent.bunchCrossing()));
std::unique_ptr<EventWithHistory> heOut(new EventWithHistory(iEvent.id().event(),iEvent.orbitNumber(),iEvent.bunchCrossing()));
heOut->add(_prevHE,_depth);

if(*heOut < _prevHE) edm::LogInfo("EventsNotInOrder") << " Events not in order " << _prevHE._event;

_prevHE = *heOut;
iEvent.put(heOut);
iEvent.put(std::move(heOut));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ EventWithHistoryProducerFromL1ABC::produce(edm::Event& iEvent, const edm::EventS

if(iEvent.run() < 110878 ) {

std::auto_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent));
iEvent.put(pOut);
std::unique_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent));
iEvent.put(std::move(pOut));

}
else {
Expand All @@ -130,8 +130,8 @@ EventWithHistoryProducerFromL1ABC::produce(edm::Event& iEvent, const edm::EventS
}


std::auto_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent,*pIn,orbitoffset,bxoffset));
iEvent.put(pOut);
std::unique_ptr<EventWithHistory> pOut(new EventWithHistory(iEvent,*pIn,orbitoffset,bxoffset));
iEvent.put(std::move(pOut));

// monitor offset

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ FromClusterSummaryMultiplicityProducer::produce(edm::Event& iEvent, const edm::E

using namespace edm;

std::auto_ptr<std::map<unsigned int,int> > mults(new std::map<unsigned int,int> );
std::unique_ptr<std::map<unsigned int,int> > mults(new std::map<unsigned int,int> );


Handle<ClusterSummary> clustsumm;
Expand Down Expand Up @@ -142,7 +142,7 @@ FromClusterSummaryMultiplicityProducer::produce(edm::Event& iEvent, const edm::E
LogDebug("Multiplicity") << " Found " << it->second << " digis/clusters in " << it->first;
}

iEvent.put(mults);
iEvent.put(std::move(mults));

}

Expand Down
4 changes: 2 additions & 2 deletions DPGAnalysis/SiStripTools/plugins/MultiplicityProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ MultiplicityProducer<T>::produce(edm::Event& iEvent, const edm::EventSetup& iSet

using namespace edm;

std::auto_ptr<std::map<unsigned int,int> > mults(new std::map<unsigned int,int> );
std::unique_ptr<std::map<unsigned int,int> > mults(new std::map<unsigned int,int> );


Handle<T> digis;
Expand Down Expand Up @@ -158,7 +158,7 @@ MultiplicityProducer<T>::produce(edm::Event& iEvent, const edm::EventSetup& iSet
LogDebug("Multiplicity") << " Found " << it->second << " digis/clusters in " << it->first << " " << m_subdets[it->first];
}

iEvent.put(mults);
iEvent.put(std::move(mults));

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ void CalibratedElectronProducer::produce( edm::Event & event, const edm::EventSe
event.getByToken(energyErrorRegToken_,valMapEnergyErrorH);

// Prepare output collections
std::auto_ptr<reco::GsfElectronCollection> electrons( new reco::GsfElectronCollection ) ;
std::unique_ptr<reco::GsfElectronCollection> electrons( new reco::GsfElectronCollection ) ;
// Fillers for ValueMaps:
std::auto_ptr<edm::ValueMap<double> > regrNewEnergyMap(new edm::ValueMap<double>() );
std::unique_ptr<edm::ValueMap<double> > regrNewEnergyMap(new edm::ValueMap<double>() );
edm::ValueMap<double>::Filler energyFiller(*regrNewEnergyMap);

std::auto_ptr<edm::ValueMap<double> > regrNewEnergyErrorMap(new edm::ValueMap<double>() );
std::unique_ptr<edm::ValueMap<double> > regrNewEnergyErrorMap(new edm::ValueMap<double>() );
edm::ValueMap<double>::Filler energyErrorFiller(*regrNewEnergyErrorMap);

// first clone the initial collection
Expand Down Expand Up @@ -362,14 +362,14 @@ void CalibratedElectronProducer::produce( edm::Event & event, const edm::EventSe
}

// Save the electrons
const edm::OrphanHandle<reco::GsfElectronCollection> gsfNewElectronHandle = event.put(electrons, newElectronName_) ;
const edm::OrphanHandle<reco::GsfElectronCollection> gsfNewElectronHandle = event.put(std::move(electrons), newElectronName_) ;
energyFiller.insert(gsfNewElectronHandle,regressionValues.begin(),regressionValues.end());
energyFiller.fill();
energyErrorFiller.insert(gsfNewElectronHandle,regressionErrorValues.begin(),regressionErrorValues.end());
energyErrorFiller.fill();

event.put(regrNewEnergyMap,nameNewEnergyReg_);
event.put(regrNewEnergyErrorMap,nameNewEnergyErrorReg_);
event.put(std::move(regrNewEnergyMap),nameNewEnergyReg_);
event.put(std::move(regrNewEnergyErrorMap),nameNewEnergyErrorReg_);
}

#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void CalibratedPatElectronProducer::produce( edm::Event & event, const edm::Even

edm::Handle<edm::View<reco::Candidate> > oldElectrons ;
event.getByToken(inputPatElectronsToken,oldElectrons) ;
std::auto_ptr<pat::ElectronCollection> electrons( new pat::ElectronCollection ) ;
std::unique_ptr<pat::ElectronCollection> electrons( new pat::ElectronCollection ) ;
pat::ElectronCollection::const_iterator electron ;
pat::ElectronCollection::iterator ele ;
// first clone the initial collection
Expand Down Expand Up @@ -318,7 +318,7 @@ void CalibratedPatElectronProducer::produce( edm::Event & event, const edm::Even
}
}
// Save the electrons
event.put(electrons) ;
event.put(std::move(electrons));
}

#include "FWCore/Framework/interface/MakerMacros.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ CalibratedPhotonProducerRun2T<T>::produce( edm::Event & iEvent, const edm::Event
edm::Handle<edm::View<T> > in;
iEvent.getByToken(thePhotonToken, in);

std::auto_ptr<std::vector<T> > out(new std::vector<T>());
std::unique_ptr<std::vector<T> > out(new std::vector<T>());
out->reserve(in->size());

for (const T &ele : *in) {
out->push_back(ele);
theEnCorrectorRun2.calibrate(out->back(), iEvent.id().run(), iEvent.streamID());
}

iEvent.put(out);
iEvent.put(std::move(out));
}

typedef CalibratedPhotonProducerRun2T<reco::Photon> CalibratedPhotonProducerRun2;
Expand Down
4 changes: 2 additions & 2 deletions EgammaAnalysis/ElectronTools/plugins/ElectronIdMVAProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ ElectronIdMVAProducer::~ElectronIdMVAProducer()
// ------------ method called on each new Event ------------
bool ElectronIdMVAProducer::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {

std::auto_ptr<edm::ValueMap<float> > out(new edm::ValueMap<float>() );
std::unique_ptr<edm::ValueMap<float> > out(new edm::ValueMap<float>() );

edm::Handle<reco::VertexCollection> vertexCollection;
iEvent.getByToken(vertexToken_, vertexCollection);
Expand Down Expand Up @@ -162,7 +162,7 @@ bool ElectronIdMVAProducer::filter(edm::Event& iEvent, const edm::EventSetup& iS
filler.insert(egCollection, values.begin(), values.end() );
filler.fill();

iEvent.put(out);
iEvent.put(std::move(out));

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ElectronIsolatorFromEffectiveArea(const edm::ParameterSet& config)
bool ElectronIsolatorFromEffectiveArea::
filter(edm::Event& event, const edm::EventSetup& )
{
std::auto_ptr<CandDoubleMap> product(new CandDoubleMap());
std::unique_ptr<CandDoubleMap> product(new CandDoubleMap());
CandDoubleMap::Filler filler(*product);

edm::Handle<double> rho; event.getByToken(rhoIsoToken, rho);
Expand Down Expand Up @@ -94,7 +94,7 @@ filter(edm::Event& event, const edm::EventSetup& )
}

filler.fill();
event.put(product);
event.put(std::move(product));
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ElectronPATIdMVAProducer::~ElectronPATIdMVAProducer()
// ------------ method called on each new Event ------------
void ElectronPATIdMVAProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {

std::auto_ptr<edm::ValueMap<float> > out(new edm::ValueMap<float>() );
std::unique_ptr<edm::ValueMap<float> > out(new edm::ValueMap<float>() );



Expand Down Expand Up @@ -138,7 +138,7 @@ void ElectronPATIdMVAProducer::produce(edm::Event& iEvent, const edm::EventSetup
filler.insert(egCollection, values.begin(), values.end() );
filler.fill();

iEvent.put(out);
iEvent.put(std::move(out));


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ bool ElectronRegressionEnergyProducer::filter(edm::Event& iEvent, const edm::Eve
geomInitialized_ = true;
}

std::auto_ptr<edm::ValueMap<double> > regrEnergyMap(new edm::ValueMap<double>() );
std::unique_ptr<edm::ValueMap<double> > regrEnergyMap(new edm::ValueMap<double>() );
edm::ValueMap<double>::Filler energyFiller(*regrEnergyMap);

std::auto_ptr<edm::ValueMap<double> > regrEnergyErrorMap(new edm::ValueMap<double>() );
std::unique_ptr<edm::ValueMap<double> > regrEnergyErrorMap(new edm::ValueMap<double>() );
edm::ValueMap<double>::Filler energyErrorFiller(*regrEnergyErrorMap);

edm::Handle<reco::GsfElectronCollection> egCollection;
Expand Down Expand Up @@ -202,8 +202,8 @@ bool ElectronRegressionEnergyProducer::filter(edm::Event& iEvent, const edm::Eve
energyErrorFiller.insert( egCollection, energyErrorValues.begin(), energyErrorValues.end() );
energyErrorFiller.fill();

iEvent.put(regrEnergyMap,nameEnergyReg_);
iEvent.put(regrEnergyErrorMap,nameEnergyErrorReg_);
iEvent.put(std::move(regrEnergyMap),nameEnergyReg_);
iEvent.put(std::move(regrEnergyErrorMap),nameEnergyErrorReg_);

return true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void PatElectronEAIsoCorrectionProducer::produce( edm::Event& iEvent, const edm:
edm::Handle< edm::ValueMap< double > > eaIsolator;
iEvent.getByToken( eaIsolatorToken_, eaIsolator );

std::auto_ptr< pat::ElectronCollection > updatedPatElectrons( new pat::ElectronCollection );
std::unique_ptr< pat::ElectronCollection > updatedPatElectrons( new pat::ElectronCollection );

for ( size_t iElectron = 0; iElectron < patElectrons->size(); ++iElectron ) {
pat::Electron* updatedPatElectron = patElectrons->at( iElectron ).clone();
Expand All @@ -42,7 +42,7 @@ void PatElectronEAIsoCorrectionProducer::produce( edm::Event& iEvent, const edm:
updatedPatElectrons->push_back( *updatedPatElectron );
}

iEvent.put( updatedPatElectrons );
iEvent.put(std::move(updatedPatElectrons));
}


Expand Down
12 changes: 6 additions & 6 deletions EgammaAnalysis/ElectronTools/plugins/PhotonIsoProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ PhotonIsoProducer::~PhotonIsoProducer()
// ------------ method called on each new Event ------------
bool PhotonIsoProducer::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {

std::auto_ptr<edm::ValueMap<double> > chIsoMap(new edm::ValueMap<double>() );
std::unique_ptr<edm::ValueMap<double> > chIsoMap(new edm::ValueMap<double>() );
edm::ValueMap<double>::Filler chFiller(*chIsoMap);

std::auto_ptr<edm::ValueMap<double> > phIsoMap(new edm::ValueMap<double>() );
std::unique_ptr<edm::ValueMap<double> > phIsoMap(new edm::ValueMap<double>() );
edm::ValueMap<double>::Filler phFiller(*phIsoMap);

std::auto_ptr<edm::ValueMap<double> > nhIsoMap(new edm::ValueMap<double>() );
std::unique_ptr<edm::ValueMap<double> > nhIsoMap(new edm::ValueMap<double>() );
edm::ValueMap<double>::Filler nhFiller(*nhIsoMap);

edm::Handle<reco::VertexCollection> vertexCollection;
Expand Down Expand Up @@ -154,9 +154,9 @@ bool PhotonIsoProducer::filter(edm::Event& iEvent, const edm::EventSetup& iSetup
nhFiller.fill();


iEvent.put(chIsoMap,nameIsoCh_);
iEvent.put(phIsoMap,nameIsoPh_);
iEvent.put(nhIsoMap,nameIsoNh_);
iEvent.put(std::move(chIsoMap),nameIsoCh_);
iEvent.put(std::move(phIsoMap),nameIsoPh_);
iEvent.put(std::move(nhIsoMap),nameIsoNh_);


return true;
Expand Down
Loading

0 comments on commit 24c77f7

Please sign in to comment.