more work on Raw -> Smart Pointers for external libs.

This commit is contained in:
suter_a 2023-10-27 23:23:19 +02:00
parent 7691ef2815
commit af13e78c52
16 changed files with 440 additions and 674 deletions

View File

@ -35,6 +35,7 @@
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include <memory>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/** /**
@ -88,10 +89,8 @@ inline double T2Integrator::IntegrateFunc(double x1, double x2, const std::vecto
ptrPair.first = (this); ptrPair.first = (this);
ptrPair.second = &par; ptrPair.second = &par;
ROOT::Math::GSLIntegrator *integrator = new ROOT::Math::GSLIntegrator(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); std::unique_ptr<ROOT::Math::GSLIntegrator> integrator = std::make_unique<ROOT::Math::GSLIntegrator>(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31);
double value(integrator->Integral(&T2Integrator::FuncAtXgsl, static_cast<void*>(&ptrPair), x1, x2)); double value(integrator->Integral(&T2Integrator::FuncAtXgsl, static_cast<void*>(&ptrPair), x1, x2));
delete integrator;
integrator = nullptr;
return value; return value;
} }
@ -115,7 +114,7 @@ class TIntegrator {
private: private:
static double FuncAtXgsl(double, void *); static double FuncAtXgsl(double, void *);
ROOT::Math::GSLIntegrator *fIntegrator; ///< pointer to the GSL integrator std::unique_ptr<ROOT::Math::GSLIntegrator> fIntegrator; ///< pointer to the GSL integrator
mutable double (*fFunc)(double, void *); ///< pointer to the integrand function mutable double (*fFunc)(double, void *); ///< pointer to the integrand function
}; };
@ -125,7 +124,7 @@ class TIntegrator {
* Allocation of memory for an integration using the adaptive 31 point Gauss-Kronrod rule * Allocation of memory for an integration using the adaptive 31 point Gauss-Kronrod rule
*/ */
inline TIntegrator::TIntegrator() : fFunc(0) { inline TIntegrator::TIntegrator() : fFunc(0) {
fIntegrator = new ROOT::Math::GSLIntegrator(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); fIntegrator = std::make_unique<ROOT::Math::GSLIntegrator>(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -135,8 +134,6 @@ inline TIntegrator::TIntegrator() : fFunc(0) {
*/ */
inline TIntegrator::~TIntegrator(){ inline TIntegrator::~TIntegrator(){
fPar.clear(); fPar.clear();
delete fIntegrator;
fIntegrator=nullptr;
fFunc=0; fFunc=0;
} }
@ -190,7 +187,7 @@ class TMCIntegrator {
private: private:
static double FuncAtXgsl(double *, size_t, void *); static double FuncAtXgsl(double *, size_t, void *);
ROOT::Math::GSLMCIntegrator *fMCIntegrator; ///< pointer to the GSL integrator std::unique_ptr<ROOT::Math::GSLMCIntegrator> fMCIntegrator; ///< pointer to the GSL integrator
mutable double (*fFunc)(double *, size_t, void *); ///< pointer to the integrand function mutable double (*fFunc)(double *, size_t, void *); ///< pointer to the integrand function
}; };
@ -200,7 +197,7 @@ class TMCIntegrator {
* Allocation of memory for an integration using the MISER algorithm of Press and Farrar * Allocation of memory for an integration using the MISER algorithm of Press and Farrar
*/ */
inline TMCIntegrator::TMCIntegrator() : fFunc(0) { inline TMCIntegrator::TMCIntegrator() : fFunc(0) {
fMCIntegrator = new ROOT::Math::GSLMCIntegrator(ROOT::Math::MCIntegration::kMISER, 1.E-6, 1.E-4, 500000); fMCIntegrator = std::make_unique<ROOT::Math::GSLMCIntegrator>(ROOT::Math::MCIntegration::kMISER, 1.E-6, 1.E-4, 500000);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -210,8 +207,6 @@ inline TMCIntegrator::TMCIntegrator() : fFunc(0) {
*/ */
inline TMCIntegrator::~TMCIntegrator(){ inline TMCIntegrator::~TMCIntegrator(){
fPar.clear(); fPar.clear();
delete fMCIntegrator;
fMCIntegrator=nullptr;
fFunc=0; fFunc=0;
} }

View File

@ -33,37 +33,33 @@
#include <cmath> #include <cmath>
#include <cassert> #include <cassert>
#include <algorithm> #include <algorithm>
#include <memory>
using namespace std;
//-------------------- //--------------------
// Constructor of the TrimSPData class -- reading all available trim.SP-rge-files with a given name into std::vectors // Constructor of the TrimSPData class -- reading all available trim.SP-rge-files with a given name into std::vectors
//-------------------- //--------------------
TTrimSPData::TTrimSPData(const string &path, map<double, string> &energies, bool debug, unsigned int highRes) { TTrimSPData::TTrimSPData(const std::string &path, std::map<double, std::string> &energies, bool debug, unsigned int highRes) {
// sort the energies in ascending order - this might be useful for later applications (energy-interpolations etc.) // sort the energies in ascending order - this might be useful for later applications (energy-interpolations etc.)
// after the change from the vector to the map this is not necessary any more - since maps are always ordered! // after the change from the vector to the map this is not necessary any more - since maps are always ordered!
// sort(energies.begin(), energies.end()); // sort(energies.begin(), energies.end());
double zz(0.0), nzz(0.0); double zz(0.0), nzz(0.0);
vector<double> vzz, vnzz; std::vector<double> vzz, vnzz;
string word, energyStr; std::string word, energyStr;
bool goodFile(false); bool goodFile(false);
for ( map<double, string>::const_iterator iter(energies.begin()); iter != energies.end(); ++iter ) { for ( std::map<double, std::string>::const_iterator iter(energies.begin()); iter != energies.end(); ++iter ) {
energyStr = path + iter->second + ".rge"; energyStr = path + iter->second + ".rge";
ifstream *rgeFile = new ifstream(energyStr.c_str()); std::unique_ptr<std::ifstream> rgeFile = std::make_unique<std::ifstream>(energyStr.c_str());
if(! *rgeFile) { if (rgeFile == nullptr) {
cerr << "TTrimSPData::TTrimSPData: file " << energyStr << " not found! Try next energy..." << endl; std::cerr << "TTrimSPData::TTrimSPData: file " << energyStr << " not found! Try next energy..." << std::endl;
delete rgeFile;
rgeFile = 0;
} else { } else {
while (*rgeFile >> word) {
while(*rgeFile >> word) { if (word == "PARTICLES") {
if(word == "PARTICLES") {
goodFile = true; goodFile = true;
break; break;
} }
@ -73,7 +69,7 @@ TTrimSPData::TTrimSPData(const string &path, map<double, string> &energies, bool
fEnergy.push_back(iter->first); fEnergy.push_back(iter->first);
while(!rgeFile->eof()) { while (!rgeFile->eof()) {
*rgeFile >> zz >> nzz; *rgeFile >> zz >> nzz;
vzz.push_back(zz); vzz.push_back(zz);
vnzz.push_back(nzz); vnzz.push_back(nzz);
@ -92,8 +88,6 @@ TTrimSPData::TTrimSPData(const string &path, map<double, string> &energies, bool
rgeFile->close(); rgeFile->close();
delete rgeFile;
rgeFile = 0;
vzz.clear(); vzz.clear();
vnzz.clear(); vnzz.clear();
@ -106,14 +100,14 @@ TTrimSPData::TTrimSPData(const string &path, map<double, string> &energies, bool
} }
} else { } else {
cerr << "TTrimSPData::TTrimSPData: " << energyStr << " does not seem to be a valid unmodified TRIM.SP output file!" << endl; std::cerr << "TTrimSPData::TTrimSPData: " << energyStr << " does not seem to be a valid unmodified TRIM.SP output file!" << std::endl;
continue; continue;
} }
} }
} }
if (debug) if (debug)
cout << "TTrimSPData::TTrimSPData: Read in " << fDataNZ.size() << " implantation profiles in total." << endl; std::cout << "TTrimSPData::TTrimSPData: Read in " << fDataNZ.size() << " implantation profiles in total." << std::endl;
fOrigDataNZ = fDataNZ; fOrigDataNZ = fDataNZ;
@ -126,8 +120,8 @@ TTrimSPData::TTrimSPData(const string &path, map<double, string> &energies, bool
// If it is not found the energy iterator will point to the end() of the energy vector. // If it is not found the energy iterator will point to the end() of the energy vector.
void TTrimSPData::FindEnergy(double e) const { void TTrimSPData::FindEnergy(double e) const {
for(fEnergyIter = fEnergy.begin(); fEnergyIter != fEnergy.end(); ++fEnergyIter) { for (fEnergyIter = fEnergy.begin(); fEnergyIter != fEnergy.end(); ++fEnergyIter) {
if(fabs(*fEnergyIter - e) < 0.05) if (fabs(*fEnergyIter - e) < 0.05)
return; return;
} }
return; return;
@ -137,11 +131,11 @@ void TTrimSPData::UseHighResolution(double e) {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
vector<double> vecZ; std::vector<double> vecZ;
vector<double> vecNZ; std::vector<double> vecNZ;
for(double zz(1.); zz<2100.; zz+=1.) { for (double zz(1.); zz<2100.; zz+=1.) {
vecZ.push_back(zz); vecZ.push_back(zz);
vecNZ.push_back(GetNofZ(zz/10.0, e)); vecNZ.push_back(GetNofZ(zz/10.0, e));
} }
@ -153,7 +147,7 @@ void TTrimSPData::UseHighResolution(double e) {
return; return;
} }
cout << "TTrimSPData::DataZ: No implantation profile available for the specified energy... Nothing happens." << endl; std::cout << "TTrimSPData::DataZ: No implantation profile available for the specified energy... Nothing happens." << std::endl;
return; return;
} }
@ -161,16 +155,16 @@ void TTrimSPData::UseHighResolution(double e) {
// Method returning z-vector calculated by trim.SP for given energy[keV] // Method returning z-vector calculated by trim.SP for given energy[keV]
//--------------------- //---------------------
vector<double> TTrimSPData::DataZ(double e) const { std::vector<double> TTrimSPData::DataZ(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
return fDataZ[i]; return fDataZ[i];
} }
// default // default
cout << "TTrimSPData::DataZ: No implantation profile available for the specified energy... You get back the first one." << endl; std::cout << "TTrimSPData::DataZ: No implantation profile available for the specified energy... You get back the first one." << std::endl;
return fDataZ[0]; return fDataZ[0];
} }
@ -179,50 +173,50 @@ vector<double> TTrimSPData::DataZ(double e) const {
// potentially altered by the WeightLayers- or the Normalize-method for given energy[keV] // potentially altered by the WeightLayers- or the Normalize-method for given energy[keV]
//--------------------- //---------------------
vector<double> TTrimSPData::DataNZ(double e) const { std::vector<double> TTrimSPData::DataNZ(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
return fDataNZ[i]; return fDataNZ[i];
} }
// default // default
cout << "TTrimSPData::DataNZ: No implantation profile available for the specified energy... You get back the first one." << endl; std::cout << "TTrimSPData::DataNZ: No implantation profile available for the specified energy... You get back the first one." << std::endl;
return fDataNZ[0];
return fDataNZ[0];
} }
//--------------------- //---------------------
// Method returning original n(z)-vector calculated by trim.SP for given energy[keV] // Method returning original n(z)-vector calculated by trim.SP for given energy[keV]
//--------------------- //---------------------
vector<double> TTrimSPData::OrigDataNZ(double e) const { std::vector<double> TTrimSPData::OrigDataNZ(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
return fOrigDataNZ[i]; return fOrigDataNZ[i];
} }
// default // default
cout << "TTrimSPData::OrigDataNZ: No implantation profile available for the specified energy... You get back the first one." << endl; std::cout << "TTrimSPData::OrigDataNZ: No implantation profile available for the specified energy... You get back the first one." << std::endl;
return fOrigDataNZ[0];
return fOrigDataNZ[0];
} }
double TTrimSPData::DataDZ(double e) const { double TTrimSPData::DataDZ(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
return fDZ[i]; return fDZ[i];
} }
// default // default
cout << "TTrimSPData::DataDZ: No implantation profile available for the specified energy... The resolution will be zero!" << endl; std::cout << "TTrimSPData::DataDZ: No implantation profile available for the specified energy... The resolution will be zero!" << std::endl;
return 0.0;
return 0.0;
} }
//--------------------- //---------------------
@ -230,10 +224,10 @@ double TTrimSPData::DataDZ(double e) const {
// Parameters: Energy[keV], LayerNumber[1], Interfaces[nm] // Parameters: Energy[keV], LayerNumber[1], Interfaces[nm]
//--------------------- //---------------------
double TTrimSPData::LayerFraction(double e, unsigned int layno, const vector<double>& interface) const { double TTrimSPData::LayerFraction(double e, unsigned int layno, const std::vector<double>& interface) const {
if(layno < 1 && layno > (interface.size()+1)) { if (layno < 1 && layno > (interface.size()+1)) {
cout << "TTrimSPData::LayerFraction: No such layer available according to your specified interfaces... Returning 0.0!" << endl; std::cout << "TTrimSPData::LayerFraction: No such layer available according to your specified interfaces... Returning 0.0!" << std::endl;
return 0.0; return 0.0;
} }
@ -244,21 +238,21 @@ double TTrimSPData::LayerFraction(double e, unsigned int layno, const vector<dou
// Because we do not know if the implantation profile is normalized or not, do not care about this and calculate the fraction from the beginning // Because we do not know if the implantation profile is normalized or not, do not care about this and calculate the fraction from the beginning
// Total "number of muons" // Total "number of muons"
double totalNumber(0.0); double totalNumber(0.0);
for(unsigned int j(0); j<fDataZ[i].size(); j++) for (unsigned int j(0); j<fDataZ[i].size(); j++)
totalNumber += fDataNZ[i][j]; totalNumber += fDataNZ[i][j];
// "number of muons" in layer layno // "number of muons" in layer layno
double layerNumber(0.0); double layerNumber(0.0);
if(!(layno-1)){ if (!(layno-1)){
for(unsigned int j(0); j<fDataZ[i].size(); j++) for (unsigned int j(0); j<fDataZ[i].size(); j++)
if(fDataZ[i][j] < interface[0]*10.0) if (fDataZ[i][j] < interface[0]*10.0)
layerNumber += fDataNZ[i][j]; layerNumber += fDataNZ[i][j];
} else if(!(layno-interface.size()-1)){ } else if (!(layno-interface.size()-1)) {
for(unsigned int j(0); j<fDataZ[i].size(); j++) for (unsigned int j(0); j<fDataZ[i].size(); j++)
if(fDataZ[i][j] >= *(interface.end()-1)*10.0) if (fDataZ[i][j] >= *(interface.end()-1)*10.0)
layerNumber += fDataNZ[i][j]; layerNumber += fDataNZ[i][j];
} else { } else {
for(unsigned int j(0); j<fDataZ[i].size(); j++) for (unsigned int j(0); j<fDataZ[i].size(); j++)
if(fDataZ[i][j] >= interface[layno-2]*10.0 && fDataZ[i][j] < interface[layno-1]*10.0) if (fDataZ[i][j] >= interface[layno-2]*10.0 && fDataZ[i][j] < interface[layno-1]*10.0)
layerNumber += fDataNZ[i][j]; layerNumber += fDataNZ[i][j];
} }
// fraction of muons in layer layno // fraction of muons in layer layno
@ -267,9 +261,9 @@ double TTrimSPData::LayerFraction(double e, unsigned int layno, const vector<dou
} }
// default // default
cout << "TTrimSPData::LayerFraction: No implantation profile available for the specified energy " << e << " keV... Returning 0.0" << endl; std::cout << "TTrimSPData::LayerFraction: No implantation profile available for the specified energy " << e << " keV... Returning 0.0" << std::endl;
return 0.0;
return 0.0;
} }
//--------------------- //---------------------
@ -280,30 +274,30 @@ double TTrimSPData::LayerFraction(double e, unsigned int layno, const vector<dou
// the first and last layers get the full n(z), where only one third of the muons in the second layer will be taken into account // the first and last layers get the full n(z), where only one third of the muons in the second layer will be taken into account
//--------------------- //---------------------
void TTrimSPData::WeightLayers(double e, const vector<double>& interface, const vector<double>& weight) const { void TTrimSPData::WeightLayers(double e, const std::vector<double>& interface, const std::vector<double>& weight) const {
if(weight.size()-interface.size()-1) { if (weight.size()-interface.size()-1) {
cout << "TTrimSPData::WeightLayers: For the weighting the number of interfaces has to be one less than the number of weights!" << endl; std::cout << "TTrimSPData::WeightLayers: For the weighting the number of interfaces has to be one less than the number of weights!" << std::endl;
cout << "TTrimSPData::WeightLayers: No weighting of the implantation profile will be done unless you take care of that!" << endl; std::cout << "TTrimSPData::WeightLayers: No weighting of the implantation profile will be done unless you take care of that!" << std::endl;
return; return;
} }
for(unsigned int i(0); i<interface.size(); i++) { for (unsigned int i(0); i<interface.size(); i++) {
if (interface[i]<0.0) { if (interface[i]<0.0) {
cout << "TTrimSPData::WeightLayers: One of your layer interfaces has a negative coordinate! - No weighting will be done!" << endl; std::cout << "TTrimSPData::WeightLayers: One of your layer interfaces has a negative coordinate! - No weighting will be done!" << std::endl;
return; return;
} }
else if (i>1) { else if (i>1) {
if (interface[i]<interface[i-1]) { if (interface[i]<interface[i-1]) {
cout << "TTrimSPData::WeightLayers: The specified interfaces appear to be not in ascending order! - No weighting will be done!" << endl; std::cout << "TTrimSPData::WeightLayers: The specified interfaces appear to be not in ascending order! - No weighting will be done!" << std::endl;
return; return;
} }
} }
} }
for(unsigned int i(0); i<weight.size(); i++) { for (unsigned int i(0); i<weight.size(); i++) {
if (weight[i]>1.0 || weight[i]<0.0) { if (weight[i]>1.0 || weight[i]<0.0) {
cout << "TTrimSPData::WeightLayers: At least one of the specified weights is out of range - no weighting will be done!" << endl; std::cout << "TTrimSPData::WeightLayers: At least one of the specified weights is out of range - no weighting will be done!" << std::endl;
return; return;
} }
} }
@ -311,11 +305,11 @@ void TTrimSPData::WeightLayers(double e, const vector<double>& interface, const
FindEnergy(e); FindEnergy(e);
// If all weights are equal to one, use the original n(z) vector // If all weights are equal to one, use the original n(z) vector
for(unsigned int i(0); i<weight.size(); i++) { for (unsigned int i(0); i<weight.size(); i++) {
if(weight[i]-1.0) if (weight[i]-1.0)
break; break;
if(i == weight.size() - 1) { if (i == weight.size() - 1) {
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int j(fEnergyIter - fEnergy.begin()); unsigned int j(fEnergyIter - fEnergy.begin());
fDataNZ[j] = fOrigDataNZ[j]; fDataNZ[j] = fOrigDataNZ[j];
fIsNormalized[j] = false; fIsNormalized[j] = false;
@ -324,12 +318,12 @@ void TTrimSPData::WeightLayers(double e, const vector<double>& interface, const
} }
} }
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
unsigned int k(0); unsigned int k(0);
for(unsigned int j(0); j<fDataZ[i].size(); j++) { for (unsigned int j(0); j<fDataZ[i].size(); j++) {
if(k<interface.size()) { if (k<interface.size()) {
if(fDataZ[i][j] < interface[k]*10.0) if (fDataZ[i][j] < interface[k]*10.0)
fDataNZ[i][j] = fOrigDataNZ[i][j]*weight[k]; fDataNZ[i][j] = fOrigDataNZ[i][j]*weight[k];
else { else {
k++; k++;
@ -339,11 +333,11 @@ void TTrimSPData::WeightLayers(double e, const vector<double>& interface, const
else else
fDataNZ[i][j] = fOrigDataNZ[i][j]*weight[k]; fDataNZ[i][j] = fOrigDataNZ[i][j]*weight[k];
} }
fIsNormalized[i] = false; fIsNormalized[i] = false;
return; return;
} }
cout << "TTrimSPData::WeightLayers: No implantation profile available for the specified energy... No weighting done." << endl; std::cout << "TTrimSPData::WeightLayers: No implantation profile available for the specified energy... No weighting done." << std::endl;
return; return;
} }
@ -353,20 +347,20 @@ void TTrimSPData::WeightLayers(double e, const vector<double>& interface, const
double TTrimSPData::GetNofZ(double zz, double e) const { double TTrimSPData::GetNofZ(double zz, double e) const {
vector<double> z, nz; std::vector<double> z, nz;
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
z = fDataZ[i]; z = fDataZ[i];
nz = fDataNZ[i]; nz = fDataNZ[i];
} else { } else {
cout << "TTrimSPData::GetNofZ: No implantation profile available for the specified energy " << e << " keV... Quitting!" << endl; std::cout << "TTrimSPData::GetNofZ: No implantation profile available for the specified energy " << e << " keV... Quitting!" << std::endl;
exit(-1); exit(-1);
} }
if(zz < 0) if (zz < 0)
return 0.0; return 0.0;
bool found = false; bool found = false;
@ -395,7 +389,7 @@ void TTrimSPData::Normalize(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
double nZsum = 0.0; double nZsum = 0.0;
for (unsigned int j(0); j<fDataZ[i].size(); j++) for (unsigned int j(0); j<fDataZ[i].size(); j++)
@ -408,9 +402,9 @@ void TTrimSPData::Normalize(double e) const {
return; return;
} }
// default // default
cout << "TTrimSPData::Normalize: No implantation profile available for the specified energy... No normalization done." << endl; std::cout << "TTrimSPData::Normalize: No implantation profile available for the specified energy... No normalization done." << std::endl;
return;
return;
} }
//--------------------- //---------------------
@ -420,12 +414,12 @@ void TTrimSPData::Normalize(double e) const {
bool TTrimSPData::IsNormalized(double e) const { bool TTrimSPData::IsNormalized(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
return fIsNormalized[i]; return fIsNormalized[i];
} }
cout << "TTrimSPData::IsNormalized: No implantation profile available for the specified energy... Returning false! Check your code!" << endl; std::cout << "TTrimSPData::IsNormalized: No implantation profile available for the specified energy... Returning false! Check your code!" << std::endl;
return false; return false;
} }
@ -436,19 +430,19 @@ bool TTrimSPData::IsNormalized(double e) const {
double TTrimSPData::MeanRange(double e) const { double TTrimSPData::MeanRange(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
if (!fIsNormalized[i]) if (!fIsNormalized[i])
Normalize(e); Normalize(e);
double mean(0.0); double mean(0.0);
for(unsigned int j(0); j<fDataNZ[i].size(); j++){ for (unsigned int j(0); j<fDataNZ[i].size(); j++){
mean += fDataNZ[i][j]*fDataZ[i][j]; mean += fDataNZ[i][j]*fDataZ[i][j];
} }
mean *= fDZ[i]/10.0; mean *= fDZ[i]/10.0;
return mean; return mean;
} }
cout << "TTrimSPData::MeanRange: No implantation profile available for the specified energy... Returning -1! Check your code!" << endl; std::cout << "TTrimSPData::MeanRange: No implantation profile available for the specified energy... Returning -1! Check your code!" << std::endl;
return -1.; return -1.;
} }
@ -460,21 +454,21 @@ double TTrimSPData::PeakRange(double e) const {
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
vector<double>::const_iterator nziter; std::vector<double>::const_iterator nziter;
nziter = max_element(fDataNZ[i].begin(),fDataNZ[i].end()); nziter = max_element(fDataNZ[i].begin(),fDataNZ[i].end());
if(nziter != fDataNZ[i].end()){ if (nziter != fDataNZ[i].end()){
unsigned int j(nziter - fDataNZ[i].begin()); unsigned int j(nziter - fDataNZ[i].begin());
return fDataZ[i][j]/10.0; return fDataZ[i][j]/10.0;
} }
cout << "TTrimSPData::PeakRange: No maximum found in the implantation profile... Returning -1! Please check the profile!" << endl; std::cout << "TTrimSPData::PeakRange: No maximum found in the implantation profile... Returning -1! Please check the profile!" << std::endl;
return -1.; return -1.;
} }
cout << "TTrimSPData::PeakRange: No implantation profile available for the specified energy... Returning -1! Check your code!" << endl; std::cout << "TTrimSPData::PeakRange: No implantation profile available for the specified energy... Returning -1! Check your code!" << std::endl;
return -1.; return -1.;
} }
@ -484,26 +478,26 @@ double TTrimSPData::PeakRange(double e) const {
//--------------------- //---------------------
void TTrimSPData::ConvolveGss(double w, double e) const { void TTrimSPData::ConvolveGss(double w, double e) const {
if(!w) if (!w)
return; return;
vector<double> z, nz, gss; std::vector<double> z, nz, gss;
double nn; double nn;
FindEnergy(e); FindEnergy(e);
if(fEnergyIter != fEnergy.end()) { if (fEnergyIter != fEnergy.end()) {
unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int i(fEnergyIter - fEnergy.begin());
z = fDataZ[i]; z = fDataZ[i];
nz = fDataNZ[i]; nz = fDataNZ[i];
for(unsigned int k(0); k<z.size(); k++) { for (unsigned int k(0); k<z.size(); k++) {
gss.push_back(exp(-z[k]*z[k]/200.0/w/w)); gss.push_back(exp(-z[k]*z[k]/200.0/w/w));
} }
for(unsigned int k(0); k<nz.size(); k++) { for (unsigned int k(0); k<nz.size(); k++) {
nn = 0.0; nn = 0.0;
for(unsigned int j(0); j<nz.size(); j++) { for (unsigned int j(0); j<nz.size(); j++) {
nn += nz[j]*gss[abs(int(k)-int(j))]; nn += nz[j]*gss[abs(int(k)-int(j))];
} }
fDataNZ[i][k] = nn; fDataNZ[i][k] = nn;
@ -514,6 +508,6 @@ void TTrimSPData::ConvolveGss(double w, double e) const {
return; return;
} }
cout << "TTrimSPData::ConvolveGss: No implantation profile available for the specified energy... No convolution done!" << endl; std::cout << "TTrimSPData::ConvolveGss: No implantation profile available for the specified energy... No convolution done!" << std::endl;
return; return;
} }

View File

@ -32,7 +32,6 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <map> #include <map>
using namespace std;
/** /**
* <p>Class used to handle a set of low energy muon implantation profiles * <p>Class used to handle a set of low energy muon implantation profiles
@ -41,7 +40,7 @@ class TTrimSPData {
public: public:
TTrimSPData(const string&, map<double, string>&, bool debug = false, unsigned int highRes = 0); TTrimSPData(const std::string&, std::map<double, std::string>&, bool debug = false, unsigned int highRes = 0);
~TTrimSPData() { ~TTrimSPData() {
fDataZ.clear(); fDataZ.clear();
@ -52,15 +51,15 @@ public:
fIsNormalized.clear(); fIsNormalized.clear();
} }
vector<double> Energy() const {return fEnergy;} std::vector<double> Energy() const {return fEnergy;}
vector<double> DataZ(double) const; std::vector<double> DataZ(double) const;
vector<double> DataNZ(double) const; std::vector<double> DataNZ(double) const;
vector<double> OrigDataNZ(double) const; std::vector<double> OrigDataNZ(double) const;
double DataDZ(double) const; double DataDZ(double) const;
void UseHighResolution(double); void UseHighResolution(double);
void SetOriginal() {fOrigDataNZ = fDataNZ;} void SetOriginal() {fOrigDataNZ = fDataNZ;}
void WeightLayers(double, const vector<double>&, const vector<double>&) const; void WeightLayers(double, const std::vector<double>&, const std::vector<double>&) const;
double LayerFraction(double, unsigned int, const vector<double>&) const; double LayerFraction(double, unsigned int, const std::vector<double>&) const;
double GetNofZ(double, double) const; double GetNofZ(double, double) const;
void Normalize(double) const; void Normalize(double) const;
bool IsNormalized(double) const; bool IsNormalized(double) const;
@ -71,13 +70,13 @@ public:
private: private:
void FindEnergy(double) const; void FindEnergy(double) const;
vector<double> fEnergy; ///< vector holding all available muon energies std::vector<double> fEnergy; ///< vector holding all available muon energies
vector<double> fDZ; ///< vector holding the spatial resolution of the TRIM.SP output for all energies std::vector<double> fDZ; ///< vector holding the spatial resolution of the TRIM.SP output for all energies
vector< vector<double> > fDataZ; ///< discrete points in real space for which n(z) has been calculated for all energies std::vector< std::vector<double> > fDataZ; ///< discrete points in real space for which n(z) has been calculated for all energies
mutable vector< vector<double> > fDataNZ; ///< n(z) for all energies mutable std::vector< std::vector<double> > fDataNZ; ///< n(z) for all energies
vector< vector<double> > fOrigDataNZ; ///< original (unmodified) implantation profiles for all energies as read in from rge-files std::vector< std::vector<double> > fOrigDataNZ; ///< original (unmodified) implantation profiles for all energies as read in from rge-files
mutable vector<bool> fIsNormalized; ///< tag indicating if the implantation profiles are normalized (for each energy separately) mutable std::vector<bool> fIsNormalized; ///< tag indicating if the implantation profiles are normalized (for each energy separately)
mutable vector<double>::const_iterator fEnergyIter; ///< iterator traversing the vector of available energies mutable std::vector<double>::const_iterator fEnergyIter; ///< iterator traversing the vector of available energies
}; };
#endif // _TTrimSPDataHandler_H_ #endif // _TTrimSPDataHandler_H_

View File

@ -59,14 +59,14 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal()
// read XML startup file // read XML startup file
char startup_path_name[128]; char startup_path_name[128];
TSAXParser *saxParser = new TSAXParser(); std::unique_ptr<TSAXParser> saxParser = std::make_unique<TSAXParser>();
PMPStartupHandler *fStartupHandler = new PMPStartupHandler(); fStartupHandler = std::make_unique<PMPStartupHandler>();
strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data()); strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data());
saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler); saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler.get());
//Int_t status = saxParser->ParseFile(startup_path_name); //Int_t status = saxParser->ParseFile(startup_path_name);
// 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_t status = parseXmlFile(saxParser, startup_path_name); Int_t status = parseXmlFile(saxParser.get(), startup_path_name);
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed."; std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed.";
@ -74,12 +74,6 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal()
fValid = false; fValid = false;
} }
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
// check if everything went fine with the startup handler // check if everything went fine with the startup handler
if (!fStartupHandler->IsValid()) { if (!fStartupHandler->IsValid()) {
std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**";
@ -89,7 +83,7 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal()
} }
// load all the TRIM.SP rge-files // load all the TRIM.SP rge-files
fRgeHandler = new PRgeHandler(); fRgeHandler = std::make_unique<PRgeHandler>();
if (!fRgeHandler->IsValid()) { if (!fRgeHandler->IsValid()) {
std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**";
std::cout << std::endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry."; std::cout << std::endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry.";
@ -109,15 +103,6 @@ PMagProximityFitterGlobal::~PMagProximityFitterGlobal()
fPreviousParam.clear(); fPreviousParam.clear();
fField.clear(); fField.clear();
if (fRgeHandler) {
delete fRgeHandler;
fRgeHandler = nullptr;
}
if (fStartupHandler) {
delete fStartupHandler;
fStartupHandler = nullptr;
}
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

@ -30,6 +30,8 @@
#ifndef _PMAGPROXIMITYFITTER_H_ #ifndef _PMAGPROXIMITYFITTER_H_
#define _PMAGPROXIMITYFITTER_H_ #define _PMAGPROXIMITYFITTER_H_
#include <memory>
#include "PUserFcnBase.h" #include "PUserFcnBase.h"
#include "PMPStartupHandler.h" #include "PMPStartupHandler.h"
#include "PRgeHandler.h" #include "PRgeHandler.h"
@ -49,8 +51,8 @@ class PMagProximityFitterGlobal
private: private:
Bool_t fValid; Bool_t fValid;
PMPStartupHandler *fStartupHandler; std::unique_ptr<PMPStartupHandler> fStartupHandler;
PRgeHandler *fRgeHandler; std::unique_ptr<PRgeHandler> fRgeHandler;
mutable std::vector<Double_t> fPreviousParam; mutable std::vector<Double_t> fPreviousParam;

View File

@ -1507,7 +1507,7 @@ bool TMusrRunHeader::UpdateFolder(TObject *treeObj, TString path)
if (!obj) { // required object not present, create it if (!obj) { // required object not present, create it
TObjArray *oarray = new TObjArray(); TObjArray *oarray = new TObjArray();
if (!oarray) { if (oarray == nullptr) {
std::cerr << std::endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't create header structure!!" << std::endl; std::cerr << std::endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't create header structure!!" << std::endl;
return false; return false;
} }

View File

@ -50,33 +50,22 @@ TMeanFieldsForScHalfSpace::TMeanFieldsForScHalfSpace() {
// 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()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
std::string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, std::string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
} }
// Operator-method that returns the mean field for a given implantation energy // Operator-method that returns the mean field for a given implantation energy
@ -141,33 +130,22 @@ TMeanFieldsForScSingleLayer::TMeanFieldsForScSingleLayer() {
// 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()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
std::string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, std::string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
} }
// Operator-method that returns the mean field for a given implantation energy // Operator-method that returns the mean field for a given implantation energy
@ -240,33 +218,22 @@ TMeanFieldsForScBilayer::TMeanFieldsForScBilayer() {
// 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()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
std::string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, std::string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug(), 1);
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug(), 1);
} }
// Operator-method that returns the mean field for a given implantation energy // Operator-method that returns the mean field for a given implantation energy
@ -335,10 +302,10 @@ double TMeanFieldsForScBilayer::CalcMeanB (double E, const std::vector<double>&
std::vector<double> nz(fImpProfile->DataNZ(E)); std::vector<double> nz(fImpProfile->DataNZ(E));
double dz(fImpProfile->DataDZ(E)); double dz(fImpProfile->DataDZ(E));
if (E==20.0){ if (E==20.0) {
ofstream of("Implantation-profile-normal.dat"); std::ofstream of("Implantation-profile-normal.dat");
for (unsigned int i(0); i<z.size(); i++) { for (unsigned int i(0); i<z.size(); i++) {
of << z[i] << " " << nz[i] << endl; of << z[i] << " " << nz[i] << std::endl;
} }
of.close(); of.close();
} }
@ -359,33 +326,22 @@ TMeanFieldsForScTrilayer::TMeanFieldsForScTrilayer() {
// 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()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
std::string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, std::string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
} }
// Operator-method that returns the mean field for a given implantation energy // Operator-method that returns the mean field for a given implantation energy
@ -464,33 +420,22 @@ TMeanFieldsForScTrilayerWithInsulator::TMeanFieldsForScTrilayerWithInsulator() {
// 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()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
std::string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, std::string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug());
// clean up
if (saxParser) {
delete saxParser;
saxParser = 0;
}
if (startupHandler) {
delete startupHandler;
startupHandler = 0;
}
fImpProfile = std::make_unique<TTrimSPData>(rge_path, energy_vec, startupHandler->GetDebug());
} }
// Operator-method that returns the mean field for a given implantation energy // Operator-method that returns the mean field for a given implantation energy

View File

@ -29,6 +29,8 @@
#ifndef _TCalcMeanFieldsLEM_H_ #ifndef _TCalcMeanFieldsLEM_H_
#define _TCalcMeanFieldsLEM_H_ #define _TCalcMeanFieldsLEM_H_
#include <memory>
#include "TLondon1D.h" #include "TLondon1D.h"
class TMeanFieldsForScHalfSpace : public PUserFcnBase { class TMeanFieldsForScHalfSpace : public PUserFcnBase {
@ -36,13 +38,12 @@ class TMeanFieldsForScHalfSpace : public PUserFcnBase {
public: public:
// default constructor // default constructor
TMeanFieldsForScHalfSpace(); TMeanFieldsForScHalfSpace();
~TMeanFieldsForScHalfSpace() {delete fImpProfile; fImpProfile = 0;}
double operator()(double, const std::vector<double>&) const; double operator()(double, const std::vector<double>&) const;
double CalcMeanB (double, const TLondon1D_HS&) const; double CalcMeanB (double, const TLondon1D_HS&) const;
private: private:
TTrimSPData *fImpProfile; std::unique_ptr<TTrimSPData> fImpProfile;
ClassDef(TMeanFieldsForScHalfSpace,1) ClassDef(TMeanFieldsForScHalfSpace,1)
}; };
@ -52,13 +53,12 @@ class TMeanFieldsForScSingleLayer : public PUserFcnBase {
public: public:
// default constructor // default constructor
TMeanFieldsForScSingleLayer(); TMeanFieldsForScSingleLayer();
~TMeanFieldsForScSingleLayer() {delete fImpProfile; fImpProfile = 0;}
double operator()(double, const std::vector<double>&) const; double operator()(double, const std::vector<double>&) const;
double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_1L&) const; double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_1L&) const;
private: private:
TTrimSPData *fImpProfile; std::unique_ptr<TTrimSPData> fImpProfile;
ClassDef(TMeanFieldsForScSingleLayer,1) ClassDef(TMeanFieldsForScSingleLayer,1)
}; };
@ -68,13 +68,12 @@ class TMeanFieldsForScBilayer : public PUserFcnBase {
public: public:
// default constructor // default constructor
TMeanFieldsForScBilayer(); TMeanFieldsForScBilayer();
~TMeanFieldsForScBilayer() {delete fImpProfile; fImpProfile = 0;}
double operator()(double, const std::vector<double>&) const; double operator()(double, const std::vector<double>&) const;
double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_2L&, double) const; double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_2L&, double) const;
private: private:
TTrimSPData *fImpProfile; std::unique_ptr<TTrimSPData> fImpProfile;
ClassDef(TMeanFieldsForScBilayer,1) ClassDef(TMeanFieldsForScBilayer,1)
}; };
@ -84,13 +83,12 @@ class TMeanFieldsForScTrilayer : public PUserFcnBase {
public: public:
// default constructor // default constructor
TMeanFieldsForScTrilayer(); TMeanFieldsForScTrilayer();
~TMeanFieldsForScTrilayer() {delete fImpProfile; fImpProfile = 0;}
double operator()(double, const std::vector<double>&) const; double operator()(double, const std::vector<double>&) const;
double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_3L&) const; double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_3L&) const;
private: private:
TTrimSPData *fImpProfile; std::unique_ptr<TTrimSPData> fImpProfile;
ClassDef(TMeanFieldsForScTrilayer,1) ClassDef(TMeanFieldsForScTrilayer,1)
}; };
@ -100,13 +98,12 @@ class TMeanFieldsForScTrilayerWithInsulator : public PUserFcnBase {
public: public:
// default constructor // default constructor
TMeanFieldsForScTrilayerWithInsulator(); TMeanFieldsForScTrilayerWithInsulator();
~TMeanFieldsForScTrilayerWithInsulator() {delete fImpProfile; fImpProfile = 0;}
double operator()(double, const std::vector<double>&) const; double operator()(double, const std::vector<double>&) const;
double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_3LwInsulator&) const; double CalcMeanB (double, const std::vector<double>&, const std::vector<double>&, const TLondon1D_3LwInsulator&) const;
private: private:
TTrimSPData *fImpProfile; std::unique_ptr<TTrimSPData> fImpProfile;
ClassDef(TMeanFieldsForScTrilayerWithInsulator,1) ClassDef(TMeanFieldsForScTrilayerWithInsulator,1)
}; };

View File

@ -147,7 +147,7 @@ TLondon1D3LS::~TLondon1D3LS() {
TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) { TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("BMW_startup.xml"); std::string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
@ -158,16 +158,16 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
int status = parseXmlFile(saxParser, startup_path_name.c_str()); int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
fNSteps = startupHandler->GetNSteps(); fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fParForPofT.push_back(0.0); // phase fParForPofT.push_back(0.0); // phase
fParForPofT.push_back(startupHandler->GetDeltat()); fParForPofT.push_back(startupHandler->GetDeltat());
@ -203,18 +203,18 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) {
// Parameters: all the parameters for the function to be fitted through TLondon1DHS // Parameters: all the parameters for the function to be fitted through TLondon1DHS
//------------------ //------------------
double TLondon1DHS::operator()(double t, const vector<double> &par) const { double TLondon1DHS::operator()(double t, const std::vector<double> &par) const {
assert(par.size() == 5); assert(par.size() == 5);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
bool dead_layer_changed(false); bool dead_layer_changed(false);
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(2); i<fPar.size(); i++){ for (unsigned int i(2); i<fPar.size(); i++){
@ -230,7 +230,7 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
@ -253,7 +253,7 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; // std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
@ -264,8 +264,8 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
fParForPofB[3] = par[2]; // Bkg-Field fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero) //fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(dead_layer_changed){ if (dead_layer_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]);// dead layer interfaces.push_back(par[3]);// dead layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer
interfaces.clear(); interfaces.clear();
@ -286,7 +286,6 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
@ -298,7 +297,7 @@ double TLondon1DHS::operator()(double t, const vector<double> &par) const {
TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) { TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("BMW_startup.xml"); std::string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
@ -309,16 +308,16 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
int status = parseXmlFile(saxParser, startup_path_name.c_str()); int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
fNSteps = startupHandler->GetNSteps(); fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fParForPofT.push_back(0.0); fParForPofT.push_back(0.0);
fParForPofT.push_back(startupHandler->GetDeltat()); fParForPofT.push_back(startupHandler->GetDeltat());
@ -354,7 +353,7 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) {
// Parameters: all the parameters for the function to be fitted through TLondon1D1L // Parameters: all the parameters for the function to be fitted through TLondon1D1L
//------------------ //------------------
double TLondon1D1L::operator()(double t, const vector<double> &par) const { double TLondon1D1L::operator()(double t, const std::vector<double> &par) const {
assert(par.size() == 6 || par.size() == 8); assert(par.size() == 6 || par.size() == 8);
@ -362,7 +361,7 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
// Count the number of function calls // Count the number of function calls
// fCallCounter++; // fCallCounter++;
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
bool bkg_fraction_changed(false); bool bkg_fraction_changed(false);
@ -370,7 +369,7 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(2); i<fPar.size(); i++){ for (unsigned int i(2); i<fPar.size(); i++){
@ -389,7 +388,7 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
@ -413,7 +412,7 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; // std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
@ -424,12 +423,12 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
fParForPofB[3] = par[2]; // Bkg-Field fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero) //fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(weights_changed) { if (weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]+par[4]); interfaces.push_back(par[3]+par[4]);
vector<double> weights; std::vector<double> weights;
for(unsigned int i(6); i<8; i++) for (unsigned int i(6); i<8; i++)
weights.push_back(par[i]); weights.push_back(par[i]);
// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl;
@ -439,8 +438,8 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
weights.clear(); weights.clear();
} }
if(bkg_fraction_changed || weights_changed) { if (bkg_fraction_changed || weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]);// dead layer interfaces.push_back(par[3]);// dead layer
interfaces.push_back(par[3] + par[4]);// dead layer + first layer interfaces.push_back(par[3] + par[4]);// dead layer + first layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer
@ -484,7 +483,7 @@ double TLondon1D1L::operator()(double t, const vector<double> &par) const {
TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) { TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("BMW_startup.xml"); std::string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
@ -495,16 +494,16 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
int status = parseXmlFile(saxParser, startup_path_name.c_str()); int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
fNSteps = startupHandler->GetNSteps(); fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fParForPofT.push_back(0.0); fParForPofT.push_back(0.0);
fParForPofT.push_back(startupHandler->GetDeltat()); fParForPofT.push_back(startupHandler->GetDeltat());
@ -540,11 +539,11 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) {
// Parameters: all the parameters for the function to be fitted through TLondon1D2L // Parameters: all the parameters for the function to be fitted through TLondon1D2L
//------------------ //------------------
double TLondon1D2L::operator()(double t, const vector<double> &par) const { double TLondon1D2L::operator()(double t, const std::vector<double> &par) const {
assert(par.size() == 8 || par.size() == 11); assert(par.size() == 8 || par.size() == 11);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
bool bkg_fraction_changed(false); bool bkg_fraction_changed(false);
@ -552,7 +551,7 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(2); i<fPar.size(); i++){ for (unsigned int i(2); i<fPar.size(); i++){
@ -570,7 +569,7 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
@ -594,7 +593,7 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; // std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
@ -605,13 +604,13 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
fParForPofB[3] = par[2]; // Bkg-Field fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero) //fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(weights_changed) { if (weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]+par[4]); interfaces.push_back(par[3]+par[4]);
interfaces.push_back(par[3]+par[4]+par[5]); interfaces.push_back(par[3]+par[4]+par[5]);
vector<double> weights; std::vector<double> weights;
for(unsigned int i(8); i<11; i++) for (unsigned int i(8); i<11; i++)
weights.push_back(par[i]); weights.push_back(par[i]);
// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl;
@ -621,8 +620,8 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
weights.clear(); weights.clear();
} }
if(bkg_fraction_changed || weights_changed) { if (bkg_fraction_changed || weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]);// dead layer interfaces.push_back(par[3]);// dead layer
interfaces.push_back(par[3] + par[4] + par[5]);// dead layer + first layer + second layer interfaces.push_back(par[3] + par[4] + par[5]);// dead layer + first layer + second layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer
@ -646,7 +645,6 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
//------------------ //------------------
@ -657,7 +655,7 @@ double TLondon1D2L::operator()(double t, const vector<double> &par) const {
TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) { TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("BMW_startup.xml"); std::string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
@ -668,16 +666,16 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
int status = parseXmlFile(saxParser, startup_path_name.c_str()); int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
fNSteps = startupHandler->GetNSteps(); fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fParForPofT.push_back(0.0); fParForPofT.push_back(0.0);
fParForPofT.push_back(startupHandler->GetDeltat()); fParForPofT.push_back(startupHandler->GetDeltat());
@ -713,18 +711,18 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) {
// Parameters: all the parameters for the function to be fitted through TProximity1D1LHS // Parameters: all the parameters for the function to be fitted through TProximity1D1LHS
//------------------ //------------------
double TProximity1D1LHS::operator()(double t, const vector<double> &par) const { double TProximity1D1LHS::operator()(double t, const std::vector<double> &par) const {
assert(par.size() == 7); assert(par.size() == 7);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
bool dead_layer_changed(false); bool dead_layer_changed(false);
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(2); i<fPar.size(); i++){ for (unsigned int i(2); i<fPar.size(); i++){
@ -740,14 +738,14 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
only_phase_changed = true; only_phase_changed = true;
} else { } else {
only_phase_changed = false; only_phase_changed = false;
if (i == 4){ if (i == 4) {
dead_layer_changed = true; dead_layer_changed = true;
} }
} }
@ -763,7 +761,7 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; // std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
@ -774,8 +772,8 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
fParForPofB[3] = par[2]; // Bkg-Field fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero) //fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(dead_layer_changed){ if (dead_layer_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[4]);// dead layer interfaces.push_back(par[4]);// dead layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer
interfaces.clear(); interfaces.clear();
@ -797,7 +795,6 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
//------------------ //------------------
@ -807,7 +804,7 @@ double TProximity1D1LHS::operator()(double t, const vector<double> &par) const {
TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) { TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("BMW_startup.xml"); std::string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
@ -818,16 +815,16 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
int status = parseXmlFile(saxParser, startup_path_name.c_str()); int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
fNSteps = startupHandler->GetNSteps(); fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fParForPofT.push_back(0.0); fParForPofT.push_back(0.0);
fParForPofT.push_back(startupHandler->GetDeltat()); fParForPofT.push_back(startupHandler->GetDeltat());
@ -863,11 +860,11 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) {
// Parameters: all the parameters for the function to be fitted through TLondon1D3L // Parameters: all the parameters for the function to be fitted through TLondon1D3L
//------------------ //------------------
double TLondon1D3L::operator()(double t, const vector<double> &par) const { double TLondon1D3L::operator()(double t, const std::vector<double> &par) const {
assert(par.size() == 10 || par.size() == 14); assert(par.size() == 10 || par.size() == 14);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
bool bkg_fraction_changed(false); bool bkg_fraction_changed(false);
@ -875,7 +872,7 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(2); i<fPar.size(); i++){ for (unsigned int i(2); i<fPar.size(); i++){
@ -893,7 +890,7 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
@ -917,7 +914,7 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; // std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
@ -928,14 +925,14 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
fParForPofB[3] = par[2]; // Bkg-Field fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero) //fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(weights_changed) { if (weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]+par[4]); interfaces.push_back(par[3]+par[4]);
interfaces.push_back(par[3]+par[4]+par[5]); interfaces.push_back(par[3]+par[4]+par[5]);
interfaces.push_back(par[3]+par[4]+par[5]+par[6]); interfaces.push_back(par[3]+par[4]+par[5]+par[6]);
vector<double> weights; std::vector<double> weights;
for(unsigned int i(10); i<14; i++) for (unsigned int i(10); i<14; i++)
weights.push_back(par[i]); weights.push_back(par[i]);
// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl;
@ -945,8 +942,8 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
weights.clear(); weights.clear();
} }
if(bkg_fraction_changed || weights_changed) { if (bkg_fraction_changed || weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]);// dead layer interfaces.push_back(par[3]);// dead layer
interfaces.push_back(par[3] + par[4] + par[5] + par[6]);// dead layer + first layer + second layer + third layer interfaces.push_back(par[3] + par[4] + par[5] + par[6]);// dead layer + first layer + second layer + third layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer
@ -969,7 +966,6 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
//------------------ //------------------
@ -979,7 +975,7 @@ double TLondon1D3L::operator()(double t, const vector<double> &par) const {
TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) { TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
// read startup file // read startup file
string startup_path_name("BMW_startup.xml"); std::string startup_path_name("BMW_startup.xml");
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
BMWStartupHandler *startupHandler = new BMWStartupHandler(); BMWStartupHandler *startupHandler = new BMWStartupHandler();
@ -990,16 +986,16 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
int status = parseXmlFile(saxParser, startup_path_name.c_str()); int status = parseXmlFile(saxParser, startup_path_name.c_str());
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
fNSteps = startupHandler->GetNSteps(); fNSteps = startupHandler->GetNSteps();
fWisdom = startupHandler->GetWisdomFile(); fWisdom = startupHandler->GetWisdomFile();
string rge_path(startupHandler->GetDataPath()); std::string rge_path(startupHandler->GetDataPath());
map<double, string> energy_vec(startupHandler->GetEnergies()); std::map<double, std::string> energy_vec(startupHandler->GetEnergies());
fParForPofT.push_back(0.0); fParForPofT.push_back(0.0);
fParForPofT.push_back(startupHandler->GetDeltat()); fParForPofT.push_back(startupHandler->GetDeltat());
@ -1035,11 +1031,11 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) {
// Parameters: all the parameters for the function to be fitted through TLondon1D3LS // Parameters: all the parameters for the function to be fitted through TLondon1D3LS
//------------------ //------------------
double TLondon1D3LS::operator()(double t, const vector<double> &par) const { double TLondon1D3LS::operator()(double t, const std::vector<double> &par) const {
assert(par.size() == 9 || par.size() == 13); assert(par.size() == 9 || par.size() == 13);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
bool bkg_fraction_changed(false); bool bkg_fraction_changed(false);
@ -1047,7 +1043,7 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(2); i<fPar.size(); i++){ for (unsigned int i(2); i<fPar.size(); i++){
@ -1065,7 +1061,7 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
@ -1089,7 +1085,7 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; // std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
@ -1100,14 +1096,14 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
fParForPofB[3] = par[2]; // Bkg-Field fParForPofB[3] = par[2]; // Bkg-Field
//fParForPofB[4] = 0.005; // Bkg-width (in principle zero) //fParForPofB[4] = 0.005; // Bkg-width (in principle zero)
if(weights_changed) { if (weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]+par[4]); interfaces.push_back(par[3]+par[4]);
interfaces.push_back(par[3]+par[4]+par[5]); interfaces.push_back(par[3]+par[4]+par[5]);
interfaces.push_back(par[3]+par[4]+par[5]+par[6]); interfaces.push_back(par[3]+par[4]+par[5]+par[6]);
vector<double> weights; std::vector<double> weights;
for(unsigned int i(9); i<13; i++) for (unsigned int i(9); i<13; i++)
weights.push_back(par[i]); weights.push_back(par[i]);
// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl;
@ -1117,8 +1113,8 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
weights.clear(); weights.clear();
} }
if(bkg_fraction_changed || weights_changed) { if (bkg_fraction_changed || weights_changed) {
vector<double> interfaces; std::vector<double> interfaces;
interfaces.push_back(par[3]);// dead layer interfaces.push_back(par[3]);// dead layer
interfaces.push_back(par[3] + par[4] + par[5] + par[6]);// dead layer + first layer + second layer + third layer interfaces.push_back(par[3] + par[4] + par[5] + par[6]);// dead layer + first layer + second layer + third layer
fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces) + // Fraction of muons in the deadlayer
@ -1141,7 +1137,6 @@ double TLondon1D3LS::operator()(double t, const vector<double> &par) const {
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
// //------------------ // //------------------

View File

@ -553,7 +553,7 @@ void TPofBCalc::Calculate(const TBulkVortexFieldCalc *vortexLattice, const std::
if (fill_index < fPBSize) { if (fill_index < fPBSize) {
fPB[fill_index] += 1.0; fPB[fill_index] += 1.0;
} else { } else {
cout << "Field over the limit..." << endl; std::cout << "Field over the limit..." << std::endl;
} }
} }
// of << endl; // of << endl;

View File

@ -217,7 +217,7 @@ double TPofTCalc::Eval(double t) const {
// Parameters: output filename, par(dt, dB, timeres, channels, asyms, phases, t0s, N0s, bgs) optPar(field, energy) // Parameters: output filename, par(dt, dB, timeres, channels, asyms, phases, t0s, N0s, bgs) optPar(field, energy)
//--------------------- //---------------------
void TPofTCalc::FakeData(const string &rootOutputFileName, const std::vector<double> &par, const std::vector<double> *optPar = 0) { void TPofTCalc::FakeData(const std::string &rootOutputFileName, const std::vector<double> &par, const std::vector<double> *optPar = 0) {
//determine the number of histograms to be built //determine the number of histograms to be built
unsigned int numHist(0); unsigned int numHist(0);

View File

@ -64,9 +64,9 @@ TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) {
int status (saxParser->ParseFile(startup_path_name.c_str())); int status (saxParser->ParseFile(startup_path_name.c_str()));
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }

View File

@ -52,12 +52,6 @@ ClassImp(TBulkAnisotropicTriVortexAGL)
//------------------ //------------------
TBulkTriVortexLondon::~TBulkTriVortexLondon() { TBulkTriVortexLondon::~TBulkTriVortexLondon() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -69,12 +63,6 @@ TBulkTriVortexLondon::~TBulkTriVortexLondon() {
//------------------ //------------------
TBulkSqVortexLondon::~TBulkSqVortexLondon() { TBulkSqVortexLondon::~TBulkSqVortexLondon() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -86,12 +74,6 @@ TBulkSqVortexLondon::~TBulkSqVortexLondon() {
//------------------ //------------------
TBulkTriVortexML::~TBulkTriVortexML() { TBulkTriVortexML::~TBulkTriVortexML() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -103,12 +85,6 @@ TBulkTriVortexML::~TBulkTriVortexML() {
//------------------ //------------------
TBulkTriVortexAGL::~TBulkTriVortexAGL() { TBulkTriVortexAGL::~TBulkTriVortexAGL() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -120,12 +96,6 @@ TBulkTriVortexAGL::~TBulkTriVortexAGL() {
//------------------ //------------------
TBulkTriVortexAGLII::~TBulkTriVortexAGLII() { TBulkTriVortexAGLII::~TBulkTriVortexAGLII() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -137,12 +107,6 @@ TBulkTriVortexAGLII::~TBulkTriVortexAGLII() {
//------------------ //------------------
TBulkTriVortexNGL::~TBulkTriVortexNGL() { TBulkTriVortexNGL::~TBulkTriVortexNGL() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -159,18 +123,18 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
// 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -192,21 +156,11 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru
fParForPofB.push_back(0.0); // vortex-weighting || antiferromagnetic field fParForPofB.push_back(0.0); // vortex-weighting || antiferromagnetic field
fParForPofB.push_back(0.0); // vortex-weighting: 0.0 homogeneous, 1.0 Gaussian, 2.0 Lorentzian || 3.0 antiferromagnetic vortex-cores fParForPofB.push_back(0.0); // vortex-weighting: 0.0 homogeneous, 1.0 Gaussian, 2.0 Lorentzian || 3.0 antiferromagnetic vortex-cores
fVortex = new TBulkTriVortexLondonFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkTriVortexLondonFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
//------------------ //------------------
@ -219,18 +173,18 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -250,21 +204,11 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : 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
fVortex = new TBulkSqVortexLondonFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkSqVortexLondonFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
//------------------ //------------------
@ -277,12 +221,12 @@ double TBulkTriVortexLondon::operator()(double t, const std::vector<double> &par
assert(par.size() == 4 || par.size() == 5 || par.size() == 7 || par.size() == 8); // normal, +BkgWeight, +VortexWeighting, +AFfield assert(par.size() == 4 || par.size() == 5 || par.size() == 7 || par.size() == 8); // normal, +BkgWeight, +VortexWeighting, +AFfield
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 3; i++) { for (unsigned int i(0); i < 3; i++) {
@ -342,7 +286,7 @@ double TBulkTriVortexLondon::operator()(double t, const std::vector<double> &par
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
@ -422,7 +366,7 @@ double TBulkSqVortexLondon::operator()(double t, const std::vector<double> &par)
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
@ -449,18 +393,18 @@ TBulkTriVortexML::TBulkTriVortexML() : 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -480,21 +424,11 @@ TBulkTriVortexML::TBulkTriVortexML() : 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
fVortex = new TBulkTriVortexMLFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkTriVortexMLFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
//------------------ //------------------
@ -507,12 +441,12 @@ double TBulkTriVortexML::operator()(double t, const std::vector<double> &par) co
assert(par.size() == 4 || par.size() == 5); assert(par.size() == 4 || par.size() == 5);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 3; i++) { for (unsigned int i(0); i < 3; i++) {
@ -547,7 +481,7 @@ double TBulkTriVortexML::operator()(double t, const std::vector<double> &par) co
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; // cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
@ -561,7 +495,7 @@ double TBulkTriVortexML::operator()(double t, const std::vector<double> &par) co
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
@ -574,7 +508,6 @@ double TBulkTriVortexML::operator()(double t, const std::vector<double> &par) co
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
@ -588,18 +521,18 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -619,21 +552,11 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : 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
fVortex = new TBulkTriVortexAGLFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkTriVortexAGLFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
//------------------ //------------------
@ -646,12 +569,12 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector<double> &par) c
assert(par.size() == 4 || par.size() == 5); assert(par.size() == 4 || par.size() == 5);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 3; i++) { for (unsigned int i(0); i < 3; i++) {
@ -686,7 +609,7 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector<double> &par) c
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; // cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
@ -700,7 +623,7 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector<double> &par) c
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
@ -713,7 +636,6 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector<double> &par) c
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
//------------------ //------------------
@ -726,18 +648,18 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -759,21 +681,11 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true)
fParForPofB.push_back(0.0); // vortex-weighting || antiferromagnetic field fParForPofB.push_back(0.0); // vortex-weighting || antiferromagnetic field
fParForPofB.push_back(0.0); // vortex-weighting: 0.0 homogeneous, 1.0 Gaussian, 2.0 Lorentzian || 3.0 antiferromagnetic vortex-cores fParForPofB.push_back(0.0); // vortex-weighting: 0.0 homogeneous, 1.0 Gaussian, 2.0 Lorentzian || 3.0 antiferromagnetic vortex-cores
fVortex = new TBulkTriVortexAGLIIFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkTriVortexAGLIIFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
//------------------ //------------------
@ -786,12 +698,12 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector<double> &par)
assert(par.size() == 4 || par.size() == 5 || par.size() == 7 || par.size() == 8); assert(par.size() == 4 || par.size() == 5 || par.size() == 7 || par.size() == 8);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 3; i++) { for (unsigned int i(0); i < 3; i++) {
@ -826,7 +738,7 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector<double> &par)
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; // cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
@ -851,7 +763,7 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector<double> &par)
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
@ -864,7 +776,6 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector<double> &par)
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
//------------------ //------------------
@ -877,18 +788,18 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -908,21 +819,11 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : 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
fVortex = new TBulkTriVortexNGLFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkTriVortexNGLFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
//------------------ //------------------
@ -935,12 +836,12 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector<double> &par) c
assert(par.size() == 4 || par.size() == 5); assert(par.size() == 4 || par.size() == 5);
if(t<0.0) if (t<0.0)
return cos(par[0]*0.017453293); return cos(par[0]*0.017453293);
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 3; i++) { for (unsigned int i(0); i < 3; i++) {
@ -975,7 +876,7 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector<double> &par) c
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; // cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
@ -989,7 +890,7 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector<double> &par) c
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
@ -1002,7 +903,6 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector<double> &par) c
} }
return fPofT->Eval(t); return fPofT->Eval(t);
} }
//------------------ //------------------
@ -1010,12 +910,6 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector<double> &par) c
//------------------ //------------------
TBulkAnisotropicTriVortexLondonGlobal::~TBulkAnisotropicTriVortexLondonGlobal() { TBulkAnisotropicTriVortexLondonGlobal::~TBulkAnisotropicTriVortexLondonGlobal() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -1032,18 +926,18 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() :
// 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -1063,21 +957,11 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() :
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
fVortex = new TBulkAnisotropicTriVortexLondonFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkAnisotropicTriVortexLondonFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector<double> &par) const { void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector<double> &par) const {
@ -1090,7 +974,7 @@ void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector<double> &par)
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 5; i++) { for (unsigned int i(0); i < 5; i++) {
@ -1127,7 +1011,7 @@ void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector<double> &par)
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; // cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl;
@ -1141,7 +1025,7 @@ void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector<double> &par)
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
@ -1198,7 +1082,7 @@ void TBulkAnisotropicTriVortexLondon::SetGlobalPart(std::vector<void *> &globalP
fGlobalUserFcn = new TBulkAnisotropicTriVortexLondonGlobal(); fGlobalUserFcn = new TBulkAnisotropicTriVortexLondonGlobal();
if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error
fValid = false; fValid = false;
cerr << endl << ">> TBulkAnisotropicTriVortexLondon::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << endl; std::cerr << std::endl << ">> TBulkAnisotropicTriVortexLondon::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << std::endl;
} else { // global user function object could be invoked -> resize to global user function vector and keep the pointer to the corresponding object } else { // global user function object could be invoked -> resize to global user function vector and keep the pointer to the corresponding object
globalPart.resize(fIdxGlobal+1); globalPart.resize(fIdxGlobal+1);
globalPart[fIdxGlobal] = dynamic_cast<TBulkAnisotropicTriVortexLondonGlobal*>(fGlobalUserFcn); globalPart[fIdxGlobal] = dynamic_cast<TBulkAnisotropicTriVortexLondonGlobal*>(fGlobalUserFcn);
@ -1238,7 +1122,7 @@ double TBulkAnisotropicTriVortexLondon::operator()(double t, const std::vector<d
assert(param.size() == 6); assert(param.size() == 6);
assert(fGlobalUserFcn); assert(fGlobalUserFcn);
if(t<0.0) if (t<0.0)
return cos(param[0]*0.017453293); return cos(param[0]*0.017453293);
// call the global user function object // call the global user function object
@ -1252,12 +1136,6 @@ double TBulkAnisotropicTriVortexLondon::operator()(double t, const std::vector<d
//------------------ //------------------
TBulkAnisotropicTriVortexMLGlobal::~TBulkAnisotropicTriVortexMLGlobal() { TBulkAnisotropicTriVortexMLGlobal::~TBulkAnisotropicTriVortexMLGlobal() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -1274,18 +1152,18 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe
// 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -1305,21 +1183,11 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe
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
fVortex = new TBulkAnisotropicTriVortexMLFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkAnisotropicTriVortexMLFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector<double> &par) const { void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector<double> &par) const {
@ -1332,7 +1200,7 @@ void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector<double> &par) con
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 5; i++) { for (unsigned int i(0); i < 5; i++) {
@ -1347,7 +1215,7 @@ void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector<double> &par) con
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
@ -1369,9 +1237,9 @@ void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector<double> &par) con
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; // cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
for (unsigned int i(0); i < 5; i++) { for (unsigned int i(0); i < 5; i++) {
fParForVortex[i] = par[i+1]; fParForVortex[i] = par[i+1];
@ -1383,11 +1251,11 @@ void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector<double> &par) con
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl;
}*/ }*/
fPofT->CalcPol(fParForPofT); fPofT->CalcPol(fParForPofT);
@ -1440,7 +1308,7 @@ void TBulkAnisotropicTriVortexML::SetGlobalPart(std::vector<void *> &globalPart,
fGlobalUserFcn = new TBulkAnisotropicTriVortexMLGlobal(); fGlobalUserFcn = new TBulkAnisotropicTriVortexMLGlobal();
if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error
fValid = false; fValid = false;
cerr << endl << ">> TBulkAnisotropicTriVortexML::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << endl; std::cerr << std::endl << ">> TBulkAnisotropicTriVortexML::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << std::endl;
} else { // global user function object could be invoked -> resize to global user function vector and keep the pointer to the corresponding object } else { // global user function object could be invoked -> resize to global user function vector and keep the pointer to the corresponding object
globalPart.resize(fIdxGlobal+1); globalPart.resize(fIdxGlobal+1);
globalPart[fIdxGlobal] = dynamic_cast<TBulkAnisotropicTriVortexMLGlobal*>(fGlobalUserFcn); globalPart[fIdxGlobal] = dynamic_cast<TBulkAnisotropicTriVortexMLGlobal*>(fGlobalUserFcn);
@ -1480,7 +1348,7 @@ double TBulkAnisotropicTriVortexML::operator()(double t, const std::vector<doubl
assert(param.size() == 6); assert(param.size() == 6);
assert(fGlobalUserFcn); assert(fGlobalUserFcn);
if(t<0.0) if (t<0.0)
return cos(param[0]*0.017453293); return cos(param[0]*0.017453293);
// call the global user function object // call the global user function object
@ -1494,12 +1362,6 @@ double TBulkAnisotropicTriVortexML::operator()(double t, const std::vector<doubl
//------------------ //------------------
TBulkAnisotropicTriVortexAGLGlobal::~TBulkAnisotropicTriVortexAGLGlobal() { TBulkAnisotropicTriVortexAGLGlobal::~TBulkAnisotropicTriVortexAGLGlobal() {
delete fPofT;
fPofT = 0;
delete fPofB;
fPofT = 0;
delete fVortex;
fVortex = 0;
fPar.clear(); fPar.clear();
fParForVortex.clear(); fParForVortex.clear();
fParForPofB.clear(); fParForPofB.clear();
@ -1516,18 +1378,18 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc
// 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
cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \
<< endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \
<< endl; << std::endl;
assert(false); assert(false);
} }
@ -1547,21 +1409,11 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc
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
fVortex = new TBulkAnisotropicTriVortexAGLFieldCalc(fWisdom, fGridSteps); fVortex = std::make_unique<TBulkAnisotropicTriVortexAGLFieldCalc>(fWisdom, fGridSteps);
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;
}
} }
void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector<double> &par) const { void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector<double> &par) const {
@ -1574,7 +1426,7 @@ void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector<double> &par) co
// check if the function is called the first time and if yes, read in parameters // check if the function is called the first time and if yes, read in parameters
if(fFirstCall){ if (fFirstCall) {
fPar = par; fPar = par;
for (unsigned int i(0); i < 5; i++) { for (unsigned int i(0); i < 5; i++) {
@ -1589,7 +1441,7 @@ void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector<double> &par) co
bool only_phase_changed(false); bool only_phase_changed(false);
for (unsigned int i(0); i<fPar.size(); i++) { for (unsigned int i(0); i<fPar.size(); i++) {
if( fPar[i]-par[i] ) { if ( fPar[i]-par[i] ) {
fPar[i] = par[i]; fPar[i] = par[i];
par_changed = true; par_changed = true;
if (i == 0) { if (i == 0) {
@ -1611,9 +1463,9 @@ void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector<double> &par) co
fParForPofT[0] = par[0]; // phase fParForPofT[0] = par[0]; // phase
if(!only_phase_changed) { if (!only_phase_changed) {
// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; // cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl;
for (unsigned int i(0); i < 5; i++) { for (unsigned int i(0); i < 5; i++) {
fParForVortex[i] = par[i+1]; fParForVortex[i] = par[i+1];
@ -1625,11 +1477,11 @@ void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector<double> &par) co
fVortex->SetParameters(fParForVortex); fVortex->SetParameters(fParForVortex);
fVortex->CalculateGrid(); fVortex->CalculateGrid();
fPofB->UnsetPBExists(); fPofB->UnsetPBExists();
fPofB->Calculate(fVortex, fParForPofB); fPofB->Calculate(fVortex.get(), fParForPofB);
fPofT->DoFFT(); fPofT->DoFFT();
}/* else { }/* else {
cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl;
}*/ }*/
fPofT->CalcPol(fParForPofT); fPofT->CalcPol(fParForPofT);
@ -1683,7 +1535,7 @@ void TBulkAnisotropicTriVortexAGL::SetGlobalPart(std::vector<void *> &globalPart
fGlobalUserFcn = new TBulkAnisotropicTriVortexAGLGlobal(); fGlobalUserFcn = new TBulkAnisotropicTriVortexAGLGlobal();
if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error
fValid = false; fValid = false;
cerr << endl << ">> TBulkAnisotropicTriVortexAGL::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << endl; std::cerr << std::endl << ">> TBulkAnisotropicTriVortexAGL::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << std::endl;
} else { // global user function object could be invoked -> resize to global user function vector and keep the pointer to the corresponding object } else { // global user function object could be invoked -> resize to global user function vector and keep the pointer to the corresponding object
globalPart.resize(fIdxGlobal+1); globalPart.resize(fIdxGlobal+1);
globalPart[fIdxGlobal] = dynamic_cast<TBulkAnisotropicTriVortexAGLGlobal*>(fGlobalUserFcn); globalPart[fIdxGlobal] = dynamic_cast<TBulkAnisotropicTriVortexAGLGlobal*>(fGlobalUserFcn);
@ -1723,7 +1575,7 @@ double TBulkAnisotropicTriVortexAGL::operator()(double t, const std::vector<doub
assert(param.size() == 6); assert(param.size() == 6);
assert(fGlobalUserFcn); assert(fGlobalUserFcn);
if(t<0.0) if (t<0.0)
return cos(param[0]*0.017453293); return cos(param[0]*0.017453293);
// call the global user function object // call the global user function object

View File

@ -52,10 +52,10 @@ private:
TPofTCalc *fPofT; ///< muon spin polarization p(t) 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 vector<double> fParForPofT; ///< parameters for the calculation of p(t) mutable std::vector<double> fParForPofT; ///< parameters for the calculation of p(t)
mutable vector<double> fParForBofZ; ///< parameters for the calculation of B(z) mutable std::vector<double> fParForBofZ; ///< parameters for the calculation of B(z)
mutable vector<double> fParForPofB; ///< parameters for the calculation of P(B) mutable std::vector<double> fParForPofB; ///< parameters for the calculation of P(B)
string fWisdom; ///< file name of the FFTW wisdom file std::string fWisdom; ///< file name of the FFTW wisdom file
unsigned int fNSteps; ///< number of points for which B(z) is calculated unsigned int fNSteps; ///< number of points for which B(z) is calculated
ClassDef(TLondon1DHS,1) ClassDef(TLondon1DHS,1)

View File

@ -66,7 +66,7 @@ private:
double *fPT; ///< array containing the discrete values of the polarization p(t) double *fPT; ///< array containing the discrete values of the polarization p(t)
double fTBin; ///< time resolution double fTBin; ///< time resolution
int fNFFT; ///< length of the discrete 1D Fourier transform int fNFFT; ///< length of the discrete 1D Fourier transform
const string fWisdom; ///< file name of the FFTW wisdom file const std::string fWisdom; ///< file name of the FFTW wisdom file
bool fUseWisdom; ///< tag determining if a FFTW wisdom file is used bool fUseWisdom; ///< tag determining if a FFTW wisdom file is used
}; };

View File

@ -29,6 +29,8 @@
#ifndef _TVortex_H_ #ifndef _TVortex_H_
#define _TVortex_H_ #define _TVortex_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
TBulkTriVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkTriVortexLondonFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -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
TBulkSqVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkSqVortexLondonFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -105,9 +107,9 @@ public:
private: private:
mutable std::vector<double> fPar; ///< parameters of the model mutable std::vector<double> fPar; ///< parameters of the model
TBulkTriVortexMLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkTriVortexMLFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -134,9 +136,9 @@ public:
private: private:
mutable std::vector<double> fPar; ///< parameters of the model mutable std::vector<double> fPar; ///< parameters of the model
TBulkTriVortexAGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkTriVortexAGLFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -163,9 +165,9 @@ public:
private: private:
mutable std::vector<double> fPar; ///< parameters of the model mutable std::vector<double> fPar; ///< parameters of the model
TBulkTriVortexAGLIIFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkTriVortexAGLIIFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -192,9 +194,9 @@ public:
private: private:
mutable std::vector<double> fPar; ///< parameters of the model mutable std::vector<double> fPar; ///< parameters of the model
TBulkTriVortexNGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkTriVortexNGLFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -223,14 +225,14 @@ public:
void Calc(const std::vector<double>&) const; void Calc(const std::vector<double>&) const;
const TPofTCalc* GetPolarizationPointer() const { return fPofT; } const TPofTCalc* GetPolarizationPointer() const { return fPofT.get(); }
private: private:
mutable bool fValid; ///< tag indicating if the global part has been calculated mutable bool fValid; ///< tag indicating if the global part has been calculated
mutable std::vector<double> fPar; ///< parameter vector mutable std::vector<double> fPar; ///< parameter vector
TBulkAnisotropicTriVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkAnisotropicTriVortexLondonFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -287,14 +289,14 @@ public:
void Calc(const std::vector<double>&) const; void Calc(const std::vector<double>&) const;
const TPofTCalc* GetPolarizationPointer() const { return fPofT; } const TPofTCalc* GetPolarizationPointer() const { return fPofT.get(); }
private: private:
mutable bool fValid; ///< tag indicating if the global part has been calculated mutable bool fValid; ///< tag indicating if the global part has been calculated
mutable std::vector<double> fPar; ///< parameter vector mutable std::vector<double> fPar; ///< parameter vector
TBulkAnisotropicTriVortexMLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkAnisotropicTriVortexMLFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)
@ -351,14 +353,14 @@ public:
void Calc(const std::vector<double>&) const; void Calc(const std::vector<double>&) const;
const TPofTCalc* GetPolarizationPointer() const { return fPofT; } const TPofTCalc* GetPolarizationPointer() const { return fPofT.get(); }
private: private:
mutable bool fValid; ///< tag indicating if the global part has been calculated mutable bool fValid; ///< tag indicating if the global part has been calculated
mutable std::vector<double> fPar; ///< parameter vector mutable std::vector<double> fPar; ///< parameter vector
TBulkAnisotropicTriVortexAGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice std::unique_ptr<TBulkAnisotropicTriVortexAGLFieldCalc> fVortex; ///< spatial field distribution B(x,y) within the vortex lattice
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> fParForVortex; ///< parameters for the calculation of B(x,y) mutable std::vector<double> fParForVortex; ///< parameters for the calculation of B(x,y)