modernized code to C++11 and newer.
This allows to analyze the code by external code analyzers. Since a lot is adopted, the version is changed to 1.4.3 Conflicts: src/classes/PFitter.cpp src/classes/PFourier.cpp src/classes/PMsrHandler.cpp src/classes/PMusrCanvas.cpp src/classes/PRunAsymmetry.cpp src/classes/PRunAsymmetryRRF.cpp src/classes/PRunListCollection.cpp src/classes/PRunSingleHisto.cpp src/classes/PRunSingleHistoRRF.cpp src/classes/PStartupHandler.cpp src/include/PFourier.h src/include/PRunListCollection.h src/musrFT.cpp
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* Copyright (C) 2007-2019 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@ -28,7 +28,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include "PMusr.h"
|
||||
#include "PFitterFcnDKS.h"
|
||||
@ -110,7 +109,7 @@ Double_t PFitterFcnDKS::operator()(const std::vector<Double_t>& par) const
|
||||
value += chisq;
|
||||
|
||||
if (ierr != 0) {
|
||||
cerr << "PFitterFcnDKS::operator(): **ERROR** Kernel launch for single histo failed!" << endl;
|
||||
std::cerr << "PFitterFcnDKS::operator(): **ERROR** Kernel launch for single histo failed!" << std::endl;
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -137,7 +136,7 @@ Double_t PFitterFcnDKS::operator()(const std::vector<Double_t>& par) const
|
||||
value += chisq;
|
||||
|
||||
if (ierr != 0) {
|
||||
cerr << "PFitterFcnDKS::operator(): **ERROR** Kernel launch for asymmetry failed!" << endl;
|
||||
std::cerr << "PFitterFcnDKS::operator(): **ERROR** Kernel launch for asymmetry failed!" << std::endl;
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -161,7 +160,7 @@ Double_t PFitterFcnDKS::operator()(const std::vector<Double_t>& par) const
|
||||
value += chisq;
|
||||
|
||||
if (ierr != 0) {
|
||||
cerr << "PFitterFcnDKS::operator(): **ERROR** Kernel launch for mu minus failed!" << endl;
|
||||
std::cerr << "PFitterFcnDKS::operator(): **ERROR** Kernel launch for mu minus failed!" << std::endl;
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
@ -229,7 +228,7 @@ void PFitterFcnDKS::CalcExpectedChiSquare(const std::vector<Double_t> &par, Doub
|
||||
*
|
||||
* \return 0 if OK, 1 otherwise
|
||||
*/
|
||||
int PFitterFcnDKS::GetDeviceName(string &devName)
|
||||
int PFitterFcnDKS::GetDeviceName(std::string &devName)
|
||||
{
|
||||
int status = 1;
|
||||
|
||||
@ -293,7 +292,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
maxSize = size;
|
||||
}
|
||||
if (maxSize == 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get data size to be fitted." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get data size to be fitted." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -301,28 +300,28 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
// 2) get number of parameters / functions / maps
|
||||
parSize = fRunListCollection->GetNoOfParameters();
|
||||
if (parSize == -1) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get number of fit parameters." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get number of fit parameters." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
funSize = fRunListCollection->GetNoOfFunctions();
|
||||
if (funSize == -1) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get number of functions." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get number of functions." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
mapSize = fRunListCollection->GetNoOfMaps();
|
||||
if (mapSize == -1) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get number of maps." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get number of maps." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// now ready to init the chisq buffer on the GPU
|
||||
// cout << "debug> maximal packed histo size=" << maxSize << ", parSize=" << parSize << ", funSize=" << funSize << ", mapSize=" << mapSize << endl;
|
||||
// std::cout << "debug> maximal packed histo size=" << maxSize << ", parSize=" << parSize << ", funSize=" << funSize << ", mapSize=" << mapSize << std::endl;
|
||||
ierr = fDKS.initChiSquare(maxSize, parSize, funSize, mapSize);
|
||||
if (ierr != 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocate the necessary chisq buffer on the GPU." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocate the necessary chisq buffer on the GPU." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -336,7 +335,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
for (UInt_t i=0; i<fRunListCollection->GetNoOfSingleHisto(); i++) {
|
||||
runData = fRunListCollection->GetSingleHisto(i);
|
||||
if (runData == 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get single histo data set (i=" << i << ") from fRunListCollection." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get single histo data set (i=" << i << ") from fRunListCollection." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -344,13 +343,13 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
fMemDataSingleHisto[i] = fDKS.allocateMemory<Double_t>(size, ierr);
|
||||
fMemDataSingleHistoErr[i] = fDKS.allocateMemory<Double_t>(size, ierr);
|
||||
if (ierr != 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocated single histo data set memory (i=" << i << ") on the GPU" << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocated single histo data set memory (i=" << i << ") on the GPU" << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
Int_t startTimeBin = fRunListCollection->GetStartTimeBin(MSR_FITTYPE_SINGLE_HISTO, i);
|
||||
if (startTimeBin < 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** startTimeBin undefind (single histo fit)." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** startTimeBin undefind (single histo fit)." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -366,7 +365,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
for (UInt_t i=0; i<fRunListCollection->GetNoOfAsymmetry(); i++) {
|
||||
runData = fRunListCollection->GetAsymmetry(i);
|
||||
if (runData == 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get asymmetry data set (i=" << i << ") from fRunListCollection." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get asymmetry data set (i=" << i << ") from fRunListCollection." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -374,13 +373,13 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
fMemDataAsymmetry[i] = fDKS.allocateMemory<Double_t>(size, ierr);
|
||||
fMemDataAsymmetryErr[i] = fDKS.allocateMemory<Double_t>(size, ierr);
|
||||
if (ierr != 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocated asymmetry data set memory (i=" << i << ") on the GPU" << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocated asymmetry data set memory (i=" << i << ") on the GPU" << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
Int_t startTimeBin = fRunListCollection->GetStartTimeBin(MSR_FITTYPE_ASYM, i);
|
||||
if (startTimeBin < 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** startTimeBin undefind (asymmetry fit)." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** startTimeBin undefind (asymmetry fit)." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -391,7 +390,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
if (fitType == FITTYPE_UNDEFINED) {
|
||||
fitType = FITTYPE_ASYMMETRY;
|
||||
} else {
|
||||
cerr << ">>PFitterFcnDKS::InitDKS: **ERROR** mixed fit types found. This is currently not supported!" << endl;
|
||||
std::cerr << ">>PFitterFcnDKS::InitDKS: **ERROR** mixed fit types found. This is currently not supported!" << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -403,7 +402,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
for (UInt_t i=0; i<fRunListCollection->GetNoOfMuMinus(); i++) {
|
||||
runData = fRunListCollection->GetMuMinus(i);
|
||||
if (runData == 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get mu minus data set (i=" << i << ") from fRunListCollection." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to get mu minus data set (i=" << i << ") from fRunListCollection." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -411,13 +410,13 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
fMemDataMuMinus[i] = fDKS.allocateMemory<Double_t>(size, ierr);
|
||||
fMemDataMuMinusErr[i] = fDKS.allocateMemory<Double_t>(size, ierr);
|
||||
if (ierr != 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocated mu minus data set memory (i=" << i << ") on the GPU" << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to allocated mu minus data set memory (i=" << i << ") on the GPU" << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
Int_t startTimeBin = fRunListCollection->GetStartTimeBin(MSR_FITTYPE_MU_MINUS, i);
|
||||
if (startTimeBin < 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** startTimeBin undefind (mu minus fit)." << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** startTimeBin undefind (mu minus fit)." << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -428,7 +427,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
if (fitType == FITTYPE_UNDEFINED) {
|
||||
fitType = FITTYPE_MU_MINUS;
|
||||
} else {
|
||||
cerr << ">>PFitterFcnDKS::InitDKS: **ERROR** mixed fit types found. This is currently not supported!" << endl;
|
||||
std::cerr << ">>PFitterFcnDKS::InitDKS: **ERROR** mixed fit types found. This is currently not supported!" << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -437,7 +436,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
// set the function string and compile the program
|
||||
ierr = fDKS.callCompileProgram(fTheoStr, !fUseChi2);
|
||||
if (ierr != 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to compile theory!" << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** failed to compile theory!" << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
@ -445,7 +444,7 @@ void PFitterFcnDKS::InitDKS(const UInt_t dksTag)
|
||||
// checks device properties if openCL
|
||||
ierr = fDKS.checkMuSRKernels(fitType);
|
||||
if (ierr != 0) {
|
||||
cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** muSR kernel checks failed!" << endl;
|
||||
std::cerr << ">> PFitterFcnDKS::InitDKS: **ERROR** muSR kernel checks failed!" << std::endl;
|
||||
fValid = false;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user