switched PRunBase where possible to smart pointers.

This commit is contained in:
suter_a 2023-10-21 18:46:24 +02:00
parent 2e9542c796
commit f03be7add9
2 changed files with 4 additions and 6 deletions

View File

@ -99,7 +99,7 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo,
fFuncValues.push_back(0.0); fFuncValues.push_back(0.0);
// generate theory // generate theory
fTheory = new PTheory(fMsrInfo, runNo); fTheory = std::make_unique<PTheory>(fMsrInfo, runNo);
if (fTheory == nullptr) { if (fTheory == nullptr) {
std::cerr << std::endl << "**SEVERE ERROR** PRunBase::PRunBase: Couldn't create an instance of PTheory :-(, will quit" << std::endl; std::cerr << std::endl << "**SEVERE ERROR** PRunBase::PRunBase: Couldn't create an instance of PTheory :-(, will quit" << std::endl;
exit(0); exit(0);
@ -181,10 +181,7 @@ void PRunBase::SetFitRange(PDoublePairVector fitRange)
*/ */
void PRunBase::CleanUp() void PRunBase::CleanUp()
{ {
if (fTheory) { fTheory.reset();
delete fTheory;
fTheory = nullptr;
}
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

@ -31,6 +31,7 @@
#define _PRUNBASE_H_ #define _PRUNBASE_H_
#include <vector> #include <vector>
#include <memory>
#include <TString.h> #include <TString.h>
@ -83,7 +84,7 @@ class PRunBase
Double_t fFitEndTime; ///< fit end time Double_t fFitEndTime; ///< fit end time
PDoubleVector fFuncValues; ///< is keeping the values of the functions from the FUNCTIONS block PDoubleVector fFuncValues; ///< is keeping the values of the functions from the FUNCTIONS block
PTheory *fTheory; ///< theory needed to calculate chi-square std::unique_ptr<PTheory> fTheory; ///< theory needed to calculate chi-square
PDoubleVector fKaiserFilter; ///< stores the Kaiser filter vector (needed for the RRF). PDoubleVector fKaiserFilter; ///< stores the Kaiser filter vector (needed for the RRF).