move on to modernize towards modern c++.

This commit is contained in:
suter_a 2022-05-31 12:32:58 +02:00
parent 357e5d6069
commit d977a8cd1a
21 changed files with 97 additions and 97 deletions

View File

@ -50,11 +50,11 @@ typedef std::vector<Double_t> PDoubleVector;
/**
* <p>
*/
typedef struct {
struct PMPRgeData {
Double_t energy;
PDoubleVector stoppingDistance;
PDoubleVector stoppingAmplitude;
} PMPRgeData;
};
//-------------------------------------------------------------
/**

View File

@ -101,7 +101,7 @@ double TMeanFieldsForScHalfSpace::operator()(double E, const std::vector<double>
if (E > energies.back())
return CalcMeanB(energies.back(), BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -201,7 +201,7 @@ double TMeanFieldsForScSingleLayer::operator()(double E, const std::vector<doubl
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -310,7 +310,7 @@ double TMeanFieldsForScBilayer::operator()(double E, const std::vector<double> &
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ, width);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -425,7 +425,7 @@ double TMeanFieldsForScTrilayer::operator()(double E, const std::vector<double>
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));
@ -530,7 +530,7 @@ double TMeanFieldsForScTrilayerWithInsulator::operator()(double E, const std::ve
if (E > energies.back())
return CalcMeanB(energies.back(), interfaces, weights, BofZ);
energyIter = find_if(energies.begin(), energies.end(), bind2nd( greater<double>(), E));
energyIter = find_if(energies.begin(), energies.end(), [E](const double ee){ return E < ee; }); //as35: bind2nd( greater<double>(), E));
// cout << *(energyIter - 1) << " " << *(energyIter) << endl;
double E1(*(energyIter - 1));

View File

@ -67,14 +67,14 @@
/**
* <p>Structure holding all necessary Fourier histograms.
*/
typedef struct {
struct PFourierCanvasDataSet {
TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram
TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram
TH1F *dataFourierPhaseOptReal; ///< phase otpimized real Fourier transform of the data histogram
std::vector<Double_t> optPhase; ///< optimal phase which maximizes the real Fourier
} PFourierCanvasDataSet;
};
//------------------------------------------------------------------------
/**

View File

@ -533,10 +533,10 @@ typedef std::vector<PRawRunData> PRawRunDataList;
/**
* <p>Helper structure for parsing. Keeps a msr-file line string and the corresponding line number.
*/
typedef struct {
struct PMsrLineStructure {
Int_t fLineNo; ///< original line number of the msr-file
TString fLine; ///< msr-file line
} PMsrLineStructure;
};
//-------------------------------------------------------------
/**
@ -548,7 +548,7 @@ typedef std::vector<PMsrLineStructure> PMsrLines;
/**
* <p>Handles the information of a parameter.
*/
typedef struct {
struct PMsrParamStructure{
Int_t fNoOfParams; ///< how many parameters are given
Int_t fNo; ///< parameter number
TString fName; ///< name
@ -561,7 +561,7 @@ typedef struct {
Bool_t fUpperBoundaryPresent; ///< flag showing if an upper boundary is present
Double_t fUpperBoundary; ///< upper boundary for the fit parameter
Bool_t fIsGlobal; ///< flag showing if the parameter is a global one (used for msr2data global)
} PMsrParamStructure;
};
//-------------------------------------------------------------
/**
@ -763,7 +763,7 @@ typedef std::vector<PMsrRunBlock> PMsrRunList;
/**
* <p>Holds the information of the Fourier block
*/
typedef struct {
struct PMsrFourierStructure {
Bool_t fFourierBlockPresent; ///< flag indicating if a Fourier block is present in the msr-file
Int_t fUnits; ///< flag used to indicate the units. 1=field units (G); 2=field units (T); 3=frequency units (MHz); 4=Mc/s
Bool_t fDCCorrected; ///< if set true, the dc offset of the signal/theory will be removed before the FFT is made.
@ -776,13 +776,13 @@ typedef struct {
Double_t fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction
Double_t fPlotRange[2]; ///< field/frequency plot range
Double_t fPhaseIncrement; ///< phase increment for manual phase optimization
} PMsrFourierStructure;
};
//-------------------------------------------------------------
/**
* <p>Holds the information of a single plot block
*/
typedef struct {
struct PMsrPlotStructure{
Int_t fPlotType; ///< plot type
Bool_t fLifeTimeCorrection; ///< needed for single histo. If yes, only the asymmetry is shown, otherweise the positron spectrum
Bool_t fUseFitRanges; ///< yes -> use the fit ranges to plot the data, no (default) -> use range information if present
@ -799,7 +799,7 @@ typedef struct {
UInt_t fRRFUnit; ///< RRF frequency unit. 0=kHz, 1=MHz, 2=Mc/s, 3=Gauss, 4=Tesla
Int_t fRRFPhaseParamNo; ///< parameter number if used instead of a RRF phase value
Double_t fRRFPhase; ///< RRF phase
} PMsrPlotStructure;
};
//-------------------------------------------------------------
/**
@ -811,7 +811,7 @@ typedef std::vector<PMsrPlotStructure> PMsrPlotList;
/**
* <p>Holds the informations for the statistics block.
*/
typedef struct {
struct PMsrStatisticStructure {
Bool_t fValid; ///< flag showing if the statistics block is valid, i.e. a fit took place which converged
PMsrLines fStatLines; ///< statistics block in msr-file clear text
TString fDate; ///< string holding fitting date and time
@ -822,13 +822,13 @@ typedef struct {
Double_t fMinExpected; ///< expected total chi2 or max. likelihood
PDoubleVector fMinExpectedPerHisto; ///< expected pre histo chi2 or max. likelihood
PUIntVector fNdfPerHisto; ///< number of degrees of freedom per histo
} PMsrStatisticStructure;
};
//-------------------------------------------------------------
/**
* <p>Holds the informations for the any2many converter program
*/
typedef struct {
struct PAny2ManyInfo {
Bool_t useStandardOutput{false}; ///< flag showing if the converted shall be sent to the standard output
TString inFormat{""}; ///< holds the information about the input data file format
TString outFormat{""}; ///< holds the information about the output data file format
@ -845,17 +845,17 @@ typedef struct {
UInt_t compressionTag{0}; ///< 0=no compression, 1=gzip compression, 2=bzip2 compression
TString compressFileName{""}; ///< holds the name of the outputfile name in case of compression is used
UInt_t idf{0}; ///< IDF version for NeXus files.
} PAny2ManyInfo;
};
//-------------------------------------------------------------
/**
* <p>Holds information given at startup
*/
typedef struct {
Bool_t writeExpectedChisq; ///< if set to true, expected chisq and chisq per block will be written (from command line)
Bool_t estimateN0; ///< if set to true, for single histogram fits N0 will be estimated (from command line)
struct PStartupOptions {
Bool_t writeExpectedChisq; ///< if set to true, expected chisq and chisq per block will be written
Bool_t estimateN0; ///< if set to true, for single histogram fits N0 will be estimated
Bool_t useDKS; ///< if set to true, use DKS if present and "sensible" (from xml)
} PStartupOptions;
};
//-------------------------------------------------------------
/**
@ -886,10 +886,10 @@ class PStringNumberList {
/**
* <p> Run name template structure.
*/
typedef struct {
struct PRunNameTemplate {
TString instrument{""};
TString runNameTemplate{""};
} PRunNameTemplate;
};
//-------------------------------------------------------------
/**

View File

@ -118,7 +118,7 @@ class PMusrCanvasPlotRange : public TObject
* <p>Structure holding all necessary histograms for a single plot block entry for
* fit types: asymmetry fit and single histogram fit.
*/
typedef struct {
struct PMusrCanvasDataSet {
TH1F *data; ///< data histogram
TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram
TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
@ -139,7 +139,7 @@ typedef struct {
TH1F *diffFourierPhaseOptReal; ///< phase optimized real part spectrum Fourier transform of the diff histogram
PMusrCanvasPlotRange *dataRange; ///< keep the msr-file plot data range
UInt_t diffFourierTag; ///< 0=not relevant, 1=d-f (Fourier of difference time spectra), 2=f-d (difference of Fourier spectra)
} PMusrCanvasDataSet;
};
//------------------------------------------------------------------------
/**
@ -152,7 +152,7 @@ typedef std::vector<PMusrCanvasDataSet> PMusrCanvasDataList;
* <p>Structure holding all necessary error graphs for a single plot block entry for
* fit types: non-muSR fit.
*/
typedef struct {
struct PMusrCanvasNonMusrDataSet {
TGraphErrors *data; ///< data error graph
TGraphErrors *dataFourierRe; ///< real part of the Fourier transform of the data error graph
TGraphErrors *dataFourierIm; ///< imaginary part of the Fourier transform of the data error graph
@ -170,7 +170,7 @@ typedef struct {
TGraphErrors *diffFourierPhase; ///< phase spectrum of the Fourier transform of the diff error graph
PMusrCanvasPlotRange *dataRange; ///< keep the msr-file plot data range
UInt_t diffFourierTag; ///< 0=not relevant, 1=d-f (Fourier of difference time spectra), 2=f-d (difference of Fourier spectra)
} PMusrCanvasNonMusrDataSet;
};
//------------------------------------------------------------------------
/**
@ -182,11 +182,11 @@ typedef std::vector<PMusrCanvasNonMusrDataSet> PMusrCanvasNonMusrDataList;
/**
* <p> data structure needed for ascii dump within musrview.
*/
typedef struct {
struct PMusrCanvasAsciiDump {
PDoubleVector dataX; ///< x-axis data set
PDoubleVector data; ///< y-axis data set
PDoubleVector dataErr; ///< error of the y-axis data set
} PMusrCanvasAsciiDump;
};
//------------------------------------------------------------------------
/**

View File

@ -43,14 +43,14 @@
* <p>Data structure holding raw time domain uSR data together with some
* necessary meta information.
*/
typedef struct {
struct musrFT_data {
Int_t dataSetTag; ///< tag to label the data set. Needed for average-per-data-set
TString info; ///< keeps all the meta information
Double_t timeResolution; ///< time resolution in (usec)
Int_t t0; ///< keep the t0 bin
Double_t timeRange[2]; ///< time range to be used, given in (usec).
PDoubleVector rawData; ///< a single time domain data vector
} musrFT_data;
};
//----------------------------------------------------------------------------
/**

View File

@ -43,13 +43,13 @@
/**
* <p>Keep a single rge table from TrimSP for a given energy.
*/
typedef struct {
struct PRgeData {
Double_t energy;
PDoubleVector depth;
PDoubleVector amplitude;
PDoubleVector nn; // normalized int n(z) dz = 1 amplitudes
Double_t noOfParticles;
} PRgeData;
};
//-----------------------------------------------------------------------------
/**

View File

@ -38,11 +38,11 @@
#include "PVarHandler.h"
//----------------------------------------------------------------------------
typedef struct {
struct PmuppPlotEntry {
int collIdx; ///< collection index
QString xLabel; ///< x-axis label
QVector<QString> yLabel; ///< y-axis label(s)
} PmuppPlotEntry;
};
//----------------------------------------------------------------------------
/**

View File

@ -50,20 +50,20 @@
#define P_MENU_ID_ABOUT 10002
//--------------------------------------------------------------------------
typedef struct {
struct PDataPoint {
Double_t y;
Double_t eYpos;
Double_t eYneg;
} PDataPoint;
};
//--------------------------------------------------------------------------
typedef struct {
struct PDataCollection {
TString name; // collection name
TString xLabel;
PStringVector yLabel;
PDoubleVector xValue;
std::vector< std::vector<PDataPoint> > yValue;
} PDataCollection;
};
//--------------------------------------------------------------------------
class PMuppCanvas : public TObject, public TQObject

View File

@ -38,7 +38,7 @@
#include <QLabel>
#include <QCheckBox>
typedef struct {
struct PParam {
QString number;
QString name;
QString value;
@ -46,7 +46,7 @@ typedef struct {
QString posErr;
QString boundLow;
QString boundHigh;
} PParam;
};
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class PModSelect : public QDialog

View File

@ -70,13 +70,13 @@
#define T0_ENTER_WIZ 2
//-------------------------------------------------------------------
typedef struct {
struct PParamGui {
QLineEdit *paramName;
QLineEdit *paramVal;
QLineEdit *paramStep;
QLineEdit *paramBoundLow;
QLineEdit *paramBoundHigh;
} PParamGui;
};
//-------------------------------------------------------------------
class PMsrData
@ -192,7 +192,7 @@ class PIntroPage : public QWizardPage
PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
bool validatePage();
bool validatePage() override;
private slots:
void handleInstituteChanged(int idx);
@ -223,8 +223,8 @@ class PTheoPage : public QWizardPage
PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void templateState(int);
@ -269,9 +269,9 @@ class PFuncPage : public QWizardPage
PFuncPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
void cleanupPage();
bool validatePage();
void initializePage() override;
void cleanupPage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -295,8 +295,8 @@ class PMapPage : public QWizardPage
PMapPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -318,8 +318,8 @@ class PParamPage : public QWizardPage
PParamPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -341,8 +341,8 @@ class PFitInfoPage : public QWizardPage
PFitInfoPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private:
PMsrData *fMsrData;

View File

@ -67,9 +67,9 @@ class PParam {
};
//-------------------------------------------------------------------
typedef struct {
struct PFunc {
int number;
QString fun;
} PFunc;
};
#endif // _MUSRWIZ_H_

View File

@ -45,14 +45,14 @@ class PAdmin;
* <p>This structure is keeping informations necessary to handle musrfit
* theory functions (see also <code>http://lmu.web.psi.ch/musrfit/user/html/user-manual.html#the-theory-block</code>).
*/
typedef struct {
struct PTheory {
QString name;
QString comment;
QString label;
QString pixmapName;
QPixmap pixmap;
int params;
} PTheory;
};
//---------------------------------------------------------------------------
/**

View File

@ -40,7 +40,7 @@
* parameters to handle <code>msr2data</code>. For a detailed description of the meaning of these
* parameters see <code>msr2data --help</code> and the online documentation.
*/
typedef struct {
struct PMsr2DataParam {
QString runList; ///< list of run numbers (usage 3 of msr2data)
QString runListFileName; ///< run list filename (usage 4 of msr2data)
QString msrFileExtension; ///< msr filename extension, e.g. '0100_h13.msr' -> '_h13'
@ -61,13 +61,13 @@ typedef struct {
bool fitOnly; ///< flag: true = just perform the fits wihtout generating any msr-files ('fit' in msr2data).
bool global; ///< flag: true = 'global' option
bool globalPlus; ///< flag: true = 'global+' option
} PMsr2DataParam;
};
//-------------------------------------------------------------------------------------------------
/**
* This structure is used to handle find (and replace) within <code>musredit</code> properly.
*/
typedef struct {
struct PFindReplaceData {
QString findText; ///< text to be found
QString replaceText; ///< replacement string
bool caseSensitive; ///< true = case sensitive
@ -76,6 +76,6 @@ typedef struct {
bool findBackwards; ///< true = reversed search
bool selectedText; ///< true = handle only the selected text
bool promptOnReplace; ///< true = request on OK from the user before performing the replace action
} PFindReplaceData;
};
#endif // _MUSREDIT_H_

View File

@ -38,11 +38,11 @@
#include "PVarHandler.h"
//----------------------------------------------------------------------------
typedef struct {
struct PmuppPlotEntry {
int collIdx; ///< collection index
QString xLabel; ///< x-axis label
QVector<QString> yLabel; ///< y-axis label(s)
} PmuppPlotEntry;
};
//----------------------------------------------------------------------------
/**

View File

@ -50,20 +50,20 @@
#define P_MENU_ID_ABOUT 10002
//--------------------------------------------------------------------------
typedef struct {
struct PDataPoint {
Double_t y;
Double_t eYpos;
Double_t eYneg;
} PDataPoint;
};
//--------------------------------------------------------------------------
typedef struct {
struct PDataCollection {
TString name; // collection name
TString xLabel;
PStringVector yLabel;
PDoubleVector xValue;
std::vector< std::vector<PDataPoint> > yValue;
} PDataCollection;
};
//--------------------------------------------------------------------------
class PMuppCanvas : public TObject, public TQObject

View File

@ -38,7 +38,7 @@
#include <QLabel>
#include <QCheckBox>
typedef struct {
struct PParam {
QString number;
QString name;
QString value;
@ -46,7 +46,7 @@ typedef struct {
QString posErr;
QString boundLow;
QString boundHigh;
} PParam;
};
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class PModSelect : public QDialog

View File

@ -70,13 +70,13 @@
#define T0_ENTER_WIZ 2
//-------------------------------------------------------------------
typedef struct {
struct PParamGui {
QLineEdit *paramName;
QLineEdit *paramVal;
QLineEdit *paramStep;
QLineEdit *paramBoundLow;
QLineEdit *paramBoundHigh;
} PParamGui;
};
//-------------------------------------------------------------------
class PMsrData
@ -192,7 +192,7 @@ class PIntroPage : public QWizardPage
PIntroPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
bool validatePage();
bool validatePage() override;
private slots:
void handleInstituteChanged(int idx);
@ -223,8 +223,8 @@ class PTheoPage : public QWizardPage
PTheoPage(PAdmin *admin, PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void templateState(int);
@ -269,9 +269,9 @@ class PFuncPage : public QWizardPage
PFuncPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
void cleanupPage();
bool validatePage();
void initializePage() override;
void cleanupPage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -295,8 +295,8 @@ class PMapPage : public QWizardPage
PMapPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -318,8 +318,8 @@ class PParamPage : public QWizardPage
PParamPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private slots:
void showTheo();
@ -341,8 +341,8 @@ class PFitInfoPage : public QWizardPage
PFitInfoPage(PMsrData *data, QWidget *parent=0);
int nextId() const Q_DECL_OVERRIDE;
void initializePage();
bool validatePage();
void initializePage() override;
bool validatePage() override;
private:
PMsrData *fMsrData;

View File

@ -67,9 +67,9 @@ class PParam {
};
//-------------------------------------------------------------------
typedef struct {
struct PFunc {
int number;
QString fun;
} PFunc;
};
#endif // _MUSRWIZ_H_

View File

@ -45,14 +45,14 @@ class PAdmin;
* <p>This structure is keeping informations necessary to handle musrfit
* theory functions (see also <code>http://lmu.web.psi.ch/musrfit/user/html/user-manual.html#the-theory-block</code>).
*/
typedef struct {
struct PTheory {
QString name;
QString comment;
QString label;
QString pixmapName;
QPixmap pixmap;
int params;
} PTheory;
};
//---------------------------------------------------------------------------
/**

View File

@ -40,7 +40,7 @@
* parameters to handle <code>msr2data</code>. For a detailed description of the meaning of these
* parameters see <code>msr2data --help</code> and the online documentation.
*/
typedef struct {
struct PMsr2DataParam {
QString runList; ///< list of run numbers (usage 3 of msr2data)
QString runListFileName; ///< run list filename (usage 4 of msr2data)
QString msrFileExtension; ///< msr filename extension, e.g. '0100_h13.msr' -> '_h13'
@ -61,13 +61,13 @@ typedef struct {
bool fitOnly; ///< flag: true = just perform the fits wihtout generating any msr-files ('fit' in msr2data).
bool global; ///< flag: true = 'global' option
bool globalPlus; ///< flag: true = 'global+' option
} PMsr2DataParam;
};
//-------------------------------------------------------------------------------------------------
/**
* This structure is used to handle find (and replace) within <code>musredit</code> properly.
*/
typedef struct {
struct PFindReplaceData {
QString findText; ///< text to be found
QString replaceText; ///< replacement string
bool caseSensitive; ///< true = case sensitive
@ -76,6 +76,6 @@ typedef struct {
bool findBackwards; ///< true = reversed search
bool selectedText; ///< true = handle only the selected text
bool promptOnReplace; ///< true = request on OK from the user before performing the replace action
} PFindReplaceData;
};
#endif // _MUSREDIT_H_