switched TLondon1D from raw -> smart pointers.
This commit is contained in:
parent
5b093208eb
commit
f7c45f46ff
197
src/external/libFitPofB/classes/TLondon1D.cpp
vendored
197
src/external/libFitPofB/classes/TLondon1D.cpp
vendored
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "TLondon1D.h"
|
#include "TLondon1D.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@ -55,12 +56,6 @@ TLondon1DHS::~TLondon1DHS() {
|
|||||||
fParForBofZ.clear();
|
fParForBofZ.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
|
||||||
fImpProfile = 0;
|
|
||||||
delete fPofB;
|
|
||||||
fPofB = 0;
|
|
||||||
delete fPofT;
|
|
||||||
fPofT = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D1L::~TLondon1D1L() {
|
TLondon1D1L::~TLondon1D1L() {
|
||||||
@ -68,12 +63,6 @@ TLondon1D1L::~TLondon1D1L() {
|
|||||||
fParForBofZ.clear();
|
fParForBofZ.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
|
||||||
fImpProfile = 0;
|
|
||||||
delete fPofB;
|
|
||||||
fPofB = 0;
|
|
||||||
delete fPofT;
|
|
||||||
fPofT = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D2L::~TLondon1D2L() {
|
TLondon1D2L::~TLondon1D2L() {
|
||||||
@ -81,12 +70,6 @@ TLondon1D2L::~TLondon1D2L() {
|
|||||||
fParForBofZ.clear();
|
fParForBofZ.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
|
||||||
fImpProfile = 0;
|
|
||||||
delete fPofB;
|
|
||||||
fPofB = 0;
|
|
||||||
delete fPofT;
|
|
||||||
fPofT = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TProximity1D1LHS::~TProximity1D1LHS() {
|
TProximity1D1LHS::~TProximity1D1LHS() {
|
||||||
@ -94,12 +77,6 @@ TProximity1D1LHS::~TProximity1D1LHS() {
|
|||||||
fParForBofZ.clear();
|
fParForBofZ.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
|
||||||
fImpProfile = 0;
|
|
||||||
delete fPofB;
|
|
||||||
fPofB = 0;
|
|
||||||
delete fPofT;
|
|
||||||
fPofT = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D3L::~TLondon1D3L() {
|
TLondon1D3L::~TLondon1D3L() {
|
||||||
@ -107,12 +84,6 @@ TLondon1D3L::~TLondon1D3L() {
|
|||||||
fParForBofZ.clear();
|
fParForBofZ.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
|
||||||
fImpProfile = 0;
|
|
||||||
delete fPofB;
|
|
||||||
fPofB = 0;
|
|
||||||
delete fPofT;
|
|
||||||
fPofT = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TLondon1D3LS::~TLondon1D3LS() {
|
TLondon1D3LS::~TLondon1D3LS() {
|
||||||
@ -120,12 +91,6 @@ TLondon1D3LS::~TLondon1D3LS() {
|
|||||||
fParForBofZ.clear();
|
fParForBofZ.clear();
|
||||||
fParForPofB.clear();
|
fParForPofB.clear();
|
||||||
fParForPofT.clear();
|
fParForPofT.clear();
|
||||||
delete fImpProfile;
|
|
||||||
fImpProfile = 0;
|
|
||||||
delete fPofB;
|
|
||||||
fPofB = 0;
|
|
||||||
delete fPofT;
|
|
||||||
fPofT = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TLondon1D4L::~TLondon1D4L() {
|
// TLondon1D4L::~TLondon1D4L() {
|
||||||
@ -133,10 +98,6 @@ TLondon1D3LS::~TLondon1D3LS() {
|
|||||||
// fParForBofZ.clear();
|
// fParForBofZ.clear();
|
||||||
// fParForPofB.clear();
|
// fParForPofB.clear();
|
||||||
// fParForPofT.clear();
|
// fParForPofT.clear();
|
||||||
// delete fImpProfile;
|
|
||||||
// fImpProfile = 0;
|
|
||||||
// delete fPofT;
|
|
||||||
// fPofT = 0;
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -149,13 +110,13 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
// read startup file
|
// read startup file
|
||||||
std::string startup_path_name("BMW_startup.xml");
|
std::string startup_path_name("BMW_startup.xml");
|
||||||
|
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
std::unique_ptr<BMWStartupHandler> startupHandler = std::make_unique<BMWStartupHandler>();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get());
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
int status = parseXmlFile(saxParser.get(), startup_path_name.c_str());
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -180,21 +141,11 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fParForPofB.push_back(0.005); // Bkg-width
|
fParForPofB.push_back(0.005); // Bkg-width
|
||||||
fParForPofB.push_back(0.0); // Bkg-weight
|
fParForPofB.push_back(0.0); // Bkg-weight
|
||||||
|
|
||||||
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
|
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
|
||||||
|
|
||||||
fPofB = new TPofBCalc(fParForPofB);
|
fPofB = std::make_unique<TPofBCalc>(fParForPofB);
|
||||||
|
|
||||||
fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
fPofT = std::make_unique<TPofTCalc>(fPofB.get(), fWisdom, fParForPofT);
|
||||||
|
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = 0;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -273,7 +224,7 @@ double TLondon1DHS::operator()(double t, const std::vector<double> &par) const {
|
|||||||
|
|
||||||
TLondon1D_HS BofZ(fParForBofZ);
|
TLondon1D_HS BofZ(fParForBofZ);
|
||||||
fPofB->UnsetPBExists();
|
fPofB->UnsetPBExists();
|
||||||
fPofB->Calculate(&BofZ, fImpProfile, fParForPofB);
|
fPofB->Calculate(&BofZ, fImpProfile.get(), fParForPofB);
|
||||||
fPofT->DoFFT();
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
@ -299,13 +250,13 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
// read startup file
|
// read startup file
|
||||||
std::string startup_path_name("BMW_startup.xml");
|
std::string startup_path_name("BMW_startup.xml");
|
||||||
|
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
std::unique_ptr<BMWStartupHandler> startupHandler = std::make_unique<BMWStartupHandler>();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get());
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
int status = parseXmlFile(saxParser.get(), startup_path_name.c_str());
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -330,21 +281,11 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fParForPofB.push_back(0.005); // Bkg-width
|
fParForPofB.push_back(0.005); // Bkg-width
|
||||||
fParForPofB.push_back(0.0); // Bkg-weight
|
fParForPofB.push_back(0.0); // Bkg-weight
|
||||||
|
|
||||||
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
|
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
|
||||||
|
|
||||||
fPofB = new TPofBCalc(fParForPofB);
|
fPofB = std::make_unique<TPofBCalc>(fParForPofB);
|
||||||
|
|
||||||
fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
fPofT = std::make_unique<TPofTCalc>(fPofB.get(), fWisdom, fParForPofT);
|
||||||
|
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = 0;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -450,7 +391,7 @@ double TLondon1D1L::operator()(double t, const std::vector<double> &par) const {
|
|||||||
|
|
||||||
TLondon1D_1L BofZ1(fParForBofZ);
|
TLondon1D_1L BofZ1(fParForBofZ);
|
||||||
fPofB->UnsetPBExists();
|
fPofB->UnsetPBExists();
|
||||||
fPofB->Calculate(&BofZ1, fImpProfile, fParForPofB);
|
fPofB->Calculate(&BofZ1, fImpProfile.get(), fParForPofB);
|
||||||
fPofT->DoFFT();
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
@ -485,13 +426,13 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
// read startup file
|
// read startup file
|
||||||
std::string startup_path_name("BMW_startup.xml");
|
std::string startup_path_name("BMW_startup.xml");
|
||||||
|
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
std::unique_ptr<BMWStartupHandler> startupHandler = std::make_unique<BMWStartupHandler>();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get());
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
int status = parseXmlFile(saxParser.get(), startup_path_name.c_str());
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -516,21 +457,11 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fParForPofB.push_back(0.005); // Bkg-width
|
fParForPofB.push_back(0.005); // Bkg-width
|
||||||
fParForPofB.push_back(0.0); // Bkg-weight
|
fParForPofB.push_back(0.0); // Bkg-weight
|
||||||
|
|
||||||
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
|
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
|
||||||
|
|
||||||
fPofB = new TPofBCalc(fParForPofB);
|
fPofB = std::make_unique<TPofBCalc>(fParForPofB);
|
||||||
|
|
||||||
fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
fPofT = std::make_unique<TPofTCalc>(fPofB.get(), fWisdom, fParForPofT);
|
||||||
|
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = 0;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -631,7 +562,7 @@ double TLondon1D2L::operator()(double t, const std::vector<double> &par) const {
|
|||||||
|
|
||||||
TLondon1D_2L BofZ2(fParForBofZ);
|
TLondon1D_2L BofZ2(fParForBofZ);
|
||||||
fPofB->UnsetPBExists();
|
fPofB->UnsetPBExists();
|
||||||
fPofB->Calculate(&BofZ2, fImpProfile, fParForPofB);
|
fPofB->Calculate(&BofZ2, fImpProfile.get(), fParForPofB);
|
||||||
fPofT->DoFFT();
|
fPofT->DoFFT();
|
||||||
|
|
||||||
|
|
||||||
@ -657,13 +588,13 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
// read startup file
|
// read startup file
|
||||||
std::string startup_path_name("BMW_startup.xml");
|
std::string startup_path_name("BMW_startup.xml");
|
||||||
|
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
std::unique_ptr<BMWStartupHandler> startupHandler = std::make_unique<BMWStartupHandler>();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get());
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
int status = parseXmlFile(saxParser.get(), startup_path_name.c_str());
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -688,21 +619,11 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fParForPofB.push_back(0.01); // Bkg-width
|
fParForPofB.push_back(0.01); // Bkg-width
|
||||||
fParForPofB.push_back(0.0); // Bkg-weight
|
fParForPofB.push_back(0.0); // Bkg-weight
|
||||||
|
|
||||||
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
|
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
|
||||||
|
|
||||||
fPofB = new TPofBCalc(fParForPofB);
|
fPofB = std::make_unique<TPofBCalc>(fParForPofB);
|
||||||
|
|
||||||
fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
fPofT = std::make_unique<TPofTCalc>(fPofB.get(), fWisdom, fParForPofT);
|
||||||
|
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = 0;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -781,7 +702,7 @@ double TProximity1D1LHS::operator()(double t, const std::vector<double> &par) co
|
|||||||
|
|
||||||
TProximity1D_1LHS BofZ(fParForBofZ);
|
TProximity1D_1LHS BofZ(fParForBofZ);
|
||||||
fPofB->UnsetPBExists();
|
fPofB->UnsetPBExists();
|
||||||
fPofB->Calculate(&BofZ, fImpProfile, fParForPofB);
|
fPofB->Calculate(&BofZ, fImpProfile.get(), fParForPofB);
|
||||||
fPofT->DoFFT();
|
fPofT->DoFFT();
|
||||||
|
|
||||||
|
|
||||||
@ -806,13 +727,13 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
// read startup file
|
// read startup file
|
||||||
std::string startup_path_name("BMW_startup.xml");
|
std::string startup_path_name("BMW_startup.xml");
|
||||||
|
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
std::unique_ptr<BMWStartupHandler> startupHandler = std::make_unique<BMWStartupHandler>();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get());
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
int status = parseXmlFile(saxParser.get(), startup_path_name.c_str());
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -837,21 +758,11 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fParForPofB.push_back(0.005); // Bkg-width
|
fParForPofB.push_back(0.005); // Bkg-width
|
||||||
fParForPofB.push_back(0.0); // Bkg-weight
|
fParForPofB.push_back(0.0); // Bkg-weight
|
||||||
|
|
||||||
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
|
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
|
||||||
|
|
||||||
fPofB = new TPofBCalc(fParForPofB);
|
fPofB = std::make_unique<TPofBCalc>(fParForPofB);
|
||||||
|
|
||||||
fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
fPofT = std::make_unique<TPofTCalc>(fPofB.get(), fWisdom, fParForPofT);
|
||||||
|
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = 0;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -953,7 +864,7 @@ double TLondon1D3L::operator()(double t, const std::vector<double> &par) const {
|
|||||||
|
|
||||||
TLondon1D_3L BofZ3(fParForBofZ);
|
TLondon1D_3L BofZ3(fParForBofZ);
|
||||||
fPofB->UnsetPBExists();
|
fPofB->UnsetPBExists();
|
||||||
fPofB->Calculate(&BofZ3, fImpProfile, fParForPofB);
|
fPofB->Calculate(&BofZ3, fImpProfile.get(), fParForPofB);
|
||||||
fPofT->DoFFT();
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
@ -977,13 +888,13 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
// read startup file
|
// read startup file
|
||||||
std::string startup_path_name("BMW_startup.xml");
|
std::string startup_path_name("BMW_startup.xml");
|
||||||
|
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
|
||||||
BMWStartupHandler *startupHandler = new BMWStartupHandler();
|
std::unique_ptr<BMWStartupHandler> startupHandler = std::make_unique<BMWStartupHandler>();
|
||||||
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler);
|
saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get());
|
||||||
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
//int status (saxParser->ParseFile(startup_path_name.c_str()));
|
||||||
// parsing the file as above seems to lead to problems in certain environments;
|
// parsing the file as above seems to lead to problems in certain environments;
|
||||||
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
// use the parseXmlFile function instead (see PUserFcnBase.cpp for the definition)
|
||||||
int status = parseXmlFile(saxParser, startup_path_name.c_str());
|
int status = parseXmlFile(saxParser.get(), startup_path_name.c_str());
|
||||||
// check for parse errors
|
// check for parse errors
|
||||||
if (status) { // error
|
if (status) { // error
|
||||||
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
|
||||||
@ -1008,21 +919,11 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
|
|||||||
fParForPofB.push_back(0.005); // Bkg-width
|
fParForPofB.push_back(0.005); // Bkg-width
|
||||||
fParForPofB.push_back(0.0); // Bkg-weight
|
fParForPofB.push_back(0.0); // Bkg-weight
|
||||||
|
|
||||||
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
|
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
|
||||||
|
|
||||||
fPofB = new TPofBCalc(fParForPofB);
|
fPofB = std::make_unique<TPofBCalc>(fParForPofB);
|
||||||
|
|
||||||
fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT);
|
fPofT = std::make_unique<TPofTCalc>(fPofB.get(), fWisdom, fParForPofT);
|
||||||
|
|
||||||
// clean up
|
|
||||||
if (saxParser) {
|
|
||||||
delete saxParser;
|
|
||||||
saxParser = 0;
|
|
||||||
}
|
|
||||||
if (startupHandler) {
|
|
||||||
delete startupHandler;
|
|
||||||
startupHandler = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------
|
//------------------
|
||||||
@ -1124,7 +1025,7 @@ double TLondon1D3LS::operator()(double t, const std::vector<double> &par) const
|
|||||||
|
|
||||||
TLondon1D_3LS BofZ3(fParForBofZ);
|
TLondon1D_3LS BofZ3(fParForBofZ);
|
||||||
fPofB->UnsetPBExists();
|
fPofB->UnsetPBExists();
|
||||||
fPofB->Calculate(&BofZ3, fImpProfile, fParForPofB);
|
fPofB->Calculate(&BofZ3, fImpProfile.get(), fParForPofB);
|
||||||
fPofT->DoFFT();
|
fPofT->DoFFT();
|
||||||
|
|
||||||
}/* else {
|
}/* else {
|
||||||
|
38
src/external/libFitPofB/include/TLondon1D.h
vendored
38
src/external/libFitPofB/include/TLondon1D.h
vendored
@ -29,6 +29,8 @@
|
|||||||
#ifndef _TLondon1D_H_
|
#ifndef _TLondon1D_H_
|
||||||
#define _TLondon1D_H_
|
#define _TLondon1D_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "PUserFcnBase.h"
|
#include "PUserFcnBase.h"
|
||||||
#include "TPofTCalc.h"
|
#include "TPofTCalc.h"
|
||||||
|
|
||||||
@ -47,9 +49,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::vector<double> fPar; ///< parameters of the model
|
mutable std::vector<double> fPar; ///< parameters of the model
|
||||||
TTrimSPData *fImpProfile; ///< low energy muon implantation profiles
|
std::unique_ptr<TTrimSPData> fImpProfile; ///< low energy muon implantation profiles
|
||||||
TPofBCalc *fPofB; ///< static field distribution P(B)
|
std::unique_ptr<TPofBCalc> fPofB; ///< static field distribution P(B)
|
||||||
TPofTCalc *fPofT; ///< muon spin polarization p(t)
|
std::unique_ptr<TPofTCalc> fPofT; ///< muon spin polarization p(t)
|
||||||
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
||||||
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
||||||
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
||||||
@ -76,9 +78,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::vector<double> fPar; ///< parameters of the model
|
mutable std::vector<double> fPar; ///< parameters of the model
|
||||||
TTrimSPData *fImpProfile; ///< low energy muon implantation profiles
|
std::unique_ptr<TTrimSPData> fImpProfile; ///< low energy muon implantation profiles
|
||||||
TPofBCalc *fPofB; ///< static field distribution P(B)
|
std::unique_ptr<TPofBCalc> fPofB; ///< static field distribution P(B)
|
||||||
TPofTCalc *fPofT; ///< muon spin polarization p(t)
|
std::unique_ptr<TPofTCalc> fPofT; ///< muon spin polarization p(t)
|
||||||
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
||||||
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
||||||
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
||||||
@ -107,9 +109,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::vector<double> fPar; ///< parameters of the model
|
mutable std::vector<double> fPar; ///< parameters of the model
|
||||||
TTrimSPData *fImpProfile; ///< low energy muon implantation profiles
|
std::unique_ptr<TTrimSPData> fImpProfile; ///< low energy muon implantation profiles
|
||||||
TPofBCalc *fPofB; ///< static field distribution P(B)
|
std::unique_ptr<TPofBCalc> fPofB; ///< static field distribution P(B)
|
||||||
TPofTCalc *fPofT; ///< muon spin polarization p(t)
|
std::unique_ptr<TPofTCalc> fPofT; ///< muon spin polarization p(t)
|
||||||
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
||||||
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
||||||
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
||||||
@ -137,9 +139,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::vector<double> fPar; ///< parameters of the model
|
mutable std::vector<double> fPar; ///< parameters of the model
|
||||||
TTrimSPData *fImpProfile; ///< low energy muon implantation profiles
|
std::unique_ptr<TTrimSPData> fImpProfile; ///< low energy muon implantation profiles
|
||||||
TPofBCalc *fPofB; ///< static field distribution P(B)
|
std::unique_ptr<TPofBCalc> fPofB; ///< static field distribution P(B)
|
||||||
TPofTCalc *fPofT; ///< muon spin polarization p(t)
|
std::unique_ptr<TPofTCalc> fPofT; ///< muon spin polarization p(t)
|
||||||
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
||||||
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
||||||
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
||||||
@ -167,9 +169,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::vector<double> fPar; ///< parameters of the model
|
mutable std::vector<double> fPar; ///< parameters of the model
|
||||||
TTrimSPData *fImpProfile; ///< low energy muon implantation profiles
|
std::unique_ptr<TTrimSPData> fImpProfile; ///< low energy muon implantation profiles
|
||||||
TPofBCalc *fPofB; ///< static field distribution P(B)
|
std::unique_ptr<TPofBCalc> fPofB; ///< static field distribution P(B)
|
||||||
TPofTCalc *fPofT; ///< muon spin polarization p(t)
|
std::unique_ptr<TPofTCalc> fPofT; ///< muon spin polarization p(t)
|
||||||
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
||||||
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
||||||
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
||||||
@ -197,9 +199,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::vector<double> fPar; ///< parameters of the model
|
mutable std::vector<double> fPar; ///< parameters of the model
|
||||||
TTrimSPData *fImpProfile; ///< low energy muon implantation profiles
|
std::unique_ptr<TTrimSPData> fImpProfile; ///< low energy muon implantation profiles
|
||||||
TPofBCalc *fPofB; ///< static field distribution P(B
|
std::unique_ptr<TPofBCalc> fPofB; ///< static field distribution P(B
|
||||||
TPofTCalc *fPofT; ///< muon spin polarization p(t)
|
std::unique_ptr<TPofTCalc> fPofT; ///< muon spin polarization p(t)
|
||||||
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged
|
||||||
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time
|
||||||
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user