diff --git a/src/external/BMWtools/BMWIntegrator.h b/src/external/BMWtools/BMWIntegrator.h index 067e7d35..c0a4f4fb 100644 --- a/src/external/BMWtools/BMWIntegrator.h +++ b/src/external/BMWtools/BMWIntegrator.h @@ -35,6 +35,7 @@ #include #include +#include //----------------------------------------------------------------------------- /** @@ -88,10 +89,8 @@ inline double T2Integrator::IntegrateFunc(double x1, double x2, const std::vecto ptrPair.first = (this); ptrPair.second = ∥ - ROOT::Math::GSLIntegrator *integrator = new ROOT::Math::GSLIntegrator(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); + std::unique_ptr integrator = std::make_unique(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); double value(integrator->Integral(&T2Integrator::FuncAtXgsl, static_cast(&ptrPair), x1, x2)); - delete integrator; - integrator = nullptr; return value; } @@ -115,7 +114,7 @@ class TIntegrator { private: static double FuncAtXgsl(double, void *); - ROOT::Math::GSLIntegrator *fIntegrator; ///< pointer to the GSL integrator + std::unique_ptr fIntegrator; ///< pointer to the GSL integrator 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 */ inline TIntegrator::TIntegrator() : fFunc(0) { - fIntegrator = new ROOT::Math::GSLIntegrator(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); + fIntegrator = std::make_unique(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); } //----------------------------------------------------------------------------- @@ -135,8 +134,6 @@ inline TIntegrator::TIntegrator() : fFunc(0) { */ inline TIntegrator::~TIntegrator(){ fPar.clear(); - delete fIntegrator; - fIntegrator=nullptr; fFunc=0; } @@ -190,7 +187,7 @@ class TMCIntegrator { private: static double FuncAtXgsl(double *, size_t, void *); - ROOT::Math::GSLMCIntegrator *fMCIntegrator; ///< pointer to the GSL integrator + std::unique_ptr fMCIntegrator; ///< pointer to the GSL integrator 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 */ 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::MCIntegration::kMISER, 1.E-6, 1.E-4, 500000); } //----------------------------------------------------------------------------- @@ -210,8 +207,6 @@ inline TMCIntegrator::TMCIntegrator() : fFunc(0) { */ inline TMCIntegrator::~TMCIntegrator(){ fPar.clear(); - delete fMCIntegrator; - fMCIntegrator=nullptr; fFunc=0; } diff --git a/src/external/BMWtools/TTrimSPDataHandler.cpp b/src/external/BMWtools/TTrimSPDataHandler.cpp index 2340484c..d14fbed8 100644 --- a/src/external/BMWtools/TTrimSPDataHandler.cpp +++ b/src/external/BMWtools/TTrimSPDataHandler.cpp @@ -33,37 +33,33 @@ #include #include #include - -using namespace std; +#include //-------------------- // 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 &energies, bool debug, unsigned int highRes) { +TTrimSPData::TTrimSPData(const std::string &path, std::map &energies, bool debug, unsigned int highRes) { // 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! // sort(energies.begin(), energies.end()); double zz(0.0), nzz(0.0); - vector vzz, vnzz; - string word, energyStr; + std::vector vzz, vnzz; + std::string word, energyStr; bool goodFile(false); - for ( map::const_iterator iter(energies.begin()); iter != energies.end(); ++iter ) { + for ( std::map::const_iterator iter(energies.begin()); iter != energies.end(); ++iter ) { energyStr = path + iter->second + ".rge"; - ifstream *rgeFile = new ifstream(energyStr.c_str()); - if(! *rgeFile) { - cerr << "TTrimSPData::TTrimSPData: file " << energyStr << " not found! Try next energy..." << endl; - delete rgeFile; - rgeFile = 0; + std::unique_ptr rgeFile = std::make_unique(energyStr.c_str()); + if (rgeFile == nullptr) { + std::cerr << "TTrimSPData::TTrimSPData: file " << energyStr << " not found! Try next energy..." << std::endl; } else { - - while(*rgeFile >> word) { - if(word == "PARTICLES") { + while (*rgeFile >> word) { + if (word == "PARTICLES") { goodFile = true; break; } @@ -73,7 +69,7 @@ TTrimSPData::TTrimSPData(const string &path, map &energies, bool fEnergy.push_back(iter->first); - while(!rgeFile->eof()) { + while (!rgeFile->eof()) { *rgeFile >> zz >> nzz; vzz.push_back(zz); vnzz.push_back(nzz); @@ -92,8 +88,6 @@ TTrimSPData::TTrimSPData(const string &path, map &energies, bool rgeFile->close(); - delete rgeFile; - rgeFile = 0; vzz.clear(); vnzz.clear(); @@ -106,14 +100,14 @@ TTrimSPData::TTrimSPData(const string &path, map &energies, bool } } 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; } } } 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; @@ -126,8 +120,8 @@ TTrimSPData::TTrimSPData(const string &path, map &energies, bool // If it is not found the energy iterator will point to the end() of the energy vector. void TTrimSPData::FindEnergy(double e) const { - for(fEnergyIter = fEnergy.begin(); fEnergyIter != fEnergy.end(); ++fEnergyIter) { - if(fabs(*fEnergyIter - e) < 0.05) + for (fEnergyIter = fEnergy.begin(); fEnergyIter != fEnergy.end(); ++fEnergyIter) { + if (fabs(*fEnergyIter - e) < 0.05) return; } return; @@ -137,11 +131,11 @@ void TTrimSPData::UseHighResolution(double e) { FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); - vector vecZ; - vector vecNZ; - for(double zz(1.); zz<2100.; zz+=1.) { + std::vector vecZ; + std::vector vecNZ; + for (double zz(1.); zz<2100.; zz+=1.) { vecZ.push_back(zz); vecNZ.push_back(GetNofZ(zz/10.0, e)); } @@ -153,7 +147,7 @@ void TTrimSPData::UseHighResolution(double e) { 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; } @@ -161,16 +155,16 @@ void TTrimSPData::UseHighResolution(double e) { // Method returning z-vector calculated by trim.SP for given energy[keV] //--------------------- -vector TTrimSPData::DataZ(double e) const { +std::vector TTrimSPData::DataZ(double e) const { FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); return fDataZ[i]; } // 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]; } @@ -179,50 +173,50 @@ vector TTrimSPData::DataZ(double e) const { // potentially altered by the WeightLayers- or the Normalize-method for given energy[keV] //--------------------- -vector TTrimSPData::DataNZ(double e) const { +std::vector TTrimSPData::DataNZ(double e) const { FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); return fDataNZ[i]; } // default - cout << "TTrimSPData::DataNZ: No implantation profile available for the specified energy... You get back the first one." << endl; - return fDataNZ[0]; + std::cout << "TTrimSPData::DataNZ: No implantation profile available for the specified energy... You get back the first one." << std::endl; + return fDataNZ[0]; } //--------------------- // Method returning original n(z)-vector calculated by trim.SP for given energy[keV] //--------------------- -vector TTrimSPData::OrigDataNZ(double e) const { +std::vector TTrimSPData::OrigDataNZ(double e) const { FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); return fOrigDataNZ[i]; } // default - cout << "TTrimSPData::OrigDataNZ: No implantation profile available for the specified energy... You get back the first one." << endl; - return fOrigDataNZ[0]; + std::cout << "TTrimSPData::OrigDataNZ: No implantation profile available for the specified energy... You get back the first one." << std::endl; + return fOrigDataNZ[0]; } double TTrimSPData::DataDZ(double e) const { FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); return fDZ[i]; } // default - cout << "TTrimSPData::DataDZ: No implantation profile available for the specified energy... The resolution will be zero!" << endl; - return 0.0; + std::cout << "TTrimSPData::DataDZ: No implantation profile available for the specified energy... The resolution will be zero!" << std::endl; + return 0.0; } //--------------------- @@ -230,10 +224,10 @@ double TTrimSPData::DataDZ(double e) const { // Parameters: Energy[keV], LayerNumber[1], Interfaces[nm] //--------------------- -double TTrimSPData::LayerFraction(double e, unsigned int layno, const vector& interface) const { +double TTrimSPData::LayerFraction(double e, unsigned int layno, const std::vector& interface) const { - if(layno < 1 && layno > (interface.size()+1)) { - cout << "TTrimSPData::LayerFraction: No such layer available according to your specified interfaces... Returning 0.0!" << endl; + if (layno < 1 && layno > (interface.size()+1)) { + std::cout << "TTrimSPData::LayerFraction: No such layer available according to your specified interfaces... Returning 0.0!" << std::endl; return 0.0; } @@ -244,21 +238,21 @@ double TTrimSPData::LayerFraction(double e, unsigned int layno, const vector= *(interface.end()-1)*10.0) + } else if (!(layno-interface.size()-1)) { + for (unsigned int j(0); j= *(interface.end()-1)*10.0) layerNumber += fDataNZ[i][j]; } else { - for(unsigned int j(0); j= interface[layno-2]*10.0 && fDataZ[i][j] < interface[layno-1]*10.0) + for (unsigned int j(0); j= interface[layno-2]*10.0 && fDataZ[i][j] < interface[layno-1]*10.0) layerNumber += fDataNZ[i][j]; } // fraction of muons in layer layno @@ -267,9 +261,9 @@ double TTrimSPData::LayerFraction(double e, unsigned int layno, const vector& interface, const vector& weight) const { +void TTrimSPData::WeightLayers(double e, const std::vector& interface, const std::vector& weight) const { - 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; - cout << "TTrimSPData::WeightLayers: No weighting of the implantation profile will be done unless you take care of that!" << endl; + if (weight.size()-interface.size()-1) { + std::cout << "TTrimSPData::WeightLayers: For the weighting the number of interfaces has to be one less than the number of weights!" << std::endl; + std::cout << "TTrimSPData::WeightLayers: No weighting of the implantation profile will be done unless you take care of that!" << std::endl; return; } - for(unsigned int i(0); i1) { if (interface[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; } } @@ -311,11 +305,11 @@ void TTrimSPData::WeightLayers(double e, const vector& interface, const FindEnergy(e); // If all weights are equal to one, use the original n(z) vector - for(unsigned int i(0); i& interface, const } } - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); unsigned int k(0); - for(unsigned int j(0); j& interface, const else fDataNZ[i][j] = fOrigDataNZ[i][j]*weight[k]; } - fIsNormalized[i] = false; - return; + fIsNormalized[i] = false; + 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; } @@ -353,20 +347,20 @@ void TTrimSPData::WeightLayers(double e, const vector& interface, const double TTrimSPData::GetNofZ(double zz, double e) const { - vector z, nz; + std::vector z, nz; FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); z = fDataZ[i]; nz = fDataNZ[i]; } 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); } - if(zz < 0) + if (zz < 0) return 0.0; bool found = false; @@ -395,7 +389,7 @@ void TTrimSPData::Normalize(double e) const { FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); double nZsum = 0.0; for (unsigned int j(0); j::const_iterator nziter; + std::vector::const_iterator nziter; 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()); 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.; } - 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.; } @@ -484,26 +478,26 @@ double TTrimSPData::PeakRange(double e) const { //--------------------- void TTrimSPData::ConvolveGss(double w, double e) const { - if(!w) + if (!w) return; - vector z, nz, gss; + std::vector z, nz, gss; double nn; FindEnergy(e); - if(fEnergyIter != fEnergy.end()) { + if (fEnergyIter != fEnergy.end()) { unsigned int i(fEnergyIter - fEnergy.begin()); z = fDataZ[i]; nz = fDataNZ[i]; - for(unsigned int k(0); k #include #include -using namespace std; /** *

Class used to handle a set of low energy muon implantation profiles @@ -41,7 +40,7 @@ class TTrimSPData { public: - TTrimSPData(const string&, map&, bool debug = false, unsigned int highRes = 0); + TTrimSPData(const std::string&, std::map&, bool debug = false, unsigned int highRes = 0); ~TTrimSPData() { fDataZ.clear(); @@ -52,15 +51,15 @@ public: fIsNormalized.clear(); } - vector Energy() const {return fEnergy;} - vector DataZ(double) const; - vector DataNZ(double) const; - vector OrigDataNZ(double) const; + std::vector Energy() const {return fEnergy;} + std::vector DataZ(double) const; + std::vector DataNZ(double) const; + std::vector OrigDataNZ(double) const; double DataDZ(double) const; void UseHighResolution(double); void SetOriginal() {fOrigDataNZ = fDataNZ;} - void WeightLayers(double, const vector&, const vector&) const; - double LayerFraction(double, unsigned int, const vector&) const; + void WeightLayers(double, const std::vector&, const std::vector&) const; + double LayerFraction(double, unsigned int, const std::vector&) const; double GetNofZ(double, double) const; void Normalize(double) const; bool IsNormalized(double) const; @@ -71,13 +70,13 @@ public: private: void FindEnergy(double) const; - vector fEnergy; ///< vector holding all available muon energies - vector fDZ; ///< vector holding the spatial resolution of the TRIM.SP output for all energies - vector< vector > fDataZ; ///< discrete points in real space for which n(z) has been calculated for all energies - mutable vector< vector > fDataNZ; ///< n(z) for all energies - vector< vector > fOrigDataNZ; ///< original (unmodified) implantation profiles for all energies as read in from rge-files - mutable vector fIsNormalized; ///< tag indicating if the implantation profiles are normalized (for each energy separately) - mutable vector::const_iterator fEnergyIter; ///< iterator traversing the vector of available energies + std::vector fEnergy; ///< vector holding all available muon energies + std::vector fDZ; ///< vector holding the spatial resolution of the TRIM.SP output for all energies + std::vector< std::vector > fDataZ; ///< discrete points in real space for which n(z) has been calculated for all energies + mutable std::vector< std::vector > fDataNZ; ///< n(z) for all energies + std::vector< std::vector > fOrigDataNZ; ///< original (unmodified) implantation profiles for all energies as read in from rge-files + mutable std::vector fIsNormalized; ///< tag indicating if the implantation profiles are normalized (for each energy separately) + mutable std::vector::const_iterator fEnergyIter; ///< iterator traversing the vector of available energies }; #endif // _TTrimSPDataHandler_H_ diff --git a/src/external/MagProximity/PMagProximityFitter.cpp b/src/external/MagProximity/PMagProximityFitter.cpp index c046ec4d..78747e82 100644 --- a/src/external/MagProximity/PMagProximityFitter.cpp +++ b/src/external/MagProximity/PMagProximityFitter.cpp @@ -59,14 +59,14 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal() // read XML startup file char startup_path_name[128]; - TSAXParser *saxParser = new TSAXParser(); - PMPStartupHandler *fStartupHandler = new PMPStartupHandler(); + std::unique_ptr saxParser = std::make_unique(); + fStartupHandler = std::make_unique(); strcpy(startup_path_name, fStartupHandler->GetStartupFilePath().Data()); - saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler); + saxParser->ConnectToHandler("PMPStartupHandler", fStartupHandler.get()); //Int_t status = saxParser->ParseFile(startup_path_name); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed."; @@ -74,12 +74,6 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal() fValid = false; } - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - // check if everything went fine with the startup handler if (!fStartupHandler->IsValid()) { std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; @@ -89,7 +83,7 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal() } // load all the TRIM.SP rge-files - fRgeHandler = new PRgeHandler(); + fRgeHandler = std::make_unique(); if (!fRgeHandler->IsValid()) { std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; std::cout << std::endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry."; @@ -109,15 +103,6 @@ PMagProximityFitterGlobal::~PMagProximityFitterGlobal() fPreviousParam.clear(); fField.clear(); - - if (fRgeHandler) { - delete fRgeHandler; - fRgeHandler = nullptr; - } - if (fStartupHandler) { - delete fStartupHandler; - fStartupHandler = nullptr; - } } //-------------------------------------------------------------------------- diff --git a/src/external/MagProximity/PMagProximityFitter.h b/src/external/MagProximity/PMagProximityFitter.h index c576768c..0791e2b1 100644 --- a/src/external/MagProximity/PMagProximityFitter.h +++ b/src/external/MagProximity/PMagProximityFitter.h @@ -30,6 +30,8 @@ #ifndef _PMAGPROXIMITYFITTER_H_ #define _PMAGPROXIMITYFITTER_H_ +#include + #include "PUserFcnBase.h" #include "PMPStartupHandler.h" #include "PRgeHandler.h" @@ -49,8 +51,8 @@ class PMagProximityFitterGlobal private: Bool_t fValid; - PMPStartupHandler *fStartupHandler; - PRgeHandler *fRgeHandler; + std::unique_ptr fStartupHandler; + std::unique_ptr fRgeHandler; mutable std::vector fPreviousParam; diff --git a/src/external/MusrRoot/TMusrRunHeader.cpp b/src/external/MusrRoot/TMusrRunHeader.cpp index 0dc391e7..76edfb63 100644 --- a/src/external/MusrRoot/TMusrRunHeader.cpp +++ b/src/external/MusrRoot/TMusrRunHeader.cpp @@ -1507,7 +1507,7 @@ bool TMusrRunHeader::UpdateFolder(TObject *treeObj, TString path) if (!obj) { // required object not present, create it TObjArray *oarray = new TObjArray(); - if (!oarray) { + if (oarray == nullptr) { std::cerr << std::endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't create header structure!!" << std::endl; return false; } diff --git a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp index c4961f95..61964065 100644 --- a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp +++ b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp @@ -50,33 +50,22 @@ TMeanFieldsForScHalfSpace::TMeanFieldsForScHalfSpace() { // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); int status (saxParser->ParseFile(startup_path_name.c_str())); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } std::string rge_path(startupHandler->GetDataPath()); - map 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; - } + std::map energy_vec(startupHandler->GetEnergies()); + fImpProfile = std::make_unique(rge_path, energy_vec, startupHandler->GetDebug()); } // Operator-method that returns the mean field for a given implantation energy @@ -141,33 +130,22 @@ TMeanFieldsForScSingleLayer::TMeanFieldsForScSingleLayer() { // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); int status (saxParser->ParseFile(startup_path_name.c_str())); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } std::string rge_path(startupHandler->GetDataPath()); - map 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; - } + std::map energy_vec(startupHandler->GetEnergies()); + fImpProfile = std::make_unique(rge_path, energy_vec, startupHandler->GetDebug()); } // Operator-method that returns the mean field for a given implantation energy @@ -240,33 +218,22 @@ TMeanFieldsForScBilayer::TMeanFieldsForScBilayer() { // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); int status (saxParser->ParseFile(startup_path_name.c_str())); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } std::string rge_path(startupHandler->GetDataPath()); - map 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; - } + std::map energy_vec(startupHandler->GetEnergies()); + fImpProfile = std::make_unique(rge_path, energy_vec, startupHandler->GetDebug(), 1); } // Operator-method that returns the mean field for a given implantation energy @@ -335,10 +302,10 @@ double TMeanFieldsForScBilayer::CalcMeanB (double E, const std::vector& std::vector nz(fImpProfile->DataNZ(E)); double dz(fImpProfile->DataDZ(E)); - if (E==20.0){ - ofstream of("Implantation-profile-normal.dat"); + if (E==20.0) { + std::ofstream of("Implantation-profile-normal.dat"); for (unsigned int i(0); iConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); int status (saxParser->ParseFile(startup_path_name.c_str())); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } std::string rge_path(startupHandler->GetDataPath()); - map 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; - } + std::map energy_vec(startupHandler->GetEnergies()); + fImpProfile = std::make_unique(rge_path, energy_vec, startupHandler->GetDebug()); } // Operator-method that returns the mean field for a given implantation energy @@ -464,33 +420,22 @@ TMeanFieldsForScTrilayerWithInsulator::TMeanFieldsForScTrilayerWithInsulator() { // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); int status (saxParser->ParseFile(startup_path_name.c_str())); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } std::string rge_path(startupHandler->GetDataPath()); - map 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; - } + std::map energy_vec(startupHandler->GetEnergies()); + fImpProfile = std::make_unique(rge_path, energy_vec, startupHandler->GetDebug()); } // Operator-method that returns the mean field for a given implantation energy diff --git a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h index 926a03fd..88cd571a 100644 --- a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h +++ b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h @@ -29,6 +29,8 @@ #ifndef _TCalcMeanFieldsLEM_H_ #define _TCalcMeanFieldsLEM_H_ +#include + #include "TLondon1D.h" class TMeanFieldsForScHalfSpace : public PUserFcnBase { @@ -36,13 +38,12 @@ class TMeanFieldsForScHalfSpace : public PUserFcnBase { public: // default constructor TMeanFieldsForScHalfSpace(); - ~TMeanFieldsForScHalfSpace() {delete fImpProfile; fImpProfile = 0;} double operator()(double, const std::vector&) const; double CalcMeanB (double, const TLondon1D_HS&) const; private: - TTrimSPData *fImpProfile; + std::unique_ptr fImpProfile; ClassDef(TMeanFieldsForScHalfSpace,1) }; @@ -52,13 +53,12 @@ class TMeanFieldsForScSingleLayer : public PUserFcnBase { public: // default constructor TMeanFieldsForScSingleLayer(); - ~TMeanFieldsForScSingleLayer() {delete fImpProfile; fImpProfile = 0;} double operator()(double, const std::vector&) const; double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_1L&) const; private: - TTrimSPData *fImpProfile; + std::unique_ptr fImpProfile; ClassDef(TMeanFieldsForScSingleLayer,1) }; @@ -68,13 +68,12 @@ class TMeanFieldsForScBilayer : public PUserFcnBase { public: // default constructor TMeanFieldsForScBilayer(); - ~TMeanFieldsForScBilayer() {delete fImpProfile; fImpProfile = 0;} double operator()(double, const std::vector&) const; double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_2L&, double) const; private: - TTrimSPData *fImpProfile; + std::unique_ptr fImpProfile; ClassDef(TMeanFieldsForScBilayer,1) }; @@ -84,13 +83,12 @@ class TMeanFieldsForScTrilayer : public PUserFcnBase { public: // default constructor TMeanFieldsForScTrilayer(); - ~TMeanFieldsForScTrilayer() {delete fImpProfile; fImpProfile = 0;} double operator()(double, const std::vector&) const; double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_3L&) const; private: - TTrimSPData *fImpProfile; + std::unique_ptr fImpProfile; ClassDef(TMeanFieldsForScTrilayer,1) }; @@ -100,13 +98,12 @@ class TMeanFieldsForScTrilayerWithInsulator : public PUserFcnBase { public: // default constructor TMeanFieldsForScTrilayerWithInsulator(); - ~TMeanFieldsForScTrilayerWithInsulator() {delete fImpProfile; fImpProfile = 0;} double operator()(double, const std::vector&) const; double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_3LwInsulator&) const; private: - TTrimSPData *fImpProfile; + std::unique_ptr fImpProfile; ClassDef(TMeanFieldsForScTrilayerWithInsulator,1) }; diff --git a/src/external/libFitPofB/classes/TLondon1D.cpp b/src/external/libFitPofB/classes/TLondon1D.cpp index b0dc0b12..cc0e4a34 100644 --- a/src/external/libFitPofB/classes/TLondon1D.cpp +++ b/src/external/libFitPofB/classes/TLondon1D.cpp @@ -147,7 +147,7 @@ TLondon1D3LS::~TLondon1D3LS() { TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -158,16 +158,16 @@ TLondon1DHS::TLondon1DHS() : fCalcNeeded(true), fFirstCall(true) { int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + std::map energy_vec(startupHandler->GetEnergies()); fParForPofT.push_back(0.0); // phase 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 //------------------ -double TLondon1DHS::operator()(double t, const vector &par) const { +double TLondon1DHS::operator()(double t, const std::vector &par) const { assert(par.size() == 5); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); bool dead_layer_changed(false); // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(2); i &par) const { bool only_phase_changed(false); for (unsigned int i(0); i &par) const { 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; @@ -264,8 +264,8 @@ double TLondon1DHS::operator()(double t, const vector &par) const { fParForPofB[3] = par[2]; // Bkg-Field //fParForPofB[4] = 0.005; // Bkg-width (in principle zero) - if(dead_layer_changed){ - vector interfaces; + if (dead_layer_changed) { + std::vector interfaces; interfaces.push_back(par[3]);// dead layer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer interfaces.clear(); @@ -286,7 +286,6 @@ double TLondon1DHS::operator()(double t, const vector &par) const { } return fPofT->Eval(t); - } @@ -298,7 +297,7 @@ double TLondon1DHS::operator()(double t, const vector &par) const { TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -309,16 +308,16 @@ TLondon1D1L::TLondon1D1L() : fCalcNeeded(true), fFirstCall(true) { int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + std::map energy_vec(startupHandler->GetEnergies()); fParForPofT.push_back(0.0); 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 //------------------ -double TLondon1D1L::operator()(double t, const vector &par) const { +double TLondon1D1L::operator()(double t, const std::vector &par) const { assert(par.size() == 6 || par.size() == 8); @@ -362,7 +361,7 @@ double TLondon1D1L::operator()(double t, const vector &par) const { // Count the number of function calls // fCallCounter++; - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); bool bkg_fraction_changed(false); @@ -370,7 +369,7 @@ double TLondon1D1L::operator()(double t, const vector &par) const { // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(2); i &par) const { bool only_phase_changed(false); for (unsigned int i(0); i &par) const { 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; @@ -424,12 +423,12 @@ double TLondon1D1L::operator()(double t, const vector &par) const { fParForPofB[3] = par[2]; // Bkg-Field //fParForPofB[4] = 0.005; // Bkg-width (in principle zero) - if(weights_changed) { - vector interfaces; + if (weights_changed) { + std::vector interfaces; interfaces.push_back(par[3]+par[4]); - vector weights; - for(unsigned int i(6); i<8; i++) + std::vector weights; + for (unsigned int i(6); i<8; i++) weights.push_back(par[i]); // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; @@ -439,8 +438,8 @@ double TLondon1D1L::operator()(double t, const vector &par) const { weights.clear(); } - if(bkg_fraction_changed || weights_changed) { - vector interfaces; + if (bkg_fraction_changed || weights_changed) { + std::vector interfaces; interfaces.push_back(par[3]);// dead 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 @@ -484,7 +483,7 @@ double TLondon1D1L::operator()(double t, const vector &par) const { TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -495,16 +494,16 @@ TLondon1D2L::TLondon1D2L() : fCalcNeeded(true), fFirstCall(true) { int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + std::map energy_vec(startupHandler->GetEnergies()); fParForPofT.push_back(0.0); 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 //------------------ -double TLondon1D2L::operator()(double t, const vector &par) const { +double TLondon1D2L::operator()(double t, const std::vector &par) const { assert(par.size() == 8 || par.size() == 11); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); bool bkg_fraction_changed(false); @@ -552,7 +551,7 @@ double TLondon1D2L::operator()(double t, const vector &par) const { // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(2); i &par) const { bool only_phase_changed(false); for (unsigned int i(0); i &par) const { 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; @@ -605,13 +604,13 @@ double TLondon1D2L::operator()(double t, const vector &par) const { fParForPofB[3] = par[2]; // Bkg-Field //fParForPofB[4] = 0.005; // Bkg-width (in principle zero) - if(weights_changed) { - vector interfaces; + if (weights_changed) { + std::vector interfaces; interfaces.push_back(par[3]+par[4]); interfaces.push_back(par[3]+par[4]+par[5]); - vector weights; - for(unsigned int i(8); i<11; i++) + std::vector weights; + for (unsigned int i(8); i<11; i++) weights.push_back(par[i]); // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; @@ -621,8 +620,8 @@ double TLondon1D2L::operator()(double t, const vector &par) const { weights.clear(); } - if(bkg_fraction_changed || weights_changed) { - vector interfaces; + if (bkg_fraction_changed || weights_changed) { + std::vector interfaces; interfaces.push_back(par[3]);// dead 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 @@ -646,7 +645,6 @@ double TLondon1D2L::operator()(double t, const vector &par) const { } return fPofT->Eval(t); - } //------------------ @@ -657,7 +655,7 @@ double TLondon1D2L::operator()(double t, const vector &par) const { TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -668,16 +666,16 @@ TProximity1D1LHS::TProximity1D1LHS() : fCalcNeeded(true), fFirstCall(true) { int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + std::map energy_vec(startupHandler->GetEnergies()); fParForPofT.push_back(0.0); 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 //------------------ -double TProximity1D1LHS::operator()(double t, const vector &par) const { +double TProximity1D1LHS::operator()(double t, const std::vector &par) const { assert(par.size() == 7); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); // check if the function is called the first time and if yes, read in parameters bool dead_layer_changed(false); - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(2); i &par) const { bool only_phase_changed(false); for (unsigned int i(0); i &par) const { 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; @@ -774,8 +772,8 @@ double TProximity1D1LHS::operator()(double t, const vector &par) const { fParForPofB[3] = par[2]; // Bkg-Field //fParForPofB[4] = 0.005; // Bkg-width (in principle zero) - if(dead_layer_changed){ - vector interfaces; + if (dead_layer_changed) { + std::vector interfaces; interfaces.push_back(par[4]);// dead layer fParForPofB[5] = fImpProfile->LayerFraction(par[1], 1, interfaces); // Fraction of muons in the deadlayer interfaces.clear(); @@ -797,7 +795,6 @@ double TProximity1D1LHS::operator()(double t, const vector &par) const { } return fPofT->Eval(t); - } //------------------ @@ -807,7 +804,7 @@ double TProximity1D1LHS::operator()(double t, const vector &par) const { TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -818,16 +815,16 @@ TLondon1D3L::TLondon1D3L() : fCalcNeeded(true), fFirstCall(true) { int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + std::map energy_vec(startupHandler->GetEnergies()); fParForPofT.push_back(0.0); 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 //------------------ -double TLondon1D3L::operator()(double t, const vector &par) const { +double TLondon1D3L::operator()(double t, const std::vector &par) const { assert(par.size() == 10 || par.size() == 14); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); bool bkg_fraction_changed(false); @@ -875,7 +872,7 @@ double TLondon1D3L::operator()(double t, const vector &par) const { // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(2); i &par) const { bool only_phase_changed(false); for (unsigned int i(0); i &par) const { 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; @@ -928,14 +925,14 @@ double TLondon1D3L::operator()(double t, const vector &par) const { fParForPofB[3] = par[2]; // Bkg-Field //fParForPofB[4] = 0.005; // Bkg-width (in principle zero) - if(weights_changed) { - vector interfaces; + if (weights_changed) { + std::vector interfaces; 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]+par[6]); - vector weights; - for(unsigned int i(10); i<14; i++) + std::vector weights; + for (unsigned int i(10); i<14; i++) weights.push_back(par[i]); // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; @@ -945,8 +942,8 @@ double TLondon1D3L::operator()(double t, const vector &par) const { weights.clear(); } - if(bkg_fraction_changed || weights_changed) { - vector interfaces; + if (bkg_fraction_changed || weights_changed) { + std::vector interfaces; 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 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 &par) const { } return fPofT->Eval(t); - } //------------------ @@ -979,7 +975,7 @@ double TLondon1D3L::operator()(double t, const vector &par) const { TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -990,16 +986,16 @@ TLondon1D3LS::TLondon1D3LS() : fCalcNeeded(true), fFirstCall(true) { int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } fNSteps = startupHandler->GetNSteps(); fWisdom = startupHandler->GetWisdomFile(); - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + std::map energy_vec(startupHandler->GetEnergies()); fParForPofT.push_back(0.0); 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 //------------------ -double TLondon1D3LS::operator()(double t, const vector &par) const { +double TLondon1D3LS::operator()(double t, const std::vector &par) const { assert(par.size() == 9 || par.size() == 13); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); bool bkg_fraction_changed(false); @@ -1047,7 +1043,7 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(2); i &par) const { bool only_phase_changed(false); for (unsigned int i(0); i &par) const { 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; @@ -1100,14 +1096,14 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { fParForPofB[3] = par[2]; // Bkg-Field //fParForPofB[4] = 0.005; // Bkg-width (in principle zero) - if(weights_changed) { - vector interfaces; + if (weights_changed) { + std::vector interfaces; 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]+par[6]); - vector weights; - for(unsigned int i(9); i<13; i++) + std::vector weights; + for (unsigned int i(9); i<13; i++) weights.push_back(par[i]); // std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; @@ -1117,8 +1113,8 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { weights.clear(); } - if(bkg_fraction_changed || weights_changed) { - vector interfaces; + if (bkg_fraction_changed || weights_changed) { + std::vector interfaces; 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 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 &par) const { } return fPofT->Eval(t); - } // //------------------ diff --git a/src/external/libFitPofB/classes/TPofBCalc.cpp b/src/external/libFitPofB/classes/TPofBCalc.cpp index eea231d2..b7def8ec 100644 --- a/src/external/libFitPofB/classes/TPofBCalc.cpp +++ b/src/external/libFitPofB/classes/TPofBCalc.cpp @@ -553,7 +553,7 @@ void TPofBCalc::Calculate(const TBulkVortexFieldCalc *vortexLattice, const std:: if (fill_index < fPBSize) { fPB[fill_index] += 1.0; } else { - cout << "Field over the limit..." << endl; + std::cout << "Field over the limit..." << std::endl; } } // of << endl; diff --git a/src/external/libFitPofB/classes/TPofTCalc.cpp b/src/external/libFitPofB/classes/TPofTCalc.cpp index 12684e84..c5f6cb24 100644 --- a/src/external/libFitPofB/classes/TPofTCalc.cpp +++ b/src/external/libFitPofB/classes/TPofTCalc.cpp @@ -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) //--------------------- -void TPofTCalc::FakeData(const string &rootOutputFileName, const std::vector &par, const std::vector *optPar = 0) { +void TPofTCalc::FakeData(const std::string &rootOutputFileName, const std::vector &par, const std::vector *optPar = 0) { //determine the number of histograms to be built unsigned int numHist(0); diff --git a/src/external/libFitPofB/classes/TSkewedGss.cpp b/src/external/libFitPofB/classes/TSkewedGss.cpp index bd1ce59e..d4b4d618 100644 --- a/src/external/libFitPofB/classes/TSkewedGss.cpp +++ b/src/external/libFitPofB/classes/TSkewedGss.cpp @@ -64,9 +64,9 @@ TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) { int status (saxParser->ParseFile(startup_path_name.c_str())); // check for parse errors if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } diff --git a/src/external/libFitPofB/classes/TVortex.cpp b/src/external/libFitPofB/classes/TVortex.cpp index 1341586c..1f49d802 100644 --- a/src/external/libFitPofB/classes/TVortex.cpp +++ b/src/external/libFitPofB/classes/TVortex.cpp @@ -52,12 +52,6 @@ ClassImp(TBulkAnisotropicTriVortexAGL) //------------------ TBulkTriVortexLondon::~TBulkTriVortexLondon() { - delete fPofT; - fPofT = 0; - delete fPofB; - fPofT = 0; - delete fVortex; - fVortex = 0; fPar.clear(); fParForVortex.clear(); fParForPofB.clear(); @@ -69,12 +63,6 @@ TBulkTriVortexLondon::~TBulkTriVortexLondon() { //------------------ TBulkSqVortexLondon::~TBulkSqVortexLondon() { - delete fPofT; - fPofT = 0; - delete fPofB; - fPofT = 0; - delete fVortex; - fVortex = 0; fPar.clear(); fParForVortex.clear(); fParForPofB.clear(); @@ -86,12 +74,6 @@ TBulkSqVortexLondon::~TBulkSqVortexLondon() { //------------------ TBulkTriVortexML::~TBulkTriVortexML() { - delete fPofT; - fPofT = 0; - delete fPofB; - fPofT = 0; - delete fVortex; - fVortex = 0; fPar.clear(); fParForVortex.clear(); fParForPofB.clear(); @@ -103,12 +85,6 @@ TBulkTriVortexML::~TBulkTriVortexML() { //------------------ TBulkTriVortexAGL::~TBulkTriVortexAGL() { - delete fPofT; - fPofT = 0; - delete fPofB; - fPofT = 0; - delete fVortex; - fVortex = 0; fPar.clear(); fParForVortex.clear(); fParForPofB.clear(); @@ -120,12 +96,6 @@ TBulkTriVortexAGL::~TBulkTriVortexAGL() { //------------------ TBulkTriVortexAGLII::~TBulkTriVortexAGLII() { - delete fPofT; - fPofT = 0; - delete fPofB; - fPofT = 0; - delete fVortex; - fVortex = 0; fPar.clear(); fParForVortex.clear(); fParForPofB.clear(); @@ -137,12 +107,6 @@ TBulkTriVortexAGLII::~TBulkTriVortexAGLII() { //------------------ TBulkTriVortexNGL::~TBulkTriVortexNGL() { - delete fPofT; - fPofT = 0; - delete fPofB; - fPofT = 0; - delete fVortex; - fVortex = 0; fPar.clear(); fParForVortex.clear(); fParForPofB.clear(); @@ -159,18 +123,18 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; 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: 0.0 homogeneous, 1.0 Gaussian, 2.0 Lorentzian || 3.0 antiferromagnetic vortex-cores - fVortex = new TBulkTriVortexLondonFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } //------------------ @@ -219,18 +173,18 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true) // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -250,21 +204,11 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true) fParForPofB.push_back(0.005); // Bkg-width fParForPofB.push_back(0.0); // Bkg-weight - fVortex = new TBulkSqVortexLondonFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } //------------------ @@ -277,12 +221,12 @@ double TBulkTriVortexLondon::operator()(double t, const std::vector &par 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); // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 3; i++) { @@ -342,7 +286,7 @@ double TBulkTriVortexLondon::operator()(double t, const std::vector &par fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* else { @@ -422,7 +366,7 @@ double TBulkSqVortexLondon::operator()(double t, const std::vector &par) fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* else { @@ -449,18 +393,18 @@ TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) { // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -480,21 +424,11 @@ TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) { fParForPofB.push_back(0.005); // Bkg-width fParForPofB.push_back(0.0); // Bkg-weight - fVortex = new TBulkTriVortexMLFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } //------------------ @@ -507,12 +441,12 @@ double TBulkTriVortexML::operator()(double t, const std::vector &par) co assert(par.size() == 4 || par.size() == 5); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 3; i++) { @@ -547,7 +481,7 @@ double TBulkTriVortexML::operator()(double t, const std::vector &par) co 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; @@ -561,7 +495,7 @@ double TBulkTriVortexML::operator()(double t, const std::vector &par) co fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* else { @@ -574,7 +508,6 @@ double TBulkTriVortexML::operator()(double t, const std::vector &par) co } return fPofT->Eval(t); - } @@ -588,18 +521,18 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) { // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -619,21 +552,11 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) { fParForPofB.push_back(0.005); // Bkg-width fParForPofB.push_back(0.0); // Bkg-weight - fVortex = new TBulkTriVortexAGLFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } //------------------ @@ -646,12 +569,12 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector &par) c assert(par.size() == 4 || par.size() == 5); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 3; i++) { @@ -686,7 +609,7 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector &par) c 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; @@ -700,7 +623,7 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector &par) c fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* else { @@ -713,7 +636,6 @@ double TBulkTriVortexAGL::operator()(double t, const std::vector &par) c } return fPofT->Eval(t); - } //------------------ @@ -726,18 +648,18 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true) // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; 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: 0.0 homogeneous, 1.0 Gaussian, 2.0 Lorentzian || 3.0 antiferromagnetic vortex-cores - fVortex = new TBulkTriVortexAGLIIFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } //------------------ @@ -786,12 +698,12 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector &par) 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); // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 3; i++) { @@ -826,7 +738,7 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector &par) 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; @@ -851,7 +763,7 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector &par) fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* else { @@ -864,7 +776,6 @@ double TBulkTriVortexAGLII::operator()(double t, const std::vector &par) } return fPofT->Eval(t); - } //------------------ @@ -877,18 +788,18 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) { // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -908,21 +819,11 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) { fParForPofB.push_back(0.005); // Bkg-width fParForPofB.push_back(0.0); // Bkg-weight - fVortex = new TBulkTriVortexNGLFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } //------------------ @@ -935,12 +836,12 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector &par) c assert(par.size() == 4 || par.size() == 5); - if(t<0.0) + if (t<0.0) return cos(par[0]*0.017453293); // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 3; i++) { @@ -975,7 +876,7 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector &par) c 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; @@ -989,7 +890,7 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector &par) c fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* else { @@ -1002,7 +903,6 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector &par) c } return fPofT->Eval(t); - } //------------------ @@ -1010,12 +910,6 @@ double TBulkTriVortexNGL::operator()(double t, const std::vector &par) c //------------------ TBulkAnisotropicTriVortexLondonGlobal::~TBulkAnisotropicTriVortexLondonGlobal() { - delete fPofT; - fPofT = 0; - delete fPofB; - fPofT = 0; - delete fVortex; - fVortex = 0; fPar.clear(); fParForVortex.clear(); fParForPofB.clear(); @@ -1032,18 +926,18 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() : // read startup file std::string startup_path_name("BMW_startup.xml"); - TSAXParser *saxParser = new TSAXParser(); - BMWStartupHandler *startupHandler = new BMWStartupHandler(); - saxParser->ConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -1063,21 +957,11 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() : fParForPofB.push_back(0.005); // Bkg-width fParForPofB.push_back(0.0); // Bkg-weight - fVortex = new TBulkAnisotropicTriVortexLondonFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector &par) const { @@ -1090,7 +974,7 @@ void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector &par) // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 5; i++) { @@ -1127,7 +1011,7 @@ void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector &par) 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; @@ -1141,7 +1025,7 @@ void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector &par) fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* else { @@ -1198,7 +1082,7 @@ void TBulkAnisotropicTriVortexLondon::SetGlobalPart(std::vector &globalP fGlobalUserFcn = new TBulkAnisotropicTriVortexLondonGlobal(); if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error 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 globalPart.resize(fIdxGlobal+1); globalPart[fIdxGlobal] = dynamic_cast(fGlobalUserFcn); @@ -1238,7 +1122,7 @@ double TBulkAnisotropicTriVortexLondon::operator()(double t, const std::vectorConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -1305,21 +1183,11 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe fParForPofB.push_back(0.005); // Bkg-width fParForPofB.push_back(0.0); // Bkg-weight - fVortex = new TBulkAnisotropicTriVortexMLFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector &par) const { @@ -1332,7 +1200,7 @@ void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector &par) con // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 5; i++) { @@ -1347,7 +1215,7 @@ void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector &par) con bool only_phase_changed(false); for (unsigned int i(0); i &par) con 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++) { fParForVortex[i] = par[i+1]; @@ -1383,11 +1251,11 @@ void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector &par) con fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* 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); @@ -1440,7 +1308,7 @@ void TBulkAnisotropicTriVortexML::SetGlobalPart(std::vector &globalPart, fGlobalUserFcn = new TBulkAnisotropicTriVortexMLGlobal(); if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error 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 globalPart.resize(fIdxGlobal+1); globalPart[fIdxGlobal] = dynamic_cast(fGlobalUserFcn); @@ -1480,7 +1348,7 @@ double TBulkAnisotropicTriVortexML::operator()(double t, const std::vectorConnectToHandler("BMWStartupHandler", startupHandler); + std::unique_ptr saxParser = std::make_unique(); + std::unique_ptr startupHandler = std::make_unique(); + saxParser->ConnectToHandler("BMWStartupHandler", startupHandler.get()); //int status (saxParser->ParseFile(startup_path_name.c_str())); // parsing the file as above seems to lead to problems in certain environments; // 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 if (status) { // error - cerr << 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!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -1547,21 +1409,11 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc fParForPofB.push_back(0.005); // Bkg-width fParForPofB.push_back(0.0); // Bkg-weight - fVortex = new TBulkAnisotropicTriVortexAGLFieldCalc(fWisdom, fGridSteps); + fVortex = std::make_unique(fWisdom, fGridSteps); - fPofB = new TPofBCalc(fParForPofB); + fPofB = std::make_unique(fParForPofB); - fPofT = new TPofTCalc(fPofB, fWisdom, fParForPofT); - - // clean up - if (saxParser) { - delete saxParser; - saxParser = 0; - } - if (startupHandler) { - delete startupHandler; - startupHandler = 0; - } + fPofT = std::make_unique(fPofB.get(), fWisdom, fParForPofT); } void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector &par) const { @@ -1574,7 +1426,7 @@ void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector &par) co // check if the function is called the first time and if yes, read in parameters - if(fFirstCall){ + if (fFirstCall) { fPar = par; for (unsigned int i(0); i < 5; i++) { @@ -1589,7 +1441,7 @@ void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector &par) co bool only_phase_changed(false); for (unsigned int i(0); i &par) co 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++) { fParForVortex[i] = par[i+1]; @@ -1625,11 +1477,11 @@ void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector &par) co fVortex->SetParameters(fParForVortex); fVortex->CalculateGrid(); fPofB->UnsetPBExists(); - fPofB->Calculate(fVortex, fParForPofB); + fPofB->Calculate(fVortex.get(), fParForPofB); fPofT->DoFFT(); }/* 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); @@ -1683,7 +1535,7 @@ void TBulkAnisotropicTriVortexAGL::SetGlobalPart(std::vector &globalPart fGlobalUserFcn = new TBulkAnisotropicTriVortexAGLGlobal(); if (fGlobalUserFcn == 0) { // global user function object couldn't be invoked -> error 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 globalPart.resize(fIdxGlobal+1); globalPart[fIdxGlobal] = dynamic_cast(fGlobalUserFcn); @@ -1723,7 +1575,7 @@ double TBulkAnisotropicTriVortexAGL::operator()(double t, const std::vector fParForPofT; ///< parameters for the calculation of p(t) - mutable vector fParForBofZ; ///< parameters for the calculation of B(z) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + mutable std::vector fParForBofZ; ///< parameters for the calculation of B(z) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fNSteps; ///< number of points for which B(z) is calculated ClassDef(TLondon1DHS,1) diff --git a/src/external/libFitPofB/include/TPofTCalc.h b/src/external/libFitPofB/include/TPofTCalc.h index ccb87631..6c689e7e 100644 --- a/src/external/libFitPofB/include/TPofTCalc.h +++ b/src/external/libFitPofB/include/TPofTCalc.h @@ -66,7 +66,7 @@ private: double *fPT; ///< array containing the discrete values of the polarization p(t) double fTBin; ///< time resolution 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 }; diff --git a/src/external/libFitPofB/include/TVortex.h b/src/external/libFitPofB/include/TVortex.h index 352309b8..3de0d88a 100644 --- a/src/external/libFitPofB/include/TVortex.h +++ b/src/external/libFitPofB/include/TVortex.h @@ -29,6 +29,8 @@ #ifndef _TVortex_H_ #define _TVortex_H_ +#include + #include "PUserFcnBase.h" #include "TPofTCalc.h" @@ -47,9 +49,9 @@ public: private: mutable std::vector fPar; ///< parameters of the model - TBulkTriVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -76,9 +78,9 @@ public: private: mutable std::vector fPar; ///< parameters of the model - TBulkSqVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -105,9 +107,9 @@ public: private: mutable std::vector fPar; ///< parameters of the model - TBulkTriVortexMLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -134,9 +136,9 @@ public: private: mutable std::vector fPar; ///< parameters of the model - TBulkTriVortexAGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -163,9 +165,9 @@ public: private: mutable std::vector fPar; ///< parameters of the model - TBulkTriVortexAGLIIFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -192,9 +194,9 @@ public: private: mutable std::vector fPar; ///< parameters of the model - TBulkTriVortexNGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -223,14 +225,14 @@ public: void Calc(const std::vector&) const; - const TPofTCalc* GetPolarizationPointer() const { return fPofT; } + const TPofTCalc* GetPolarizationPointer() const { return fPofT.get(); } private: mutable bool fValid; ///< tag indicating if the global part has been calculated mutable std::vector fPar; ///< parameter vector - TBulkAnisotropicTriVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -287,14 +289,14 @@ public: void Calc(const std::vector&) const; - const TPofTCalc* GetPolarizationPointer() const { return fPofT; } + const TPofTCalc* GetPolarizationPointer() const { return fPofT.get(); } private: mutable bool fValid; ///< tag indicating if the global part has been calculated mutable std::vector fPar; ///< parameter vector - TBulkAnisotropicTriVortexMLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y) @@ -351,14 +353,14 @@ public: void Calc(const std::vector&) const; - const TPofTCalc* GetPolarizationPointer() const { return fPofT; } + const TPofTCalc* GetPolarizationPointer() const { return fPofT.get(); } private: mutable bool fValid; ///< tag indicating if the global part has been calculated mutable std::vector fPar; ///< parameter vector - TBulkAnisotropicTriVortexAGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice - TPofBCalc *fPofB; ///< static field distribution P(B) - TPofTCalc *fPofT; ///< muon spin polarization p(t) + std::unique_ptr fVortex; ///< spatial field distribution B(x,y) within the vortex lattice + std::unique_ptr fPofB; ///< static field distribution P(B) + std::unique_ptr fPofT; ///< muon spin polarization p(t) 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 std::vector fParForVortex; ///< parameters for the calculation of B(x,y)