Merged muonspin/musrfit:root6 into master

This commit is contained in:
Zaher Salman
2019-04-25 17:27:56 +02:00
130 changed files with 5530 additions and 5743 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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 *
@ -27,9 +27,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include "PFitterFcn.h"
//--------------------------------------------------------------------------

View File

@ -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 *
@ -31,9 +31,7 @@
#include <iostream>
#include <iomanip>
using namespace std;
#include "TH1F.h"
#include "TF1.h"
#include "TAxis.h"
@ -67,17 +65,18 @@ PFTPhaseCorrection::PFTPhaseCorrection(const Int_t minBin, const Int_t maxBin) :
/**
*
*/
PFTPhaseCorrection::PFTPhaseCorrection(vector<Double_t> &reFT, vector<Double_t> &imFT, const Int_t minBin, const Int_t maxBin) :
PFTPhaseCorrection::PFTPhaseCorrection(std::vector<Double_t> &reFT, std::vector<Double_t> &imFT, const Int_t minBin, const Int_t maxBin) :
fReal(reFT), fImag(imFT), fMinBin(minBin), fMaxBin(maxBin)
{
Init();
Int_t realSize = static_cast<Int_t>(fReal.size());
if (fMinBin == -1)
fMinBin = 0;
if (fMaxBin == -1)
fMaxBin = fReal.size();
if (fMaxBin > fReal.size())
fMaxBin = fReal.size();
fMaxBin = realSize;
if (fMaxBin > realSize)
fMaxBin = realSize;
fRealPh.resize(fReal.size());
fImagPh.resize(fReal.size());
@ -110,7 +109,7 @@ void PFTPhaseCorrection::Minimize()
} else {
fMin = -1.0;
fValid = false;
cout << endl << ">> **WARNING** minimize failed to find a minimum for the real FT phase correction ..." << endl;
std::cout << std::endl << ">> **WARNING** minimize failed to find a minimum for the real FT phase correction ..." << std::endl;
return;
}
}
@ -130,7 +129,7 @@ Double_t PFTPhaseCorrection::GetPhaseCorrectionParam(UInt_t idx)
else if (idx == 1)
result = fPh_c1;
else
cerr << ">> **ERROR** requested phase correction parameter with index=" << idx << " does not exist!" << endl;
std::cerr << ">> **ERROR** requested phase correction parameter with index=" << idx << " does not exist!" << std::endl;
return result;
}
@ -144,7 +143,7 @@ Double_t PFTPhaseCorrection::GetPhaseCorrectionParam(UInt_t idx)
Double_t PFTPhaseCorrection::GetMinimum()
{
if (!fValid) {
cerr << ">> **ERROR** requested minimum is invalid!" << endl;
std::cerr << ">> **ERROR** requested minimum is invalid!" << std::endl;
return -1.0;
}
@ -178,7 +177,7 @@ void PFTPhaseCorrection::CalcPhasedFT() const
Double_t w=0.0;
for (UInt_t i=0; i<fRealPh.size(); i++) {
w = (Double_t)i / (Double_t)fReal.size();
w = static_cast<Double_t>(i) / static_cast<Double_t>(fReal.size());
phi = fPh_c0 + fPh_c1 * w;
fRealPh[i] = fReal[i]*cos(phi) - fImag[i]*sin(phi);
fImagPh[i] = fReal[i]*sin(phi) + fImag[i]*cos(phi);
@ -253,7 +252,7 @@ Double_t PFTPhaseCorrection::Entropy() const
/**
*
*/
double PFTPhaseCorrection::operator()(const vector<double> &par) const
double PFTPhaseCorrection::operator()(const std::vector<double> &par) const
{
// par : [0]: c0, [1]: c1
@ -287,15 +286,15 @@ PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTi
fDCCorrected(dcCorrected), fZeroPaddingPower(zeroPaddingPower)
{
// some necessary checks and initialization
if (fData == 0) {
cerr << endl << "**ERROR** PFourier::PFourier: no valid data" << endl << endl;
if (fData == nullptr) {
std::cerr << std::endl << "**ERROR** PFourier::PFourier: no valid data" << std::endl << std::endl;
fValid = false;
return;
}
fValid = true;
fIn = 0;
fOut = 0;
fIn = nullptr;
fOut = nullptr;
//as fPhCorrectedReFT = 0;
fApodization = F_APODIZATION_NONE;
@ -317,7 +316,7 @@ PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTi
}
// calculate start and end bin
fNoOfData = (UInt_t)((fEndTime-fStartTime)/fTimeResolution);
fNoOfData = static_cast<UInt_t>((fEndTime-fStartTime)/fTimeResolution);
// check if zero padding is whished
if (fZeroPaddingPower > 0) {
@ -348,21 +347,20 @@ PFourier::PFourier(TH1F *data, Int_t unitTag, Double_t startTime, Double_t endTi
default:
fValid = false;
return;
break;
}
// allocate necessary memory
fIn = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*fNoOfBins);
fOut = (fftw_complex *)fftw_malloc(sizeof(fftw_complex)*fNoOfBins);
fIn = static_cast<fftw_complex *>(fftw_malloc(sizeof(fftw_complex)*fNoOfBins));
fOut = static_cast<fftw_complex *>(fftw_malloc(sizeof(fftw_complex)*fNoOfBins));
// check if memory allocation has been successful
if ((fIn == 0) || (fOut == 0)) {
if ((fIn == nullptr) || (fOut == nullptr)) {
fValid = false;
return;
}
// get the FFTW3 plan (see FFTW3 manual)
fFFTwPlan = fftw_plan_dft_1d(fNoOfBins, fIn, fOut, FFTW_FORWARD, FFTW_ESTIMATE);
fFFTwPlan = fftw_plan_dft_1d(static_cast<Int_t>(fNoOfBins), fIn, fOut, FFTW_FORWARD, FFTW_ESTIMATE);
// check if a valid plan has been generated
if (!fFFTwPlan) {
@ -455,7 +453,7 @@ TH1F* PFourier::GetRealFourier(const Double_t scale)
{
// check if valid flag is set
if (!fValid)
return 0;
return nullptr;
// invoke realFourier
Char_t name[256];
@ -469,15 +467,15 @@ TH1F* PFourier::GetRealFourier(const Double_t scale)
else
noOfFourierBins = (fNoOfBins+1)/2;
TH1F *realFourier = new TH1F(name, title, noOfFourierBins, -fResolution/2.0, (Double_t)(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (realFourier == 0) {
TH1F *realFourier = new TH1F(name, title, static_cast<Int_t>(noOfFourierBins), -fResolution/2.0, static_cast<Double_t>(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (realFourier == nullptr) {
fValid = false;
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the real part of the Fourier transform." << endl;
return 0;
std::cerr << std::endl << "**SEVERE ERROR** couldn't allocate memory for the real part of the Fourier transform." << std::endl;
return nullptr;
}
// fill realFourier vector
for (UInt_t i=0; i<noOfFourierBins; i++) {
for (Int_t i=0; i<static_cast<Int_t>(noOfFourierBins); i++) {
realFourier->SetBinContent(i+1, scale*fOut[i][0]);
realFourier->SetBinError(i+1, 0.0);
}
@ -499,11 +497,11 @@ TH1F* PFourier::GetRealFourier(const Double_t scale)
* \param min minimal freq / field from which to optimise. Given in the choosen unit.
* \param max maximal freq / field up to which to optimise. Given in the choosen unit.
*/
TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Double_t> &phase,
TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, std::vector<Double_t> &phase,
const Double_t scale, const Double_t min, const Double_t max)
{
if ((re == 0) || (im == 0))
return 0;
if ((re == nullptr) || (im == nullptr))
return nullptr;
phase.resize(2); // c0, c1
@ -519,7 +517,7 @@ TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Do
minBin = axis->FindFixBin(min);
if ((minBin == 0) || (minBin > maxBin)) {
minBin = 1;
cerr << "**WARNING** minimum frequency/field out of range. Will adopted it." << endl;
std::cerr << "**WARNING** minimum frequency/field out of range. Will adopted it." << std::endl;
}
}
@ -528,12 +526,12 @@ TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Do
maxBin = axis->FindFixBin(max);
if ((maxBin == 0) || (maxBin > axis->GetNbins())) {
maxBin = axis->GetNbins();
cerr << "**WARNING** maximum frequency/field out of range. Will adopted it." << endl;
std::cerr << "**WARNING** maximum frequency/field out of range. Will adopted it." << std::endl;
}
}
// copy the real/imag Fourier from min to max
vector<Double_t> realF, imagF;
std::vector<Double_t> realF, imagF;
for (Int_t i=minBin; i<=maxBin; i++) {
realF.push_back(re->GetBinContent(i));
imagF.push_back(im->GetBinContent(i));
@ -541,15 +539,15 @@ TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Do
// optimize real FT phase
PFTPhaseCorrection *phCorrectedReFT = new PFTPhaseCorrection(realF, imagF);
if (phCorrectedReFT == 0) {
cerr << endl << "**SEVERE ERROR** couldn't invoke PFTPhaseCorrection object." << endl;
return 0;
if (phCorrectedReFT == nullptr) {
std::cerr << std::endl << "**SEVERE ERROR** couldn't invoke PFTPhaseCorrection object." << std::endl;
return nullptr;
}
phCorrectedReFT->Minimize();
if (!phCorrectedReFT->IsValid()) {
cerr << endl << "**ERROR** could not find a valid phase correction minimum." << endl;
return 0;
std::cerr << std::endl << "**ERROR** could not find a valid phase correction minimum." << std::endl;
return nullptr;
}
phase[0] = phCorrectedReFT->GetPhaseCorrectionParam(0);
phase[1] = phCorrectedReFT->GetPhaseCorrectionParam(1);
@ -557,7 +555,7 @@ TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Do
// clean up
if (phCorrectedReFT) {
delete phCorrectedReFT;
phCorrectedReFT = 0;
phCorrectedReFT = nullptr;
}
realF.clear();
imagF.clear();
@ -568,16 +566,16 @@ TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector<Do
snprintf(name, sizeof(name), "%s_Fourier_PhOptRe", re->GetName());
snprintf(title, sizeof(title), "%s_Fourier_PhOptRe", re->GetTitle());
TH1F *realPhaseOptFourier = new TH1F(name, title, noOfBins, -res/2.0, (Double_t)(noOfBins-1)*res+res/2.0);
if (realPhaseOptFourier == 0) {
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the real part of the Fourier transform." << endl;
return 0;
TH1F *realPhaseOptFourier = new TH1F(name, title, noOfBins, -res/2.0, static_cast<Double_t>(noOfBins-1)*res+res/2.0);
if (realPhaseOptFourier == nullptr) {
std::cerr << std::endl << "**SEVERE ERROR** couldn't allocate memory for the real part of the Fourier transform." << std::endl;
return nullptr;
}
// fill realFourier vector
Double_t ph;
for (Int_t i=0; i<noOfBins; i++) {
ph = phase[0] + phase[1] * (Double_t)((Int_t)i-(Int_t)minBin) / (Double_t)(maxBin-minBin);
ph = phase[0] + phase[1] * static_cast<Double_t>(i-static_cast<Int_t>(minBin)) / static_cast<Double_t>(maxBin-minBin);
realPhaseOptFourier->SetBinContent(i+1, scale*(re->GetBinContent(i+1)*cos(ph) - im->GetBinContent(i+1)*sin(ph)));
realPhaseOptFourier->SetBinError(i+1, 0.0);
}
@ -597,7 +595,7 @@ TH1F* PFourier::GetImaginaryFourier(const Double_t scale)
{
// check if valid flag is set
if (!fValid)
return 0;
return nullptr;
// invoke imaginaryFourier
Char_t name[256];
@ -611,15 +609,15 @@ TH1F* PFourier::GetImaginaryFourier(const Double_t scale)
else
noOfFourierBins = (fNoOfBins+1)/2;
TH1F* imaginaryFourier = new TH1F(name, title, noOfFourierBins, -fResolution/2.0, (Double_t)(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (imaginaryFourier == 0) {
TH1F* imaginaryFourier = new TH1F(name, title, static_cast<Int_t>(noOfFourierBins), -fResolution/2.0, static_cast<Double_t>(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (imaginaryFourier == nullptr) {
fValid = false;
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the imaginary part of the Fourier transform." << endl;
return 0;
std::cerr << std::endl << "**SEVERE ERROR** couldn't allocate memory for the imaginary part of the Fourier transform." << std::endl;
return nullptr;
}
// fill imaginaryFourier vector
for (UInt_t i=0; i<noOfFourierBins; i++) {
for (Int_t i=0; i<static_cast<Int_t>(noOfFourierBins); i++) {
imaginaryFourier->SetBinContent(i+1, scale*fOut[i][1]);
imaginaryFourier->SetBinError(i+1, 0.0);
}
@ -639,7 +637,7 @@ TH1F* PFourier::GetPowerFourier(const Double_t scale)
{
// check if valid flag is set
if (!fValid)
return 0;
return nullptr;
// invoke powerFourier
Char_t name[256];
@ -653,15 +651,15 @@ TH1F* PFourier::GetPowerFourier(const Double_t scale)
else
noOfFourierBins = (fNoOfBins+1)/2;
TH1F* pwrFourier = new TH1F(name, title, noOfFourierBins, -fResolution/2.0, (Double_t)(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (pwrFourier == 0) {
TH1F* pwrFourier = new TH1F(name, title, static_cast<Int_t>(noOfFourierBins), -fResolution/2.0, static_cast<Double_t>(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (pwrFourier == nullptr) {
fValid = false;
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the power part of the Fourier transform." << endl;
return 0;
std::cerr << std::endl << "**SEVERE ERROR** couldn't allocate memory for the power part of the Fourier transform." << std::endl;
return nullptr;
}
// fill powerFourier vector
for (UInt_t i=0; i<noOfFourierBins; i++) {
for (Int_t i=0; i<static_cast<Int_t>(noOfFourierBins); i++) {
pwrFourier->SetBinContent(i+1, scale*sqrt(fOut[i][0]*fOut[i][0]+fOut[i][1]*fOut[i][1]));
pwrFourier->SetBinError(i+1, 0.0);
}
@ -681,7 +679,7 @@ TH1F* PFourier::GetPhaseFourier(const Double_t scale)
{
// check if valid flag is set
if (!fValid)
return 0;
return nullptr;
// invoke phaseFourier
Char_t name[256];
@ -695,18 +693,18 @@ TH1F* PFourier::GetPhaseFourier(const Double_t scale)
else
noOfFourierBins = (fNoOfBins+1)/2;
TH1F* phaseFourier = new TH1F(name, title, noOfFourierBins, -fResolution/2.0, (Double_t)(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (phaseFourier == 0) {
TH1F* phaseFourier = new TH1F(name, title, static_cast<Int_t>(noOfFourierBins), -fResolution/2.0, static_cast<Double_t>(noOfFourierBins-1)*fResolution+fResolution/2.0);
if (phaseFourier == nullptr) {
fValid = false;
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the phase part of the Fourier transform." << endl;
return 0;
std::cerr << std::endl << "**SEVERE ERROR** couldn't allocate memory for the phase part of the Fourier transform." << std::endl;
return nullptr;
}
// fill phaseFourier vector
Double_t value = 0.0;
for (UInt_t i=0; i<noOfFourierBins; i++) {
for (Int_t i=0; i<static_cast<Int_t>(noOfFourierBins); i++) {
// calculate the phase
if (fOut[i][0] == 0) {
if (fOut[i][0] == 0.0) {
if (fOut[i][1] >= 0.0)
value = PI_HALF;
else
@ -758,14 +756,14 @@ void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
Double_t mean = 0.0;
if (fDCCorrected) {
for (UInt_t i=0; i<fNoOfData; i++) {
mean += fData->GetBinContent(i+start);
mean += fData->GetBinContent(static_cast<Int_t>(i+start));
}
mean /= (Double_t)fNoOfData;
mean /= static_cast<Double_t>(fNoOfData);
}
// 2nd fill fIn
for (UInt_t i=0; i<fNoOfData; i++) {
fIn[i][0] = fData->GetBinContent(i+start) - mean;
fIn[i][0] = fData->GetBinContent(static_cast<Int_t>(i+start)) - mean;
fIn[i][1] = 0.0;
}
for (UInt_t i=fNoOfData; i<fNoOfBins; i++) {
@ -774,7 +772,7 @@ void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
}
// 3rd apodize data (if wished)
ApodizeData(apodizationTag);
ApodizeData(static_cast<Int_t>(apodizationTag));
}
//--------------------------------------------------------------------------
@ -801,7 +799,6 @@ void PFourier::ApodizeData(Int_t apodizationTag) {
switch (apodizationTag) {
case F_APODIZATION_NONE:
return;
break;
case F_APODIZATION_WEAK:
c[0] = cweak[0]+cweak[1]+cweak[2];
c[1] = -(cweak[1]+2.0*cweak[2]);
@ -820,7 +817,7 @@ void PFourier::ApodizeData(Int_t apodizationTag) {
c[4] = cstrong[2];
break;
default:
cerr << endl << ">> **ERROR** User Apodization tag " << apodizationTag << " unknown, sorry ..." << endl;
std::cerr << std::endl << ">> **ERROR** User Apodization tag " << apodizationTag << " unknown, sorry ..." << std::endl;
break;
}
@ -828,7 +825,7 @@ void PFourier::ApodizeData(Int_t apodizationTag) {
for (UInt_t i=0; i<fNoOfData; i++) {
q = c[0];
for (UInt_t j=1; j<5; j++) {
q += c[j] * pow((Double_t)i/(Double_t)fNoOfData, 2.0*(Double_t)j);
q += c[j] * pow(static_cast<Double_t>(i)/static_cast<Double_t>(fNoOfData), 2.0*static_cast<Double_t>(j));
}
fIn[i][0] *= q;
}

View File

@ -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 *
@ -29,7 +29,6 @@
#include <iostream>
#include <fstream>
using namespace std;
#include <TColor.h>
#include <TRandom.h>
@ -45,7 +44,7 @@ using namespace std;
static const Char_t *gFiletypes[] = { "Data files", "*.dat",
"All files", "*",
0, 0 };
nullptr, nullptr };
ClassImpQ(PFourierCanvas)
@ -56,7 +55,7 @@ ClassImpQ(PFourierCanvas)
PFourierCanvas::PFourierCanvas()
{
fTimeout = 0;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
fBatchMode = false;
fValid = false;
@ -70,18 +69,18 @@ PFourierCanvas::PFourierCanvas()
fXaxisTitle = TString("");
fCurrentFourierPhase = 0.0;
fCurrentFourierPhaseText = 0;
fCurrentFourierPhaseText = nullptr;
fStyle = 0;
fImp = 0;
fBar = 0;
fPopupMain = 0;
fPopupFourier = 0;
fStyle = nullptr;
fImp = nullptr;
fBar = nullptr;
fPopupMain = nullptr;
fPopupFourier = nullptr;
fMainCanvas = 0;
fTitlePad = 0;
fFourierPad = 0;
fInfoPad = 0;
fMainCanvas = nullptr;
fTitlePad = nullptr;
fFourierPad = nullptr;
fInfoPad = nullptr;
}
//---------------------------------------------------------------------------
@ -100,7 +99,7 @@ PFourierCanvas::PFourierCanvas()
* \param wh
* \param batch
*/
PFourierCanvas::PFourierCanvas(vector<PFourier*> &fourier, PIntVector dataSetTag, const Char_t* title,
PFourierCanvas::PFourierCanvas(std::vector<PFourier*> &fourier, PIntVector dataSetTag, const Char_t* title,
const Bool_t showAverage, const Bool_t showAveragePerDataSet,
const Int_t fourierPlotOpt, Double_t fourierXrange[], Double_t phase,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
@ -113,20 +112,20 @@ PFourierCanvas::PFourierCanvas(vector<PFourier*> &fourier, PIntVector dataSetTag
fInitialXRange[1] = fourierXrange[1];
fTimeout = 0;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
fValid = false;
fCurrentFourierPhaseText = 0;
fCurrentFourierPhaseText = nullptr;
// generate fMarkerList and fColorList, since they are not provided
TRandom rand;
Int_t style, color;
for (UInt_t i=0; i<fourier.size(); i++) {
rand.SetSeed(i);
style = 20+(Int_t)rand.Integer(10);
style = 20+static_cast<Int_t>(rand.Integer(10));
fMarkerList.push_back(style);
color = TColor::GetColor((Int_t)rand.Integer(255), (Int_t)rand.Integer(255), (Int_t)rand.Integer(255));
color = TColor::GetColor(static_cast<Int_t>(rand.Integer(255)), static_cast<Int_t>(rand.Integer(255)), static_cast<Int_t>(rand.Integer(255)));
fColorList.push_back(color);
}
@ -156,7 +155,7 @@ PFourierCanvas::PFourierCanvas(vector<PFourier*> &fourier, PIntVector dataSetTag
* \param colorList
* \param batch
*/
PFourierCanvas::PFourierCanvas(vector<PFourier*> &fourier, PIntVector dataSetTag, const Char_t* title,
PFourierCanvas::PFourierCanvas(std::vector<PFourier*> &fourier, PIntVector dataSetTag, const Char_t* title,
const Bool_t showAverage, const Bool_t showAveragePerDataSet,
const Int_t fourierPlotOpt, Double_t fourierXrange[], Double_t phase,
Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh,
@ -169,23 +168,23 @@ PFourierCanvas::PFourierCanvas(vector<PFourier*> &fourier, PIntVector dataSetTag
fInitialXRange[1] = fourierXrange[1];
fTimeout = 0;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
fValid = false;
fCurrentFourierPhaseText = 0;
fCurrentFourierPhaseText = nullptr;
// generate fMarkerList and fColorList, since they are not provided
TRandom rand;
Int_t style, color;
for (UInt_t i=fMarkerList.size(); i<fourier.size(); i++) {
for (UInt_t i=static_cast<UInt_t>(fMarkerList.size()); i<fourier.size(); i++) {
rand.SetSeed(i);
style = 20+(Int_t)rand.Integer(10);
style = 20+static_cast<Int_t>(rand.Integer(10));
fMarkerList.push_back(style);
}
for (UInt_t i=fColorList.size(); i<fourier.size(); i++) {
for (UInt_t i=static_cast<UInt_t>(fColorList.size()); i<fourier.size(); i++) {
rand.SetSeed(i);
color = TColor::GetColor((Int_t)rand.Integer(255), (Int_t)rand.Integer(255), (Int_t)rand.Integer(255));
color = TColor::GetColor(static_cast<Int_t>(rand.Integer(255)), static_cast<Int_t>(rand.Integer(255)), static_cast<Int_t>(rand.Integer(255)));
fColorList.push_back(color);
}
@ -218,7 +217,7 @@ PFourierCanvas::~PFourierCanvas()
if (fTitlePad) {
fTitlePad->Clear();
delete fTitlePad;
fTitlePad = 0;
fTitlePad = nullptr;
}
if (fFourierHistos.size() > 0) {
@ -244,19 +243,19 @@ PFourierCanvas::~PFourierCanvas()
if (fInfoPad) {
fInfoPad->Clear();
delete fInfoPad;
fInfoPad = 0;
fInfoPad = nullptr;
}
if (fLegAvgPerDataSet) {
fLegAvgPerDataSet->Clear();
delete fLegAvgPerDataSet;
fLegAvgPerDataSet = 0;
fLegAvgPerDataSet = nullptr;
}
/*
if (fMainCanvas) {
delete fMainCanvas;
fMainCanvas = 0;
fMainCanvas = nullptr;
}
*/
}
@ -476,7 +475,7 @@ void PFourierCanvas::HandleMenuPopup(Int_t id)
fi.fFileTypes = gFiletypes;
fi.fIniDir = StrDup(dir);
fi.fOverwrite = true;
new TGFileDialog(0, fImp, kFDSave, &fi);
new TGFileDialog(nullptr, fImp, kFDSave, &fi);
if (fi.fFilename && strlen(fi.fFilename)) {
ExportData(fi.fFilename);
}
@ -566,7 +565,7 @@ void PFourierCanvas::SetTimeout(Int_t timeout)
if (fTimeoutTimer) {
delete fTimeoutTimer;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
}
fTimeoutTimer = new TTimer();
@ -585,7 +584,7 @@ void PFourierCanvas::SetTimeout(Int_t timeout)
*/
void PFourierCanvas::SaveGraphicsAndQuit(const Char_t *fileName)
{
cout << endl << ">> SaveGraphicsAndQuit: will dump the canvas into a graphics output file: " << fileName << " ..." << endl;
std::cout << std::endl << ">> SaveGraphicsAndQuit: will dump the canvas into a graphics output file: " << fileName << " ..." << std::endl;
fMainCanvas->SaveAs(fileName);
@ -605,7 +604,7 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
if (pathFileName) { // path file name provided
pfn = TString(pathFileName);
} else { // path file name NOT provided, generate a default path file name
cerr << endl << ">> PFourierCanvas::ExportData **ERROR** NO path file name provided. Will do nothing." << endl;
std::cerr << std::endl << ">> PFourierCanvas::ExportData **ERROR** NO path file name provided. Will do nothing." << std::endl;
return;
}
@ -698,33 +697,33 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
}
// write data to file
ofstream fout(pfn.Data(), ofstream::out);
std::ofstream fout(pfn.Data(), std::ofstream::out);
if (fAveragedView) {
// write header
fout << "% " << pfn << endl;
fout << "% averaged data of:" << endl;
fout << "% " << pfn << std::endl;
fout << "% averaged data of:" << std::endl;
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
fout << "% " << fFourierHistos[i].dataFourierRe->GetTitle() << endl;
fout << "% " << fFourierHistos[i].dataFourierRe->GetTitle() << std::endl;
}
fout << "%------------" << endl;
fout << "% " << xAxis << ", " << yAxis << endl;
fout << "%------------" << std::endl;
fout << "% " << xAxis << ", " << yAxis << std::endl;
for (Int_t i=xMinBin; i<xMaxBin; i++) {
switch (fCurrentPlotView) {
case FOURIER_PLOT_REAL:
fout << fFourierAverage[0].dataFourierRe->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierRe->GetBinContent(i) << endl;
fout << fFourierAverage[0].dataFourierRe->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierRe->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_IMAG:
fout << fFourierAverage[0].dataFourierIm->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierIm->GetBinContent(i) << endl;
fout << fFourierAverage[0].dataFourierIm->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierIm->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_POWER:
fout << fFourierAverage[0].dataFourierPwr->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPwr->GetBinContent(i) << endl;
fout << fFourierAverage[0].dataFourierPwr->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPwr->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_PHASE:
fout << fFourierAverage[0].dataFourierPhase->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPhase->GetBinContent(i) << endl;
fout << fFourierAverage[0].dataFourierPhase->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPhase->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_PHASE_OPT_REAL:
fout << fFourierAverage[0].dataFourierPhaseOptReal->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPhaseOptReal->GetBinContent(i) << endl;
fout << fFourierAverage[0].dataFourierPhaseOptReal->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPhaseOptReal->GetBinContent(i) << std::endl;
break;
default:
break;
@ -732,17 +731,17 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
}
} else {
// write header
fout << "% " << pfn << endl;
fout << "% data of:" << endl;
fout << "% " << pfn << std::endl;
fout << "% data of:" << std::endl;
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
fout << "% " << fFourierHistos[i].dataFourierRe->GetTitle() << endl;
fout << "% " << fFourierHistos[i].dataFourierRe->GetTitle() << std::endl;
}
fout << "%------------" << endl;
fout << "%------------" << std::endl;
fout << "% ";
for (UInt_t i=0; i<fFourierHistos.size()-1; i++) {
fout << xAxis << i << ", " << yAxis << i << ", ";
}
fout << xAxis << fFourierHistos.size()-1 << ", " << yAxis << fFourierHistos.size()-1 << endl;
fout << xAxis << fFourierHistos.size()-1 << ", " << yAxis << fFourierHistos.size()-1 << std::endl;
// write data
for (Int_t i=xMinBin; i<xMaxBin; i++) {
@ -771,21 +770,21 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
}
switch (fCurrentPlotView) {
case FOURIER_PLOT_REAL:
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierRe->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierRe->GetBinContent(i) << endl;
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierRe->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierRe->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_IMAG:
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierIm->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierIm->GetBinContent(i) << endl;
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierIm->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierIm->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_REAL_AND_IMAG:
break;
case FOURIER_PLOT_POWER:
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPwr->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPwr->GetBinContent(i) << endl;
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPwr->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPwr->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_PHASE:
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPhase->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPhase->GetBinContent(i) << endl;
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPhase->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPhase->GetBinContent(i) << std::endl;
break;
case FOURIER_PLOT_PHASE_OPT_REAL:
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPhaseOptReal->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPhaseOptReal->GetBinContent(i) << endl;
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPhaseOptReal->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPhaseOptReal->GetBinContent(i) << std::endl;
break;
default:
break;
@ -988,28 +987,28 @@ void PFourierCanvas::InitFourierDataSets()
*/
void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh)
{
fImp = 0;
fBar = 0;
fPopupMain = 0;
fPopupFourier = 0;
fImp = nullptr;
fBar = nullptr;
fPopupMain = nullptr;
fPopupFourier = nullptr;
fMainCanvas = 0;
fTitlePad = 0;
fFourierPad = 0;
fInfoPad = 0;
fMainCanvas = nullptr;
fTitlePad = nullptr;
fFourierPad = nullptr;
fInfoPad = nullptr;
// invoke canvas
TString canvasName = TString("fMainCanvas");
fMainCanvas = new TCanvas(canvasName.Data(), title, wtopx, wtopy, ww, wh);
if (fMainCanvas == 0) {
cerr << endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke " << canvasName.Data();
cerr << endl;
if (fMainCanvas == nullptr) {
std::cerr << std::endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke " << canvasName.Data();
std::cerr << std::endl;
return;
}
// add canvas menu if not in batch mode
if (!fBatchMode) {
fImp = (TRootCanvas*)fMainCanvas->GetCanvasImp();
fImp = static_cast<TRootCanvas*>(fMainCanvas->GetCanvasImp());
fBar = fImp->GetMenuBar();
fPopupMain = fBar->AddPopup("MusrFT");
@ -1069,9 +1068,9 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w
// divide the canvas into sub pads
// title pad
fTitlePad = new TPaveText(0.0, YTITLE, 1.0, 1.0, "NDC");
if (fTitlePad == 0) {
cerr << endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke fTitlePad";
cerr << endl;
if (fTitlePad == nullptr) {
std::cerr << std::endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke fTitlePad";
std::cerr << std::endl;
return;
}
fTitlePad->SetFillColor(TColor::GetColor(255,255,255));
@ -1081,9 +1080,9 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w
// fourier pad
fFourierPad = new TPad("fFourierPad", "fFourierPad", 0.0, YINFO, 1.0, YTITLE);
if (fFourierPad == 0) {
cerr << endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke fFourierPad";
cerr << endl;
if (fFourierPad == nullptr) {
std::cerr << std::endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke fFourierPad";
std::cerr << std::endl;
return;
}
fFourierPad->SetFillColor(TColor::GetColor(255,255,255));
@ -1091,21 +1090,21 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w
// info pad
fInfoPad = new TLegend(0.0, 0.0, 1.0, YINFO, "NDC");
if (fInfoPad == 0) {
cerr << endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke fInfoPad";
cerr << endl;
if (fInfoPad == nullptr) {
std::cerr << std::endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: Couldn't invoke fInfoPad";
std::cerr << std::endl;
return;
}
fInfoPad->SetFillColor(TColor::GetColor(255,255,255));
fInfoPad->SetTextAlign(12); // middle, left
fLegAvgPerDataSet = 0;
fLegAvgPerDataSet = nullptr;
fValid = true;
if ((fFourier.size() != fDataSetTag.size()) && fAveragedViewPerDataSet) {
fValid = false;
cerr << endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: # Fourier != # Data Set Tags." << endl;
std::cerr << std::endl << "PFourierCanvas::PFourierCanvas: **PANIC ERROR**: # Fourier != # Data Set Tags." << std::endl;
}
fMainCanvas->cd();
@ -1125,25 +1124,25 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w
void PFourierCanvas::CleanupAverage()
{
for (UInt_t i=0; i<fFourierAverage.size(); i++) {
if (fFourierAverage[i].dataFourierRe != 0) {
if (fFourierAverage[i].dataFourierRe != nullptr) {
delete fFourierAverage[i].dataFourierRe;
fFourierAverage[i].dataFourierRe = 0;
fFourierAverage[i].dataFourierRe = nullptr;
}
if (fFourierAverage[i].dataFourierIm) {
delete fFourierAverage[i].dataFourierIm;
fFourierAverage[i].dataFourierIm = 0;
fFourierAverage[i].dataFourierIm = nullptr;
}
if (fFourierAverage[i].dataFourierPwr) {
delete fFourierAverage[i].dataFourierPwr;
fFourierAverage[i].dataFourierPwr = 0;
fFourierAverage[i].dataFourierPwr = nullptr;
}
if (fFourierAverage[i].dataFourierPhase) {
delete fFourierAverage[i].dataFourierPhase;
fFourierAverage[i].dataFourierPhase = 0;
fFourierAverage[i].dataFourierPhase = nullptr;
}
if (fFourierAverage[i].dataFourierPhaseOptReal) {
delete fFourierAverage[i].dataFourierPhaseOptReal;
fFourierAverage[i].dataFourierPhaseOptReal = 0;
fFourierAverage[i].dataFourierPhaseOptReal = nullptr;
}
}
fFourierAverage.clear();
@ -1166,7 +1165,7 @@ void PFourierCanvas::HandleAverage()
Double_t dval=0.0;
Bool_t phaseOptRealPresent = false;
if (fFourierHistos[0].dataFourierPhaseOptReal != 0)
if (fFourierHistos[0].dataFourierPhaseOptReal != nullptr)
phaseOptRealPresent = true;
// check if ALL data shall be averaged
@ -1473,7 +1472,7 @@ void PFourierCanvas::PlotFourier()
// check if phase opt real Fourier spectra already exists if requested,
// and if not calculate them first
if (fCurrentPlotView == FOURIER_PLOT_PHASE_OPT_REAL) {
if (fFourierHistos[0].dataFourierPhaseOptReal == 0) { // not yet calculated
if (fFourierHistos[0].dataFourierPhaseOptReal == nullptr) { // not yet calculated
CalcPhaseOptReal();
}
}
@ -1633,7 +1632,7 @@ void PFourierCanvas::PlotFourierPhaseValue()
// check if phase TLatex object is present
if (fCurrentFourierPhaseText) {
delete fCurrentFourierPhaseText;
fCurrentFourierPhaseText = 0;
fCurrentFourierPhaseText = nullptr;
}
Double_t x, y;
@ -1679,7 +1678,7 @@ void PFourierCanvas::PlotAverage()
if (fLegAvgPerDataSet) {
fLegAvgPerDataSet->Clear();
delete fLegAvgPerDataSet;
fLegAvgPerDataSet = 0;
fLegAvgPerDataSet = nullptr;
}
switch (fCurrentPlotView) {
@ -1773,8 +1772,8 @@ void PFourierCanvas::PlotAverage()
fFourierAverage[0].dataFourierPhase->Draw("p");
break;
case FOURIER_PLOT_PHASE_OPT_REAL:
if (fFourierHistos[0].dataFourierPhaseOptReal == 0) {
cout << "debug> need to calculate phase opt. average first ..." << endl;
if (fFourierHistos[0].dataFourierPhaseOptReal == nullptr) {
std::cout << "debug> need to calculate phase opt. average first ..." << std::endl;
CalcPhaseOptReal();
HandleAverage();
}
@ -1862,7 +1861,7 @@ void PFourierCanvas::IncrementFourierPhase()
PlotFourierPhaseValue();
for (UInt_t i=0; i<fFourierHistos.size(); i++) { // loop over all data sets
if ((fFourierHistos[i].dataFourierRe != 0) && (fFourierHistos[i].dataFourierIm != 0)) {
if ((fFourierHistos[i].dataFourierRe != nullptr) && (fFourierHistos[i].dataFourierIm != nullptr)) {
for (Int_t j=0; j<fFourierHistos[i].dataFourierRe->GetNbinsX(); j++) { // loop over a fourier data set
// calculate new fourier data set value
re = fFourierHistos[i].dataFourierRe->GetBinContent(j) * cp + fFourierHistos[i].dataFourierIm->GetBinContent(j) * sp;
@ -1895,7 +1894,7 @@ void PFourierCanvas::DecrementFourierPhase()
PlotFourierPhaseValue();
for (UInt_t i=0; i<fFourierHistos.size(); i++) { // loop over all data sets
if ((fFourierHistos[i].dataFourierRe != 0) && (fFourierHistos[i].dataFourierIm != 0)) {
if ((fFourierHistos[i].dataFourierRe != nullptr) && (fFourierHistos[i].dataFourierIm != nullptr)) {
for (Int_t j=0; j<fFourierHistos[i].dataFourierRe->GetNbinsX(); j++) { // loop over a fourier data set
// calculate new fourier data set value
re = fFourierHistos[i].dataFourierRe->GetBinContent(j) * cp - fFourierHistos[i].dataFourierIm->GetBinContent(j) * sp;
@ -1924,7 +1923,7 @@ void PFourierCanvas::DecrementFourierPhase()
*/
Double_t PFourierCanvas::GetMaximum(TH1F* histo, Double_t xmin, Double_t xmax)
{
if (histo == 0)
if (histo == nullptr)
return 0.0;
Int_t start=0, end=0;
@ -1967,7 +1966,7 @@ Double_t PFourierCanvas::GetMaximum(TH1F* histo, Double_t xmin, Double_t xmax)
*/
Double_t PFourierCanvas::GetMinimum(TH1F* histo, Double_t xmin, Double_t xmax)
{
if (histo == 0)
if (histo == nullptr)
return 0.0;
Int_t start=0, end=0;
@ -2009,7 +2008,7 @@ Double_t PFourierCanvas::GetMinimum(TH1F* histo, Double_t xmin, Double_t xmax)
*/
Double_t PFourierCanvas::GetInterpolatedValue(TH1F* histo, Double_t xVal)
{
if (histo == 0)
if (histo == nullptr)
return 0.0;
Int_t idx = histo->FindBin(xVal);

View File

@ -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 *
@ -30,7 +30,6 @@
#include<cmath>
#include <iostream>
using namespace std;
#include <boost/algorithm/string/trim.hpp> // for stripping leading whitespace in std::string
@ -128,7 +127,7 @@ Bool_t PFunction::SetFuncNo()
i = i->children.begin(); // FUNx
// get string from tree
string str(i->value.begin(), i->value.end());
std::string str(i->value.begin(), i->value.end());
boost::algorithm::trim(str);
// extract function number from string
@ -171,13 +170,13 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
Double_t dvalue;
Int_t ivalue;
Int_t status;
string str;
std::string str;
PFuncTreeNode child;
InitNode(child);
if (i->value.id() == PFunctionGrammar::realID) { // handle number
str = string(i->value.begin(), i->value.end()); // get string
str = std::string(i->value.begin(), i->value.end()); // get string
boost::algorithm::trim(str);
status = sscanf(str.c_str(), "%lf", &dvalue); // convert string to Double_t
node.fID = PFunctionGrammar::realID; // keep the ID
@ -189,7 +188,7 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
node.fID = PFunctionGrammar::constGammaMuID; // keep the ID
node.fDvalue = GAMMA_BAR_MUON; // keep the value
} else if (i->value.id() == PFunctionGrammar::parameterID) { // handle parameter number
str = string(i->value.begin(), i->value.end()); // get string
str = std::string(i->value.begin(), i->value.end()); // get string
boost::algorithm::trim(str);
if (strstr(str.c_str(), "-")) {
node.fSign = true;
@ -200,7 +199,7 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
node.fID = PFunctionGrammar::parameterID; // keep the ID
node.fIvalue = ivalue; // keep the value
} else if (i->value.id() == PFunctionGrammar::mapID) { // handle map number
str = string(i->value.begin(), i->value.end()); // get string
str = std::string(i->value.begin(), i->value.end()); // get string
boost::algorithm::trim(str);
status = sscanf(str.c_str(), "MAP%d", &ivalue); // convert string to map number
node.fID = PFunctionGrammar::mapID; // keep the ID
@ -209,7 +208,7 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
// keep the id
node.fID = PFunctionGrammar::functionID;
// keep function tag
str = string(i->value.begin(), i->value.end()); // get string
str = std::string(i->value.begin(), i->value.end()); // get string
if (!strcmp(str.c_str(), "COS"))
node.fFunctionTag = FUN_COS;
else if (!strcmp(str.c_str(), "SIN"))
@ -243,8 +242,8 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
else if (!strcmp(str.c_str(), "SQRT"))
node.fFunctionTag = FUN_SQRT;
else {
cerr << endl << "**PANIC ERROR**: function " << str << " doesn't exist, but you never should have reached this point!";
cerr << endl;
std::cerr << std::endl << "**PANIC ERROR**: function " << str << " doesn't exist, but you never should have reached this point!";
std::cerr << std::endl;
assert(0);
}
// add node
@ -255,13 +254,13 @@ void PFunction::FillFuncEvalTree(iter_t const& i, PFuncTreeNode &node)
// keep the id
node.fID = PFunctionGrammar::powerID;
// keep function tag
str = string(i->value.begin(), i->value.end()); // get string
str = std::string(i->value.begin(), i->value.end()); // get string
if (!strcmp(str.c_str(), "POW"))
node.fFunctionTag = FUN_POW;
else {
cerr << endl << "**PANIC ERROR**: function " << str << " doesn't exist, but you never should have reached this point!";
cerr << endl;
std::cerr << std::endl << "**PANIC ERROR**: function " << str << " doesn't exist, but you never should have reached this point!";
std::cerr << std::endl;
assert(0);
}
// i: '(', 'expression', ',', expression, ')'
@ -345,12 +344,12 @@ Bool_t PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, UInt_t mapSi
} else if (node.fID == PFunctionGrammar::constGammaMuID) {
return true;
} else if (node.fID == PFunctionGrammar::parameterID) {
if (node.fIvalue <= (Int_t) paramSize)
if (node.fIvalue <= static_cast<Int_t>(paramSize))
return true;
else
return false;
} else if (node.fID == PFunctionGrammar::mapID) {
if (node.fIvalue <= (Int_t) mapSize)
if (node.fIvalue <= static_cast<Int_t>(mapSize))
return true;
else
return false;
@ -374,9 +373,9 @@ Bool_t PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, UInt_t mapSi
else
return false;
} else {
cerr << endl << ">> **PANIC ERROR**: PFunction::FindAndCheckMapAndParamRange: you never should have reached this point!";
cerr << endl << ">> node.fID = " << node.fID;
cerr << endl;
std::cerr << std::endl << ">> **PANIC ERROR**: PFunction::FindAndCheckMapAndParamRange: you never should have reached this point!";
std::cerr << std::endl << ">> node.fID = " << node.fID;
std::cerr << std::endl;
assert(0);
}
return true;
@ -392,7 +391,7 @@ Bool_t PFunction::FindAndCheckMapAndParamRange(PFuncTreeNode &node, UInt_t mapSi
*
* \param param fit parameter vector
*/
Double_t PFunction::Eval(vector<Double_t> param)
Double_t PFunction::Eval(std::vector<Double_t> param)
{
fParam = param;
@ -461,8 +460,8 @@ Double_t PFunction::EvalNode(PFuncTreeNode &node)
} else if (node.fFunctionTag == FUN_SQRT) {
return sqrt(fabs(EvalNode(node.children[0])));
} else {
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: node.fID == PFunctionGrammar::functionID: you never should have reached this point!";
cerr << endl;
std::cerr << std::endl << "**PANIC ERROR**: PFunction::EvalNode: node.fID == PFunctionGrammar::functionID: you never should have reached this point!";
std::cerr << std::endl;
assert(0);
}
} else if (node.fID == PFunctionGrammar::powerID) {
@ -476,8 +475,8 @@ Double_t PFunction::EvalNode(PFuncTreeNode &node)
}
return pow(base, expo);
} else {
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: node.fID == PFunctionGrammar::powerID: you never should have reached this point!";
cerr << endl;
std::cerr << std::endl << "**PANIC ERROR**: PFunction::EvalNode: node.fID == PFunctionGrammar::powerID: you never should have reached this point!";
std::cerr << std::endl;
assert(0);
}
} else if (node.fID == PFunctionGrammar::factorID) {
@ -488,10 +487,10 @@ Double_t PFunction::EvalNode(PFuncTreeNode &node)
} else {
Double_t denominator = EvalNode(node.children[1]);
if (denominator == 0.0) {
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: division by 0.0";
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: requested operation: " << EvalNode(node.children[0]) << "/" << EvalNode(node.children[1]);
cerr << endl << ">> " << fFuncString.Data() << endl;
cerr << endl;
std::cerr << std::endl << "**PANIC ERROR**: PFunction::EvalNode: division by 0.0";
std::cerr << std::endl << "**PANIC ERROR**: PFunction::EvalNode: requested operation: " << EvalNode(node.children[0]) << "/" << EvalNode(node.children[1]);
std::cerr << std::endl << ">> " << fFuncString.Data() << std::endl;
std::cerr << std::endl;
assert(0);
}
return EvalNode(node.children[0]) / denominator;
@ -503,8 +502,8 @@ Double_t PFunction::EvalNode(PFuncTreeNode &node)
return EvalNode(node.children[0]) - EvalNode(node.children[1]);
}
} else {
cerr << endl << "**PANIC ERROR**: PFunction::EvalNode: you never should have reached this point!";
cerr << endl;
std::cerr << std::endl << "**PANIC ERROR**: PFunction::EvalNode: you never should have reached this point!";
std::cerr << std::endl;
assert(0);
}
return 0.0;
@ -570,7 +569,7 @@ void PFunction::EvalTreeForStringExpression(iter_t const& i)
assert(i->children.size() == 0);
if (*i->value.begin() == '-')
fFuncString += "(";
fFuncString += boost::algorithm::trim_copy(string(i->value.begin(), i->value.end())).c_str();
fFuncString += boost::algorithm::trim_copy(std::string(i->value.begin(), i->value.end())).c_str();
if (*i->value.begin() == '-')
fFuncString += ")";
} else if (i->value.id() == PFunctionGrammar::constPiID) {
@ -580,23 +579,23 @@ void PFunction::EvalTreeForStringExpression(iter_t const& i)
} else if (i->value.id() == PFunctionGrammar::funLabelID) {
assert(i->children.size() == 0);
//SetFuncNo(i);
fFuncString += string(i->value.begin(), i->value.end()).c_str(); // funx
fFuncString += std::string(i->value.begin(), i->value.end()).c_str(); // funx
} else if (i->value.id() == PFunctionGrammar::parameterID) {
assert(i->children.size() == 0);
fFuncString += boost::algorithm::trim_copy(string(i->value.begin(), i->value.end())).c_str();
fFuncString += boost::algorithm::trim_copy(std::string(i->value.begin(), i->value.end())).c_str();
} else if (i->value.id() == PFunctionGrammar::mapID) {
assert(i->children.size() == 0);
fFuncString += boost::algorithm::trim_copy(string(i->value.begin(), i->value.end())).c_str();
fFuncString += boost::algorithm::trim_copy(std::string(i->value.begin(), i->value.end())).c_str();
} else if (i->value.id() == PFunctionGrammar::functionID) {
assert(i->children.size() == 3);
fFuncString += string(i->value.begin(), i->value.end()).c_str(); // keep function name
fFuncString += std::string(i->value.begin(), i->value.end()).c_str(); // keep function name
fFuncString += "(";
// '(', expression, ')'
EvalTreeForStringExpression(i->children.begin()+1); // the real stuff
fFuncString += ")";
} else if (i->value.id() == PFunctionGrammar::powerID) {
assert(i->children.size() == 5);
fFuncString += string(i->value.begin(), i->value.end()).c_str(); // keep function name
fFuncString += std::string(i->value.begin(), i->value.end()).c_str(); // keep function name
fFuncString += "(";
// '(', expression, ',' expression, ')'
EvalTreeForStringExpression(i->children.begin()+1); // base expression

View File

@ -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 *
@ -96,7 +96,7 @@ Bool_t PFunctionHandler::DoParse()
PFunction func(info); // generate an evaluation function object based on the AST tree
fFuncs.push_back(func); // feeds it to the functions vector
} else {
cerr << endl << "**ERROR**: FUNCTIONS parse failed in line " << fLines[i].fLineNo << endl;
std::cerr << std::endl << "**ERROR**: FUNCTIONS parse failed in line " << fLines[i].fLineNo << std::endl;
success = false;
break;
}
@ -107,9 +107,9 @@ Bool_t PFunctionHandler::DoParse()
for (UInt_t i=0; i<fFuncs.size(); i++) {
for (UInt_t j=i+1; j<fFuncs.size(); j++) {
if (fFuncs[i].GetFuncNo() == fFuncs[j].GetFuncNo()) {
cerr << endl << "**ERROR**: function number " << fFuncs[i].GetFuncNo();
cerr << " is at least twice present! Fix this first.";
cerr << endl;
std::cerr << std::endl << "**ERROR**: function number " << fFuncs[i].GetFuncNo();
std::cerr << " is at least twice present! Fix this first.";
std::cerr << std::endl;
success = false;
}
}
@ -155,11 +155,11 @@ Bool_t PFunctionHandler::CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize)
* \param map map vector
* \param param fit parameter vector
*/
Double_t PFunctionHandler::Eval(Int_t funNo, vector<Int_t> map, vector<double> param)
Double_t PFunctionHandler::Eval(Int_t funNo, std::vector<Int_t> map, std::vector<double> param)
{
if (GetFuncIndex(funNo) == -1) {
cerr << endl << "**ERROR**: Couldn't find FUN" << funNo << " for evaluation";
cerr << endl;
std::cerr << std::endl << "**ERROR**: Couldn't find FUN" << funNo << " for evaluation";
std::cerr << std::endl;
return 0.0;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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 *
@ -29,7 +29,6 @@
#include <cassert>
#include <iostream>
using namespace std;
#include <boost/algorithm/string.hpp>
using namespace boost;
@ -164,8 +163,8 @@ PNonMusrRawRunData::~PNonMusrRawRunData()
void PNonMusrRawRunData::SetLabel(const UInt_t idx, const TString str)
{
if (idx >= fLabels.size()) {
cerr << endl << ">> PNonMusrRawRunData::SetLabel: **WARNING** idx=" << idx << " is out of range [0," << fLabels.size() << "[.";
cerr << endl;
std::cerr << std::endl << ">> PNonMusrRawRunData::SetLabel: **WARNING** idx=" << idx << " is out of range [0," << fLabels.size() << "[.";
std::cerr << std::endl;
return;
}
fLabels[idx] = str;
@ -184,8 +183,8 @@ void PNonMusrRawRunData::SetLabel(const UInt_t idx, const TString str)
void PNonMusrRawRunData::AppendSubData(const UInt_t idx, const Double_t dval)
{
if (idx >= fData.size()) {
cerr << endl << ">> PNonMusrRawRunData::AppendSubData: **WARNING** idx=" << idx << " is out of range [0," << fData.size() << "[.";
cerr << endl;
std::cerr << std::endl << ">> PNonMusrRawRunData::AppendSubData: **WARNING** idx=" << idx << " is out of range [0," << fData.size() << "[.";
std::cerr << std::endl;
return;
}
fData[idx].push_back(dval);
@ -204,8 +203,8 @@ void PNonMusrRawRunData::AppendSubData(const UInt_t idx, const Double_t dval)
void PNonMusrRawRunData::AppendSubErrData(const UInt_t idx, const Double_t dval)
{
if (idx >= fErrData.size()) {
cerr << endl << ">> PNonMusrRawRunData::AppendSubErrData: **WARNING** idx=" << idx << " is out of range [0," << fErrData.size() << "[.";
cerr << endl;
std::cerr << std::endl << ">> PNonMusrRawRunData::AppendSubErrData: **WARNING** idx=" << idx << " is out of range [0," << fErrData.size() << "[.";
std::cerr << std::endl;
return;
}
fErrData[idx].push_back(dval);
@ -267,7 +266,7 @@ Bool_t PRawRunDataVector::IsPresent(UInt_t histoNo)
Bool_t found=false;
for (UInt_t i=0; i<fDataVec.size(); i++) {
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
if (fDataVec[i].GetHistoNo() == static_cast<Int_t>(histoNo)) {
found = true;
break;
}
@ -292,7 +291,7 @@ Bool_t PRawRunDataVector::IsPresent(UInt_t histoNo)
*/
PRawRunDataSet* PRawRunDataVector::GetSet(UInt_t idx)
{
PRawRunDataSet *result=0;
PRawRunDataSet *result = nullptr;
if (idx >= fDataVec.size())
return result;
@ -314,10 +313,10 @@ PRawRunDataSet* PRawRunDataVector::GetSet(UInt_t idx)
*/
PRawRunDataSet* PRawRunDataVector::Get(UInt_t histoNo)
{
PRawRunDataSet *result=0;
PRawRunDataSet *result = nullptr;
for (UInt_t i=0; i<fDataVec.size(); i++) {
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
if (fDataVec[i].GetHistoNo() == static_cast<Int_t>(histoNo)) {
result = &fDataVec[i];
break;
}
@ -357,10 +356,10 @@ PRawRunDataSet* PRawRunDataVector::operator[](UInt_t histoNo)
*/
PDoubleVector* PRawRunDataVector::GetData(UInt_t histoNo)
{
PDoubleVector *result=0;
PDoubleVector *result = nullptr;
for (UInt_t i=0; i<fDataVec.size(); i++) {
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
if (fDataVec[i].GetHistoNo() == static_cast<Int_t>(histoNo)) {
result = fDataVec[i].GetData();
break;
}
@ -386,7 +385,7 @@ Double_t PRawRunDataVector::GetT0Bin(UInt_t histoNo)
Double_t result=-1.0; // undefined
for (UInt_t i=0; i<fDataVec.size(); i++) {
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
if (fDataVec[i].GetHistoNo() == static_cast<Int_t>(histoNo)) {
result = fDataVec[i].GetTimeZeroBin();
break;
}
@ -412,7 +411,7 @@ Double_t PRawRunDataVector::GetT0BinEstimated(UInt_t histoNo)
Double_t result=PMUSR_UNDEFINED;
for (UInt_t i=0; i<fDataVec.size(); i++) {
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
if (fDataVec[i].GetHistoNo() == static_cast<Int_t>(histoNo)) {
result = fDataVec[i].GetTimeZeroBinEstimated();
break;
}
@ -438,7 +437,7 @@ PIntPair PRawRunDataVector::GetBkgBin(UInt_t histoNo)
PIntPair bkg(-1,-1);
for (UInt_t i=0; i<fDataVec.size(); i++) {
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
if (fDataVec[i].GetHistoNo() == static_cast<Int_t>(histoNo)) {
bkg.first = fDataVec[i].GetFirstBkgBin();
bkg.second = fDataVec[i].GetLastBkgBin();
break;
@ -465,7 +464,7 @@ PIntPair PRawRunDataVector::GetGoodDataBin(UInt_t histoNo)
PIntPair gdb(-1,-1);
for (UInt_t i=0; i<fDataVec.size(); i++) {
if (fDataVec[i].GetHistoNo() == (Int_t)histoNo) {
if (fDataVec[i].GetHistoNo() == static_cast<Int_t>(histoNo)) {
gdb.first = fDataVec[i].GetFirstGoodBin();
gdb.second = fDataVec[i].GetLastGoodBin();
break;
@ -491,7 +490,7 @@ void PRawRunDataVector::Set(PRawRunDataSet dataSet, Int_t idx)
if (idx == -1) { // data set to be appended
fDataVec.push_back(dataSet);
} else {
if (idx >= (Int_t)fDataVec.size())
if (idx >= static_cast<Int_t>(fDataVec.size()))
fDataVec.resize(idx+1);
fDataVec[idx] = dataSet;
}
@ -571,8 +570,8 @@ PRawRunData::~PRawRunData()
const Double_t PRawRunData::GetTemperature(const UInt_t idx)
{
if (idx >= fTemp.size()) {
cerr << endl << ">> PRawRunData::GetTemperature: **WARNING** idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
cerr << endl;
std::cerr << std::endl << ">> PRawRunData::GetTemperature: **WARNING** idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
std::cerr << std::endl;
return PMUSR_UNDEFINED;
}
return fTemp[idx].first;
@ -593,8 +592,8 @@ const Double_t PRawRunData::GetTemperature(const UInt_t idx)
const Double_t PRawRunData::GetTempError(const UInt_t idx)
{
if (idx >= fTemp.size()) {
cerr << endl << ">> PRawRunData::GetTempError: **WARNING** idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
cerr << endl;
std::cerr << std::endl << ">> PRawRunData::GetTempError: **WARNING** idx=" << idx << " is out of range [0," << fTemp.size() << "[.";
std::cerr << std::endl;
return PMUSR_UNDEFINED;
}
return fTemp[idx].second;
@ -615,8 +614,8 @@ const Double_t PRawRunData::GetTempError(const UInt_t idx)
const Double_t PRawRunData::GetRingAnode(const UInt_t idx)
{
if (idx >= fRingAnode.size()) {
cerr << endl << ">> PRawRunData::GetRingAnode: **WARNING** idx=" << idx << " is out of range [0," << fRingAnode.size() << "[.";
cerr << endl;
std::cerr << std::endl << ">> PRawRunData::GetRingAnode: **WARNING** idx=" << idx << " is out of range [0," << fRingAnode.size() << "[.";
std::cerr << std::endl;
return PMUSR_UNDEFINED;
}
return fRingAnode[idx];
@ -790,8 +789,8 @@ void PMsrGlobalBlock::SetRRFFreq(Double_t freq, const char *unit)
else if (!unitStr.CompareTo("T", TString::kIgnoreCase))
unitTag = RRF_UNIT_T;
else {
cerr << endl << ">> PMsrGlobalBlock::SetRRFFreq: **ERROR** found undefined RRF unit '" << unit << "'!";
cerr << endl << ">> Will set RRF frequency to 0.0." << endl;
std::cerr << std::endl << ">> PMsrGlobalBlock::SetRRFFreq: **ERROR** found undefined RRF unit '" << unit << "'!";
std::cerr << std::endl << ">> Will set RRF frequency to 0.0." << std::endl;
fRRFFreq = 0.0;
fRRFUnitTag = RRF_UNIT_UNDEF;
}
@ -848,7 +847,7 @@ TString PMsrGlobalBlock::GetRRFUnit()
void PMsrGlobalBlock::SetRRFPacking(Int_t pack)
{
if (pack <= 0) {
cerr << endl << "PMsrGlobalBlock::SetRRFPacking: **WARNING** found RRF packing <= 0. Likely doesn't make any sense." << endl;
std::cerr << std::endl << "PMsrGlobalBlock::SetRRFPacking: **WARNING** found RRF packing <= 0. Likely doesn't make any sense." << std::endl;
fRRFPacking = -1; // set to undefined
}
@ -887,8 +886,8 @@ Int_t PMsrGlobalBlock::GetDataRange(UInt_t idx)
void PMsrGlobalBlock::SetDataRange(Int_t ival, Int_t idx)
{
if (idx >= 4) {
cerr << endl << ">> PMsrGlobalBlock::SetDataRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
cerr << endl;
std::cerr << std::endl << ">> PMsrGlobalBlock::SetDataRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
std::cerr << std::endl;
return;
}
@ -1207,7 +1206,7 @@ void PMsrRunBlock::CleanUp()
TString* PMsrRunBlock::GetRunName(UInt_t idx)
{
if (idx>fRunName.size())
return 0;
return nullptr;
return &fRunName[idx];
}
@ -1249,7 +1248,7 @@ void PMsrRunBlock::SetRunName(TString &str, Int_t idx)
TString* PMsrRunBlock::GetBeamline(UInt_t idx)
{
if (idx>fBeamline.size())
return 0;
return nullptr;
return &fBeamline[idx];
}
@ -1291,7 +1290,7 @@ void PMsrRunBlock::SetBeamline(TString &str, Int_t idx)
TString* PMsrRunBlock::GetInstitute(UInt_t idx)
{
if (idx>fInstitute.size())
return 0;
return nullptr;
return &fInstitute[idx];
}
@ -1333,7 +1332,7 @@ void PMsrRunBlock::SetInstitute(TString &str, Int_t idx)
TString* PMsrRunBlock::GetFileFormat(UInt_t idx)
{
if (idx>fFileFormat.size())
return 0;
return nullptr;
return &fFileFormat[idx];
}
@ -1524,8 +1523,8 @@ Double_t PMsrRunBlock::GetBkgEstimated(UInt_t idx)
void PMsrRunBlock::SetBkgEstimated(Double_t dval, Int_t idx)
{
if (idx >= 2) {
cerr << endl << ">> PMsrRunBlock::SetBkgEstimated: **WARNING** idx=" << idx << ", only idx=0,1 are sensible.";
cerr << endl;
std::cerr << std::endl << ">> PMsrRunBlock::SetBkgEstimated: **WARNING** idx=" << idx << ", only idx=0,1 are sensible.";
std::cerr << std::endl;
return;
}
@ -1564,8 +1563,8 @@ Double_t PMsrRunBlock::GetBkgFix(UInt_t idx)
void PMsrRunBlock::SetBkgFix(Double_t dval, Int_t idx)
{
if (idx >= 2) {
cerr << endl << ">> PMsrRunBlock::SetBkgFix: **WARNING** idx=" << idx << ", only idx=0,1 are sensible.";
cerr << endl;
std::cerr << std::endl << ">> PMsrRunBlock::SetBkgFix: **WARNING** idx=" << idx << ", only idx=0,1 are sensible.";
std::cerr << std::endl;
return;
}
@ -1605,8 +1604,8 @@ Int_t PMsrRunBlock::GetBkgRange(UInt_t idx)
void PMsrRunBlock::SetBkgRange(Int_t ival, Int_t idx)
{
if (idx >= 4) {
cerr << endl << ">> PMsrRunBlock::SetBkgRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
cerr << endl;
std::cerr << std::endl << ">> PMsrRunBlock::SetBkgRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
std::cerr << std::endl;
return;
}
@ -1647,8 +1646,8 @@ Int_t PMsrRunBlock::GetDataRange(UInt_t idx)
void PMsrRunBlock::SetDataRange(Int_t ival, Int_t idx)
{
if (idx >= 4) {
cerr << endl << ">> PMsrRunBlock::SetDataRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
cerr << endl;
std::cerr << std::endl << ">> PMsrRunBlock::SetDataRange: **WARNING** idx=" << idx << ", only idx=0..3 are sensible.";
std::cerr << std::endl;
return;
}
@ -1897,10 +1896,10 @@ void PMsrRunBlock::SetMapGlobal(UInt_t idx, Int_t ival)
*
* @return true if parse has been successful, otherwise false
*/
bool PStringNumberList::Parse(string &errorMsg, bool ignoreFirstToken)
bool PStringNumberList::Parse(std::string &errorMsg, bool ignoreFirstToken)
{
bool result=true;
vector<string> splitVec;
std::vector<std::string> splitVec;
int ival;
// before checking tokens, remove 'forbidden' " - " and " : "
@ -1915,8 +1914,8 @@ bool PStringNumberList::Parse(string &errorMsg, bool ignoreFirstToken)
for (unsigned int i=start; i<splitVec.size(); i++) {
if (splitVec[i].length() != 0) { // ignore empty tokens
if (splitVec[i].find("-") != string::npos) { // check for potential range
vector<string> subSplitVec;
if (splitVec[i].find("-") != std::string::npos) { // check for potential range
std::vector<std::string> subSplitVec;
// split potential nS-nE token
split(subSplitVec, splitVec[i], is_any_of("-"), token_compress_on);
@ -1944,15 +1943,15 @@ bool PStringNumberList::Parse(string &errorMsg, bool ignoreFirstToken)
if (result) { // no error, hence check start and end
if (start > end) {
int swap = end;
cerr << "**WARNING** start=" << start << " > end=" << end << ", hence I will swap them" << endl;
std::cerr << "**WARNING** start=" << start << " > end=" << end << ", hence I will swap them" << std::endl;
end = start;
start = swap;
}
for (int j=start; j<=end; j++)
fList.push_back(j);
}
} else if (splitVec[i].find(":") != string::npos) { // check for potential sequence
vector<string> subSplitVec;
} else if (splitVec[i].find(":") != std::string::npos) { // check for potential sequence
std::vector<std::string> subSplitVec;
// split potential rStart:rEnd:rStep token
split(subSplitVec, splitVec[i], is_any_of(":"), token_compress_on);
@ -1982,7 +1981,7 @@ bool PStringNumberList::Parse(string &errorMsg, bool ignoreFirstToken)
if (result) { // no error, hence check start and end
if (start > end) {
int swap = end;
cerr << "**WARNING** start=" << start << " > end=" << end << ", hence I will swap them" << endl;
std::cerr << "**WARNING** start=" << start << " > end=" << end << ", hence I will swap them" << std::endl;
end = start;
start = swap;
}
@ -2011,7 +2010,7 @@ bool PStringNumberList::Parse(string &errorMsg, bool ignoreFirstToken)
*/
void PStringNumberList::StripSpaces()
{
string str=fString;
std::string str=fString;
int pos=-1;
// backward scan

File diff suppressed because it is too large Load Diff

View File

@ -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 *
@ -29,7 +29,6 @@
#include <iostream>
#include <fstream>
using namespace std;
#include <TColor.h>
#include <TRandom.h>
@ -106,7 +105,7 @@ void PMusrT0Data::InitData()
PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx)
{
if ((idx < 0) || (idx >= static_cast<Int_t>(fRawRunData.size())))
return 0;
return nullptr;
return fRawRunData[idx];
}
@ -246,19 +245,19 @@ ClassImpQ(PMusrT0)
PMusrT0::PMusrT0()
{
fTimeout = 0;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
fValid = false;
fStatus = 0; // default is quit locally
fMainCanvas = 0;
fMainCanvas = nullptr;
fHisto = 0;
fData = 0;
fBkg = 0;
fHisto = nullptr;
fData = nullptr;
fBkg = nullptr;
fToDoInfo = 0;
fToDoInfo = nullptr;
fDataAndBkgEnabled = false;
fT0Enabled = false;
@ -269,12 +268,12 @@ PMusrT0::PMusrT0()
fBkgRange[0] = 0;
fBkgRange[1] = 0;
fT0Line = 0;
fT0DataLine = 0;
fFirstBkgLine = 0;
fLastBkgLine = 0;
fFirstDataLine = 0;
fLastDataLine = 0;
fT0Line = nullptr;
fT0DataLine = nullptr;
fFirstBkgLine = nullptr;
fLastBkgLine = nullptr;
fFirstDataLine = nullptr;
fLastDataLine = nullptr;
}
//--------------------------------------------------------------------------
@ -288,19 +287,19 @@ PMusrT0::PMusrT0()
PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
{
fTimeout = 0;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
fValid = true;
fStatus = 0; // default is quit locally
fMainCanvas = 0;
fMainCanvas = nullptr;
fHisto = 0;
fData = 0;
fBkg = 0;
fHisto = nullptr;
fData = nullptr;
fBkg = nullptr;
fToDoInfo = 0;
fToDoInfo = nullptr;
fDataAndBkgEnabled = false;
fT0Enabled = false;
@ -311,12 +310,12 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
fBkgRange[0] = 0;
fBkgRange[1] = 0;
fT0Line = 0;
fT0DataLine = 0;
fFirstBkgLine = 0;
fLastBkgLine = 0;
fFirstDataLine = 0;
fLastDataLine = 0;
fT0Line = nullptr;
fT0DataLine = nullptr;
fFirstBkgLine = nullptr;
fLastBkgLine = nullptr;
fFirstDataLine = nullptr;
fLastDataLine = nullptr;
// feed necessary objects
TString str;
@ -334,14 +333,14 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
// feed raw data histo
PRawRunData *rawRunData = fMusrT0Data.GetRawRunData(fMusrT0Data.GetAddRunIdx());
if (rawRunData == 0) {
if (rawRunData == nullptr) {
fValid = false;
return;
}
Int_t histoNo = fMusrT0Data.GetHistoNo(fMusrT0Data.GetHistoNoIdx());
if (!rawRunData->IsPresent(histoNo)) {
cerr << endl << ">> PMusrT0::PMusrT0: **ERROR** found histogram number " << histoNo+1 << " which is NOT present in the data file.";
cerr << endl << ">> Please try to fix this first ..." << endl;
std::cerr << std::endl << ">> PMusrT0::PMusrT0: **ERROR** found histogram number " << histoNo+1 << " which is NOT present in the data file.";
std::cerr << std::endl << ">> Please try to fix this first ..." << std::endl;
fValid = false;
return;
}
@ -373,7 +372,7 @@ PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
// feed raw data histo
PRawRunData *rawRunData = fMusrT0Data.GetRawRunData(0);
if (rawRunData == 0) {
if (rawRunData == nullptr) {
fValid = false;
return;
}
@ -574,51 +573,51 @@ PMusrT0::~PMusrT0()
{
if (fTimeoutTimer) {
delete fTimeoutTimer;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
}
if (fHisto) {
delete fHisto;
fHisto = 0;
fHisto = nullptr;
}
if (fData) {
delete fData;
fData = 0;
fData = nullptr;
}
if (fBkg) {
delete fBkg;
fBkg = 0;
fBkg = nullptr;
}
if (fToDoInfo) {
delete fToDoInfo;
fToDoInfo = 0;
fToDoInfo = nullptr;
}
if (fT0Line) {
delete fT0Line;
fT0Line = 0;
fT0Line = nullptr;
}
if (fT0DataLine) {
delete fT0DataLine;
fT0DataLine = 0;
fT0DataLine = nullptr;
}
if (fFirstBkgLine) {
delete fFirstBkgLine;
fFirstBkgLine = 0;
fFirstBkgLine = nullptr;
}
if (fLastBkgLine) {
delete fLastBkgLine;
fLastBkgLine = 0;
fLastBkgLine = nullptr;
}
if (fFirstDataLine) {
delete fFirstDataLine;
fFirstDataLine = 0;
fFirstDataLine = nullptr;
}
if (fLastDataLine) {
delete fLastDataLine;
fLastDataLine = 0;
fLastDataLine = nullptr;
}
if (fMainCanvas && (fStatus != 2)) {
delete fMainCanvas;
fMainCanvas = 0;
fMainCanvas = nullptr;
}
}
@ -727,7 +726,7 @@ void PMusrT0::SetTimeout(Int_t timeout)
if (fTimeoutTimer) {
delete fTimeoutTimer;
fTimeoutTimer = 0;
fTimeoutTimer = nullptr;
}
fTimeoutTimer = new TTimer();
@ -858,26 +857,26 @@ void PMusrT0::InitDataAndBkg()
Double_t max = fHisto->GetMaximum();
// data lines
fFirstDataLine = new TLine((Double_t)fDataRange[0], 0.0, (Double_t)fDataRange[0], max);
fFirstDataLine = new TLine(static_cast<Double_t>(fDataRange[0]), 0.0, static_cast<Double_t>(fDataRange[0]), max);
fFirstDataLine->SetLineStyle(3); // doted
fFirstDataLine->SetLineColor(TColor::GetColor(0,0,255)); // blue
fFirstDataLine->SetLineWidth(2);
fFirstDataLine->Draw();
fLastDataLine = new TLine((Double_t)fDataRange[1], 0.0, (Double_t)fDataRange[1], max);
fLastDataLine = new TLine(static_cast<Double_t>(fDataRange[1]), 0.0, static_cast<Double_t>(fDataRange[1]), max);
fLastDataLine->SetLineStyle(3); // doted
fLastDataLine->SetLineColor(TColor::GetColor(0,0,255)); // blue
fLastDataLine->SetLineWidth(2);
fLastDataLine->Draw();
// bkg lines
fFirstBkgLine = new TLine((Double_t)fBkgRange[0], 0.0, (Double_t)fBkgRange[0], max);
fFirstBkgLine = new TLine(static_cast<Double_t>(fBkgRange[0]), 0.0, static_cast<Double_t>(fBkgRange[0]), max);
fFirstBkgLine->SetLineStyle(6); // _..._...
fFirstBkgLine->SetLineColor(TColor::GetColor(255,0,0)); // red
fFirstBkgLine->SetLineWidth(2);
fFirstBkgLine->Draw();
fLastBkgLine = new TLine((Double_t)fBkgRange[1], 0.0, (Double_t)fBkgRange[1], max);
fLastBkgLine = new TLine(static_cast<Double_t>(fBkgRange[1]), 0.0, static_cast<Double_t>(fBkgRange[1]), max);
fLastBkgLine->SetLineStyle(6); // _..._...
fLastBkgLine->SetLineColor(TColor::GetColor(255,0,0)); // red
fLastBkgLine->SetLineWidth(2);
@ -899,7 +898,7 @@ void PMusrT0::ShowDataFileT0Channel()
Double_t max = fHisto->GetMaximum();
if (!fT0DataLine) {
fT0DataLine = new TLine((Double_t)t0Bin, 0.0, (Double_t)t0Bin, max);
fT0DataLine = new TLine(static_cast<Double_t>(t0Bin), 0.0, static_cast<Double_t>(t0Bin), max);
fT0DataLine->SetLineStyle(1); // solid
fT0DataLine->SetLineColor(kOrange-3);
fT0DataLine->SetLineWidth(2);
@ -919,7 +918,7 @@ void PMusrT0::HideDataFileT0Channel()
{
if (fT0DataLine) {
delete fT0DataLine;
fT0DataLine = 0;
fT0DataLine = nullptr;
}
fMainCanvas->Update();
}
@ -941,7 +940,7 @@ void PMusrT0::SetT0Channel()
// get binx to set t0 corresponding to fPx
Int_t binx = fHisto->GetXaxis()->FindFixBin(x) - 1;
cout << endl << ">> PMusrT0::SetT0Channel(): t0 = " << binx << endl;
std::cout << std::endl << ">> PMusrT0::SetT0Channel(): t0 = " << binx << std::endl;
// set t0 bin in msr-Handler
UInt_t idx;
@ -998,7 +997,7 @@ void PMusrT0::SetEstimatedT0Channel()
Double_t x = fHisto->GetXaxis()->GetBinCenter(fT0Estimated)+1.0; // +1.0 needed since the first bin == 1 not 0.
cout << endl << ">> PMusrT0::SetEstimatedT0Channel(): estimated t0 = " << fT0Estimated << endl;
std::cout << std::endl << ">> PMusrT0::SetEstimatedT0Channel(): estimated t0 = " << fT0Estimated << std::endl;
// shift line to the proper position
fT0Line->SetX1(x);
@ -1025,7 +1024,7 @@ void PMusrT0::SetDataFirstChannel()
// get binx to set the data first channel corresponding to fPx
fDataRange[0] = fHisto->GetXaxis()->FindFixBin(x) - 1;
cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRange[0] << endl;
std::cout << std::endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRange[0] << std::endl;
// set the data first bin in msr-Handler
UInt_t idx = 0;
@ -1039,7 +1038,7 @@ void PMusrT0::SetDataFirstChannel()
// recreate data histo
delete fData;
fData = 0;
fData = nullptr;
// refill data histo
Int_t noOfBins = fDataRange[1]-fDataRange[0]+1;
@ -1075,7 +1074,7 @@ void PMusrT0::SetDataLastChannel()
// get binx to set the data last channel corresponding to fPx
fDataRange[1] = fHisto->GetXaxis()->FindFixBin(x) - 1;
cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRange[1] << endl;
std::cout << std::endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRange[1] << std::endl;
// set the data first bin in msr-Handler
UInt_t idx = 1;
@ -1089,7 +1088,7 @@ void PMusrT0::SetDataLastChannel()
// recreate data histo
delete fData;
fData = 0;
fData = nullptr;
// refill data histo
Int_t noOfBins = fDataRange[1]-fDataRange[0]+1;
@ -1125,7 +1124,7 @@ void PMusrT0::SetBkgFirstChannel()
// get binx to set the background first channel corresponding to fPx
fBkgRange[0] = fHisto->GetXaxis()->FindFixBin(x) - 1;
cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange[0] << endl;
std::cout << std::endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange[0] << std::endl;
// set the background first bin in msr-Handler
UInt_t idx = 0;
@ -1139,7 +1138,7 @@ void PMusrT0::SetBkgFirstChannel()
// recreate data histo
delete fBkg;
fBkg = 0;
fBkg = nullptr;
// refill data histo
Int_t noOfBins = fBkgRange[1]-fBkgRange[0]+1;
@ -1175,7 +1174,7 @@ void PMusrT0::SetBkgLastChannel()
// get binx to set the background last channel corresponding to fPx
fBkgRange[1] = fHisto->GetXaxis()->FindFixBin(x) - 1;
cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[1] << endl;
std::cout << std::endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[1] << std::endl;
// set the background first bin in msr-Handler
UInt_t idx = 1;
@ -1189,7 +1188,7 @@ void PMusrT0::SetBkgLastChannel()
// recreate data histo
delete fBkg;
fBkg = 0;
fBkg = nullptr;
// refill data histo
Int_t noOfBins = fBkgRange[1]-fBkgRange[0]+1;

View File

@ -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 *
@ -111,7 +111,7 @@ void PPrepFourier::SetBkgRange(const Int_t *bkgRange)
}
if (err != 0) {
cerr << endl << ">> PPrepFourier::SetBkgRange: **WARNING** " << errMsg << endl;
std::cerr << std::endl << ">> PPrepFourier::SetBkgRange: **WARNING** " << errMsg << std::endl;
}
}
@ -142,7 +142,7 @@ void PPrepFourier::SetPacking(const Int_t packing)
if (packing > 0) {
fPacking = packing;
} else {
cerr << endl << ">> PPrepFourier::SetPacking: **WARNING** found packing=" << packing << " < 0, will ignore it." << endl;
std::cerr << std::endl << ">> PPrepFourier::SetPacking: **WARNING** found packing=" << packing << " < 0, will ignore it." << std::endl;
}
}
@ -181,8 +181,8 @@ void PPrepFourier::DoBkgCorrection()
if ((fBkgRange[0] != -1) && (fBkgRange[1] != -1)) { // background range is given
// make sure that the bkg range is ok
for (UInt_t i=0; i<fRawData.size(); i++) {
if ((fBkgRange[0] >= (Int_t)fRawData[i].rawData.size()) || (fBkgRange[1] >= (Int_t)fRawData[i].rawData.size())) {
cerr << endl << "PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!";
if ((fBkgRange[0] >= static_cast<Int_t>(fRawData[i].rawData.size())) || (fBkgRange[1] >= static_cast<Int_t>(fRawData[i].rawData.size()))) {
std::cerr << std::endl << "PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!";
return;
}
}
@ -194,7 +194,7 @@ void PPrepFourier::DoBkgCorrection()
bkg += fRawData[i].rawData[j];
}
bkg /= (fBkgRange[1]-fBkgRange[0]+1);
cout << "info> background " << i << ": " << bkg << endl;
std::cout << "info> background " << i << ": " << bkg << std::endl;
// correct data
for (UInt_t j=0; j<fData[i].size(); j++)
@ -207,7 +207,7 @@ void PPrepFourier::DoBkgCorrection()
// check if there are as many background values than data values
if (fBkg.size() != fData.size()) {
cerr << endl << "PPrepFourier::DoBkgCorrection() **ERROR** #bkg values != #histos. Will do nothing here." << endl;
std::cerr << std::endl << "PPrepFourier::DoBkgCorrection() **ERROR** #bkg values != #histos. Will do nothing here." << std::endl;
return;
}
@ -338,9 +338,9 @@ Int_t PPrepFourier::GetDataSetTag(const UInt_t idx)
* <p>Creates the requested TH1F objects and returns them. The ownership is with
* the caller.
*/
vector<TH1F*> PPrepFourier::GetData()
std::vector<TH1F*> PPrepFourier::GetData()
{
vector<TH1F*> data;
std::vector<TH1F*> data;
data.resize(fData.size());
// if not data are present, just return an empty vector
@ -368,12 +368,12 @@ vector<TH1F*> PPrepFourier::GetData()
// time range given, hence calculate the proper size
if (start != -1.0) {
size = (UInt_t)((end-start)/dt);
size = static_cast<UInt_t>((end-start)/dt);
if (start >= 0.0) {
startIdx = (UInt_t)(start/dt)+1;
endIdx = (UInt_t)(end/dt)+1;
startIdx = static_cast<UInt_t>(start/dt)+1;
endIdx = static_cast<UInt_t>(end/dt)+1;
} else {
cerr << endl << ">> PPrepFourier::GetData **WARNING** found start time < 0.0, will set it to 0.0" << endl;
std::cerr << std::endl << ">> PPrepFourier::GetData **WARNING** found start time < 0.0, will set it to 0.0" << std::endl;
endIdx = static_cast<UInt_t>(end/dt)+1;
}
}
@ -410,10 +410,10 @@ vector<TH1F*> PPrepFourier::GetData()
TH1F *PPrepFourier::GetData(const UInt_t idx)
{
if (fData.size() == 0) // no data present
return 0;
return nullptr;
if (idx > fData.size()) // requested index out of range
return 0;
return nullptr;
TString name = TString::Format("histo%2d", idx);
Double_t dt = fRawData[idx].timeResolution*fPacking;
@ -425,13 +425,13 @@ TH1F *PPrepFourier::GetData(const UInt_t idx)
// time range given, hence calculate the proper size
if (start != -1.0) {
size = (UInt_t)((end-start)/dt);
size = static_cast<UInt_t>((end-start)/dt);
if (start >= 0.0) {
startIdx = (UInt_t)(start/dt)+1;
endIdx = (UInt_t)(end/dt)+1;
startIdx = static_cast<UInt_t>(start/dt)+1;
endIdx = static_cast<UInt_t>(end/dt)+1;
} else {
cerr << endl << ">> PPrepFourier::GetData **WARNING** found start time < 0.0, will set it to 0.0" << endl;
endIdx = (UInt_t)(end/dt)+1;
std::cerr << std::endl << ">> PPrepFourier::GetData **WARNING** found start time < 0.0, will set it to 0.0" << std::endl;
endIdx = static_cast<UInt_t>(end/dt)+1;
}
}

View File

@ -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 *
@ -47,8 +47,8 @@
PRunBase::PRunBase()
{
fRunNo = -1;
fRunInfo = 0;
fRawData = 0;
fRunInfo = nullptr;
fRawData = nullptr;
fTimeResolution = -1.0;
fFitStartTime = PMUSR_UNDEFINED;
@ -76,7 +76,7 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo,
fRunNo = static_cast<Int_t>(runNo);
if (runNo > fMsrInfo->GetMsrRunList()->size()) {
fRunInfo = 0;
fRunInfo = nullptr;
return;
}
@ -84,8 +84,8 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo,
fRunInfo = &(*fMsrInfo->GetMsrRunList())[runNo];
// check the parameter and map range of the functions
if (!fMsrInfo->CheckMapAndParamRange(fRunInfo->GetMap()->size(), fMsrInfo->GetNoOfParams())) {
cerr << endl << "**SEVERE ERROR** PRunBase::PRunBase: map and/or parameter out of range in FUNCTIONS." << endl;
if (!fMsrInfo->CheckMapAndParamRange(static_cast<UInt_t>(fRunInfo->GetMap()->size()), fMsrInfo->GetNoOfParams())) {
std::cerr << std::endl << "**SEVERE ERROR** PRunBase::PRunBase: map and/or parameter out of range in FUNCTIONS." << std::endl;
exit(0);
}
@ -96,12 +96,12 @@ PRunBase::PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo,
// generate theory
fTheory = new PTheory(fMsrInfo, runNo);
if (fTheory == 0) {
cerr << endl << "**SEVERE ERROR** PRunBase::PRunBase: Couldn't create an instance of PTheory :-(, will quit" << endl;
if (fTheory == nullptr) {
std::cerr << std::endl << "**SEVERE ERROR** PRunBase::PRunBase: Couldn't create an instance of PTheory :-(, will quit" << std::endl;
exit(0);
}
if (!fTheory->IsValid()) {
cerr << endl << "**SEVERE ERROR** PRunBase::PRunBase: Theory is not valid :-(, will quit" << endl;
std::cerr << std::endl << "**SEVERE ERROR** PRunBase::PRunBase: Theory is not valid :-(, will quit" << std::endl;
exit(0);
}
@ -146,20 +146,21 @@ void PRunBase::SetFitRange(PDoublePairVector fitRange)
end = fitRange[0].second;
} else {
// check that fRunNo is found within fitRange
if (fRunNo < static_cast<Int_t>(fitRange.size())) { // fRunNo present
start = fitRange[fRunNo].first;
end = fitRange[fRunNo].second;
UInt_t idx=static_cast<UInt_t>(fRunNo);
if (idx < fitRange.size()) { // fRunNo present
start = fitRange[idx].first;
end = fitRange[idx].second;
} else { // fRunNo NOT present
cerr << endl << ">> PRunBase::SetFitRange(): **ERROR** msr-file run entry " << fRunNo << " not present in fit range vector.";
cerr << endl << ">> Will not do anything! Please check, this shouldn't happen." << endl;
std::cerr << std::endl << ">> PRunBase::SetFitRange(): **ERROR** msr-file run entry " << fRunNo << " not present in fit range vector.";
std::cerr << std::endl << ">> Will not do anything! Please check, this shouldn't happen." << std::endl;
return;
}
}
// check that start is before end
if (start > end) {
cerr << endl << ">> PRunBase::SetFitRange(): **WARNING** start=" << start << " is > as end=" << end;
cerr << endl << ">> Will swap them, since otherwise chisq/logLH == 0.0" << endl;
std::cerr << std::endl << ">> PRunBase::SetFitRange(): **WARNING** start=" << start << " is > as end=" << end;
std::cerr << std::endl << ">> Will swap them, since otherwise chisq/logLH == 0.0" << std::endl;
fFitStartTime = end;
fFitEndTime = start;
} else {
@ -178,7 +179,7 @@ void PRunBase::CleanUp()
{
if (fTheory) {
delete fTheory;
fTheory = 0;
fTheory = nullptr;
}
}
@ -199,7 +200,7 @@ void PRunBase::CalculateKaiserFilterCoeff(Double_t wc, Double_t A, Double_t dw)
{
Double_t beta;
Double_t dt = fData.GetTheoryTimeStep();
UInt_t m;
Int_t m;
// estimate beta (see reference above, p.574ff)
if (A > 50.0) {
@ -218,13 +219,13 @@ void PRunBase::CalculateKaiserFilterCoeff(Double_t wc, Double_t A, Double_t dw)
Double_t alpha = static_cast<Double_t>(m)/2.0;
Double_t dval;
Double_t dsum = 0.0;
for (UInt_t i=0; i<=m; i++) {
for (Int_t i=0; i<=m; i++) {
dval = TMath::Sin(wc*(i-alpha)*dt)/(TMath::Pi()*(i-alpha)*dt);
dval *= TMath::BesselI0(beta*TMath::Sqrt(1.0-TMath::Power((i-alpha)*dt/alpha, 2.0)))/TMath::BesselI0(beta);
dsum += dval;
fKaiserFilter.push_back(dval);
}
for (UInt_t i=0; i<=m; i++) {
for (UInt_t i=0; i<=static_cast<UInt_t>(m); i++) {
fKaiserFilter[i] /= dsum;
}
}

View File

@ -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 *
@ -350,7 +350,7 @@ Double_t PRunListCollection::GetSingleHistoChisqExpected(const std::vector<Doubl
Double_t expectedChisq = 0.0;
if (idx > fMsrInfo->GetMsrRunList()->size()) {
cerr << ">> PRunListCollection::GetSingleHistoChisqExpected() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << endl << endl;
std::cerr << ">> PRunListCollection::GetSingleHistoChisqExpected() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << std::endl << std::endl;
return expectedChisq;
}
@ -410,7 +410,7 @@ Double_t PRunListCollection::GetSingleRunChisq(const std::vector<Double_t>& par,
Double_t chisq = 0.0;
if (idx > fMsrInfo->GetMsrRunList()->size()) {
cerr << ">> PRunListCollection::GetSingleRunChisq() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << endl << endl;
std::cerr << ">> PRunListCollection::GetSingleRunChisq() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << std::endl << std::endl;
return chisq;
}
@ -600,7 +600,7 @@ Double_t PRunListCollection::GetSingleHistoMaximumLikelihoodExpected(const std::
Double_t expected_mlh = 0.0;
if (idx > fMsrInfo->GetMsrRunList()->size()) {
cerr << ">> PRunListCollection::GetSingleHistoMaximumLikelihoodExpected() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << endl << endl;
std::cerr << ">> PRunListCollection::GetSingleHistoMaximumLikelihoodExpected() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << std::endl << std::endl;
return expected_mlh;
}
@ -645,7 +645,7 @@ Double_t PRunListCollection::GetSingleRunMaximumLikelihood(const std::vector<Dou
Double_t mlh = 0.0;
if (idx > fMsrInfo->GetMsrRunList()->size()) {
cerr << ">> PRunListCollection::GetSingleRunMaximumLikelihood() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << endl << endl;
std::cerr << ">> PRunListCollection::GetSingleRunMaximumLikelihood() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << std::endl << std::endl;
return mlh;
}
@ -691,7 +691,7 @@ UInt_t PRunListCollection::GetNoOfBinsFitted(const UInt_t idx) const
UInt_t result = 0;
if (idx > fMsrInfo->GetMsrRunList()->size()) {
cerr << ">> PRunListCollection::GetNoOfBinsFitted() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << endl << endl;
std::cerr << ">> PRunListCollection::GetNoOfBinsFitted() **ERROR** idx=" << idx << " is out of range [0.." << fMsrInfo->GetMsrRunList()->size() << "[" << std::endl << std::endl;
return result;
}
@ -784,14 +784,14 @@ UInt_t PRunListCollection::GetTotalNoOfBinsFitted() const
*/
PRunData* PRunListCollection::GetSingleHisto(UInt_t index, EDataSwitch tag)
{
PRunData *data = 0;
PRunData *data = nullptr;
switch (tag) {
case kIndex:
if (index >= fRunSingleHistoList.size()) {
cerr << endl << ">> PRunListCollection::GetSingleHisto(): **ERROR** index = " << index << " out of bounds";
cerr << endl;
return 0;
std::cerr << std::endl << ">> PRunListCollection::GetSingleHisto(): **ERROR** index = " << index << " out of bounds";
std::cerr << std::endl;
return nullptr;
}
fRunSingleHistoList[index]->CalcTheory();
@ -827,14 +827,14 @@ PRunData* PRunListCollection::GetSingleHisto(UInt_t index, EDataSwitch tag)
*/
PRunData* PRunListCollection::GetSingleHistoRRF(UInt_t index, EDataSwitch tag)
{
PRunData *data = 0;
PRunData *data = nullptr;
switch (tag) {
case kIndex:
if (index >= fRunSingleHistoRRFList.size()) {
cerr << endl << ">> PRunListCollection::GetSingleHistoRRF(): **ERROR** index = " << index << " out of bounds";
cerr << endl;
return 0;
std::cerr << std::endl << ">> PRunListCollection::GetSingleHistoRRF(): **ERROR** index = " << index << " out of bounds";
std::cerr << std::endl;
return nullptr;
}
fRunSingleHistoRRFList[index]->CalcTheory();
@ -870,14 +870,14 @@ PRunData* PRunListCollection::GetSingleHistoRRF(UInt_t index, EDataSwitch tag)
*/
PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
{
PRunData *data = 0;
PRunData *data = nullptr;
switch (tag) {
case kIndex: // called from musrfit when dumping the data
if (index > fRunAsymmetryList.size()) {
cerr << endl << ">> PRunListCollection::GetAsymmetry(): **ERROR** index = " << index << " out of bounds";
cerr << endl;
return 0;
std::cerr << std::endl << ">> PRunListCollection::GetAsymmetry(): **ERROR** index = " << index << " out of bounds";
std::cerr << std::endl;
return nullptr;
}
fRunAsymmetryList[index]->CalcTheory();
@ -913,14 +913,14 @@ PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
*/
PRunData* PRunListCollection::GetAsymmetryRRF(UInt_t index, EDataSwitch tag)
{
PRunData *data = 0;
PRunData *data = nullptr;
switch (tag) {
case kIndex: // called from musrfit when dumping the data
if (index > fRunAsymmetryRRFList.size()) {
cerr << endl << ">> PRunListCollection::GetAsymmetryRRF(): **ERROR** index = " << index << " out of bounds";
cerr << endl;
return 0;
std::cerr << std::endl << ">> PRunListCollection::GetAsymmetryRRF(): **ERROR** index = " << index << " out of bounds";
std::cerr << std::endl;
return nullptr;
}
fRunAsymmetryRRFList[index]->CalcTheory();
@ -956,14 +956,14 @@ PRunData* PRunListCollection::GetAsymmetryRRF(UInt_t index, EDataSwitch tag)
*/
PRunData* PRunListCollection::GetMuMinus(UInt_t index, EDataSwitch tag)
{
PRunData *data = 0;
PRunData *data = nullptr;
switch (tag) {
case kIndex:
if (index > fRunMuMinusList.size()) {
cerr << endl << ">> PRunListCollection::GetMuMinus(): **ERROR** index = " << index << " out of bounds";
cerr << endl;
return 0;
std::cerr << std::endl << ">> PRunListCollection::GetMuMinus(): **ERROR** index = " << index << " out of bounds";
std::cerr << std::endl;
return nullptr;
}
fRunMuMinusList[index]->CalcTheory();
data = fRunMuMinusList[index]->GetData();
@ -998,14 +998,14 @@ PRunData* PRunListCollection::GetMuMinus(UInt_t index, EDataSwitch tag)
*/
PRunData* PRunListCollection::GetNonMusr(UInt_t index, EDataSwitch tag)
{
PRunData *data = 0;
PRunData *data = nullptr;
switch (tag) {
case kIndex:
if (index > fRunNonMusrList.size()) {
cerr << endl << ">> PRunListCollection::GetNonMusr(): **ERROR** index = " << index << " out of bounds";
cerr << endl;
return 0;
std::cerr << std::endl << ">> PRunListCollection::GetNonMusr(): **ERROR** index = " << index << " out of bounds";
std::cerr << std::endl;
return nullptr;
}
break;
case kRunNo:
@ -1103,7 +1103,7 @@ const Char_t* PRunListCollection::GetXAxisTitle(const TString &runName, const UI
{
PRawRunData *runData = fData->GetRunData(runName);
const Char_t *result = 0;
const Char_t *result = nullptr;
if (runData->fDataNonMusr.FromAscii()) {
result = runData->fDataNonMusr.GetLabels()->at(0).Data();
@ -1136,7 +1136,7 @@ const Char_t* PRunListCollection::GetYAxisTitle(const TString &runName, const UI
{
PRawRunData *runData = fData->GetRunData(runName);
const Char_t *result = 0;
const Char_t *result = nullptr;
if (runData->fDataNonMusr.FromAscii()) {
result = runData->fDataNonMusr.GetLabels()->at(1).Data();

View File

@ -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 *
@ -46,7 +46,7 @@ PRunNonMusr::PRunNonMusr() : PRunBase()
fHandleTag = kEmpty;
fRawRunData = 0;
fRawRunData = nullptr;
}
//--------------------------------------------------------------------------
@ -65,8 +65,8 @@ PRunNonMusr::PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t
// get the proper run
fRawRunData = fRawData->GetRunData(*(fRunInfo->GetRunName()));
if (!fRawRunData) { // couldn't get run
cerr << endl << "PRunNonMusr::PRunNonMusr(): **ERROR** Couldn't get raw run data!";
cerr << endl;
std::cerr << std::endl << "PRunNonMusr::PRunNonMusr(): **ERROR** Couldn't get raw run data!";
std::cerr << std::endl;
fValid = false;
}
@ -130,7 +130,7 @@ Double_t PRunNonMusr::CalcChiSquare(const std::vector<Double_t>& par)
*/
Double_t PRunNonMusr::CalcChiSquareExpected(const std::vector<Double_t>& par)
{
cout << endl << "PRunNonMusr::CalcChiSquareExpected(): not implemented yet ..." << endl;
std::cout << std::endl << "PRunNonMusr::CalcChiSquareExpected(): not implemented yet ..." << std::endl;
return 0.0;
}
@ -148,7 +148,7 @@ Double_t PRunNonMusr::CalcChiSquareExpected(const std::vector<Double_t>& par)
*/
Double_t PRunNonMusr::CalcMaxLikelihood(const std::vector<Double_t>& par)
{
cout << endl << "PRunNonMusr::CalcMaxLikelihood(): not implemented yet ..." << endl;
std::cout << std::endl << "PRunNonMusr::CalcMaxLikelihood(): not implemented yet ..." << std::endl;
return 1.0;
}
@ -199,7 +199,7 @@ Bool_t PRunNonMusr::PrepareData()
Bool_t success = true;
if (fRunInfo->GetRunNameSize() > 1) { // ADDRUN present which is not supported for NonMusr
cerr << endl << ">> PRunNonMusr::PrepareData(): **WARNING** ADDRUN NOT SUPPORTED FOR THIS FIT TYPE, WILL IGNORE IT." << endl;
std::cerr << std::endl << ">> PRunNonMusr::PrepareData(): **WARNING** ADDRUN NOT SUPPORTED FOR THIS FIT TYPE, WILL IGNORE IT." << std::endl;
}
// get packing info
@ -208,7 +208,7 @@ Bool_t PRunNonMusr::PrepareData()
fPacking = fMsrInfo->GetMsrGlobal()->GetPacking();
}
if (fPacking == -1) { // packing NOT present, in neither the RUN block, nor in the GLOBAL block
cerr << endl << ">> PRunNonMusr::PrepareData(): **ERROR** couldn't find any packing information." << endl;
std::cerr << std::endl << ">> PRunNonMusr::PrepareData(): **ERROR** couldn't find any packing information." << std::endl;
return false;
}
@ -491,8 +491,8 @@ UInt_t PRunNonMusr::GetXIndex()
}
if (!found) {
cerr << endl << "PRunNonMusr::GetXIndex(): **ERROR** Couldn't obtain x-data index!";
cerr << endl;
std::cerr << std::endl << "PRunNonMusr::GetXIndex(): **ERROR** Couldn't obtain x-data index!";
std::cerr << std::endl;
assert(0);
}
@ -532,8 +532,8 @@ UInt_t PRunNonMusr::GetYIndex()
}
if (!found) {
cerr << endl << "PRunNonMusr::GetYIndex(): **ERROR** Couldn't obtain y-data index!";
cerr << endl;
std::cerr << std::endl << "PRunNonMusr::GetYIndex(): **ERROR** Couldn't obtain y-data index!";
std::cerr << std::endl;
assert(0);
}

View File

@ -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 *
@ -33,7 +33,6 @@
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
#include <TObjArray.h>
#include <TObjString.h>
@ -61,14 +60,14 @@ ClassImpQ(PStartupHandler)
int parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
{
int status;
fstream xmlFile;
std::fstream xmlFile;
unsigned int xmlSize = 0;
char *xmlBuffer = 0;
char *xmlBuffer = nullptr;
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
xmlFile.open(startup_path_name, std::ios::in | std::ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlFile.seekg(0, std::ios::beg); // go back to the beginning of the stream
xmlBuffer = new char[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
@ -78,7 +77,7 @@ int parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
xmlBuffer = nullptr;
}
return status;
@ -96,8 +95,8 @@ PStartupHandler::PStartupHandler()
fStartupFilePath = "";
// get default path (for the moment only linux like)
Char_t *pmusrpath=0;
Char_t *home=0;
Char_t *pmusrpath=nullptr;
Char_t *home=nullptr;
Char_t musrpath[128];
Char_t startup_path_name[128];
@ -112,7 +111,7 @@ PStartupHandler::PStartupHandler()
if (!fStartupFileFound) { // startup file not found in the current directory
// check if the startup file is found under $HOME/.musrfit
home = getenv("HOME");
if (home != 0) {
if (home != nullptr) {
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
@ -123,7 +122,7 @@ PStartupHandler::PStartupHandler()
if (!fStartupFileFound) { // startup file not found in $HOME/.musrfit
// check if the MUSRFITPATH system variable is set
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath != 0) {
if (pmusrpath != nullptr) {
sprintf(startup_path_name, "%s/musrfit_startup.xml", pmusrpath);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
@ -133,9 +132,9 @@ PStartupHandler::PStartupHandler()
}
if (!fStartupFileFound) { // MUSRFITPATH not set or empty, will try $ROOTSYS/bin
home = getenv("ROOTSYS");
if (home != 0) {
if (home != nullptr) {
sprintf(musrpath, "%s/bin", home);
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
std::cerr << std::endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << std::endl;
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
@ -146,12 +145,12 @@ PStartupHandler::PStartupHandler()
// if musrfit_startup.xml is still not found, will create a default one
if (!fStartupFileFound) {
cout << endl << "**INFO** no musrfit_startup.xml file found, will write a default one." << endl;
std::cout << std::endl << "**INFO** no musrfit_startup.xml file found, will write a default one." << std::endl;
if (!WriteDefaultStartupFile()) {
cerr << endl << "**ERROR** couldn't write default musrfit_startup.xml." << endl;
std::cerr << std::endl << "**ERROR** couldn't write default musrfit_startup.xml." << std::endl;
} else {
home = getenv("HOME");
if (home != 0) {
if (home != nullptr) {
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
@ -286,8 +285,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
// add converted str to the marker list
fMarkerList.push_back(tstr.Atoi());
} else {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a number, will ignore it";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a number, will ignore it";
std::cerr << std::endl;
}
break;
case eColor:
@ -296,14 +295,14 @@ void PStartupHandler::OnCharacters(const Char_t *str)
tokens = tstr.Tokenize(",");
// check that there any tokens
if (!tokens) {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
std::cerr << std::endl;
return;
}
// check there is the right number of tokens
if (tokens->GetEntries() != 3) {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
std::cerr << std::endl;
return;
}
// get r
@ -312,8 +311,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsDigit()) {
r = tstr.Atoi();
} else {
cerr << endl << "PStartupHandler **WARNING** r within the rgb code is not a number, will ignore it";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** r within the rgb code is not a number, will ignore it";
std::cerr << std::endl;
return;
}
// get g
@ -322,8 +321,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsDigit()) {
g = tstr.Atoi();
} else {
cerr << endl << "PStartupHandler **WARNING** g within the rgb code is not a number, will ignore it";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** g within the rgb code is not a number, will ignore it";
std::cerr << std::endl;
return;
}
// get b
@ -332,14 +331,14 @@ void PStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsDigit()) {
b = tstr.Atoi();
} else {
cerr << endl << "PStartupHandler **WARNING** b within the rgb code is not a number, will ignore it";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** b within the rgb code is not a number, will ignore it";
std::cerr << std::endl;
return;
}
// clean up tokens
if (tokens) {
delete tokens;
tokens = 0;
tokens = nullptr;
}
// generate the ROOT color code based on str
color = TColor::GetColor(r,g,b);
@ -357,8 +356,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
} else if (!tstr.CompareTo("mc/s", TString::kIgnoreCase)) {
fFourierDefaults.fUnits = FOURIER_UNIT_CYCLES;
} else {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid unit, will ignore it.";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a valid unit, will ignore it.";
std::cerr << std::endl;
}
break;
case eFourierPower:
@ -368,12 +367,12 @@ void PStartupHandler::OnCharacters(const Char_t *str)
if ((ival >= 0) && (ival <= 20)) {
fFourierDefaults.fFourierPower = ival;
} else {
cerr << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
std::cerr << std::endl;
}
} else {
cerr << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
std::cerr << std::endl;
}
break;
case eApodization:
@ -387,8 +386,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
} else if (!tstr.CompareTo("strong", TString::kIgnoreCase)) {
fFourierDefaults.fApodization = FOURIER_APOD_STRONG;
} else {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid apodization, will ignore it.";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a valid apodization, will ignore it.";
std::cerr << std::endl;
}
break;
case ePlot:
@ -404,8 +403,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
} else if (!tstr.CompareTo("phase", TString::kIgnoreCase)) {
fFourierDefaults.fPlotTag = FOURIER_PLOT_PHASE;
} else {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid plot option, will ignore it.";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a valid plot option, will ignore it.";
std::cerr << std::endl;
}
break;
case ePhase:
@ -413,8 +412,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsFloat()) {
fFourierDefaults.fPhase.push_back(tstr.Atof());
} else {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase, will ignore it.";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase, will ignore it.";
std::cerr << std::endl;
}
break;
case ePhaseIncrement:
@ -422,8 +421,8 @@ void PStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsFloat()) {
fFourierDefaults.fPhaseIncrement = tstr.Atof();
} else {
cerr << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase increment, will ignore it.";
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** '" << str << "' is not a valid phase increment, will ignore it.";
std::cerr << std::endl;
}
break;
default:
@ -454,8 +453,8 @@ void PStartupHandler::OnComment(const Char_t *str)
*/
void PStartupHandler::OnWarning(const Char_t *str)
{
cerr << endl << "PStartupHandler **WARNING** " << str;
cerr << endl;
std::cerr << std::endl << "PStartupHandler **WARNING** " << str;
std::cerr << std::endl;
}
//--------------------------------------------------------------------------
@ -468,8 +467,8 @@ void PStartupHandler::OnWarning(const Char_t *str)
*/
void PStartupHandler::OnError(const Char_t *str)
{
cerr << endl << "PStartupHandler **ERROR** " << str;
cerr << endl;
std::cerr << std::endl << "PStartupHandler **ERROR** " << str;
std::cerr << std::endl;
}
//--------------------------------------------------------------------------
@ -482,8 +481,8 @@ void PStartupHandler::OnError(const Char_t *str)
*/
void PStartupHandler::OnFatalError(const Char_t *str)
{
cerr << endl << "PStartupHandler **FATAL ERROR** " << str;
cerr << endl;
std::cerr << std::endl << "PStartupHandler **FATAL ERROR** " << str;
std::cerr << std::endl;
}
//--------------------------------------------------------------------------
@ -573,7 +572,7 @@ Bool_t PStartupHandler::StartupFileExists(Char_t *fln)
{
Bool_t result = false;
ifstream ifile(fln);
std::ifstream ifile(fln);
if (ifile.fail()) {
result = false;
@ -592,10 +591,10 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
{
// get home
Char_t startup_path_name[256];
Char_t *home=0;
Char_t *home = nullptr;
home = getenv("HOME");
if (home == 0) {
cerr << endl << "**ERROR** couldn't obtain $HOME." << endl;
if (home == nullptr) {
std::cerr << std::endl << "**ERROR** couldn't obtain $HOME." << std::endl;
return false;
}
@ -608,7 +607,7 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
return false;
} else {
if (mkdir(startup_path_name, 0777)) {
cerr << endl << "**ERROR** couldn't create '" << startup_path_name << "'" << endl;
std::cerr << std::endl << "**ERROR** couldn't create '" << startup_path_name << "'" << std::endl;
return false;
}
}
@ -616,68 +615,68 @@ Bool_t PStartupHandler::WriteDefaultStartupFile()
// set path-name for musrfit_startup.xml
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
ofstream fout(startup_path_name, ofstream::out);
std::ofstream fout(startup_path_name, std::ofstream::out);
if (!fout.is_open()) {
cerr << endl << "**ERROR** couldn't open '" << startup_path_name << "' for writing." << endl;
std::cerr << std::endl << "**ERROR** couldn't open '" << startup_path_name << "' for writing." << std::endl;
return false;
}
// write default musrfit_startup.xml
fout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
fout << "<musrfit xmlns=\"http://lmu.web.psi.ch/musrfit/user/MUSR/WebHome.html\">" << endl;
fout << " <comment>" << endl;
fout << " Defines default settings for the musrfit package" << endl;
fout << " </comment>" << endl;
fout << " <data_path>/afs/psi.ch/project/nemu/data/his</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/nemu/data/wkm</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/gps</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/dolly</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/gpd</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/ltf</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path>" << endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path>" << endl;
fout << " <fourier_settings>" << endl;
fout << " <units>Gauss</units>" << endl;
fout << " <fourier_power>0</fourier_power>" << endl;
fout << " <apodization>none</apodization>" << endl;
fout << " <plot>real_and_imag</plot>" << endl;
fout << " <phase>0.0</phase>" << endl;
fout << " <phase_increment>1.0</phase_increment>" << endl;
fout << " </fourier_settings>" << endl;
fout << " <root_settings>" << endl;
fout << " <marker_list>" << endl;
fout << " <!-- Root marker numbers -->" << endl;
fout << " <marker>24</marker> <!-- open circle -->" << endl;
fout << " <marker>25</marker> <!-- open square -->" << endl;
fout << " <marker>26</marker> <!-- open triangle -->" << endl;
fout << " <marker>27</marker> <!-- open diamond -->" << endl;
fout << " <marker>28</marker> <!-- open cross -->" << endl;
fout << " <marker>29</marker> <!-- full star -->" << endl;
fout << " <marker>30</marker> <!-- open star -->" << endl;
fout << " <marker>20</marker> <!-- full circle -->" << endl;
fout << " <marker>21</marker> <!-- full square -->" << endl;
fout << " <marker>22</marker> <!-- full triangle -->" << endl;
fout << " <marker>23</marker> <!-- full triangle down -->" << endl;
fout << " <marker>2</marker> <!-- thin cross -->" << endl;
fout << " <marker>3</marker> <!-- thin star -->" << endl;
fout << " <marker>5</marker> <!-- thin x -->" << endl;
fout << " </marker_list>" << endl;
fout << " <color_list>" << endl;
fout << " <!-- Color as RGB coded string -->" << endl;
fout << " <color>0,0,0</color> <!-- kBlack -->" << endl;
fout << " <color>255,0,0</color> <!-- kRed -->" << endl;
fout << " <color>0,255,0</color> <!-- kGreen -->" << endl;
fout << " <color>0,0,255</color> <!-- kBlue -->" << endl;
fout << " <color>255,0,255</color> <!-- kMagenta -->" << endl;
fout << " <color>0,255,255</color> <!-- kCyan -->" << endl;
fout << " <color>153,0,255</color> <!-- kViolet-3 -->" << endl;
fout << " <color>102,102,51</color> <!-- kYellow-1 -->" << endl;
fout << " <color>51,102,51</color> <!-- kGreen-1 -->" << endl;
fout << " <color>153,0,0</color> <!-- kRed+2 -->" << endl;
fout << " </color_list>" << endl;
fout << " </root_settings>" << endl;
fout << "</musrfit>" << endl;
fout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
fout << "<musrfit xmlns=\"http://lmu.web.psi.ch/musrfit/user/MUSR/WebHome.html\">" << std::endl;
fout << " <comment>" << std::endl;
fout << " Defines default settings for the musrfit package" << std::endl;
fout << " </comment>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/nemu/data/his</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/nemu/data/wkm</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/gps</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/dolly</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/gpd</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/ltf</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/alc</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/hifi</data_path>" << std::endl;
fout << " <data_path>/afs/psi.ch/project/bulkmusr/data/lem</data_path>" << std::endl;
fout << " <fourier_settings>" << std::endl;
fout << " <units>Gauss</units>" << std::endl;
fout << " <fourier_power>0</fourier_power>" << std::endl;
fout << " <apodization>none</apodization>" << std::endl;
fout << " <plot>real_and_imag</plot>" << std::endl;
fout << " <phase>0.0</phase>" << std::endl;
fout << " <phase_increment>1.0</phase_increment>" << std::endl;
fout << " </fourier_settings>" << std::endl;
fout << " <root_settings>" << std::endl;
fout << " <marker_list>" << std::endl;
fout << " <!-- Root marker numbers -->" << std::endl;
fout << " <marker>24</marker> <!-- open circle -->" << std::endl;
fout << " <marker>25</marker> <!-- open square -->" << std::endl;
fout << " <marker>26</marker> <!-- open triangle -->" << std::endl;
fout << " <marker>27</marker> <!-- open diamond -->" << std::endl;
fout << " <marker>28</marker> <!-- open cross -->" << std::endl;
fout << " <marker>29</marker> <!-- full star -->" << std::endl;
fout << " <marker>30</marker> <!-- open star -->" << std::endl;
fout << " <marker>20</marker> <!-- full circle -->" << std::endl;
fout << " <marker>21</marker> <!-- full square -->" << std::endl;
fout << " <marker>22</marker> <!-- full triangle -->" << std::endl;
fout << " <marker>23</marker> <!-- full triangle down -->" << std::endl;
fout << " <marker>2</marker> <!-- thin cross -->" << std::endl;
fout << " <marker>3</marker> <!-- thin star -->" << std::endl;
fout << " <marker>5</marker> <!-- thin x -->" << std::endl;
fout << " </marker_list>" << std::endl;
fout << " <color_list>" << std::endl;
fout << " <!-- Color as RGB coded string -->" << std::endl;
fout << " <color>0,0,0</color> <!-- kBlack -->" << std::endl;
fout << " <color>255,0,0</color> <!-- kRed -->" << std::endl;
fout << " <color>0,255,0</color> <!-- kGreen -->" << std::endl;
fout << " <color>0,0,255</color> <!-- kBlue -->" << std::endl;
fout << " <color>255,0,255</color> <!-- kMagenta -->" << std::endl;
fout << " <color>0,255,255</color> <!-- kCyan -->" << std::endl;
fout << " <color>153,0,255</color> <!-- kViolet-3 -->" << std::endl;
fout << " <color>102,102,51</color> <!-- kYellow-1 -->" << std::endl;
fout << " <color>51,102,51</color> <!-- kGreen-1 -->" << std::endl;
fout << " <color>153,0,0</color> <!-- kRed+2 -->" << std::endl;
fout << " </color_list>" << std::endl;
fout << " </root_settings>" << std::endl;
fout << "</musrfit>" << std::endl;
fout.close();

View File

@ -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 *
@ -29,7 +29,6 @@
#include <iostream>
#include <vector>
using namespace std;
#include <TObject.h>
#include <TString.h>
@ -47,7 +46,7 @@ using namespace std;
#define SQRT_TWO 1.41421356237
#define SQRT_PI 1.77245385091
extern vector<void*> gGlobalUserFcn;
extern std::vector<void*> gGlobalUserFcn;
//--------------------------------------------------------------------------
// Constructor
@ -95,10 +94,10 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
{
// init stuff
fValid = true;
fAdd = 0;
fMul = 0;
fAdd = nullptr;
fMul = nullptr;
fUserFcnClassName = TString("");
fUserFcn = 0;
fUserFcn = nullptr;
fDynLFdt = 0.0;
fSamplingTime = 0.001; // default = 1ns (units in us)
@ -143,9 +142,9 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
tokens = str.Tokenize(" \t");
if (!tokens) {
cerr << endl << ">> PTheory::PTheory: **SEVERE ERROR** Couldn't tokenize theory block line " << line->fLineNo << ".";
cerr << endl << ">> line content: " << line->fLine.Data();
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **SEVERE ERROR** Couldn't tokenize theory block line " << line->fLineNo << ".";
std::cerr << std::endl << ">> line content: " << line->fLine.Data();
std::cerr << std::endl;
exit(0);
}
ostr = dynamic_cast<TObjString*>(tokens->At(0));
@ -155,21 +154,21 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
UInt_t idx = SearchDataBase(str);
// function found is not defined
if (idx == (UInt_t) THEORY_UNDEFINED) {
cerr << endl << ">> PTheory::PTheory: **ERROR** Theory line '" << line->fLine.Data() << "'";
cerr << endl << ">> in line no " << line->fLineNo << " is undefined!";
cerr << endl;
if (idx == static_cast<UInt_t>(THEORY_UNDEFINED)) {
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** Theory line '" << line->fLine.Data() << "'";
std::cerr << std::endl << ">> in line no " << line->fLineNo << " is undefined!";
std::cerr << std::endl;
fValid = false;
return;
}
// line is a valid function, hence analyze parameters
if (((UInt_t)(tokens->GetEntries()-1) < fNoOfParam) &&
if ((static_cast<UInt_t>(tokens->GetEntries()-1) < fNoOfParam) &&
((idx != THEORY_USER_FCN) && (idx != THEORY_POLYNOM))) {
cerr << endl << ">> PTheory::PTheory: **ERROR** Theory line '" << line->fLine.Data() << "'";
cerr << endl << ">> in line no " << line->fLineNo;
cerr << endl << ">> expecting " << fgTheoDataBase[idx].fNoOfParam << ", but found " << tokens->GetEntries()-1;
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** Theory line '" << line->fLine.Data() << "'";
std::cerr << std::endl << ">> in line no " << line->fLineNo;
std::cerr << std::endl << ">> expecting " << fgTheoDataBase[idx].fNoOfParam << ", but found " << tokens->GetEntries()-1;
std::cerr << std::endl;
fValid = false;
}
// keep function index
@ -203,13 +202,13 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
if ((value <= maps.size()) && (value > 0)) { // everything fine
fParamNo.push_back(maps[value-1]-1);
} else { // map index out of range
cerr << endl << ">> PTheory::PTheory: **ERROR** map index " << value << " out of range! See line no " << line->fLineNo;
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** map index " << value << " out of range! See line no " << line->fLineNo;
std::cerr << std::endl;
fValid = false;
}
} else { // something wrong
cerr << endl << ">> PTheory::PTheory: **ERROR**: map '" << str.Data() << "' not allowed. See line no " << line->fLineNo;
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR**: map '" << str.Data() << "' not allowed. See line no " << line->fLineNo;
std::cerr << std::endl;
fValid = false;
}
} else if (str.Contains("fun")) { // check if str is fun
@ -230,8 +229,8 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
}
// check if one of the valid entries was found
if (!ok) {
cerr << endl << ">> PTheory::PTheory: **ERROR** '" << str.Data() << "' not allowed. See line no " << line->fLineNo;
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** '" << str.Data() << "' not allowed. See line no " << line->fLineNo;
std::cerr << std::endl;
fValid = false;
}
}
@ -265,41 +264,41 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
// check if user function, if so, check if it is reachable (root) and if yes invoke object
if (!fUserFcnClassName.IsWhitespace()) {
cout << endl << ">> user function class name: " << fUserFcnClassName.Data() << endl;
std::cout << std::endl << ">> user function class name: " << fUserFcnClassName.Data() << std::endl;
if (!TClass::GetDict(fUserFcnClassName.Data())) {
if (gSystem->Load(fUserFcnSharedLibName.Data()) < 0) {
cerr << endl << ">> PTheory::PTheory: **ERROR** user function class '" << fUserFcnClassName.Data() << "' not found.";
cerr << endl << ">> Tried to load " << fUserFcnSharedLibName.Data() << " but failed.";
cerr << endl << ">> See line no " << line->fLineNo;
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** user function class '" << fUserFcnClassName.Data() << "' not found.";
std::cerr << std::endl << ">> Tried to load " << fUserFcnSharedLibName.Data() << " but failed.";
std::cerr << std::endl << ">> See line no " << line->fLineNo;
std::cerr << std::endl;
fValid = false;
// clean up
if (tokens) {
delete tokens;
tokens = 0;
tokens = nullptr;
}
return;
} else if (!TClass::GetDict(fUserFcnClassName.Data())) {
cerr << endl << ">> PTheory::PTheory: **ERROR** user function class '" << fUserFcnClassName.Data() << "' not found.";
cerr << endl << ">> " << fUserFcnSharedLibName.Data() << " loaded successfully, but no dictionary present.";
cerr << endl << ">> See line no " << line->fLineNo;
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** user function class '" << fUserFcnClassName.Data() << "' not found.";
std::cerr << std::endl << ">> " << fUserFcnSharedLibName.Data() << " loaded successfully, but no dictionary present.";
std::cerr << std::endl << ">> See line no " << line->fLineNo;
std::cerr << std::endl;
fValid = false;
// clean up
if (tokens) {
delete tokens;
tokens = 0;
tokens = nullptr;
}
return;
}
}
// invoke user function object
fUserFcn = 0;
fUserFcn = (PUserFcnBase*)TClass::GetClass(fUserFcnClassName.Data())->New();
if (fUserFcn == 0) {
cerr << endl << ">> PTheory::PTheory: **ERROR** user function object could not be invoked. See line no " << line->fLineNo;
cerr << endl;
fUserFcn = nullptr;
fUserFcn = static_cast<PUserFcnBase*>(TClass::GetClass(fUserFcnClassName.Data())->New());
if (fUserFcn == nullptr) {
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** user function object could not be invoked. See line no " << line->fLineNo;
std::cerr << std::endl;
fValid = false;
return;
} else { // user function valid, hence expand the fUserParam vector to the proper size
@ -310,8 +309,8 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
if (fUserFcn->NeedGlobalPart()) {
fUserFcn->SetGlobalPart(gGlobalUserFcn, fUserFcnIdx); // invoke or retrieve global user function object
if (!fUserFcn->GlobalPartIsValid()) {
cerr << endl << ">> PTheory::PTheory: **ERROR** global user function object could not be invoked/retrived. See line no " << line->fLineNo;
cerr << endl;
std::cerr << std::endl << ">> PTheory::PTheory: **ERROR** global user function object could not be invoked/retrived. See line no " << line->fLineNo;
std::cerr << std::endl;
fValid = false;
}
}
@ -320,7 +319,7 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
// clean up
if (tokens) {
delete tokens;
tokens = 0;
tokens = nullptr;
}
}
@ -343,7 +342,7 @@ PTheory::~PTheory()
if (fUserFcn) {
delete fUserFcn;
fUserFcn = 0;
fUserFcn = nullptr;
}
gGlobalUserFcn.clear();
@ -375,8 +374,6 @@ Bool_t PTheory::IsValid()
return fValid;
}
}
return false;
}
//--------------------------------------------------------------------------
@ -398,223 +395,163 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
case THEORY_CONST:
return Constant(paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_ASYMMETRY:
return Asymmetry(paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SIMPLE_EXP:
return SimpleExp(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_GENERAL_EXP:
return GeneralExp(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SIMPLE_GAUSS:
return SimpleGauss(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT:
return StaticGaussKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT_LF:
return StaticGaussKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_GAUSS_KT_LF:
return DynamicGaussKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT:
return StaticLorentzKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT_LF:
return StaticLorentzKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STR_KT:
return StrKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SPIN_GLASS:
return SpinGlass(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_RANDOM_ANISOTROPIC_HYPERFINE:
return RandomAnisotropicHyperfine(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_ABRAGAM:
return Abragam(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_TF_COS:
return TFCos(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD:
return InternalField(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_KORNILOV:
return InternalFieldGK(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_LARKIN:
return InternalFieldLL(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_BESSEL:
return Bessel(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_BESSEL:
return InternalBessel(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SKEWED_GAUSS:
return SkewedGauss(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_ZF_NK:
return StaticNKZF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
fAdd->Func(t, paramValues, funcValues);
case THEORY_STATIC_TF_NK:
return StaticNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_ZF_NK:
return DynamicNKZF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_USER_FCN:
return UserFcn(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
default:
cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl;
std::cerr << std::endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
std::cerr << std::endl;
exit(0);
}
} else { // fMul !=0 && fAdd == 0
switch (fType) {
case THEORY_CONST:
return Constant(paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_ASYMMETRY:
return Asymmetry(paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_SIMPLE_EXP:
return SimpleExp(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_GENERAL_EXP:
return GeneralExp(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_SIMPLE_GAUSS:
return SimpleGauss(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT:
return StaticGaussKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT_LF:
return StaticGaussKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_GAUSS_KT_LF:
return DynamicGaussKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT:
return StaticLorentzKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT_LF:
return StaticLorentzKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_STR_KT:
return StrKT(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_SPIN_GLASS:
return SpinGlass(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_RANDOM_ANISOTROPIC_HYPERFINE:
return RandomAnisotropicHyperfine(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_ABRAGAM:
return Abragam(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_TF_COS:
return TFCos(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD:
return InternalField(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_KORNILOV:
return InternalFieldGK(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_LARKIN:
return InternalFieldLL(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_BESSEL:
return Bessel(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_BESSEL:
return InternalBessel(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_SKEWED_GAUSS:
return SkewedGauss(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_ZF_NK:
return StaticNKZF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_TF_NK:
return StaticNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_ZF_NK:
return DynamicNKZF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_USER_FCN:
return UserFcn(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
default:
cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl;
std::cerr << std::endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
std::cerr << std::endl;
exit(0);
}
}
@ -623,200 +560,138 @@ Double_t PTheory::Func(Double_t t, const PDoubleVector& paramValues, const PDoub
switch (fType) {
case THEORY_CONST:
return Constant(paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_ASYMMETRY:
return Asymmetry(paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SIMPLE_EXP:
return SimpleExp(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_GENERAL_EXP:
return GeneralExp(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SIMPLE_GAUSS:
return SimpleGauss(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT:
return StaticGaussKT(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT_LF:
return StaticGaussKTLF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_GAUSS_KT_LF:
return DynamicGaussKTLF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT:
return StaticLorentzKT(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT_LF:
return StaticLorentzKTLF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STR_KT:
return StrKT(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SPIN_GLASS:
return SpinGlass(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_RANDOM_ANISOTROPIC_HYPERFINE:
return RandomAnisotropicHyperfine(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_ABRAGAM:
return Abragam(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_TF_COS:
return TFCos(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD:
return InternalField(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_KORNILOV:
return InternalFieldGK(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_LARKIN:
return InternalFieldLL(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_BESSEL:
return Bessel(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_BESSEL:
return InternalBessel(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_SKEWED_GAUSS:
return SkewedGauss(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_ZF_NK:
return StaticNKZF (t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_STATIC_TF_NK:
return StaticNKTF (t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_ZF_NK:
return DynamicNKZF (t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF (t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_USER_FCN:
return UserFcn(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
default:
cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl;
std::cerr << std::endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
std::cerr << std::endl;
exit(0);
}
} else { // fMul == 0 && fAdd == 0
switch (fType) {
case THEORY_CONST:
return Constant(paramValues, funcValues);
break;
case THEORY_ASYMMETRY:
return Asymmetry(paramValues, funcValues);
break;
case THEORY_SIMPLE_EXP:
return SimpleExp(t, paramValues, funcValues);
break;
case THEORY_GENERAL_EXP:
return GeneralExp(t, paramValues, funcValues);
break;
case THEORY_SIMPLE_GAUSS:
return SimpleGauss(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT:
return StaticGaussKT(t, paramValues, funcValues);
break;
case THEORY_STATIC_GAUSS_KT_LF:
return StaticGaussKTLF(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_GAUSS_KT_LF:
return DynamicGaussKTLF(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT:
return StaticLorentzKT(t, paramValues, funcValues);
break;
case THEORY_STATIC_LORENTZ_KT_LF:
return StaticLorentzKTLF(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_LORENTZ_KT_LF:
return DynamicLorentzKTLF(t, paramValues, funcValues);
break;
case THEORY_COMBI_LGKT:
return CombiLGKT(t, paramValues, funcValues);
break;
case THEORY_STR_KT:
return StrKT(t, paramValues, funcValues);
break;
case THEORY_SPIN_GLASS:
return SpinGlass(t, paramValues, funcValues);
break;
case THEORY_RANDOM_ANISOTROPIC_HYPERFINE:
return RandomAnisotropicHyperfine(t, paramValues, funcValues);
break;
case THEORY_ABRAGAM:
return Abragam(t, paramValues, funcValues);
break;
case THEORY_TF_COS:
return TFCos(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD:
return InternalField(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_KORNILOV:
return InternalFieldGK(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_FIELD_LARKIN:
return InternalFieldLL(t, paramValues, funcValues);
break;
case THEORY_BESSEL:
return Bessel(t, paramValues, funcValues);
break;
case THEORY_INTERNAL_BESSEL:
return InternalBessel(t, paramValues, funcValues);
break;
case THEORY_SKEWED_GAUSS:
return SkewedGauss(t, paramValues, funcValues);
break;
case THEORY_STATIC_ZF_NK:
return StaticNKZF(t, paramValues, funcValues);
break;
case THEORY_STATIC_TF_NK:
return StaticNKTF(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_ZF_NK:
return DynamicNKZF(t, paramValues, funcValues);
break;
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues);
break;
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues);
break;
case THEORY_USER_FCN:
return UserFcn(t, paramValues, funcValues);
break;
default:
cerr << endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
cerr << endl;
std::cerr << std::endl << ">> PTheory::Func: **PANIC ERROR** You never should have reached this line?!?! (" << fType << ")";
std::cerr << std::endl;
exit(0);
}
}
}
return 0.0;
}
//--------------------------------------------------------------------------
@ -842,12 +717,12 @@ void PTheory::CleanUp(PTheory *theo)
{
if (theo->fMul) { // '*' present
delete theo->fMul;
theo->fMul = 0;
theo->fMul = nullptr;
}
if (theo->fAdd) {
delete theo->fAdd;
theo->fAdd = 0;
theo->fAdd = nullptr;
}
}
@ -868,8 +743,8 @@ Int_t PTheory::SearchDataBase(TString name)
for (UInt_t i=0; i<THEORY_MAX; i++) {
if (!name.CompareTo(fgTheoDataBase[i].fName, TString::kIgnoreCase) ||
!name.CompareTo(fgTheoDataBase[i].fAbbrev, TString::kIgnoreCase)) {
idx = fgTheoDataBase[i].fType;
fType = idx;
idx = static_cast<Int_t>(fgTheoDataBase[i].fType);
fType = fgTheoDataBase[i].fType;
fNoOfParam = fgTheoDataBase[i].fNoOfParam;
}
}
@ -921,8 +796,8 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
PMsrLineStructure *line;
TString str, tidy;
Char_t substr[256];
TObjArray *tokens = 0;
TObjString *ostr = 0;
TObjArray *tokens = nullptr;
TObjString *ostr = nullptr;
Int_t idx = THEORY_UNDEFINED;
for (UInt_t i=1; i<fullTheoryBlock->size(); i++) {
@ -956,19 +831,19 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
for (UInt_t j=0; j<THEORY_MAX; j++) {
if (!str.CompareTo(fgTheoDataBase[j].fName, TString::kIgnoreCase) ||
!str.CompareTo(fgTheoDataBase[j].fAbbrev, TString::kIgnoreCase)) {
idx = fgTheoDataBase[j].fType;
idx = static_cast<Int_t>(fgTheoDataBase[j].fType);
}
}
// check if theory is indeed defined. This should not be necessay at this point but ...
if (idx == THEORY_UNDEFINED)
return;
// check that there enough tokens. This should not be necessay at this point but ...
if ((UInt_t)tokens->GetEntries() < fgTheoDataBase[idx].fNoOfParam + 1)
if (static_cast<UInt_t>(tokens->GetEntries()) < fgTheoDataBase[idx].fNoOfParam + 1)
return;
// make tidy string
sprintf(substr, "%-10s", fgTheoDataBase[idx].fName.Data());
tidy = TString(substr);
for (UInt_t j=1; j<(UInt_t)tokens->GetEntries(); j++) {
for (Int_t j=1; j<tokens->GetEntries(); j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString();
sprintf(substr, "%6s", str.Data());
@ -976,12 +851,12 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
}
if (fgTheoDataBase[idx].fComment.Length() != 0) {
if (tidy.Length() < 35) {
for (UInt_t k=0; k<35-(UInt_t)tidy.Length(); k++)
for (Int_t k=0; k<35-tidy.Length(); k++)
tidy += TString(" ");
} else {
tidy += TString(" ");
}
if ((UInt_t)tokens->GetEntries() == fgTheoDataBase[idx].fNoOfParam + 1) // no tshift
if (static_cast<UInt_t>(tokens->GetEntries()) == fgTheoDataBase[idx].fNoOfParam + 1) // no tshift
tidy += fgTheoDataBase[idx].fComment;
else
tidy += fgTheoDataBase[idx].fCommentTimeShift;
@ -992,7 +867,7 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock)
// clean up
if (tokens) {
delete tokens;
tokens = 0;
tokens = nullptr;
}
}
@ -1011,7 +886,7 @@ void PTheory::MakeCleanAndTidyPolynom(UInt_t i, PMsrLines *fullTheoryBlock)
{
PMsrLineStructure *line;
TString str, tidy;
TObjArray *tokens = 0;
TObjArray *tokens = nullptr;
TObjString *ostr;
Char_t substr[256];
@ -1025,8 +900,8 @@ void PTheory::MakeCleanAndTidyPolynom(UInt_t i, PMsrLines *fullTheoryBlock)
tokens = str.Tokenize(" \t");
// check if comment is already present, and if yes ignore it by setting max correctly
UInt_t max = (UInt_t)tokens->GetEntries();
for (UInt_t j=1; j<max; j++) {
Int_t max = tokens->GetEntries();
for (Int_t j=1; j<max; j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString();
if (str.Contains("(")) { // comment present
@ -1035,7 +910,7 @@ void PTheory::MakeCleanAndTidyPolynom(UInt_t i, PMsrLines *fullTheoryBlock)
}
}
for (UInt_t j=1; j<max; j++) {
for (Int_t j=1; j<max; j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString();
sprintf(substr, "%6s", str.Data());
@ -1051,7 +926,7 @@ void PTheory::MakeCleanAndTidyPolynom(UInt_t i, PMsrLines *fullTheoryBlock)
// clean up
if (tokens) {
delete tokens;
tokens = 0;
tokens = nullptr;
}
}
@ -1068,7 +943,7 @@ void PTheory::MakeCleanAndTidyUserFcn(UInt_t i, PMsrLines *fullTheoryBlock)
{
PMsrLineStructure *line;
TString str, tidy;
TObjArray *tokens = 0;
TObjArray *tokens = nullptr;
TObjString *ostr;
// init tidy
@ -1080,7 +955,7 @@ void PTheory::MakeCleanAndTidyUserFcn(UInt_t i, PMsrLines *fullTheoryBlock)
// tokenize line
tokens = str.Tokenize(" \t");
for (UInt_t j=1; j<(UInt_t)tokens->GetEntries(); j++) {
for (Int_t j=1; j<tokens->GetEntries(); j++) {
ostr = dynamic_cast<TObjString*>(tokens->At(j));
str = ostr->GetString();
tidy += TString(" ") + str;
@ -1092,7 +967,7 @@ void PTheory::MakeCleanAndTidyUserFcn(UInt_t i, PMsrLines *fullTheoryBlock)
// clean up
if (tokens) {
delete tokens;
tokens = 0;
tokens = nullptr;
}
}
@ -2853,7 +2728,7 @@ void PTheory::CalculateDynKTLF(const Double_t *val, Int_t tag) const
CalculateLorentzLFIntegral(val);
break;
default:
cerr << endl << ">> PTheory::CalculateDynKTLF: **FATAL ERROR** You should never have reached this point." << endl;
std::cerr << std::endl << ">> PTheory::CalculateDynKTLF: **FATAL ERROR** You should never have reached this point." << std::endl;
assert(false);
break;
}

View File

@ -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 *
@ -27,9 +27,6 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include <cassert>
#include "PUserFcn.h"

View File

@ -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 *
@ -29,7 +29,6 @@
#include <vector>
#include <fstream>
using namespace std;
#include "PUserFcnBase.h"
@ -74,14 +73,14 @@ PUserFcnBase::~PUserFcnBase()
Int_t parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
{
Int_t status;
fstream xmlFile;
std::fstream xmlFile;
UInt_t xmlSize = 0;
Char_t *xmlBuffer = 0;
Char_t *xmlBuffer = nullptr;
xmlFile.open(startup_path_name, ios::in | ios::ate); // open file for reading and go to the end of the file
xmlFile.open(startup_path_name, std::ios::in | std::ios::ate); // open file for reading and go to the end of the file
if (xmlFile.is_open()) { // check if file has been opened successfully
xmlSize = xmlFile.tellg(); // get the position within the stream == size of the file (since we are at the end)
xmlFile.seekg(0, ios::beg); // go back to the beginning of the stream
xmlFile.seekg(0, std::ios::beg); // go back to the beginning of the stream
xmlBuffer = new Char_t[xmlSize]; // allocate buffer memory for the whole XML file
xmlFile.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file
@ -91,11 +90,11 @@ Int_t parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
} else {
status = saxParser->ParseBuffer(xmlBuffer, xmlSize); // parse buffer
delete[] xmlBuffer; // free the buffer memory
xmlBuffer = 0;
xmlBuffer = nullptr;
}
return status;
}
// place a void pointer vector for global user function objects which might be needed
vector<void *> gGlobalUserFcn;
std::vector<void *> gGlobalUserFcn;