Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MuonAnalysis/MomentumScaleCalibration: replace auto_ptr removed in strict std=c++17 #24725

Merged
merged 1 commit into from Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -32,7 +32,7 @@ lorentzVector fromPtEtaPhiToPxPyPz( const double* ptEtaPhiE )

// lorentzVector corrMu(px,py,pz,E);
// To fix memory leaks, this is to be substituted with
// std::auto_ptr<lorentzVector> corrMu(new lorentzVector(px, py, pz, E));
// std::unique_ptr<lorentzVector> corrMu(new lorentzVector(px, py, pz, E));

return lorentzVector(px,py,pz,E);
}
Expand Down
2 changes: 1 addition & 1 deletion MuonAnalysis/MomentumScaleCalibration/plugins/DBReader.h
Expand Up @@ -57,7 +57,7 @@ class DBReader : public edm::EDAnalyzer

// uint32_t printdebug_;
std::string type_;
//std::auto_ptr<BaseFunction> corrector_;
//std::unique_ptr<BaseFunction> corrector_;
boost::shared_ptr<MomentumScaleCorrector> corrector_;
boost::shared_ptr<ResolutionFunction> resolution_;
boost::shared_ptr<BackgroundFunction> background_;
Expand Down
2 changes: 1 addition & 1 deletion MuonAnalysis/MomentumScaleCalibration/plugins/DBWriter.h
Expand Up @@ -20,5 +20,5 @@ class DBWriter : public edm::EDAnalyzer {
void analyze(const edm::Event&, const edm::EventSetup&) override;
void endJob() override {};

std::auto_ptr<BaseFunction> corrector_;
std::unique_ptr<BaseFunction> corrector_;
};
4 changes: 2 additions & 2 deletions MuonAnalysis/MomentumScaleCalibration/plugins/Histograms.h
Expand Up @@ -2270,8 +2270,8 @@ class HMassResolutionVSPart : public Histograms
protected:
std::map<TString, TH1*> mapHisto_;
TString nameSuffix_[2];
std::auto_ptr<HDelta> muMinus;
std::auto_ptr<HDelta> muPlus;
std::unique_ptr<HDelta> muMinus;
std::unique_ptr<HDelta> muPlus;
};

#endif
4 changes: 2 additions & 2 deletions MuonAnalysis/MomentumScaleCalibration/plugins/MuScleFit.cc
Expand Up @@ -309,7 +309,7 @@ class MuScleFit: public edm::EDLooper, MuScleFitBase
edm::InputTag puInfoSrc_;
edm::InputTag vertexSrc_;

std::auto_ptr<MuScleFitMuonSelector> muonSelector_;
std::unique_ptr<MuScleFitMuonSelector> muonSelector_;
};

template<typename T>
Expand Down Expand Up @@ -783,7 +783,7 @@ edm::EDLooper::Status MuScleFit::duringLoop( const edm::Event & event, const edm
//event.getByLabel(InputTag(triggerResultsLabel_),triggerResults);
bool isFired = false;

if(triggerPath_[0] == "")
if(triggerPath_[0].empty())
isFired = true;
else if(triggerPath_[0] == "All"){
isFired =triggerResults->accept();
Expand Down
Expand Up @@ -122,7 +122,7 @@ bool MuScleFitFilter::filter(edm::Event& event, const edm::EventSetup& iSetup) {

// Get the RecTrack and the RecMuon collection from the event
// ----------------------------------------------------------
std::auto_ptr<reco::MuonCollection> muons(new reco::MuonCollection());
std::unique_ptr<reco::MuonCollection> muons(new reco::MuonCollection());

if (debug) std::cout << "Looking for muons of the right kind" << std::endl;

Expand Down
Expand Up @@ -462,7 +462,7 @@ lorentzVector MuScleFitUtils::applyScale (const lorentzVector& muon,
{
double * p = new double[(int)(parval.size())];
// Replaced by auto_ptr, which handles delete at the end
// std::auto_ptr<double> p(new double[(int)(parval.size())]);
// std::unique_ptr<double> p(new double[(int)(parval.size())]);
// Removed auto_ptr, check massResolution for an explanation.
int id = 0;
for (std::vector<double>::const_iterator it=parval.begin(); it!=parval.end(); ++it, ++id) {
Expand Down Expand Up @@ -506,7 +506,7 @@ lorentzVector MuScleFitUtils::fromPtEtaPhiToPxPyPz( const double* ptEtaPhiE )

// lorentzVector corrMu(px,py,pz,E);
// To fix memory leaks, this is to be substituted with
// std::auto_ptr<lorentzVector> corrMu(new lorentzVector(px, py, pz, E));
// std::unique_ptr<lorentzVector> corrMu(new lorentzVector(px, py, pz, E));

return lorentzVector(px,py,pz,E);
}
Expand Down Expand Up @@ -534,7 +534,7 @@ double MuScleFitUtils::massResolution( const lorentzVector& mu1,
// not be used with arrays. There are alternatives see
// e.g.: http://www.gotw.ca/gotw/042.htm. The best
// alternative seems to be to switch to vector though.
// std::auto_ptr<double> p(new double[(int)(parval.size())]);
// std::unique_ptr<double> p(new double[(int)(parval.size())]);

double * p = new double[(int)(parval.size())];
std::vector<double>::const_iterator it = parval.begin();
Expand Down Expand Up @@ -711,7 +711,7 @@ double MuScleFitUtils::massProb( const double & mass, const double & resEta, con
double * p = new double[(int)(parval.size())];
// Replaced by auto_ptr, which handles delete at the end
// Removed auto_ptr, check massResolution for an explanation.
// std::auto_ptr<double> p(new double[(int)(parval.size())]);
// std::unique_ptr<double> p(new double[(int)(parval.size())]);

std::vector<double>::const_iterator it = parval.begin();
int id = 0;
Expand Down
Expand Up @@ -79,7 +79,7 @@ class MuScleFitUtils {
static double invDimuonMass( const lorentzVector & mu1, const lorentzVector & mu2 );
static double massResolution( const lorentzVector & mu1, const lorentzVector & mu2 );
static double massResolution( const lorentzVector & mu1, const lorentzVector & mu2, const std::vector<double> & parval );
static double massResolution( const lorentzVector & mu1, const lorentzVector & mu2, std::auto_ptr<double> parval );
static double massResolution( const lorentzVector & mu1, const lorentzVector & mu2, std::unique_ptr<double> parval );
static double massResolution( const lorentzVector & mu1, const lorentzVector & mu2, double* parval );
static double massResolution( const lorentzVector& mu1, const lorentzVector& mu2, const ResolutionFunction & resolFunc );

Expand Down
Expand Up @@ -123,9 +123,9 @@ class TestCorrection : public edm::EDAnalyzer, MuScleFitBase {

int eventCounter_;

std::auto_ptr<MomentumScaleCorrector> corrector_;
std::auto_ptr<ResolutionFunction> resolution_;
std::auto_ptr<BackgroundFunction> background_;
std::unique_ptr<MomentumScaleCorrector> corrector_;
std::unique_ptr<ResolutionFunction> resolution_;
std::unique_ptr<BackgroundFunction> background_;

edm::EDGetTokenT<reco::MuonCollection> glbMuonsToken_;
edm::EDGetTokenT<reco::TrackCollection> saMuonsToken_;
Expand Down
Expand Up @@ -119,9 +119,9 @@ class TestCorrection : public edm::EDAnalyzer, MuScleFitBase {

int eventCounter_;

std::auto_ptr<MomentumScaleCorrector> corrector_;
std::auto_ptr<ResolutionFunction> resolution_;
std::auto_ptr<BackgroundFunction> background_;
std::unique_ptr<MomentumScaleCorrector> corrector_;
std::unique_ptr<ResolutionFunction> resolution_;
std::unique_ptr<BackgroundFunction> background_;
};

#endif // TESTCORRECTION_HH
Expand Up @@ -91,7 +91,7 @@ class TestResolution : public edm::EDAnalyzer {

int eventCounter_;

std::auto_ptr<ResolutionFunction> resolutionFunction_;
std::unique_ptr<ResolutionFunction> resolutionFunction_;
};

#endif // TESTRESOLUTION_HH