diff --git a/src/classes/PRunBase.cpp b/src/classes/PRunBase.cpp index 1c71f7c2..8773a5f8 100644 --- a/src/classes/PRunBase.cpp +++ b/src/classes/PRunBase.cpp @@ -99,7 +99,7 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, fFuncValues.push_back(0.0); // generate theory - fTheory = new PTheory(fMsrInfo, runNo); + fTheory = std::make_unique(fMsrInfo, runNo); if (fTheory == nullptr) { std::cerr << std::endl << "**SEVERE ERROR** PRunBase::PRunBase: Couldn't create an instance of PTheory :-(, will quit" << std::endl; exit(0); @@ -181,10 +181,7 @@ void PRunBase::SetFitRange(PDoublePairVector fitRange) */ void PRunBase::CleanUp() { - if (fTheory) { - delete fTheory; - fTheory = nullptr; - } + fTheory.reset(); } //-------------------------------------------------------------------------- diff --git a/src/include/PRunBase.h b/src/include/PRunBase.h index 6a376d8b..e9d4d8d8 100644 --- a/src/include/PRunBase.h +++ b/src/include/PRunBase.h @@ -31,6 +31,7 @@ #define _PRUNBASE_H_ #include +#include #include @@ -83,7 +84,7 @@ class PRunBase Double_t fFitEndTime; ///< fit end time PDoubleVector fFuncValues; ///< is keeping the values of the functions from the FUNCTIONS block - PTheory *fTheory; ///< theory needed to calculate chi-square + std::unique_ptr fTheory; ///< theory needed to calculate chi-square PDoubleVector fKaiserFilter; ///< stores the Kaiser filter vector (needed for the RRF).