switched PMsrHandler where possible to smart pointers.
This commit is contained in:
parent
17bc497b30
commit
9ef5c5cac6
@ -66,8 +66,6 @@ PMsrHandler::PMsrHandler(const Char_t *fileName, PStartupOptions *startupOptions
|
|||||||
fStatistic.fMinExpectedPerHisto.clear();
|
fStatistic.fMinExpectedPerHisto.clear();
|
||||||
fStatistic.fNdfPerHisto.clear();
|
fStatistic.fNdfPerHisto.clear();
|
||||||
|
|
||||||
fFuncHandler = nullptr;
|
|
||||||
|
|
||||||
// check if the file name given is a path-file-name, and if yes, split it into path and file name.
|
// check if the file name given is a path-file-name, and if yes, split it into path and file name.
|
||||||
if (fFileName.Contains("/")) {
|
if (fFileName.Contains("/")) {
|
||||||
Int_t idx = -1;
|
Int_t idx = -1;
|
||||||
@ -99,11 +97,6 @@ PMsrHandler::~PMsrHandler()
|
|||||||
fStatistic.fMinExpectedPerHisto.clear();
|
fStatistic.fMinExpectedPerHisto.clear();
|
||||||
fStatistic.fNdfPerHisto.clear();
|
fStatistic.fNdfPerHisto.clear();
|
||||||
fParamInUse.clear();
|
fParamInUse.clear();
|
||||||
|
|
||||||
if (fFuncHandler) {
|
|
||||||
delete fFuncHandler;
|
|
||||||
fFuncHandler = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -2941,11 +2934,7 @@ Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines)
|
|||||||
fFunctions = lines;
|
fFunctions = lines;
|
||||||
|
|
||||||
// create function handler
|
// create function handler
|
||||||
fFuncHandler = new PFunctionHandler(fFunctions);
|
fFuncHandler = std::make_unique<PFunctionHandler>(fFunctions);
|
||||||
if (fFuncHandler == nullptr) {
|
|
||||||
std::cerr << std::endl << ">> PMsrHandler::HandleFunctionsEntry: **ERROR** Couldn't invoke PFunctionHandler." << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// do the parsing
|
// do the parsing
|
||||||
if (!fFuncHandler->DoParse()) {
|
if (!fFuncHandler->DoParse()) {
|
||||||
@ -3545,7 +3534,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
|||||||
} else {
|
} else {
|
||||||
PUIntVector group;
|
PUIntVector group;
|
||||||
str = iter->fLine;
|
str = iter->fLine;
|
||||||
PStringNumberList *rl = new PStringNumberList(str.Data());
|
std::unique_ptr<PStringNumberList> rl = std::make_unique<PStringNumberList>(str.Data());
|
||||||
std::string errorMsg("");
|
std::string errorMsg("");
|
||||||
if (rl->Parse(errorMsg, true)) {
|
if (rl->Parse(errorMsg, true)) {
|
||||||
group = rl->GetList();
|
group = rl->GetList();
|
||||||
@ -3555,7 +3544,6 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
|||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
delete rl;
|
|
||||||
group.clear();
|
group.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3570,7 +3558,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
|||||||
} else {
|
} else {
|
||||||
PUIntVector group;
|
PUIntVector group;
|
||||||
str = iter->fLine;
|
str = iter->fLine;
|
||||||
PStringNumberList *rl = new PStringNumberList(str.Data());
|
std::unique_ptr<PStringNumberList> rl = std::make_unique<PStringNumberList>(str.Data());
|
||||||
std::string errorMsg("");
|
std::string errorMsg("");
|
||||||
if (rl->Parse(errorMsg, true)) {
|
if (rl->Parse(errorMsg, true)) {
|
||||||
group = rl->GetList();
|
group = rl->GetList();
|
||||||
@ -3580,7 +3568,6 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
|||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
delete rl;
|
|
||||||
group.clear();
|
group.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4634,7 +4621,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
|||||||
param.fLifeTimeCorrection = true;
|
param.fLifeTimeCorrection = true;
|
||||||
} else if (line.Contains("runs", TString::kIgnoreCase)) { // handle plot runs
|
} else if (line.Contains("runs", TString::kIgnoreCase)) { // handle plot runs
|
||||||
TComplex run;
|
TComplex run;
|
||||||
PStringNumberList *rl;
|
std::unique_ptr<PStringNumberList> rl;
|
||||||
std::string errorMsg;
|
std::string errorMsg;
|
||||||
PUIntVector runList;
|
PUIntVector runList;
|
||||||
switch (param.fPlotType) {
|
switch (param.fPlotType) {
|
||||||
@ -4648,7 +4635,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
|||||||
case MSR_PLOT_ASYM_RRF:
|
case MSR_PLOT_ASYM_RRF:
|
||||||
case MSR_PLOT_NON_MUSR:
|
case MSR_PLOT_NON_MUSR:
|
||||||
case MSR_PLOT_MU_MINUS:
|
case MSR_PLOT_MU_MINUS:
|
||||||
rl = new PStringNumberList(line.Data());
|
rl = std::make_unique<PStringNumberList>(line.Data());
|
||||||
if (!rl->Parse(errorMsg, true)) {
|
if (!rl->Parse(errorMsg, true)) {
|
||||||
std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
|
std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
|
||||||
std::cerr << std::endl << ">> Error Message: " << errorMsg;
|
std::cerr << std::endl << ">> Error Message: " << errorMsg;
|
||||||
@ -4662,7 +4649,6 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
|||||||
}
|
}
|
||||||
// clean up
|
// clean up
|
||||||
runList.clear();
|
runList.clear();
|
||||||
delete rl;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error = true;
|
error = true;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define _PMSRHANDLER_H_
|
#define _PMSRHANDLER_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <TString.h>
|
#include <TString.h>
|
||||||
#include <TComplex.h>
|
#include <TComplex.h>
|
||||||
@ -134,7 +135,7 @@ class PMsrHandler
|
|||||||
|
|
||||||
Int_t fMsrBlockCounter; ///< used to select the proper msr-block
|
Int_t fMsrBlockCounter; ///< used to select the proper msr-block
|
||||||
|
|
||||||
PFunctionHandler *fFuncHandler; ///< needed to parse functions
|
std::unique_ptr<PFunctionHandler> fFuncHandler; ///< needed to parse functions
|
||||||
|
|
||||||
PIntVector fParamInUse; ///< array holding the information if a particular parameter is used at all, i.e. if the theory is using it (perhaps via maps or functions)
|
PIntVector fParamInUse; ///< array holding the information if a particular parameter is used at all, i.e. if the theory is using it (perhaps via maps or functions)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user