From 795cd75b1ead82d1345fb21f8415a92d93b78af5 Mon Sep 17 00:00:00 2001 From: Andreas Suter Date: Tue, 16 Apr 2019 15:34:49 +0200 Subject: [PATCH] modernized code to C++11 and newer. This allows to analyze the code by external code analyzers. Since a lot is adopted, the version is changed to 1.4.3 --- CMakeLists.txt | 2 +- src/any2many.cpp | 239 ++- src/classes/PFitter.cpp | 580 +++--- src/classes/PFitterFcn.cpp | 5 +- src/classes/PFourier.cpp | 139 +- src/classes/PFourierCanvas.cpp | 189 +- src/classes/PFunction.cpp | 69 +- src/classes/PFunctionHandler.cpp | 16 +- src/classes/PMsr2Data.cpp | 803 ++++---- src/classes/PMsrHandler.cpp | 1652 ++++++++--------- src/classes/PMusr.cpp | 101 +- src/classes/PMusrCanvas.cpp | 875 +++++---- src/classes/PMusrT0.cpp | 119 +- src/classes/PPrepFourier.cpp | 40 +- src/classes/PRunAsymmetry.cpp | 353 ++-- src/classes/PRunAsymmetryRRF.cpp | 337 ++-- src/classes/PRunBase.cpp | 41 +- src/classes/PRunDataHandler.cpp | 1257 +++++++------ src/classes/PRunListCollection.cpp | 64 +- src/classes/PRunMuMinus.cpp | 184 +- src/classes/PRunNonMusr.cpp | 24 +- src/classes/PRunSingleHisto.cpp | 324 ++-- src/classes/PRunSingleHistoRRF.cpp | 227 +-- src/classes/PStartupHandler.cpp | 221 ++- src/classes/PTheory.cpp | 271 +-- src/classes/PUserFcn.cpp | 5 +- src/classes/PUserFcnBase.cpp | 15 +- src/dump_header.cpp | 494 ++--- src/external/BMWtools/BMWIntegrator.h | 52 +- src/external/BMWtools/BMWStartupHandler.cpp | 91 +- src/external/BMWtools/BMWStartupHandler.h | 22 +- src/external/MagProximity/PMPRgeHandler.cpp | 15 +- src/external/MagProximity/PMPRgeHandler.h | 2 +- .../MagProximity/PMPStartupHandler.cpp | 25 +- src/external/MagProximity/PMPStartupHandler.h | 2 +- .../MagProximity/PMPStartupHandlerLinkDef.h | 2 +- src/external/MagProximity/PMagProximity.h | 2 +- .../MagProximity/PMagProximityFitter.cpp | 46 +- .../MagProximity/PMagProximityFitter.h | 4 +- .../MagProximity/PMagProximityFitterLinkDef.h | 2 +- .../Class_MuSR_PSI/MuSR_td_PSI_bin.cpp | 466 ++--- .../Class_MuSR_PSI/MuSR_td_PSI_bin.h | 116 +- src/external/MusrRoot/TMusrRunHeader.cpp | 121 +- src/external/MusrRoot/TMusrRunHeader.h | 25 +- src/external/MusrRoot/TMusrRunHeaderLinkDef.h | 2 +- src/external/Nonlocal/PNL_PippardFitter.cpp | 2 +- src/external/Nonlocal/PNL_PippardFitter.h | 2 +- .../Nonlocal/PNL_PippardFitterLinkDef.h | 2 +- src/external/Nonlocal/PNL_RgeHandler.cpp | 11 +- src/external/Nonlocal/PNL_RgeHandler.h | 2 +- src/external/Nonlocal/PNL_StartupHandler.cpp | 35 +- src/external/Nonlocal/PNL_StartupHandler.h | 2 +- .../Nonlocal/PNL_StartupHandlerLinkDef.h | 2 +- src/external/Nonlocal/PNonlocal.h | 2 +- src/external/TLemRunHeader/TLemRunHeader.cxx | 3 - src/external/libBNMR/TBNMR.cpp | 4 +- src/external/libBNMR/TBNMR.h | 8 +- .../TCalcMeanFieldsLEM.cpp | 115 +- .../libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h | 28 +- src/external/libFitPofB/classes/TBofZCalc.cpp | 52 +- .../classes/TBulkTriVortexFieldCalc.cpp | 97 +- .../classes/TFilmTriVortexFieldCalc.cpp | 81 +- src/external/libFitPofB/classes/TLondon1D.cpp | 57 +- src/external/libFitPofB/classes/TPofBCalc.cpp | 24 +- src/external/libFitPofB/classes/TPofTCalc.cpp | 50 +- .../libFitPofB/classes/TSkewedGss.cpp | 9 +- src/external/libFitPofB/classes/TVortex.cpp | 43 +- src/external/libFitPofB/include/TBofZCalc.h | 39 +- .../include/TBulkTriVortexFieldCalc.h | 25 +- .../include/TFilmTriVortexFieldCalc.h | 17 +- src/external/libFitPofB/include/TLondon1D.h | 76 +- src/external/libFitPofB/include/TPofBCalc.h | 18 +- src/external/libFitPofB/include/TPofTCalc.h | 6 +- src/external/libFitPofB/include/TSkewedGss.h | 12 +- src/external/libFitPofB/include/TVortex.h | 132 +- .../libGapIntegrals/TGapIntegrals.cpp | 113 +- src/external/libGapIntegrals/TGapIntegrals.h | 162 +- src/external/libGbGLF/PGbGLF.cpp | 5 +- src/external/libGbGLF/PGbGLF.h | 5 +- src/external/libGbGLF/PGbGLFLinkDef.h | 2 +- .../libLFRelaxation/TLFRelaxation.cpp | 48 +- src/external/libLFRelaxation/TLFRelaxation.h | 38 +- .../classes/PStartupHandler_PM.cpp | 46 +- .../libPhotoMeissner/include/PPhotoMeissner.h | 11 +- .../include/PPhotoMeissnerLinkDef.h | 2 +- .../include/PStartupHandler_PM.h | 2 +- .../include/PStartupHandler_PMLinkDef.h | 2 +- .../classes/PSkewedLorentzian.cpp | 43 +- .../classes/PStartupHandler_SV.cpp | 29 +- .../libSpinValve/include/PSkewedLorentzian.h | 7 +- .../include/PSkewedLorentzianLinkDef.h | 2 +- .../libSpinValve/include/PStartupHandler_SV.h | 2 +- .../include/PStartupHandler_SVLinkDef.h | 2 +- src/external/libZFRelaxation/ZFRelaxation.cpp | 26 +- src/external/libZFRelaxation/ZFRelaxation.h | 13 +- src/external/nexus/PNeXus.cpp | 729 ++++---- src/external/nexus/PNeXus.h | 395 ++-- src/include/PFitter.h | 2 +- src/include/PFitterFcn.h | 2 +- src/include/PFourier.h | 27 +- src/include/PFourierCanvas.h | 14 +- src/include/PFourierCanvasLinkDef.h | 2 +- src/include/PFunction.h | 12 +- src/include/PFunctionGrammar.h | 5 +- src/include/PFunctionHandler.h | 9 +- src/include/PMsr2Data.h | 31 +- src/include/PMsrHandler.h | 8 +- src/include/PMusr.h | 57 +- src/include/PMusrCanvas.h | 8 +- src/include/PMusrCanvasLinkDef.h | 2 +- src/include/PMusrT0.h | 8 +- src/include/PMusrT0LinkDef.h | 2 +- src/include/PPrepFourier.h | 9 +- src/include/PRunAsymmetry.h | 2 +- src/include/PRunAsymmetryRRF.h | 2 +- src/include/PRunBase.h | 9 +- src/include/PRunDataHandler.h | 7 +- src/include/PRunListCollection.h | 15 +- src/include/PRunMuMinus.h | 2 +- src/include/PRunNonMusr.h | 2 +- src/include/PRunSingleHisto.h | 2 +- src/include/PRunSingleHistoRRF.h | 2 +- src/include/PStartupHandler.h | 2 +- src/include/PStartupHandlerLinkDef.h | 2 +- src/include/PTheory.h | 4 +- src/include/PUserFcn.h | 2 +- src/include/PUserFcnBase.h | 5 +- src/include/PUserFcnBaseLinkDef.h | 2 +- src/msr2data.cpp | 389 ++-- src/msr2msr.cpp | 107 +- src/musrFT.cpp | 403 ++-- src/musrRootValidation.cpp | 109 +- src/musrfit.cpp | 179 +- src/musrt0.cpp | 111 +- src/musrview.cpp | 105 +- src/write_musrRoot_runHeader.cpp | 13 +- 136 files changed, 6870 insertions(+), 7085 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 55df6f7a..90423d17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # - musrfit cmake_minimum_required(VERSION 3.6) -project(musrfit VERSION 1.4.2 LANGUAGES C CXX) +project(musrfit VERSION 1.4.3 LANGUAGES C CXX) #--- musrfit specific options ------------------------------------------------- option(nexus "build optional NeXus support. Needed for ISIS" OFF) diff --git a/src/any2many.cpp b/src/any2many.cpp index 9de7779d..6dbf7186 100644 --- a/src/any2many.cpp +++ b/src/any2many.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2014 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 * @@ -37,7 +37,6 @@ #include #include -using namespace std; #include #include @@ -53,85 +52,85 @@ using namespace std; */ void any2many_syntax() { - cout << endl << "usage: any2many [--help] : will show this help."; - cout << endl << " any2many --version : will show the git version."; - cout << endl << " any2many -f | -r "; - cout << endl << " -c [-p ] [-y ]"; - cout << endl << " [-o | -t ] [-s]"; - cout << endl << " [-rebin ] [-z ]"; - cout << endl << " -f : where is space"; - cout << endl << " separeted a list of file names (not starting with a '-'),"; - cout << endl << " e.g. 2010/lem10_his_0111.root 2010/lem10_his_0112.root"; - cout << endl << " -o : this option only makes sense, if "; - cout << endl << " is a single input file name!"; - cout << endl << " -r : where is a list of run numbers"; - cout << endl << " separated by spaces ' ' of the form: "; - cout << endl << " etc., or a sequence of runs -, e.g. 111-222"; - cout << endl << " -t : "; - cout << endl << " : template file name. Needed for run-lists in"; - cout << endl << " order to generate the proper file names. The following template"; - cout << endl << " tags can be used: [yy] for year, and [rrrr] for the run number."; - cout << endl << " If the run number tag is used, the number of 'r' will give the"; - cout << endl << " number of digits used with leading zeros, e.g. [rrrrrr] and run"; - cout << endl << " number 123 will result in 000123. The same is true for the"; - cout << endl << " year, i.e. [yyyy] will result in something like 1999."; - cout << endl << " -c : "; - cout << endl << " : input data file format. Supported formats are:"; - cout << endl << " MusrRoot, PSI-BIN, ROOT (LEM), MUD, NeXus, PSI-MDU, WKM"; - cout << endl << " : ouput data file format. Supported formats are:"; - cout << endl << " PSI-BIN, MusrRoot, ROOT, MUD, NeXus1-HDF4, NeXus1-HDF5, NeXus1-XML,"; - cout << endl << " NeXus2-HDF4, NeXus2-HDF5, NeXus2-XML, WKM, ASCII"; - cout << endl << " Comment: ROOT is superseeded by MusrRoot. If there is not a very good"; - cout << endl << " reason, avoid it!"; - cout << endl << " -h : This option is for MusrRoot input files only!"; - cout << endl << " Select the the histo groups to be exported. is a space"; - cout << endl << " separated list of the histo group, e.g. -h 0, 20 will try to export the histo"; - cout << endl << " 0 (NPP) and 20 (PPC)."; - cout << endl << " -p : where is the output path for the"; - cout << endl << " converted files. If nothing is given, the current directory"; - cout << endl << " will be used, unless the option '-s' is used."; - cout << endl << " -y : if the option -y is used, here a year in the form 'yy' or 'yyyy' can"; - cout << endl << " be given, if this is the case, any automatic file name"; - cout << endl << " generation needs a year, this number will be used."; - cout << endl << " -s : with this option the output data file will be sent to the stdout."; - cout << endl << " -rebin : where is the number of bins to be packed"; - cout << endl << " -z [g|b] : where is the output file name"; - cout << endl << " (without extension) of the compressed data collection, and"; - cout << endl << " 'g' will result in .tar.gz, and 'b' in .tar.bz2 files."; - cout << endl; - cout << endl << " If the template option '-t' is absent, the output file name will be"; - cout << endl << " generated according to the input data file name, and the output data"; - cout << endl << " format."; - cout << endl; - cout << endl << "examples:" << endl; - cout << endl << " any2many -f 2010/lem10_his_0123.root -c ROOT ASCII -rebin 25"; - cout << endl << " Will take the LEM ROOT file '2010/lem10_his_0123.root' rebin it with 25"; - cout << endl << " and convert it to ASCII. The output file name will be"; - cout << endl << " lem10_his_0123.ascii, and the file will be saved in the current directory." << endl; - cout << endl << " any2many -f 2010/lem10_his_0123.root -c MusrRoot NEXUS2-HDF5 -o 2010/lem10_his_0123_v2.nxs"; - cout << endl << " Will take the MusrRoot file '2010/lem10_his_0123.root' "; - cout << endl << " and convert it to NeXus IDF V2. The output file name will be"; - cout << endl << " lem10_his_0123_v2.nxs, and the file will be saved in the current directory." << endl; - cout << endl << " any2many -r 123 137 -c PSI-BIN MUD -t d[yyyy]/deltat_tdc_gps_[rrrr].bin \\"; - cout << endl << " [rrrrrr].msr -y 2001"; - cout << endl << " Will take the run 123 and 137, will generate the input file names:"; - cout << endl << " d2001/deltat_tdc_gps_0123.bin and d2001/deltat_tdc_gps_0137.bin, and"; - cout << endl << " output file names 000123.msr and 000137.msr" << endl; - cout << endl << " any2many -r 100-117 -c PSI-MDU ASCII -t d[yyyy]/deltat_tdc_alc_[rrrr].mdu \\"; - cout << endl << " [rrr].ascii -y 2011 -s"; - cout << endl << " Will take the runs 100 through 117 and convert the PSI-MDU input files to"; - cout << endl << " ASCII output and instead of saving them into a file, they will be spit to"; - cout << endl << " the standard output." << endl; - cout << endl << " any2many -r 100-117 -c NEXUS MusrRoot -t d[yyyy]/psi_gps_[rrrr].NXS \\"; - cout << endl << " psi_[yyyy]_gps_[rrrr].root -z b psi_gps_run_100to117"; - cout << endl << " Will take the runs 100 through 117 and convert the NEXUS input files"; - cout << endl << " to MusrRoot output. Afterwards these new files will be collected in a"; - cout << endl << " compressed archive psi_gps_run_100to117.tar.bz2." << endl; - cout << endl << " any2many -f 2010/lem10_his_0123.root 2010/lem10_his_0012.root -c MusrRoot MusrRoot -rebin 25"; - cout << endl << " Will read the two files '2010/lem10_his_0123.root' and '2010/lem10_his_0012.root',"; - cout << endl << " rebin them with 25 and export them as LEM ROOT files with adding rebin25 to the"; - cout << endl << " name, e.g. 2010/lem10_his_0123_rebin25.root"; - cout << endl << endl; + std::cout << std::endl << "usage: any2many [--help] : will show this help."; + std::cout << std::endl << " any2many --version : will show the git version."; + std::cout << std::endl << " any2many -f | -r "; + std::cout << std::endl << " -c [-p ] [-y ]"; + std::cout << std::endl << " [-o | -t ] [-s]"; + std::cout << std::endl << " [-rebin ] [-z ]"; + std::cout << std::endl << " -f : where is space"; + std::cout << std::endl << " separeted a list of file names (not starting with a '-'),"; + std::cout << std::endl << " e.g. 2010/lem10_his_0111.root 2010/lem10_his_0112.root"; + std::cout << std::endl << " -o : this option only makes sense, if "; + std::cout << std::endl << " is a single input file name!"; + std::cout << std::endl << " -r : where is a list of run numbers"; + std::cout << std::endl << " separated by spaces ' ' of the form: "; + std::cout << std::endl << " etc., or a sequence of runs -, e.g. 111-222"; + std::cout << std::endl << " -t : "; + std::cout << std::endl << " : template file name. Needed for run-lists in"; + std::cout << std::endl << " order to generate the proper file names. The following template"; + std::cout << std::endl << " tags can be used: [yy] for year, and [rrrr] for the run number."; + std::cout << std::endl << " If the run number tag is used, the number of 'r' will give the"; + std::cout << std::endl << " number of digits used with leading zeros, e.g. [rrrrrr] and run"; + std::cout << std::endl << " number 123 will result in 000123. The same is true for the"; + std::cout << std::endl << " year, i.e. [yyyy] will result in something like 1999."; + std::cout << std::endl << " -c : "; + std::cout << std::endl << " : input data file format. Supported formats are:"; + std::cout << std::endl << " MusrRoot, PSI-BIN, ROOT (LEM), MUD, NeXus, PSI-MDU, WKM"; + std::cout << std::endl << " : ouput data file format. Supported formats are:"; + std::cout << std::endl << " PSI-BIN, MusrRoot, ROOT, MUD, NeXus1-HDF4, NeXus1-HDF5, NeXus1-XML,"; + std::cout << std::endl << " NeXus2-HDF4, NeXus2-HDF5, NeXus2-XML, WKM, ASCII"; + std::cout << std::endl << " Comment: ROOT is superseeded by MusrRoot. If there is not a very good"; + std::cout << std::endl << " reason, avoid it!"; + std::cout << std::endl << " -h : This option is for MusrRoot input files only!"; + std::cout << std::endl << " Select the the histo groups to be exported. is a space"; + std::cout << std::endl << " separated list of the histo group, e.g. -h 0, 20 will try to export the histo"; + std::cout << std::endl << " 0 (NPP) and 20 (PPC)."; + std::cout << std::endl << " -p : where is the output path for the"; + std::cout << std::endl << " converted files. If nothing is given, the current directory"; + std::cout << std::endl << " will be used, unless the option '-s' is used."; + std::cout << std::endl << " -y : if the option -y is used, here a year in the form 'yy' or 'yyyy' can"; + std::cout << std::endl << " be given, if this is the case, any automatic file name"; + std::cout << std::endl << " generation needs a year, this number will be used."; + std::cout << std::endl << " -s : with this option the output data file will be sent to the stdout."; + std::cout << std::endl << " -rebin : where is the number of bins to be packed"; + std::cout << std::endl << " -z [g|b] : where is the output file name"; + std::cout << std::endl << " (without extension) of the compressed data collection, and"; + std::cout << std::endl << " 'g' will result in .tar.gz, and 'b' in .tar.bz2 files."; + std::cout << std::endl; + std::cout << std::endl << " If the template option '-t' is absent, the output file name will be"; + std::cout << std::endl << " generated according to the input data file name, and the output data"; + std::cout << std::endl << " format."; + std::cout << std::endl; + std::cout << std::endl << "examples:" << std::endl; + std::cout << std::endl << " any2many -f 2010/lem10_his_0123.root -c ROOT ASCII -rebin 25"; + std::cout << std::endl << " Will take the LEM ROOT file '2010/lem10_his_0123.root' rebin it with 25"; + std::cout << std::endl << " and convert it to ASCII. The output file name will be"; + std::cout << std::endl << " lem10_his_0123.ascii, and the file will be saved in the current directory." << std::endl; + std::cout << std::endl << " any2many -f 2010/lem10_his_0123.root -c MusrRoot NEXUS2-HDF5 -o 2010/lem10_his_0123_v2.nxs"; + std::cout << std::endl << " Will take the MusrRoot file '2010/lem10_his_0123.root' "; + std::cout << std::endl << " and convert it to NeXus IDF V2. The output file name will be"; + std::cout << std::endl << " lem10_his_0123_v2.nxs, and the file will be saved in the current directory." << std::endl; + std::cout << std::endl << " any2many -r 123 137 -c PSI-BIN MUD -t d[yyyy]/deltat_tdc_gps_[rrrr].bin \\"; + std::cout << std::endl << " [rrrrrr].msr -y 2001"; + std::cout << std::endl << " Will take the run 123 and 137, will generate the input file names:"; + std::cout << std::endl << " d2001/deltat_tdc_gps_0123.bin and d2001/deltat_tdc_gps_0137.bin, and"; + std::cout << std::endl << " output file names 000123.msr and 000137.msr" << std::endl; + std::cout << std::endl << " any2many -r 100-117 -c PSI-MDU ASCII -t d[yyyy]/deltat_tdc_alc_[rrrr].mdu \\"; + std::cout << std::endl << " [rrr].ascii -y 2011 -s"; + std::cout << std::endl << " Will take the runs 100 through 117 and convert the PSI-MDU input files to"; + std::cout << std::endl << " ASCII output and instead of saving them into a file, they will be spit to"; + std::cout << std::endl << " the standard output." << std::endl; + std::cout << std::endl << " any2many -r 100-117 -c NEXUS MusrRoot -t d[yyyy]/psi_gps_[rrrr].NXS \\"; + std::cout << std::endl << " psi_[yyyy]_gps_[rrrr].root -z b psi_gps_run_100to117"; + std::cout << std::endl << " Will take the runs 100 through 117 and convert the NEXUS input files"; + std::cout << std::endl << " to MusrRoot output. Afterwards these new files will be collected in a"; + std::cout << std::endl << " compressed archive psi_gps_run_100to117.tar.bz2." << std::endl; + std::cout << std::endl << " any2many -f 2010/lem10_his_0123.root 2010/lem10_his_0012.root -c MusrRoot MusrRoot -rebin 25"; + std::cout << std::endl << " Will read the two files '2010/lem10_his_0123.root' and '2010/lem10_his_0012.root',"; + std::cout << std::endl << " rebin them with 25 and export them as LEM ROOT files with adding rebin25 to the"; + std::cout << std::endl << " name, e.g. 2010/lem10_his_0123_rebin25.root"; + std::cout << std::endl << std::endl; } //-------------------------------------------------------------------------- @@ -198,9 +197,9 @@ int main(int argc, char *argv[]) any2many_syntax(); else if (strstr(argv[1], "--v")) { #ifdef HAVE_CONFIG_H - cout << endl << "any2many version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl; + std::cout << std::endl << "any2many version: " << PACKAGE_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl; #else - cout << endl << "any2many git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << endl << endl; + std::cout << std::endl << "any2many git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1 << std::endl << std::endl; #endif } else { any2many_syntax(); @@ -219,7 +218,7 @@ int main(int argc, char *argv[]) if (i+1 < argc) { // check that date if it is either of the form 'yy' or 'yyyy' if ((strlen(argv[i+1]) != 2) && (strlen(argv[i+1]) != 4)) { - cerr << endl << ">> any2many **ERROR** found in option '-y' the argument '" << argv[i+1] << "' which is neither of the form 'yy' nor 'yyyy'." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found in option '-y' the argument '" << argv[i+1] << "' which is neither of the form 'yy' nor 'yyyy'." << std::endl; show_syntax = true; break; } @@ -229,7 +228,7 @@ int main(int argc, char *argv[]) info.year = argv[i+1]; i++; } else { - cerr << endl << ">> any2many **ERROR** found in option '-y' the argument '" << argv[i+1] << "' which is not a number." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found in option '-y' the argument '" << argv[i+1] << "' which is not a number." << std::endl; show_syntax = true; break; } @@ -255,7 +254,7 @@ int main(int argc, char *argv[]) if (j >= argc) // make sure that counter is still in range break; } else { - cerr << endl << ">> any2many **ERROR** found input option '-f' without any arguments" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found input option '-f' without any arguments" << std::endl; show_syntax = true; break; } @@ -264,7 +263,7 @@ int main(int argc, char *argv[]) outputFileName = argv[i+1]; i++; } else { - cerr << endl << ">> any2many **ERROR** found output file name option '-o' without any arguments" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found output file name option '-o' without any arguments" << std::endl; show_syntax = true; break; } @@ -299,20 +298,20 @@ int main(int argc, char *argv[]) break; } } else { - cerr << endl << ">> any2many **ERROR** found input option '-r' without any arguments" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found input option '-r' without any arguments" << std::endl; show_syntax = true; break; } // check if any valid input option was found if (info.runList.size() == 0) { - cerr << endl << ">> any2many **ERROR** found input option '-r' without any valid arguments" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found input option '-r' without any valid arguments" << std::endl; show_syntax = true; break; } } else if (!strcmp(argv[i], "-c")) { // set convert option tag bool found = false; - string sval; + std::string sval; if (i+2 < argc) { sval = argv[i+1]; found = false; @@ -324,7 +323,7 @@ int main(int argc, char *argv[]) } } if (!found) { - cerr << endl << ">> any2many **ERROR** found unkown input data file format option '" << sval << "'" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found unkown input data file format option '" << sval << "'" << std::endl; show_syntax = true; break; } @@ -338,13 +337,13 @@ int main(int argc, char *argv[]) } } if (!found) { - cerr << endl << ">> any2many **ERROR** found unkown output data file format option '" << sval << "'" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found unkown output data file format option '" << sval << "'" << std::endl; show_syntax = true; break; } i += 2; // shift argument position } else { - cerr << endl << ">> any2many **ERROR** found option '-c' with missing arguments" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found option '-c' with missing arguments" << std::endl; show_syntax = true; break; } @@ -370,7 +369,7 @@ int main(int argc, char *argv[]) info.outPath += "/"; i++; } else { - cerr << endl << ">> any2many **ERROR** found output option '-p' without any argument." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found output option '-p' without any argument." << std::endl; show_syntax = true; break; } @@ -381,19 +380,19 @@ int main(int argc, char *argv[]) info.rebin = ival; i++; } else { - cerr << endl << ">> any2many **ERROR** found in option '-rebin " << argv[i+1] << "' which doesn't make any sense." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found in option '-rebin " << argv[i+1] << "' which doesn't make any sense." << std::endl; show_syntax = true; break; } } else { - cerr << endl << ">> any2many **ERROR** found output option '-rebin' without any argument." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found output option '-rebin' without any argument." << std::endl; show_syntax = true; break; } } else if (!strcmp(argv[i], "-t")) { // filter out the input/output file template if (i+2 < argc) { if ((argv[i+1][0] == '-') || (argv[i+2][0] == '-')) { - cerr << endl << ">> any2many **ERROR** found invalid template in option '-t'" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found invalid template in option '-t'" << std::endl; show_syntax = true; break; } @@ -401,14 +400,14 @@ int main(int argc, char *argv[]) info.outTemplate = argv[i+2]; i += 2; // shift argument position } else { - cerr << endl << ">> any2many **ERROR** found option '-t' with missing arguments" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found option '-t' with missing arguments" << std::endl; show_syntax = true; break; } } else if (!strcmp(argv[i], "-z")) { // filter out if compression is whished if (i+2 < argc) { if ((argv[i+1][0] == '-') || (argv[i+2][0] == '-')) { - cerr << endl << ">> any2many **ERROR** found invalid template in option '-t'" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found invalid template in option '-t'" << std::endl; show_syntax = true; break; } @@ -417,19 +416,19 @@ int main(int argc, char *argv[]) } else if (argv[i+1][0] == 'b') { info.compressionTag = 2; } else { - cerr << endl << ">> any2many **ERROR** found in option '-z' compression tag '" << argv[i+1] << "' which is not supported." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found in option '-z' compression tag '" << argv[i+1] << "' which is not supported." << std::endl; show_syntax = true; break; } info.compressFileName = argv[i+2]; i += 2; // shift argument position } else { - cerr << endl << ">> any2many **ERROR** found option '-z' with missing arguments" << endl; + std::cerr << std::endl << ">> any2many **ERROR** found option '-z' with missing arguments" << std::endl; show_syntax = true; break; } } else { // unrecognized command - cerr << endl << ">> any2many **ERROR** found unrecognized option " << argv[i] << endl; + std::cerr << std::endl << ">> any2many **ERROR** found unrecognized option " << argv[i] << std::endl; show_syntax = true; break; } @@ -437,13 +436,13 @@ int main(int argc, char *argv[]) // make sure that either a filenameList or a runList has been provided if ((info.inFileName.size()==0) && (info.runList.size()==0)) { - cerr << endl << ">> any2many **ERROR** neither a input filename list, nor a run list was given." << endl; + std::cerr << std::endl << ">> any2many **ERROR** neither a input filename list, nor a run list was given." << std::endl; show_syntax = true; } // make sure that in/out formats are given if ((info.inFormat.Length() == 0) || (info.outFormat.Length() == 0)) { - cerr << endl << ">> any2many **ERROR** conversion information is missing." << endl; + std::cerr << std::endl << ">> any2many **ERROR** conversion information is missing." << std::endl; show_syntax = true; } @@ -460,11 +459,11 @@ int main(int argc, char *argv[]) if ((info.inTemplate.Length() == 0) && (info.outTemplate.Length() == 0)) { info.outFileName = outputFileName; } else { - cerr << endl << ">> any2many **ERROR** found option '-o' cannot be combined with option '-t'." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found option '-o' cannot be combined with option '-t'." << std::endl; show_syntax = true; } } else { - cerr << endl << ">> any2many **ERROR** found option '-o' with multiple input file names, which doesn't make any sense." << endl; + std::cerr << std::endl << ">> any2many **ERROR** found option '-o' with multiple input file names, which doesn't make any sense." << std::endl; show_syntax = true; } } @@ -477,8 +476,8 @@ int main(int argc, char *argv[]) if (!info.inFormat.CompareTo(info.outFormat, TString::kIgnoreCase) && (info.rebin == 1)) { info.runList.clear(); - cout << endl << ">> any2many **ERROR** input data format == output data format, only allowed if rebin != 1."; - cout << endl << " will ignore the request." << endl << endl; + std::cerr << std::endl << ">> any2many **ERROR** input data format == output data format, only allowed if rebin != 1."; + std::cerr << std::endl << " will ignore the request." << std::endl << std::endl; return PMUSR_SUCCESS; } @@ -487,16 +486,16 @@ int main(int argc, char *argv[]) TSAXParser *saxParser = new TSAXParser(); PStartupHandler *startupHandler = new PStartupHandler(); if (!startupHandler->StartupFileFound()) { - cerr << endl << ">> any2many **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data(); - cerr << endl; + std::cerr << std::endl << ">> any2many **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data(); + std::cerr << std::endl; // clean up if (saxParser) { delete saxParser; - saxParser = 0; + saxParser = nullptr; } if (startupHandler) { delete startupHandler; - startupHandler = 0; + startupHandler = nullptr; } } else { strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data()); @@ -507,16 +506,16 @@ int main(int argc, char *argv[]) status = parseXmlFile(saxParser, startup_path_name); // check for parse errors if (status) { // error - cerr << endl << ">> any2many **WARNING** Reading/parsing musrfit_startup.xml failed."; - cerr << endl; + std::cerr << std::endl << ">> any2many **WARNING** Reading/parsing musrfit_startup.xml failed."; + std::cerr << std::endl; // clean up if (saxParser) { delete saxParser; - saxParser = 0; + saxParser = nullptr; } if (startupHandler) { delete startupHandler; - startupHandler = 0; + startupHandler = nullptr; } } } @@ -534,22 +533,22 @@ int main(int argc, char *argv[]) // check if it has been successfull bool success = dataHandler->IsAllDataAvailable(); if (!success) { - cout << endl << ">> any2many **ERROR** Couldn't read all data files, will quit ..." << endl; + std::cerr << std::endl << ">> any2many **ERROR** Couldn't read all data files, will quit ..." << std::endl; } // clean up info.runList.clear(); if (saxParser) { delete saxParser; - saxParser = 0; + saxParser = nullptr; } if (startupHandler) { delete startupHandler; - startupHandler = 0; + startupHandler = nullptr; } if (dataHandler) { delete dataHandler; - dataHandler = 0; + dataHandler = nullptr; } return PMUSR_SUCCESS; diff --git a/src/classes/PFitter.cpp b/src/classes/PFitter.cpp index 09733447..c9f5db4b 100644 --- a/src/classes/PFitter.cpp +++ b/src/classes/PFitter.cpp @@ -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 * @@ -41,7 +41,6 @@ #include #include -using namespace std; #include @@ -92,8 +91,8 @@ PFitter::PFitter(PMsrHandler *runInfo, PRunListCollection *runListCollection, Bo fCmdLines = *runInfo->GetMsrCommands(); // init class variables - fFitterFcn = 0; - fFcnMin = 0; + fFitterFcn = nullptr; + fFcnMin = nullptr; fScanAll = true; fScanParameter[0] = 0; @@ -141,12 +140,12 @@ PFitter::~PFitter() if (fFcnMin) { delete fFcnMin; - fFcnMin = 0; + fFcnMin = nullptr; } if (fFitterFcn) { delete fFitterFcn; - fFitterFcn = 0; + fFitterFcn = nullptr; } } @@ -172,7 +171,7 @@ Bool_t PFitter::DoFit() if (error[i] != 0.0) usedParams++; } - Int_t ndf = fFitterFcn->GetTotalNoOfFittedBins() - usedParams; + Int_t ndf = static_cast(fFitterFcn->GetTotalNoOfFittedBins()) - usedParams; Double_t val = (*fFitterFcn)(param); if (fUseChi2) { // calculate expected chisq @@ -185,22 +184,22 @@ Bool_t PFitter::DoFit() chisqPerHisto.push_back(fRunListCollection->GetSingleRunChisq(param, i)); } - cout << endl << endl << ">> chisq = " << val << ", NDF = " << ndf << ", chisq/NDF = " << val/ndf; + std::cout << std::endl << std::endl << ">> chisq = " << val << ", NDF = " << ndf << ", chisq/NDF = " << val/ndf; if (totalExpectedChisq != 0.0) { - cout << endl << ">> expected chisq = " << totalExpectedChisq << ", NDF = " << ndf << ", expected chisq/NDF = " << totalExpectedChisq/ndf; + std::cout << std::endl << ">> expected chisq = " << totalExpectedChisq << ", NDF = " << ndf << ", expected chisq/NDF = " << totalExpectedChisq/ndf; UInt_t ndf_histo = 0; for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); if (ndf_histo > 0) - cout << endl << ">> run block " << i+1 << ": (NDF/red.chisq/red.chisq_e) = (" << ndf_histo << "/" << chisqPerHisto[i]/ndf_histo << "/" << expectedChisqPerHisto[i]/ndf_histo << ")"; + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq/red.chisq_e) = (" << ndf_histo << "/" << chisqPerHisto[i]/ndf_histo << "/" << expectedChisqPerHisto[i]/ndf_histo << ")"; } } else if (chisqPerHisto.size() > 0) { // in case expected chisq is not applicable like for asymmetry fits UInt_t ndf_histo = 0; for (UInt_t i=0; iGetNoOfFittedBins(i) - fRunInfo->GetNoOfFitParameters(i); if (ndf_histo > 0) - cout << endl << ">> run block " << i+1 << ": (NDF/red.chisq) = (" << ndf_histo << "/" << chisqPerHisto[i]/ndf_histo << ")"; + std::cout << std::endl << ">> run block " << i+1 << ": (NDF/red.chisq) = (" << ndf_histo << "/" << chisqPerHisto[i]/ndf_histo << ")"; } } @@ -208,22 +207,22 @@ Bool_t PFitter::DoFit() chisqPerHisto.clear(); expectedChisqPerHisto.clear(); } else { // max. log likelihood - cout << endl << endl << ">> maxLH = " << val << ", NDF = " << ndf << ", maxLH/NDF = " << val/ndf; + std::cout << std::endl << std::endl << ">> maxLH = " << val << ", NDF = " << ndf << ", maxLH/NDF = " << val/ndf; } - cout << endl << endl; + std::cout << std::endl << std::endl; return true; } // debugging information #ifdef HAVE_GOMP - cout << endl << ">> Number of available threads for the function optimization: " << omp_get_num_procs() << endl; + std::cout << std::endl << ">> Number of available threads for the function optimization: " << omp_get_num_procs() << std::endl; #endif // real fit wanted if (fUseChi2) - cout << endl << ">> Chi Square fit will be executed" << endl; + std::cout << std::endl << ">> Chi Square fit will be executed" << std::endl; else - cout << endl << ">> Maximum Likelihood fit will be executed" << endl; + std::cout << std::endl << ">> Maximum Likelihood fit will be executed" << std::endl; Bool_t status = true; // init positive errors to default false, if minos is called, it will be set true there @@ -236,8 +235,8 @@ Bool_t PFitter::DoFit() for (UInt_t i=0; i> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> parameter number is not number!"; - cerr << endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> parameter number is not number!"; + std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } ival = str.Atoi(); // check that parameter is within range if ((ival < 1) || (ival > fParams.size())) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> parameter number is out of range [1," << fParams.size() << "]!"; - cerr << endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> parameter number is out of range [1," << fParams.size() << "]!"; + std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -415,29 +413,29 @@ Bool_t PFitter::CheckCommands() if (i==3) { // check that token is a UInt_t if (!str.IsDigit()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> number of points is not number!"; - cerr << endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> number of points is not number!"; + std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } ival = str.Atoi(); if ((ival < 1) || (ival > 100)) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> number of scan points is out of range [1,100]!"; - cerr << endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> number of scan points is out of range [1,100]!"; + std::cerr << std::endl << ">> command syntax for CONTOURS is: CONTOURS parameter-X parameter-Y [# of points]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -447,7 +445,7 @@ Bool_t PFitter::CheckCommands() if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (it->fLine.Contains("EIGEN", TString::kIgnoreCase)) { cmd.first = PMN_EIGEN; @@ -460,7 +458,7 @@ Bool_t PFitter::CheckCommands() // (iii) FIT_RANGE start1 end1 start2 end2 ... startN endN // (iv) FIT_RANGE fgb+n0 lgb-n1 // (v) FIT_RANGE fgb+n00 lgb-n01 fgb+n10 lgb-n11 ... fgb+nN0 lgb-nN1 - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; @@ -469,35 +467,35 @@ Bool_t PFitter::CheckCommands() if (tokens->GetEntries() == 2) { // should only be RESET ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); - if (str.Contains("RESET"), TString::kIgnoreCase) { + if (str.Contains("RESET", TString::kIgnoreCase)) { cmd.first = PMN_FIT_RANGE; cmd.second = cmdLineNo; fCmdList.push_back(cmd); } else { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE start end | FIT_RANGE s1 e1 s2 e2 .. sN eN,"; - cerr << endl << ">> with N the number of runs in the msr-file." << endl; - cerr << endl << ">> Found " << str.Data() << ", instead of RESET" << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE start end | FIT_RANGE s1 e1 s2 e2 .. sN eN,"; + std::cerr << std::endl << ">> with N the number of runs in the msr-file." << std::endl; + std::cerr << std::endl << ">> Found " << str.Data() << ", instead of RESET" << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } } else if ((tokens->GetEntries() > 1) && (static_cast(tokens->GetEntries()) % 2) == 1) { if ((tokens->GetEntries() > 3) && ((static_cast(tokens->GetEntries())-1)) != 2*fRunInfo->GetMsrRunList()->size()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE | FIT_RANGE .. |"; - cerr << endl << ">> FIT_RANGE fgb+ lgb- | FIT_RANGE fgb+ lgb- fgb+ lgb- ... fgb+ lgb-,"; - cerr << endl << ">> with N the number of runs in the msr-file."; - cerr << endl << ">> Found N=" << (tokens->GetEntries()-1)/2 << ", # runs in msr-file=" << fRunInfo->GetMsrRunList()->size() << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE | FIT_RANGE .. |"; + std::cerr << std::endl << ">> FIT_RANGE fgb+ lgb- | FIT_RANGE fgb+ lgb- fgb+ lgb- ... fgb+ lgb-,"; + std::cerr << std::endl << ">> with N the number of runs in the msr-file."; + std::cerr << std::endl << ">> Found N=" << (tokens->GetEntries()-1)/2 << ", # runs in msr-file=" << fRunInfo->GetMsrRunList()->size() << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } else { @@ -521,41 +519,41 @@ Bool_t PFitter::CheckCommands() cmd.second = cmdLineNo; fCmdList.push_back(cmd); } else { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE | FIT_RANGE .. |"; - cerr << endl << ">> FIT_RANGE fgb+ lgb- | FIT_RANGE fgb+ lgb- fgb+ lgb- ... fgb+ lgb-,"; - cerr << endl << ">> with N the number of runs in the msr-file."; - cerr << endl << ">> Found token '" << str.Data() << "', which is not a floating point number." << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE | FIT_RANGE .. |"; + std::cerr << std::endl << ">> FIT_RANGE fgb+ lgb- | FIT_RANGE fgb+ lgb- fgb+ lgb- ... fgb+ lgb-,"; + std::cerr << std::endl << ">> with N the number of runs in the msr-file."; + std::cerr << std::endl << ">> Found token '" << str.Data() << "', which is not a floating point number." << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } } } else { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE | FIT_RANGE .. |"; - cerr << endl << ">> FIT_RANGE fgb+ lgb- | FIT_RANGE fgb+ lgb- fgb+ lgb- ... fgb+ lgb-,"; - cerr << endl << ">> with N the number of runs in the msr-file."; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Syntax: FIT_RANGE RESET | FIT_RANGE | FIT_RANGE .. |"; + std::cerr << std::endl << ">> FIT_RANGE fgb+ lgb- | FIT_RANGE fgb+ lgb- fgb+ lgb- ... fgb+ lgb-,"; + std::cerr << std::endl << ">> with N the number of runs in the msr-file."; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (it->fLine.Contains("FIX", TString::kIgnoreCase)) { // check if the given set of parameters (number or names) is present - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; UInt_t ival; @@ -570,14 +568,14 @@ Bool_t PFitter::CheckCommands() ival = str.Atoi(); // check that ival is in the parameter list if (ival > fParams.size()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Parameter " << ival << " is out of the Parameter Range [1," << fParams.size() << "]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Parameter " << ival << " is out of the Parameter Range [1," << fParams.size() << "]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -591,14 +589,14 @@ Bool_t PFitter::CheckCommands() } } if (!found) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Parameter '" << str.Data() << "' is NOT present as a parameter name"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Parameter '" << str.Data() << "' is NOT present as a parameter name"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -607,7 +605,7 @@ Bool_t PFitter::CheckCommands() if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } // everything looks fine, feed the command list @@ -648,7 +646,7 @@ Bool_t PFitter::CheckCommands() fCmdList.push_back(cmd); } else if (it->fLine.Contains("RELEASE", TString::kIgnoreCase)) { // check if the given set of parameters (number or names) is present - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; UInt_t ival; @@ -663,14 +661,14 @@ Bool_t PFitter::CheckCommands() ival = str.Atoi(); // check that ival is in the parameter list if (ival > fParams.size()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Parameter " << ival << " is out of the Parameter Range [1," << fParams.size() << "]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Parameter " << ival << " is out of the Parameter Range [1," << fParams.size() << "]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -684,14 +682,14 @@ Bool_t PFitter::CheckCommands() } } if (!found) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Parameter '" << str.Data() << "' is NOT present as a parameter name"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Parameter '" << str.Data() << "' is NOT present as a parameter name"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -700,7 +698,7 @@ Bool_t PFitter::CheckCommands() if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } cmd.first = PMN_RELEASE; cmd.second = cmdLineNo; @@ -718,7 +716,7 @@ Bool_t PFitter::CheckCommands() cmd.second = cmdLineNo; fCmdList.push_back(cmd); // filter out possible parameters for scan - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; UInt_t ival; @@ -731,30 +729,30 @@ Bool_t PFitter::CheckCommands() if (i==1) { // get parameter number // check that token is a UInt_t if (!str.IsDigit()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> parameter number is not number!"; - cerr << endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> parameter number is not number!"; + std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } ival = str.Atoi(); // check that parameter is within range if ((ival < 1) || (ival > fParams.size())) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> parameter number is out of range [1," << fParams.size() << "]!"; - cerr << endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> parameter number is out of range [1," << fParams.size() << "]!"; + std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -766,29 +764,29 @@ Bool_t PFitter::CheckCommands() if (i==2) { // get number of points // check that token is a UInt_t if (!str.IsDigit()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> number of points is not number!"; - cerr << endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> number of points is not number!"; + std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } ival = str.Atoi(); if ((ival < 1) || (ival > 100)) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> number of scan points is out of range [1,100]!"; - cerr << endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> number of scan points is out of range [1,100]!"; + std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -798,15 +796,15 @@ Bool_t PFitter::CheckCommands() if (i==3) { // get low // check that token is a Double_t if (!str.IsFloat()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> low is not a floating point number!"; - cerr << endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> low is not a floating point number!"; + std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -816,15 +814,15 @@ Bool_t PFitter::CheckCommands() if (i==4) { // get high // check that token is a Double_t if (!str.IsFloat()) { - cerr << endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> high is not a floating point number!"; - cerr << endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands: **ERROR** in line " << it->fLineNo; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> high is not a floating point number!"; + std::cerr << std::endl << ">> command syntax for SCAN is: SCAN [parameter no [# of points [low high]]]"; + std::cerr << std::endl; fIsValid = false; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } break; } @@ -834,14 +832,14 @@ Bool_t PFitter::CheckCommands() if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (it->fLine.Contains("SIMPLEX", TString::kIgnoreCase)) { cmd.first = PMN_SIMPLEX; cmd.second = cmdLineNo; fCmdList.push_back(cmd); } else if (it->fLine.Contains("STRATEGY", TString::kIgnoreCase)) { - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; @@ -866,7 +864,7 @@ Bool_t PFitter::CheckCommands() if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (it->fLine.Contains("USER_COVARIANCE", TString::kIgnoreCase)) { cmd.first = PMN_USER_COVARIANCE; @@ -877,10 +875,10 @@ Bool_t PFitter::CheckCommands() cmd.second = cmdLineNo; fCmdList.push_back(cmd); } else { // unkown command - cerr << endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo << " an unkown command is found:"; - cerr << endl << ">> " << it->fLine.Data(); - cerr << endl << ">> Will stop ..."; - cerr << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands(): **FATAL ERROR** in line " << it->fLineNo << " an unkown command is found:"; + std::cerr << std::endl << ">> " << it->fLine.Data(); + std::cerr << std::endl << ">> Will stop ..."; + std::cerr << std::endl; fIsValid = false; break; } @@ -904,10 +902,10 @@ Bool_t PFitter::CheckCommands() minimizerFlag = true; } else if (it->fLine.Contains("MINOS", TString::kIgnoreCase)) { if (fixFlag && releaseFlag && !minimizerFlag) { - cerr << endl << ">> PFitter::CheckCommands(): **WARNING** RELEASE/RESTORE command present"; - cerr << endl << ">> without minimizer command (MINIMIZE/MIGRAD/SIMPLEX) between"; - cerr << endl << ">> RELEASE/RESTORE and MINOS. Behaviour might be different to the"; - cerr << endl << ">> expectation of the user ?!?" << endl; + std::cerr << std::endl << ">> PFitter::CheckCommands(): **WARNING** RELEASE/RESTORE command present"; + std::cerr << std::endl << ">> without minimizer command (MINIMIZE/MIGRAD/SIMPLEX) between"; + std::cerr << std::endl << ">> RELEASE/RESTORE and MINOS. Behaviour might be different to the"; + std::cerr << std::endl << ">> expectation of the user ?!?" << std::endl; } fixFlag = false; releaseFlag = false; @@ -959,8 +957,8 @@ Bool_t PFitter::SetParameters() // parameter not used in the whole theory and not already fixed!! if ((fRunInfo->ParameterInUse(i) == 0) && (fParams[i].fStep != 0.0)) { fMnUserParams.Fix(i); // fix the unused parameter so that minuit will not vary it - cerr << endl << "**WARNING** : Parameter No " << i+1 << " is not used at all, will fix it"; - cerr << endl; + std::cerr << std::endl << "**WARNING** : Parameter No " << i+1 << " is not used at all, will fix it"; + std::cerr << std::endl; } } @@ -977,19 +975,19 @@ Bool_t PFitter::SetParameters() */ Bool_t PFitter::ExecuteContours() { - cout << ">> PFitter::ExecuteContours() ..." << endl; + std::cout << ">> PFitter::ExecuteContours() ..." << std::endl; // if already some minimization is done use the minuit2 output as input if (!fFcnMin) { - cerr << endl << "**WARNING**: CONTOURS musn't be called before any minimization (MINIMIZE/MIGRAD/SIMPLEX) is done!!"; - cerr << endl; + std::cerr << std::endl << "**WARNING**: CONTOURS musn't be called before any minimization (MINIMIZE/MIGRAD/SIMPLEX) is done!!"; + std::cerr << std::endl; return false; } // check if minimum was valid if (!fFcnMin->IsValid()) { - cerr << endl << "**ERROR**: CONTOURS cannot started since the previous minimization failed :-("; - cerr << endl; + std::cerr << std::endl << "**ERROR**: CONTOURS cannot started since the previous minimization failed :-("; + std::cerr << std::endl; return false; } @@ -1012,14 +1010,14 @@ Bool_t PFitter::ExecuteContours() */ Bool_t PFitter::ExecuteFitRange(UInt_t lineNo) { - cout << ">> PFitter::ExecuteFitRange(): " << fCmdLines[lineNo].fLine.Data() << endl; + std::cout << ">> PFitter::ExecuteFitRange(): " << fCmdLines[lineNo].fLine.Data() << std::endl; if (fCmdLines[lineNo].fLine.Contains("fgb", TString::kIgnoreCase)) { // fit range given in bins fRunListCollection->SetFitRange(fCmdLines[lineNo].fLine); return true; } - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; @@ -1083,9 +1081,9 @@ Bool_t PFitter::ExecuteFitRange(UInt_t lineNo) */ Bool_t PFitter::ExecuteFix(UInt_t lineNo) { - cout << ">> PFitter::ExecuteFix(): " << fCmdLines[lineNo].fLine.Data() << endl; + std::cout << ">> PFitter::ExecuteFix(): " << fCmdLines[lineNo].fLine.Data() << std::endl; - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; @@ -1105,7 +1103,7 @@ Bool_t PFitter::ExecuteFix(UInt_t lineNo) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } return true; @@ -1121,30 +1119,30 @@ Bool_t PFitter::ExecuteFix(UInt_t lineNo) */ Bool_t PFitter::ExecuteHesse() { - cout << ">> PFitter::ExecuteHesse(): will call hesse ..." << endl; + std::cout << ">> PFitter::ExecuteHesse(): will call hesse ..." << std::endl; // create the hesse object ROOT::Minuit2::MnHesse hesse; // specify maximal number of function calls - UInt_t maxfcn = numeric_limits::max(); + UInt_t maxfcn = std::numeric_limits::max(); // call hesse Double_t start=0.0, end=0.0; start=MilliTime(); ROOT::Minuit2::MnUserParameterState mnState = hesse((*fFitterFcn), fMnUserParams, maxfcn); end=MilliTime(); - cout << ">> PFitter::ExecuteMinimize(): execution time for Hesse = " << setprecision(3) << (end-start)/1.0e3 << " sec." << endl; + std::cout << ">> PFitter::ExecuteMinimize(): execution time for Hesse = " << std::setprecision(3) << (end-start)/1.0e3 << " sec." << std::endl; TString str = TString::Format("Hesse: %.3f sec", (end-start)/1.0e3); fElapsedTime.push_back(str); if (!mnState.IsValid()) { - cerr << endl << ">> PFitter::ExecuteHesse(): **WARNING** Hesse encountered a problem! The state found is invalid."; - cerr << endl; + std::cerr << std::endl << ">> PFitter::ExecuteHesse(): **WARNING** Hesse encountered a problem! The state found is invalid."; + std::cerr << std::endl; return false; } if (!mnState.HasCovariance()) { - cerr << endl << ">> PFitter::ExecuteHesse(): **WARNING** Hesse encountered a problem! No covariance matrix available."; - cerr << endl; + std::cerr << std::endl << ">> PFitter::ExecuteHesse(): **WARNING** Hesse encountered a problem! No covariance matrix available."; + std::cerr << std::endl; return false; } @@ -1155,7 +1153,7 @@ Bool_t PFitter::ExecuteHesse() } if (fPrintLevel >= 2) - cout << mnState << endl; + std::cout << mnState << std::endl; return true; } @@ -1170,7 +1168,7 @@ Bool_t PFitter::ExecuteHesse() */ Bool_t PFitter::ExecuteMigrad() { - cout << ">> PFitter::ExecuteMigrad(): will call migrad ..." << endl; + std::cout << ">> PFitter::ExecuteMigrad(): will call migrad ..." << std::endl; // create migrad object // strategy is by default = 'default' @@ -1178,7 +1176,7 @@ Bool_t PFitter::ExecuteMigrad() // minimize // maxfcn is MINUIT2 Default maxfcn - UInt_t maxfcn = numeric_limits::max(); + UInt_t maxfcn = std::numeric_limits::max(); // tolerance = MINUIT2 Default tolerance Double_t tolerance = 0.1; // keep track of elapsed time @@ -1186,12 +1184,12 @@ Bool_t PFitter::ExecuteMigrad() start=MilliTime(); ROOT::Minuit2::FunctionMinimum min = migrad(maxfcn, tolerance); end=MilliTime(); - cout << ">> PFitter::ExecuteMinimize(): execution time for Migrad = " << setprecision(3) << (end-start)/1.0e3 << " sec." << endl; + std::cout << ">> PFitter::ExecuteMinimize(): execution time for Migrad = " << std::setprecision(3) << (end-start)/1.0e3 << " sec." << std::endl; TString str = TString::Format("Migrad: %.3f sec", (end-start)/1.0e3); fElapsedTime.push_back(str); if (!min.IsValid()) { - cerr << endl << ">> PFitter::ExecuteMigrad(): **WARNING**: Fit did not converge, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PFitter::ExecuteMigrad(): **WARNING**: Fit did not converge, sorry ..."; + std::cerr << std::endl; fIsValid = false; return false; } @@ -1199,7 +1197,7 @@ Bool_t PFitter::ExecuteMigrad() // keep FunctionMinimum object if (fFcnMin) { // fFcnMin exist hence clean up first delete fFcnMin; - fFcnMin = 0; + fFcnMin = nullptr; } fFcnMin = new ROOT::Minuit2::FunctionMinimum(min); @@ -1230,7 +1228,7 @@ Bool_t PFitter::ExecuteMigrad() fConverged = true; if (fPrintLevel >= 2) - cout << *fFcnMin << endl; + std::cout << *fFcnMin << std::endl; return true; } @@ -1245,7 +1243,7 @@ Bool_t PFitter::ExecuteMigrad() */ Bool_t PFitter::ExecuteMinimize() { - cout << ">> PFitter::ExecuteMinimize(): will call minimize ..." << endl; + std::cout << ">> PFitter::ExecuteMinimize(): will call minimize ..." << std::endl; // create minimizer object // strategy is by default = 'default' @@ -1253,7 +1251,7 @@ Bool_t PFitter::ExecuteMinimize() // minimize // maxfcn is MINUIT2 Default maxfcn - UInt_t maxfcn = numeric_limits::max(); + UInt_t maxfcn = std::numeric_limits::max(); // tolerance = MINUIT2 Default tolerance Double_t tolerance = 0.1; @@ -1262,12 +1260,12 @@ Bool_t PFitter::ExecuteMinimize() start = MilliTime(); ROOT::Minuit2::FunctionMinimum min = minimize(maxfcn, tolerance); end = MilliTime(); - cout << ">> PFitter::ExecuteMinimize(): execution time for Minimize = " << setprecision(3) << (end-start)/1.0e3 << " sec." << endl; + std::cout << ">> PFitter::ExecuteMinimize(): execution time for Minimize = " << std::setprecision(3) << (end-start)/1.0e3 << " sec." << std::endl; TString str = TString::Format("Minimize: %.3f sec", (end-start)/1.0e3); fElapsedTime.push_back(str); if (!min.IsValid()) { - cerr << endl << ">> PFitter::ExecuteMinimize(): **WARNING**: Fit did not converge, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PFitter::ExecuteMinimize(): **WARNING**: Fit did not converge, sorry ..."; + std::cerr << std::endl; fIsValid = false; return false; } @@ -1275,7 +1273,7 @@ Bool_t PFitter::ExecuteMinimize() // keep FunctionMinimum object if (fFcnMin) { // fFcnMin exist hence clean up first delete fFcnMin; - fFcnMin = 0; + fFcnMin = nullptr; } fFcnMin = new ROOT::Minuit2::FunctionMinimum(min); @@ -1306,7 +1304,7 @@ Bool_t PFitter::ExecuteMinimize() fConverged = true; if (fPrintLevel >= 2) - cout << *fFcnMin << endl; + std::cout << *fFcnMin << std::endl; return true; } @@ -1321,19 +1319,19 @@ Bool_t PFitter::ExecuteMinimize() */ Bool_t PFitter::ExecuteMinos() { - cout << ">> PFitter::ExecuteMinos(): will call minos ..." << endl; + std::cout << ">> PFitter::ExecuteMinos(): will call minos ..." << std::endl; // if already some minimization is done use the minuit2 output as input if (!fFcnMin) { - cerr << endl << "**ERROR**: MINOS musn't be called before any minimization (MINIMIZE/MIGRAD/SIMPLEX) is done!!"; - cerr << endl; + std::cerr << std::endl << "**ERROR**: MINOS musn't be called before any minimization (MINIMIZE/MIGRAD/SIMPLEX) is done!!"; + std::cerr << std::endl; return false; } // check if minimum was valid if (!fFcnMin->IsValid()) { - cerr << endl << "**ERROR**: MINOS cannot started since the previous minimization failed :-("; - cerr << endl; + std::cerr << std::endl << "**ERROR**: MINOS cannot started since the previous minimization failed :-("; + std::cerr << std::endl; return false; } @@ -1348,7 +1346,7 @@ Bool_t PFitter::ExecuteMinos() // the 2nd condition is from an all together unused variable // the 3rd condition is a variable fixed via the FIX command if ((fMnUserParams.Error(i) != 0.0) && (fRunInfo->ParameterInUse(i) != 0) && (!fMnUserParams.Parameters().at(i).IsFixed())) { - cout << ">> PFitter::ExecuteMinos(): calculate errors for " << fParams[i].fName << endl; + std::cout << ">> PFitter::ExecuteMinos(): calculate errors for " << fParams[i].fName << std::endl; // 1-sigma MINOS errors ROOT::Minuit2::MinosError err = minos.Minos(i); @@ -1364,16 +1362,16 @@ Bool_t PFitter::ExecuteMinos() } if (fMnUserParams.Parameters().at(i).IsFixed()) { - cerr << endl << ">> PFitter::ExecuteMinos(): **WARNING** Parameter " << fMnUserParams.Name(i) << " (ParamNo " << i+1 << ") is fixed!"; - cerr << endl << ">> Will set STEP to zero, i.e. making it a constant parameter"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::ExecuteMinos(): **WARNING** Parameter " << fMnUserParams.Name(i) << " (ParamNo " << i+1 << ") is fixed!"; + std::cerr << std::endl << ">> Will set STEP to zero, i.e. making it a constant parameter"; + std::cerr << std::endl; fRunInfo->SetMsrParamStep(i, 0.0); fRunInfo->SetMsrParamPosErrorPresent(i, false); } } end=MilliTime(); - cout << ">> PFitter::ExecuteMinimize(): execution time for Minos = " << setprecision(3) << (end-start)/1.0e3 << " sec." << endl; + std::cout << ">> PFitter::ExecuteMinimize(): execution time for Minos = " << std::setprecision(3) << (end-start)/1.0e3 << " sec." << std::endl; TString str = TString::Format("Minos: %.3f sec", (end-start)/1.0e3); fElapsedTime.push_back(str); @@ -1390,7 +1388,7 @@ Bool_t PFitter::ExecuteMinos() */ Bool_t PFitter::ExecutePlot() { - cout << ">> PFitter::ExecutePlot() ..." << endl; + std::cout << ">> PFitter::ExecutePlot() ..." << std::endl; ROOT::Minuit2::MnPlot plot; plot(fScanData); @@ -1410,16 +1408,16 @@ Bool_t PFitter::ExecutePlot() */ Bool_t PFitter::ExecutePrintLevel(UInt_t lineNo) { - cout << ">> PFitter::ExecutePrintLevel(): " << fCmdLines[lineNo].fLine.Data() << endl; + std::cout << ">> PFitter::ExecutePrintLevel(): " << fCmdLines[lineNo].fLine.Data() << std::endl; - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; tokens = fCmdLines[lineNo].fLine.Tokenize(", \t"); if (tokens->GetEntries() < 2) { - cerr << endl << "**ERROR** from PFitter::ExecutePrintLevel(): SYNTAX: PRINT_LEVEL , where =0-3" << endl << endl; + std::cerr << std::endl << "**ERROR** from PFitter::ExecutePrintLevel(): SYNTAX: PRINT_LEVEL , where =0-3" << std::endl << std::endl; return false; } @@ -1432,12 +1430,12 @@ Bool_t PFitter::ExecutePrintLevel(UInt_t lineNo) if ((ival >=0) && (ival <= 3)) { fPrintLevel = (UInt_t) ival; } else { - cerr << endl << "**ERROR** from PFitter::ExecutePrintLevel(): SYNTAX: PRINT_LEVEL , where =0-3"; - cerr << endl << " found =" << ival << endl << endl; + std::cerr << std::endl << "**ERROR** from PFitter::ExecutePrintLevel(): SYNTAX: PRINT_LEVEL , where =0-3"; + std::cerr << std::endl << " found =" << ival << std::endl << std::endl; return false; } } else { - cerr << endl << "**ERROR** from PFitter::ExecutePrintLevel(): SYNTAX: PRINT_LEVEL , where =0-3" << endl << endl; + std::cerr << std::endl << "**ERROR** from PFitter::ExecutePrintLevel(): SYNTAX: PRINT_LEVEL , where =0-3" << std::endl << std::endl; return false; } @@ -1446,7 +1444,7 @@ Bool_t PFitter::ExecutePrintLevel(UInt_t lineNo) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } return true; @@ -1464,13 +1462,13 @@ Bool_t PFitter::ExecutePrintLevel(UInt_t lineNo) */ Bool_t PFitter::ExecuteRelease(UInt_t lineNo) { - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TObjString *ostr; TString str; tokens = fCmdLines[lineNo].fLine.Tokenize(", \t"); - cout << ">> PFitter::ExecuteRelease(): " << fCmdLines[lineNo].fLine.Data() << endl; + std::cout << ">> PFitter::ExecuteRelease(): " << fCmdLines[lineNo].fLine.Data() << std::endl; for (Int_t i=1; iGetEntries(); i++) { ostr = dynamic_cast(tokens->At(i)); @@ -1490,7 +1488,7 @@ Bool_t PFitter::ExecuteRelease(UInt_t lineNo) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } return true; @@ -1506,7 +1504,7 @@ Bool_t PFitter::ExecuteRelease(UInt_t lineNo) */ Bool_t PFitter::ExecuteRestore() { - cout << "PFitter::ExecuteRestore(): release all fixed parameters (RESTORE) ..." << endl; + std::cout << "PFitter::ExecuteRestore(): release all fixed parameters (RESTORE) ..." << std::endl; for (UInt_t i=0; i> PFitter::ExecuteScan(): will call scan ..." << endl; + std::cout << ">> PFitter::ExecuteScan(): will call scan ..." << std::endl; ROOT::Minuit2::MnScan scan((*fFitterFcn), fMnUserParams); @@ -1557,7 +1555,7 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave) { // if any minimization was done, otherwise get out immediately if (!fFcnMin) { - cout << endl << ">> PFitter::ExecuteSave(): nothing to be saved ..."; + std::cout << std::endl << ">> PFitter::ExecuteSave(): nothing to be saved ..."; return false; } @@ -1565,8 +1563,8 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave) // check if the user parameter state is valid if (!mnState.IsValid()) { - cerr << endl << ">> PFitter::ExecuteSave: **WARNING** Minuit2 User Parameter State is not valid, i.e. nothing to be saved"; - cerr << endl; + std::cerr << std::endl << ">> PFitter::ExecuteSave: **WARNING** Minuit2 User Parameter State is not valid, i.e. nothing to be saved"; + std::cerr << std::endl; return false; } @@ -1631,44 +1629,44 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave) ndfPerHisto.clear(); chisqPerHisto.clear(); - cout << ">> PFitter::ExecuteSave(): will write minuit2 output file ..." << endl; + std::cout << ">> PFitter::ExecuteSave(): will write minuit2 output file ..." << std::endl; - ofstream fout; + std::ofstream fout; // open minuit2 output file if (firstSave) - fout.open("MINUIT2.OUTPUT", iostream::out); + fout.open("MINUIT2.OUTPUT", std::iostream::out); else - fout.open("MINUIT2.OUTPUT", iostream::out | iostream::app); + fout.open("MINUIT2.OUTPUT", std::iostream::out | std::iostream::app); if (!fout.is_open()) { - cerr << endl << "**ERROR** PFitter::ExecuteSave() couldn't open MINUIT2.OUTPUT file"; - cerr << endl; + std::cerr << std::endl << "**ERROR** PFitter::ExecuteSave() couldn't open MINUIT2.OUTPUT file"; + std::cerr << std::endl; return false; } // write header TDatime dt; - fout << endl << "*************************************************************************"; - fout << endl << " musrfit MINUIT2 output file from " << fRunInfo->GetFileName().Data() << " - " << dt.AsSQLString(); - fout << endl << "*************************************************************************"; - fout << endl; + fout << std::endl << "*************************************************************************"; + fout << std::endl << " musrfit MINUIT2 output file from " << fRunInfo->GetFileName().Data() << " - " << dt.AsSQLString(); + fout << std::endl << "*************************************************************************"; + fout << std::endl; // write elapsed times - fout << endl << " elapsed times:"; + fout << std::endl << " elapsed times:"; for (UInt_t i=0; iGetMsrParamList()); // get the update parameters back - fout << endl << " PARAMETERS"; - fout << endl << "-------------------------------------------------------------------------"; - fout << endl << " "; + fout << std::endl << " PARAMETERS"; + fout << std::endl << "-------------------------------------------------------------------------"; + fout << std::endl << " "; for (Int_t j=0; j<=maxLength-4; j++) fout << " "; fout << "Parabolic Minos"; - fout << endl << " No Name"; + fout << std::endl << " No Name"; for (Int_t j=0; j<=maxLength-4; j++) fout << " "; fout << "Value Error Negative Positive Limits"; for (UInt_t i=0; i 5) { - fout.setf(ios::left, ios::adjustfield); + fout.setf(std::ios::left, std::ios::adjustfield); fout.width(7); if (fParams[i].fLowerBoundaryPresent) fout << fParams[i].fLowerBoundary; else fout << "---"; - fout.setf(ios::left, ios::adjustfield); + fout.setf(std::ios::left, std::ios::adjustfield); fout.width(7); if (fParams[i].fUpperBoundaryPresent) fout << fParams[i].fUpperBoundary; else fout << "---"; } else { - fout.setf(ios::left, ios::adjustfield); + fout.setf(std::ios::left, std::ios::adjustfield); fout.width(7); fout << "---"; - fout.setf(ios::left, ios::adjustfield); + fout.setf(std::ios::left, std::ios::adjustfield); fout.width(7); fout << "---"; } } - fout << endl; - fout << endl << "*************************************************************************"; + fout << std::endl; + fout << std::endl << "*************************************************************************"; // write covariance matrix - fout << endl << " COVARIANCE MATRIX"; - fout << endl << "-------------------------------------------------------------------------"; + fout << std::endl << " COVARIANCE MATRIX"; + fout << std::endl << "-------------------------------------------------------------------------"; if (mnState.HasCovariance()) { ROOT::Minuit2::MnUserCovariance cov = mnState.Covariance(); - fout << endl << "from " << cov.Nrow() << " free parameters"; + fout << std::endl << "from " << cov.Nrow() << " free parameters"; for (UInt_t i=0; i 0.0) { fout << " "; @@ -1776,23 +1774,23 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave) } } } else { - fout << endl << " no covariance matrix available"; + fout << std::endl << " no covariance matrix available"; } - fout << endl; - fout << endl << "*************************************************************************"; + fout << std::endl; + fout << std::endl << "*************************************************************************"; // write correlation matrix - fout << endl << " CORRELATION COEFFICIENTS"; - fout << endl << "-------------------------------------------------------------------------"; + fout << std::endl << " CORRELATION COEFFICIENTS"; + fout << std::endl << "-------------------------------------------------------------------------"; if (mnState.HasGlobalCC() && mnState.HasCovariance()) { ROOT::Minuit2::MnGlobalCorrelationCoeff corr = mnState.GlobalCC(); ROOT::Minuit2::MnUserCovariance cov = mnState.Covariance(); PIntVector parNo; - fout << endl << " No Global "; + fout << std::endl << " No Global "; for (UInt_t i=0; iParameterInUse(i) > 0) && (!fMnUserParams.Parameters().at(i).IsFixed())) { - fout.setf(ios::left, ios::adjustfield); + fout.setf(std::ios::left, std::ios::adjustfield); fout.width(9); fout << i+1; parNo.push_back(i); @@ -1800,8 +1798,8 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave) } // check that there is a correspondens between minuit2 and musrfit book keeping if (parNo.size() != cov.Nrow()) { - cerr << endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): minuit2 and musrfit book keeping to not correspond! Unable to write correlation matrix."; - cerr << endl; + std::cerr << std::endl << "**SEVERE ERROR** in PFitter::ExecuteSave(): minuit2 and musrfit book keeping to not correspond! Unable to write correlation matrix."; + std::cerr << std::endl; } else { // book keeping is OK TString title("Minuit2 Output Correlation Matrix for "); title += fRunInfo->GetFileName(); @@ -1812,18 +1810,18 @@ Bool_t PFitter::ExecuteSave(Bool_t firstSave) Double_t dval; for (UInt_t i=0; i> PFitter::ExecuteSimplex(): will call simplex ..." << endl; + std::cout << ">> PFitter::ExecuteSimplex(): will call simplex ..." << std::endl; // create minimizer object // strategy is by default = 'default' @@ -1914,7 +1912,7 @@ Bool_t PFitter::ExecuteSimplex() // minimize // maxfcn is 10*MINUIT2 Default maxfcn - UInt_t maxfcn = numeric_limits::max(); + UInt_t maxfcn = std::numeric_limits::max(); // tolerance = MINUIT2 Default tolerance Double_t tolerance = 0.1; // keep track of elapsed time @@ -1922,12 +1920,12 @@ Bool_t PFitter::ExecuteSimplex() start=MilliTime(); ROOT::Minuit2::FunctionMinimum min = simplex(maxfcn, tolerance); end=MilliTime(); - cout << ">> PFitter::ExecuteMinimize(): execution time for Simplex = " << setprecision(3) << (end-start)/1.0e3 << " sec." << endl; + std::cout << ">> PFitter::ExecuteMinimize(): execution time for Simplex = " << std::setprecision(3) << (end-start)/1.0e3 << " sec." << std::endl; TString str = TString::Format("Simplex: %.3f sec", (end-start)/1.0e3); fElapsedTime.push_back(str); if (!min.IsValid()) { - cerr << endl << ">> PFitter::ExecuteSimplex(): **WARNING**: Fit did not converge, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PFitter::ExecuteSimplex(): **WARNING**: Fit did not converge, sorry ..."; + std::cerr << std::endl; fIsValid = false; return false; } @@ -1935,7 +1933,7 @@ Bool_t PFitter::ExecuteSimplex() // keep FunctionMinimum object if (fFcnMin) { // fFcnMin exist hence clean up first delete fFcnMin; - fFcnMin = 0; + fFcnMin = nullptr; } fFcnMin = new ROOT::Minuit2::FunctionMinimum(min); @@ -1966,7 +1964,7 @@ Bool_t PFitter::ExecuteSimplex() fConverged = true; if (fPrintLevel >= 2) - cout << *fFcnMin << endl; + std::cout << *fFcnMin << std::endl; return true; } @@ -1982,7 +1980,7 @@ Bool_t PFitter::ExecuteSimplex() Double_t PFitter::MilliTime() { struct timeval now; - gettimeofday(&now, 0); + gettimeofday(&now, nullptr); return ((Double_t)now.tv_sec * 1.0e6 + (Double_t)now.tv_usec)/1.0e3; } diff --git a/src/classes/PFitterFcn.cpp b/src/classes/PFitterFcn.cpp index 07c4831a..d04ac1ee 100644 --- a/src/classes/PFitterFcn.cpp +++ b/src/classes/PFitterFcn.cpp @@ -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 -using namespace std; - #include "PFitterFcn.h" //-------------------------------------------------------------------------- diff --git a/src/classes/PFourier.cpp b/src/classes/PFourier.cpp index 72ac31e5..3005b1eb 100644 --- a/src/classes/PFourier.cpp +++ b/src/classes/PFourier.cpp @@ -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 #include -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 &reFT, vector &imFT, const Int_t minBin, const Int_t maxBin) : +PFTPhaseCorrection::PFTPhaseCorrection(std::vector &reFT, std::vector &imFT, const Int_t minBin, const Int_t maxBin) : fReal(reFT), fImag(imFT), fMinBin(minBin), fMaxBin(maxBin) { Init(); + Int_t realSize = static_cast(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(i) / static_cast(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 &par) const +double PFTPhaseCorrection::operator()(const std::vector &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((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_malloc(sizeof(fftw_complex)*fNoOfBins)); + fOut = static_cast(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(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(noOfFourierBins), -fResolution/2.0, static_cast(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++) { 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 &phase, +TH1F* PFourier::GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, std::vector &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, vectorFindFixBin(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, vectorFindFixBin(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 realF, imagF; + std::vector 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, vectorMinimize(); 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, vectorGetName()); 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(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(i-static_cast(minBin)) / static_cast(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(noOfFourierBins), -fResolution/2.0, static_cast(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++) { 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(noOfFourierBins), -fResolution/2.0, static_cast(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++) { 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(noOfFourierBins), -fResolution/2.0, static_cast(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++) { // 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; iGetBinContent(i+start); + mean += fData->GetBinContent(static_cast(i+start)); } - mean /= (Double_t)fNoOfData; + mean /= static_cast(fNoOfData); } // 2nd fill fIn for (UInt_t i=0; iGetBinContent(i+start) - mean; + fIn[i][0] = fData->GetBinContent(static_cast(i+start)) - mean; fIn[i][1] = 0.0; } for (UInt_t i=fNoOfData; i(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(i)/static_cast(fNoOfData), 2.0*static_cast(j)); } fIn[i][0] *= q; } diff --git a/src/classes/PFourierCanvas.cpp b/src/classes/PFourierCanvas.cpp index 17e06de2..3578fdbb 100644 --- a/src/classes/PFourierCanvas.cpp +++ b/src/classes/PFourierCanvas.cpp @@ -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 #include -using namespace std; #include #include @@ -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 &fourier, PIntVector dataSetTag, const Char_t* title, +PFourierCanvas::PFourierCanvas(std::vector &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 &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(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(rand.Integer(255)), static_cast(rand.Integer(255)), static_cast(rand.Integer(255))); fColorList.push_back(color); } @@ -156,7 +155,7 @@ PFourierCanvas::PFourierCanvas(vector &fourier, PIntVector dataSetTag * \param colorList * \param batch */ -PFourierCanvas::PFourierCanvas(vector &fourier, PIntVector dataSetTag, const Char_t* title, +PFourierCanvas::PFourierCanvas(std::vector &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 &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(fMarkerList.size()); i(rand.Integer(10)); fMarkerList.push_back(style); } - for (UInt_t i=fColorList.size(); i(fColorList.size()); i(rand.Integer(255)), static_cast(rand.Integer(255)), static_cast(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; iGetTitle() << 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; iGetBinCenter(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; iGetTitle() << endl; + fout << "% " << fFourierHistos[i].dataFourierRe->GetTitle() << std::endl; } - fout << "%------------" << endl; + fout << "%------------" << std::endl; fout << "% "; for (UInt_t i=0; iGetBinCenter(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(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; iClear(); 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; iGetNbinsX(); 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; iGetNbinsX(); 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); diff --git a/src/classes/PFunction.cpp b/src/classes/PFunction.cpp index 951153d8..3516434e 100644 --- a/src/classes/PFunction.cpp +++ b/src/classes/PFunction.cpp @@ -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 #include -using namespace std; #include // 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(paramSize)) return true; else return false; } else if (node.fID == PFunctionGrammar::mapID) { - if (node.fIvalue <= (Int_t) mapSize) + if (node.fIvalue <= static_cast(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 param) +Double_t PFunction::Eval(std::vector 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 diff --git a/src/classes/PFunctionHandler.cpp b/src/classes/PFunctionHandler.cpp index de8abaa5..0167c254 100644 --- a/src/classes/PFunctionHandler.cpp +++ b/src/classes/PFunctionHandler.cpp @@ -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 map, vector param) +Double_t PFunctionHandler::Eval(Int_t funNo, std::vector map, std::vector 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; } diff --git a/src/classes/PMsr2Data.cpp b/src/classes/PMsr2Data.cpp index 0a2cdb00..f30134af 100644 --- a/src/classes/PMsr2Data.cpp +++ b/src/classes/PMsr2Data.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009-2016 by Bastian M. Wojek / Andreas Suter * + * Copyright (C) 2009-2019 by Bastian M. Wojek / Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -38,7 +38,6 @@ #include #include #include -using namespace std; #include // for stripping leading whitespace in std::string #include // for to_lower() in std::string @@ -55,15 +54,15 @@ using namespace boost::algorithm; * * \param ext extension/suffix of the msr-files to be processed */ -PMsr2Data::PMsr2Data(const string &ext) : fFileExtension(ext), fRunListFile(false), fNumGlobalParam(0), fNumSpecParam(0), fNumTempRunBlocks(0), fRunNumberDigits(4), fHeaderWritten(false) +PMsr2Data::PMsr2Data(const std::string &ext) : fFileExtension(ext), fRunListFile(false), fNumGlobalParam(0), fNumSpecParam(0), fNumTempRunBlocks(0), fRunNumberDigits(4), fHeaderWritten(false) { fRunVector.clear(); fRunVectorIter = fRunVector.end(); - fRunListFileStream = 0; - fSaxParser = 0; - fStartupHandler = 0; - fDataHandler = 0; - fMsrHandler = 0; + fRunListFileStream = nullptr; + fSaxParser = nullptr; + fStartupHandler = nullptr; + fDataHandler = nullptr; + fMsrHandler = nullptr; } //------------------------------------------------------------- @@ -79,23 +78,23 @@ PMsr2Data::~PMsr2Data() if (fRunListFileStream) { fRunListFileStream->close(); delete fRunListFileStream; - fRunListFileStream = 0; + fRunListFileStream = nullptr; } if (fSaxParser) { delete fSaxParser; - fSaxParser = 0; + fSaxParser = nullptr; } if (fStartupHandler) { delete fStartupHandler; - fStartupHandler = 0; + fStartupHandler = nullptr; } if (fDataHandler) { delete fDataHandler; - fDataHandler = 0; + fDataHandler = nullptr; } if (fMsrHandler) { delete fMsrHandler; - fMsrHandler = 0; + fMsrHandler = nullptr; } } @@ -117,20 +116,20 @@ PMsr2Data::~PMsr2Data() */ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) const { - ostringstream strInfile; + std::ostringstream strInfile; strInfile << runNo << fFileExtension << ".msr"; - ifstream *in = new ifstream(strInfile.str().c_str()); + std::ifstream *in = new std::ifstream(strInfile.str().c_str()); if (!in->is_open()) { delete in; if (!normalMode && (runNo == *fRunVectorIter)) { - string fileNameCopy(strInfile.str()); + std::string fileNameCopy(strInfile.str()); strInfile.clear(); strInfile.str(""); strInfile << runNo << "+global" << fFileExtension << ".msr"; - in = new ifstream(strInfile.str().c_str()); + in = new std::ifstream(strInfile.str().c_str()); if (!in->is_open()) { - cerr << endl << ">> msr2data: **ERROR** Neither the file " << fileNameCopy << " nor the file " << strInfile.str() << " can be opened! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Neither the file " << fileNameCopy << " nor the file " << strInfile.str() << " can be opened! Please check!"; + std::cerr << std::endl; delete in; return -1; } @@ -138,27 +137,27 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) con if (++fRunVectorIter != fRunVector.end()) { return DetermineRunNumberDigits(*fRunVectorIter, true); } else { - cerr << endl << ">> msr2data: **ERROR** None of the given msr-files can be opened! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** None of the given msr-files can be opened! Please check!"; + std::cerr << std::endl; return -1; } } else { - cerr << endl << ">> msr2data: **ERROR** The given template " << strInfile.str() << " cannot be opened! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The given template " << strInfile.str() << " cannot be opened! Please check!"; + std::cerr << std::endl; return -1; } } - ostringstream tempRunNumber; + std::ostringstream tempRunNumber; tempRunNumber.fill('0'); - tempRunNumber.setf(ios::internal, ios::adjustfield); + tempRunNumber.setf(std::ios::internal, std::ios::adjustfield); tempRunNumber.width(fRunNumberDigits); tempRunNumber << runNo; fRunNumberDigits = tempRunNumber.str().length(); - string line, firstOnLine; - istringstream strLine; + std::string line, firstOnLine; + std::istringstream strLine; while (getline(*in, line)) { strLine.clear(); @@ -167,8 +166,8 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) con if (!to_lower_copy(firstOnLine).compare("run")) { firstOnLine.clear(); strLine >> firstOnLine; - string::size_type loc = firstOnLine.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = firstOnLine.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { while ( loc > 0 ) { if (isdigit(firstOnLine.at(--loc))) { ++fRunNumberDigits; @@ -178,29 +177,29 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) con } in->close(); delete in; - in = 0; + in = nullptr; fRunVectorIter = fRunVector.begin(); // set back the runlist-iterator which might have changed during the search for the correct file return 0; } else { - cerr << endl << ">> msr2data: **ERROR** The first processed run file number does not match the \"file index\"!"; - cerr << endl << ">> msr2data: **ERROR** The number of digits to be used for formatting the run numbers cannot be determined!"; - cerr << endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;"; - cerr << endl << ">> msr2data: **ERROR** this is either some template or the first existing file from the run list."; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The first processed run file number does not match the \"file index\"!"; + std::cerr << std::endl << ">> msr2data: **ERROR** The number of digits to be used for formatting the run numbers cannot be determined!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;"; + std::cerr << std::endl << ">> msr2data: **ERROR** this is either some template or the first existing file from the run list."; + std::cerr << std::endl; in->close(); delete in; - in = 0; + in = nullptr; return -2; } } } - cerr << endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;"; - cerr << endl << ">> msr2data: **ERROR** this is either some template or the first file from the run list."; - cerr << endl << ">> msr2data: **ERROR** Obviously it contains no RUN block..."; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check the first msr-file that should be processed;"; + std::cerr << std::endl << ">> msr2data: **ERROR** this is either some template or the first file from the run list."; + std::cerr << std::endl << ">> msr2data: **ERROR** Obviously it contains no RUN block..."; + std::cerr << std::endl; in->close(); delete in; - in = 0; + in = nullptr; return -3; } @@ -216,10 +215,10 @@ int PMsr2Data::CheckRunNumbersInRange() const { double max(pow(static_cast(10), static_cast(fRunNumberDigits)) - 1.0); unsigned int max_UInt; - max > static_cast(numeric_limits::max()) ? max_UInt = numeric_limits::max() + max > static_cast(std::numeric_limits::max()) ? max_UInt = std::numeric_limits::max() : max_UInt = static_cast(max); - for (vector::const_iterator iter(fRunVector.begin()); iter != fRunVector.end(); ++iter) { + for (std::vector::const_iterator iter(fRunVector.begin()); iter != fRunVector.end(); ++iter) { if (*iter > max_UInt) { return -1; } @@ -305,12 +304,12 @@ int PMsr2Data::SetRunNumbers(unsigned int runNoStart, unsigned int runNoEnd) * * \param runListVector vector containing the run numbers to be processed */ -int PMsr2Data::SetRunNumbers(const vector &runListVector) +int PMsr2Data::SetRunNumbers(const std::vector &runListVector) { if (runListVector.empty()) return -1; - for (vector::const_iterator iter(runListVector.begin()); iter!=runListVector.end(); ++iter) { + for (std::vector::const_iterator iter(runListVector.begin()); iter!=runListVector.end(); ++iter) { if (*iter < 1) return 1; } @@ -332,20 +331,20 @@ int PMsr2Data::SetRunNumbers(const vector &runListVector) * * \param runListFile name of run list file */ -int PMsr2Data::SetRunNumbers(const string &runListFile) +int PMsr2Data::SetRunNumbers(const std::string &runListFile) { fRunVector.clear(); - ifstream in(runListFile.c_str()); + std::ifstream in(runListFile.c_str()); if (!in) { - cerr << endl << ">> msr2data: **ERROR** The runlist file " << runListFile << " cannot be opened! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The runlist file " << runListFile << " cannot be opened! Please check!"; + std::cerr << std::endl; return -1; } - string line, indvar; - istringstream strLine; - vector splitVec; + std::string line, indvar; + std::istringstream strLine; + std::vector splitVec; unsigned int cntr(0); unsigned int runNo; @@ -365,8 +364,8 @@ int PMsr2Data::SetRunNumbers(const string &runListFile) strLine.str(splitVec[0]); strLine >> indvar; // "RUN" if (to_lower_copy(indvar).compare("run")) { - cerr << endl << ">> msr2data: **ERROR** The format of the runlist file " << runListFile << " is not correct! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The format of the runlist file " << runListFile << " is not correct! Please check!"; + std::cerr << std::endl; } while (strLine >> indvar) fIndVar.push_back(indvar); @@ -387,7 +386,7 @@ int PMsr2Data::SetRunNumbers(const string &runListFile) in.close(); fRunVectorIter = fRunVector.begin(); fRunListFile = true; - fRunListFileStream = new ifstream(runListFile.c_str()); + fRunListFileStream = new std::ifstream(runListFile.c_str()); return 0; } @@ -404,7 +403,7 @@ int PMsr2Data::ParseXmlStartupFile() int status; fSaxParser = new TSAXParser(); fStartupHandler = new PStartupHandler(); - string startup_path_name(fStartupHandler->GetStartupFilePath().Data()); + std::string startup_path_name(fStartupHandler->GetStartupFilePath().Data()); fSaxParser->ConnectToHandler("PStartupHandler", fStartupHandler); //status = fSaxParser->ParseFile(startup_path_name.c_str()); // parsing the file as above seems to lead to problems in certain environments; @@ -412,15 +411,15 @@ int PMsr2Data::ParseXmlStartupFile() status = parseXmlFile(fSaxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << endl << ">> msr2data: **WARNING** Reading/parsing musrfit_startup.xml failed." << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** Reading/parsing musrfit_startup.xml failed." << std::endl; // clean up if (fSaxParser) { delete fSaxParser; - fSaxParser = 0; + fSaxParser = nullptr; } if (fStartupHandler) { delete fStartupHandler; - fStartupHandler = 0; + fStartupHandler = nullptr; } } return status; @@ -436,7 +435,7 @@ int PMsr2Data::ParseXmlStartupFile() * * \param infile name of the msr-file to be read */ -int PMsr2Data::ReadMsrFile(const string &infile) const +int PMsr2Data::ReadMsrFile(const std::string &infile) const { int status; fMsrHandler = new PMsrHandler(infile.c_str()); @@ -444,13 +443,13 @@ int PMsr2Data::ReadMsrFile(const string &infile) const if (status != PMUSR_SUCCESS) { switch (status) { case PMUSR_MSR_FILE_NOT_FOUND: - cerr << endl << ">> msr2data: **ERROR** Could not find " << infile << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Could not find " << infile << std::endl; break; case PMUSR_MSR_SYNTAX_ERROR: - cerr << endl << ">> msr2data: **SYNTAX ERROR** in file " << infile << ", full stop here." << endl; + std::cerr << std::endl << ">> msr2data: **SYNTAX ERROR** in file " << infile << ", full stop here." << std::endl; break; default: - cerr << endl << ">> msr2data: **UNKOWN ERROR** when trying to read the msr-file" << endl; + std::cerr << std::endl << ">> msr2data: **UNKOWN ERROR** when trying to read the msr-file" << std::endl; break; } } @@ -468,7 +467,7 @@ int PMsr2Data::ReadMsrFile(const string &infile) const */ PMsrHandler* PMsr2Data::GetSingleRunMsrFile() const { - ostringstream singleMsrInFile; + std::ostringstream singleMsrInFile; singleMsrInFile << *fRunVectorIter << "-OneRunFit" << fFileExtension << ".msr"; PMsrHandler *singleRunMsrFile = new PMsrHandler(singleMsrInFile.str().c_str()); @@ -476,16 +475,16 @@ PMsrHandler* PMsr2Data::GetSingleRunMsrFile() const if (status != PMUSR_SUCCESS) { switch (status) { case PMUSR_MSR_FILE_NOT_FOUND: - cerr << endl << ">> msr2data: **ERROR** Could not find " << singleMsrInFile.str() << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Could not find " << singleMsrInFile.str() << std::endl; break; case PMUSR_MSR_SYNTAX_ERROR: - cerr << endl << ">> msr2data: **SYNTAX ERROR** in file " << singleMsrInFile.str() << ", full stop here." << endl; + std::cerr << std::endl << ">> msr2data: **SYNTAX ERROR** in file " << singleMsrInFile.str() << ", full stop here." << std::endl; break; default: - cerr << endl << ">> msr2data: **UNKOWN ERROR** when trying to read the msr-file" << endl; + std::cerr << std::endl << ">> msr2data: **UNKOWN ERROR** when trying to read the msr-file" << std::endl; break; } - return 0; + return nullptr; } return singleRunMsrFile; } @@ -509,9 +508,9 @@ int PMsr2Data::ReadRunDataFile() bool success = fDataHandler->IsAllDataAvailable(); if (!success) { - cerr << endl << ">> msr2data: **WARNING** Could not read all data files, will continue without the data file information..." << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** Could not read all data files, will continue without the data file information..." << std::endl; delete fDataHandler; - fDataHandler = 0; + fDataHandler = nullptr; return 1; } return 0; @@ -536,54 +535,54 @@ bool PMsr2Data::PrepareNewInputFile(unsigned int tempRun, bool calledFromGlobalM if (*fRunVectorIter == tempRun) return true; - string globalTag(""); + std::string globalTag(""); if (calledFromGlobalMode) globalTag = "-OneRunFit"; - ostringstream strInfile; + std::ostringstream strInfile; strInfile << tempRun << globalTag << fFileExtension << ".msr"; - ifstream in(strInfile.str().c_str()); + std::ifstream in(strInfile.str().c_str()); if (!in) { - cerr << endl << ">> msr2data: **ERROR** The template msr-file " << strInfile.str() << " cannot be opened! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The template msr-file " << strInfile.str() << " cannot be opened! Please check!"; + std::cerr << std::endl; return false; } - ostringstream strOutfile; + std::ostringstream strOutfile; strOutfile << *fRunVectorIter << globalTag << fFileExtension << ".msr"; - ofstream out(strOutfile.str().c_str()); + std::ofstream out(strOutfile.str().c_str()); if (!out) { - cerr << endl << ">> msr2data: **ERROR** The new msr file " << strOutfile.str() << " cannot be opened! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The new msr file " << strOutfile.str() << " cannot be opened! Please check!"; + std::cerr << std::endl; return false; } - ostringstream tempRunNumber; + std::ostringstream tempRunNumber; tempRunNumber.fill('0'); - tempRunNumber.setf(ios::internal, ios::adjustfield); + tempRunNumber.setf(std::ios::internal, std::ios::adjustfield); tempRunNumber.width(fRunNumberDigits); tempRunNumber << tempRun; - ostringstream newRunNumber; + std::ostringstream newRunNumber; newRunNumber.fill('0'); - newRunNumber.setf(ios::internal, ios::adjustfield); + newRunNumber.setf(std::ios::internal, std::ios::adjustfield); newRunNumber.width(fRunNumberDigits); newRunNumber << *fRunVectorIter; - cout << endl << ">> msr2data: **INFO** Generating new input msr file " << strOutfile.str() << endl; + std::cout << std::endl << ">> msr2data: **INFO** Generating new input msr file " << strOutfile.str() << std::endl; - string line, firstOnLine; - istringstream strLine; + std::string line, firstOnLine; + std::istringstream strLine; unsigned int emptyLineCounter(0); // write the run number in the TITLE line of the msr-file (is overwritten later by musrfit if called with the -t option) getline(in, line); - out << *fRunVectorIter << endl; + out << *fRunVectorIter << std::endl; while (getline(in, line)) { if (line.empty()) { if (++emptyLineCounter < 3) // allow only two successive empty lines in the input files (just for convenience) - out << endl; + out << std::endl; continue; } else emptyLineCounter = 0; @@ -596,23 +595,23 @@ bool PMsr2Data::PrepareNewInputFile(unsigned int tempRun, bool calledFromGlobalM strLine >> firstOnLine; if (!to_lower_copy(firstOnLine).compare("run")) { strLine >> firstOnLine; - string::size_type loc = firstOnLine.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = firstOnLine.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { firstOnLine.replace(loc, fRunNumberDigits, newRunNumber.str()); } else { - cerr << endl << ">> msr2data: **WARNING** The template run file number does not match the \"file index\""; - cerr << endl << ">> msr2data: **WARNING** Unexpected things will happen... (for sure)"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** The template run file number does not match the \"file index\""; + std::cerr << std::endl << ">> msr2data: **WARNING** Unexpected things will happen... (for sure)"; + std::cerr << std::endl; } out << "RUN " << firstOnLine; while (strLine >> firstOnLine) out << " " << firstOnLine; - out << endl; + out << std::endl; } else if (!to_lower_copy(firstOnLine).compare("chisq") || !to_lower_copy(firstOnLine).compare("maxlh")) { - out << "*** FIT DID NOT CONVERGE ***" << endl; + out << "*** FIT DID NOT CONVERGE ***" << std::endl; break; } else { - out << line << endl; + out << line << std::endl; } } in.close(); @@ -667,11 +666,11 @@ bool compare_parameters(const PMsrParamStructure &par1, const PMsrParamStructure * - 1: global mode including single run fits and data extraction for the global msr-file (same template for all runs) * - 2: global mode including single run fits and data extraction for the global msr-file (successive template generation) */ -bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOutFile, unsigned int globalPlus) const +bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const std::string &msrOutFile, unsigned int globalPlus) const { const TString alpha("alpha"), beta("beta"), norm("norm"), bkgfit("bkgfit"), lifetime("lifetime"); - ostringstream strInfile; + std::ostringstream strInfile; strInfile << tempRun << fFileExtension << ".msr"; // read template msr-file @@ -687,28 +686,28 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu fNumTempRunBlocks = msrRunList->size(); // check that the RUN block run numbers match the template run number - ostringstream tempRunNumber; + std::ostringstream tempRunNumber; tempRunNumber.fill('0'); - tempRunNumber.setf(ios::internal, ios::adjustfield); + tempRunNumber.setf(std::ios::internal, std::ios::adjustfield); tempRunNumber.width(fRunNumberDigits); tempRunNumber << tempRun; - string tempRunName; + std::string tempRunName; for (unsigned int i(0); i < fNumTempRunBlocks; ++i) { tempRunName = msrRunList->at(i).GetRunName()->Data(); - string::size_type loc = tempRunName.rfind(tempRunNumber.str()); - if ( loc == string::npos ) { - cerr << endl << ">> msr2data: **ERROR** A template run file number does not match the \"file index\""; - cerr << endl << ">> msr2data: **ERROR** Please check the template file!"; - cerr << endl; + std::string::size_type loc = tempRunName.rfind(tempRunNumber.str()); + if ( loc == std::string::npos ) { + std::cerr << std::endl << ">> msr2data: **ERROR** A template run file number does not match the \"file index\""; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check the template file!"; + std::cerr << std::endl; return false; } } - cout << endl << ">> msr2data: **INFO** Generating new global input msr file " << msrOutFile << endl; + std::cout << std::endl << ">> msr2data: **INFO** Generating new global input msr file " << msrOutFile << std::endl; // set some title for the msr-file - ostringstream titleStream; + std::ostringstream titleStream; titleStream << "Global msr file for the runs: "; while (fRunVectorIter != fRunVector.end()) { titleStream << *fRunVectorIter << " "; @@ -720,10 +719,10 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu titleStream.str(""); // search parameter list for run-specific parameters - the rest is assumed to be global - string tempParamName; + std::string tempParamName; for (unsigned int i(0); i < msrParamList->size(); ++i) { tempParamName = msrParamList->at(i).fName.Data(); - string::size_type loc = tempParamName.rfind(tempRunNumber.str()); + std::string::size_type loc = tempParamName.rfind(tempRunNumber.str()); if ((tempParamName.length() > fRunNumberDigits) && (loc == tempParamName.length() - fRunNumberDigits)) { msrParamList->at(i).fIsGlobal = false; ++fNumSpecParam; @@ -731,7 +730,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu msrParamList->at(i).fIsGlobal = true; ++fNumGlobalParam; } - // cout << "debug> " << msrParamList->at(i).fNo << ": " << msrParamList->at(i).fName.Data() << " is global: " << msrParamList->at(i).fIsGlobal << endl; + // std::cout << "debug> " << msrParamList->at(i).fNo << ": " << msrParamList->at(i).fName.Data() << " is global: " << msrParamList->at(i).fIsGlobal << std::endl; } // check if parameters have been sorted correctly from the beginning @@ -744,10 +743,10 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } int tempPar; - vector *tempMap; + std::vector *tempMap; PMsrLines *tempLines; - vector tempVec; - string line, tempString; + std::vector tempVec; + std::string line, tempString; if (!wasSorted) { // Sort the parameters: global ones first, then run-specific @@ -768,14 +767,14 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu for (unsigned int k(0); k < msrParamList->size(); ++k) { if (tempPar == msrParamList->at(k).fNo) { if (msrParamList->at(k).fIsGlobal) { - tempVec[j] = boost::lexical_cast(k + 1); + tempVec[j] = boost::lexical_cast(k + 1); } else { - cerr << endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(k).fName.Data() \ + std::cerr << std::endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(k).fName.Data() \ << " is recognized as run specific!"; - cerr << endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template THEORY block."; - cerr << endl << ">> msr2data: **WARNING** The THEORY block entry will be substituted by a mapped parameter."; - cerr << endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template THEORY block."; + std::cerr << std::endl << ">> msr2data: **WARNING** The THEORY block entry will be substituted by a mapped parameter."; + std::cerr << std::endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; + std::cerr << std::endl; unsigned int l(0); tempMap = msrRunList->at(0).GetMap(); @@ -798,7 +797,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu if (mapExists) { tempVec[j] = "map"; - tempVec[j].append(boost::lexical_cast(l + 1)); + tempVec[j].append(boost::lexical_cast(l + 1)); mapExists = false; } else { // look for the first not used map entry for (l = 0; l < tempMap->size(); ++l) { @@ -810,7 +809,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu msrRunList->at(m).SetMap(tempPar, l); } tempVec[j] = "map"; - tempVec[j].append(boost::lexical_cast(l + 1)); + tempVec[j].append(boost::lexical_cast(l + 1)); } } break; @@ -830,7 +829,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } // FUNCTIONS block - string::size_type pos(0); + std::string::size_type pos(0); tempLines = fMsrHandler->GetMsrFunctions(); for (unsigned int i(0); i < tempLines->size(); ++i) { line = (*tempLines)[i].fLine.Data(); @@ -844,22 +843,22 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu if (tempPar == msrParamList->at(k).fNo) { if (msrParamList->at(k).fIsGlobal) { pos = line.find(tempVec[j], pos); - if ( pos != string::npos ) { + if ( pos != std::string::npos ) { tempString = "par"; - tempString.append(boost::lexical_cast(k + 1)); + tempString.append(boost::lexical_cast(k + 1)); line.replace(pos, tempVec[j].length(), tempString); } else { - cerr << endl << ">> msr2data: **ERROR** A previously identified parameter in the FUNCTIONS block is not found any more!"; - cerr << endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** A previously identified parameter in the FUNCTIONS block is not found any more!"; + std::cerr << std::endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; + std::cerr << std::endl; } } else { - cerr << endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(k).fName.Data() \ + std::cerr << std::endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(k).fName.Data() \ << " is recognized as run specific!"; - cerr << endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template FUNCTIONS block."; - cerr << endl << ">> msr2data: **WARNING** The FUNCTIONS block entry will be substituted by a mapped parameter."; - cerr << endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template FUNCTIONS block."; + std::cerr << std::endl << ">> msr2data: **WARNING** The FUNCTIONS block entry will be substituted by a mapped parameter."; + std::cerr << std::endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; + std::cerr << std::endl; unsigned int l(0); tempMap = msrRunList->at(0).GetMap(); @@ -891,14 +890,14 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } pos = line.find(tempVec[j], pos); - if ( pos != string::npos ) { + if ( pos != std::string::npos ) { tempString = "map"; - tempString.append(boost::lexical_cast(l + 1)); + tempString.append(boost::lexical_cast(l + 1)); line.replace(pos, tempVec[j].length(), tempString); } else { - cerr << endl << ">> msr2data: **ERROR** A previously identified parameter in the FUNCTIONS block is not found any more!"; - cerr << endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** A previously identified parameter in the FUNCTIONS block is not found any more!"; + std::cerr << std::endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; + std::cerr << std::endl; } mapExists = false; } @@ -907,9 +906,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } catch(boost::bad_lexical_cast &) { - cerr << endl << ">> msr2data: **ERROR** Something is wrong with the parameters used in the FUNCTIONS block!"; - cerr << endl << ">> msr2data: **ERROR** Please report a bug - function parsing should have failed earlier!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Something is wrong with the parameters used in the FUNCTIONS block!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please report a bug - function parsing should have failed earlier!"; + std::cerr << std::endl; return false; } } @@ -938,9 +937,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } if (l > msrParamList->size()) { - cerr << endl << ">> msr2data: **ERROR** The norm parameter specified in RUN block " << i + 1 << " does not exist!"; - cerr << endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The norm parameter specified in RUN block " << i + 1 << " does not exist!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; + std::cerr << std::endl; return false; } } @@ -954,9 +953,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } if (l > msrParamList->size()) { - cerr << endl << ">> msr2data: **ERROR** The backgr.fit parameter specified in RUN block " << i + 1 << " does not exist!"; - cerr << endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The backgr.fit parameter specified in RUN block " << i + 1 << " does not exist!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; + std::cerr << std::endl; return false; } } @@ -970,9 +969,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } if (l > msrParamList->size()) { - cerr << endl << ">> msr2data: **ERROR** The alpha parameter specified in RUN block " << i + 1 << " does not exist!"; - cerr << endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The alpha parameter specified in RUN block " << i + 1 << " does not exist!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; + std::cerr << std::endl; return false; } } @@ -986,9 +985,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } if (l > msrParamList->size()) { - cerr << endl << ">> msr2data: **ERROR** The beta parameter specified in RUN block " << i + 1 << " does not exist!"; - cerr << endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The beta parameter specified in RUN block " << i + 1 << " does not exist!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; + std::cerr << std::endl; return false; } } @@ -1002,9 +1001,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } if (l > msrParamList->size()) { - cerr << endl << ">> msr2data: **ERROR** The lifetime parameter specified in RUN block " << i + 1 << " does not exist!"; - cerr << endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The lifetime parameter specified in RUN block " << i + 1 << " does not exist!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please report a bug - file checks should have failed earlier!"; + std::cerr << std::endl; return false; } } @@ -1021,7 +1020,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } } - tempMap = 0; + tempMap = nullptr; } // FOURIER block - in case a parameter is used for the phase @@ -1065,12 +1064,12 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu try { tempPar = boost::lexical_cast(tempVec[j]); if (!msrParamList->at(tempPar - 1).fIsGlobal) { - cerr << endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(tempPar - 1).fName.Data() \ + std::cerr << std::endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(tempPar - 1).fName.Data() \ << " is recognized as run specific!"; - cerr << endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template THEORY block."; - cerr << endl << ">> msr2data: **WARNING** The THEORY block entry will be substituted by a mapped parameter."; - cerr << endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template THEORY block."; + std::cerr << std::endl << ">> msr2data: **WARNING** The THEORY block entry will be substituted by a mapped parameter."; + std::cerr << std::endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; + std::cerr << std::endl; unsigned int l(0); tempMap = msrRunList->at(0).GetMap(); @@ -1093,7 +1092,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu if (mapExists) { tempVec[j] = "map"; - tempVec[j].append(boost::lexical_cast(l + 1)); + tempVec[j].append(boost::lexical_cast(l + 1)); lineChanged = true; mapExists = false; } else { @@ -1106,7 +1105,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu msrRunList->at(m).SetMap(tempPar, l); } tempVec[j] = "map"; - tempVec[j].append(boost::lexical_cast(l + 1)); + tempVec[j].append(boost::lexical_cast(l + 1)); lineChanged = true; } } @@ -1128,7 +1127,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu // FUNCTIONS block tempLines = fMsrHandler->GetMsrFunctions(); - string::size_type pos(0); + std::string::size_type pos(0); for (unsigned int i(0); i < tempLines->size(); ++i) { line = (*tempLines)[i].fLine.Data(); split( tempVec, line, is_any_of(" ()+-*/=\t,") ); // split the function line at spaces and some characters that might be juxtaposed to the parameters @@ -1139,12 +1138,12 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu if (!msrParamList->at(tempPar - 1).fIsGlobal) { - cerr << endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(tempPar - 1).fName.Data() \ + std::cerr << std::endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(tempPar - 1).fName.Data() \ << " is recognized as run specific!"; - cerr << endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template FUNCTIONS block."; - cerr << endl << ">> msr2data: **WARNING** The FUNCTIONS block entry will be substituted by a mapped parameter."; - cerr << endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** Still it appears directly (un-mapped) in the template FUNCTIONS block."; + std::cerr << std::endl << ">> msr2data: **WARNING** The FUNCTIONS block entry will be substituted by a mapped parameter."; + std::cerr << std::endl << ">> msr2data: **WARNING** In case, this is not what has been intended, please review the new msr-file!"; + std::cerr << std::endl; unsigned int l(0); tempMap = msrRunList->at(0).GetMap(); @@ -1176,14 +1175,14 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } pos = line.find(tempVec[j], pos); - if ( pos != string::npos ) { + if ( pos != std::string::npos ) { tempString = "map"; - tempString.append(boost::lexical_cast(l + 1)); + tempString.append(boost::lexical_cast(l + 1)); line.replace(pos, tempVec[j].length(), tempString); } else { - cerr << endl << ">> msr2data: **ERROR** A previously identified parameter in the FUNCTIONS block is not found any more!"; - cerr << endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** A previously identified parameter in the FUNCTIONS block is not found any more!"; + std::cerr << std::endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; + std::cerr << std::endl; } mapExists = false; lineChanged = true; @@ -1191,9 +1190,9 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } catch(boost::bad_lexical_cast &) { - cerr << endl << ">> msr2data: **ERROR** Something is wrong with the parameters used in the FUNCTIONS block!"; - cerr << endl << ">> msr2data: **ERROR** Please report a bug - function parsing should have failed earlier!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Something is wrong with the parameters used in the FUNCTIONS block!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please report a bug - function parsing should have failed earlier!"; + std::cerr << std::endl; return false; } } @@ -1263,7 +1262,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu } } } - tempMap = 0; + tempMap = nullptr; } // if the global+ option is specified, generate new single run msr-files and fit them @@ -1286,29 +1285,29 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu oldTempRun = *fRunVectorIter; if (!success) { - cout << endl << ">> msr2data: **ERROR** Input file generation has not been successful! Quitting..." << endl; + std::cout << std::endl << ">> msr2data: **ERROR** Input file generation has not been successful! Quitting..." << std::endl; return false; } // and do the fitting // check if MUSRFITPATH is set, if not issue a warning - string path(""); + std::string path(""); bool pathSet(false); char *pathPtr(getenv("MUSRFITPATH")); if (pathPtr) { - path = boost::lexical_cast(pathPtr); + path = boost::lexical_cast(pathPtr); if (!path.empty()) { pathSet = true; path.append("/"); } } if (!pathSet) { - cerr << endl << ">> msr2data: **WARNING** The MUSRFITPATH environment variable is not set!"; - cerr << endl << ">> msr2data: **WARNING** Please set it or at least ensure that musrfit can be found on the PATH!" << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** The MUSRFITPATH environment variable is not set!"; + std::cerr << std::endl << ">> msr2data: **WARNING** Please set it or at least ensure that musrfit can be found on the PATH!" << std::endl; } - ostringstream oss; + std::ostringstream oss; oss << path << "musrfit" << " " << *fRunVectorIter << "-OneRunFit" << fFileExtension << ".msr"; - cout << endl << ">> msr2data: **INFO** Calling " << oss.str() << endl; + std::cout << std::endl << ">> msr2data: **INFO** Calling " << oss.str() << std::endl; system(oss.str().c_str()); ++fRunVectorIter; @@ -1316,24 +1315,24 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu // set back the iterator to the first run fRunVectorIter = fRunVector.begin(); - cout << endl << ">> msr2data: **INFO** Continuing with the generation of the global input msr file " << msrOutFile << endl; + std::cout << std::endl << ">> msr2data: **INFO** Continuing with the generation of the global input msr file " << msrOutFile << std::endl; } // now go through the specified runs and add run-specific parameters and RUN blocks PMsrHandler *singleRunMsrFile; - singleRunMsrFile = 0; + singleRunMsrFile = nullptr; - map commentsP, commentsR; + std::map commentsP, commentsR; TString tempTstr; - ostringstream newRunNumber; + std::ostringstream newRunNumber; newRunNumber.fill('0'); - newRunNumber.setf(ios::internal, ios::adjustfield); + newRunNumber.setf(std::ios::internal, std::ios::adjustfield); newRunNumber.width(fRunNumberDigits); newRunNumber << *fRunVectorIter; - //cout << "Number of run specific parameters: " << fNumSpecParam << endl; + //std::cout << "Number of run specific parameters: " << fNumSpecParam << std::endl; if (newRunNumber.str().compare(tempRunNumber.str())) { // first run number does not match the template run number // in global+ mode, read in the single run msr-file of the corresponding run @@ -1343,8 +1342,8 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu // substitute the template run-numbers in the parameter names for (unsigned int l(fNumGlobalParam); l < msrParamList->size(); ++l) { tempParamName = msrParamList->at(l).fName.Data(); - string::size_type loc = tempParamName.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = tempParamName.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { tempParamName.replace(loc, fRunNumberDigits, newRunNumber.str()); msrParamList->at(l).fName = tempParamName; if (globalPlus && singleRunMsrFile) { @@ -1352,34 +1351,34 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu fMsrHandler->SetMsrParamStep(l, singleRunMsrFile->GetMsrParamList()->at(l).fStep); } } else { - cerr << endl << ">> msr2data: **ERROR** The indices of the run specific parameters do not match the template run number!"; - cerr << endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The indices of the run specific parameters do not match the template run number!"; + std::cerr << std::endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; + std::cerr << std::endl; } } if (singleRunMsrFile) { delete singleRunMsrFile; - singleRunMsrFile = 0; + singleRunMsrFile = nullptr; } // substitute the template run-numbers in the RUN names for (unsigned int i(0); i < fNumTempRunBlocks; ++i) { tempRunName = msrRunList->at(i).GetRunName()->Data(); - string::size_type loc = tempRunName.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = tempRunName.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { tempRunName.replace(loc, fRunNumberDigits, newRunNumber.str()); tempTstr = TString(tempRunName); msrRunList->at(i).SetRunName(tempTstr, 0); } else { - cerr << endl << ">> msr2data: **ERROR** A template run file number does not match the \"file index\""; - cerr << endl << ">> msr2data: **ERROR** Please check the template file!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** A template run file number does not match the \"file index\""; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check the template file!"; + std::cerr << std::endl; return false; } } } - ostringstream tempStrStr; + std::ostringstream tempStrStr; // comments for the output-file if (fNumGlobalParam) { @@ -1401,16 +1400,16 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu ++fRunVectorIter; UInt_t runcounter(0); - map *runParGlobal(0); - map::iterator iter; - PIntVector *runMapGlobal(0); + std::map *runParGlobal(nullptr); + std::map::iterator iter; + PIntVector *runMapGlobal(nullptr); while (fRunVectorIter != fRunVector.end()) { tempRunNumber.str(newRunNumber.str()); newRunNumber.str(""); newRunNumber.clear(); newRunNumber.fill('0'); - newRunNumber.setf(ios::internal, ios::adjustfield); + newRunNumber.setf(std::ios::internal, std::ios::adjustfield); newRunNumber.width(fRunNumberDigits); newRunNumber << *fRunVectorIter; @@ -1422,8 +1421,8 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu for (unsigned int l(0); l < fNumSpecParam; ++l) { msrParamList->push_back(msrParamList->at(fNumGlobalParam + runcounter*fNumSpecParam + l)); tempParamName = msrParamList->back().fName.Data(); - string::size_type loc = tempParamName.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = tempParamName.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { tempParamName.replace(loc, fRunNumberDigits, newRunNumber.str()); msrParamList->back().fName = tempParamName; msrParamList->back().fNo += fNumSpecParam; @@ -1432,29 +1431,29 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu fMsrHandler->SetMsrParamStep(msrParamList->size() - 1, singleRunMsrFile->GetMsrParamList()->at(fNumGlobalParam + l).fStep); } } else { - cerr << endl << ">> msr2data: **ERROR** Something went wrong when appending new parameters!"; - cerr << endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Something went wrong when appending new parameters!"; + std::cerr << std::endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; + std::cerr << std::endl; } } if (singleRunMsrFile) { delete singleRunMsrFile; - singleRunMsrFile = 0; + singleRunMsrFile = nullptr; } // add RUN blocks for each run for (unsigned int i(0); i < fNumTempRunBlocks; ++i) { msrRunList->push_back(msrRunList->at(runcounter*fNumTempRunBlocks + i)); tempRunName = msrRunList->back().GetRunName()->Data(); - string::size_type loc = tempRunName.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = tempRunName.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { tempRunName.replace(loc, fRunNumberDigits, newRunNumber.str()); tempTstr = TString(tempRunName); msrRunList->back().SetRunName(tempTstr, 0); } else { - cerr << endl << ">> msr2data: **ERROR** Something went wrong when appending new RUN blocks!"; - cerr << endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Something went wrong when appending new RUN blocks!"; + std::cerr << std::endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; + std::cerr << std::endl; return false; } // change run specific parameter numbers in the new RUN block @@ -1514,19 +1513,19 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu fMsrHandler->GetMsrStatistic()->fValid = false; // write the global msr-file - status = fMsrHandler->WriteMsrFile(msrOutFile.c_str(), &commentsP, 0, 0, &commentsR); + status = fMsrHandler->WriteMsrFile(msrOutFile.c_str(), &commentsP, nullptr, nullptr, &commentsR); if (status != PMUSR_SUCCESS) { - cerr << endl << ">> msr2data: **ERROR** Writing the new msr-file has not been successful!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Writing the new msr-file has not been successful!"; + std::cerr << std::endl; return false; } // set back the run-iterator to the start fRunVectorIter = fRunVector.begin(); - msrParamList = 0; - msrRunList = 0; + msrParamList = nullptr; + msrRunList = nullptr; return true; } @@ -1553,24 +1552,24 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const PMsrRunList runListCopy(*msrRunList); TString titleCopy(*(fMsrHandler->GetMsrTitle())); - ostringstream tempRunNumber; + std::ostringstream tempRunNumber; tempRunNumber.fill('0'); - tempRunNumber.setf(ios::internal, ios::adjustfield); + tempRunNumber.setf(std::ios::internal, std::ios::adjustfield); tempRunNumber.width(fRunNumberDigits); tempRunNumber << tempRun; - ostringstream newRunNumber; + std::ostringstream newRunNumber; newRunNumber.fill('0'); - newRunNumber.setf(ios::internal, ios::adjustfield); + newRunNumber.setf(std::ios::internal, std::ios::adjustfield); newRunNumber.width(fRunNumberDigits); newRunNumber << *fRunVectorIter; - string tempParamName, tempRunName; + std::string tempParamName, tempRunName; TString tempTstr; - ostringstream msrOutFile; + std::ostringstream msrOutFile; msrOutFile << *fRunVectorIter << "-OneRunFit" << fFileExtension << ".msr"; - cout << endl << ">> msr2data: **INFO** Generating new input msr file " << msrOutFile.str() << endl; + std::cout << std::endl << ">> msr2data: **INFO** Generating new input msr file " << msrOutFile.str() << std::endl; tempTstr = TString(newRunNumber.str()); fMsrHandler->SetMsrTitle(tempTstr); @@ -1578,14 +1577,14 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const // remove the template run-numbers in the parameter names for (unsigned int l(fNumGlobalParam); l < msrParamList->size(); ++l) { tempParamName = msrParamList->at(l).fName.Data(); - string::size_type loc = tempParamName.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = tempParamName.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { tempParamName.erase(loc); msrParamList->at(l).fName = tempParamName; } else { - cerr << endl << ">> msr2data: **ERROR** The indices of the run specific parameters do not match the template run number!"; - cerr << endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The indices of the run specific parameters do not match the template run number!"; + std::cerr << std::endl << ">> msr2data: **ERROR** This should not happen! Please report a bug!"; + std::cerr << std::endl; } } @@ -1593,15 +1592,15 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const // substitute the template run-numbers in the RUN names for (unsigned int i(0); i < fNumTempRunBlocks; ++i) { tempRunName = msrRunList->at(i).GetRunName()->Data(); - string::size_type loc = tempRunName.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = tempRunName.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { tempRunName.replace(loc, fRunNumberDigits, newRunNumber.str()); tempTstr = TString(tempRunName); msrRunList->at(i).SetRunName(tempTstr, 0); } else { - cerr << endl << ">> msr2data: **ERROR** A template run file number does not match the \"file index\""; - cerr << endl << ">> msr2data: **ERROR** Please check the template file!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** A template run file number does not match the \"file index\""; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check the template file!"; + std::cerr << std::endl; return false; } } @@ -1623,8 +1622,8 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const titleCopy.Clear(); if (status != PMUSR_SUCCESS) { - cerr << endl << ">> msr2data: **ERROR** Writing the new msr file has not been successful!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** Writing the new msr file has not been successful!"; + std::cerr << std::endl; return false; } @@ -1648,13 +1647,13 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const * \param global global mode or not * \param counter counter used within the global mode to determine how many runs have been processed already */ -int PMsr2Data::WriteOutput(const string &outfile, const vector& paramList, bool db, +int PMsr2Data::WriteOutput(const std::string &outfile, const std::vector& paramList, bool db, unsigned int withHeader, bool global, unsigned int counter) const { // make sure that the parameter number of the parameter list stays within proper bounds for (unsigned int i=0; i fMsrHandler->GetMsrParamList()->size()) { - cerr << "msr2data: **ERROR** found parameter " << paramList[i] << " which is out of bound (>" << fMsrHandler->GetMsrParamList()->size() << ")." << endl; + std::cerr << "msr2data: **ERROR** found parameter " << paramList[i] << " which is out of bound (>" << fMsrHandler->GetMsrParamList()->size() << ")." << std::endl; return -1; } } @@ -1664,14 +1663,14 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa return PMUSR_SUCCESS; } - ostringstream curRunNumber; + std::ostringstream curRunNumber; curRunNumber.fill('0'); - curRunNumber.setf(ios::internal, ios::adjustfield); + curRunNumber.setf(std::ios::internal, std::ios::adjustfield); curRunNumber.width(fRunNumberDigits); curRunNumber << *fRunVectorIter; - string msrTitle(fMsrHandler->GetMsrTitle()->Data()); - string msrFileName(fMsrHandler->GetFileName().Data()); + std::string msrTitle(fMsrHandler->GetMsrTitle()->Data()); + std::string msrFileName(fMsrHandler->GetFileName().Data()); unsigned int msrNoOfParams(fMsrHandler->GetNoOfParams()); PMsrParamList *msrParamList(fMsrHandler->GetMsrParamList()); PMsrRunList *msrRunList(fMsrHandler->GetMsrRunList()); @@ -1680,18 +1679,18 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa // since the DB-ASCII-output is in principle independent of the original msr-file-generation // the number of global and run specific parameters as well as the number of RUN blocks per run number have to be determined again // in case no msr-file has been created before. - ostringstream tempRunNumber; - string tempName; + std::ostringstream tempRunNumber; + std::string tempName; if (!fNumGlobalParam && !fNumSpecParam && !fNumTempRunBlocks) { // if not all parameters are zero they have been determined before tempRunNumber.fill('0'); - tempRunNumber.setf(ios::internal, ios::adjustfield); + tempRunNumber.setf(std::ios::internal, std::ios::adjustfield); tempRunNumber.width(fRunNumberDigits); tempRunNumber << fRunVector.front(); // search parameter list for run-specific parameters for (unsigned int i(0); i < msrParamList->size(); ++i) { tempName = msrParamList->at(i).fName.Data(); - string::size_type loc = tempName.rfind(tempRunNumber.str()); + std::string::size_type loc = tempName.rfind(tempRunNumber.str()); if ((tempName.length() > fRunNumberDigits) && (loc == tempName.length() - fRunNumberDigits)) { if (!fNumSpecParam) { fNumGlobalParam = i; @@ -1706,19 +1705,19 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa // look through the RUN blocks and count them for (unsigned int i(0); i < msrRunList->size(); ++i) { tempName = msrRunList->at(i).GetRunName()->Data(); - string::size_type loc = tempName.rfind(tempRunNumber.str()); - if ( loc != string::npos ) { + std::string::size_type loc = tempName.rfind(tempRunNumber.str()); + if ( loc != std::string::npos ) { ++fNumTempRunBlocks; } } -// cerr << endl << ">> msr2data: **WARNING** At the moment the full integrity of the global msr file cannot be checked!"; -// cerr << endl << ">> msr2data: **WARNING** It should therefore be checked carefully that the run order is consistent"; -// cerr << endl << ">> msr2data: **WARNING** in the specified run list, the parameters and the RUN blocks in the msr file!"; -// cerr << endl << ">> msr2data: **WARNING** A simple check for the first specified run yields:"; -// cerr << endl << ">> msr2data: **WARNING** Number of global parameters: " << fNumGlobalParam; -// cerr << endl << ">> msr2data: **WARNING** Number of run specific parameters: " << fNumSpecParam; -// cerr << endl << ">> msr2data: **WARNING** Number of RUN blocks per run number: " << fNumTempRunBlocks; -// cerr << endl; +// std::cerr << std::endl << ">> msr2data: **WARNING** At the moment the full integrity of the global msr file cannot be checked!"; +// std::cerr << std::endl << ">> msr2data: **WARNING** It should therefore be checked carefully that the run order is consistent"; +// std::cerr << std::endl << ">> msr2data: **WARNING** in the specified run list, the parameters and the RUN blocks in the msr file!"; +// std::cerr << std::endl << ">> msr2data: **WARNING** A simple check for the first specified run yields:"; +// std::cerr << std::endl << ">> msr2data: **WARNING** Number of global parameters: " << fNumGlobalParam; +// std::cerr << std::endl << ">> msr2data: **WARNING** Number of run specific parameters: " << fNumSpecParam; +// std::cerr << std::endl << ">> msr2data: **WARNING** Number of RUN blocks per run number: " << fNumTempRunBlocks; +// std::cerr << std::endl; } // Two more simple consistency checks bool okP(true), okR(true); @@ -1729,10 +1728,10 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa } if (!okP) { - cerr << endl << ">> msr2data: **ERROR** The number of parameters or their grouping is not consistent with the specified run list!"; - cerr << endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file!"; - cerr << endl << ">> msr2data: **ERROR** No output will be written!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The number of parameters or their grouping is not consistent with the specified run list!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file!"; + std::cerr << std::endl << ">> msr2data: **ERROR** No output will be written!"; + std::cerr << std::endl; return -1; } @@ -1743,10 +1742,10 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa } if (!okR) { - cerr << endl << ">> msr2data: **ERROR** The number of RUN blocks or their grouping is not consistent with the specified run list!"; - cerr << endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file!"; - cerr << endl << ">> msr2data: **ERROR** No output will be written!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The number of RUN blocks or their grouping is not consistent with the specified run list!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file!"; + std::cerr << std::endl << ">> msr2data: **ERROR** No output will be written!"; + std::cerr << std::endl; return -1; } @@ -1755,13 +1754,13 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa tempRunNumber.clear(); tempRunNumber.str(""); tempRunNumber.fill('0'); - tempRunNumber.setf(ios::internal, ios::adjustfield); + tempRunNumber.setf(std::ios::internal, std::ios::adjustfield); tempRunNumber.width(fRunNumberDigits); tempRunNumber << fRunVector[a]; for (unsigned int i(0); i < fNumSpecParam; ++i) { tempName = msrParamList->at(fNumGlobalParam + a*fNumSpecParam + i).fName.Data(); - string::size_type loc = tempName.rfind(tempRunNumber.str()); + std::string::size_type loc = tempName.rfind(tempRunNumber.str()); if (!(tempName.length() > fRunNumberDigits) || !(loc == tempName.length() - fRunNumberDigits)) { okP = false; break; @@ -1773,10 +1772,10 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa } if (!okP) { - cerr << endl << ">> msr2data: **ERROR** The run specific parameter names are not consistent with the specified run list!"; - cerr << endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file and the run list!"; - cerr << endl << ">> msr2data: **ERROR** No output will be written!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The run specific parameter names are not consistent with the specified run list!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file and the run list!"; + std::cerr << std::endl << ">> msr2data: **ERROR** No output will be written!"; + std::cerr << std::endl; return -1; } @@ -1784,14 +1783,14 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa tempRunNumber.clear(); tempRunNumber.str(""); tempRunNumber.fill('0'); - tempRunNumber.setf(ios::internal, ios::adjustfield); + tempRunNumber.setf(std::ios::internal, std::ios::adjustfield); tempRunNumber.width(fRunNumberDigits); tempRunNumber << fRunVector[a]; for (unsigned int i(0); i < fNumTempRunBlocks; ++i) { tempName = msrRunList->at(a*fNumTempRunBlocks + i).GetRunName()->Data(); - string::size_type loc = tempName.rfind(tempRunNumber.str()); - if (loc == string::npos) { + std::string::size_type loc = tempName.rfind(tempRunNumber.str()); + if (loc == std::string::npos) { okR = false; break; } @@ -1802,17 +1801,17 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa } if (!okR) { - cerr << endl << ">> msr2data: **ERROR** The run names in the RUN blocks are not consistent with the specified run list!"; - cerr << endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file and the run list!"; - cerr << endl << ">> msr2data: **ERROR** No output will be written!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The run names in the RUN blocks are not consistent with the specified run list!"; + std::cerr << std::endl << ">> msr2data: **ERROR** Please check carefully the integrity of the msr file and the run list!"; + std::cerr << std::endl << ">> msr2data: **ERROR** No output will be written!"; + std::cerr << std::endl; return -1; } } - vector dataParamNames; - vector dataParamLabels; - vector dataParam, dataParamErr; + std::vector dataParamNames; + std::vector dataParamLabels; + std::vector dataParam, dataParamErr; if (fDataHandler) { PRawRunData *rawRunData; @@ -1830,7 +1829,7 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa dataParamErr.push_back(rawRunData->GetTempError(0)); break; default: - ostringstream oss; + std::ostringstream oss; for (unsigned int i(0); iGetNoOfTemperatures(); i++) { oss << "dataT" << i; dataParamNames.push_back(oss.str()); @@ -1889,18 +1888,18 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa dataParam.push_back(value); } - rawRunData = 0; + rawRunData = nullptr; } // get the independent variable values from the runlist file if needed PDoubleVector indVarValues; if (fRunListFile) { - string line; - vector splitVec; + std::string line; + std::vector splitVec; unsigned int runNo; double val; - istringstream strLine; + std::istringstream strLine; while (getline(*fRunListFileStream, line)) { trim(line); @@ -1914,9 +1913,9 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa strLine.str(splitVec[0]); strLine >> runNo; if (runNo != *fRunVectorIter) { - cerr << endl << ">> msr2data: **ERROR** The run number in the runlist file does not match the one which should be processed..."; - cerr << endl << ">> msr2data: **ERROR** Something is very strange... Please report this bug!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The run number in the runlist file does not match the one which should be processed..."; + std::cerr << std::endl << ">> msr2data: **ERROR** Something is very strange... Please report this bug!"; + std::cerr << std::endl; fRunVectorIter = fRunVector.end(); return -1; } @@ -1924,9 +1923,9 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa indVarValues.push_back(val); } if (indVarValues.size() != fIndVar.size()) { - cerr << endl << ">> msr2data: **ERROR** The number of data entries in the runlist file for the run number " << runNo; - cerr << endl << ">> msr2data: **ERROR** does not match the number of labels given in the RUN-line! Please check the file!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The number of data entries in the runlist file for the run number " << runNo; + std::cerr << std::endl << ">> msr2data: **ERROR** does not match the number of labels given in the RUN-line! Please check the file!"; + std::cerr << std::endl; fRunVectorIter = fRunVector.end(); return -1; } @@ -1938,17 +1937,17 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa // The RUNLIST file stream and the run vector iterator might get out of synchronization, if the following check is placed before the above block... PMsrStatisticStructure *msrStatistic(fMsrHandler->GetMsrStatistic()); if (!msrStatistic->fValid) { // in the GLOBAL mode this has already been checked before -> check should be negative anyway - cerr << endl << ">> msr2data: **WARNING** The fit of run " << *fRunVectorIter << " has not converged!"; - cerr << endl << ">> msr2data: **WARNING** Its parameter data have not been appended to the output file " << outfile; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **WARNING** The fit of run " << *fRunVectorIter << " has not converged!"; + std::cerr << std::endl << ">> msr2data: **WARNING** Its parameter data have not been appended to the output file " << outfile; + std::cerr << std::endl; fRunVectorIter++; delete fMsrHandler; - fMsrHandler = 0; + fMsrHandler = nullptr; if (fDataHandler) { delete fDataHandler; - fDataHandler = 0; + fDataHandler = nullptr; } // clean up some vectors @@ -1962,22 +1961,22 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa } // open the DB or dat file and write the data - fstream outFile; - outFile.open(outfile.c_str(), ios::in | ios::out | ios::ate); + std::fstream outFile; + outFile.open(outfile.c_str(), std::ios::in | std::ios::out | std::ios::ate); if (outFile.is_open()) { if (((withHeader == 0) || (withHeader == 1)) && !fHeaderWritten) { // Header should (not) be written explicitly, start writing at the end of the file // This also ensures the backward compatibility to the old "noheader" option - outFile.seekp(0, ios::end); + outFile.seekp(0, std::ios::end); } else { if (!fHeaderWritten) { // File already present: assume header is present already and find the last written block fHeaderWritten = true; } int size(outFile.tellg()); - string s; + std::string s; for (int i(1); i<=size; ++i) { // find the last non-empty line - outFile.seekg(-i, ios::end); + outFile.seekg(-i, std::ios::end); getline(outFile, s); trim(s); // remove whitespace if (s.empty()) { // trim cuts off also characters like '\n', therefore this should work also with M$-DOS linebreaks @@ -1989,16 +1988,16 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa continue; } } else { - outFile.seekp(0, ios::cur); + outFile.seekp(0, std::ios::cur); break; } } } } else { - outFile.open(outfile.c_str(), ios::out); + outFile.open(outfile.c_str(), std::ios::out); if (!outFile.is_open()) { - cerr << endl << ">> msr2data: **ERROR** The output file " << outfile << " cannot be opened! Please check!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The output file " << outfile << " cannot be opened! Please check!"; + std::cerr << std::endl; fRunVectorIter = fRunVector.end(); return -1; } @@ -2007,68 +2006,68 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa if (db) { if (withHeader && !fHeaderWritten) { - cout << endl << ">> msr2data: **INFO** Write a new DB file header to " << outfile << endl; + std::cout << std::endl << ">> msr2data: **INFO** Write a new DB file header to " << outfile << std::endl; - outFile << "TITLE" << endl; - outFile << ">>>Put your title here<<<" << endl << endl; - outFile << "Abstract" << endl; - outFile << ">>>Put your abstract here<<<" << endl << endl; - outFile << "LABELS" << endl; + outFile << "TITLE" << std::endl; + outFile << ">>>Put your title here<<<" << std::endl << std::endl; + outFile << "Abstract" << std::endl; + outFile << ">>>Put your abstract here<<<" << std::endl << std::endl; + outFile << "LABELS" << std::endl; if (fDataHandler) { for (unsigned int i(0); i < dataParamLabels.size(); ++i) { - outFile << dataParamLabels[i] << endl; + outFile << dataParamLabels[i] << std::endl; } } if (fRunListFile) { for (unsigned int i(0); i < fIndVar.size(); ++i) { - outFile << fIndVar[i] << endl; + outFile << fIndVar[i] << std::endl; } } // in the GLOBAL mode write only global parameters and those which belong to the actual run - in the NORMAL mode write all parameters if (global) { - string tempName; + std::string tempName; for (unsigned int i(0); i < fNumGlobalParam; ++i) { if (InParameterList(i, paramList)) - outFile << (*msrParamList)[i].fName.Data() << endl; + outFile << (*msrParamList)[i].fName.Data() << std::endl; } for (unsigned int i(0); i < fNumSpecParam; ++i) { if (InParameterList(fNumGlobalParam + fNumSpecParam*counter + i, paramList)) { tempName = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data(); - string::size_type loc = tempName.rfind(curRunNumber.str()); + std::string::size_type loc = tempName.rfind(curRunNumber.str()); if (loc == tempName.length() - fRunNumberDigits) { - outFile << tempName.substr(0, loc) << endl; + outFile << tempName.substr(0, loc) << std::endl; } else { - cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; - cerr << endl << ">> msr2data: **ERROR** The output will be flawed!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; + std::cerr << std::endl << ">> msr2data: **ERROR** The output will be flawed!"; + std::cerr << std::endl; } } } } else { for (unsigned int i(0); i < msrNoOfParams; ++i) { if (InParameterList(i, paramList)) - outFile << (*msrParamList)[i].fName.Data() << endl; + outFile << (*msrParamList)[i].fName.Data() << std::endl; } } if (msrStatistic->fChisq) - outFile << "CHISQ" << endl; + outFile << "CHISQ" << std::endl; else - outFile << "maxLH" << endl; + outFile << "maxLH" << std::endl; - outFile << "NDF" << endl; + outFile << "NDF" << std::endl; if (msrStatistic->fChisq) - outFile << "CHISQred" << endl; + outFile << "CHISQred" << std::endl; else - outFile << "maxLHred" << endl; + outFile << "maxLHred" << std::endl; - outFile << "RUN" << endl; + outFile << "RUN" << std::endl; - outFile << endl << "Data"; + outFile << std::endl << "Data"; if (fDataHandler) { for (unsigned int i(0); i < dataParamNames.size(); ++i) { @@ -2084,7 +2083,7 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa // in the GLOBAL mode write only global parameters and those which belong to the actual run - in the NORMAL mode write all parameters if (global) { - string tempName; + std::string tempName; for (unsigned int i(0); i < fNumGlobalParam; ++i) { if (InParameterList(i, paramList)) outFile << " " << (*msrParamList)[i].fName.Data(); @@ -2092,13 +2091,13 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa for (unsigned int i(0); i < fNumSpecParam; ++i) { if (InParameterList(i, paramList)) { tempName = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data(); - string::size_type loc = tempName.rfind(curRunNumber.str()); + std::string::size_type loc = tempName.rfind(curRunNumber.str()); if (loc == tempName.length() - fRunNumberDigits) { outFile << " " << tempName.substr(0, loc); } else { - cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; - cerr << endl << ">> msr2data: **ERROR** The output will be flawed!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; + std::cerr << std::endl << ">> msr2data: **ERROR** The output will be flawed!"; + std::cerr << std::endl; } } } @@ -2121,9 +2120,9 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa else outFile << " " << "maxLHred"; - outFile << " " << "RUN" << endl; + outFile << " " << "RUN" << std::endl; - outFile << "\\-e" << endl; + outFile << "\\-e" << std::endl; fHeaderWritten = true; } @@ -2132,21 +2131,21 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa for (unsigned int i(0); i < dataParam.size(); ++i) { if (i < dataParamErr.size()) outFile << dataParamNames[i] << " = " << dataParam[i] << ", " \ - << dataParamErr[i] << ", " << dataParamErr[i] << ",\\" << endl; + << dataParamErr[i] << ", " << dataParamErr[i] << ",\\" << std::endl; else - outFile << dataParamNames[i] << " = " << dataParam[i] << ", 0, 0,\\" << endl; + outFile << dataParamNames[i] << " = " << dataParam[i] << ", 0, 0,\\" << std::endl; } } if (fRunListFile) { for (unsigned int i(0); i < indVarValues.size(); ++i) { - outFile << fIndVar[i] << " = " << indVarValues[i] << ", 0, 0,\\" << endl; + outFile << fIndVar[i] << " = " << indVarValues[i] << ", 0, 0,\\" << std::endl; } } // in the GLOBAL mode write only global parameters and those which belong to the actual run - in the NORMAL mode write all parameters if (global) { - string tempName; + std::string tempName; unsigned int idx; for (unsigned int i(0); i < fNumGlobalParam; ++i) { if (InParameterList(i, paramList)) { @@ -2162,14 +2161,14 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa outFile << (*msrParamList)[i].fPosError << ", "; else outFile << fabs((*msrParamList)[i].fStep) << ", "; - outFile << fabs((*msrParamList)[i].fStep) << ",\\" << endl; + outFile << fabs((*msrParamList)[i].fStep) << ",\\" << std::endl; } } for (unsigned int i(0); i < fNumSpecParam; ++i) { idx = fNumGlobalParam + fNumSpecParam*counter + i; if (InParameterList(idx, paramList)) { tempName = (*msrParamList)[idx].fName.Data(); - string::size_type loc = tempName.rfind(curRunNumber.str()); + std::string::size_type loc = tempName.rfind(curRunNumber.str()); if (loc == tempName.length() - fRunNumberDigits) { outFile << tempName.substr(0, loc) << " = "; if ((*msrParamList)[idx].fPosErrorPresent) { @@ -2186,7 +2185,7 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa outFile << ", "; } WriteValue(outFile, (*msrParamList)[idx].fStep, (*msrParamList)[idx].fStep, outFile.width(), db); - outFile << ",\\" << endl; + outFile << ",\\" << std::endl; } } } @@ -2209,24 +2208,24 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa outFile << ", "; } WriteValue(outFile, (*msrParamList)[i].fStep, (*msrParamList)[i].fStep, outFile.width(), db); - outFile << ",\\" << endl; + outFile << ",\\" << std::endl; } } } if (msrStatistic->fChisq) - outFile << "CHISQ = " << msrStatistic->fMin << ", 0, 0,\\" << endl; + outFile << "CHISQ = " << msrStatistic->fMin << ", 0, 0,\\" << std::endl; else - outFile << "maxLH = " << msrStatistic->fMin << ", 0, 0,\\" << endl; + outFile << "maxLH = " << msrStatistic->fMin << ", 0, 0,\\" << std::endl; - outFile << "NDF = " << msrStatistic->fNdf << ", 0, 0,\\" << endl; + outFile << "NDF = " << msrStatistic->fNdf << ", 0, 0,\\" << std::endl; if (msrStatistic->fChisq) - outFile << "CHISQred = " << msrStatistic->fMin/msrStatistic->fNdf << ", 0, 0,\\" << endl; + outFile << "CHISQred = " << msrStatistic->fMin/msrStatistic->fNdf << ", 0, 0,\\" << std::endl; else - outFile << "maxLHred = " << msrStatistic->fMin/msrStatistic->fNdf << ", 0, 0,\\" << endl; + outFile << "maxLHred = " << msrStatistic->fMin/msrStatistic->fNdf << ", 0, 0,\\" << std::endl; - outFile << *fRunVectorIter << ",,, " << msrTitle << endl; + outFile << *fRunVectorIter << ",,, " << msrTitle << std::endl; } else { // no DB file but ASCII file with data columns @@ -2242,7 +2241,7 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa maxlength = length; } // in the GLOBAL mode write only global parameters and those which belong to the actual run - in the NORMAL mode write all parameters - string s; + std::string s; if (global) { for (unsigned int i(0); i < fNumGlobalParam; ++i) { if (InParameterList(i, paramList)) { @@ -2257,15 +2256,15 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa idx = fNumGlobalParam + fNumSpecParam*counter + i; if (InParameterList(idx, paramList)) { s = (*msrParamList)[idx].fName.Data(); - string::size_type loc = s.rfind(curRunNumber.str()); + std::string::size_type loc = s.rfind(curRunNumber.str()); if (loc == s.length() - fRunNumberDigits) { length = s.length() - fRunNumberDigits; if (length > maxlength) maxlength = length; } else { - cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; - cerr << endl << ">> msr2data: **ERROR** The output will be flawed!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; + std::cerr << std::endl << ">> msr2data: **ERROR** The output will be flawed!"; + std::cerr << std::endl; } } } @@ -2285,21 +2284,21 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa maxlength += 1; // maximum length of parameter names + ' ' if (withHeader && !fHeaderWritten) { - cout << endl << ">> msr2data: **INFO** Write a new simple-ASCII file header to " << outfile << endl; + std::cout << std::endl << ">> msr2data: **INFO** Write a new simple-ASCII file header to " << outfile << std::endl; if (fDataHandler) { for (unsigned int i(0); i < dataParamNames.size(); ++i) { s = dataParamNames[i]; if (i < dataParamErr.size()) { - outFile << setw(maxlength) << left << s << setw(maxlength + 3) << left << s + "Err"; + outFile << std::setw(maxlength) << std::left << s << std::setw(maxlength + 3) << std::left << s + "Err"; } else - outFile << setw(maxlength) << left << s; + outFile << std::setw(maxlength) << std::left << s; } } if (fRunListFile) { for (unsigned int i(0); i < fIndVar.size(); ++i) { - outFile << setw(maxlength) << left << fIndVar[i]; + outFile << std::setw(maxlength) << std::left << fIndVar[i]; } } @@ -2308,9 +2307,9 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa for (unsigned int i(0); i < fNumGlobalParam; ++i) { if (InParameterList(i, paramList)) { s = (*msrParamList)[i].fName.Data(); - outFile << setw(maxlength) << left << s \ - << setw(maxlength + 6) << left << s + "PosErr" \ - << setw(maxlength + 6) << left << s + "NegErr"; + outFile << std::setw(maxlength) << std::left << s \ + << std::setw(maxlength + 6) << std::left << s + "PosErr" \ + << std::setw(maxlength + 6) << std::left << s + "NegErr"; } } unsigned int idx; @@ -2318,16 +2317,16 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa idx = fNumGlobalParam + fNumSpecParam*counter + i; if (InParameterList(idx, paramList)) { s = (*msrParamList)[idx].fName.Data(); - string::size_type loc = s.rfind(curRunNumber.str()); + std::string::size_type loc = s.rfind(curRunNumber.str()); if (loc == s.length() - fRunNumberDigits) { s = s.substr(0, loc); - outFile << setw(maxlength) << left << s \ - << setw(maxlength + 6) << left << s + "PosErr" \ - << setw(maxlength + 6) << left << s + "NegErr"; + outFile << std::setw(maxlength) << std::left << s \ + << std::setw(maxlength + 6) << std::left << s + "PosErr" \ + << std::setw(maxlength + 6) << std::left << s + "NegErr"; } else { - cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; - cerr << endl << ">> msr2data: **ERROR** The output will be flawed!"; - cerr << endl; + std::cerr << std::endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!"; + std::cerr << std::endl << ">> msr2data: **ERROR** The output will be flawed!"; + std::cerr << std::endl; } } } @@ -2335,27 +2334,27 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa for (unsigned int i(0); i < msrNoOfParams; ++i) { if (InParameterList(i, paramList)) { s = (*msrParamList)[i].fName.Data(); - outFile << setw(maxlength) << left << s \ - << setw(maxlength + 6) << left << s + "PosErr" \ - << setw(maxlength + 6) << left << s + "NegErr"; + outFile << std::setw(maxlength) << std::left << s \ + << std::setw(maxlength + 6) << std::left << s + "PosErr" \ + << std::setw(maxlength + 6) << std::left << s + "NegErr"; } } } s.clear(); if (msrStatistic->fChisq) - outFile << setw(maxlength) << left << "CHISQ"; + outFile << std::setw(maxlength) << std::left << "CHISQ"; else - outFile << setw(maxlength) << left << "maxLH"; + outFile << std::setw(maxlength) << std::left << "maxLH"; - outFile << setw(maxlength) << left << "NDF"; + outFile << std::setw(maxlength) << std::left << "NDF"; if (msrStatistic->fChisq) - outFile << setw(maxlength) << left << "CHISQred"; + outFile << std::setw(maxlength) << std::left << "CHISQred"; else - outFile << setw(maxlength) << left << "maxLHred"; + outFile << std::setw(maxlength) << std::left << "maxLHred"; - outFile << setw(maxlength) << left << "RUN" << endl; + outFile << std::setw(maxlength) << std::left << "RUN" << std::endl; fHeaderWritten = true; } @@ -2436,15 +2435,15 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa WriteValue(outFile, msrStatistic->fMin/msrStatistic->fNdf, maxlength); WriteValue(outFile, *fRunVectorIter, maxlength); - outFile << endl; + outFile << std::endl; } if (global) { - cout << endl << ">> msr2data: **INFO** Parameter data of run " << *fRunVectorIter << " of file " << msrFileName \ - << " have been appended to " << outfile << endl; + std::cout << std::endl << ">> msr2data: **INFO** Parameter data of run " << *fRunVectorIter << " of file " << msrFileName \ + << " have been appended to " << outfile << std::endl; } else { - cout << endl << ">> msr2data: **INFO** Parameter data of file " << msrFileName << " have been appended to " << outfile << endl; + std::cout << std::endl << ">> msr2data: **INFO** Parameter data of file " << msrFileName << " have been appended to " << outfile << std::endl; } fRunVectorIter++; @@ -2453,16 +2452,16 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa if (!global || (fRunVectorIter == fRunVector.end())) { delete fMsrHandler; - fMsrHandler = 0; + fMsrHandler = nullptr; if (fDataHandler) { delete fDataHandler; - fDataHandler = 0; + fDataHandler = nullptr; } } - msrParamList = 0; - msrRunList = 0; + msrParamList = nullptr; + msrRunList = nullptr; // clean up some vectors dataParamNames.clear(); @@ -2483,13 +2482,13 @@ int PMsr2Data::WriteOutput(const string &outfile, const vector& pa * \param value number to be written to the ASCII file * \param width column width of the ASCII file */ -void PMsr2Data::WriteValue(fstream &outFile, const double &value, const unsigned int &width) const +void PMsr2Data::WriteValue(std::fstream &outFile, const double &value, const unsigned int &width) const { if ((fabs(value) >= 1.0e6) || ((fabs(value) < 1.0e-4) && (fabs(value) > 0.0))) - outFile << scientific << setprecision(width - 8); + outFile << std::scientific << std::setprecision(width - 8); else - outFile.unsetf(ios::floatfield); - outFile << setw(width) << left << value; + outFile.unsetf(std::ios::floatfield); + outFile << std::setw(width) << std::left << value; } //------------------------------------------------------------- @@ -2501,22 +2500,22 @@ void PMsr2Data::WriteValue(fstream &outFile, const double &value, const unsigned * \param errValue * \param width */ -void PMsr2Data::WriteValue(fstream &outFile, const double &value, const double &errValue, const unsigned int &width, const bool &db) const +void PMsr2Data::WriteValue(std::fstream &outFile, const double &value, const double &errValue, const unsigned int &width, const bool &db) const { Int_t previous_prec = outFile.precision(); Int_t prec = GetFirstSignificantDigit(errValue); // for iostream also the number of digit before the decimal points are needed if (fabs(value) > 0.0) - prec += (int)log10(fabs(value)); + prec += static_cast(log10(fabs(value))); if ((fabs(value) >= 1.0e6) || ((fabs(value) < 1.0e-4) && (fabs(value) > 0))) - outFile << scientific; + outFile << std::scientific; else - outFile.unsetf(ios::floatfield); + outFile.unsetf(std::ios::floatfield); outFile.precision(prec); - outFile << setw(width) << left << value; + outFile << std::setw(width) << std::left << value; outFile.precision(previous_prec); // make sure there is at least one space before the next number starts @@ -2555,7 +2554,7 @@ int PMsr2Data::GetFirstSignificantDigit(const double &value) const /** * */ -bool PMsr2Data::InParameterList(const unsigned int ¶mValue, const vector ¶mList) const +bool PMsr2Data::InParameterList(const unsigned int ¶mValue, const std::vector ¶mList) const { // if paramList.size() == 0, i.e. use ALL parameters if (paramList.size() == 0) diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index ef095723..a45d5832 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2018 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 * @@ -32,7 +32,6 @@ #include #include #include -using namespace std; #include #include @@ -67,7 +66,7 @@ PMsrHandler::PMsrHandler(const Char_t *fileName, PStartupOptions *startupOptions fStatistic.fMinExpectedPerHisto.clear(); fStatistic.fNdfPerHisto.clear(); - fFuncHandler = 0; + fFuncHandler = nullptr; // check if the file name given is a path-file-name, and if yes, split it into path and file name. if (fFileName.Contains("/")) { @@ -103,7 +102,7 @@ PMsrHandler::~PMsrHandler() if (fFuncHandler) { delete fFuncHandler; - fFuncHandler = 0; + fFuncHandler = nullptr; } } @@ -119,8 +118,8 @@ PMsrHandler::~PMsrHandler() */ Int_t PMsrHandler::ReadMsrFile() { - ifstream f; - string str; + std::ifstream f; + std::string str; TString line; Int_t line_no = 0; Int_t result = PMUSR_SUCCESS; @@ -141,7 +140,7 @@ Int_t PMsrHandler::ReadMsrFile() InitFourierParameterStructure(fFourier); // open msr-file - f.open(fFileName.Data(), iostream::in); + f.open(fFileName.Data(), std::iostream::in); if (!f.is_open()) { return PMUSR_MSR_FILE_NOT_FOUND; } @@ -284,9 +283,9 @@ Int_t PMsrHandler::ReadMsrFile() if ((result == PMUSR_SUCCESS) && !fFourierOnly) { UInt_t parX, parY; if (!CheckUniquenessOfParamNames(parX, parY)) { - cerr << endl << ">> PMsrHandler::ReadMsrFile: **SEVERE ERROR** parameter name " << fParam[parX].fName.Data() << " is identical for parameter no " << fParam[parX].fNo << " and " << fParam[parY].fNo << "!"; - cerr << endl << ">> Needs to be fixed first!"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::ReadMsrFile: **SEVERE ERROR** parameter name " << fParam[parX].fName.Data() << " is identical for parameter no " << fParam[parX].fNo << " and " << fParam[parY].fNo << "!"; + std::cerr << std::endl << ">> Needs to be fixed first!"; + std::cerr << std::endl; result = PMUSR_MSR_SYNTAX_ERROR; } } @@ -327,8 +326,8 @@ Int_t PMsrHandler::ReadMsrFile() // check if the given phases in the Fourier block are in agreement with the Plot block settings if ((fFourier.fPhase.size() > 1) && (fPlots.size() > 0)) { if (fFourier.fPhase.size() != fPlots[0].fRuns.size()) { - cerr << endl << ">> PMsrHandler::ReadMsrFile: **ERROR** if more than one phase is given in the Fourier block,"; - cerr << endl << ">> it needs to correspond to the number of runs in the Plot block!" << endl; + std::cerr << std::endl << ">> PMsrHandler::ReadMsrFile: **ERROR** if more than one phase is given in the Fourier block,"; + std::cerr << std::endl << ">> it needs to correspond to the number of runs in the Plot block!" << std::endl; result = PMUSR_MSR_SYNTAX_ERROR; } } @@ -370,10 +369,10 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) Int_t tag, lineNo = 0, number; Int_t runNo = -1, addRunNo = 0; Int_t plotNo = -1; - string line; + std::string line; TString logFileName, str, sstr, *pstr; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; Bool_t found = false; Bool_t statisticBlockFound = false; Bool_t partialStatisticBlockFound = true; @@ -382,7 +381,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) for (UInt_t i=0; i addt0TagMissing; // needed for proper musrt0 handling + std::vector addt0TagMissing; // needed for proper musrt0 handling PBoolVector bvec; for (UInt_t i=0; iGetEntries() == 0) { // not a parameter line - fout << str.Data() << endl; + fout << str.Data() << std::endl; } else { ostr = dynamic_cast(tokens->At(0)); sstr = ostr->GetString(); @@ -528,11 +527,11 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) assert ((number >= 0) && (number < (Int_t)fParam.size())); // parameter no fout.width(9); - fout << right << fParam[number].fNo; + fout << std::right << fParam[number].fNo; fout << " "; // parameter name fout.width(11); - fout << left << fParam[number].fName.Data(); + fout << std::left << fParam[number].fName.Data(); fout << " "; // value of the parameter if (fParam[number].fStep == 0.0) // if fixed parameter take all significant digits @@ -546,50 +545,50 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) else neededWidth = neededPrec + 3; fout.width(neededWidth); - fout.setf(ios::fixed, ios::floatfield); + fout.setf(std::ios::fixed, std::ios::floatfield); fout.precision(neededPrec); - fout << left << fParam[number].fValue; + fout << std::left << fParam[number].fValue; fout << " "; // value of step/error/neg.error fout.width(11); - fout.setf(ios::fixed); + fout.setf(std::ios::fixed); if (fParam[number].fStep == 0.0) neededPrec = 0; fout.precision(neededPrec); - fout << left << fParam[number].fStep; + fout << std::left << fParam[number].fStep; fout << " "; fout.width(11); - fout.setf(ios::fixed); + fout.setf(std::ios::fixed); fout.precision(neededPrec); if ((fParam[number].fNoOfParams == 5) || (fParam[number].fNoOfParams == 7)) // pos. error given if (fParam[number].fPosErrorPresent && (fParam[number].fStep != 0)) // pos error is a number - fout << left << fParam[number].fPosError; + fout << std::left << fParam[number].fPosError; else // pos error is a none - fout << left << "none"; + fout << std::left << "none"; else // no pos. error - fout << left << "none"; + fout << std::left << "none"; fout << " "; - fout.unsetf(ios::floatfield); + fout.unsetf(std::ios::floatfield); // boundaries if (fParam[number].fNoOfParams > 5) { fout.width(7); fout.precision(prec); if (fParam[number].fLowerBoundaryPresent) - fout << left << fParam[number].fLowerBoundary; + fout << std::left << fParam[number].fLowerBoundary; else - fout << left << "none"; + fout << std::left << "none"; fout << " "; fout.width(7); fout.precision(prec); if (fParam[number].fUpperBoundaryPresent) - fout << left << fParam[number].fUpperBoundary; + fout << std::left << fParam[number].fUpperBoundary; else - fout << left << "none"; + fout << std::left << "none"; fout << " "; } - fout << endl; + fout << std::endl; } else { // not a parameter, hence just copy it - fout << str.Data() << endl; + fout << str.Data() << std::endl; } // clean up tokens delete tokens; @@ -599,12 +598,12 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) found = false; for (UInt_t i=0; iGetFuncString(idx); sstr.ToLower(); - fout << sstr.Data() << endl; + fout << sstr.Data() << std::endl; } } else { - fout << str.Data() << endl; + fout << str.Data() << std::endl; } break; case MSR_TAG_GLOBAL: @@ -627,81 +626,81 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout.width(16); switch (fGlobal.GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << std::endl; break; case MSR_FITTYPE_SINGLE_HISTO_RRF: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << std::endl; break; case MSR_FITTYPE_ASYM: - fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << std::endl ; break; case MSR_FITTYPE_ASYM_RRF: - fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << std::endl ; break; case MSR_FITTYPE_MU_MINUS: - fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ; break; case MSR_FITTYPE_NON_MUSR: - fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ; break; default: break; } } else if (sstr.BeginsWith("rrf_freq", TString::kIgnoreCase) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) { fout.width(16); - fout << left << "rrf_freq "; + fout << std::left << "rrf_freq "; fout.width(8); neededPrec = LastSignificant(fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()),10); fout.precision(neededPrec); - fout << left << fixed << fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()); + fout << std::left << std::fixed << fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()); fout << " " << fGlobal.GetRRFUnit(); - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("rrf_phase", TString::kIgnoreCase) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) { fout.width(16); fout << "rrf_phase "; fout.width(8); - fout << left << fGlobal.GetRRFPhase(); - fout << endl; + fout << std::left << fGlobal.GetRRFPhase(); + fout << std::endl; } else if (sstr.BeginsWith("rrf_packing", TString::kIgnoreCase) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) { fout.width(16); fout << "rrf_packing "; fout.width(8); - fout << left << fGlobal.GetRRFPacking(); - fout << endl; + fout << std::left << fGlobal.GetRRFPacking(); + fout << std::endl; } else if (sstr.BeginsWith("data")) { fout.width(16); - fout << left << "data"; + fout << std::left << "data"; for (UInt_t j=0; j<4; j++) { if (fGlobal.GetDataRange(j) > 0) { fout.width(8); - fout << left << fGlobal.GetDataRange(j); + fout << std::left << fGlobal.GetDataRange(j); } } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("t0")) { fout.width(16); - fout << left << "t0"; + fout << std::left << "t0"; for (UInt_t j=0; j 0) @@ -722,18 +721,18 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) neededPrec = LastSignificant(fGlobal.GetFitRange(j)); fout.width(neededWidth); fout.precision(neededPrec); - fout << left << fixed << fGlobal.GetFitRange(j); + fout << std::left << std::fixed << fGlobal.GetFitRange(j); if (j==0) fout << " "; } } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("packing")) { fout.width(16); - fout << left << "packing"; - fout << fGlobal.GetPacking() << endl; + fout << std::left << "packing"; + fout << fGlobal.GetPacking() << std::endl; } else { - fout << str.Data() << endl; + fout << str.Data() << std::endl; } break; case MSR_TAG_RUN: @@ -743,117 +742,117 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) addRunNo = 0; // reset counter fout << "RUN " << fRuns[runNo].GetRunName()->Data() << " "; pstr = fRuns[runNo].GetBeamline(); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[runNo].GetInstitute(); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[runNo].GetFileFormat(); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data." << std::endl; assert(0); } pstr->ToUpper(); - fout << pstr->Data() << " (name beamline institute data-file-format)" << endl; + fout << pstr->Data() << " (name beamline institute data-file-format)" << std::endl; } else if (sstr.BeginsWith("ADDRUN")) { addRunNo++; fout << "ADDRUN " << fRuns[runNo].GetRunName(addRunNo)->Data() << " "; pstr = fRuns[runNo].GetBeamline(addRunNo); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data (addrun)." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain beamline data (addrun)." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[runNo].GetInstitute(addRunNo); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data (addrun)." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain institute data (addrun)." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[runNo].GetFileFormat(addRunNo); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data (addrun)." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **ERROR** Couldn't obtain file format data (addrun)." << std::endl; assert(0); } pstr->ToUpper(); - fout << pstr->Data() << " (name beamline institute data-file-format)" << endl; + fout << pstr->Data() << " (name beamline institute data-file-format)" << std::endl; } else if (sstr.BeginsWith("fittype")) { fout.width(16); switch (fRuns[runNo].GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << std::endl; break; case MSR_FITTYPE_SINGLE_HISTO_RRF: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << std::endl; break; case MSR_FITTYPE_ASYM: - fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << std::endl ; break; case MSR_FITTYPE_ASYM_RRF: - fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << std::endl ; break; case MSR_FITTYPE_MU_MINUS: - fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ; break; case MSR_FITTYPE_NON_MUSR: - fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ; break; default: break; } } else if (sstr.BeginsWith("alpha ")) { fout.width(16); - fout << left << "alpha"; - fout << fRuns[runNo].GetAlphaParamNo() << endl; + fout << std::left << "alpha"; + fout << fRuns[runNo].GetAlphaParamNo() << std::endl; } else if (sstr.BeginsWith("beta ")) { fout.width(16); - fout << left << "beta"; - fout << fRuns[runNo].GetBetaParamNo() << endl; + fout << std::left << "beta"; + fout << fRuns[runNo].GetBetaParamNo() << std::endl; } else if (sstr.BeginsWith("norm")) { fout.width(16); - fout << left << "norm"; + fout << std::left << "norm"; // check if norm is give as a function if (fRuns[runNo].GetNormParamNo() >= MSR_PARAM_FUN_OFFSET) fout << "fun" << fRuns[runNo].GetNormParamNo()-MSR_PARAM_FUN_OFFSET; else fout << fRuns[runNo].GetNormParamNo(); - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("backgr.fit")) { fout.width(16); - fout << left << "backgr.fit"; - fout << fRuns[runNo].GetBkgFitParamNo() << endl; + fout << std::left << "backgr.fit"; + fout << fRuns[runNo].GetBkgFitParamNo() << std::endl; } else if (sstr.BeginsWith("lifetime ")) { fout.width(16); - fout << left << "lifetime"; - fout << fRuns[runNo].GetLifetimeParamNo() << endl; + fout << std::left << "lifetime"; + fout << fRuns[runNo].GetLifetimeParamNo() << std::endl; } else if (sstr.BeginsWith("lifetimecorrection")) { // obsolate, hence do nothing here } else if (sstr.BeginsWith("map")) { fout << "map "; for (UInt_t j=0; jsize(); j++) { fout.width(5); - fout << right << fRuns[runNo].GetMap(j); + fout << std::right << fRuns[runNo].GetMap(j); } // if there are less maps then 10 fill with zeros if (fRuns[runNo].GetMap()->size() < 10) { for (UInt_t j=fRuns[runNo].GetMap()->size(); j<10; j++) fout << " 0"; } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("forward")) { if (fRuns[runNo].GetForwardHistoNoSize() == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'forward' tag without any data found!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'forward' tag without any data found!"; + std::cerr << std::endl << ">> Something is VERY fishy, please check your msr-file carfully." << std::endl; } else { TString result(""); PIntVector forward; @@ -861,12 +860,12 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) forward.push_back(fRuns[runNo].GetForwardHistoNo(i)); MakeDetectorGroupingString("forward", forward, result); forward.clear(); - fout << result.Data() << endl; + fout << result.Data() << std::endl; } } else if (sstr.BeginsWith("backward")) { if (fRuns[runNo].GetBackwardHistoNoSize() == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'backward' tag without any data found!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'backward' tag without any data found!"; + std::cerr << std::endl << ">> Something is VERY fishy, please check your msr-file carfully." << std::endl; } else { TString result(""); PIntVector backward; @@ -874,27 +873,27 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) backward.push_back(fRuns[runNo].GetBackwardHistoNo(i)); MakeDetectorGroupingString("backward", backward, result); backward.clear(); - fout << result.Data() << endl; + fout << result.Data() << std::endl; } } else if (sstr.BeginsWith("backgr.fix")) { fout.width(16); - fout << left << "backgr.fix"; + fout << std::left << "backgr.fix"; for (UInt_t j=0; j<2; j++) { if (fRuns[runNo].GetBkgFix(j) != PMUSR_UNDEFINED) { fout.precision(prec); fout.width(12); - fout << left << fRuns[runNo].GetBkgFix(j); + fout << std::left << fRuns[runNo].GetBkgFix(j); } } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("background")) { backgroundTagMissing[runNo] = false; fout.width(16); - fout << left << "background"; + fout << std::left << "background"; for (UInt_t j=0; j<4; j++) { if (fRuns[runNo].GetBkgRange(j) > 0) { fout.width(8); - fout << left << fRuns[runNo].GetBkgRange(j); + fout << std::left << fRuns[runNo].GetBkgRange(j); } } if (fRuns[runNo].GetBkgEstimated(0) != PMUSR_UNDEFINED) { @@ -902,76 +901,76 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) if ((Int_t)log10(fRuns[runNo].GetBkgEstimated(0))+1 >= 4) precision = 2; fout << " # estimated bkg: "; - fout << fixed; + fout << std::fixed; fout.precision(precision); fout << fRuns[runNo].GetBkgEstimated(0); if (fRuns[runNo].GetBkgEstimated(1) != PMUSR_UNDEFINED) { fout << " / "; - fout << fixed; + fout << std::fixed; fout.precision(precision); fout << fRuns[runNo].GetBkgEstimated(1); } } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("data")) { dataTagMissing[runNo] = false; fout.width(16); - fout << left << "data"; + fout << std::left << "data"; for (UInt_t j=0; j<4; j++) { if (fRuns[runNo].GetDataRange(j) > 0) { fout.width(8); - fout << left << fRuns[runNo].GetDataRange(j); + fout << std::left << fRuns[runNo].GetDataRange(j); } } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("t0")) { t0TagMissing[runNo] = false; fout.width(16); - fout << left << "t0"; + fout << std::left << "t0"; for (UInt_t j=0; j> PMsrHandler::WriteMsrLogFile: **WARNING** 'addt0' tag without any data found!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addt0' tag without any data found!"; + std::cerr << std::endl << ">> Something is VERY fishy, please check your msr-file carfully." << std::endl; } else { fout.width(16); - fout << left << "addt0"; + fout << std::left << "addt0"; for (Int_t j=0; jIsWhitespace()) { // labels fout.width(16); - fout << left << "xy-data"; + fout << std::left << "xy-data"; fout.width(8); - fout << left << fixed << fRuns[runNo].GetXDataLabel()->Data(); + fout << std::left << std::fixed << fRuns[runNo].GetXDataLabel()->Data(); fout << " "; fout.width(8); - fout << left << fixed << fRuns[runNo].GetYDataLabel()->Data(); - fout << endl; + fout << std::left << std::fixed << fRuns[runNo].GetYDataLabel()->Data(); + fout << std::endl; } } else if (sstr.BeginsWith("fit")) { // check if missing t0/addt0/background/data tag are present eventhough the values are present, if so write these data values @@ -979,60 +978,60 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) if (t0TagMissing[runNo] && fRuns[runNo].GetInstitute()->CompareTo("isis", TString::kIgnoreCase)) { if (fRuns[runNo].GetT0BinSize() > 0) { fout.width(16); - fout << left << "t0"; + fout << std::left << "t0"; for (UInt_t j=0; jCompareTo("isis", TString::kIgnoreCase)) { if (fRuns[runNo].GetAddT0BinSize(i) > 0) { fout.width(16); - fout << left << "addt0"; + fout << std::left << "addt0"; for (Int_t j=0; j= 0) { fout.width(16); - fout << left << "background"; + fout << std::left << "background"; for (UInt_t j=0; j<4; j++) { if (fRuns[runNo].GetBkgRange(j) > 0) { fout.width(8); - fout << left << fRuns[runNo].GetBkgRange(j); + fout << std::left << fRuns[runNo].GetBkgRange(j); } } - fout << endl; + fout << std::endl; } } if (dataTagMissing[runNo]) { if (fRuns[runNo].GetDataRange(0) >= 0) { fout.width(16); - fout << left << "data"; + fout << std::left << "data"; for (UInt_t j=0; j<4; j++) { if (fRuns[runNo].GetDataRange(j) > 0) { fout.width(8); - fout << left << fRuns[runNo].GetDataRange(j); + fout << std::left << fRuns[runNo].GetDataRange(j); } } - fout << endl; + fout << std::endl; } } // write fit range line fout.width(16); - fout << left << "fit"; + fout << std::left << "fit"; if (fRuns[runNo].IsFitRangeInBin()) { // fit range given in bins fout << "fgb"; if (fRuns[runNo].GetFitRangeOffset(0) > 0) @@ -1053,22 +1052,22 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) neededPrec = LastSignificant(fRuns[runNo].GetFitRange(j)); fout.width(neededWidth); fout.precision(neededPrec); - fout << left << fixed << fRuns[runNo].GetFitRange(j); + fout << std::left << std::fixed << fRuns[runNo].GetFitRange(j); if (j==0) fout << " "; } } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("packing")) { fout.width(16); - fout << left << "packing"; - fout << fRuns[runNo].GetPacking() << endl; + fout << std::left << "packing"; + fout << fRuns[runNo].GetPacking() << std::endl; } else { - fout << str.Data() << endl; + fout << str.Data() << std::endl; } break; case MSR_TAG_COMMANDS: - fout << str.Data() << endl; + fout << str.Data() << std::endl; break; case MSR_TAG_FOURIER: sstr = str; @@ -1085,15 +1084,15 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout << "Mc/s"; } fout << " # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'"; - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("fourier_power")) { - fout << "fourier_power " << fFourier.fFourierPower << endl; + fout << "fourier_power " << fFourier.fFourierPower << std::endl; } else if (sstr.BeginsWith("dc-corrected")) { fout << "dc-corrected "; if (fFourier.fDCCorrected == true) - fout << "true" << endl; + fout << "true" << std::endl; else - fout << "false" << endl; + fout << "false" << std::endl; } else if (sstr.BeginsWith("apodization")) { fout << "apodization "; if (fFourier.fApodization == FOURIER_APOD_NONE) { @@ -1106,7 +1105,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout << "STRONG"; } fout << " # NONE, WEAK, MEDIUM, STRONG"; - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("plot")) { fout << "plot "; if (fFourier.fPlotTag == FOURIER_PLOT_REAL) { @@ -1123,29 +1122,29 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout << "PHASE_OPT_REAL"; } fout << " # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL"; - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("phase")) { if (fFourier.fPhaseParamNo.size() > 0) { TString phaseParamStr = BeautifyFourierPhaseParameterString(); - fout << "phase " << phaseParamStr << endl; + fout << "phase " << phaseParamStr << std::endl; } else if (fFourier.fPhase.size() > 0) { fout << "phase "; for (UInt_t i=0; i neededPrec) neededPrec = LastSignificant(fFourier.fPlotRange[1]); fout.precision(neededPrec); - fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << endl; + fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << std::endl; } else { - fout << str.Data() << endl; + fout << str.Data() << std::endl; } break; case MSR_TAG_PLOT: @@ -1154,28 +1153,28 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) if (sstr.BeginsWith("PLOT")) { switch (fPlots[plotNo].fPlotType) { case MSR_PLOT_SINGLE_HISTO: - fout << "PLOT " << fPlots[plotNo].fPlotType << " (single histo plot)" << endl; + fout << "PLOT " << fPlots[plotNo].fPlotType << " (single histo plot)" << std::endl; break; case MSR_PLOT_SINGLE_HISTO_RRF: - fout << "PLOT " << fPlots[plotNo].fPlotType << " (single histo RRF plot)" << endl; + fout << "PLOT " << fPlots[plotNo].fPlotType << " (single histo RRF plot)" << std::endl; break; case MSR_PLOT_ASYM: - fout << "PLOT " << fPlots[plotNo].fPlotType << " (asymmetry plot)" << endl; + fout << "PLOT " << fPlots[plotNo].fPlotType << " (asymmetry plot)" << std::endl; break; case MSR_PLOT_ASYM_RRF: - fout << "PLOT " << fPlots[plotNo].fPlotType << " (asymmetry RRF plot)" << endl; + fout << "PLOT " << fPlots[plotNo].fPlotType << " (asymmetry RRF plot)" << std::endl; break; case MSR_PLOT_MU_MINUS: - fout << "PLOT " << fPlots[plotNo].fPlotType << " (mu minus plot)" << endl; + fout << "PLOT " << fPlots[plotNo].fPlotType << " (mu minus plot)" << std::endl; break; case MSR_PLOT_NON_MUSR: - fout << "PLOT " << fPlots[plotNo].fPlotType << " (non muSR plot)" << endl; + fout << "PLOT " << fPlots[plotNo].fPlotType << " (non muSR plot)" << std::endl; break; default: break; } if (fPlots[plotNo].fLifeTimeCorrection) { - fout << "lifetimecorrection" << endl; + fout << "lifetimecorrection" << std::endl; } } else if (sstr.BeginsWith("lifetimecorrection")) { // do nothing, since it is already handled in the lines above. @@ -1188,7 +1187,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout.width(4); fout << fPlots[plotNo].fRuns[j]; } - fout << endl; + fout << std::endl; } else if (sstr.BeginsWith("range")) { fout << "range "; neededPrec = LastSignificant(fPlots[plotNo].fTmin[0]); @@ -1207,9 +1206,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) fout.precision(neededPrec); fout << fPlots[plotNo].fYmax[0]; } - fout << endl; + fout << std::endl; } else { - fout << str.Data() << endl; + fout << str.Data() << std::endl; } break; case MSR_TAG_STATISTIC: @@ -1218,7 +1217,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) sstr.Remove(TString::kLeading, ' '); if (sstr.BeginsWith("STATISTIC")) { TDatime dt; - fout << "STATISTIC --- " << dt.AsSQLString() << endl; + fout << "STATISTIC --- " << dt.AsSQLString() << std::endl; } else if (sstr.BeginsWith("chisq") || sstr.BeginsWith("maxLH")) { partialStatisticBlockFound = false; if (fStatistic.fValid) { // valid fit result @@ -1227,9 +1226,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } else { str.Form(" maxLH = %.1lf, NDF = %d, maxLH/NDF = %lf", fStatistic.fMin, fStatistic.fNdf, fStatistic.fMin / fStatistic.fNdf); } - fout << str.Data() << endl; + fout << str.Data() << std::endl; if (messages) - cout << endl << str.Data() << endl; + std::cout << std::endl << str.Data() << std::endl; // check if expected chisq needs to be written if (fStatistic.fMinExpected != 0.0) { @@ -1242,10 +1241,10 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << endl << str.Data() << endl; + std::cout << std::endl << str.Data() << std::endl; for (UInt_t i=0; i 0) { @@ -1258,11 +1257,11 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else if (fStatistic.fNdfPerHisto.size() > 1) { // check if per run chisq needs to be written @@ -1276,17 +1275,17 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else { - fout << "*** FIT DID NOT CONVERGE ***" << endl; + fout << "*** FIT DID NOT CONVERGE ***" << std::endl; if (messages) - cout << endl << "*** FIT DID NOT CONVERGE ***" << endl; + std::cout << std::endl << "*** FIT DID NOT CONVERGE ***" << std::endl; } } else if (sstr.BeginsWith("*** FIT DID NOT CONVERGE ***")) { partialStatisticBlockFound = false; @@ -1296,9 +1295,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } else { str.Form(" maxLH = %.1lf, NDF = %d, maxLH/NDF = %lf", fStatistic.fMin, fStatistic.fNdf, fStatistic.fMin / fStatistic.fNdf); } - fout << str.Data() << endl; + fout << str.Data() << std::endl; if (messages) - cout << endl << str.Data() << endl; + std::cout << std::endl << str.Data() << std::endl; // check if expected chisq needs to be written if (fStatistic.fMinExpected != 0.0) { @@ -1311,10 +1310,10 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; for (UInt_t i=0; i 0) { @@ -1327,11 +1326,11 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else if (fStatistic.fNdfPerHisto.size() > 1) { // check if per run chisq needs to be written @@ -1345,27 +1344,27 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else { - fout << "*** FIT DID NOT CONVERGE ***" << endl; + fout << "*** FIT DID NOT CONVERGE ***" << std::endl; if (messages) - cout << endl << "*** FIT DID NOT CONVERGE ***" << endl; + std::cout << std::endl << "*** FIT DID NOT CONVERGE ***" << std::endl; } } else { if (str.Length() > 0) { sstr = str; sstr.Remove(TString::kLeading, ' '); if (!sstr.BeginsWith("expected chisq") && !sstr.BeginsWith("expected maxLH") && !sstr.BeginsWith("run block")) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } else { // only write endl if not eof is reached. This is preventing growing msr-files, i.e. more and more empty lines at the end of the file if (!fin.eof()) - fout << endl; + fout << std::endl; } } break; @@ -1377,19 +1376,19 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) // there was no statistic block present in the msr-input-file if (!statisticBlockFound) { partialStatisticBlockFound = false; - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** no STATISTIC block present, will write a default one" << endl; - fout << "###############################################################" << endl; + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** no STATISTIC block present, will write a default one" << std::endl; + fout << "###############################################################" << std::endl; TDatime dt; - fout << "STATISTIC --- " << dt.AsSQLString() << endl; + fout << "STATISTIC --- " << dt.AsSQLString() << std::endl; if (fStatistic.fValid) { // valid fit result if (fStatistic.fChisq) { str.Form(" chisq = %.1lf, NDF = %d, chisq/NDF = %lf", fStatistic.fMin, fStatistic.fNdf, fStatistic.fMin / fStatistic.fNdf); } else { str.Form(" maxLH = %.1lf, NDF = %d, maxLH/NDF = %lf", fStatistic.fMin, fStatistic.fNdf, fStatistic.fMin / fStatistic.fNdf); } - fout << str.Data() << endl; + fout << str.Data() << std::endl; if (messages) - cout << endl << str.Data() << endl; + std::cout << std::endl << str.Data() << std::endl; // check if expected chisq needs to be written if (fStatistic.fMinExpected != 0.0) { @@ -1402,10 +1401,10 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; for (UInt_t i=0; i 0) { @@ -1418,11 +1417,11 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else if (fStatistic.fNdfPerHisto.size() > 1) { // check if per run chisq needs to be written @@ -1436,35 +1435,35 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else { - fout << "*** FIT DID NOT CONVERGE ***" << endl; + fout << "*** FIT DID NOT CONVERGE ***" << std::endl; if (messages) - cout << endl << "*** FIT DID NOT CONVERGE ***" << endl; + std::cout << std::endl << "*** FIT DID NOT CONVERGE ***" << std::endl; } } // there was only a partial statistic block present in the msr-input-file if (partialStatisticBlockFound) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** garbage STATISTIC block present in the msr-input file."; - cerr << endl << ">> ** WILL ADD SOME SENSIBLE STUFF, BUT YOU HAVE TO CHECK IT SINCE I AM **NOT** REMOVING THE GARBAGE! **" << endl; + std::cerr << std::endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** garbage STATISTIC block present in the msr-input file."; + std::cerr << std::endl << ">> ** WILL ADD SOME SENSIBLE STUFF, BUT YOU HAVE TO CHECK IT SINCE I AM **NOT** REMOVING THE GARBAGE! **" << std::endl; TDatime dt; - fout << "STATISTIC --- " << dt.AsSQLString() << endl; + fout << "STATISTIC --- " << dt.AsSQLString() << std::endl; if (fStatistic.fValid) { // valid fit result if (fStatistic.fChisq) { // chisq str.Form(" chisq = %.1lf, NDF = %d, chisq/NDF = %lf", fStatistic.fMin, fStatistic.fNdf, fStatistic.fMin / fStatistic.fNdf); } else { str.Form(" maxLH = %.1lf, NDF = %d, maxLH/NDF = %lf", fStatistic.fMin, fStatistic.fNdf, fStatistic.fMin / fStatistic.fNdf); } - fout << str.Data() << endl; + fout << str.Data() << std::endl; if (messages) - cout << endl << str.Data() << endl; + std::cout << std::endl << str.Data() << std::endl; // check if expected chisq needs to be written if (fStatistic.fMinExpected != 0.0) { @@ -1477,10 +1476,10 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; for (UInt_t i=0; i 0) { @@ -1493,11 +1492,11 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else if (fStatistic.fNdfPerHisto.size() > 1) { // check if per run chisq needs to be written @@ -1511,17 +1510,17 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } if (fStartupOptions) { if (fStartupOptions->writeExpectedChisq) - fout << str.Data() << endl; + fout << str.Data() << std::endl; } if (messages) - cout << str.Data() << endl; + std::cout << str.Data() << std::endl; } } } else { - fout << "*** FIT DID NOT CONVERGE (4) ***" << endl; + fout << "*** FIT DID NOT CONVERGE (4) ***" << std::endl; if (messages) - cout << endl << "*** FIT DID NOT CONVERGE ***" << endl; + std::cout << std::endl << "*** FIT DID NOT CONVERGE ***" << std::endl; } } @@ -1549,176 +1548,176 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) * * \param filename The name of the output file. */ -Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *commentsPAR, \ - map *commentsTHE, \ - map *commentsFUN, \ - map *commentsRUN) +Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map *commentsPAR, \ + std::map *commentsTHE, \ + std::map *commentsFUN, \ + std::map *commentsRUN) { const UInt_t prec = 6; // output precision for float/doubles const TString hline = "###############################################################"; UInt_t i = 0; - map::iterator iter; + std::map::iterator iter; TString str, *pstr; // open output file for writing - ofstream fout(filename); + std::ofstream fout(filename); if (!fout) { return PMUSR_MSR_FILE_WRITE_ERROR; } // write TITLE - fout << fTitle.Data() << endl; - fout << hline.Data() << endl; + fout << fTitle.Data() << std::endl; + fout << hline.Data() << std::endl; // write FITPARAMETER block - fout << "FITPARAMETER" << endl; - fout << "# No Name Value Step Pos_Error Boundaries" << endl; + fout << "FITPARAMETER" << std::endl; + fout << "# No Name Value Step Pos_Error Boundaries" << std::endl; for (i = 0; i < fParam.size(); ++i) { if (commentsPAR) { iter = commentsPAR->find(i+1); if (iter != commentsPAR->end()) { - fout << endl; - fout << "# " << iter->second.Data() << endl; - fout << endl; + fout << std::endl; + fout << "# " << iter->second.Data() << std::endl; + fout << std::endl; commentsPAR->erase(iter); } } // parameter no fout.width(9); - fout << right << fParam[i].fNo; + fout << std::right << fParam[i].fNo; fout << " "; // parameter name fout.width(11); - fout << left << fParam[i].fName.Data(); + fout << std::left << fParam[i].fName.Data(); fout << " "; // value of the parameter fout.width(9); fout.precision(prec); - fout << left << fParam[i].fValue; + fout << std::left << fParam[i].fValue; fout << " "; // value of step/error/neg.error fout.width(11); fout.precision(prec); - fout << left << fParam[i].fStep; + fout << std::left << fParam[i].fStep; fout << " "; fout.width(11); fout.precision(prec); if ((fParam[i].fNoOfParams == 5) || (fParam[i].fNoOfParams == 7)) // pos. error given if (fParam[i].fPosErrorPresent && (fParam[i].fStep != 0)) // pos error is a number - fout << left << fParam[i].fPosError; + fout << std::left << fParam[i].fPosError; else // pos error is a none - fout << left << "none"; + fout << std::left << "none"; else // no pos. error - fout << left << "none"; + fout << std::left << "none"; fout << " "; // boundaries if (fParam[i].fNoOfParams > 5) { fout.width(7); fout.precision(prec); if (fParam[i].fLowerBoundaryPresent) - fout << left << fParam[i].fLowerBoundary; + fout << std::left << fParam[i].fLowerBoundary; else - fout << left << "none"; + fout << std::left << "none"; fout << " "; fout.width(7); fout.precision(prec); if (fParam[i].fUpperBoundaryPresent) - fout << left << fParam[i].fUpperBoundary; + fout << std::left << fParam[i].fUpperBoundary; else - fout << left << "none"; + fout << std::left << "none"; fout << " "; } - fout << endl; + fout << std::endl; } if (commentsPAR && !commentsPAR->empty()) { - fout << endl; + fout << std::endl; for(iter = commentsPAR->begin(); iter != commentsPAR->end(); ++iter) { - fout << "# " << iter->second.Data() << endl; + fout << "# " << iter->second.Data() << std::endl; } commentsPAR->clear(); } - fout << endl; - fout << hline.Data() << endl; + fout << std::endl; + fout << hline.Data() << std::endl; // write THEORY block - fout << "THEORY" << endl; + fout << "THEORY" << std::endl; for (i = 1; i < fTheory.size(); ++i) { if (commentsTHE) { iter = commentsTHE->find(i); if (iter != commentsTHE->end()) { - fout << endl; - fout << "# " << iter->second.Data() << endl; - fout << endl; + fout << std::endl; + fout << "# " << iter->second.Data() << std::endl; + fout << std::endl; commentsTHE->erase(iter); } } - fout << fTheory[i].fLine.Data() << endl; + fout << fTheory[i].fLine.Data() << std::endl; } if (commentsTHE && !commentsTHE->empty()) { - fout << endl; + fout << std::endl; for(iter = commentsTHE->begin(); iter != commentsTHE->end(); ++iter) { - fout << "# " << iter->second.Data() << endl; + fout << "# " << iter->second.Data() << std::endl; } commentsTHE->clear(); } - fout << endl; - fout << hline.Data() << endl; + fout << std::endl; + fout << hline.Data() << std::endl; // write FUNCTIONS block // or comment it if there is none in the data structures if (fFunctions.size() < 2) fout << "# "; - fout << "FUNCTIONS" << endl; + fout << "FUNCTIONS" << std::endl; for (i = 1; i < fFunctions.size(); ++i) { if (commentsFUN) { iter = commentsFUN->find(i); if (iter != commentsFUN->end()) { - fout << endl; - fout << "# " << iter->second.Data() << endl; - fout << endl; + fout << std::endl; + fout << "# " << iter->second.Data() << std::endl; + fout << std::endl; commentsFUN->erase(iter); } } - fout << fFunctions[i].fLine.Data() << endl; + fout << fFunctions[i].fLine.Data() << std::endl; } if (commentsFUN && !commentsFUN->empty()) { - fout << endl; + fout << std::endl; for(iter = commentsFUN->begin(); iter != commentsFUN->end(); ++iter) { - fout << "# " << iter->second.Data() << endl; + fout << "# " << iter->second.Data() << std::endl; } commentsFUN->clear(); } - fout << endl; - fout << hline.Data() << endl; + fout << std::endl; + fout << hline.Data() << std::endl; // write GLOBAL block if (fGlobal.IsPresent()) { - fout << "GLOBAL" << endl; + fout << "GLOBAL" << std::endl; // fittype if (fGlobal.GetFitType() != -1) { fout.width(16); switch (fGlobal.GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << std::endl; break; case MSR_FITTYPE_SINGLE_HISTO_RRF: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << std::endl; break; case MSR_FITTYPE_ASYM: - fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << std::endl ; break; case MSR_FITTYPE_ASYM_RRF: - fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << std::endl ; break; case MSR_FITTYPE_MU_MINUS: - fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ; break; case MSR_FITTYPE_NON_MUSR: - fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ; break; default: break; @@ -1728,65 +1727,65 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co // RRF related stuff if ((fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) > 0.0) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) { fout.width(16); - fout << left << "rrf_freq "; + fout << std::left << "rrf_freq "; fout.width(8); - fout << left << fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()); + fout << std::left << fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()); fout << " " << fGlobal.GetRRFUnit(); - fout << endl; + fout << std::endl; } if ((fGlobal.GetRRFPhase() != 0.0) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) { fout.width(16); fout << "rrf_phase "; fout.width(8); - fout << left << fGlobal.GetRRFPhase(); - fout << endl; + fout << std::left << fGlobal.GetRRFPhase(); + fout << std::endl; } if ((fGlobal.GetRRFPacking() != -1) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) { fout.width(16); fout << "rrf_packing "; fout.width(8); - fout << left << fGlobal.GetRRFPacking(); - fout << endl; + fout << std::left << fGlobal.GetRRFPacking(); + fout << std::endl; } // data range if ((fGlobal.GetDataRange(0) != -1) || (fGlobal.GetDataRange(1) != -1) || (fGlobal.GetDataRange(2) != -1) || (fGlobal.GetDataRange(3) != -1)) { fout.width(16); - fout << left << "data"; + fout << std::left << "data"; for (UInt_t j=0; j<4; ++j) { if (fGlobal.GetDataRange(j) > 0) { fout.width(8); - fout << left << fGlobal.GetDataRange(j); + fout << std::left << fGlobal.GetDataRange(j); } } - fout << endl; + fout << std::endl; } // t0 if (fGlobal.GetT0BinSize() > 0) { fout.width(16); - fout << left << "t0"; + fout << std::left << "t0"; for (UInt_t j=0; j 0) { fout.width(16); - fout << left << "addt0"; + fout << std::left << "addt0"; for (Int_t k=0; k *co if ( (fGlobal.IsFitRangeInBin() && fGlobal.GetFitRangeOffset(0) != -1) || (fGlobal.GetFitRange(0) != PMUSR_UNDEFINED) ) { fout.width(16); - fout << left << "fit"; + fout << std::left << "fit"; if (fGlobal.IsFitRangeInBin()) { // fit range given in bins fout << "fgb"; if (fGlobal.GetFitRangeOffset(0) > 0) @@ -1810,22 +1809,22 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j)); fout.width(neededWidth); fout.precision(neededPrec); - fout << left << fixed << fGlobal.GetFitRange(j); + fout << std::left << std::fixed << fGlobal.GetFitRange(j); if (j==0) fout << " "; } } - fout << endl; + fout << std::endl; } // packing if (fGlobal.GetPacking() != -1) { fout.width(16); - fout << left << "packing"; - fout << fGlobal.GetPacking() << endl; + fout << std::left << "packing"; + fout << fGlobal.GetPacking() << std::endl; } - fout << endl << hline.Data() << endl; + fout << std::endl << hline.Data() << std::endl; } // write RUN blocks @@ -1834,59 +1833,59 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co iter = commentsRUN->find(i + 1); if (iter != commentsRUN->end()) { if (!i) - fout << endl; - fout << "# " << iter->second.Data() << endl; - fout << endl; + fout << std::endl; + fout << "# " << iter->second.Data() << std::endl; + fout << std::endl; commentsRUN->erase(iter); } } fout << "RUN " << fRuns[i].GetRunName()->Data() << " "; pstr = fRuns[i].GetBeamline(); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[i].GetInstitute(); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[i].GetFileFormat(); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data." << std::endl; assert(0); } pstr->ToUpper(); - fout << pstr->Data() << " (name beamline institute data-file-format)" << endl; + fout << pstr->Data() << " (name beamline institute data-file-format)" << std::endl; // ADDRUN for (UInt_t j = 1; j < fRuns[i].GetRunNameSize(); ++j) { fout << "ADDRUN " << fRuns[i].GetRunName(j)->Data() << " "; pstr = fRuns[i].GetBeamline(j); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data (addrun)." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain beamline data (addrun)." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[i].GetInstitute(j); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data (addrun)." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain institute data (addrun)." << std::endl; assert(0); } pstr->ToUpper(); fout << pstr->Data() << " "; pstr = fRuns[i].GetFileFormat(j); - if (pstr == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data (addrun)." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::WriteMsrFile: **ERROR** Couldn't obtain file format data (addrun)." << std::endl; assert(0); } pstr->ToUpper(); - fout << pstr->Data() << " (name beamline institute data-file-format)" << endl; + fout << pstr->Data() << " (name beamline institute data-file-format)" << std::endl; } // fittype @@ -1894,22 +1893,22 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co fout.width(16); switch (fRuns[i].GetFitType()) { case MSR_FITTYPE_SINGLE_HISTO: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << std::endl; break; case MSR_FITTYPE_SINGLE_HISTO_RRF: - fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl; + fout << std::left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << std::endl; break; case MSR_FITTYPE_ASYM: - fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << std::endl ; break; case MSR_FITTYPE_ASYM_RRF: - fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << std::endl ; break; case MSR_FITTYPE_MU_MINUS: - fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ; break; case MSR_FITTYPE_NON_MUSR: - fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ; + fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ; break; default: break; @@ -1919,137 +1918,137 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co // alpha if (fRuns[i].GetAlphaParamNo() != -1) { fout.width(16); - fout << left << "alpha"; - fout << fRuns[i].GetAlphaParamNo() << endl; + fout << std::left << "alpha"; + fout << fRuns[i].GetAlphaParamNo() << std::endl; } // beta if (fRuns[i].GetBetaParamNo() != -1) { fout.width(16); - fout << left << "beta"; - fout << fRuns[i].GetBetaParamNo() << endl; + fout << std::left << "beta"; + fout << fRuns[i].GetBetaParamNo() << std::endl; } // norm if (fRuns[i].GetNormParamNo() != -1) { fout.width(16); - fout << left << "norm"; + fout << std::left << "norm"; // check if norm is give as a function if (fRuns[i].GetNormParamNo() >= MSR_PARAM_FUN_OFFSET) fout << "fun" << fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET; else fout << fRuns[i].GetNormParamNo(); - fout << endl; + fout << std::endl; } // backgr.fit if (fRuns[i].GetBkgFitParamNo() != -1) { fout.width(16); - fout << left << "backgr.fit"; - fout << fRuns[i].GetBkgFitParamNo() << endl; + fout << std::left << "backgr.fit"; + fout << fRuns[i].GetBkgFitParamNo() << std::endl; } // lifetime if (fRuns[i].GetLifetimeParamNo() != -1) { fout.width(16); - fout << left << "lifetime"; - fout << fRuns[i].GetLifetimeParamNo() << endl; + fout << std::left << "lifetime"; + fout << fRuns[i].GetLifetimeParamNo() << std::endl; } // lifetimecorrection if ((fRuns[i].IsLifetimeCorrected()) && (fRuns[i].GetFitType() == MSR_FITTYPE_SINGLE_HISTO)) { - fout << "lifetimecorrection" << endl; + fout << "lifetimecorrection" << std::endl; } // map fout << "map "; for (UInt_t j=0; jsize(); ++j) { fout.width(5); - fout << right << fRuns[i].GetMap(j); + fout << std::right << fRuns[i].GetMap(j); } // if there are less maps then 10 fill with zeros if (fRuns[i].GetMap()->size() < 10) { for (UInt_t j=fRuns[i].GetMap()->size(); j<10; ++j) fout << " 0"; } - fout << endl; + fout << std::endl; // forward if (fRuns[i].GetForwardHistoNoSize() == 0) { - cerr << endl << ">> PMsrHandler::WriteMsrFile: **WARNING** No 'forward' data found!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; + std::cerr << std::endl << ">> PMsrHandler::WriteMsrFile: **WARNING** No 'forward' data found!"; + std::cerr << std::endl << ">> Something is VERY fishy, please check your msr-file carfully." << std::endl; } else { fout.width(16); - fout << left << "forward"; + fout << std::left << "forward"; for (UInt_t j=0; j 0) { fout.width(16); - fout << left << "backward"; + fout << std::left << "backward"; for (UInt_t j=0; j 0) { fout.width(8); - fout << left << fRuns[i].GetBkgRange(j); + fout << std::left << fRuns[i].GetBkgRange(j); } } - fout << endl; + fout << std::endl; } // data if ((fRuns[i].GetDataRange(0) != -1) || (fRuns[i].GetDataRange(1) != -1) || (fRuns[i].GetDataRange(2) != -1) || (fRuns[i].GetDataRange(3) != -1)) { fout.width(16); - fout << left << "data"; + fout << std::left << "data"; for (UInt_t j=0; j<4; ++j) { if (fRuns[i].GetDataRange(j) > 0) { fout.width(8); - fout << left << fRuns[i].GetDataRange(j); + fout << std::left << fRuns[i].GetDataRange(j); } } - fout << endl; + fout << std::endl; } // t0 if (fRuns[i].GetT0BinSize() > 0) { fout.width(16); - fout << left << "t0"; + fout << std::left << "t0"; for (UInt_t j=0; j *co for (UInt_t j = 0; j < fRuns[i].GetRunNameSize() - 1; ++j) { if (fRuns[i].GetAddT0BinSize(j) > 0) { fout.width(16); - fout << left << "addt0"; + fout << std::left << "addt0"; for (Int_t k=0; k *co // xy-data if (fRuns[i].GetXDataIndex() != -1) { // indices fout.width(16); - fout << left << "xy-data"; + fout << std::left << "xy-data"; fout.width(8); fout.precision(2); - fout << left << fixed << fRuns[i].GetXDataIndex(); + fout << std::left << std::fixed << fRuns[i].GetXDataIndex(); fout.width(8); fout.precision(2); - fout << left << fixed << fRuns[i].GetYDataIndex(); - fout << endl; + fout << std::left << std::fixed << fRuns[i].GetYDataIndex(); + fout << std::endl; } else if (!fRuns[i].GetXDataLabel()->IsWhitespace()) { // labels fout.width(16); - fout << left << "xy-data"; + fout << std::left << "xy-data"; fout.width(8); - fout << left << fixed << fRuns[i].GetXDataLabel()->Data(); + fout << std::left << std::fixed << fRuns[i].GetXDataLabel()->Data(); fout << " "; fout.width(8); - fout << left << fixed << fRuns[i].GetYDataLabel()->Data(); - fout << endl; + fout << std::left << std::fixed << fRuns[i].GetYDataLabel()->Data(); + fout << std::endl; } // fit if ( (fRuns[i].IsFitRangeInBin() && fRuns[i].GetFitRangeOffset(0) != -1) || (fRuns[i].GetFitRange(0) != PMUSR_UNDEFINED) ) { fout.width(16); - fout << left << "fit"; + fout << std::left << "fit"; if (fRuns[i].IsFitRangeInBin()) { // fit range given in bins fout << "fgb"; if (fRuns[i].GetFitRangeOffset(0) > 0) @@ -2111,47 +2110,47 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j)); fout.width(neededWidth); fout.precision(neededPrec); - fout << left << fixed << fRuns[i].GetFitRange(j); + fout << std::left << std::fixed << fRuns[i].GetFitRange(j); if (j==0) fout << " "; } } - fout << endl; + fout << std::endl; } // packing if (fRuns[i].GetPacking() != -1) { fout.width(16); - fout << left << "packing"; - fout << fRuns[i].GetPacking() << endl; + fout << std::left << "packing"; + fout << fRuns[i].GetPacking() << std::endl; } - fout << endl; + fout << std::endl; } if (commentsRUN && !commentsRUN->empty()) { for(iter = commentsRUN->begin(); iter != commentsRUN->end(); ++iter) { - fout << "# " << iter->second.Data() << endl; + fout << "# " << iter->second.Data() << std::endl; } - fout << endl; + fout << std::endl; commentsRUN->clear(); } - fout << hline.Data() << endl; + fout << hline.Data() << std::endl; // write COMMANDS block - fout << "COMMANDS" << endl; + fout << "COMMANDS" << std::endl; for (i = 0; i < fCommands.size(); ++i) { if (fCommands[i].fLine.BeginsWith("SET BATCH") || fCommands[i].fLine.BeginsWith("END RETURN")) continue; else - fout << fCommands[i].fLine.Data() << endl; + fout << fCommands[i].fLine.Data() << std::endl; } - fout << endl; - fout << hline.Data() << endl; + fout << std::endl; + fout << hline.Data() << std::endl; // write FOURIER block if (fFourier.fFourierBlockPresent) { - fout << "FOURIER" << endl; + fout << "FOURIER" << std::endl; // units if (fFourier.fUnits) { @@ -2166,12 +2165,12 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co fout << "Mc/s"; } fout << " # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'"; - fout << endl; + fout << std::endl; } // fourier_power if (fFourier.fFourierPower != -1) { - fout << "fourier_power " << fFourier.fFourierPower << endl; + fout << "fourier_power " << fFourier.fFourierPower << std::endl; } // apodization @@ -2187,7 +2186,7 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co fout << "STRONG"; } fout << " # NONE, WEAK, MEDIUM, STRONG"; - fout << endl; + fout << std::endl; } // plot @@ -2207,65 +2206,65 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co fout << "PHASE_OPT_REAL"; } fout << " # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL"; - fout << endl; + fout << std::endl; } // phase if (fFourier.fPhaseParamNo.size() > 0) { TString phaseParamStr = BeautifyFourierPhaseParameterString(); - fout << "phase " << phaseParamStr << endl; + fout << "phase " << phaseParamStr << std::endl; } else if (fFourier.fPhase.size() > 0) { fout << "phase "; for (UInt_t i=0; i neededPrec) neededPrec = LastSignificant(fFourier.fPlotRange[1]); fout.precision(neededPrec); - fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << endl; + fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << std::endl; } // // phase_increment -- not used in msr-files at the moment (can only be set through the xml-file) // if (fFourier.fPhaseIncrement) { -// fout << "phase_increment " << fFourier.fPhaseIncrement << endl; +// fout << "phase_increment " << fFourier.fPhaseIncrement << std::endl; // } - fout << endl; - fout << hline.Data() << endl; + fout << std::endl; + fout << hline.Data() << std::endl; } // write PLOT blocks for (i = 0; i < fPlots.size(); ++i) { switch (fPlots[i].fPlotType) { case MSR_PLOT_SINGLE_HISTO: - fout << "PLOT " << fPlots[i].fPlotType << " (single histo plot)" << endl; + fout << "PLOT " << fPlots[i].fPlotType << " (single histo plot)" << std::endl; break; case MSR_PLOT_SINGLE_HISTO_RRF: - fout << "PLOT " << fPlots[i].fPlotType << " (single histo RRF plot)" << endl; + fout << "PLOT " << fPlots[i].fPlotType << " (single histo RRF plot)" << std::endl; break; case MSR_PLOT_ASYM: - fout << "PLOT " << fPlots[i].fPlotType << " (asymmetry plot)" << endl; + fout << "PLOT " << fPlots[i].fPlotType << " (asymmetry plot)" << std::endl; break; case MSR_PLOT_ASYM_RRF: - fout << "PLOT " << fPlots[i].fPlotType << " (asymmetry RRF plot)" << endl; + fout << "PLOT " << fPlots[i].fPlotType << " (asymmetry RRF plot)" << std::endl; break; case MSR_PLOT_MU_MINUS: - fout << "PLOT " << fPlots[i].fPlotType << " (mu minus plot)" << endl; + fout << "PLOT " << fPlots[i].fPlotType << " (mu minus plot)" << std::endl; break; case MSR_PLOT_NON_MUSR: - fout << "PLOT " << fPlots[i].fPlotType << " (non muSR plot)" << endl; + fout << "PLOT " << fPlots[i].fPlotType << " (non muSR plot)" << std::endl; break; default: break; @@ -2278,7 +2277,7 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co fout.width(4); fout << fPlots[i].fRuns[j]; } - fout << endl; + fout << std::endl; // range and sub_ranges if ((fPlots[i].fTmin.size() == 1) && (fPlots[i].fTmax.size() == 1)) { @@ -2295,34 +2294,34 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co if (!fPlots[i].fYmin.empty() && !fPlots[i].fYmax.empty()) { fout << " " << fPlots[i].fYmin[0] << " " << fPlots[i].fYmax[0]; } - fout << endl; + fout << std::endl; // use_fit_ranges if (fPlots[i].fUseFitRanges) { if (!fPlots[i].fYmin.empty() && !fPlots[i].fYmax.empty()) - fout << "use_fit_ranges " << fPlots[i].fYmin[0] << " " << fPlots[i].fYmax[0] << endl; + fout << "use_fit_ranges " << fPlots[i].fYmin[0] << " " << fPlots[i].fYmax[0] << std::endl; else - fout << "use_fit_ranges" << endl; + fout << "use_fit_ranges" << std::endl; } // view_packing if (fPlots[i].fViewPacking != -1) { - fout << "view_packing " << fPlots[i].fViewPacking << endl; + fout << "view_packing " << fPlots[i].fViewPacking << std::endl; } // logx if (fPlots[i].fLogX) { - fout << "logx" << endl; + fout << "logx" << std::endl; } // logy if (fPlots[i].fLogY) { - fout << "logy" << endl; + fout << "logy" << std::endl; } // rrf_packing if (fPlots[i].fRRFPacking) { - fout << "rrf_packing " << fPlots[i].fRRFPacking << endl; + fout << "rrf_packing " << fPlots[i].fRRFPacking << std::endl; } // rrf_freq @@ -2347,25 +2346,25 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co default: break; } - fout << endl; + fout << std::endl; } // rrf_phase if (fPlots[i].fRRFPhaseParamNo > 0) { - fout << "rrf_phase par" << fPlots[i].fRRFPhaseParamNo << endl; + fout << "rrf_phase par" << fPlots[i].fRRFPhaseParamNo << std::endl; } else if (fPlots[i].fRRFPhase) { - fout << "rrf_phase " << fPlots[i].fRRFPhase << endl; + fout << "rrf_phase " << fPlots[i].fRRFPhase << std::endl; } - fout << endl; + fout << std::endl; } if (!fPlots.empty()) { - fout << hline.Data() << endl; + fout << hline.Data() << std::endl; } // write STATISTIC block TDatime dt; - fout << "STATISTIC --- " << dt.AsSQLString() << endl; + fout << "STATISTIC --- " << dt.AsSQLString() << std::endl; if (fStatistic.fValid) { // valid fit result if (fStatistic.fChisq) { // chisq str = " chisq = "; @@ -2374,7 +2373,7 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co str += fStatistic.fNdf; str += ", chisq/NDF = "; str += fStatistic.fMin / fStatistic.fNdf; - fout << str.Data() << endl; + fout << str.Data() << std::endl; } else { // max. log. liklihood str = " maxLH = "; str += fStatistic.fMin; @@ -2382,17 +2381,17 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co str += fStatistic.fNdf; str += ", maxLH/NDF = "; str += fStatistic.fMin / fStatistic.fNdf; - fout << str.Data() << endl; + fout << str.Data() << std::endl; } } else { - fout << "*** FIT DID NOT CONVERGE ***" << endl; + fout << "*** FIT DID NOT CONVERGE ***" << std::endl; } // close file fout.close(); str.Clear(); - pstr = 0; + pstr = nullptr; return PMUSR_SUCCESS; } @@ -2413,8 +2412,8 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map *co Bool_t PMsrHandler::SetMsrParamValue(UInt_t idx, Double_t value) { if (idx >= fParam.size()) { - cerr << endl << ">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is >= than the number of fit parameters " << fParam.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is >= than the number of fit parameters " << fParam.size(); + std::cerr << std::endl; return false; } @@ -2440,8 +2439,8 @@ Bool_t PMsrHandler::SetMsrParamValue(UInt_t idx, Double_t value) Bool_t PMsrHandler::SetMsrParamStep(UInt_t idx, Double_t value) { if (idx >= fParam.size()) { - cerr << endl << ">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrParamValue(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); + std::cerr << std::endl; return false; } @@ -2466,8 +2465,8 @@ Bool_t PMsrHandler::SetMsrParamStep(UInt_t idx, Double_t value) Bool_t PMsrHandler::SetMsrParamPosErrorPresent(UInt_t idx, Bool_t value) { if (idx >= fParam.size()) { - cerr << endl << ">> PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrParamPosErrorPresent(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); + std::cerr << std::endl; return false; } @@ -2492,8 +2491,8 @@ Bool_t PMsrHandler::SetMsrParamPosErrorPresent(UInt_t idx, Bool_t value) Bool_t PMsrHandler::SetMsrParamPosError(UInt_t idx, Double_t value) { if (idx >= fParam.size()) { - cerr << endl << ">> PMsrHandler::SetMsrParamPosError(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrParamPosError(): **ERROR** idx = " << idx << " is larger than the number of parameters " << fParam.size(); + std::cerr << std::endl; return false; } @@ -2516,15 +2515,15 @@ Bool_t PMsrHandler::SetMsrParamPosError(UInt_t idx, Double_t value) void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Double_t bin) { if (runNo >= fRuns.size()) { // error - cerr << endl << ">> PMsrHandler::SetMsrT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); + std::cerr << std::endl; return; } if (idx >= fRuns[runNo].GetT0BinSize()) { // error - cerr << endl << ">> PMsrHandler::SetMsrT0Entry: **WARNING** idx = " << idx << ", is out of valid range 0.." << fRuns[runNo].GetT0BinSize(); - cerr << endl << ">> Will add it anyway."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrT0Entry: **WARNING** idx = " << idx << ", is out of valid range 0.." << fRuns[runNo].GetT0BinSize(); + std::cerr << std::endl << ">> Will add it anyway."; + std::cerr << std::endl; } fRuns[runNo].SetT0Bin(bin, idx); @@ -2544,21 +2543,21 @@ void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Double_t bin) void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Double_t bin) { if (runNo >= fRuns.size()) { // error - cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrAddT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); + std::cerr << std::endl; return; } if (addRunIdx >= fRuns[runNo].GetAddT0BinEntries()) { // error - cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** addRunIdx = " << addRunIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0BinEntries(); - cerr << endl << ">> Will add it anyway."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** addRunIdx = " << addRunIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0BinEntries(); + std::cerr << std::endl << ">> Will add it anyway."; + std::cerr << std::endl; } if (static_cast(histoIdx) > fRuns[runNo].GetAddT0BinSize(addRunIdx)) { // error - cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** histoIdx = " << histoIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0BinSize(addRunIdx); - cerr << endl << ">> Will add it anyway."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** histoIdx = " << histoIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0BinSize(addRunIdx); + std::cerr << std::endl << ">> Will add it anyway."; + std::cerr << std::endl; } fRuns[runNo].SetAddT0Bin(bin, addRunIdx, histoIdx); @@ -2577,8 +2576,8 @@ void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoI void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) { if (runNo >= fRuns.size()) { // error - cerr << endl << ">> PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); + std::cerr << std::endl; return; } @@ -2598,8 +2597,8 @@ void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) void PMsrHandler::SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin) { if (runNo >= fRuns.size()) { // error - cerr << endl << ">> PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size(); + std::cerr << std::endl; return; } @@ -2665,8 +2664,8 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) PMsrLines::iterator iter; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; // fill param structure @@ -2688,8 +2687,8 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) tokens = iter->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandleFitParameterEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleFitParameterEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; + std::cerr << std::endl << std::endl; return false; } @@ -2714,7 +2713,7 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(2)); str = ostr->GetString(); if (str.IsFloat()) - param.fValue = (Double_t)str.Atof(); + param.fValue = static_cast(str.Atof()); else error = true; @@ -2722,7 +2721,7 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(3)); str = ostr->GetString(); if (str.IsFloat()) - param.fStep = (Double_t)str.Atof(); + param.fStep = static_cast(str.Atof()); else error = true; @@ -2740,7 +2739,7 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) str = ostr->GetString(); if (str.IsFloat()) { param.fPosErrorPresent = true; - param.fPosError = (Double_t)str.Atof(); + param.fPosError = static_cast(str.Atof()); } else { str.ToLower(); if (!str.CompareTo("none", TString::kIgnoreCase)) @@ -2759,7 +2758,7 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) str = ostr->GetString(); if (str.IsFloat()) { param.fPosErrorPresent = true; - param.fPosError = (Double_t)str.Atof(); + param.fPosError = static_cast(str.Atof()); } else { str.ToLower(); if (!str.CompareTo("none", TString::kIgnoreCase)) @@ -2776,7 +2775,7 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) param.fLowerBoundaryPresent = false; } else { // assuming that the lower boundary is a number if (str.IsFloat()) { - param.fLowerBoundary = (Double_t)str.Atof(); + param.fLowerBoundary = static_cast(str.Atof()); param.fLowerBoundaryPresent = true; } else { error = true; @@ -2791,7 +2790,7 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) param.fUpperBoundaryPresent = false; } else { // assuming a number if (str.IsFloat()) { - param.fUpperBoundary = (Double_t)str.Atof(); + param.fUpperBoundary = static_cast(str.Atof()); param.fUpperBoundaryPresent = true; } else { error = true; @@ -2806,28 +2805,28 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) // check if enough elements found if (error) { - cerr << endl; - cerr << endl << ">> PMsrHandler::HandleFitParameterEntry: **ERROR** in line " << iter->fLineNo << ":"; - cerr << endl << ">> " << iter->fLine.Data(); - cerr << endl << ">> A Fit Parameter line needs to have the following form: "; - cerr << endl; - cerr << endl << ">> No Name Value Step/Error [Lower_Boundary Upper_Boundary]"; - cerr << endl; - cerr << endl << ">> or"; - cerr << endl; - cerr << endl << ">> No Name Value Step/Neg_Error Pos_Error [Lower_Boundary Upper_Boundary]"; - cerr << endl; - cerr << endl << ">> No: the parameter number (an Int_t)"; - cerr << endl << ">> Name: the name of the parameter (less than 256 character)"; - cerr << endl << ">> Value: the starting value of the parameter (a Double_t)"; - cerr << endl << ">> Step/Error,"; - cerr << endl << ">> Step/Neg_Error: the starting step value in a fit (a Double_t), or"; - cerr << endl << ">> the symmetric error (MIGRAD, SIMPLEX), or"; - cerr << endl << ">> the negative error (MINOS)"; - cerr << endl << ">> Pos_Error: the positive error (MINOS), (a Double_t or \"none\")"; - cerr << endl << ">> Lower_Boundary: the lower boundary allowed for the fit parameter (a Double_t or \"none\")"; - cerr << endl << ">> Upper_Boundary: the upper boundary allowed for the fit parameter (a Double_t or \"none\")"; - cerr << endl; + std::cerr << std::endl; + std::cerr << std::endl << ">> PMsrHandler::HandleFitParameterEntry: **ERROR** in line " << iter->fLineNo << ":"; + std::cerr << std::endl << ">> " << iter->fLine.Data(); + std::cerr << std::endl << ">> A Fit Parameter line needs to have the following form: "; + std::cerr << std::endl; + std::cerr << std::endl << ">> No Name Value Step/Error [Lower_Boundary Upper_Boundary]"; + std::cerr << std::endl; + std::cerr << std::endl << ">> or"; + std::cerr << std::endl; + std::cerr << std::endl << ">> No Name Value Step/Neg_Error Pos_Error [Lower_Boundary Upper_Boundary]"; + std::cerr << std::endl; + std::cerr << std::endl << ">> No: the parameter number (an Int_t)"; + std::cerr << std::endl << ">> Name: the name of the parameter (less than 256 character)"; + std::cerr << std::endl << ">> Value: the starting value of the parameter (a Double_t)"; + std::cerr << std::endl << ">> Step/Error,"; + std::cerr << std::endl << ">> Step/Neg_Error: the starting step value in a fit (a Double_t), or"; + std::cerr << std::endl << ">> the symmetric error (MIGRAD, SIMPLEX), or"; + std::cerr << std::endl << ">> the negative error (MINOS)"; + std::cerr << std::endl << ">> Pos_Error: the positive error (MINOS), (a Double_t or \"none\")"; + std::cerr << std::endl << ">> Lower_Boundary: the lower boundary allowed for the fit parameter (a Double_t or \"none\")"; + std::cerr << std::endl << ">> Upper_Boundary: the upper boundary allowed for the fit parameter (a Double_t or \"none\")"; + std::cerr << std::endl; } else { // everything is OK, therefore add the parameter to the parameter list fParam.push_back(param); } @@ -2835,7 +2834,7 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } iter++; @@ -2843,15 +2842,15 @@ Bool_t PMsrHandler::HandleFitParameterEntry(PMsrLines &lines) // check if all parameters have subsequent numbers. for (UInt_t i=0; i(i)+1) { error = true; - cerr << endl << ">> PMsrHandler::HandleFitParameterEntry: **ERROR**"; - cerr << endl << ">> Sorry, you are assuming to much from this program, it cannot"; - cerr << endl << ">> handle none subsequent numbered parameters yet or in the near future."; - cerr << endl << ">> Found parameter " << fParam[i].fName.Data() << ", with"; - cerr << endl << ">> parameter number " << fParam[i].fNo << ", at paramter position " << i+1 << "."; - cerr << endl << ">> This needs to be fixed first."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleFitParameterEntry: **ERROR**"; + std::cerr << std::endl << ">> Sorry, you are assuming to much from this program, it cannot"; + std::cerr << std::endl << ">> handle none subsequent numbered parameters yet or in the near future."; + std::cerr << std::endl << ">> Found parameter " << fParam[i].fName.Data() << ", with"; + std::cerr << std::endl << ">> parameter number " << fParam[i].fNo << ", at paramter position " << i+1 << "."; + std::cerr << std::endl << ">> This needs to be fixed first."; + std::cerr << std::endl; break; } } @@ -2905,8 +2904,8 @@ Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines) // create function handler fFuncHandler = new PFunctionHandler(fFunctions); - if (fFuncHandler == 0) { - cerr << endl << ">> PMsrHandler::HandleFunctionsEntry: **ERROR** Couldn't invoke PFunctionHandler." << endl; + if (fFuncHandler == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::HandleFunctionsEntry: **ERROR** Couldn't invoke PFunctionHandler." << std::endl; return false; } @@ -2917,8 +2916,8 @@ Bool_t PMsrHandler::HandleFunctionsEntry(PMsrLines &lines) // check if an empty FUNCTIONS block is present if ((fFuncHandler->GetNoOfFuncs() == 0) && !lines.empty()) { - cerr << endl << ">> PMsrHandler::HandleFunctionsEntry: **WARNING** empty FUNCTIONS block found!"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleFunctionsEntry: **WARNING** empty FUNCTIONS block found!"; + std::cerr << std::endl; } return true; @@ -2944,8 +2943,8 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) Bool_t error = false; TString str; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; Int_t ival = 0; Double_t dval = 0.0; UInt_t addT0Counter = 0; @@ -2964,8 +2963,8 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) // tokenize line tokens = str.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandleGlobalEntry: **SEVERE ERROR** Couldn't tokenize line " << iter->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleGlobalEntry: **SEVERE ERROR** Couldn't tokenize line " << iter->fLineNo; + std::cerr << std::endl << std::endl; return false; } @@ -3166,7 +3165,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } ++iter; @@ -3174,9 +3173,9 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines) if (error) { --iter; - cerr << endl << ">> PMsrHandler::HandleGlobalEntry: **ERROR** in line " << iter->fLineNo << ":"; - cerr << endl << ">> '" << iter->fLine.Data() << "'"; - cerr << endl << ">> GLOBAL block syntax is too complex to print it here. Please check the manual."; + std::cerr << std::endl << ">> PMsrHandler::HandleGlobalEntry: **ERROR** in line " << iter->fLineNo << ":"; + std::cerr << std::endl << ">> '" << iter->fLine.Data() << "'"; + std::cerr << std::endl << ">> GLOBAL block syntax is too complex to print it here. Please check the manual."; } else { // save global fGlobal = global; } @@ -3205,8 +3204,8 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) Bool_t runLinePresent = false; TString str, line; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; UInt_t addT0Counter = 0; @@ -3224,8 +3223,8 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) // tokenize line tokens = str.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; + std::cerr << std::endl << std::endl; return false; } @@ -3275,10 +3274,10 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) if (line.BeginsWith("addrun", TString::kIgnoreCase)) { if (!runLinePresent) { - cerr << endl << ">> PMsrHandler::HandleRunEntry: **ERROR** Found ADDRUN without prior RUN, or"; - cerr << endl << ">> ADDRUN lines intercepted by other stuff. All this is not allowed!"; - cerr << endl << ">> error in line " << iter->fLineNo; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleRunEntry: **ERROR** Found ADDRUN without prior RUN, or"; + std::cerr << std::endl << ">> ADDRUN lines intercepted by other stuff. All this is not allowed!"; + std::cerr << std::endl << ">> error in line " << iter->fLineNo; + std::cerr << std::endl; error = true; continue; } @@ -3475,8 +3474,8 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) // check map entries, i.e. if the map values are within parameter bounds if (!fFourierOnly) { for (UInt_t i=0; isize(); i++) { - if ((param.GetMap(i) < 0) || (param.GetMap(i) > (Int_t) fParam.size())) { - cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.GetMap(i) << " in line " << iter->fLineNo << " is out of range!"; + if ((param.GetMap(i) < 0) || (param.GetMap(i) > static_cast(fParam.size()))) { + std::cerr << std::endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** map value " << param.GetMap(i) << " in line " << iter->fLineNo << " is out of range!"; error = true; break; } @@ -3495,7 +3494,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) PUIntVector group; str = iter->fLine; PStringNumberList *rl = new PStringNumberList(str.Data()); - string errorMsg(""); + std::string errorMsg(""); if (rl->Parse(errorMsg, true)) { group = rl->GetList(); for (UInt_t i=0; ifLine; PStringNumberList *rl = new PStringNumberList(str.Data()); - string errorMsg(""); + std::string errorMsg(""); if (rl->Parse(errorMsg, true)) { group = rl->GetList(); for (UInt_t i=0; i> PMsrHandler::HandleRunEntry: **ERROR** in line " << iter->fLineNo << ":"; - cerr << endl << ">> " << iter->fLine.Data(); - cerr << endl << ">> RUN block syntax is too complex to print it here. Please check the manual."; + std::cerr << std::endl << ">> PMsrHandler::HandleRunEntry: **ERROR** in line " << iter->fLineNo << ":"; + std::cerr << std::endl << ">> " << iter->fLine.Data(); + std::cerr << std::endl << ">> RUN block syntax is too complex to print it here. Please check the manual."; } else { // save last run found fRuns.push_back(param); param.CleanUp(); @@ -3819,7 +3818,7 @@ Bool_t PMsrHandler::FilterNumber(TString str, const Char_t *filter, Int_t offset // clean up if (cstr) { delete [] cstr; - cstr = 0; + cstr = nullptr; } if ((no_found < 0) || (no_found > 1000)) @@ -3848,8 +3847,8 @@ Bool_t PMsrHandler::HandleCommandsEntry(PMsrLines &lines) PMsrLines::iterator iter; if (lines.empty()) { - cerr << endl << ">> PMsrHandler::HandleCommandsEntry(): **WARNING**: There is no COMMAND block! Do you really want this?"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleCommandsEntry(): **WARNING**: There is no COMMAND block! Do you really want this?"; + std::cerr << std::endl; } for (iter = lines.begin(); iter != lines.end(); ++iter) { @@ -3925,8 +3924,8 @@ Bool_t PMsrHandler::ParseFourierPhaseValueVector(PMsrFourierStructure &fourier, Bool_t result = true; TObjArray *tok = str.Tokenize(" ,;\t"); - if (tok == 0) { - cerr << endl << ">> PMsrHandler::ParseFourierPhaseValueVector: **ERROR** couldn't tokenize Fourier phase line." << endl << endl; + if (tok == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::ParseFourierPhaseValueVector: **ERROR** couldn't tokenize Fourier phase line." << std::endl << std::endl; return false; } @@ -3937,7 +3936,7 @@ Bool_t PMsrHandler::ParseFourierPhaseValueVector(PMsrFourierStructure &fourier, } // convert all acceptable tokens - TObjString *ostr=0; + TObjString *ostr = nullptr; TString sstr(""); for (Int_t i=1; iGetEntries(); i++) { ostr = dynamic_cast(tok->At(i)); @@ -3947,8 +3946,8 @@ Bool_t PMsrHandler::ParseFourierPhaseValueVector(PMsrFourierStructure &fourier, } else { result = false; if (i>1) { // make sure that no 'phase val, parX' mixture is present - cerr << endl << ">> PMsrHandler::ParseFourierPhaseValueVector: **ERROR** in Fourier phase line."; - cerr << endl << ">> Attempt to mix val, parX? This is currently not supported." << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::ParseFourierPhaseValueVector: **ERROR** in Fourier phase line."; + std::cerr << std::endl << ">> Attempt to mix val, parX? This is currently not supported." << std::endl << std::endl; error = true; } break; @@ -3985,8 +3984,8 @@ Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, co Int_t refCount = 0; TObjArray *tok = str.Tokenize(" ,;\t"); - if (tok == 0) { - cerr << endl << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** couldn't tokenize Fourier phase line." << endl << endl; + if (tok == nullptr) { + std::cerr << std::endl << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** couldn't tokenize Fourier phase line." << std::endl << std::endl; return false; } @@ -4002,7 +4001,7 @@ Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, co TObjString *ostr = dynamic_cast(tok->At(i)); sstr = ostr->GetString(); if (!sstr.BeginsWith("par")) { - cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found unhandable token '" << sstr << "'" << endl; + std::cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found unhandable token '" << sstr << "'" << std::endl; error = true; result = false; break; @@ -4020,7 +4019,7 @@ Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, co } if (refCount > 1) { - cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found multiple parR's! Only one reference phase is accepted." << endl; + std::cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found multiple parR's! Only one reference phase is accepted." << std::endl; result = false; } @@ -4040,7 +4039,7 @@ Bool_t PMsrHandler::ParseFourierPhaseParVector(PMsrFourierStructure &fourier, co fourier.fPhaseRef = sstr.Atoi(); fourier.fPhaseParamNo.push_back(sstr.Atoi()); } else { - cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found token '" << ostr->GetString() << "' which is not parX with X an integer." << endl; + std::cerr << ">> PMsrHandler::ParseFourierPhaseParVector: **ERROR** found token '" << ostr->GetString() << "' which is not parX with X an integer." << std::endl; fourier.fPhaseParamNo.clear(); error = true; break; @@ -4086,7 +4085,7 @@ Bool_t PMsrHandler::ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier // remove 'par(' from string if present, otherwise and error is issued if (!wstr.BeginsWith("par(") && !wstr.BeginsWith("parR(")) { - cout << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** token should start with 'par(' or 'parR(', found: '" << wstr << "' -> ERROR" << endl; + std::cout << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** token should start with 'par(' or 'parR(', found: '" << wstr << "' -> ERROR" << std::endl; error = true; return false; } @@ -4107,15 +4106,15 @@ Bool_t PMsrHandler::ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier // tokenize rest which should have the form 'X0, offset, #Param' TObjArray *tok = wstr.Tokenize(",;"); - if (tok == 0) { - cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** tokenize failed." << endl; + if (tok == nullptr) { + std::cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** tokenize failed." << std::endl; error = true; return false; } // check for proper number of expected elements if (tok->GetEntries() != 3) { - cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** wrong syntax for the expected par(X0, offset, #param)." << endl; + std::cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** wrong syntax for the expected par(X0, offset, #param)." << std::endl; error = true; delete tok; return false; @@ -4129,7 +4128,7 @@ Bool_t PMsrHandler::ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier if (wstr.IsDigit()) { x0 = wstr.Atoi(); } else { - cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** X0='" << wstr << "' is not an integer." << endl; + std::cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** X0='" << wstr << "' is not an integer." << std::endl; error = true; delete tok; return false; @@ -4141,7 +4140,7 @@ Bool_t PMsrHandler::ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier if (wstr.IsDigit()) { offset = wstr.Atoi(); } else { - cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** offset='" << wstr << "' is not an integer." << endl; + std::cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** offset='" << wstr << "' is not an integer." << std::endl; error = true; delete tok; return false; @@ -4153,7 +4152,7 @@ Bool_t PMsrHandler::ParseFourierPhaseParIterVector(PMsrFourierStructure &fourier if (wstr.IsDigit()) { noParam = wstr.Atoi(); } else { - cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** #Param='" << wstr << "' is not an integer." << endl; + std::cerr << ">> PMsrHandler::ParseFourierPhaseParIterVector: **ERROR** #Param='" << wstr << "' is not an integer." << std::endl; error = true; delete tok; return false; @@ -4203,8 +4202,8 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) PMsrLines::iterator iter; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str, pcStr=TString(""); Int_t ival; @@ -4214,8 +4213,8 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) // tokenize line tokens = iter->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandleFourierEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleFourierEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo; + std::cerr << std::endl << std::endl; return false; } @@ -4358,7 +4357,7 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) if (fourier.fPhaseParamNo.size() > 0) { for (UInt_t i=0; i fParam.size()) { - cerr << ">> PMsrHandler::HandleFourierEntry: found Fourier parameter entry par" << fourier.fPhaseParamNo[i] << " > #Param = " << fParam.size() << endl; + std::cerr << ">> PMsrHandler::HandleFourierEntry: found Fourier parameter entry par" << fourier.fPhaseParamNo[i] << " > #Param = " << fParam.size() << std::endl; error = true; --iter; continue; @@ -4412,7 +4411,7 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } ++iter; @@ -4421,7 +4420,7 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) // clean up after error if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } // handle range_for_phase_correction if present @@ -4459,33 +4458,33 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } if (error) { - cerr << endl << ">> PMsrHandler::HandleFourierEntry: **ERROR** in line " << iter->fLineNo << ":"; - cerr << endl; - cerr << endl << ">> " << iter->fLine.Data(); - cerr << endl; - cerr << endl << ">> FOURIER block syntax, parameters in [] are optinal:"; - cerr << endl; - cerr << endl << ">> FOURIER"; - cerr << endl << ">> [units Gauss | MHz | Mc/s]"; - cerr << endl << ">> [fourier_power n # n is a number such that zero padding up to 2^n will be used]"; - cerr << endl << ">> n=0 means no zero padding"; - cerr << endl << ">> 0 <= n <= 20 are allowed values"; - cerr << endl << ">> [dc-corrected true | false]"; - cerr << endl << ">> [apodization none | weak | medium | strong]"; - cerr << endl << ">> [plot real | imag | real_and_imag | power | phase | phase_opt_real]"; - cerr << endl << ">> [phase valList | parList | parIterList [# comment]]"; - cerr << endl << ">> valList : val [sep val ... sep val]. sep=' ,;\\t'"; - cerr << endl << ">> parList : parX0 [sep parX1 ... sep parX1]"; - cerr << endl << ">> parIterList : par(X0,offset,#param), with X0=first parameter number"; - cerr << endl << ">> offset=parameter offset, #param=number of phase parameters."; - cerr << endl << ">> [range_for_phase_correction min max | all]"; - cerr << endl << ">> [range min max]"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleFourierEntry: **ERROR** in line " << iter->fLineNo << ":"; + std::cerr << std::endl; + std::cerr << std::endl << ">> " << iter->fLine.Data(); + std::cerr << std::endl; + std::cerr << std::endl << ">> FOURIER block syntax, parameters in [] are optinal:"; + std::cerr << std::endl; + std::cerr << std::endl << ">> FOURIER"; + std::cerr << std::endl << ">> [units Gauss | MHz | Mc/s]"; + std::cerr << std::endl << ">> [fourier_power n # n is a number such that zero padding up to 2^n will be used]"; + std::cerr << std::endl << ">> n=0 means no zero padding"; + std::cerr << std::endl << ">> 0 <= n <= 20 are allowed values"; + std::cerr << std::endl << ">> [dc-corrected true | false]"; + std::cerr << std::endl << ">> [apodization none | weak | medium | strong]"; + std::cerr << std::endl << ">> [plot real | imag | real_and_imag | power | phase | phase_opt_real]"; + std::cerr << std::endl << ">> [phase valList | parList | parIterList [# comment]]"; + std::cerr << std::endl << ">> valList : val [sep val ... sep val]. sep=' ,;\\t'"; + std::cerr << std::endl << ">> parList : parX0 [sep parX1 ... sep parX1]"; + std::cerr << std::endl << ">> parIterList : par(X0,offset,#param), with X0=first parameter number"; + std::cerr << std::endl << ">> offset=parameter offset, #param=number of phase parameters."; + std::cerr << std::endl << ">> [range_for_phase_correction min max | all]"; + std::cerr << std::endl << ">> [range min max]"; + std::cerr << std::endl; } else { // save last run found fFourier = fourier; } @@ -4513,13 +4512,13 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) PMsrLines::iterator iter1; PMsrLines::iterator iter2; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; if (lines.empty()) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING**: There is no PLOT block! Do you really want this?"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING**: There is no PLOT block! Do you really want this?"; + std::cerr << std::endl; } iter1 = lines.begin(); @@ -4557,8 +4556,8 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) if (iter1->fLine.Contains("PLOT")) { // handle plot header tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } if (tokens->GetEntries() < 2) { // plot type missing @@ -4574,14 +4573,14 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (iter1->fLine.Contains("lifetimecorrection", TString::kIgnoreCase)) { param.fLifeTimeCorrection = true; } else if (iter1->fLine.Contains("runs", TString::kIgnoreCase)) { // handle plot runs TComplex run; PStringNumberList *rl; - string errorMsg; + std::string errorMsg; PUIntVector runList; switch (param.fPlotType) { case -1: @@ -4595,9 +4594,9 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) case MSR_PLOT_MU_MINUS: rl = new PStringNumberList(iter1->fLine.Data()); if (!rl->Parse(errorMsg, true)) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; - cerr << endl << ">> Error Message: " << errorMsg; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; + std::cerr << std::endl << ">> Error Message: " << errorMsg; + std::cerr << std::endl << std::endl; return false; } runList = rl->GetList(); @@ -4622,8 +4621,8 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } if ((tokens->GetEntries() != 3) && (tokens->GetEntries() != 5)) { @@ -4634,7 +4633,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsFloat()) - param.fTmin.push_back((Double_t)str.Atof()); + param.fTmin.push_back(static_cast(str.Atof())); else error = true; @@ -4642,7 +4641,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(2)); str = ostr->GetString(); if (str.IsFloat()) - param.fTmax.push_back((Double_t)str.Atof()); + param.fTmax.push_back(static_cast(str.Atof())); else error = true; @@ -4652,7 +4651,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(3)); str = ostr->GetString(); if (str.IsFloat()) - param.fYmin.push_back((Double_t)str.Atof()); + param.fYmin.push_back(static_cast(str.Atof())); else error = true; @@ -4660,7 +4659,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(4)); str = ostr->GetString(); if (str.IsFloat()) - param.fYmax.push_back((Double_t)str.Atof()); + param.fYmax.push_back(static_cast(str.Atof())); else error = true; } @@ -4668,7 +4667,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (iter1->fLine.Contains("sub_ranges", TString::kIgnoreCase)) { // remove previous entries @@ -4679,11 +4678,11 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } - if ((tokens->GetEntries() != (Int_t)(2*param.fRuns.size() + 1)) && (tokens->GetEntries() != (Int_t)(2*param.fRuns.size() + 3))) { + if ((tokens->GetEntries() != static_cast(2*param.fRuns.size() + 1)) && (tokens->GetEntries() != static_cast(2*param.fRuns.size() + 3))) { error = true; } else { // get all the times @@ -4693,7 +4692,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(2*i+1)); str = ostr->GetString(); if (str.IsFloat()) - param.fTmin.push_back((Double_t)str.Atof()); + param.fTmin.push_back(static_cast(str.Atof())); else error = true; @@ -4701,19 +4700,19 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(2*i+2)); str = ostr->GetString(); if (str.IsFloat()) - param.fTmax.push_back((Double_t)str.Atof()); + param.fTmax.push_back(static_cast(str.Atof())); else error = true; } // get y-range if present - if (tokens->GetEntries() == (Int_t)(2*param.fRuns.size() + 3)) { + if (tokens->GetEntries() == static_cast(2*param.fRuns.size() + 3)) { // handle y_min ostr = dynamic_cast(tokens->At(2*param.fRuns.size()+1)); str = ostr->GetString(); if (str.IsFloat()) - param.fYmin.push_back((Double_t)str.Atof()); + param.fYmin.push_back(static_cast(str.Atof())); else error = true; @@ -4721,7 +4720,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(2*param.fRuns.size()+2)); str = ostr->GetString(); if (str.IsFloat()) - param.fYmax.push_back((Double_t)str.Atof()); + param.fYmax.push_back(static_cast(str.Atof())); else error = true; } @@ -4730,7 +4729,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (iter1->fLine.Contains("use_fit_ranges", TString::kIgnoreCase)) { param.fUseFitRanges = true; @@ -4738,8 +4737,8 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } @@ -4748,7 +4747,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(1)); str = ostr->GetString(); if (str.IsFloat()) - param.fYmin.push_back((Double_t)str.Atof()); + param.fYmin.push_back(static_cast(str.Atof())); else error = true; @@ -4756,22 +4755,22 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) ostr = dynamic_cast(tokens->At(2)); str = ostr->GetString(); if (str.IsFloat()) - param.fYmax.push_back((Double_t)str.Atof()); + param.fYmax.push_back(static_cast(str.Atof())); else error = true; } if ((tokens->GetEntries() != 1) && (tokens->GetEntries() != 3)) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **WARNING** use_fit_ranges with undefined additional parameters in line " << iter1->fLineNo; - cerr << endl << ">> Will ignore this PLOT block command line, sorry."; - cerr << endl << ">> Proper syntax: use_fit_ranges [ymin ymax]"; - cerr << endl << ">> Found: '" << iter1->fLine.Data() << "'" << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **WARNING** use_fit_ranges with undefined additional parameters in line " << iter1->fLineNo; + std::cerr << std::endl << ">> Will ignore this PLOT block command line, sorry."; + std::cerr << std::endl << ">> Proper syntax: use_fit_ranges [ymin ymax]"; + std::cerr << std::endl << ">> Found: '" << iter1->fLine.Data() << "'" << std::endl; } // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (iter1->fLine.Contains("logx", TString::kIgnoreCase)) { param.fLogX = true; @@ -4780,8 +4779,8 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) } else if (iter1->fLine.Contains("view_packing", TString::kIgnoreCase)) { tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize view_packing in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize view_packing in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } if (tokens->GetEntries() != 2) { @@ -4803,15 +4802,15 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (iter1->fLine.Contains("rrf_freq", TString::kIgnoreCase)) { // expected entry: rrf_freq value unit // allowed units: kHz, MHz, Mc/s, G, T tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_freq in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_freq in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } if (tokens->GetEntries() != 3) { @@ -4844,15 +4843,15 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (iter1->fLine.Contains("rrf_phase", TString::kIgnoreCase)) { // expected entry: rrf_phase value. value given in units of degree. or // rrf_phase parX. where X is the parameter number, e.g. par3 tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_phase in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_phase in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } if (tokens->GetEntries() != 2) { @@ -4868,7 +4867,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) Int_t no = 0; if (FilterNumber(str, "par", 0, no)) { // check that the parameter is in range - if ((Int_t)fParam.size() < no) { + if (static_cast(fParam.size()) < no) { error = true; } else { // keep the parameter number in case parX was used @@ -4885,14 +4884,14 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (iter1->fLine.Contains("rrf_packing", TString::kIgnoreCase)) { // expected entry: rrf_phase value. value given in units of degree tokens = iter1->fLine.Tokenize(" \t"); if (!tokens) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_packing in line " << iter1->fLineNo; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize rrf_packing in line " << iter1->fLineNo; + std::cerr << std::endl << std::endl; return false; } if (tokens->GetEntries() != 2) { @@ -4910,7 +4909,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else { error = true; @@ -4949,9 +4948,9 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // check RRF entries if (param.fRRFFreq != 0.0) { if (param.fRRFPacking == 0) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry(): **ERROR** found RRF frequency but no required RRF packing."; - cerr << endl << ">> Will ignore the RRF option."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry(): **ERROR** found RRF frequency but no required RRF packing."; + std::cerr << std::endl << ">> Will ignore the RRF option."; + std::cerr << std::endl; param.fRRFFreq = 0.0; } } @@ -4959,16 +4958,16 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) // check if runs listed in the plot block indeed to exist for (UInt_t i=0; i static_cast(fRuns.size())) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number " << param.fRuns[i] << "."; - cerr << endl << ">> There are only " << fRuns.size() << " runs present, will ignore this run."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number " << param.fRuns[i] << "."; + std::cerr << std::endl << ">> There are only " << fRuns.size() << " runs present, will ignore this run."; + std::cerr << std::endl; param.fRuns.erase(param.fRuns.begin()+i); i--; } if (param.fRuns[i] == 0) { - cerr << endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number 0."; - cerr << endl << ">> Pot number needs to be > 0. Will ignore this entry."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry(): **WARNING** found plot run number 0."; + std::cerr << std::endl << ">> Pot number needs to be > 0. Will ignore this entry."; + std::cerr << std::endl; param.fRuns.erase(param.fRuns.begin()+i); i--; } @@ -4977,44 +4976,44 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines) if (param.fRuns.size() > 0) { fPlots.push_back(param); } else { - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block entries, will ignore the entire PLOT block."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block entries, will ignore the entire PLOT block."; + std::cerr << std::endl; } } } if (fPlots.size() == 0) { error = true; - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block at all present. Fix this first!"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** no valid PLOT block at all present. Fix this first!"; + std::cerr << std::endl; } if (error) { // print error message --iter1; - cerr << endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** in line " << iter1->fLineNo << ": " << iter1->fLine.Data(); - cerr << endl << ">> A PLOT block needs to have the following structure:"; - cerr << endl; - cerr << endl << ">> PLOT "; - cerr << endl << ">> runs "; - cerr << endl << ">> [range tmin tmax [ymin ymax]]"; - cerr << endl << ">> [sub_ranges tmin1 tmax1 tmin2 tmax2 ... tminN tmaxN [ymin ymax]"; - cerr << endl << ">> [logx | logy]"; - cerr << endl << ">> [use_fit_ranges [ymin ymax]]"; - cerr << endl << ">> [view_packing n]"; - cerr << endl; - cerr << endl << ">> where is: 0=single histo,"; - cerr << endl << ">> 1=RRF single histo,"; - cerr << endl << ">> 2=forward-backward asym,"; - cerr << endl << ">> 3=forward-backward RRF asym,"; - cerr << endl << ">> 4=mu minus single histo,"; - cerr << endl << ">> 8=non muSR."; - cerr << endl << ">> is the list of runs, e.g. runs 1 3"; - cerr << endl << ">> range is optional"; - cerr << endl << ">> sub_ranges (if present) will plot the N given runs each on its own sub-range"; - cerr << endl << ">> logx, logy (if present) will present the x-, y-axis in log-scale"; - cerr << endl << ">> use_fit_ranges (if present) will plot each run on its fit-range"; - cerr << endl << ">> view_packing n (if present) will bin all data by n (> 0) rather than the binning of the fit"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandlePlotEntry: **ERROR** in line " << iter1->fLineNo << ": " << iter1->fLine.Data(); + std::cerr << std::endl << ">> A PLOT block needs to have the following structure:"; + std::cerr << std::endl; + std::cerr << std::endl << ">> PLOT "; + std::cerr << std::endl << ">> runs "; + std::cerr << std::endl << ">> [range tmin tmax [ymin ymax]]"; + std::cerr << std::endl << ">> [sub_ranges tmin1 tmax1 tmin2 tmax2 ... tminN tmaxN [ymin ymax]"; + std::cerr << std::endl << ">> [logx | logy]"; + std::cerr << std::endl << ">> [use_fit_ranges [ymin ymax]]"; + std::cerr << std::endl << ">> [view_packing n]"; + std::cerr << std::endl; + std::cerr << std::endl << ">> where is: 0=single histo,"; + std::cerr << std::endl << ">> 1=RRF single histo,"; + std::cerr << std::endl << ">> 2=forward-backward asym,"; + std::cerr << std::endl << ">> 3=forward-backward RRF asym,"; + std::cerr << std::endl << ">> 4=mu minus single histo,"; + std::cerr << std::endl << ">> 8=non muSR."; + std::cerr << std::endl << ">> is the list of runs, e.g. runs 1 3"; + std::cerr << std::endl << ">> range is optional"; + std::cerr << std::endl << ">> sub_ranges (if present) will plot the N given runs each on its own sub-range"; + std::cerr << std::endl << ">> logx, logy (if present) will present the x-, y-axis in log-scale"; + std::cerr << std::endl << ">> use_fit_ranges (if present) will plot each run on its fit-range"; + std::cerr << std::endl << ">> view_packing n (if present) will bin all data by n (> 0) rather than the binning of the fit"; + std::cerr << std::endl; } param.fRuns.clear(); @@ -5043,8 +5042,8 @@ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines) return true; if (lines.empty()) { - cerr << endl << ">> PMsrHandler::HandleStatisticEntry: **WARNING** There is no STATISTIC block! Do you really want this?"; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleStatisticEntry: **WARNING** There is no STATISTIC block! Do you really want this?"; + std::cerr << std::endl; fStatistic.fValid = false; return true; } @@ -5065,11 +5064,11 @@ Bool_t PMsrHandler::HandleStatisticEntry(PMsrLines &lines) !tstr.BeginsWith("maxLH") && !tstr.BeginsWith("*** FIT DID NOT CONVERGE ***") && !tstr.BeginsWith("expected chisq") && !tstr.BeginsWith("expected maxLH") && !tstr.BeginsWith("run block")) { - cerr << endl << ">> PMsrHandler::HandleStatisticEntry: **SYNTAX ERROR** in line " << lines[i].fLineNo; - cerr << endl << ">> '" << lines[i].fLine.Data() << "'"; - cerr << endl << ">> not a valid STATISTIC block line"; - cerr << endl << ">> If you do not understand this, just remove the STATISTIC block, musrfit will recreate after fitting"; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::HandleStatisticEntry: **SYNTAX ERROR** in line " << lines[i].fLineNo; + std::cerr << std::endl << ">> '" << lines[i].fLine.Data() << "'"; + std::cerr << std::endl << ">> not a valid STATISTIC block line"; + std::cerr << std::endl << ">> If you do not understand this, just remove the STATISTIC block, musrfit will recreate after fitting"; + std::cerr << std::endl << std::endl; return false; } } @@ -5148,16 +5147,16 @@ UInt_t PMsrHandler::GetNoOfFitParameters(UInt_t idx) PUIntVector paramVector; PUIntVector funVector; PUIntVector mapVector; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; UInt_t k, dval; Int_t status, pos; // check that idx is valid if (idx >= fRuns.size()) { - cerr << endl << ">> PMsrHandler::GetNoOfFitParameters() **ERROR** idx=" << idx << ", out of range fRuns.size()=" << fRuns.size(); - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::GetNoOfFitParameters() **ERROR** idx=" << idx << ", out of range fRuns.size()=" << fRuns.size(); + std::cerr << std::endl; return 0; } @@ -5225,7 +5224,7 @@ UInt_t PMsrHandler::GetNoOfFitParameters(UInt_t idx) } delete tokens; - tokens = 0; + tokens = nullptr; } // go through the function block and collect parameters @@ -5241,8 +5240,8 @@ UInt_t PMsrHandler::GetNoOfFitParameters(UInt_t idx) // check if everything has been found at all if (k == fFunctions.size()) { - cerr << endl << ">> PMsrHandler::GetNoOfFitParameters() **ERROR** couldn't find fun" << funVector[i]; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::GetNoOfFitParameters() **ERROR** couldn't find fun" << funVector[i]; + std::cerr << std::endl << std::endl; // clean up mapVector.clear(); @@ -5336,10 +5335,10 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi PIntVector map; PIntVector fun; PMsrLines::iterator iter; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; - Int_t ival, funNo; + Int_t ival, funNo; // create and initialize fParamInUse vector for (UInt_t i=0; iGetString(); if (str.IsDigit()) { // parameter number ival = str.Atoi(); - if ((ival > 0) && (ival < (Int_t)fParam.size()+1)) { + if ((ival > 0) && (ival < static_cast(fParam.size())+1)) { fParamInUse[ival-1]++; } } else if (str.Contains("map")) { // map @@ -5381,7 +5380,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // delete tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } @@ -5455,7 +5454,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // delete tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } @@ -5498,7 +5497,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // delete tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } @@ -5528,7 +5527,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // delete tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } } @@ -5591,7 +5590,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi if (ival == map[pos]) break; } - if ((UInt_t)pos == map.size()) { // new map value + if (static_cast(pos) == map.size()) { // new map value map.push_back(ival); } } @@ -5602,7 +5601,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // delete tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } @@ -5642,7 +5641,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi // delete tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } } @@ -5651,7 +5650,7 @@ void PMsrHandler::FillParameterInUse(PMsrLines &theory, PMsrLines &funcs, PMsrLi for (UInt_t i=0; i> **WARNING** : Parameter No " << i+1 << " is not used at all, will fix it" << endl; + std::cerr << std::endl << ">> **WARNING** : Parameter No " << i+1 << " is not used at all, will fix it" << std::endl; fParam[i].fStep = 0.0; } } @@ -5684,7 +5683,7 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() if (fitType == -1) { // fittype not given in the run block fitType = fGlobal.GetFitType(); if (fitType == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype is neither defined in RUN block number " << i+1 << ", nor in the GLOBAL block." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype is neither defined in RUN block number " << i+1 << ", nor in the GLOBAL block." << std::endl; return false; } } @@ -5694,8 +5693,8 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() case PRUN_SINGLE_HISTO: // check of norm is present if ((fRuns[i].GetNormParamNo() == -1) && !fFourierOnly) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Norm parameter number not defined. Necessary for single histogram fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Norm parameter number not defined. Necessary for single histogram fits." << std::endl; return false; } if (!fFourierOnly) { // next check NOT needed for Fourier only @@ -5703,32 +5702,32 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() if (fRuns[i].GetNormParamNo() < MSR_PARAM_FUN_OFFSET) { // parameter number // check that norm parameter number is not larger than the number of parameters if (fRuns[i].GetNormParamNo() > static_cast(fParam.size())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Norm parameter number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Norm parameter number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; + std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl; return false; } } else { // function norm if (fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET > GetNoOfFuncs()) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Norm parameter function number " << fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET << " is larger than the number of functions (" << GetNoOfFuncs() << ")."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Norm parameter function number " << fRuns[i].GetNormParamNo()-MSR_PARAM_FUN_OFFSET << " is larger than the number of functions (" << GetNoOfFuncs() << ")."; + std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl; return false; } } } // check that there is a forward parameter number if (fRuns[i].GetForwardHistoNo() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> forward parameter number not defined. Necessary for single histogram fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> forward parameter number not defined. Necessary for single histogram fits." << std::endl; return false; } if ((fRuns[i].GetNormParamNo() > static_cast(fParam.size())) && !fFourierOnly) { // check if forward histogram number is a function if (fRuns[i].GetNormParamNo() - MSR_PARAM_FUN_OFFSET > static_cast(fParam.size())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; + std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl; return false; } } @@ -5737,8 +5736,8 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in RUN block if (!fGlobal.IsFitRangeInBin()) { // fit range given as times in usec (GLOBAL block) if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in GLOBAL block - cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << " Fit range is not defined. Necessary for single histogram fits." << endl; + std::cerr << std::endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << " Fit range is not defined. Necessary for single histogram fits." << std::endl; return false; } } @@ -5747,31 +5746,31 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() // check number of T0's provided if ((fRuns[i].GetT0BinSize() > fRuns[i].GetForwardHistoNoSize()) && (fGlobal.GetT0BinSize() > fRuns[i].GetForwardHistoNoSize())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; - cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl; + std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl; return false; } // check packing if ((fRuns[i].GetPacking() == -1) && (fGlobal.GetPacking() == -1)) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; - cerr << endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; + std::cerr << std::endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl; fRuns[i].SetPacking(1); } break; case PRUN_SINGLE_HISTO_RRF: // check that there is a forward parameter number if (fRuns[i].GetForwardHistoNo() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> forward parameter number not defined. Necessary for single histogram RRF fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> forward parameter number not defined. Necessary for single histogram RRF fits." << std::endl; return false; } if ((fRuns[i].GetNormParamNo() > static_cast(fParam.size())) && !fFourierOnly) { // check if forward histogram number is a function if (fRuns[i].GetNormParamNo() - MSR_PARAM_FUN_OFFSET > static_cast(fParam.size())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ")."; + std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl; return false; } } @@ -5780,8 +5779,8 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in RUN block if (!fGlobal.IsFitRangeInBin()) { // fit range given as times in usec (GLOBAL block) if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in GLOBAL block - cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << " Fit range is not defined. Necessary for single histogram fits." << endl; + std::cerr << std::endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << " Fit range is not defined. Necessary for single histogram fits." << std::endl; return false; } } @@ -5790,48 +5789,48 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() // check number of T0's provided if ((fRuns[i].GetT0BinSize() > fRuns[i].GetForwardHistoNoSize()) && (fGlobal.GetT0BinSize() > fRuns[i].GetForwardHistoNoSize())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; - cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl; + std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl; return false; } // check that RRF frequency is given if (fGlobal.GetRRFUnitTag() == RRF_UNIT_UNDEF) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << std::endl; return false; } // check that RRF packing is given if (fGlobal.GetRRFPacking() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << std::endl; return false; } break; case PRUN_ASYMMETRY: // check alpha if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> alpha parameter number missing which is needed for an asymmetry fit."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> alpha parameter number missing which is needed for an asymmetry fit."; + std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl; return false; } // check that there is a forward parameter number if (fRuns[i].GetForwardHistoNo() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> forward histogram number not defined. Necessary for asymmetry fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> forward histogram number not defined. Necessary for asymmetry fits." << std::endl; return false; } // check that there is a backward parameter number if (fRuns[i].GetBackwardHistoNo() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> backward histogram number not defined. Necessary for asymmetry fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> backward histogram number not defined. Necessary for asymmetry fits." << std::endl; return false; } // check fit range if (!fRuns[i].IsFitRangeInBin()) { // fit range given as times in usec if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << std::endl; return false; } } @@ -5839,51 +5838,51 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() // check number of T0's provided if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize()) && (fGlobal.GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << endl; - cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << std::endl; + std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl; return false; } if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize()) && (fGlobal.GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << endl; - cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << std::endl; + std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << std::endl; return false; } // check packing if ((fRuns[i].GetPacking() == -1) && (fGlobal.GetPacking() == -1)) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; - cerr << endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; + std::cerr << std::endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl; fRuns[i].SetPacking(1); } break; case PRUN_ASYMMETRY_RRF: // check alpha if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> alpha parameter number missing which is needed for an asymmetry RRF fit."; - cerr << endl << ">> Consider to check the manual ;-)" << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> alpha parameter number missing which is needed for an asymmetry RRF fit."; + std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl; return false; } // check that there is a forward parameter number if (fRuns[i].GetForwardHistoNo() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> forward histogram number not defined. Necessary for asymmetry RRF fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> forward histogram number not defined. Necessary for asymmetry RRF fits." << std::endl; return false; } // check that there is a backward parameter number if (fRuns[i].GetBackwardHistoNo() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> backward histogram number not defined. Necessary for asymmetry RRF fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> backward histogram number not defined. Necessary for asymmetry RRF fits." << std::endl; return false; } // check fit range if (!fRuns[i].IsFitRangeInBin()) { // fit range given as times in usec if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry RRF fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry RRF fits." << std::endl; return false; } } @@ -5891,26 +5890,26 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() // check number of T0's provided if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize()) && (fGlobal.GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << endl; - cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << std::endl; + std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl; return false; } if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize()) && (fGlobal.GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize())) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << endl; - cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << std::endl; + std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << std::endl; return false; } // check that RRF frequency is given if (fGlobal.GetRRFUnitTag() == RRF_UNIT_UNDEF) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << std::endl; return false; } // check that RRF packing is given if (fGlobal.GetRRFPacking() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << std::endl; return false; } break; @@ -5920,32 +5919,31 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity() case PRUN_NON_MUSR: // check xy-data if ((fRuns[i].GetXDataIndex() == -1) && (fRuns[i].GetXDataLabel()->Length() == 0)) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> xy-data is missing. Necessary for non muSR fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> xy-data is missing. Necessary for non muSR fits." << std::endl; return false; } // check fit range if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; - cerr << endl << ">> Fit range is not defined, neither in the RUN block, nor in the GLOBAL block."; - cerr << endl << ">> Necessary for non muSR fits." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1; + std::cerr << std::endl << ">> Fit range is not defined, neither in the RUN block, nor in the GLOBAL block."; + std::cerr << std::endl << ">> Necessary for non muSR fits." << std::endl; return false; } } // check packing if (fRuns[i].GetPacking() == -1) { if (fGlobal.GetPacking() == -1) { - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; - cerr << endl << ">> Packing is not defined, will set it to 1." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1; + std::cerr << std::endl << ">> Packing is not defined, will set it to 1." << std::endl; fRuns[i].SetPacking(1); } } break; default: - cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype " << fitType << " undefined." << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** fittype " << fitType << " undefined." << std::endl; return false; - break; } } @@ -6004,8 +6002,8 @@ Bool_t PMsrHandler::CheckMaps() PIntVector mapBlock; PIntVector mapLineNo; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; Int_t no; @@ -6029,7 +6027,7 @@ Bool_t PMsrHandler::CheckMaps() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } } @@ -6053,7 +6051,7 @@ Bool_t PMsrHandler::CheckMaps() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } } @@ -6063,7 +6061,7 @@ Bool_t PMsrHandler::CheckMaps() for (UInt_t i=0; isize()) && + if ((mapVec[i]-MSR_PARAM_MAP_OFFSET-1 < static_cast(fRuns[j].GetMap()->size())) && (mapVec[i]-MSR_PARAM_MAP_OFFSET-1 >= 0)) { // map value smaller than run-block map length if (fRuns[j].GetMap(mapVec[i]-MSR_PARAM_MAP_OFFSET-1) != 0) { // map value in the run-block != 0 found = true; @@ -6073,16 +6071,16 @@ Bool_t PMsrHandler::CheckMaps() } if (!found) { // map not found result = false; - cerr << endl << ">> PMsrHandler::CheckMaps: **ERROR** map" << mapVec[i]-MSR_PARAM_MAP_OFFSET << " found in the "; + std::cerr << std::endl << ">> PMsrHandler::CheckMaps: **ERROR** map" << mapVec[i]-MSR_PARAM_MAP_OFFSET << " found in the "; if (mapBlock[i] == 0) - cerr << "theory-block "; + std::cerr << "theory-block "; else - cerr << "functions-block "; - cerr << "in line " << mapLineNo[i] << " is not present in the run-block!"; - cerr << endl; + std::cerr << "functions-block "; + std::cerr << "in line " << mapLineNo[i] << " is not present in the run-block!"; + std::cerr << std::endl; if (mapVec[i]-MSR_PARAM_MAP_OFFSET == 0) { - cerr << endl << ">> by the way: map must be > 0 ..."; - cerr << endl; + std::cerr << std::endl << ">> by the way: map must be > 0 ..."; + std::cerr << std::endl; } } } @@ -6117,8 +6115,8 @@ Bool_t PMsrHandler::CheckFuncs() PIntVector funBlock; PIntVector funLineBlockNo; - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; Int_t no; @@ -6142,7 +6140,7 @@ Bool_t PMsrHandler::CheckFuncs() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } } @@ -6173,12 +6171,12 @@ Bool_t PMsrHandler::CheckFuncs() } if (!found) { // func not found result = false; - cerr << endl << ">> PMsrHandler::CheckFuncs: **ERROR** fun" << funVec[i]-MSR_PARAM_FUN_OFFSET << " found in the "; + std::cerr << std::endl << ">> PMsrHandler::CheckFuncs: **ERROR** fun" << funVec[i]-MSR_PARAM_FUN_OFFSET << " found in the "; if (funBlock[i] == 0) - cerr << "theory-block in line " << funLineBlockNo[i] << " is not present in the functions-block!"; + std::cerr << "theory-block in line " << funLineBlockNo[i] << " is not present in the functions-block!"; else - cerr << "run-block No " << funLineBlockNo[i] << " (norm) is not present in the functions-block!"; - cerr << endl; + std::cerr << "run-block No " << funLineBlockNo[i] << " (norm) is not present in the functions-block!"; + std::cerr << std::endl; } } @@ -6207,9 +6205,9 @@ Bool_t PMsrHandler::CheckHistoGrouping() for (UInt_t i=0; i> PMsrHandler::CheckHistoGrouping: **ERROR** # of forward histos != # of backward histos."; - cerr << endl << ">> Run #" << i+1; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckHistoGrouping: **ERROR** # of forward histos != # of backward histos."; + std::cerr << std::endl << ">> Run #" << i+1; + std::cerr << std::endl; result = false; break; } @@ -6219,10 +6217,10 @@ Bool_t PMsrHandler::CheckHistoGrouping() for (UInt_t j=0; j> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!"; - cerr << endl << ">> run no " << i+1 << ", forward histo " << j+1 << " == forward histo " << k+1 << "."; - cerr << endl << ">> this really doesn't make any sense, but you are the boss."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!"; + std::cerr << std::endl << ">> run no " << i+1 << ", forward histo " << j+1 << " == forward histo " << k+1 << "."; + std::cerr << std::endl << ">> this really doesn't make any sense, but you are the boss."; + std::cerr << std::endl; } } } @@ -6232,10 +6230,10 @@ Bool_t PMsrHandler::CheckHistoGrouping() for (UInt_t j=0; j> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!"; - cerr << endl << ">> run no " << i+1 << ", backward histo " << j+1 << " == backward histo " << k+1 << "."; - cerr << endl << ">> this really doesn't make any sense, but you are the boss."; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!"; + std::cerr << std::endl << ">> run no " << i+1 << ", backward histo " << j+1 << " == backward histo " << k+1 << "."; + std::cerr << std::endl << ">> this really doesn't make any sense, but you are the boss."; + std::cerr << std::endl; } } } @@ -6264,9 +6262,9 @@ Bool_t PMsrHandler::CheckAddRunParameters() // check concerning the addt0 tags if (fRuns[i].GetAddT0BinEntries() != 0) { if (fRuns[i].GetAddT0BinEntries() != fRuns[i].GetRunNameSize()-1) { - cerr << endl << ">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addt0 != # of addruns."; - cerr << endl << ">> Run #" << i+1; - cerr << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addt0 != # of addruns."; + std::cerr << std::endl << ">> Run #" << i+1; + std::cerr << std::endl; result = false; break; } @@ -6291,9 +6289,9 @@ void PMsrHandler::CheckMaxLikelihood() for (UInt_t i=0; i> PMsrHandler::CheckMaxLikelihood: **WARNING**: Maximum Log Likelihood Fit is only implemented"; - cerr << endl << ">> for Single Histogram and Mu Minus Fits. Will fall back to Chi Square Fit."; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckMaxLikelihood: **WARNING**: Maximum Log Likelihood Fit is only implemented"; + std::cerr << std::endl << ">> for Single Histogram and Mu Minus Fits. Will fall back to Chi Square Fit."; + std::cerr << std::endl << std::endl; fStatistic.fChisq = true; break; } @@ -6318,8 +6316,8 @@ Bool_t PMsrHandler::CheckRRFSettings() if (fittype != -1) { // check if GLOBAL fittype is set if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) && (fittype != MSR_FITTYPE_ASYM_RRF)) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** found GLOBAL fittype " << fittype << " and"; - cerr << endl << ">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first."; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** found GLOBAL fittype " << fittype << " and"; + std::cerr << std::endl << ">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first."; result = false; } } else { // GLOBAL fittype is NOT set @@ -6327,8 +6325,8 @@ Bool_t PMsrHandler::CheckRRFSettings() fittype = fRuns[i].GetFitType(); if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) && (fittype != MSR_FITTYPE_ASYM_RRF)) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** found RUN with fittype " << fittype << " and"; - cerr << endl << ">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first."; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** found RUN with fittype " << fittype << " and"; + std::cerr << std::endl << ">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first."; result = false; break; } @@ -6336,15 +6334,15 @@ Bool_t PMsrHandler::CheckRRFSettings() } } else { if (fGlobal.GetRRFPacking() != -1) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_packing, without"; - cerr << endl << ">> rrf_freq. Doesn't make any sense. Will drop rrf_packing"; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_packing, without"; + std::cerr << std::endl << ">> rrf_freq. Doesn't make any sense. Will drop rrf_packing"; + std::cerr << std::endl << std::endl; fGlobal.SetRRFPacking(-1); } if (fGlobal.GetRRFPhase() != 0.0) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_phase, without"; - cerr << endl << ">> rrf_freq. Doesn't make any sense. Will drop rrf_phase"; - cerr << endl << endl; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_phase, without"; + std::cerr << std::endl << ">> rrf_freq. Doesn't make any sense. Will drop rrf_phase"; + std::cerr << std::endl << std::endl; fGlobal.SetRRFPhase(0.0); } } @@ -6360,13 +6358,13 @@ Bool_t PMsrHandler::CheckRRFSettings() if ((fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) || (fittype == MSR_FITTYPE_ASYM_RRF)) { // make sure RRF freq and RRF packing are set if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == RRF_FREQ_UNDEF) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; - cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; + std::cerr << std::endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; return false; } if (fGlobal.GetRRFPacking() == -1) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; - cerr << endl << ">> no RRF packing found in the GLOBAL section! Fix it."; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; + std::cerr << std::endl << ">> no RRF packing found in the GLOBAL section! Fix it."; return false; } } else { // check single runs for RRF @@ -6379,18 +6377,18 @@ Bool_t PMsrHandler::CheckRRFSettings() } } if (rrfFitCounter != fRuns.size()) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** #Runs (" << fRuns.size() << ") != # RRF fits found (" << rrfFitCounter << ")"; - cerr << endl << ">> This is currently not supported."; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** #Runs (" << fRuns.size() << ") != # RRF fits found (" << rrfFitCounter << ")"; + std::cerr << std::endl << ">> This is currently not supported."; return false; } if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == RRF_FREQ_UNDEF) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; - cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; + std::cerr << std::endl << ">> no RRF frequency found in the GLOBAL section! Fix it."; return false; } if (fGlobal.GetRRFPacking() == -1) { - cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; - cerr << endl << ">> no RRF packing found in the GLOBAL section! Fix it."; + std::cerr << std::endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but"; + std::cerr << std::endl << ">> no RRF packing found in the GLOBAL section! Fix it."; return false; } } @@ -6436,7 +6434,7 @@ void PMsrHandler::GetGroupingString(Int_t runNo, TString detector, TString &grou */ Bool_t PMsrHandler::EstimateN0() { - if (fStartupOptions == 0) + if (fStartupOptions == nullptr) return true; return fStartupOptions->estimateN0; @@ -6462,14 +6460,14 @@ UInt_t PMsrHandler::NeededPrecision(Double_t dval, UInt_t precLimit) return prec; for (UInt_t i=0; i(dval*pow(10.0,static_cast(i))) != 0) { prec = i; break; } } if (prec == precLimit) { - cerr << endl << ">> PMsrHandler::NeededPrecision(): **WARNING** precision limit of " << precLimit << ", requested."; + std::cerr << std::endl << ">> PMsrHandler::NeededPrecision(): **WARNING** precision limit of " << precLimit << ", requested."; } return prec; @@ -6506,8 +6504,8 @@ UInt_t PMsrHandler::LastSignificant(Double_t dval, UInt_t precLimit) // find last significant digit for (Int_t i=strlen(str)-1; i>=0; i--) { if (str[i] != '0') { - if (((UInt_t)i-decimalPoint) < precLimit) - lastSignificant = (UInt_t)i-decimalPoint; + if ((static_cast(i)-decimalPoint) < precLimit) + lastSignificant = static_cast(i)-decimalPoint; else lastSignificant = precLimit; break; diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index a84f4765..5adbb618 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -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 #include -using namespace std; #include 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(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(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(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(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(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(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(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(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 splitVec; + std::vector 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 subSplitVec; + if (splitVec[i].find("-") != std::string::npos) { // check for potential range + std::vector 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 subSplitVec; + } else if (splitVec[i].find(":") != std::string::npos) { // check for potential sequence + std::vector 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 diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index de383a93..e69fe411 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -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 #include #include -using namespace std; #include #include @@ -43,7 +42,7 @@ using namespace std; static const char *gFiletypes[] = { "Data files", "*.dat", "All files", "*", - 0, 0 }; + nullptr, nullptr }; ClassImp(PMusrCanvasPlotRange) @@ -76,7 +75,7 @@ PMusrCanvasPlotRange::PMusrCanvasPlotRange() void PMusrCanvasPlotRange::SetXRange(Double_t xmin, Double_t xmax) { if (xmin > xmax) { - cerr << endl << ">> PMusrCanvasPlotRange::SetXRange(): **WARNING** xmin > xmax, will swap them." << endl; + std::cerr << std::endl << ">> PMusrCanvasPlotRange::SetXRange(): **WARNING** xmin > xmax, will swap them." << std::endl; fXmin = xmax; fXmax = xmin; } else { @@ -98,7 +97,7 @@ void PMusrCanvasPlotRange::SetXRange(Double_t xmin, Double_t xmax) void PMusrCanvasPlotRange::SetYRange(Double_t ymin, Double_t ymax) { if (ymin > ymax) { - cerr << endl << ">> PMusrCanvasPlotRange::SetYRange(): **WARNING** ymin > ymax, will swap them." << endl; + std::cerr << std::endl << ">> PMusrCanvasPlotRange::SetYRange(): **WARNING** ymin > ymax, will swap them." << std::endl; fYmin = ymax; fYmax = ymin; } else { @@ -120,7 +119,7 @@ ClassImpQ(PMusrCanvas) PMusrCanvas::PMusrCanvas() { fTimeout = 0; - fTimeoutTimer = 0; + fTimeoutTimer = nullptr; fScaleN0AndBkg = true; fValid = false; @@ -131,32 +130,32 @@ PMusrCanvas::PMusrCanvas() fPlotType = -1; fPlotNumber = -1; - fImp = 0; - fBar = 0; - fPopupMain = 0; - fPopupFourier = 0; + fImp = nullptr; + fBar = nullptr; + fPopupMain = nullptr; + fPopupFourier = nullptr; - fStyle = 0; - fMainCanvas = 0; - fTitlePad = 0; - fDataTheoryPad = 0; - fParameterPad = 0; - fTheoryPad = 0; - fInfoPad = 0; - fMultiGraphLegend = 0; + fStyle = nullptr; + fMainCanvas = nullptr; + fTitlePad = nullptr; + fDataTheoryPad = nullptr; + fParameterPad = nullptr; + fTheoryPad = nullptr; + fInfoPad = nullptr; + fMultiGraphLegend = nullptr; - fHistoFrame = 0; + fHistoFrame = nullptr; - fMultiGraphData = 0; - fMultiGraphDiff = 0; + fMultiGraphData = nullptr; + fMultiGraphDiff = nullptr; InitFourier(); InitAverage(); - fCurrentFourierPhaseText = 0; + fCurrentFourierPhaseText = nullptr; - fRRFText = 0; - fRRFLatexText = 0; + fRRFText = nullptr; + fRRFLatexText = nullptr; fXRangePresent = false; fYRangePresent = false; @@ -192,23 +191,23 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title, fBatchMode(batch), fPlotNumber(number) { fTimeout = 0; - fTimeoutTimer = 0; + fTimeoutTimer = nullptr; fAveragedView = false; - fMultiGraphData = 0; - fMultiGraphDiff = 0; + fMultiGraphData = nullptr; + fMultiGraphDiff = nullptr; - fHistoFrame = 0; + fHistoFrame = nullptr; InitFourier(); InitAverage(); CreateStyle(); InitMusrCanvas(title, wtopx, wtopy, ww, wh); - fCurrentFourierPhaseText = 0; + fCurrentFourierPhaseText = nullptr; - fRRFText = 0; - fRRFLatexText = 0; + fRRFText = nullptr; + fRRFLatexText = nullptr; fXRangePresent = false; fYRangePresent = false; @@ -250,21 +249,21 @@ PMusrCanvas::PMusrCanvas(const Int_t number, const Char_t* title, fMarkerList(markerList), fColorList(colorList) { fTimeout = 0; - fTimeoutTimer = 0; + fTimeoutTimer = nullptr; - fMultiGraphData = 0; - fMultiGraphDiff = 0; + fMultiGraphData = nullptr; + fMultiGraphDiff = nullptr; - fHistoFrame = 0; + fHistoFrame = nullptr; InitAverage(); CreateStyle(); InitMusrCanvas(title, wtopx, wtopy, ww, wh); - fCurrentFourierPhaseText = 0; + fCurrentFourierPhaseText = nullptr; - fRRFText = 0; - fRRFLatexText = 0; + fRRFText = nullptr; + fRRFLatexText = nullptr; fXRangePresent = false; fYRangePresent = false; @@ -287,28 +286,28 @@ PMusrCanvas::~PMusrCanvas() // cleanup if (fTimeoutTimer) { delete fTimeoutTimer; - fTimeoutTimer = 0; + fTimeoutTimer = nullptr; } if (fCurrentFourierPhaseText) { delete fCurrentFourierPhaseText; - fCurrentFourierPhaseText = 0; + fCurrentFourierPhaseText = nullptr; } if (fRRFLatexText) { delete fRRFLatexText; - fRRFLatexText = 0; + fRRFLatexText = nullptr; } if (fRRFText) { delete fRRFText; - fRRFText = 0; + fRRFText = nullptr; } if (fStyle) { delete fStyle; - fStyle = 0; + fStyle = nullptr; } if (fTitlePad) { fTitlePad->Clear(); delete fTitlePad; - fTitlePad = 0; + fTitlePad = nullptr; } if (fData.size() > 0) { for (UInt_t i=0; iClear(); delete fMultiGraphLegend; - fMultiGraphLegend = 0; + fMultiGraphLegend = nullptr; } if (fMultiGraphData) { delete fMultiGraphData; - fMultiGraphData = 0; + fMultiGraphData = nullptr; } if (fMultiGraphDiff) { delete fMultiGraphDiff; - fMultiGraphDiff = 0; + fMultiGraphDiff = nullptr; } if (fDataTheoryPad) { delete fDataTheoryPad; - fDataTheoryPad = 0; + fDataTheoryPad = nullptr; } if (fParameterPad) { fParameterPad->Clear(); delete fParameterPad; - fParameterPad = 0; + fParameterPad = nullptr; } if (fTheoryPad) { fTheoryPad->Clear(); delete fTheoryPad; - fTheoryPad = 0; + fTheoryPad = nullptr; } if (fInfoPad) { fInfoPad->Clear(); delete fInfoPad; - fInfoPad = 0; + fInfoPad = nullptr; } if (fMainCanvas) { delete fMainCanvas; - fMainCanvas = 0; + fMainCanvas = nullptr; } } @@ -493,7 +492,7 @@ void PMusrCanvas::SetTimeout(Int_t timeout) if (fTimeoutTimer) { delete fTimeoutTimer; - fTimeoutTimer = 0; + fTimeoutTimer = nullptr; } fTimeoutTimer = new TTimer(); @@ -646,8 +645,8 @@ void PMusrCanvas::UpdateDataTheoryPad() // first check that plot number is smaller than the maximal number of runs if ((Int_t)plotInfo.fRuns[i] > (Int_t)runs.size()) { fValid = false; - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** run plot number " << (Int_t)plotInfo.fRuns[i] << " is larger than the number of runs " << runs.size(); - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** run plot number " << (Int_t)plotInfo.fRuns[i] << " is larger than the number of runs " << runs.size(); + std::cerr << std::endl; return; } // check that the plottype and the fittype do correspond @@ -657,10 +656,10 @@ void PMusrCanvas::UpdateDataTheoryPad() } if (fitType == -1) { fValid = false; - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** plottype = " << fPlotType; - cerr << ", fittype = " << runs[runNo].GetFitType() << "(RUN block)/"; - cerr << "fittype = " << globalBlock->GetFitType() << "(GLOBAL block). However, they have to correspond!"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** plottype = " << fPlotType; + std::cerr << ", fittype = " << runs[runNo].GetFitType() << "(RUN block)/"; + std::cerr << "fittype = " << globalBlock->GetFitType() << "(GLOBAL block). However, they have to correspond!"; + std::cerr << std::endl; return; } } @@ -668,7 +667,7 @@ void PMusrCanvas::UpdateDataTheoryPad() PRunData *data; for (UInt_t i=0; i> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a single histogram plot"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a single histogram plot"; + std::cerr << std::endl; return; } // handle data @@ -692,8 +691,8 @@ void PMusrCanvas::UpdateDataTheoryPad() if (!data) { // something wrong fValid = false; // error message - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a single histogram RRF plot"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a single histogram RRF plot"; + std::cerr << std::endl; return; } // handle data @@ -704,8 +703,8 @@ void PMusrCanvas::UpdateDataTheoryPad() if (!data) { // something wrong fValid = false; // error message - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a asymmetry plot"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a asymmetry plot"; + std::cerr << std::endl; return; } // handle data @@ -716,8 +715,8 @@ void PMusrCanvas::UpdateDataTheoryPad() if (!data) { // something wrong fValid = false; // error message - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a asymmetry RRF plot"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a asymmetry RRF plot"; + std::cerr << std::endl; return; } // handle data @@ -728,8 +727,8 @@ void PMusrCanvas::UpdateDataTheoryPad() if (!data) { // something wrong fValid = false; // error message - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a mu minus single histogram plot"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a mu minus single histogram plot"; + std::cerr << std::endl; return; } // handle data @@ -740,8 +739,8 @@ void PMusrCanvas::UpdateDataTheoryPad() if (!data) { // something wrong fValid = false; // error message - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a none musr data plot"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a none musr data plot"; + std::cerr << std::endl; return; } // handle data @@ -760,8 +759,8 @@ void PMusrCanvas::UpdateDataTheoryPad() default: fValid = false; // error message - cerr << endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** wrong plottype tag?!"; - cerr << endl; + std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** wrong plottype tag?!"; + std::cerr << std::endl; return; break; } @@ -1021,12 +1020,12 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) static eKeySwitch lastKeySwitch = kNotRelevant; if ((lastKeySwitch == kFourierDiff) && (x == 'f')) { - cout << "**INFO** f-d-f doesn't make any sense, will ignore 'f' ..." << endl; + std::cout << "**INFO** f-d-f doesn't make any sense, will ignore 'f' ..." << std::endl; return; } if ((lastKeySwitch == kDiffFourier) && (x == 'd')) { - cout << "**INFO** d-f-d doesn't make any sense, will ignore 'd' ..." << endl; + std::cout << "**INFO** d-f-d doesn't make any sense, will ignore 'd' ..." << std::endl; return; } @@ -1157,7 +1156,7 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected) else if ((fCurrentPlotView != PV_DATA) && !fDifferenceView && !fAveragedView) relevantKeySwitch = kFourier; } else { // with only 1 data set, it doesn't make any sense to average! - cout << "**INFO** averaging of a single data set doesn't make any sense, will ignore 'a' ..." << endl; + std::cout << "**INFO** averaging of a single data set doesn't make any sense, will ignore 'a' ..." << std::endl; return; } } else if (x == 'c') { @@ -1367,8 +1366,8 @@ void PMusrCanvas::HandleMenuPopup(Int_t id) fPreviousPlotView = fCurrentPlotView; fCurrentPlotView = PV_FOURIER_PHASE_OPT_REAL; // make sure that phase opt. real indeed exists - if (fData[0].dataFourierPhaseOptReal == 0) { - if (fData[0].dataFourierRe == 0) + if (fData[0].dataFourierPhaseOptReal == nullptr) { + if (fData[0].dataFourierRe == nullptr) HandleFourier(); else CalcPhaseOptReFT(); @@ -1463,7 +1462,7 @@ void PMusrCanvas::HandleMenuPopup(Int_t id) CleanupAverage(); } } else { - cout << "**INFO** averaging of a single data set doesn't make any sense, will ignore 'a' ..." << endl; + std::cout << "**INFO** averaging of a single data set doesn't make any sense, will ignore 'a' ..." << std::endl; return; } } else if (id == P_MENU_ID_EXPORT_DATA+P_MENU_PLOT_OFFSET*fPlotNumber) { @@ -1500,7 +1499,7 @@ void PMusrCanvas::HandleMenuPopup(Int_t id) */ void PMusrCanvas::LastCanvasClosed() { -// cerr << ">> in last canvas closed check. gROOT->GetListOfCanvases()->GetEntries()=" << gROOT->GetListOfCanvases()->GetEntries() << endl; +// std::cerr << ">> in last canvas closed check. gROOT->GetListOfCanvases()->GetEntries()=" << gROOT->GetListOfCanvases()->GetEntries() << std::endl; if (gROOT->GetListOfCanvases()->IsEmpty()) { Done(0); } @@ -1514,7 +1513,7 @@ void PMusrCanvas::LastCanvasClosed() */ void PMusrCanvas::WindowClosed() { -// cerr << ">> fMainCanvas->GetName()=" << fMainCanvas->GetName() << endl; +// std::cerr << ">> fMainCanvas->GetName()=" << fMainCanvas->GetName() << std::endl; gROOT->GetListOfCanvases()->Remove(fMainCanvas); LastCanvasClosed(); } @@ -1530,7 +1529,7 @@ void PMusrCanvas::WindowClosed() */ void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat) { - cout << endl << ">> SaveGraphicsAndQuit: will dump the canvas into a graphics output file (" << graphicsFormat << ") ..."<< endl; + std::cout << std::endl << ">> SaveGraphicsAndQuit: will dump the canvas into a graphics output file (" << graphicsFormat << ") ..."<< std::endl; TString str(fileName); Int_t idx = -1; @@ -1547,7 +1546,7 @@ void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat) } if (idx == -1) { - cerr << endl << ">> PMusrCanvas::SaveGraphicsAndQuit(): **ERROR** fileName (" << fileName << ") is invalid." << endl; + std::cerr << std::endl << ">> PMusrCanvas::SaveGraphicsAndQuit(): **ERROR** fileName (" << fileName << ") is invalid." << std::endl; return; } @@ -1561,7 +1560,7 @@ void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat) sprintf(ext, ".%s", graphicsFormat); str.Replace(idx, size, ext, strlen(ext)); - cout << endl << ">> SaveGraphicsAndQuit: " << str.Data() << endl; + std::cout << std::endl << ">> SaveGraphicsAndQuit: " << str.Data() << std::endl; fMainCanvas->SaveAs(str.Data()); @@ -1579,8 +1578,8 @@ void PMusrCanvas::SaveGraphicsAndQuit(Char_t *fileName, Char_t *graphicsFormat) */ void PMusrCanvas::ExportData(const Char_t *fileName) { - if (fileName == 0) { // path file name NOT provided, generate a default path file name - cerr << endl << ">> PMusrCanvas::ExportData(): **ERROR** NO path file name provided. Will do nothing." << endl; + if (fileName == nullptr) { // path file name NOT provided, generate a default path file name + std::cerr << std::endl << ">> PMusrCanvas::ExportData(): **ERROR** NO path file name provided. Will do nothing." << std::endl; return; } @@ -1953,12 +1952,12 @@ void PMusrCanvas::ExportData(const Char_t *fileName) } // open file - ofstream fout; + std::ofstream fout; // open output data-file - fout.open(fileName, iostream::out); + fout.open(fileName, std::iostream::out); if (!fout.is_open()) { - cerr << endl << ">> PMusrCanvas::ExportData(): **ERROR** couldn't open file " << fileName << " for writing." << endl; + std::cerr << std::endl << ">> PMusrCanvas::ExportData(): **ERROR** couldn't open file " << fileName << " for writing." << std::endl; return; } @@ -1975,44 +1974,44 @@ void PMusrCanvas::ExportData(const Char_t *fileName) switch (fCurrentPlotView) { case PV_DATA: if (fAveragedView) { - fout << "% from averaged view" << endl; - fout << "% x, diff, errDiff" << endl; + fout << "% from averaged view" << std::endl; + fout << "% x, diff, errDiff" << std::endl; } else { fout << "% "; for (UInt_t i=0; i 0) - fout << setprecision(9) << dumpVector[j].dataErr[i] << ", "; + fout << std::setprecision(9) << dumpVector[j].dataErr[i] << ", "; } else { if (dumpVector[j].dataErr.size() > 0) fout << " , , , "; @@ -2213,12 +2212,12 @@ void PMusrCanvas::ExportData(const Char_t *fileName) } // write last data/theory entry if (i> Data windows saved in ascii format ..." << endl; + std::cout << std::endl << ">> Data windows saved in ascii format ..." << std::endl; // if (asciiOutput) { // if (fPlotNumber == static_cast(fMsrHandler->GetMsrPlotList()->size()) - 1) // Done(0); @@ -2322,25 +2321,25 @@ void PMusrCanvas::InitFourier() */ void PMusrCanvas::InitAverage() { - fDataAvg.data = 0; - fDataAvg.dataFourierRe = 0; - fDataAvg.dataFourierIm = 0; - fDataAvg.dataFourierPwr = 0; - fDataAvg.dataFourierPhase = 0; - fDataAvg.dataFourierPhaseOptReal = 0; - fDataAvg.theory = 0; - fDataAvg.theoryFourierRe = 0; - fDataAvg.theoryFourierIm = 0; - fDataAvg.theoryFourierPwr = 0; - fDataAvg.theoryFourierPhase = 0; - fDataAvg.theoryFourierPhaseOptReal = 0; - fDataAvg.diff = 0; - fDataAvg.diffFourierRe = 0; - fDataAvg.diffFourierIm = 0; - fDataAvg.diffFourierPwr = 0; - fDataAvg.diffFourierPhase = 0; - fDataAvg.diffFourierPhaseOptReal = 0; - fDataAvg.dataRange = 0; + fDataAvg.data = nullptr; + fDataAvg.dataFourierRe = nullptr; + fDataAvg.dataFourierIm = nullptr; + fDataAvg.dataFourierPwr = nullptr; + fDataAvg.dataFourierPhase = nullptr; + fDataAvg.dataFourierPhaseOptReal = nullptr; + fDataAvg.theory = nullptr; + fDataAvg.theoryFourierRe = nullptr; + fDataAvg.theoryFourierIm = nullptr; + fDataAvg.theoryFourierPwr = nullptr; + fDataAvg.theoryFourierPhase = nullptr; + fDataAvg.theoryFourierPhaseOptReal = nullptr; + fDataAvg.diff = nullptr; + fDataAvg.diffFourierRe = nullptr; + fDataAvg.diffFourierIm = nullptr; + fDataAvg.diffFourierPwr = nullptr; + fDataAvg.diffFourierPhase = nullptr; + fDataAvg.diffFourierPhaseOptReal = nullptr; + fDataAvg.dataRange = nullptr; fDataAvg.diffFourierTag = 0; } @@ -2366,26 +2365,26 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, fPreviousPlotView = PV_DATA; fPlotType = -1; - fImp = 0; - fBar = 0; - fPopupMain = 0; - fPopupFourier = 0; + fImp = nullptr; + fBar = nullptr; + fPopupMain = nullptr; + fPopupFourier = nullptr; - fMainCanvas = 0; - fTitlePad = 0; - fDataTheoryPad = 0; - fParameterPad = 0; - fTheoryPad = 0; - fInfoPad = 0; - fMultiGraphLegend = 0; + fMainCanvas = nullptr; + fTitlePad = nullptr; + fDataTheoryPad = nullptr; + fParameterPad = nullptr; + fTheoryPad = nullptr; + fInfoPad = nullptr; + fMultiGraphLegend = nullptr; // invoke canvas TString canvasName = TString("fMainCanvas"); canvasName += fPlotNumber; fMainCanvas = new TCanvas(canvasName.Data(), title, wtopx, wtopy, ww, wh); - if (fMainCanvas == 0) { - cerr << endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke " << canvasName.Data(); - cerr << endl; + if (fMainCanvas == nullptr) { + std::cerr << std::endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke " << canvasName.Data(); + std::cerr << std::endl; return; } @@ -2433,9 +2432,9 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, // divide the canvas into 4 pads // title pad fTitlePad = new TPaveText(0.0, YTITLE, 1.0, 1.0, "NDC"); - if (fTitlePad == 0) { - cerr << endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fTitlePad"; - cerr << endl; + if (fTitlePad == nullptr) { + std::cerr << std::endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fTitlePad"; + std::cerr << std::endl; return; } fTitlePad->SetFillColor(TColor::GetColor(255,255,255)); @@ -2445,9 +2444,9 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, // data/theory pad fDataTheoryPad = new TPad("dataTheoryPad", "dataTheoryPad", 0.0, YINFO, XTHEO, YTITLE); - if (fDataTheoryPad == 0) { - cerr << endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fDataTheoryPad"; - cerr << endl; + if (fDataTheoryPad == nullptr) { + std::cerr << std::endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fDataTheoryPad"; + std::cerr << std::endl; return; } fDataTheoryPad->SetFillColor(TColor::GetColor(255,255,255)); @@ -2455,9 +2454,9 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, // parameter pad fParameterPad = new TPaveText(XTHEO, 0.5, 1.0, YTITLE, "NDC"); - if (fParameterPad == 0) { - cerr << endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fParameterPad"; - cerr << endl; + if (fParameterPad == nullptr) { + std::cerr << std::endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fParameterPad"; + std::cerr << std::endl; return; } fParameterPad->SetFillColor(TColor::GetColor(255,255,255)); @@ -2466,9 +2465,9 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, // theory pad fTheoryPad = new TPaveText(XTHEO, 0.1, 1.0, 0.5, "NDC"); - if (fTheoryPad == 0) { - cerr << endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fTheoryPad"; - cerr << endl; + if (fTheoryPad == nullptr) { + std::cerr << std::endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fTheoryPad"; + std::cerr << std::endl; return; } fTheoryPad->SetFillColor(TColor::GetColor(255,255,255)); @@ -2478,9 +2477,9 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, // info pad fInfoPad = new TLegend(0.0, 0.0, 1.0, YINFO, "NDC"); - if (fInfoPad == 0) { - cerr << endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fInfoPad"; - cerr << endl; + if (fInfoPad == nullptr) { + std::cerr << std::endl << ">> PMusrCanvas::PMusrCanvas(): **PANIC ERROR** Couldn't invoke fInfoPad"; + std::cerr << std::endl; return; } fInfoPad->SetFillColor(TColor::GetColor(255,255,255)); @@ -2506,25 +2505,25 @@ void PMusrCanvas::InitMusrCanvas(const Char_t* title, Int_t wtopx, Int_t wtopy, */ void PMusrCanvas::InitDataSet(PMusrCanvasDataSet &dataSet) { - dataSet.data = 0; - dataSet.dataFourierRe = 0; - dataSet.dataFourierIm = 0; - dataSet.dataFourierPwr = 0; - dataSet.dataFourierPhase = 0; - dataSet.dataFourierPhaseOptReal = 0; - dataSet.theory = 0; - dataSet.theoryFourierRe = 0; - dataSet.theoryFourierIm = 0; - dataSet.theoryFourierPwr = 0; - dataSet.theoryFourierPhase = 0; - dataSet.theoryFourierPhaseOptReal = 0; - dataSet.diff = 0; - dataSet.diffFourierRe = 0; - dataSet.diffFourierIm = 0; - dataSet.diffFourierPwr = 0; - dataSet.diffFourierPhase = 0; - dataSet.diffFourierPhaseOptReal = 0; - dataSet.dataRange = 0; + dataSet.data = nullptr; + dataSet.dataFourierRe = nullptr; + dataSet.dataFourierIm = nullptr; + dataSet.dataFourierPwr = nullptr; + dataSet.dataFourierPhase = nullptr; + dataSet.dataFourierPhaseOptReal = nullptr; + dataSet.theory = nullptr; + dataSet.theoryFourierRe = nullptr; + dataSet.theoryFourierIm = nullptr; + dataSet.theoryFourierPwr = nullptr; + dataSet.theoryFourierPhase = nullptr; + dataSet.theoryFourierPhaseOptReal = nullptr; + dataSet.diff = nullptr; + dataSet.diffFourierRe = nullptr; + dataSet.diffFourierIm = nullptr; + dataSet.diffFourierPwr = nullptr; + dataSet.diffFourierPhase = nullptr; + dataSet.diffFourierPhaseOptReal = nullptr; + dataSet.dataRange = nullptr; } //-------------------------------------------------------------------------- @@ -2537,22 +2536,22 @@ void PMusrCanvas::InitDataSet(PMusrCanvasDataSet &dataSet) */ void PMusrCanvas::InitDataSet(PMusrCanvasNonMusrDataSet &dataSet) { - dataSet.data = 0; - dataSet.dataFourierRe = 0; - dataSet.dataFourierIm = 0; - dataSet.dataFourierPwr = 0; - dataSet.dataFourierPhase = 0; - dataSet.theory = 0; - dataSet.theoryFourierRe = 0; - dataSet.theoryFourierIm = 0; - dataSet.theoryFourierPwr = 0; - dataSet.theoryFourierPhase = 0; - dataSet.diff = 0; - dataSet.diffFourierRe = 0; - dataSet.diffFourierIm = 0; - dataSet.diffFourierPwr = 0; - dataSet.diffFourierPhase = 0; - dataSet.dataRange = 0; + dataSet.data = nullptr; + dataSet.dataFourierRe = nullptr; + dataSet.dataFourierIm = nullptr; + dataSet.dataFourierPwr = nullptr; + dataSet.dataFourierPhase = nullptr; + dataSet.theory = nullptr; + dataSet.theoryFourierRe = nullptr; + dataSet.theoryFourierIm = nullptr; + dataSet.theoryFourierPwr = nullptr; + dataSet.theoryFourierPhase = nullptr; + dataSet.diff = nullptr; + dataSet.diffFourierRe = nullptr; + dataSet.diffFourierIm = nullptr; + dataSet.diffFourierPwr = nullptr; + dataSet.diffFourierPhase = nullptr; + dataSet.dataRange = nullptr; } //-------------------------------------------------------------------------- @@ -2567,79 +2566,79 @@ void PMusrCanvas::CleanupDataSet(PMusrCanvasDataSet &dataSet) { if (dataSet.data) { delete dataSet.data; - dataSet.data = 0; + dataSet.data = nullptr; } if (dataSet.dataFourierRe) { delete dataSet.dataFourierRe; - dataSet.dataFourierRe = 0; + dataSet.dataFourierRe = nullptr; } if (dataSet.dataFourierIm) { delete dataSet.dataFourierIm; - dataSet.dataFourierIm = 0; + dataSet.dataFourierIm = nullptr; } if (dataSet.dataFourierPwr) { delete dataSet.dataFourierPwr; - dataSet.dataFourierPwr = 0; + dataSet.dataFourierPwr = nullptr; } if (dataSet.dataFourierPhase) { delete dataSet.dataFourierPhase; - dataSet.dataFourierPhase = 0; + dataSet.dataFourierPhase = nullptr; } if (dataSet.dataFourierPhaseOptReal) { delete dataSet.dataFourierPhaseOptReal; - dataSet.dataFourierPhaseOptReal = 0; + dataSet.dataFourierPhaseOptReal = nullptr; } if (dataSet.theory) { delete dataSet.theory; - dataSet.theory = 0; + dataSet.theory = nullptr; } if (dataSet.theoryFourierRe) { delete dataSet.theoryFourierRe; - dataSet.theoryFourierRe = 0; + dataSet.theoryFourierRe = nullptr; } if (dataSet.theoryFourierIm) { delete dataSet.theoryFourierIm; - dataSet.theoryFourierIm = 0; + dataSet.theoryFourierIm = nullptr; } if (dataSet.theoryFourierPwr) { delete dataSet.theoryFourierPwr; - dataSet.theoryFourierPwr = 0; + dataSet.theoryFourierPwr = nullptr; } if (dataSet.theoryFourierPhase) { delete dataSet.theoryFourierPhase; - dataSet.theoryFourierPhase = 0; + dataSet.theoryFourierPhase = nullptr; } if (dataSet.theoryFourierPhaseOptReal) { delete dataSet.theoryFourierPhaseOptReal; - dataSet.theoryFourierPhaseOptReal = 0; + dataSet.theoryFourierPhaseOptReal = nullptr; } if (dataSet.diff) { delete dataSet.diff; - dataSet.diff = 0; + dataSet.diff = nullptr; } if (dataSet.diffFourierRe) { delete dataSet.diffFourierRe; - dataSet.diffFourierRe = 0; + dataSet.diffFourierRe = nullptr; } if (dataSet.diffFourierIm) { delete dataSet.diffFourierIm; - dataSet.diffFourierIm = 0; + dataSet.diffFourierIm = nullptr; } if (dataSet.diffFourierPwr) { delete dataSet.diffFourierPwr; - dataSet.diffFourierPwr = 0; + dataSet.diffFourierPwr = nullptr; } if (dataSet.diffFourierPhase) { delete dataSet.diffFourierPhase; - dataSet.diffFourierPhase = 0; + dataSet.diffFourierPhase = nullptr; } if (dataSet.diffFourierPhaseOptReal) { delete dataSet.diffFourierPhaseOptReal; - dataSet.diffFourierPhaseOptReal = 0; + dataSet.diffFourierPhaseOptReal = nullptr; } if (dataSet.dataRange) { delete dataSet.dataRange; - dataSet.dataRange = 0; + dataSet.dataRange = nullptr; } } @@ -2655,67 +2654,67 @@ void PMusrCanvas::CleanupDataSet(PMusrCanvasNonMusrDataSet &dataSet) { if (dataSet.data) { delete dataSet.data; - dataSet.data = 0; + dataSet.data = nullptr; } if (dataSet.dataFourierRe) { delete dataSet.dataFourierRe; - dataSet.dataFourierRe = 0; + dataSet.dataFourierRe = nullptr; } if (dataSet.dataFourierIm) { delete dataSet.dataFourierIm; - dataSet.dataFourierIm = 0; + dataSet.dataFourierIm = nullptr; } if (dataSet.dataFourierPwr) { delete dataSet.dataFourierPwr; - dataSet.dataFourierPwr = 0; + dataSet.dataFourierPwr = nullptr; } if (dataSet.dataFourierPhase) { delete dataSet.dataFourierPhase; - dataSet.dataFourierPhase = 0; + dataSet.dataFourierPhase = nullptr; } if (dataSet.theory) { delete dataSet.theory; - dataSet.theory = 0; + dataSet.theory = nullptr; } if (dataSet.theoryFourierRe) { delete dataSet.theoryFourierRe; - dataSet.theoryFourierRe = 0; + dataSet.theoryFourierRe = nullptr; } if (dataSet.theoryFourierIm) { delete dataSet.theoryFourierIm; - dataSet.theoryFourierIm = 0; + dataSet.theoryFourierIm = nullptr; } if (dataSet.theoryFourierPwr) { delete dataSet.theoryFourierPwr; - dataSet.theoryFourierPwr = 0; + dataSet.theoryFourierPwr = nullptr; } if (dataSet.theoryFourierPhase) { delete dataSet.theoryFourierPhase; - dataSet.theoryFourierPhase = 0; + dataSet.theoryFourierPhase = nullptr; } if (dataSet.diff) { delete dataSet.diff; - dataSet.diff = 0; + dataSet.diff = nullptr; } if (dataSet.diffFourierRe) { delete dataSet.diffFourierRe; - dataSet.diffFourierRe = 0; + dataSet.diffFourierRe = nullptr; } if (dataSet.diffFourierIm) { delete dataSet.diffFourierIm; - dataSet.diffFourierIm = 0; + dataSet.diffFourierIm = nullptr; } if (dataSet.diffFourierPwr) { delete dataSet.diffFourierPwr; - dataSet.diffFourierPwr = 0; + dataSet.diffFourierPwr = nullptr; } if (dataSet.diffFourierPhase) { delete dataSet.diffFourierPhase; - dataSet.diffFourierPhase = 0; + dataSet.diffFourierPhase = nullptr; } if (dataSet.dataRange) { delete dataSet.dataRange; - dataSet.dataRange = 0; + dataSet.dataRange = nullptr; } } @@ -2749,7 +2748,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) // dataHisto ------------------------------------------------------------- // create histo specific infos name = *fMsrHandler->GetMsrRunList()->at(runNo).GetRunName() + "_DataRunNo"; - name += (Int_t)runNo; + name += static_cast(runNo); name += "_"; name += fPlotNumber; start = data->GetDataTimeStart() - data->GetDataTimeStep()/2.0; @@ -2899,10 +2898,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) Double_t dval = (startFitRange - data->GetDataTimeStart())/data->GetDataTimeStep(); if (dval < 0.0) { // make sure that startBin >= 0 startBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data < 0 for 'use_fit_range', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data < 0 for 'use_fit_range', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetValue()->size()) { // make sure that startBin <= length of data vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'use_fit_range',"; - cerr << endl << ">> will set it to data vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'use_fit_range',"; + std::cerr << std::endl << ">> will set it to data vector size" << std::endl << std::endl; startBin = data->GetValue()->size(); } else { startBin = (UInt_t)dval; @@ -2915,10 +2914,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) dval = (endFitRange - data->GetDataTimeStart())/data->GetDataTimeStep(); if (dval < 0.0) { // make sure that endBin >= 0 endBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data < 0 for 'use_fit_range', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data < 0 for 'use_fit_range', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetValue()->size()) { // make sure that endBin <= length of data vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'use_fit_range',"; - cerr << endl << ">> will set it to data vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'use_fit_range',"; + std::cerr << std::endl << ">> will set it to data vector size" << std::endl << std::endl; endBin = data->GetValue()->size(); } else { endBin = (UInt_t)dval; @@ -2930,10 +2929,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) Double_t dval = (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin[runNo] - data->GetDataTimeStart())/data->GetDataTimeStep(); if (dval < 0.0) { // make sure that startBin >= 0 startBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data < 0 for 'sub_ranges', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data < 0 for 'sub_ranges', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetValue()->size()) { // make sure that startBin <= length of data vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'sub_ranges',"; - cerr << endl << ">> will set it to data vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'sub_ranges',"; + std::cerr << std::endl << ">> will set it to data vector size" << std::endl << std::endl; startBin = data->GetValue()->size(); } else { startBin = (UInt_t)dval; @@ -2942,10 +2941,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) dval = (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmax[runNo] - data->GetDataTimeStart())/data->GetDataTimeStep(); if (dval < 0.0) { // make sure that endBin >= 0 endBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data < 0 for 'sub_ranges', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data < 0 for 'sub_ranges', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetValue()->size()) { // make sure that endtBin <= length of data vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'sub_ranges',"; - cerr << endl << ">> will set it to data vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin data=" << (UInt_t)dval << " >= data vector size=" << data->GetValue()->size() << " for 'sub_ranges',"; + std::cerr << std::endl << ">> will set it to data vector size" << std::endl << std::endl; endBin = data->GetValue()->size(); } else { endBin = (UInt_t)dval; @@ -3031,10 +3030,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) Double_t dval = (startFitRange - data->GetDataTimeStart())/data->GetTheoryTimeStep(); if (dval < 0.0) { // make sure that startBin >= 0 startBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory < 0 for 'use_fit_range', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory < 0 for 'use_fit_range', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetTheory()->size()) { // make sure that startBin <= length of theory vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'use_fit_range',"; - cerr << endl << ">> will set it to theory vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'use_fit_range',"; + std::cerr << std::endl << ">> will set it to theory vector size" << std::endl << std::endl; startBin = data->GetTheory()->size(); } else { startBin = (UInt_t)dval; @@ -3047,10 +3046,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) dval = (endFitRange - data->GetDataTimeStart())/data->GetTheoryTimeStep(); if (dval < 0.0) { // make sure that endBin >= 0 endBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory < 0 for 'use_fit_range', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory < 0 for 'use_fit_range', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetTheory()->size()) { // make sure that endBin <= length of theory vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'use_fit_range',"; - cerr << endl << ">> will set it to theory vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'use_fit_range',"; + std::cerr << std::endl << ">> will set it to theory vector size" << std::endl << std::endl; endBin = data->GetTheory()->size(); } else { endBin = (UInt_t)dval; @@ -3065,10 +3064,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) Double_t dval = (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin[runNo] -data->GetDataTimeStart())/data->GetTheoryTimeStep(); if (dval < 0.0) { // make sure that startBin >= 0 startBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory < 0 for 'sub_ranges', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory < 0 for 'sub_ranges', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetTheory()->size()) { // make sure that startBin <= length of theory vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'sub_ranges',"; - cerr << endl << ">> will set it to theory vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found startBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'sub_ranges',"; + std::cerr << std::endl << ">> will set it to theory vector size" << std::endl << std::endl; startBin = data->GetTheory()->size(); } else { startBin = (UInt_t)dval; @@ -3077,10 +3076,10 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data) dval = (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmax[runNo] -data->GetDataTimeStart())/data->GetTheoryTimeStep(); if (dval < 0.0) { // make sure that endBin >= 0 endBin = 0; - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory < 0 for 'sub_ranges', will set it to 0" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory < 0 for 'sub_ranges', will set it to 0" << std::endl << std::endl; } else if (dval >= (Double_t)data->GetTheory()->size()) { // make sure that endtBin <= length of theory vector - cerr << endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'sub_ranges',"; - cerr << endl << ">> will set it to theory vector size" << endl << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleDataSet(): **WARNING** found endBin theory=" << (UInt_t)dval << " >= theory vector size=" << data->GetTheory()->size() << " for 'sub_ranges',"; + std::cerr << std::endl << ">> will set it to theory vector size" << std::endl << std::endl; endBin = data->GetTheory()->size(); } else { endBin = (UInt_t)dval; @@ -3284,7 +3283,7 @@ void PMusrCanvas::HandleNonMusrDataSet(UInt_t plotNo, UInt_t runNo, PRunData *da void PMusrCanvas::HandleDifference() { // check if it is necessary to calculate diff data - if ((fPlotType != MSR_PLOT_NON_MUSR) && (fData[0].diff == 0)) { + if ((fPlotType != MSR_PLOT_NON_MUSR) && (fData[0].diff == nullptr)) { TH1F *diffHisto; TString name; // loop over all histos @@ -3318,13 +3317,13 @@ void PMusrCanvas::HandleDifference() fData[i].diff->SetBinError(j, value); } } - } else if ((fPlotType == MSR_PLOT_NON_MUSR) && (fNonMusrData[0].diff == 0)) { + } else if ((fPlotType == MSR_PLOT_NON_MUSR) && (fNonMusrData[0].diff == nullptr)) { TGraphErrors *diffHisto; TString name; // loop over all histos for (UInt_t i=0; iGetN()); @@ -3376,7 +3375,7 @@ void PMusrCanvas::HandleFourier() return; // check if fourier needs to be calculated - if (fData[0].dataFourierRe == 0) { + if (fData[0].dataFourierRe == nullptr) { Int_t bin; double startTime = fXmin; double endTime = fXmax; @@ -3390,7 +3389,7 @@ void PMusrCanvas::HandleFourier() // calculate fourier transform of the data PFourier fourierData(fData[i].data, fFourier.fUnits, startTime, endTime, fFourier.fDCCorrected, fFourier.fFourierPower); if (!fourierData.IsValid()) { - cerr << endl << ">> PMusrCanvas::HandleFourier(): **SEVERE ERROR** couldn't invoke PFourier to calculate the Fourier data ..." << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleFourier(): **SEVERE ERROR** couldn't invoke PFourier to calculate the Fourier data ..." << std::endl; return; } fourierData.Transform(fFourier.fApodization); @@ -3431,7 +3430,7 @@ void PMusrCanvas::HandleFourier() Int_t powerPad = (Int_t)round(log((endTime-startTime)/fData[i].theory->GetBinWidth(1))/log(2))+3; PFourier fourierTheory(fData[i].theory, fFourier.fUnits, startTime, endTime, fFourier.fDCCorrected, powerPad); if (!fourierTheory.IsValid()) { - cerr << endl << ">> PMusrCanvas::HandleFourier(): **SEVERE ERROR** couldn't invoke PFourier to calculate the Fourier theory ..." << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleFourier(): **SEVERE ERROR** couldn't invoke PFourier to calculate the Fourier theory ..." << std::endl; return; } fourierTheory.Transform(fFourier.fApodization); @@ -3472,7 +3471,7 @@ void PMusrCanvas::HandleFourier() cp = TMath::Cos(fFourier.fPhase[i]/180.0*TMath::Pi()); sp = TMath::Sin(fFourier.fPhase[i]/180.0*TMath::Pi()); } - if ((fData[i].dataFourierRe != 0) && (fData[i].dataFourierIm != 0)) { + if ((fData[i].dataFourierRe != nullptr) && (fData[i].dataFourierIm != nullptr)) { for (Int_t j=0; jGetNbinsX(); j++) { // loop over a fourier data set // calculate new fourier data set value re = fData[i].dataFourierRe->GetBinContent(j) * cp + fData[i].dataFourierIm->GetBinContent(j) * sp; @@ -3482,7 +3481,7 @@ void PMusrCanvas::HandleFourier() fData[i].dataFourierIm->SetBinContent(j, im); } } - if ((fData[i].theoryFourierRe != 0) && (fData[i].theoryFourierIm != 0)) { + if ((fData[i].theoryFourierRe != nullptr) && (fData[i].theoryFourierIm != nullptr)) { for (Int_t j=0; jGetNbinsX(); j++) { // loop over a fourier data set // calculate new fourier data set value re = fData[i].theoryFourierRe->GetBinContent(j) * cp + fData[i].theoryFourierIm->GetBinContent(j) * sp; @@ -3512,9 +3511,9 @@ void PMusrCanvas::HandleDifferenceFourier() return; // check if fourier needs to be calculated - if (fData[0].diffFourierRe == 0) { + if (fData[0].diffFourierRe == nullptr) { // check if difference has been already calcualted, if not do it - if (fData[0].diff == 0) + if (fData[0].diff == nullptr) HandleDifference(); // get time from the current fHistoFrame @@ -3528,7 +3527,7 @@ void PMusrCanvas::HandleDifferenceFourier() // calculate fourier transform of the data PFourier fourierData(fData[i].diff, fFourier.fUnits, startTime, endTime, fFourier.fDCCorrected, fFourier.fFourierPower); if (!fourierData.IsValid()) { - cerr << endl << ">> PMusrCanvas::HandleFourier(): **SEVERE ERROR** couldn't invoke PFourier to calculate the Fourier diff ..." << endl; + std::cerr << std::endl << ">> PMusrCanvas::HandleFourier(): **SEVERE ERROR** couldn't invoke PFourier to calculate the Fourier diff ..." << std::endl; return; } fourierData.Transform(fFourier.fApodization); @@ -3577,7 +3576,7 @@ void PMusrCanvas::HandleDifferenceFourier() fCurrentFourierPhase = fFourier.fPhase; for (UInt_t i=0; iGetTitle()) + "_avg"; fDataAvg.data = new TH1F(name, name, fData[0].data->GetNbinsX(), fData[0].data->GetXaxis()->GetXmin(), fData[0].data->GetXaxis()->GetXmax()); } - if (fData[0].dataFourierRe != 0) { + if (fData[0].dataFourierRe != nullptr) { name = TString(fData[0].dataFourierRe->GetTitle()) + "_avg"; fDataAvg.dataFourierRe = new TH1F(name, name, fData[0].dataFourierRe->GetNbinsX(), fData[0].dataFourierRe->GetXaxis()->GetXmin(), fData[0].dataFourierRe->GetXaxis()->GetXmax()); } - if (fData[0].dataFourierIm != 0) { + if (fData[0].dataFourierIm != nullptr) { name = TString(fData[0].dataFourierIm->GetTitle()) + "_avg"; fDataAvg.dataFourierIm = new TH1F(name, name, fData[0].dataFourierIm->GetNbinsX(), fData[0].dataFourierIm->GetXaxis()->GetXmin(), fData[0].dataFourierIm->GetXaxis()->GetXmax()); } - if (fData[0].dataFourierPwr != 0) { + if (fData[0].dataFourierPwr != nullptr) { name = TString(fData[0].dataFourierPwr->GetTitle()) + "_avg"; fDataAvg.dataFourierPwr = new TH1F(name, name, fData[0].dataFourierPwr->GetNbinsX(), fData[0].dataFourierPwr->GetXaxis()->GetXmin(), fData[0].dataFourierPwr->GetXaxis()->GetXmax()); } - if (fData[0].dataFourierPhase != 0) { + if (fData[0].dataFourierPhase != nullptr) { name = TString(fData[0].dataFourierPhase->GetTitle()) + "_avg"; fDataAvg.dataFourierPhase = new TH1F(name, name, fData[0].dataFourierPhase->GetNbinsX(), fData[0].dataFourierPhase->GetXaxis()->GetXmin(), fData[0].dataFourierPhase->GetXaxis()->GetXmax()); } - if (fData[0].dataFourierPhaseOptReal != 0) { + if (fData[0].dataFourierPhaseOptReal != nullptr) { name = TString(fData[0].dataFourierPhaseOptReal->GetTitle()) + "_avg"; fDataAvg.dataFourierPhaseOptReal = new TH1F(name, name, fData[0].dataFourierPhaseOptReal->GetNbinsX(), fData[0].dataFourierPhaseOptReal->GetXaxis()->GetXmin(), fData[0].dataFourierPhaseOptReal->GetXaxis()->GetXmax()); } - if (fData[0].theory != 0) { + if (fData[0].theory != nullptr) { name = TString(fData[0].theory->GetTitle()) + "_avg"; fDataAvg.theory = new TH1F(name, name, fData[0].theory->GetNbinsX(), fData[0].theory->GetXaxis()->GetXmin(), fData[0].theory->GetXaxis()->GetXmax()); } - if (fData[0].theoryFourierRe != 0) { + if (fData[0].theoryFourierRe != nullptr) { name = TString(fData[0].theoryFourierRe->GetTitle()) + "_avg"; fDataAvg.theoryFourierRe = new TH1F(name, name, fData[0].theoryFourierRe->GetNbinsX(), fData[0].theoryFourierRe->GetXaxis()->GetXmin(), fData[0].theoryFourierRe->GetXaxis()->GetXmax()); } - if (fData[0].theoryFourierIm != 0) { + if (fData[0].theoryFourierIm != nullptr) { name = TString(fData[0].theoryFourierIm->GetTitle()) + "_avg"; fDataAvg.theoryFourierIm = new TH1F(name, name, fData[0].theoryFourierIm->GetNbinsX(), fData[0].theoryFourierIm->GetXaxis()->GetXmin(), fData[0].theoryFourierIm->GetXaxis()->GetXmax()); } - if (fData[0].theoryFourierPwr != 0) { + if (fData[0].theoryFourierPwr != nullptr) { name = TString(fData[0].theoryFourierPwr->GetTitle()) + "_avg"; fDataAvg.theoryFourierPwr = new TH1F(name, name, fData[0].theoryFourierPwr->GetNbinsX(), fData[0].theoryFourierPwr->GetXaxis()->GetXmin(), fData[0].theoryFourierPwr->GetXaxis()->GetXmax()); } - if (fData[0].theoryFourierPhase != 0) { + if (fData[0].theoryFourierPhase != nullptr) { name = TString(fData[0].theoryFourierPhase->GetTitle()) + "_avg"; fDataAvg.theoryFourierPhase = new TH1F(name, name, fData[0].theoryFourierPhase->GetNbinsX(), fData[0].theoryFourierPhase->GetXaxis()->GetXmin(), fData[0].theoryFourierPhase->GetXaxis()->GetXmax()); } - if (fData[0].theoryFourierPhaseOptReal != 0) { + if (fData[0].theoryFourierPhaseOptReal != nullptr) { name = TString(fData[0].theoryFourierPhaseOptReal->GetTitle()) + "_avg"; fDataAvg.theoryFourierPhaseOptReal = new TH1F(name, name, fData[0].theoryFourierPhaseOptReal->GetNbinsX(), fData[0].theoryFourierPhaseOptReal->GetXaxis()->GetXmin(), fData[0].theoryFourierPhaseOptReal->GetXaxis()->GetXmax()); } - if (fData[0].diff != 0) { + if (fData[0].diff != nullptr) { name = TString(fData[0].diff->GetTitle()) + "_avg"; fDataAvg.diff = new TH1F(name, name, fData[0].diff->GetNbinsX(), fData[0].diff->GetXaxis()->GetXmin(), fData[0].diff->GetXaxis()->GetXmax()); } - if (fData[0].diffFourierRe != 0) { + if (fData[0].diffFourierRe != nullptr) { name = TString(fData[0].diffFourierRe->GetTitle()) + "_avg"; fDataAvg.diff = new TH1F(name, name, fData[0].diffFourierRe->GetNbinsX(), fData[0].diffFourierRe->GetXaxis()->GetXmin(), fData[0].diffFourierRe->GetXaxis()->GetXmax()); } - if (fData[0].diffFourierIm != 0) { + if (fData[0].diffFourierIm != nullptr) { name = TString(fData[0].diffFourierIm->GetTitle()) + "_avg"; fDataAvg.diffFourierIm = new TH1F(name, name, fData[0].diffFourierIm->GetNbinsX(), fData[0].diffFourierIm->GetXaxis()->GetXmin(), fData[0].diffFourierIm->GetXaxis()->GetXmax()); } - if (fData[0].diffFourierPwr != 0) { + if (fData[0].diffFourierPwr != nullptr) { name = TString(fData[0].diffFourierPwr->GetTitle()) + "_avg"; fDataAvg.diffFourierPwr = new TH1F(name, name, fData[0].diffFourierPwr->GetNbinsX(), fData[0].diffFourierPwr->GetXaxis()->GetXmin(), fData[0].diffFourierPwr->GetXaxis()->GetXmax()); } - if (fData[0].diffFourierPhase != 0) { + if (fData[0].diffFourierPhase != nullptr) { name = TString(fData[0].diffFourierPhase->GetTitle()) + "_avg"; fDataAvg.diffFourierPhase = new TH1F(name, name, fData[0].diffFourierPhase->GetNbinsX(), fData[0].diffFourierPhase->GetXaxis()->GetXmin(), fData[0].diffFourierPhase->GetXaxis()->GetXmax()); } - if (fData[0].diffFourierPhaseOptReal != 0) { + if (fData[0].diffFourierPhaseOptReal != nullptr) { name = TString(fData[0].diffFourierPhaseOptReal->GetTitle()) + "_avg"; fDataAvg.diffFourierPhaseOptReal = new TH1F(name, name, fData[0].diffFourierPhaseOptReal->GetNbinsX(), fData[0].diffFourierPhaseOptReal->GetXaxis()->GetXmin(), @@ -3837,7 +3836,7 @@ void PMusrCanvas::HandleAverage() // calculate all the average data sets double dval; - if (fDataAvg.data != 0) { + if (fDataAvg.data != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].data->GetMarkerSize()); fDataAvg.data->SetMarkerStyle(fData[0].data->GetMarkerStyle()); } - if (fDataAvg.dataFourierRe != 0) { + if (fDataAvg.dataFourierRe != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].dataFourierRe->GetMarkerSize()); fDataAvg.dataFourierRe->SetMarkerStyle(fData[0].dataFourierRe->GetMarkerStyle()); } - if (fDataAvg.dataFourierIm != 0) { + if (fDataAvg.dataFourierIm != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].dataFourierIm->GetMarkerSize()); fDataAvg.dataFourierIm->SetMarkerStyle(fData[0].dataFourierIm->GetMarkerStyle()); } - if (fDataAvg.dataFourierPwr != 0) { + if (fDataAvg.dataFourierPwr != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].dataFourierPwr->GetMarkerSize()); fDataAvg.dataFourierPwr->SetMarkerStyle(fData[0].dataFourierPwr->GetMarkerStyle()); } - if (fDataAvg.dataFourierPhase != 0) { + if (fDataAvg.dataFourierPhase != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].dataFourierPhase->GetMarkerSize()); fDataAvg.dataFourierPhase->SetMarkerStyle(fData[0].dataFourierPhase->GetMarkerStyle()); } - if (fDataAvg.dataFourierPhaseOptReal != 0) { + if (fDataAvg.dataFourierPhaseOptReal != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].dataFourierPhaseOptReal->GetMarkerSize()); fDataAvg.dataFourierPhaseOptReal->SetMarkerStyle(fData[0].dataFourierPhaseOptReal->GetMarkerStyle()); } - if (fDataAvg.theory != 0) { + if (fDataAvg.theory != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetLineColor(fData[0].theory->GetLineColor()); } - if (fDataAvg.theoryFourierRe != 0) { + if (fDataAvg.theoryFourierRe != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].theoryFourierRe->GetMarkerSize()); fDataAvg.theoryFourierRe->SetMarkerStyle(fData[0].theoryFourierRe->GetMarkerStyle()); } - if (fDataAvg.theoryFourierIm != 0) { + if (fDataAvg.theoryFourierIm != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].theoryFourierIm->GetMarkerSize()); fDataAvg.theoryFourierIm->SetMarkerStyle(fData[0].theoryFourierIm->GetMarkerStyle()); } - if (fDataAvg.theoryFourierPwr != 0) { + if (fDataAvg.theoryFourierPwr != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].theoryFourierPwr->GetMarkerSize()); fDataAvg.theoryFourierPwr->SetMarkerStyle(fData[0].theoryFourierPwr->GetMarkerStyle()); } - if (fDataAvg.theoryFourierPhase != 0) { + if (fDataAvg.theoryFourierPhase != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].theoryFourierPhase->GetMarkerSize()); fDataAvg.theoryFourierPhase->SetMarkerStyle(fData[0].theoryFourierPhase->GetMarkerStyle()); } - if (fDataAvg.theoryFourierPhaseOptReal != 0) { + if (fDataAvg.theoryFourierPhaseOptReal != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].theoryFourierPhaseOptReal->GetMarkerSize()); fDataAvg.theoryFourierPhaseOptReal->SetMarkerStyle(fData[0].theoryFourierPhaseOptReal->GetMarkerStyle()); } - if (fDataAvg.diff != 0) { + if (fDataAvg.diff != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].diff->GetMarkerSize()); fDataAvg.diff->SetMarkerStyle(fData[0].diff->GetMarkerStyle()); } - if (fDataAvg.diffFourierRe != 0) { + if (fDataAvg.diffFourierRe != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].diffFourierRe->GetMarkerSize()); fDataAvg.diffFourierRe->SetMarkerStyle(fData[0].diffFourierRe->GetMarkerStyle()); } - if (fDataAvg.diffFourierIm != 0) { + if (fDataAvg.diffFourierIm != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].diffFourierIm->GetMarkerSize()); fDataAvg.diffFourierIm->SetMarkerStyle(fData[0].diffFourierIm->GetMarkerStyle()); } - if (fDataAvg.diffFourierPwr != 0) { + if (fDataAvg.diffFourierPwr != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].diffFourierPwr->GetMarkerSize()); fDataAvg.diffFourierPwr->SetMarkerStyle(fData[0].diffFourierPwr->GetMarkerStyle()); } - if (fDataAvg.diffFourierPhase != 0) { + if (fDataAvg.diffFourierPhase != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jSetMarkerSize(fData[0].dataFourierPhase->GetMarkerSize()); fDataAvg.diffFourierPhase->SetMarkerStyle(fData[0].dataFourierPhase->GetMarkerStyle()); } - if (fDataAvg.diffFourierPhaseOptReal != 0) { + if (fDataAvg.diffFourierPhaseOptReal != nullptr) { for (Int_t i=0; iGetNbinsX(); i++) { dval = 0.0; for (UInt_t j=0; jDrawLatex(0.1, 0.92, fRRFText->Data()); } } else { // fPlotType == MSR_PLOT_NO_MUSR @@ -4741,11 +4740,11 @@ void PMusrCanvas::PlotData(Bool_t unzoom) // cleanup if previous fMultiGraphData is present if (fMultiGraphData) { delete fMultiGraphData; - fMultiGraphData = 0; + fMultiGraphData = nullptr; } if (fMultiGraphDiff) { delete fMultiGraphDiff; - fMultiGraphDiff = 0; + fMultiGraphDiff = nullptr; } PMsrRunList runs = *fMsrHandler->GetMsrRunList(); @@ -4804,7 +4803,7 @@ void PMusrCanvas::PlotData(Bool_t unzoom) // create fMultiGraphData, and add all data and theory fMultiGraphData = new TMultiGraph(); - assert(fMultiGraphData != 0); + assert(fMultiGraphData != nullptr); // add all data to fMultiGraphData for (UInt_t i=0; iDrawLatex(0.1, 0.92, fRRFText->Data()); } } else { // fPlotType == MSR_PLOT_NON_MUSR @@ -5005,11 +5004,11 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom) // clean up previous fMultiGraphDiff if (fMultiGraphDiff) { delete fMultiGraphDiff; - fMultiGraphDiff = 0; + fMultiGraphDiff = nullptr; } if (fMultiGraphData) { delete fMultiGraphData; - fMultiGraphData = 0; + fMultiGraphData = nullptr; } PMsrRunList runs = *fMsrHandler->GetMsrRunList(); @@ -5019,7 +5018,7 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom) // if fMultiGraphDiff is not present create it and add the diff data fMultiGraphDiff = new TMultiGraph(); - assert(fMultiGraphDiff != 0); + assert(fMultiGraphDiff != nullptr); // get the histo frame x/y range boundaries Double_t dataXmin=0.0, dataXmax=0.0, dataYmin=0.0, dataYmax=0.0; @@ -5167,7 +5166,7 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5247,7 +5246,7 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5340,7 +5339,7 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5426,7 +5425,7 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 0.95*ymin, xmax, 1.05*ymax); @@ -5504,7 +5503,7 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5581,7 +5580,7 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5625,7 +5624,7 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) } // check if RRF and if yes show a label - if ((fRRFText != 0) && (fRRFLatexText != 0)) { + if ((fRRFText != nullptr) && (fRRFLatexText != nullptr)) { fRRFLatexText->DrawLatex(0.1, 0.92, fRRFText->Data()); } @@ -5702,7 +5701,7 @@ void PMusrCanvas::PlotFourierDifference(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5757,7 +5756,7 @@ void PMusrCanvas::PlotFourierDifference(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5820,7 +5819,7 @@ void PMusrCanvas::PlotFourierDifference(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5878,7 +5877,7 @@ void PMusrCanvas::PlotFourierDifference(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 0.95*ymin, xmax, 1.05*ymax); @@ -5931,7 +5930,7 @@ void PMusrCanvas::PlotFourierDifference(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -5986,7 +5985,7 @@ void PMusrCanvas::PlotFourierDifference(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); @@ -6017,7 +6016,7 @@ void PMusrCanvas::PlotFourierDifference(Bool_t unzoom) } // check if RRF and if yes show a label - if ((fRRFText != 0) && (fRRFLatexText != 0)) { + if ((fRRFText != nullptr) && (fRRFLatexText != nullptr)) { fRRFLatexText->DrawLatex(0.1, 0.92, fRRFText->Data()); } @@ -6040,7 +6039,7 @@ void PMusrCanvas::PlotFourierPhaseValue(Bool_t unzoom) // check if phase TLatex object is present if (fCurrentFourierPhaseText) { delete fCurrentFourierPhaseText; - fCurrentFourierPhaseText = 0; + fCurrentFourierPhaseText = nullptr; } double x, y; @@ -6203,7 +6202,7 @@ void PMusrCanvas::PlotAverage(Bool_t unzoom) // delete old fHistoFrame if present if (fHistoFrame) { delete fHistoFrame; - fHistoFrame = 0; + fHistoFrame = nullptr; } fHistoFrame = fDataTheoryPad->DrawFrame(xmin, ymin, xmax, ymax); @@ -6278,7 +6277,7 @@ void PMusrCanvas::PlotAverage(Bool_t unzoom) } // check if RRF and if yes show a label - if ((fRRFText != 0) && (fRRFLatexText != 0)) { + if ((fRRFText != nullptr) && (fRRFLatexText != nullptr)) { fRRFLatexText->DrawLatex(0.1, 0.92, fRRFText->Data()); } @@ -6308,7 +6307,7 @@ void PMusrCanvas::IncrementFourierPhase() PlotFourierPhaseValue(); for (UInt_t i=0; iGetNbinsX(); j++) { // loop over a fourier data set // calculate new fourier data set value re = fData[i].dataFourierRe->GetBinContent(j) * cp + fData[i].dataFourierIm->GetBinContent(j) * sp; @@ -6318,7 +6317,7 @@ void PMusrCanvas::IncrementFourierPhase() fData[i].dataFourierIm->SetBinContent(j, im); } } - if ((fData[i].theoryFourierRe != 0) && (fData[i].theoryFourierIm != 0)) { + if ((fData[i].theoryFourierRe != nullptr) && (fData[i].theoryFourierIm != nullptr)) { for (Int_t j=0; jGetNbinsX(); j++) { // loop over a fourier data set // calculate new fourier data set value re = fData[i].theoryFourierRe->GetBinContent(j) * cp + fData[i].theoryFourierIm->GetBinContent(j) * sp; @@ -6328,7 +6327,7 @@ void PMusrCanvas::IncrementFourierPhase() fData[i].theoryFourierIm->SetBinContent(j, im); } } - if ((fData[i].diffFourierRe != 0) && (fData[i].diffFourierIm != 0)) { + if ((fData[i].diffFourierRe != nullptr) && (fData[i].diffFourierIm != nullptr)) { for (Int_t j=0; jGetNbinsX(); j++) { // loop over a fourier diff data set // calculate new fourier diff data set value re = fData[i].diffFourierRe->GetBinContent(j) * cp + fData[i].diffFourierIm->GetBinContent(j) * sp; @@ -6361,7 +6360,7 @@ void PMusrCanvas::DecrementFourierPhase() PlotFourierPhaseValue(); for (UInt_t i=0; iGetNbinsX(); j++) { // loop over a fourier data set // calculate new fourier data set value re = fData[i].dataFourierRe->GetBinContent(j) * cp - fData[i].dataFourierIm->GetBinContent(j) * sp; @@ -6371,7 +6370,7 @@ void PMusrCanvas::DecrementFourierPhase() fData[i].dataFourierIm->SetBinContent(j, im); } } - if ((fData[i].theoryFourierRe != 0) && (fData[i].theoryFourierIm != 0)) { + if ((fData[i].theoryFourierRe != nullptr) && (fData[i].theoryFourierIm != nullptr)) { for (Int_t j=0; jGetNbinsX(); j++) { // loop over a fourier data set // calculate new fourier data set value re = fData[i].theoryFourierRe->GetBinContent(j) * cp - fData[i].theoryFourierIm->GetBinContent(j) * sp; @@ -6381,7 +6380,7 @@ void PMusrCanvas::DecrementFourierPhase() fData[i].theoryFourierIm->SetBinContent(j, im); } } - if ((fData[i].diffFourierRe != 0) && (fData[i].diffFourierIm != 0)) { + if ((fData[i].diffFourierRe != nullptr) && (fData[i].diffFourierIm != nullptr)) { for (Int_t j=0; jGetNbinsX(); j++) { // loop over a fourier diff data set // calculate new fourier diff data set value re = fData[i].diffFourierRe->GetBinContent(j) * cp - fData[i].diffFourierIm->GetBinContent(j) * sp; @@ -6415,13 +6414,13 @@ Bool_t PMusrCanvas::IsScaleN0AndBkg() PMsrLines *cmd = fMsrHandler->GetMsrCommands(); for (UInt_t i=0; isize(); i++) { if (cmd->at(i).fLine.Contains("SCALE_N0_BKG", TString::kIgnoreCase)) { - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; tokens = cmd->at(i).fLine.Tokenize(" \t"); if (tokens->GetEntries() != 2) { - cerr << endl << ">> PRunSingleHisto::IsScaleN0AndBkg(): **WARNING** Found uncorrect 'SCALE_N0_BKG' command, will ignore it."; - cerr << endl << ">> Allowed commands: SCALE_N0_BKG TRUE | FALSE" << endl; + std::cerr << std::endl << ">> PRunSingleHisto::IsScaleN0AndBkg(): **WARNING** Found uncorrect 'SCALE_N0_BKG' command, will ignore it."; + std::cerr << std::endl << ">> Allowed commands: SCALE_N0_BKG TRUE | FALSE" << std::endl; return willScale; } ostr = dynamic_cast(tokens->At(1)); @@ -6534,7 +6533,7 @@ UInt_t PMusrCanvas::GetNeededAccuracy(PMsrParamStructure param) */ Double_t PMusrCanvas::GetInterpolatedValue(TH1F* histo, Double_t xVal) { - if (histo == 0) + if (histo == nullptr) return 0.0; Int_t idx = histo->FindBin(xVal); diff --git a/src/classes/PMusrT0.cpp b/src/classes/PMusrT0.cpp index c13414fc..8d8504ed 100644 --- a/src/classes/PMusrT0.cpp +++ b/src/classes/PMusrT0.cpp @@ -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 #include -using namespace std; #include #include @@ -106,7 +105,7 @@ void PMusrT0Data::InitData() PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx) { if ((idx < 0) || (idx >= static_cast(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(fDataRange[0]), 0.0, static_cast(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(fDataRange[1]), 0.0, static_cast(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(fBkgRange[0]), 0.0, static_cast(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(fBkgRange[1]), 0.0, static_cast(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(t0Bin), 0.0, static_cast(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; diff --git a/src/classes/PPrepFourier.cpp b/src/classes/PPrepFourier.cpp index a28bc29f..4bfbc275 100644 --- a/src/classes/PPrepFourier.cpp +++ b/src/classes/PPrepFourier.cpp @@ -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= (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(fRawData[i].rawData.size())) || (fBkgRange[1] >= static_cast(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; jCreates the requested TH1F objects and returns them. The ownership is with * the caller. */ -vector PPrepFourier::GetData() +std::vector PPrepFourier::GetData() { - vector data; + std::vector data; data.resize(fData.size()); // if not data are present, just return an empty vector @@ -368,12 +368,12 @@ vector PPrepFourier::GetData() // time range given, hence calculate the proper size if (start != -1.0) { - size = (UInt_t)((end-start)/dt); + size = static_cast((end-start)/dt); if (start >= 0.0) { - startIdx = (UInt_t)(start/dt)+1; - endIdx = (UInt_t)(end/dt)+1; + startIdx = static_cast(start/dt)+1; + endIdx = static_cast(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(end/dt)+1; } } @@ -410,10 +410,10 @@ vector 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((end-start)/dt); if (start >= 0.0) { - startIdx = (UInt_t)(start/dt)+1; - endIdx = (UInt_t)(end/dt)+1; + startIdx = static_cast(start/dt)+1; + endIdx = static_cast(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(end/dt)+1; } } diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 8290fd90..2616ea1b 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -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 * @@ -38,7 +38,6 @@ #include #include -using namespace std; #include #include @@ -93,9 +92,9 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn fPacking = fMsrInfo->GetMsrGlobal()->GetPacking(); } if (fPacking == -1) { // this should NOT happen, somethin is severely wrong - cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **SEVERE ERROR**: Couldn't find any packing information!"; - cerr << endl << ">> This is very bad :-(, will quit ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **SEVERE ERROR**: Couldn't find any packing information!"; + std::cerr << std::endl << ">> This is very bad :-(, will quit ..."; + std::cerr << std::endl; fValid = false; return; } @@ -106,16 +105,16 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn // check if alpha is given if (fRunInfo->GetAlphaParamNo() == -1) { // no alpha given - cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!"; + std::cerr << std::endl; fValid = false; return; } // check if alpha parameter is within proper bounds - if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > (Int_t)param->size())) { - cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo(); - cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; - cerr << endl; + if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast(param->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; + std::cerr << std::endl; fValid = false; return; } @@ -129,10 +128,10 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn Bool_t betaFixedToOne = false; if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1 betaFixedToOne = true; - } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > (Int_t)param->size())) { // check if beta parameter is within proper bounds - cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); - cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; - cerr << endl; + } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > static_cast(param->size()))) { // check if beta parameter is within proper bounds + std::cerr << std::endl << ">> PRunAsymmetry::PRunAsymmetry(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; + std::cerr << std::endl; fValid = false; return; } else { // check if beta is fixed @@ -210,7 +209,7 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i(i)*fData.GetDataTimeStep(); switch (fAlphaBetaTag) { case 1: // alpha == 1, beta == 1 asymFcnValue = fTheory->Func(time, par, fFuncValues); @@ -268,7 +267,7 @@ Double_t PRunAsymmetry::CalcChiSquareExpected(const std::vector& par) */ Double_t PRunAsymmetry::CalcMaxLikelihood(const std::vector& par) { - cout << endl << "PRunAsymmetry::CalcMaxLikelihood(): not implemented yet ..." << endl; + std::cout << std::endl << "PRunAsymmetry::CalcMaxLikelihood(): not implemented yet ..." << std::endl; return 1.0; } @@ -304,8 +303,8 @@ UInt_t PRunAsymmetry::GetNoOfFitBins() */ void PRunAsymmetry::SetFitRangeBin(const TString fitRange) { - TObjArray *tok = 0; - TObjString *ostr = 0; + TObjArray *tok = nullptr; + TObjString *ostr = nullptr; TString str; Ssiz_t idx = -1; Int_t offset = 0; @@ -314,7 +313,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange) if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1 // handle fgb+n0 entry - ostr = (TObjString*) tok->At(1); + ostr = dynamic_cast(tok->At(1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -326,7 +325,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(2); + ostr = dynamic_cast(tok->At(2)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -340,11 +339,11 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange) Int_t pos = 2*(fRunNo+1)-1; if (pos + 1 >= tok->GetEntries()) { - cerr << endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } else { // handle fgb+n0 entry - ostr = (TObjString*) tok->At(pos); + ostr = static_cast(tok->At(pos)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -356,7 +355,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(pos+1); + ostr = static_cast(tok->At(pos+1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -368,8 +367,8 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange) fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution; } } else { // error - cerr << endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } // clean up @@ -395,7 +394,7 @@ void PRunAsymmetry::CalcNoOfFitBins() fEndTimeBin = fData.GetValue()->size(); if (fEndTimeBin > fStartTimeBin) - fNoOfFitBins = fEndTimeBin - fStartTimeBin; + fNoOfFitBins = static_cast(fEndTimeBin - fStartTimeBin); else fNoOfFitBins = 0; } @@ -424,7 +423,7 @@ void PRunAsymmetry::CalcTheory() Double_t a, b, f; Double_t time; for (UInt_t i=0; isize(); i++) { - time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep(); + time = fData.GetDataTimeStart() + static_cast(i)*fData.GetDataTimeStep(); switch (fAlphaBetaTag) { case 1: // alpha == 1, beta == 1 asymFcnValue = fTheory->Func(time, par, fFuncValues); @@ -487,8 +486,8 @@ Bool_t PRunAsymmetry::PrepareData() // get the correct run PRawRunData *runData = fRawData->GetRunData(*(fRunInfo->GetRunName())); if (!runData) { // run not found - cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; + std::cerr << std::endl; return false; } @@ -499,10 +498,10 @@ Bool_t PRunAsymmetry::PrepareData() forwardHistoNo.push_back(fRunInfo->GetForwardHistoNo(i)); if (!runData->IsPresent(forwardHistoNo[i])) { - cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?"; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?"; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; // clean up forwardHistoNo.clear(); backwardHistoNo.clear(); @@ -513,10 +512,10 @@ Bool_t PRunAsymmetry::PrepareData() backwardHistoNo.push_back(fRunInfo->GetBackwardHistoNo(i)); if (!runData->IsPresent(backwardHistoNo[i])) { - cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?"; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?"; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; // clean up forwardHistoNo.clear(); backwardHistoNo.clear(); @@ -524,10 +523,10 @@ Bool_t PRunAsymmetry::PrepareData() } } if (forwardHistoNo.size() != backwardHistoNo.size()) { - cerr << endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> # of forward histograms different from # of backward histograms."; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms."; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; // clean up forwardHistoNo.clear(); backwardHistoNo.clear(); @@ -536,8 +535,8 @@ Bool_t PRunAsymmetry::PrepareData() // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; - cout.precision(10); - cout << endl << ">> PRunAsymmetry::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl; + std::cout.precision(10); + std::cout << std::endl << ">> PRunAsymmetry::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl; // get all the proper t0's and addt0's for the current RUN block if (!GetProperT0(runData, globalBlock, forwardHistoNo, backwardHistoNo)) { @@ -545,7 +544,7 @@ Bool_t PRunAsymmetry::PrepareData() } // keep the histo of each group at this point (addruns handled below) - vector forward, backward; + std::vector forward, backward; forward.resize(forwardHistoNo.size()); // resize to number of groups backward.resize(backwardHistoNo.size()); // resize to numer of groups for (UInt_t i=0; iGetRunNameSize(); i++) { // get run to be added to the main one addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i))); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -574,8 +573,9 @@ Bool_t PRunAsymmetry::PrepareData() addRunSize = addRunData->GetDataBin(forwardHistoNo[k])->size(); for (UInt_t j=0; jGetDataBin(forwardHistoNo[k])->size(); j++) { // loop over the bin indices // make sure that the index stays in the proper range - if (((Int_t)j+(Int_t)fAddT0s[i-1][2*k]-(Int_t)fT0s[2*k] >= 0) && (j+(Int_t)fAddT0s[i-1][2*k]-(Int_t)fT0s[2*k] < addRunSize)) { - forward[k][j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j+(Int_t)fAddT0s[i-1][2*k]-(Int_t)fT0s[2*k]); + if ((static_cast(j)+static_cast(fAddT0s[i-1][2*k])-static_cast(fT0s[2*k]) >= 0) && + (j+static_cast(fAddT0s[i-1][2*k])-static_cast(fT0s[2*k]) < addRunSize)) { + forward[k][j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j+static_cast(fAddT0s[i-1][2*k])-static_cast(fT0s[2*k])); } } } @@ -585,8 +585,9 @@ Bool_t PRunAsymmetry::PrepareData() addRunSize = addRunData->GetDataBin(backwardHistoNo[k])->size(); for (UInt_t j=0; jGetDataBin(backwardHistoNo[k])->size(); j++) { // loop over the bin indices // make sure that the index stays in the proper range - if (((Int_t)j+(Int_t)fAddT0s[i-1][2*k+1]-(Int_t)fT0s[2*k+1] >= 0) && (j+(Int_t)fAddT0s[i-1][2*k+1]-(Int_t)fT0s[2*k+1] < addRunSize)) { - backward[k][j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j+(Int_t)fAddT0s[i-1][2*k+1]-(Int_t)fT0s[2*k+1]); + if ((static_cast(j)+static_cast(fAddT0s[i-1][2*k+1])-static_cast(fT0s[2*k+1]) >= 0) && + (j+static_cast(fAddT0s[i-1][2*k+1])-static_cast(fT0s[2*k+1]) < addRunSize)) { + backward[k][j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j+static_cast(fAddT0s[i-1][2*k+1])-static_cast(fT0s[2*k+1])); } } } @@ -606,7 +607,7 @@ Bool_t PRunAsymmetry::PrepareData() for (UInt_t j=0; jGetDataBin(forwardHistoNo[i])->size(); j++) { // loop over the bin indices // make sure that the index stays within proper range if ((j+fT0s[2*i]-fT0s[0] >= 0) && (j+fT0s[2*i]-fT0s[0] < runData->GetDataBin(forwardHistoNo[i])->size())) { - fForward[j] += forward[i][j+(Int_t)fT0s[2*i]-(Int_t)fT0s[0]]; + fForward[j] += forward[i][j+static_cast(fT0s[2*i])-static_cast(fT0s[0])]; } } } @@ -616,7 +617,7 @@ Bool_t PRunAsymmetry::PrepareData() for (UInt_t j=0; jGetDataBin(backwardHistoNo[i])->size(); j++) { // loop over the bin indices // make sure that the index stays within proper range if ((j+fT0s[2*i+1]-fT0s[1] >= 0) && (j+fT0s[2*i+1]-fT0s[1] < runData->GetDataBin(backwardHistoNo[i])->size())) { - fBackward[j] += backward[i][j+(Int_t)fT0s[2*i+1]-(Int_t)fT0s[1]]; + fBackward[j] += backward[i][j+static_cast(fT0s[2*i+1])-static_cast(fT0s[1])]; } } } @@ -631,12 +632,12 @@ Bool_t PRunAsymmetry::PrepareData() fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.6), 1); fRunInfo->SetBkgRange(static_cast(fT0s[1]*0.1), 2); fRunInfo->SetBkgRange(static_cast(fT0s[1]*0.6), 3); - cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING** Neither fix background nor background bins are given!"; - cerr << endl << ">> Will try the following:"; - cerr << endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); - cerr << endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3); - cerr << endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **WARNING** Neither fix background nor background bins are given!"; + std::cerr << std::endl << ">> Will try the following:"; + std::cerr << std::endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); + std::cerr << std::endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; + std::cerr << std::endl; if (!SubtractEstimatedBkg()) return false; } @@ -761,7 +762,7 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg() Int_t end[2] = {fRunInfo->GetBkgRange(1), fRunInfo->GetBkgRange(3)}; for (UInt_t i=0; i<2; i++) { if (end[i] < start[i]) { - cout << endl << "PRunAsymmetry::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!"; + std::cout << std::endl << "PRunAsymmetry::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!"; UInt_t keep = end[i]; end[i] = start[i]; start[i] = keep; @@ -771,11 +772,11 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg() // calculate proper background range for (UInt_t i=0; i<2; i++) { if (beamPeriod != 0.0) { - Double_t timeBkg = (Double_t)(end[i]-start[i])*(fTimeResolution*fPacking); // length of the background intervall in time - UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall + Double_t timeBkg = static_cast(end[i]-start[i])*(fTimeResolution*fPacking); // length of the background intervall in time + UInt_t fullCycles = static_cast(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall // correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce - end[i] = start[i] + (UInt_t) ((fullCycles*beamPeriod)/(fTimeResolution*fPacking)); - cout << "PRunAsymmetry::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << endl; + end[i] = start[i] + static_cast((fullCycles*beamPeriod)/(fTimeResolution*fPacking)); + std::cout << "PRunAsymmetry::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << std::endl; if (end[i] == start[i]) end[i] = fRunInfo->GetBkgRange(2*i+1); } @@ -784,18 +785,18 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg() // check if start is within histogram bounds if ((start[0] < 0) || (start[0] >= fForward.size()) || (start[1] < 0) || (start[1] >= fBackward.size())) { - cerr << endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; - cerr << endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ")."; + std::cerr << std::endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; + std::cerr << std::endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ")."; return false; } // check if end is within histogram bounds if ((end[0] < 0) || (end[0] >= fForward.size()) || (end[1] < 0) || (end[1] >= fBackward.size())) { - cerr << endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; - cerr << endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ")."; + std::cerr << std::endl << ">> PRunAsymmetry::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; + std::cerr << std::endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ")."; return false; } @@ -808,14 +809,14 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg() bkg[0] += fForward[i]; errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1); bkg[0] /= static_cast(end[0] - start[0] + 1); - cout << endl << ">> estimated forward histo background: " << bkg[0]; + std::cout << std::endl << ">> estimated forward histo background: " << bkg[0]; // backward for (UInt_t i=start[1]; i<=end[1]; i++) bkg[1] += fBackward[i]; errBkg[1] = TMath::Sqrt(bkg[1])/(end[1] - start[1] + 1); bkg[1] /= static_cast(end[1] - start[1] + 1); - cout << endl << ">> estimated backward histo background: " << bkg[1] << endl; + std::cout << std::endl << ">> estimated backward histo background: " << bkg[1] << std::endl; // correct error for forward, backward Double_t errVal = 0.0; @@ -925,8 +926,8 @@ Bool_t PRunAsymmetry::PrepareFitData() Double_t f, b, ef, eb; // fill data time start, and step // data start at data_start-t0 shifted by (pack-1)/2 - fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-fT0s[0]+(Double_t)(fPacking-1)/2.0)); - fData.SetDataTimeStep(fTimeResolution*(Double_t)fPacking); + fData.SetDataTimeStart(fTimeResolution*(static_cast(fGoodBins[0])-fT0s[0]+static_cast(fPacking-1)/2.0)); + fData.SetDataTimeStep(fTimeResolution*static_cast(fPacking)); for (UInt_t i=0; iat(i); @@ -997,7 +998,7 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) // first get start data, end data, and t0 Int_t start[2] = {fGoodBins[0], fGoodBins[2]}; Int_t end[2] = {fGoodBins[1], fGoodBins[3]}; - Int_t t0[2] = {(Int_t)fT0s[0], (Int_t)fT0s[1]}; + Int_t t0[2] = {static_cast(fT0s[0]), static_cast(fT0s[1])}; // check if the data ranges and t0's between forward/backward are compatible Int_t fgb[2]; @@ -1005,13 +1006,13 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) { fgb[0] = start[0]; fgb[1] = t0[1] + start[0]-t0[0]; - cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift backward fgb from "; - cerr << start[1] << " to " << fgb[1] << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift backward fgb from "; + std::cerr << start[1] << " to " << fgb[1] << std::endl; } else { fgb[0] = t0[0] + start[1]-t0[1]; fgb[1] = start[1]; - cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift forward fgb from "; - cerr << start[0] << " to " << fgb[0] << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** needed to shift forward fgb from "; + std::cerr << start[0] << " to " << fgb[0] << std::endl; } } else { // fgb aligning is correct fgb[0] = start[0]; @@ -1044,21 +1045,21 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) start[i] = keep; } // 2nd check if start is within proper bounds - if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start[i] < 0) || (start[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds - if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; + if ((end[i] < 0) || (end[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** end data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 4th check if t0 is within proper bounds - if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!"; - cerr << endl; + if ((t0[i] < 0) || (t0[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -1127,8 +1128,8 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) Double_t f, b, ef, eb, alpha = 1.0, beta = 1.0; // set data time start, and step // data start at data_start-t0 - fData.SetDataTimeStart(fTimeResolution*((Double_t)start[0]-t0[0]+(Double_t)(packing-1)/2.0)); - fData.SetDataTimeStep(fTimeResolution*(Double_t)packing); + fData.SetDataTimeStart(fTimeResolution*(static_cast(start[0])-t0[0]+static_cast(packing-1)/2.0)); + fData.SetDataTimeStep(fTimeResolution*static_cast(packing)); // get the proper alpha and beta switch (fAlphaBetaTag) { @@ -1192,12 +1193,12 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) Double_t factor = 1.0; if (fData.GetValue()->size() * 10 > runData->GetDataBin(histoNo[0])->size()) { size = fData.GetValue()->size() * 10; - factor = (Double_t)runData->GetDataBin(histoNo[0])->size() / (Double_t)size; + factor = static_cast(runData->GetDataBin(histoNo[0])->size()) / static_cast(size); } fData.SetTheoryTimeStart(fData.GetDataTimeStart()); fData.SetTheoryTimeStep(fTimeResolution*factor); for (UInt_t i=0; i(i)*fTimeResolution*factor; value = fTheory->Func(time, par, fFuncValues); if (fabs(value) > 10.0) { // dirty hack needs to be fixed!! value = 0.0; @@ -1244,7 +1245,7 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2] // first get start data, end data, and t0 Int_t start[2] = {fGoodBins[0], fGoodBins[2]}; Int_t end[2] = {fGoodBins[1], fGoodBins[3]}; - Int_t t0[2] = {(Int_t)fT0s[0], (Int_t)fT0s[1]}; + Int_t t0[2] = {static_cast(fT0s[0]), static_cast(fT0s[1])}; UInt_t packing = fMsrInfo->GetMsrPlotList()->at(0).fRRFPacking; // check if the data ranges and t0's between forward/backward are compatible @@ -1253,13 +1254,13 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2] if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) { fgb[0] = start[0]; fgb[1] = t0[1] + start[0]-t0[0]; - cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift backward fgb from "; - cerr << start[1] << " to " << fgb[1] << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift backward fgb from "; + std::cerr << start[1] << " to " << fgb[1] << std::endl; } else { fgb[0] = t0[0] + start[1]-t0[1]; fgb[1] = start[1]; - cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift forward fgb from "; - cerr << start[1] << " to " << fgb[0] << endl; + std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **WARNING** needed to shift forward fgb from "; + std::cerr << start[1] << " to " << fgb[0] << std::endl; } } else { // fgb aligning is correct fgb[0] = start[0]; @@ -1292,21 +1293,21 @@ Bool_t PRunAsymmetry::PrepareRRFViewData(PRawRunData* runData, UInt_t histoNo[2] start[i] = keep; } // 2nd check if start is within proper bounds - if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start[i] < 0) || (start[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds - if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; + if ((end[i] < 0) || (end[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** end data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 4th check if t0 is within proper bounds - if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** t0 data bin doesn't make any sense!"; - cerr << endl; + if ((t0[i] < 0) || (t0[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PrepareRRFViewData(): **ERROR** t0 data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -1582,11 +1583,11 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB fT0s[2*i] = runData->GetT0BinEstimated(forwardHistoNo[i]); fRunInfo->SetT0Bin(fT0s[2*i], 2*i); - cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } for (UInt_t i=0; iGetT0BinEstimated(backwardHistoNo[i]); fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1); - cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data(); + std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t i=0; i (Int_t)runData->GetDataBin(forwardHistoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!"; - cerr << endl << ">> forwardHistoNo " << forwardHistoNo[i]; - cerr << endl; + if ((fT0s[2*i] < 0) || (fT0s[2*i] > static_cast(runData->GetDataBin(forwardHistoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!"; + std::cerr << std::endl << ">> forwardHistoNo " << forwardHistoNo[i]; + std::cerr << std::endl; return false; } - if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > (Int_t)runData->GetDataBin(backwardHistoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!"; - cerr << endl << ">> backwardHistoNo " << backwardHistoNo[i]; - cerr << endl; + if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > static_cast(runData->GetDataBin(backwardHistoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!"; + std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i]; + std::cerr << std::endl; return false; } } @@ -1626,8 +1627,8 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB // get run to be added to the main one addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i))); if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -1666,11 +1667,11 @@ Bool_t PRunAsymmetry::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalB fAddT0s[i-1][2*j] = addRunData->GetT0BinEstimated(forwardHistoNo[j]); fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j], i-1, 2*j); - cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } for (UInt_t j=0; jGetT0BinEstimated(backwardHistoNo[j]); fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j+1], i-1, 2*j+1); - cerr << endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); + std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } } @@ -1727,36 +1728,36 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2] } Double_t t0[2] = {fT0s[0], fT0s[1]}; - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); // needed in case first good bin is not given, default = 10ns + Int_t offset = static_cast((10.0e-3/fTimeResolution)); // needed in case first good bin is not given, default = 10ns // check if data range has been provided, and if not try to estimate them if (start[0] < 0) { - start[0] = (Int_t)t0[0]+offset; + start[0] = static_cast(t0[0])+offset; fRunInfo->SetDataRange(start[0], 0); - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (start[1] < 0) { - start[1] = (Int_t)t0[1]+offset; + start[1] = static_cast(t0[1])+offset; fRunInfo->SetDataRange(start[1], 2); - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (end[0] < 0) { end[0] = runData->GetDataBin(histoNo[0])->size(); fRunInfo->SetDataRange(end[0], 1); - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (end[1] < 0) { end[1] = runData->GetDataBin(histoNo[1])->size(); fRunInfo->SetDataRange(end[1], 3); - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start, end, and t0 make any sense @@ -1768,27 +1769,27 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2] start[i] = keep; } // 2nd check if start is within proper bounds - if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start[i] < 0) || (start[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds if (end[i] < 0) { - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } - if (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size()) { - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ")."; - cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl; - cerr << endl; - end[i] = (Int_t)runData->GetDataBin(histoNo[i])->size()-1; + if (end[i] > static_cast(runData->GetDataBin(histoNo[i])->size())) { + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << static_cast(runData->GetDataBin(histoNo[i])->size()) << ")."; + std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl; + std::cerr << std::endl; + end[i] = static_cast(runData->GetDataBin(histoNo[i])->size())-1; } // 4th check if t0 is within proper bounds - if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!"; - cerr << endl; + if ((t0[i] < 0) || (t0[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -1797,18 +1798,18 @@ Bool_t PRunAsymmetry::GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2] if (fabs(static_cast(start[0])-t0[0]) > fabs(static_cast(start[1])-t0[1])){ start[1] = static_cast(t0[1] + static_cast(start[0]) - t0[0]); end[1] = static_cast(t0[1] + static_cast(end[0]) - t0[0]); - cerr << endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift backward data range."; - cerr << endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3); - cerr << endl << ">> used : " << start[1] << ", " << end[1]; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift backward data range."; + std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3); + std::cerr << std::endl << ">> used : " << start[1] << ", " << end[1]; + std::cerr << std::endl; } if (fabs(static_cast(start[0])-t0[0]) < fabs(static_cast(start[1])-t0[1])){ start[0] = static_cast(t0[0] + static_cast(start[1]) - t0[1]); end[0] = static_cast(t0[0] + static_cast(end[1]) - t0[1]); - cerr << endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift forward data range."; - cerr << endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1); - cerr << endl << ">> used : " << start[0] << ", " << end[0]; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetry::GetProperDataRange **WARNING** needed to shift forward data range."; + std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1); + std::cerr << std::endl << ">> used : " << start[0] << ", " << end[0]; + std::cerr << std::endl; } // keep good bins for potential latter use @@ -1863,7 +1864,7 @@ void PRunAsymmetry::GetProperFitRange(PMsrGlobalBlock *globalBlock) if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) { fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt - cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; - cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; + std::cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl; + std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl; } } diff --git a/src/classes/PRunAsymmetryRRF.cpp b/src/classes/PRunAsymmetryRRF.cpp index 03e8ec9b..64d2fdc2 100644 --- a/src/classes/PRunAsymmetryRRF.cpp +++ b/src/classes/PRunAsymmetryRRF.cpp @@ -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 * @@ -39,7 +39,6 @@ #include #include -using namespace std; #include #include @@ -85,9 +84,9 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat fRRFPacking = fMsrInfo->GetMsrGlobal()->GetRRFPacking(); if (fRRFPacking == -1) { // this should NOT happen, somethin is severely wrong - cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **SEVERE ERROR**: Couldn't find any RRF packing information!"; - cerr << endl << ">> This is very bad :-(, will quit ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **SEVERE ERROR**: Couldn't find any RRF packing information!"; + std::cerr << std::endl << ">> This is very bad :-(, will quit ..."; + std::cerr << std::endl; fValid = false; return; } @@ -98,16 +97,16 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat // check if alpha is given if (fRunInfo->GetAlphaParamNo() == -1) { // no alpha given - cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** no alpha parameter given! This is needed for an asymmetry fit!"; + std::cerr << std::endl; fValid = false; return; } // check if alpha parameter is within proper bounds - if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > (Int_t)param->size())) { - cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo(); - cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; - cerr << endl; + if ((fRunInfo->GetAlphaParamNo() < 0) || (fRunInfo->GetAlphaParamNo() > static_cast(param->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** alpha parameter no = " << fRunInfo->GetAlphaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; + std::cerr << std::endl; fValid = false; return; } @@ -121,10 +120,10 @@ PRunAsymmetryRRF::PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawDat Bool_t betaFixedToOne = false; if (fRunInfo->GetBetaParamNo() == -1) { // no beta given hence assuming beta == 1 betaFixedToOne = true; - } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > (Int_t)param->size())) { // check if beta parameter is within proper bounds - cerr << endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); - cerr << endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; - cerr << endl; + } else if ((fRunInfo->GetBetaParamNo() < 0) || (fRunInfo->GetBetaParamNo() > static_cast(param->size()))) { // check if beta parameter is within proper bounds + std::cerr << std::endl << ">> PRunAsymmetryRRF::PRunAsymmetryRRF(): **ERROR** beta parameter no = " << fRunInfo->GetBetaParamNo(); + std::cerr << std::endl << ">> This is out of bound, since there are only " << param->size() << " parameters."; + std::cerr << std::endl; fValid = false; return; } else { // check if beta is fixed @@ -202,7 +201,7 @@ Double_t PRunAsymmetryRRF::CalcChiSquare(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i(i)*fData.GetDataTimeStep(); switch (fAlphaBetaTag) { case 1: // alpha == 1, beta == 1 asymFcnValue = fTheory->Func(time, par, fFuncValues); @@ -260,7 +259,7 @@ Double_t PRunAsymmetryRRF::CalcChiSquareExpected(const std::vector& pa */ Double_t PRunAsymmetryRRF::CalcMaxLikelihood(const std::vector& par) { - cout << endl << "PRunAsymmetryRRF::CalcMaxLikelihood(): not implemented yet ..." << endl; + std::cout << std::endl << "PRunAsymmetryRRF::CalcMaxLikelihood(): not implemented yet ..." << std::endl; return 1.0; } @@ -296,8 +295,8 @@ UInt_t PRunAsymmetryRRF::GetNoOfFitBins() */ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange) { - TObjArray *tok = 0; - TObjString *ostr = 0; + TObjArray *tok = nullptr; + TObjString *ostr = nullptr; TString str; Ssiz_t idx = -1; Int_t offset = 0; @@ -306,7 +305,7 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange) if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1 // handle fgb+n0 entry - ostr = (TObjString*) tok->At(1); + ostr = static_cast(tok->At(1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -318,7 +317,7 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(2); + ostr = static_cast(tok->At(2)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -332,11 +331,11 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange) Int_t pos = 2*(fRunNo+1)-1; if (pos + 1 >= tok->GetEntries()) { - cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } else { // handle fgb+n0 entry - ostr = (TObjString*) tok->At(pos); + ostr = static_cast(tok->At(pos)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -348,7 +347,7 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(pos+1); + ostr = static_cast(tok->At(pos+1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -360,8 +359,8 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange) fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution; } } else { // error - cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } // clean up @@ -416,7 +415,7 @@ void PRunAsymmetryRRF::CalcTheory() Double_t a, b, f; Double_t time; for (UInt_t i=0; isize(); i++) { - time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep(); + time = fData.GetDataTimeStart() + static_cast(i)*fData.GetDataTimeStep(); switch (fAlphaBetaTag) { case 1: // alpha == 1, beta == 1 asymFcnValue = fTheory->Func(time, par, fFuncValues); @@ -479,8 +478,8 @@ Bool_t PRunAsymmetryRRF::PrepareData() // get the correct run PRawRunData *runData = fRawData->GetRunData(*(fRunInfo->GetRunName())); if (!runData) { // run not found - cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; + std::cerr << std::endl; return false; } @@ -491,10 +490,10 @@ Bool_t PRunAsymmetryRRF::PrepareData() forwardHistoNo.push_back(fRunInfo->GetForwardHistoNo(i)); if (!runData->IsPresent(forwardHistoNo[i])) { - cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?"; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> forwardHistoNo found = " << forwardHistoNo[i] << ", which is NOT present in the data file!?!?"; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; // clean up forwardHistoNo.clear(); backwardHistoNo.clear(); @@ -505,10 +504,10 @@ Bool_t PRunAsymmetryRRF::PrepareData() backwardHistoNo.push_back(fRunInfo->GetBackwardHistoNo(i)); if (!runData->IsPresent(backwardHistoNo[i])) { - cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?"; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> backwardHistoNo found = " << backwardHistoNo[i] << ", which is NOT present in the data file!?!?"; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; // clean up forwardHistoNo.clear(); backwardHistoNo.clear(); @@ -516,10 +515,10 @@ Bool_t PRunAsymmetryRRF::PrepareData() } } if (forwardHistoNo.size() != backwardHistoNo.size()) { - cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> # of forward histograms different from # of backward histograms."; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> # of forward histograms different from # of backward histograms."; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; // clean up forwardHistoNo.clear(); backwardHistoNo.clear(); @@ -528,8 +527,8 @@ Bool_t PRunAsymmetryRRF::PrepareData() // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; - cout.precision(10); - cout << endl << ">> PRunAsymmetryRRF::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl; + std::cout.precision(10); + std::cout << std::endl << ">> PRunAsymmetryRRF::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl; // get all the proper t0's and addt0's for the current RUN block if (!GetProperT0(runData, globalBlock, forwardHistoNo, backwardHistoNo)) { @@ -537,7 +536,7 @@ Bool_t PRunAsymmetryRRF::PrepareData() } // keep the histo of each group at this point (addruns handled below) - vector forward, backward; + std::vector forward, backward; forward.resize(forwardHistoNo.size()); // resize to number of groups backward.resize(backwardHistoNo.size()); // resize to numer of groups for (UInt_t i=0; iGetRunNameSize(); i++) { // get run to be added to the main one addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i))); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -623,12 +622,12 @@ Bool_t PRunAsymmetryRRF::PrepareData() fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.6), 1); fRunInfo->SetBkgRange(static_cast(fT0s[1]*0.1), 2); fRunInfo->SetBkgRange(static_cast(fT0s[1]*0.6), 3); - cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **WARNING** Neither fix background nor background bins are given!"; - cerr << endl << ">> Will try the following:"; - cerr << endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); - cerr << endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3); - cerr << endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **WARNING** Neither fix background nor background bins are given!"; + std::cerr << std::endl << ">> Will try the following:"; + std::cerr << std::endl << ">> forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); + std::cerr << std::endl << ">> backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; + std::cerr << std::endl; if (!SubtractEstimatedBkg()) return false; } @@ -746,11 +745,11 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg() beamPeriod = 0.0; // check if start and end are in proper order - UInt_t start[2] = {(UInt_t)fRunInfo->GetBkgRange(0), (UInt_t)fRunInfo->GetBkgRange(2)}; - UInt_t end[2] = {(UInt_t)fRunInfo->GetBkgRange(1), (UInt_t)fRunInfo->GetBkgRange(3)}; + UInt_t start[2] = {static_cast(fRunInfo->GetBkgRange(0)), static_cast(fRunInfo->GetBkgRange(2))}; + UInt_t end[2] = {static_cast(fRunInfo->GetBkgRange(1)), static_cast(fRunInfo->GetBkgRange(3))}; for (UInt_t i=0; i<2; i++) { if (end[i] < start[i]) { - cout << endl << "PRunAsymmetryRRF::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!"; + std::cout << std::endl << "PRunAsymmetryRRF::SubtractEstimatedBkg(): end = " << end[i] << " > start = " << start[i] << "! Will swap them!"; UInt_t keep = end[i]; end[i] = start[i]; start[i] = keep; @@ -760,11 +759,11 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg() // calculate proper background range for (UInt_t i=0; i<2; i++) { if (beamPeriod != 0.0) { - Double_t timeBkg = (Double_t)(end[i]-start[i])*fTimeResolution; // length of the background intervall in time - UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall + Double_t timeBkg = static_cast(end[i]-start[i])*fTimeResolution; // length of the background intervall in time + UInt_t fullCycles = static_cast(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall // correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce - end[i] = start[i] + (UInt_t) ((fullCycles*beamPeriod)/fTimeResolution); - cout << "PRunAsymmetryRRF::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << endl; + end[i] = start[i] + static_cast((fullCycles*beamPeriod)/fTimeResolution); + std::cout << "PRunAsymmetryRRF::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << std::endl; if (end[i] == start[i]) end[i] = fRunInfo->GetBkgRange(2*i+1); } @@ -772,17 +771,17 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg() // check if start is within histogram bounds if ((start[0] >= fForward.size()) || (start[1] >= fBackward.size())) { - cerr << endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; - cerr << endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ")."; + std::cerr << std::endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; + std::cerr << std::endl << ">> background start (f/b) = (" << start[0] << "/" << start[1] << ")."; return false; } // check if end is within histogram bounds if ((end[0] >= fForward.size()) || (end[1] >= fBackward.size())) { - cerr << endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; - cerr << endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ")."; + std::cerr << std::endl << ">> PRunAsymmetryRRF::SubtractEstimatedBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths (f/b) = (" << fForward.size() << "/" << fBackward.size() << ")."; + std::cerr << std::endl << ">> background end (f/b) = (" << end[0] << "/" << end[1] << ")."; return false; } @@ -795,14 +794,14 @@ Bool_t PRunAsymmetryRRF::SubtractEstimatedBkg() bkg[0] += fForward[i]; errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1); bkg[0] /= static_cast(end[0] - start[0] + 1); - cout << endl << ">> estimated forward histo background: " << bkg[0]; + std::cout << std::endl << ">> estimated forward histo background: " << bkg[0]; // backward for (UInt_t i=start[1]; i<=end[1]; i++) bkg[1] += fBackward[i]; errBkg[1] = TMath::Sqrt(bkg[1])/(end[1] - start[1] + 1); bkg[1] /= static_cast(end[1] - start[1] + 1); - cout << endl << ">> estimated backward histo background: " << bkg[1] << endl; + std::cout << std::endl << ">> estimated backward histo background: " << bkg[1] << std::endl; // correct error for forward, backward Double_t errVal = 0.0; @@ -845,17 +844,17 @@ Bool_t PRunAsymmetryRRF::PrepareFitData() // 1st: form the asymmetry of the original data // forward and backward detectors might have different fgb-t0 offset. Take the maximum of both. - Int_t fgbOffset = fGoodBins[0]-(Int_t)fT0s[0]; - if (fgbOffset < fGoodBins[2]-(Int_t)fT0s[1]) - fgbOffset = fGoodBins[2]-(Int_t)fT0s[1]; + Int_t fgbOffset = fGoodBins[0]-static_cast(fT0s[0]); + if (fgbOffset < fGoodBins[2]-static_cast(fT0s[1])) + fgbOffset = fGoodBins[2]-static_cast(fT0s[1]); // last good bin (lgb) is the minimum of forward/backward lgb - Int_t lgb_offset = fGoodBins[1]-(Int_t)fT0s[0]+fgbOffset; - if (lgb_offset < fGoodBins[3]-(Int_t)fT0s[1]+fgbOffset) - lgb_offset = fGoodBins[3]-(Int_t)fT0s[1]+fgbOffset; + Int_t lgb_offset = fGoodBins[1]-static_cast(fT0s[0])+fgbOffset; + if (lgb_offset < fGoodBins[3]-static_cast(fT0s[1])+fgbOffset) + lgb_offset = fGoodBins[3]-static_cast(fT0s[1])+fgbOffset; - Int_t fgb = (Int_t)fT0s[0]+fgbOffset; + Int_t fgb = static_cast(fT0s[0])+fgbOffset; Int_t lgb = fgb + lgb_offset; - Int_t dt0 = (Int_t)fT0s[0]-(Int_t)fT0s[1]; + Int_t dt0 = static_cast(fT0s[0])-static_cast(fT0s[1]); PDoubleVector asym; PDoubleVector asymErr; @@ -883,7 +882,7 @@ Bool_t PRunAsymmetryRRF::PrepareFitData() Double_t wRRF = globalBlock->GetRRFFreq("Mc"); Double_t phaseRRF = globalBlock->GetRRFPhase()*TMath::TwoPi()/180.0; - Double_t startTime = fTimeResolution * (Double_t)fgbOffset; + Double_t startTime = fTimeResolution * static_cast(fgbOffset); Double_t time=0.0; for (UInt_t i=0; i(fRRFPacking-1)/2.0)); + fData.SetDataTimeStep(fTimeResolution*static_cast(fRRFPacking)); for (UInt_t i=0; i(fT0s[0]), static_cast(fT0s[1])}; // check if the data ranges and t0's between forward/backward are compatible Int_t fgb[2]; @@ -973,13 +972,13 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2] if (abs(start[0]-t0[0]) > abs(start[1]-t0[1])) { fgb[0] = start[0]; fgb[1] = t0[1] + start[0]-t0[0]; - cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift backward fgb from "; - cerr << start[1] << " to " << fgb[1] << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift backward fgb from "; + std::cerr << start[1] << " to " << fgb[1] << std::endl; } else { fgb[0] = t0[0] + start[1]-t0[1]; fgb[1] = start[1]; - cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift forward fgb from "; - cerr << start[0] << " to " << fgb[0] << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **WARNING** needed to shift forward fgb from "; + std::cerr << start[0] << " to " << fgb[0] << std::endl; } } else { // fgb aligning is correct fgb[0] = start[0]; @@ -999,21 +998,21 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2] // check if start, end, and t0 make any sense for (UInt_t i=0; i<2; i++) { // 1st check if start is within proper bounds - if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start[i] < 0) || (start[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 2nd check if end is within proper bounds - if ((end[i] < 0) || (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; + if ((end[i] < 0) || (end[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** end data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if t0 is within proper bounds - if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!"; - cerr << endl; + if ((t0[i] < 0) || (t0[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareViewData(): **ERROR** t0 data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -1077,7 +1076,7 @@ Bool_t PRunAsymmetryRRF::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2] PMsrGlobalBlock *globalBlock = fMsrInfo->GetMsrGlobal(); Double_t wRRF = globalBlock->GetRRFFreq("Mc"); Double_t phaseRRF = globalBlock->GetRRFPhase()*TMath::TwoPi()/180.0; - Double_t startTime=fTimeResolution*((Double_t)start[0]-t0[0]); + Double_t startTime=fTimeResolution*(static_cast(start[0])-t0[0]); Double_t time = 0.0; for (UInt_t i=0; i(fRRFPacking-1)/2.0)); + fData.SetDataTimeStep(fTimeResolution*static_cast(fRRFPacking)); for (UInt_t i=0; isize() * 10 > runData->GetDataBin(histoNo[0])->size()) { size = fData.GetValue()->size() * 10; - factor = (Double_t)runData->GetDataBin(histoNo[0])->size() / (Double_t)size; + factor = static_cast(runData->GetDataBin(histoNo[0])->size()) / static_cast(size); } fData.SetTheoryTimeStart(fData.GetDataTimeStart()); fData.SetTheoryTimeStep(fTimeResolution*factor); for (UInt_t i=0; i(i)*fTimeResolution*factor; dval = fTheory->Func(time, par, fFuncValues); if (fabs(dval) > 10.0) { // dirty hack needs to be fixed!! dval = 0.0; @@ -1193,7 +1192,7 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob // fill in the missing T0's from the GLOBAL block section (if present) for (UInt_t i=0; iGetT0BinSize(); i++) { - if (fT0s[i] == -1) { // i.e. not given in the RUN block section + if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section fT0s[i] = globalBlock->GetT0Bin(i); } } @@ -1220,11 +1219,11 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob fT0s[2*i] = runData->GetT0BinEstimated(forwardHistoNo[i]); fRunInfo->SetT0Bin(fT0s[2*i], 2*i); - cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(forwardHistoNo[i]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } for (UInt_t i=0; iGetT0BinEstimated(backwardHistoNo[i]); fRunInfo->SetT0Bin(fT0s[2*i+1], 2*i+1); - cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data(); + std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[i]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t i=0; i (Int_t)runData->GetDataBin(forwardHistoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!"; - cerr << endl << ">> forwardHistoNo " << forwardHistoNo[i]; - cerr << endl; + if ((fT0s[2*i] < 0) || (fT0s[2*i] > static_cast(runData->GetDataBin(forwardHistoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[2*i] << ") doesn't make any sense!"; + std::cerr << std::endl << ">> forwardHistoNo " << forwardHistoNo[i]; + std::cerr << std::endl; return false; } - if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > (Int_t)runData->GetDataBin(backwardHistoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!"; - cerr << endl << ">> backwardHistoNo " << backwardHistoNo[i]; - cerr << endl; + if ((fT0s[2*i+1] < 0) || (fT0s[2*i+1] > static_cast(runData->GetDataBin(backwardHistoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::PrepareData(): **ERROR** t0 data bin (" << fT0s[2*i+1] << ") doesn't make any sense!"; + std::cerr << std::endl << ">> backwardHistoNo " << backwardHistoNo[i]; + std::cerr << std::endl; return false; } } @@ -1263,9 +1262,9 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob for (UInt_t i=1; iGetRunNameSize(); i++) { // get run to be added to the main one addRunData = fRawData->GetRunData(*(fRunInfo->GetRunName(i))); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -1304,11 +1303,11 @@ Bool_t PRunAsymmetryRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *glob fAddT0s[i-1][2*j] = addRunData->GetT0BinEstimated(forwardHistoNo[j]); fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j], i-1, 2*j); - cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(forwardHistoNo[j]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } for (UInt_t j=0; jGetT0BinEstimated(backwardHistoNo[j]); fRunInfo->SetAddT0Bin(fAddT0s[i-1][2*j+1], i-1, 2*j+1); - cerr << endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); + std::cerr << std::endl << ">> will try the estimated one: backward t0 = " << runData->GetT0BinEstimated(backwardHistoNo[j]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } } @@ -1365,36 +1364,36 @@ Bool_t PRunAsymmetryRRF::GetProperDataRange(PRawRunData* runData, UInt_t histoNo } Double_t t0[2] = {fT0s[0], fT0s[1]}; - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); // needed in case first good bin is not given, default = 10ns + Int_t offset = static_cast(10.0e-3/fTimeResolution); // needed in case first good bin is not given, default = 10ns // check if data range has been provided, and if not try to estimate them if (start[0] < 0) { - start[0] = (Int_t)t0[0]+offset; + start[0] = static_cast(t0[0])+offset; fRunInfo->SetDataRange(start[0], 0); - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[0] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (start[1] < 0) { - start[1] = (Int_t)t0[1]+offset; + start[1] = static_cast(t0[1])+offset; fRunInfo->SetDataRange(start[1], 2); - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start[1] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (end[0] < 0) { end[0] = runData->GetDataBin(histoNo[0])->size(); fRunInfo->SetDataRange(end[0], 1); - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (end[1] < 0) { end[1] = runData->GetDataBin(histoNo[1])->size(); fRunInfo->SetDataRange(end[1], 3); - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start, end, and t0 make any sense @@ -1406,27 +1405,27 @@ Bool_t PRunAsymmetryRRF::GetProperDataRange(PRawRunData* runData, UInt_t histoNo start[i] = keep; } // 2nd check if start is within proper bounds - if ((start[i] < 0) || (start[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start[i] < 0) || (start[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds if (end[i] < 0) { - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!"; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** end data bin (" << end[i] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } - if (end[i] > (Int_t)runData->GetDataBin(histoNo[i])->size()) { - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ")."; - cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl; - cerr << endl; - end[i] = (Int_t)runData->GetDataBin(histoNo[i])->size()-1; + if (end[i] > static_cast(runData->GetDataBin(histoNo[i])->size())) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **WARNING** end data bin (" << end[i] << ") > histo length (" << (Int_t)runData->GetDataBin(histoNo[i])->size() << ")."; + std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl; + std::cerr << std::endl; + end[i] = static_cast(runData->GetDataBin(histoNo[i])->size())-1; } // 4th check if t0 is within proper bounds - if ((t0[i] < 0) || (t0[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!"; - cerr << endl; + if ((t0[i] < 0) || (t0[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange(): **ERROR** t0 data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -1435,18 +1434,18 @@ Bool_t PRunAsymmetryRRF::GetProperDataRange(PRawRunData* runData, UInt_t histoNo if (fabs(static_cast(start[0])-t0[0]) > fabs(static_cast(start[1])-t0[1])){ start[1] = static_cast(t0[1] + static_cast(start[0]) - t0[0]); end[1] = static_cast(t0[1] + static_cast(end[0]) - t0[0]); - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift backward data range."; - cerr << endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3); - cerr << endl << ">> used : " << start[1] << ", " << end[1]; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift backward data range."; + std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3); + std::cerr << std::endl << ">> used : " << start[1] << ", " << end[1]; + std::cerr << std::endl; } if (fabs(static_cast(start[0])-t0[0]) < fabs(static_cast(start[1])-t0[1])){ start[0] = static_cast(t0[0] + static_cast(start[1]) - t0[1]); end[0] = static_cast(t0[0] + static_cast(end[1]) - t0[1]); - cerr << endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift forward data range."; - cerr << endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1); - cerr << endl << ">> used : " << start[0] << ", " << end[0]; - cerr << endl; + std::cerr << std::endl << ">> PRunAsymmetryRRF::GetProperDataRange **WARNING** needed to shift forward data range."; + std::cerr << std::endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1); + std::cerr << std::endl << ">> used : " << start[0] << ", " << end[0]; + std::cerr << std::endl; } // keep good bins for potential latter use @@ -1501,7 +1500,7 @@ void PRunAsymmetryRRF::GetProperFitRange(PMsrGlobalBlock *globalBlock) if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) { fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt - cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; - cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; + std::cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl; + std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl; } } diff --git a/src/classes/PRunBase.cpp b/src/classes/PRunBase.cpp index 2d2466c4..c8ee5bc0 100644 --- a/src/classes/PRunBase.cpp +++ b/src/classes/PRunBase.cpp @@ -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(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(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(fitRange.size())) { // fRunNo present - start = fitRange[fRunNo].first; - end = fitRange[fRunNo].second; + UInt_t idx=static_cast(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(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(m); i++) { fKaiserFilter[i] /= dsum; } } diff --git a/src/classes/PRunDataHandler.cpp b/src/classes/PRunDataHandler.cpp index e12e8400..b6be2530 100644 --- a/src/classes/PRunDataHandler.cpp +++ b/src/classes/PRunDataHandler.cpp @@ -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 * @@ -41,7 +41,6 @@ #include #include #include -using namespace std; #include #include @@ -236,7 +235,7 @@ PRawRunData* PRunDataHandler::GetRunData(const TString &runName) } if (i == fData.size()) - return 0; + return nullptr; else return &fData[i]; } @@ -256,7 +255,7 @@ PRawRunData* PRunDataHandler::GetRunData(const TString &runName) PRawRunData* PRunDataHandler::GetRunData(const UInt_t idx) { if (idx >= fData.size()) - return 0; + return nullptr; else return &fData[idx]; } @@ -288,11 +287,11 @@ void PRunDataHandler::ReadData() } else if ((fFileFormat == "Wkm") || (fFileFormat == "wkm")) { fAllDataAvailable = ReadWkmFile(); } else { - cerr << endl << ">> PRunDataHandler::ReadData(): **ERROR** unkown file format \"" << fFileFormat << "\" found." << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadData(): **ERROR** unkown file format \"" << fFileFormat << "\" found." << std::endl; fAllDataAvailable = false; } } else { - cerr << endl << ">> PRunDataHandler::ReadData(): **ERROR** Couldn't read files." << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadData(): **ERROR** Couldn't read files." << std::endl; fAllDataAvailable = false; } } @@ -331,9 +330,9 @@ void PRunDataHandler::WriteData() void PRunDataHandler::Init(const Int_t tag) { if ((tag==PHR_INIT_ALL) || (tag==PHR_INIT_ANY2MANY)) - fMsrInfo = 0; + fMsrInfo = nullptr; if ((tag==PHR_INIT_ALL) || (tag==PHR_INIT_MSR)) - fAny2ManyInfo = 0; + fAny2ManyInfo = nullptr; fAllDataAvailable = false; if (tag!=PHR_INIT_ALL) fFileFormat = TString(""); @@ -357,15 +356,15 @@ Bool_t PRunDataHandler::ReadFilesMsr() Bool_t success = true; // loop over the full RUN list to see what needs to be read - PMsrRunList *runList = 0; + PMsrRunList *runList = nullptr; runList = fMsrInfo->GetMsrRunList(); - if (runList == 0) { - cerr << endl << ">> PRunDataHandler::ReadFilesMsr(): **ERROR** Couldn't obtain run list from PMsrHandler: something VERY fishy"; - cerr << endl; + if (runList == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::ReadFilesMsr(): **ERROR** Couldn't obtain run list from PMsrHandler: something VERY fishy"; + std::cerr << std::endl; return false; } - char str[1024], *p_str=0; + char str[1024], *p_str=nullptr; UInt_t year=0; TString musrRoot("musr-root"); @@ -379,7 +378,7 @@ Bool_t PRunDataHandler::ReadFilesMsr() // get year from string if LEM data file strcpy(str, fRunName.Data()); p_str = strstr(str, "lem"); - if (p_str != 0) + if (p_str != nullptr) sscanf(p_str, "lem%d_his", &year); // check special case for ROOT-NPP/ROOT-PPC (LEM) @@ -462,8 +461,8 @@ Bool_t PRunDataHandler::ReadFilesMsr() Bool_t PRunDataHandler::ReadWriteFilesList() { if ((fAny2ManyInfo->inFileName.size() == 0) && (fAny2ManyInfo->runList.size() == 0)) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't obtain run list from fAny2ManyInfo: something VERY fishy"; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't obtain run list from fAny2ManyInfo: something VERY fishy"; + std::cerr << std::endl; return false; } @@ -487,7 +486,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() inTag = A2M_UNDEFINED; if (inTag == A2M_UNDEFINED) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** no valid input data file format found: '" << fAny2ManyInfo->inFormat.Data() << "'" << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** no valid input data file format found: '" << fAny2ManyInfo->inFormat.Data() << "'" << std::endl; return false; } @@ -511,7 +510,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() outTag = A2M_UNDEFINED; if (outTag == A2M_UNDEFINED) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** no valid output data file format found: '" << fAny2ManyInfo->outFormat.Data() << "'" << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** no valid output data file format found: '" << fAny2ManyInfo->outFormat.Data() << "'" << std::endl; return false; } @@ -520,7 +519,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() // loop over all runs of the run list for (UInt_t i=0; iinFileName.size(); i++) { if (!FileExistsCheck(true, i)) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't find file " << fAny2ManyInfo->inFileName[i].Data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't find file " << fAny2ManyInfo->inFileName[i].Data() << std::endl; return false; } @@ -549,7 +548,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() } if (!success) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't read file " << fAny2ManyInfo->inFileName[i].Data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't read file " << fAny2ManyInfo->inFileName[i].Data() << std::endl; return false; } @@ -568,7 +567,6 @@ Bool_t PRunDataHandler::ReadWriteFilesList() else success = WriteMusrRootFile(fAny2ManyInfo->outFileName); break; - break; case A2M_PSIBIN: if (fAny2ManyInfo->outFileName.Length() == 0) success = WritePsiBinFile(); @@ -610,7 +608,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() } if (success == false) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't write converted output file." << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't write converted output file." << std::endl; return false; } @@ -624,7 +622,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() // loop over all runs of the run list for (UInt_t i=0; irunList.size(); i++) { if (!FileExistsCheck(false, i)) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't find run " << fAny2ManyInfo->runList[i] << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't find run " << fAny2ManyInfo->runList[i] << std::endl; return false; } @@ -653,7 +651,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() } if (!success) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't read file " << fRunPathName.Data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't read file " << fRunPathName.Data() << std::endl; return false; } @@ -665,7 +663,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() Bool_t ok; TString fln = FileNameFromTemplate(fAny2ManyInfo->outTemplate, fAny2ManyInfo->runList[i], year, ok); if (!ok) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't create necessary output file name." << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't create necessary output file name." << std::endl; return false; } @@ -701,7 +699,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() } if (success == false) { - cerr << endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't write converted output file." << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't write converted output file." << std::endl; return false; } @@ -750,24 +748,24 @@ Bool_t PRunDataHandler::ReadWriteFilesList() // check if the compressed file shall be streamed to the stdout if (fAny2ManyInfo->useStandardOutput) { // stream file to stdout - ifstream is; + std::ifstream is; int length=1024; char *buffer; - is.open(fln.Data(), ios::binary); + is.open(fln.Data(), std::ios::binary); if (!is.is_open()) { - cerr << endl << "PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't open the file for streaming." << endl; + std::cerr << std::endl << "PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't open the file for streaming." << std::endl; remove(fln.Data()); return false; } // get length of file - is.seekg(0, ios::end); + is.seekg(0, std::ios::end); length = is.tellg(); - is.seekg(0, ios::beg); + is.seekg(0, std::ios::beg); if (length == -1) { - cerr << endl << "PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't determine the file size." << endl; + std::cerr << std::endl << "PRunDataHandler::ReadWriteFilesList(): **ERROR** Couldn't determine the file size." << std::endl; remove(fln.Data()); return false; } @@ -778,7 +776,7 @@ Bool_t PRunDataHandler::ReadWriteFilesList() // read data as a block while (!is.eof()) { is.read(buffer, length); - cout.write(buffer, length); + std::cout.write(buffer, length); } is.close(); @@ -942,28 +940,28 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) Bool_t success = true; // local init - TROOT root("PRunBase", "PRunBase", 0); + TROOT root("PRunBase", "PRunBase", nullptr); TString pathName = "???"; TString str, *pstr; TString ext; pstr = runInfo.GetBeamline(idx); - if (pstr == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain beamline data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain beamline data." << std::endl; assert(0); } pstr->ToLower(); runInfo.SetBeamline(*pstr, idx); pstr = runInfo.GetInstitute(idx); - if (pstr == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain institute data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain institute data." << std::endl; assert(0); } pstr->ToLower(); runInfo.SetInstitute(*pstr, idx); pstr = runInfo.GetFileFormat(idx); - if (pstr == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain file format data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain file format data." << std::endl; assert(0); } pstr->ToLower(); @@ -1002,25 +1000,25 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) // unkown file format found if (!success) { pstr = runInfo.GetFileFormat(idx); - if (pstr == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain file format data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain file format data." << std::endl; assert(0); } pstr->ToUpper(); - cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** File Format '" << pstr->Data() << "' unsupported."; - cerr << endl << ">> support file formats are:"; - cerr << endl << ">> ROOT-NPP -> root not post pileup corrected for lem"; - cerr << endl << ">> ROOT-PPC -> root post pileup corrected for lem"; - cerr << endl << ">> MUSR-ROOT -> MusrRoot file format"; - cerr << endl << ">> NEXUS -> nexus file format, HDF4, HDF5, or XML"; - cerr << endl << ">> PSI-BIN -> psi bin file format"; - cerr << endl << ">> PSI-MDU -> psi mdu file format (see also MDU-ASCII)"; - cerr << endl << ">> MUD -> triumf mud file format"; - cerr << endl << ">> WKM -> wkm ascii file format"; - cerr << endl << ">> MDU-ASCII -> psi mdu ascii file format"; - cerr << endl << ">> ASCII -> column like file format"; - cerr << endl << ">> DB -> triumf db file \"format\""; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** File Format '" << pstr->Data() << "' unsupported."; + std::cerr << std::endl << ">> support file formats are:"; + std::cerr << std::endl << ">> ROOT-NPP -> root not post pileup corrected for lem"; + std::cerr << std::endl << ">> ROOT-PPC -> root post pileup corrected for lem"; + std::cerr << std::endl << ">> MUSR-ROOT -> MusrRoot file format"; + std::cerr << std::endl << ">> NEXUS -> nexus file format, HDF4, HDF5, or XML"; + std::cerr << std::endl << ">> PSI-BIN -> psi bin file format"; + std::cerr << std::endl << ">> PSI-MDU -> psi mdu file format (see also MDU-ASCII)"; + std::cerr << std::endl << ">> MUD -> triumf mud file format"; + std::cerr << std::endl << ">> WKM -> wkm ascii file format"; + std::cerr << std::endl << ">> MDU-ASCII -> psi mdu ascii file format"; + std::cerr << std::endl << ">> ASCII -> column like file format"; + std::cerr << std::endl << ">> DB -> triumf db file \"format\""; + std::cerr << std::endl; return success; } @@ -1071,7 +1069,7 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) // cleanup if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } @@ -1082,15 +1080,15 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) TObjArray *tokens = str.Tokenize(":"); TObjString *ostr; pstr = runInfo.GetInstitute(idx); - if (pstr == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain institute data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain institute data." << std::endl; assert(0); } pstr->ToUpper(); runInfo.SetInstitute(*pstr, idx); pstr = runInfo.GetBeamline(idx); - if (pstr == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain beamline data." << endl; + if (pstr == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck: **ERROR** Couldn't obtain beamline data." << std::endl; assert(0); } pstr->ToUpper(); @@ -1110,18 +1108,18 @@ Bool_t PRunDataHandler::FileExistsCheck(PMsrRunBlock &runInfo, const UInt_t idx) // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } // no proper path name found if (pathName.CompareTo("???") == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** Couldn't find '" << runInfo.GetRunName(idx)->Data() << "' in any standard path."; - cerr << endl << ">> standard search pathes are:"; - cerr << endl << ">> 1. the local directory"; - cerr << endl << ">> 2. the data directory given in the startup XML file"; - cerr << endl << ">> 3. the directories listed in MUSRFULLDATAPATH"; - cerr << endl << ">> 4. default path construct which is described in the manual"; + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** Couldn't find '" << runInfo.GetRunName(idx)->Data() << "' in any standard path."; + std::cerr << std::endl << ">> standard search pathes are:"; + std::cerr << std::endl << ">> 1. the local directory"; + std::cerr << std::endl << ">> 2. the data directory given in the startup XML file"; + std::cerr << std::endl << ">> 3. the directories listed in MUSRFULLDATAPATH"; + std::cerr << std::endl << ">> 4. default path construct which is described in the manual"; return false; } @@ -1150,19 +1148,19 @@ Bool_t PRunDataHandler::FileExistsCheck(const Bool_t fileName, const Int_t idx) TString fln(""); if (fileName) { // single input file name - if (idx >= (Int_t)fAny2ManyInfo->inFileName.size()) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** idx=" << idx << " out of range. (inFileName.size()==" << fAny2ManyInfo->inFileName.size() << ")" << endl; + if (idx >= static_cast(fAny2ManyInfo->inFileName.size())) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** idx=" << idx << " out of range. (inFileName.size()==" << fAny2ManyInfo->inFileName.size() << ")" << std::endl; return false; } fln = fAny2ManyInfo->inFileName[idx]; } else { // run file list entry shall be handled - if (idx >= (Int_t)fAny2ManyInfo->runList.size()) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** idx=" << idx << " out of range. (inFileName.size()==" << fAny2ManyInfo->runList.size() << ")" << endl; + if (idx >= static_cast(fAny2ManyInfo->runList.size())) { + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** idx=" << idx << " out of range. (inFileName.size()==" << fAny2ManyInfo->runList.size() << ")" << std::endl; return false; } // check for input/output templates if ((fAny2ManyInfo->inTemplate.Length() == 0) || (fAny2ManyInfo->outTemplate.Length() == 0)) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** when using run lists, input/output templates are needed as well." << endl; + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** when using run lists, input/output templates are needed as well." << std::endl; return false; } // make the input file name according to the input template @@ -1209,16 +1207,16 @@ Bool_t PRunDataHandler::FileExistsCheck(const Bool_t fileName, const Int_t idx) // cleanup if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } // no proper path name found if (pathName.CompareTo("???") == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** Couldn't find '" << fln.Data() << "' in any standard path."; - cerr << endl << ">> standard search pathes are:"; - cerr << endl << ">> 1. the local directory"; - cerr << endl << ">> 2. the data directory given in the startup XML file"; - cerr << endl << ">> 3. the directories listed in MUSRFULLDATAPATH"; + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** Couldn't find '" << fln.Data() << "' in any standard path."; + std::cerr << std::endl << ">> standard search pathes are:"; + std::cerr << std::endl << ">> 1. the local directory"; + std::cerr << std::endl << ">> 2. the data directory given in the startup XML file"; + std::cerr << std::endl << ">> 3. the directories listed in MUSRFULLDATAPATH"; return false; } @@ -1276,16 +1274,16 @@ Bool_t PRunDataHandler::FileExistsCheck(const TString fileName) // cleanup if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } // no proper path name found if (pathName.CompareTo("???") == 0) { - cerr << endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** Couldn't find '" << fileName.Data() << "' in any standard path."; - cerr << endl << ">> standard search pathes are:"; - cerr << endl << ">> 1. the local directory"; - cerr << endl << ">> 2. the data directory given in the startup XML file"; - cerr << endl << ">> 3. the directories listed in MUSRFULLDATAPATH"; + std::cerr << std::endl << ">> PRunDataHandler::FileExistsCheck(): **ERROR** Couldn't find '" << fileName.Data() << "' in any standard path."; + std::cerr << std::endl << ">> standard search pathes are:"; + std::cerr << std::endl << ">> 1. the local directory"; + std::cerr << std::endl << ">> 2. the data directory given in the startup XML file"; + std::cerr << std::endl << ">> 3. the directories listed in MUSRFULLDATAPATH"; return false; } @@ -1323,8 +1321,8 @@ Bool_t PRunDataHandler::ReadRootFile() if (!folder) { // either something is wrong, or it is a MusrRoot file f.GetObject("RunHeader", folder); if (!folder) { // something is wrong!! - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't neither obtain RunInfo (LEM),"; - cerr << endl << " nor RunHeader (MusrRoot) from " << fRunPathName.Data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't neither obtain RunInfo (LEM),"; + std::cerr << std::endl << " nor RunHeader (MusrRoot) from " << fRunPathName.Data() << std::endl; f.Close(); return false; } else { @@ -1340,7 +1338,7 @@ Bool_t PRunDataHandler::ReadRootFile() // check if run header is valid if (!runHeader) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain run header info from ROOT file " << fRunPathName.Data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain run header info from ROOT file " << fRunPathName.Data() << std::endl; f.Close(); return false; } @@ -1357,7 +1355,7 @@ Bool_t PRunDataHandler::ReadRootFile() runData.SetRunTitle(ostr.GetString()); // get run number - runData.SetRunNumber((Int_t)runHeader->GetRunNumber()); + runData.SetRunNumber(static_cast(runHeader->GetRunNumber())); // get temperature runData.ClearTemperature(); @@ -1377,7 +1375,7 @@ Bool_t PRunDataHandler::ReadRootFile() // get start time/date // start date - time_t idt = (time_t)runHeader->GetStartTime(); + time_t idt = static_cast(runHeader->GetStartTime()); runData.SetStartDateTime(idt); struct tm *dt = localtime(&idt); char str[128]; @@ -1392,7 +1390,7 @@ Bool_t PRunDataHandler::ReadRootFile() // get stop time/date // stop date - idt = (time_t)runHeader->GetStopTime(); + idt = static_cast(runHeader->GetStopTime()); runData.SetStopDateTime(idt); dt = localtime(&idt); memset(str, 0, sizeof(str)); @@ -1419,26 +1417,26 @@ Bool_t PRunDataHandler::ReadRootFile() // check if run summary is valid if (!runSummary) { - cout << endl << "**INFO** Couldn't obtain run summary info from ROOT file " << fRunPathName.Data() << endl; + std::cout << std::endl << "**INFO** Couldn't obtain run summary info from ROOT file " << fRunPathName.Data() << std::endl; // this is not fatal... only RA-HV values are not available } else { // it follows a (at least) little bit strange extraction of the RA values from Thomas' TObjArray... //streaming of a ASCII-file would be more easy TString s; TObjArrayIter summIter(runSummary); TObjString *os(dynamic_cast(summIter.Next())); - TObjArray *oa(0); - TObjString *objTok(0); - while (os != 0) { + TObjArray *oa(nullptr); + TObjString *objTok(nullptr); + while (os != nullptr) { s = os->GetString(); // will put four parallel if's since it may be that more than one RA-values are on one line if (s.Contains("RA-L")) { oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0) { + while (objTok != nullptr) { if (!objTok->GetString().CompareTo("RA-L")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if ((objTok != nullptr) && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(0, objTok->GetString().Atof()); // fill RA-R value into the runData structure break; @@ -1449,7 +1447,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1457,10 +1455,10 @@ Bool_t PRunDataHandler::ReadRootFile() oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0){ + while (objTok != nullptr){ if (!objTok->GetString().CompareTo("RA-R")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if (objTok != nullptr && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(1, objTok->GetString().Atof()); // fill RA-R value into the runData structure break; @@ -1471,7 +1469,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1479,10 +1477,10 @@ Bool_t PRunDataHandler::ReadRootFile() oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0){ + while (objTok != nullptr){ if (!objTok->GetString().CompareTo("RA-T")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if ((objTok != nullptr) && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(2, objTok->GetString().Atof()); // fill RA-T value into the runData structure break; @@ -1493,7 +1491,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1501,10 +1499,10 @@ Bool_t PRunDataHandler::ReadRootFile() oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0){ + while (objTok != nullptr){ if (!objTok->GetString().CompareTo("RA-B")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if ((objTok != nullptr) && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(3, objTok->GetString().Atof()); // fill RA-B value into the runData structure break; @@ -1515,7 +1513,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1528,7 +1526,7 @@ Bool_t PRunDataHandler::ReadRootFile() // check if histos folder is found f.GetObject("histos", folder); if (!folder) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain histos from " << fRunPathName.Data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain histos from " << fRunPathName.Data() << std::endl; f.Close(); return false; } @@ -1539,8 +1537,8 @@ Bool_t PRunDataHandler::ReadRootFile() sprintf(histoName, "hDecay%02d", i); TH1F *histo = dynamic_cast(folder->FindObjectAny(histoName)); if (!histo) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName; + std::cerr << std::endl; f.Close(); return false; } @@ -1556,7 +1554,7 @@ Bool_t PRunDataHandler::ReadRootFile() dataSet.SetHistoNo(i+1); dataSet.SetTimeZeroBin(t0[i]); dataSet.SetTimeZeroBinEstimated(histo->GetMaximumBin()); - dataSet.SetFirstGoodBin((Int_t)t0[i]); + dataSet.SetFirstGoodBin(static_cast(t0[i])); dataSet.SetLastGoodBin(histo->GetNbinsX()-1); dataSet.SetData(histoData); runData.SetDataSet(dataSet); @@ -1567,16 +1565,16 @@ Bool_t PRunDataHandler::ReadRootFile() // check if any post pileup histos are present at all (this is not the case for LEM data 2006 and earlier) sprintf(histoName, "hDecay%02d", POST_PILEUP_HISTO_OFFSET); if (!folder->FindObjectAny(histoName)) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **WARNING** Couldn't get histo " << histoName; - cerr << endl << ">> most probably this is an old (2006 or earlier) LEM file without post pileup histos."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **WARNING** Couldn't get histo " << histoName; + std::cerr << std::endl << ">> most probably this is an old (2006 or earlier) LEM file without post pileup histos."; + std::cerr << std::endl; } else { for (Int_t i=0; i(folder->FindObjectAny(histoName)); if (!histo) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << histoName; + std::cerr << std::endl; f.Close(); return false; } @@ -1591,7 +1589,7 @@ Bool_t PRunDataHandler::ReadRootFile() dataSet.SetHistoNo(i+1+POST_PILEUP_HISTO_OFFSET); dataSet.SetTimeZeroBin(t0[i]); dataSet.SetTimeZeroBinEstimated(histo->GetMaximumBin()); - dataSet.SetFirstGoodBin((Int_t)t0[i]); + dataSet.SetFirstGoodBin(static_cast(t0[i])); dataSet.SetLastGoodBin(histo->GetNbinsX()-1); dataSet.SetData(histoData); runData.SetDataSet(dataSet); @@ -1603,17 +1601,17 @@ Bool_t PRunDataHandler::ReadRootFile() } else { // MusrRoot file // invoke the MusrRoot header object TMusrRunHeader *header = new TMusrRunHeader(true); // read quite - if (header == 0) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fRunPathName; - cerr << endl; + if (header == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fRunPathName; + std::cerr << std::endl; f.Close(); return false; } // try to populate the MusrRoot header object if (!header->ExtractAll(folder)) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fRunPathName; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fRunPathName; + std::cerr << std::endl; f.Close(); return false; } @@ -1744,7 +1742,7 @@ Bool_t PRunDataHandler::ReadRootFile() else if (!prop.GetUnit().CompareTo("us") || !prop.GetUnit().CompareTo("microsec")) dval = prop.GetValue()*1.0e3; else - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Found unrecognized Time Resolution unit: " << prop.GetUnit() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Found unrecognized Time Resolution unit: " << prop.GetUnit() << std::endl; runData.SetTimeResolution(dval); } @@ -1764,8 +1762,8 @@ Bool_t PRunDataHandler::ReadRootFile() found = true; } if (!found) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** requested histo group " << fAny2ManyInfo->groupHistoList[i]; - cerr << endl << ">> which is NOT present in the data file." << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** requested histo group " << fAny2ManyInfo->groupHistoList[i]; + std::cerr << std::endl << ">> which is NOT present in the data file." << std::endl; return false; } } @@ -1812,26 +1810,26 @@ Bool_t PRunDataHandler::ReadRootFile() // check if run summary is valid if (!runSummary) { - cout << endl << "**INFO** Couldn't obtain run summary info from ROOT file " << fRunPathName.Data() << endl; + std::cout << std::endl << "**INFO** Couldn't obtain run summary info from ROOT file " << fRunPathName.Data() << std::endl; // this is not fatal... only RA-HV values are not available } else { // it follows a (at least) little bit strange extraction of the RA values from Thomas' TObjArray... //streaming of a ASCII-file would be more easy TString s; TObjArrayIter summIter(runSummary); TObjString *os(dynamic_cast(summIter.Next())); - TObjArray *oa(0); - TObjString *objTok(0); - while (os != 0) { + TObjArray *oa(nullptr); + TObjString *objTok(nullptr); + while (os != nullptr) { s = os->GetString(); // will put four parallel if's since it may be that more than one RA-values are on one line if (s.Contains("RA-L")) { oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0) { + while (objTok != nullptr) { if (!objTok->GetString().CompareTo("RA-L")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if ((objTok != nullptr) && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(0, objTok->GetString().Atof()); // fill RA-R value into the runData structure break; @@ -1842,7 +1840,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1850,10 +1848,10 @@ Bool_t PRunDataHandler::ReadRootFile() oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0){ + while (objTok != nullptr){ if (!objTok->GetString().CompareTo("RA-R")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if ((objTok != nullptr) && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(1, objTok->GetString().Atof()); // fill RA-R value into the runData structure break; @@ -1864,7 +1862,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1872,10 +1870,10 @@ Bool_t PRunDataHandler::ReadRootFile() oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0){ + while (objTok != nullptr){ if (!objTok->GetString().CompareTo("RA-T")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if ((objTok != nullptr) && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(2, objTok->GetString().Atof()); // fill RA-T value into the runData structure break; @@ -1886,7 +1884,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1894,10 +1892,10 @@ Bool_t PRunDataHandler::ReadRootFile() oa = s.Tokenize(" "); TObjArrayIter lineIter(oa); objTok = dynamic_cast(lineIter.Next()); - while (objTok != 0){ + while (objTok != nullptr){ if (!objTok->GetString().CompareTo("RA-B")) { objTok = dynamic_cast(lineIter.Next()); // "=" - if (objTok != 0 && !objTok->GetString().CompareTo("=")) { + if ((objTok != nullptr) && !objTok->GetString().CompareTo("=")) { objTok = dynamic_cast(lineIter.Next()); // HV value runData.SetRingAnode(3, objTok->GetString().Atof()); // fill RA-B value into the runData structure break; @@ -1908,7 +1906,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (oa) { delete oa; - oa = 0; + oa = nullptr; } } @@ -1921,7 +1919,7 @@ Bool_t PRunDataHandler::ReadRootFile() // check if histos folder is found f.GetObject("histos", folder); if (!folder) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain histos from " << fRunPathName.Data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't obtain histos from " << fRunPathName.Data() << std::endl; f.Close(); return false; } @@ -1932,8 +1930,8 @@ Bool_t PRunDataHandler::ReadRootFile() str.Form("hDecay%03d", redGreenOffsets[i]+j+1); TH1F *histo = dynamic_cast(folder->FindObjectAny(str.Data())); if (!histo) { - cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << str; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadRootFile: **ERROR** Couldn't get histo " << str; + std::cerr << std::endl; f.Close(); return false; } @@ -1973,7 +1971,7 @@ Bool_t PRunDataHandler::ReadRootFile() // clean up if (header) { delete header; - header=0; + header=nullptr; } } @@ -2001,26 +1999,26 @@ Bool_t PRunDataHandler::ReadRootFile() Bool_t PRunDataHandler::ReadNexusFile() { #ifdef PNEXUS_ENABLED - cout << endl << ">> PRunDataHandler::ReadNexusFile(): Will read nexus file " << fRunPathName.Data() << " ..."; + std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): Will read nexus file " << fRunPathName.Data() << " ..."; PDoubleVector histoData; PRawRunData runData; PRawRunDataSet dataSet; TString str; - string sstr; + std::string sstr; Double_t dval; bool ok; PNeXus *nxs_file = new PNeXus(fRunPathName.Data()); if (!nxs_file->IsValid()) { - cerr << endl << ">> PRunDataHandler::ReadNexusFile(): Not a valid NeXus file."; - cerr << endl << ">> Error Message: " << nxs_file->GetErrorMsg().data() << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadNexusFile(): Not a valid NeXus file."; + std::cerr << std::endl << ">> Error Message: " << nxs_file->GetErrorMsg().data() << std::endl; return false; } if (nxs_file->GetIdfVersion() == 1) { if (!nxs_file->IsValid()) { - cout << endl << "**ERROR** invalid NeXus IDF 2 version file found." << endl; + std::cout << std::endl << "**ERROR** invalid NeXus IDF 2 version file found." << std::endl; return false; } @@ -2105,12 +2103,12 @@ Bool_t PRunDataHandler::ReadNexusFile() } // get/set t0, firstGoodBin, lastGoodBin - vector *t0 = nxs_file->GetEntryIdf1()->GetData()->GetT0s(); - vector *fgb = nxs_file->GetEntryIdf1()->GetData()->GetFirstGoodBins(); - vector *lgb = nxs_file->GetEntryIdf1()->GetData()->GetLastGoodBins(); + std::vector *t0 = nxs_file->GetEntryIdf1()->GetData()->GetT0s(); + std::vector *fgb = nxs_file->GetEntryIdf1()->GetData()->GetFirstGoodBins(); + std::vector *lgb = nxs_file->GetEntryIdf1()->GetData()->GetLastGoodBins(); // get/set data - vector *pdata; + std::vector *pdata; unsigned int max=0, binMax=0; PDoubleVector data; for (UInt_t i=0; iGetEntryIdf1()->GetData()->GetNoOfHistos(); i++) { @@ -2156,7 +2154,7 @@ Bool_t PRunDataHandler::ReadNexusFile() fData.push_back(runData); } else if (nxs_file->GetIdfVersion() == 2) { if (!nxs_file->IsValid()) { - cout << endl << "**ERROR** invalid NeXus IDF 2 version file found." << endl; + std::cout << std::endl << "**ERROR** invalid NeXus IDF 2 version file found." << std::endl; return false; } // get header information @@ -2218,7 +2216,7 @@ Bool_t PRunDataHandler::ReadNexusFile() runData.SetRingAnode(i, PMUSR_UNDEFINED); // get/set setup take NXsample/temperature_1_env and NXsample/magnetic_field_1_env - sstr = nxs_file->GetEntryIdf2()->GetSample()->GetEnvironmentTemp() + string("/"); + sstr = nxs_file->GetEntryIdf2()->GetSample()->GetEnvironmentTemp() + std::string("/"); sstr += nxs_file->GetEntryIdf2()->GetSample()->GetEnvironmentField(); str = sstr; runData.SetSetup(str); @@ -2341,16 +2339,16 @@ Bool_t PRunDataHandler::ReadNexusFile() // keep the information fData.push_back(runData); } else { - cout << endl << ">> PRunDataHandler::ReadNexusFile(): IDF version " << nxs_file->GetIdfVersion() << ", not implemented." << endl; + std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): IDF version " << nxs_file->GetIdfVersion() << ", not implemented." << std::endl; } // clean up if (nxs_file) { delete nxs_file; - nxs_file = 0; + nxs_file = nullptr; } #else - cout << endl << ">> PRunDataHandler::ReadNexusFile(): Sorry, not enabled at configuration level, i.e. --enable-NeXus when executing configure" << endl << endl; + std::cout << std::endl << ">> PRunDataHandler::ReadNexusFile(): Sorry, not enabled at configuration level, i.e. --enable-NeXus when executing configure" << std::endl << std::endl; #endif return true; } @@ -2372,13 +2370,13 @@ Bool_t PRunDataHandler::ReadWkmFile() PRawRunData runData; // open file - ifstream f; + std::ifstream f; // open wkm-file - f.open(fRunPathName.Data(), ifstream::in); + f.open(fRunPathName.Data(), std::ifstream::in); if (!f.is_open()) { - cerr << endl << ">> PRunDataHandler::ReadWkmFile: **ERROR** Couldn't open run data (" << fRunPathName.Data() << ") file for reading, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile: **ERROR** Couldn't open run data (" << fRunPathName.Data() << ") file for reading, sorry ..."; + std::cerr << std::endl; return false; } @@ -2408,19 +2406,19 @@ Bool_t PRunDataHandler::ReadWkmFile() } else { // real stuff, hence filter data if (line.Contains("Title") || line.Contains("Titel")) { idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Title:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Title:' StripWhitespace(line); runData.SetRunTitle(line); } else if (line.Contains("Run:")) { idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Run:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Run:' StripWhitespace(line); ival = ToInt(line, ok); if (ok) runData.SetRunNumber(ival); } else if (line.Contains("Field")) { idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Field:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Field:' StripWhitespace(line); idx = line.Index("G"); // check if unit is given if (idx > 0) // unit is indeed given @@ -2430,13 +2428,13 @@ Bool_t PRunDataHandler::ReadWkmFile() runData.SetField(dval); } else if (line.Contains("Setup")) { idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Setup:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Setup:' StripWhitespace(line); runData.SetSetup(line); } else if (line.Contains("Temp:") || line.Contains("Temp(meas1):")) { linecp = line; idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Temp:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Temp:' StripWhitespace(line); idx = line.Index("+/-"); // remove "+/- ..." part if (idx > 0) @@ -2449,7 +2447,7 @@ Bool_t PRunDataHandler::ReadWkmFile() runData.SetTemperature(0, dval, 0.0); } idx = linecp.Index("+/-"); // get the error - linecp.Replace(0, idx+3, 0, 0); + linecp.Replace(0, idx+3, nullptr, 0); StripWhitespace(linecp); dval = ToDouble(linecp, ok); if (ok) { @@ -2458,7 +2456,7 @@ Bool_t PRunDataHandler::ReadWkmFile() } else if (line.Contains("Temp(meas2):")) { linecp = line; idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Temp(meas2):' + line.Replace(0, idx+1, nullptr, 0); // remove 'Temp(meas2):' StripWhitespace(line); idx = line.Index("+/-"); // remove "+/- ..." part if (idx > 0) @@ -2471,7 +2469,7 @@ Bool_t PRunDataHandler::ReadWkmFile() runData.SetTemperature(1, dval, 0.0); } idx = linecp.Index("+/-"); // get the error - linecp.Replace(0, idx+3, 0, 0); + linecp.Replace(0, idx+3, nullptr, 0); StripWhitespace(linecp); dval = ToDouble(linecp, ok); if (ok) { @@ -2479,21 +2477,21 @@ Bool_t PRunDataHandler::ReadWkmFile() } } else if (line.Contains("Groups")) { idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Groups:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Groups:' StripWhitespace(line); ival = ToInt(line, ok); if (ok) groups = ival; } else if (line.Contains("Channels")) { idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Channels:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Channels:' StripWhitespace(line); ival = ToInt(line, ok); if (ok) channels = ival; } else if (line.Contains("Resolution")) { idx = line.Index(":"); - line.Replace(0, idx+1, 0, 0); // remove 'Resolution:' + line.Replace(0, idx+1, nullptr, 0); // remove 'Resolution:' StripWhitespace(line); dval = ToDouble(line, ok); if (ok) @@ -2506,11 +2504,11 @@ Bool_t PRunDataHandler::ReadWkmFile() } while (headerInfo && !f.eof()); if ((groups == 0) || (channels == 0) || runData.GetTimeResolution() == 0.0) { - cerr << endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** essential header informations are missing!"; - cerr << endl << ">> groups = " << groups; - cerr << endl << ">> channels = " << channels; - cerr << endl << ">> time resolution = " << runData.GetTimeResolution(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** essential header informations are missing!"; + std::cerr << std::endl << ">> groups = " << groups; + std::cerr << std::endl << ">> channels = " << channels; + std::cerr << std::endl << ">> time resolution = " << runData.GetTimeResolution(); + std::cerr << std::endl; f.close(); return false; } @@ -2556,7 +2554,7 @@ Bool_t PRunDataHandler::ReadWkmFile() tokens = line.Tokenize(" "); if (!tokens) { // no tokens found - cerr << endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: coulnd't tokenize run data."; + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: coulnd't tokenize run data."; return false; } for (Int_t i=0; iGetEntries(); i++) { @@ -2566,7 +2564,7 @@ Bool_t PRunDataHandler::ReadWkmFile() if (ok) { histoData.push_back(val); } else { - cerr << endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: data line contains non-integer values."; + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: data line contains non-integer values."; // clean up delete tokens; return false; @@ -2575,7 +2573,7 @@ Bool_t PRunDataHandler::ReadWkmFile() // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } @@ -2589,7 +2587,7 @@ Bool_t PRunDataHandler::ReadWkmFile() line = TString(instr); tokens = line.Tokenize(" "); if (!tokens) { // no tokens found - cerr << endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: coulnd't tokenize run data."; + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: coulnd't tokenize run data."; return false; } for (Int_t i=0; iGetEntries(); i++) { @@ -2599,7 +2597,7 @@ Bool_t PRunDataHandler::ReadWkmFile() if (ok) { histoData.push_back(val); } else { - cerr << endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: data line contains non-integer values."; + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: data line contains non-integer values."; // clean up delete tokens; return false; @@ -2608,7 +2606,7 @@ Bool_t PRunDataHandler::ReadWkmFile() // clean up if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } @@ -2637,17 +2635,17 @@ Bool_t PRunDataHandler::ReadWkmFile() f.close(); // check if all groups are found - if ((Int_t) runData.GetNoOfHistos() != groups) { - cerr << endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR**"; - cerr << endl << ">> expected " << groups << " histos, but found " << runData.GetNoOfHistos(); + if (static_cast(runData.GetNoOfHistos()) != groups) { + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR**"; + std::cerr << std::endl << ">> expected " << groups << " histos, but found " << runData.GetNoOfHistos(); return false; } // check if all groups have enough channels for (UInt_t i=0; isize() != channels) { - cerr << endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR**"; - cerr << endl << ">> expected " << channels << " bins in histo " << i+1 << ", but found " << runData.GetDataBin(i)->size(); + if (static_cast(runData.GetDataBin(i+1)->size()) != channels) { + std::cerr << std::endl << ">> PRunDataHandler::ReadWkmFile(): **ERROR**"; + std::cerr << std::endl << ">> expected " << channels << " bins in histo " << i+1 << ", but found " << runData.GetDataBin(i)->size(); return false; } } @@ -2685,23 +2683,23 @@ Bool_t PRunDataHandler::ReadPsiBinFile() success = true; break; case 1: // couldn't open file, or failed while reading the header - cerr << endl << ">> **ERROR** couldn't open psi-bin file, or failed while reading the header"; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** couldn't open psi-bin file, or failed while reading the header"; + std::cerr << std::endl; success = false; break; case 2: // unsupported version of the data - cerr << endl << ">> **ERROR** psi-bin file: unsupported version of the data"; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** psi-bin file: unsupported version of the data"; + std::cerr << std::endl; success = false; break; case 3: // error when allocating data buffer - cerr << endl << ">> **ERROR** psi-bin file: error when allocating data buffer"; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** psi-bin file: error when allocating data buffer"; + std::cerr << std::endl; success = false; break; case 4: // number of histograms/record not equals 1 - cerr << endl << ">> **ERROR** psi-bin file: number of histograms/record not equals 1"; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** psi-bin file: number of histograms/record not equals 1"; + std::cerr << std::endl; success = false; break; default: // you never should have reached this point @@ -2784,9 +2782,9 @@ Bool_t PRunDataHandler::ReadPsiBinFile() runData.SetTransport(PMUSR_UNDEFINED); // get field Double_t scale = 0.0; - if (psiBin.get_field().rfind("G") != string::npos) + if (psiBin.get_field().rfind("G") != std::string::npos) scale = 1.0; - if (psiBin.get_field().rfind("T") != string::npos) + if (psiBin.get_field().rfind("T") != std::string::npos) scale = 1.0e4; status = sscanf(psiBin.get_field().c_str(), "%lf", &dval); if (status == 1) @@ -2812,15 +2810,15 @@ Bool_t PRunDataHandler::ReadPsiBinFile() runData.SetTimeResolution(psiBin.get_binWidth_ns()); // get start/stop time - vector sDateTime = psiBin.get_timeStart_vector(); + std::vector sDateTime = psiBin.get_timeStart_vector(); if (sDateTime.size() < 2) { - cerr << endl << ">> **WARNING** psi-bin file: couldn't obtain run start date/time" << endl; + std::cerr << std::endl << ">> **WARNING** psi-bin file: couldn't obtain run start date/time" << std::endl; } - string date(""); + std::string date(""); if (DateToISO8601(sDateTime[0], date)) { runData.SetStartDate(date); } else { - cerr << endl << ">> **WARNING** failed to convert start date: " << sDateTime[0] << " into ISO 8601 date." << endl; + std::cerr << std::endl << ">> **WARNING** failed to convert start date: " << sDateTime[0] << " into ISO 8601 date." << std::endl; runData.SetStartDate(sDateTime[0]); } runData.SetStartTime(sDateTime[1]); @@ -2828,13 +2826,13 @@ Bool_t PRunDataHandler::ReadPsiBinFile() sDateTime = psiBin.get_timeStop_vector(); if (sDateTime.size() < 2) { - cerr << endl << ">> **WARNING** psi-bin file: couldn't obtain run stop date/time" << endl; + std::cerr << std::endl << ">> **WARNING** psi-bin file: couldn't obtain run stop date/time" << std::endl; } - date = string(""); + date = std::string(""); if (DateToISO8601(sDateTime[0], date)) { runData.SetStopDate(date); } else { - cerr << endl << ">> **WARNING** failed to convert stop date: " << sDateTime[0] << " into ISO 8601 date." << endl; + std::cerr << std::endl << ">> **WARNING** failed to convert stop date: " << sDateTime[0] << " into ISO 8601 date." << std::endl; runData.SetStopDate(sDateTime[0]); } runData.SetStopTime(sDateTime[1]); @@ -2844,24 +2842,24 @@ Bool_t PRunDataHandler::ReadPsiBinFile() PIntVector t0 = psiBin.get_t0_vector(); if (t0.empty()) { - cerr << endl << ">> **ERROR** psi-bin file: couldn't obtain any t0's"; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** psi-bin file: couldn't obtain any t0's"; + std::cerr << std::endl; return false; } // get first good bin PIntVector fgb = psiBin.get_firstGood_vector(); if (fgb.empty()) { - cerr << endl << ">> **ERROR** psi-bin file: couldn't obtain any fgb's"; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** psi-bin file: couldn't obtain any fgb's"; + std::cerr << std::endl; return false; } // get last good bin PIntVector lgb = psiBin.get_lastGood_vector(); if (lgb.empty()) { - cerr << endl << ">> **ERROR** psi-bin file: couldn't obtain any lgb's"; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** psi-bin file: couldn't obtain any lgb's"; + std::cerr << std::endl; return false; } @@ -2889,12 +2887,12 @@ Bool_t PRunDataHandler::ReadPsiBinFile() dataSet.Clear(); dataSet.SetName(psiBin.get_nameHisto(i).c_str()); dataSet.SetHistoNo(i+1); // i.e. hist numbering starts at 1 - if (i < (Int_t)t0.size()) + if (i < static_cast(t0.size())) dataSet.SetTimeZeroBin(t0[i]); dataSet.SetTimeZeroBinEstimated(maxBin); - if (i < (Int_t)fgb.size()) + if (i < static_cast(fgb.size())) dataSet.SetFirstGoodBin(fgb[i]); - if (i < (Int_t)lgb.size()) + if (i < static_cast(lgb.size())) dataSet.SetLastGoodBin(lgb[i]); dataSet.SetData(histoData); @@ -2929,10 +2927,10 @@ Bool_t PRunDataHandler::ReadMudFile() PRawRunData runData; - fh = MUD_openRead((Char_t *)fRunPathName.Data(), &type); + fh = MUD_openRead((char*)fRunPathName.Data(), &type); if (fh == -1) { - cerr << endl << ">> **ERROR** Couldn't open mud-file " << fRunPathName.Data() << ", sorry."; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** Couldn't open mud-file " << fRunPathName.Data() << ", sorry."; + std::cerr << std::endl; return false; } @@ -2944,8 +2942,8 @@ Bool_t PRunDataHandler::ReadMudFile() // get/set the lab success = MUD_getLab( fh, str, sizeof(str) ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't obtain the laboratory name of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't obtain the laboratory name of run " << fRunName.Data(); + std::cerr << std::endl; strcpy(str, "n/a"); } runData.SetLaboratory(TString(str)); @@ -2953,8 +2951,8 @@ Bool_t PRunDataHandler::ReadMudFile() // get/set the beamline success = MUD_getArea( fh, str, sizeof(str) ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't obtain the beamline of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't obtain the beamline of run " << fRunName.Data(); + std::cerr << std::endl; strcpy(str, "n/a"); } runData.SetBeamline(TString(str)); @@ -2962,8 +2960,8 @@ Bool_t PRunDataHandler::ReadMudFile() // get/set the instrument success = MUD_getApparatus( fh, str, sizeof(str) ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't obtain the instrument name of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't obtain the instrument name of run " << fRunName.Data(); + std::cerr << std::endl; strcpy(str, "n/a"); } runData.SetInstrument(TString(str)); @@ -2971,15 +2969,15 @@ Bool_t PRunDataHandler::ReadMudFile() // get run title success = MUD_getTitle( fh, str, sizeof(str) ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't obtain the run title of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't obtain the run title of run " << fRunName.Data(); + std::cerr << std::endl; } runData.SetRunTitle(TString(str)); // get run number success = MUD_getRunNumber( fh, &val ); if (success) { - runData.SetRunNumber((Int_t)val); + runData.SetRunNumber(static_cast(val)); } // get start/stop time of the run @@ -2988,7 +2986,7 @@ Bool_t PRunDataHandler::ReadMudFile() TString stime(""); success = MUD_getTimeBegin( fh, (UINT32*)&tval ); if (success) { - runData.SetStartDateTime((const time_t)tval); + runData.SetStartDateTime(static_cast(tval)); dt = localtime((const time_t*)&tval); if (dt) { @@ -3002,7 +3000,7 @@ Bool_t PRunDataHandler::ReadMudFile() stime = str; runData.SetStartTime(stime); } else { - cerr << "PRunDataHandler::ReadMudFile: **WARNING** run start time readback wrong, will set it to 1900-01-01, 00:00:00" << endl; + std::cerr << "PRunDataHandler::ReadMudFile: **WARNING** run start time readback wrong, will set it to 1900-01-01, 00:00:00" << std::endl; stime = "1900-01-01"; runData.SetStartDate(stime); stime = "00:00:00"; @@ -3027,7 +3025,7 @@ Bool_t PRunDataHandler::ReadMudFile() stime = str; runData.SetStopTime(stime); } else { - cerr << "PRunDataHandler::ReadMudFile: **WARNING** run stop time readback wrong, will set it to 1900-01-01, 00:00:00" << endl; + std::cerr << "PRunDataHandler::ReadMudFile: **WARNING** run stop time readback wrong, will set it to 1900-01-01, 00:00:00" << std::endl; stime = "1900-01-01"; runData.SetStopDate(stime); stime = "00:00:00"; @@ -3046,7 +3044,7 @@ Bool_t PRunDataHandler::ReadMudFile() if (success) { setup += TString(str) + TString("/"); if (TString(str) == "BNQR" || TString(str) == "BNMR") { - cerr << "PRunDataHandler::ReadMudFile: **INFORMATION** this run was performed on " << str << endl; + std::cerr << "PRunDataHandler::ReadMudFile: **INFORMATION** this run was performed on " << str << std::endl; // identified BNMR/BNQR, correct time resolution. timeResMultiplier = 1.0e15; } @@ -3095,12 +3093,12 @@ Bool_t PRunDataHandler::ReadMudFile() // get number of histogramms success = MUD_getHists(fh, &type, &val); if ( !success ) { - cerr << endl << ">> **ERROR** Couldn't obtain the number of histograms of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **ERROR** Couldn't obtain the number of histograms of run " << fRunName.Data(); + std::cerr << std::endl; MUD_closeRead(fh); return false; } - Int_t noOfHistos = (Int_t)val; + Int_t noOfHistos = static_cast(val); // get time resolution (ns) // check that time resolution is identical for all histograms @@ -3111,9 +3109,9 @@ Bool_t PRunDataHandler::ReadMudFile() for (Int_t i=1; i<=noOfHistos; i++) { success = MUD_getHistSecondsPerBin( fh, i, &lrval ); if (!success) { - cerr << endl << ">> **ERROR** Couldn't obtain the time resolution of run " << fRunName.Data(); - cerr << endl << ">> which is fatal, sorry."; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** Couldn't obtain the time resolution of run " << fRunName.Data(); + std::cerr << std::endl << ">> which is fatal, sorry."; + std::cerr << std::endl; MUD_closeRead(fh); return false; } @@ -3121,16 +3119,16 @@ Bool_t PRunDataHandler::ReadMudFile() timeResolution = lrval; } else { if (lrval != timeResolution) { - cerr << endl << ">> **ERROR** various time resolutions found in run " << fRunName.Data(); - cerr << endl << ">> this is currently not supported, sorry."; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** various time resolutions found in run " << fRunName.Data(); + std::cerr << std::endl << ">> this is currently not supported, sorry."; + std::cerr << std::endl; MUD_closeRead(fh); return false; } } } - runData.SetTimeResolution((Double_t)timeResolution * timeResMultiplier); // s -> ns + runData.SetTimeResolution(static_cast(timeResolution) * timeResMultiplier); // s -> ns // An additional factor of 1e6 needed for bNMR // Check if it is a bNMR run and fix it or check if "timeres" line // was introduced in the msr file @@ -3138,7 +3136,7 @@ Bool_t PRunDataHandler::ReadMudFile() // read histograms UINT32 *pData; // histo memory - pData = NULL; + pData = nullptr; PDoubleVector histoData; PRawRunDataSet dataSet; UInt_t noOfBins; @@ -3151,61 +3149,61 @@ Bool_t PRunDataHandler::ReadMudFile() // get t0's success = MUD_getHistT0_Bin( fh, i, &val ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't get t0 of histo " << i << " of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't get t0 of histo " << i << " of run " << fRunName.Data(); + std::cerr << std::endl; } - dataSet.SetTimeZeroBin((Double_t)val); + dataSet.SetTimeZeroBin(static_cast(val)); // get bkg bins success = MUD_getHistBkgd1( fh, i, &val ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't get bkg bin 1 of histo " << i << " of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't get bkg bin 1 of histo " << i << " of run " << fRunName.Data(); + std::cerr << std::endl; val = 0; } - dataSet.SetFirstBkgBin((Int_t)val); + dataSet.SetFirstBkgBin(static_cast(val)); success = MUD_getHistBkgd2( fh, i, &val ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't get bkg bin 2 of histo " << i << " of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't get bkg bin 2 of histo " << i << " of run " << fRunName.Data(); + std::cerr << std::endl; val = 0; } - dataSet.SetLastBkgBin((Int_t)val); + dataSet.SetLastBkgBin(static_cast(val)); // get good data bins success = MUD_getHistGoodBin1( fh, i, &val ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't get good bin 1 of histo " << i << " of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't get good bin 1 of histo " << i << " of run " << fRunName.Data(); + std::cerr << std::endl; val = 0; } - dataSet.SetFirstGoodBin((Int_t)val); + dataSet.SetFirstGoodBin(static_cast(val)); success = MUD_getHistGoodBin2( fh, i, &val ); if ( !success ) { - cerr << endl << ">> **WARNING** Couldn't get good bin 2 of histo " << i << " of run " << fRunName.Data(); - cerr << endl; + std::cerr << std::endl << ">> **WARNING** Couldn't get good bin 2 of histo " << i << " of run " << fRunName.Data(); + std::cerr << std::endl; val = 0; } - dataSet.SetLastGoodBin((Int_t)val); + dataSet.SetLastGoodBin(static_cast(val)); // get number of bins success = MUD_getHistNumBins( fh, i, &val ); if ( !success ) { - cerr << endl << ">> **ERROR** Couldn't get the number of bins of histo " << i << "."; - cerr << endl << ">> This is fatal, sorry."; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** Couldn't get the number of bins of histo " << i << "."; + std::cerr << std::endl << ">> This is fatal, sorry."; + std::cerr << std::endl; MUD_closeRead( fh ); return false; } - noOfBins = (UInt_t)val; + noOfBins = static_cast(val); pData = (UINT32*)malloc(noOfBins*sizeof(pData)); - if (pData == NULL) { - cerr << endl << ">> **ERROR** Couldn't allocate memory for data."; - cerr << endl << ">> This is fatal, sorry."; - cerr << endl; + if (pData == nullptr) { + std::cerr << std::endl << ">> **ERROR** Couldn't allocate memory for data."; + std::cerr << std::endl << ">> This is fatal, sorry."; + std::cerr << std::endl; MUD_closeRead( fh ); return false; } @@ -3213,9 +3211,9 @@ Bool_t PRunDataHandler::ReadMudFile() // get histogram success = MUD_getHistData( fh, i, pData ); if ( !success ) { - cerr << endl << ">> **ERROR** Couldn't get histo no " << i << "."; - cerr << endl << ">> This is fatal, sorry."; - cerr << endl; + std::cerr << std::endl << ">> **ERROR** Couldn't get histo no " << i << "."; + std::cerr << std::endl << ">> This is fatal, sorry."; + std::cerr << std::endl; MUD_closeRead( fh ); return false; } @@ -3285,13 +3283,13 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() Bool_t success = true; // open file - ifstream f; + std::ifstream f; // open data-file - f.open(fRunPathName.Data(), ifstream::in); + f.open(fRunPathName.Data(), std::ifstream::in); if (!f.is_open()) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ..."; + std::cerr << std::endl; return false; } @@ -3307,12 +3305,12 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() Bool_t dataTag = false; Int_t dataLineCounter = 0; TObjString *ostr; - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; TString str; Int_t groups = 0; Int_t channels = 0; Double_t dval = 0.0, unitScaling = 0.0; - vector data; + std::vector data; while (!f.eof()) { f.getline(instr, sizeof(instr)); @@ -3354,9 +3352,9 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() tokens = workStr.Tokenize(":("); // field: val (units) // check if expected number of tokens present if (tokens->GetEntries() != 3) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", invalid field entry in header."; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", invalid field entry in header."; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3365,9 +3363,9 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() if (ostr->GetString().IsFloat()) { dval = ostr->GetString().Atof(); } else { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", field value is not float/doulbe."; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", field value is not float/doulbe."; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3378,9 +3376,9 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() else if (ostr->GetString().Contains("T")) unitScaling = 1.0e4; else { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", unkown field units."; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", unkown field units."; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3389,15 +3387,15 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (workStr.BeginsWith("temp:", TString::kIgnoreCase)) { tokens = workStr.Tokenize(":("); // temp: val (units) // check if expected number of tokens present if (tokens->GetEntries() != 3) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", invalid temperatue entry in header."; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", invalid temperatue entry in header."; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3406,9 +3404,9 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() if (ostr->GetString().IsFloat()) { dval = ostr->GetString().Atof(); } else { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", temperature value is not float/doulbe."; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", temperature value is not float/doulbe."; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3417,7 +3415,7 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else if (workStr.BeginsWith("setup:", TString::kIgnoreCase)) { runData.SetSetup(TString(workStr.Data()+workStr.First(":")+2)); @@ -3425,8 +3423,8 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() workStr = TString(workStr.Data()+workStr.First(":")+2); groups = workStr.Atoi(); if (groups == 0) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", groups is not a number or 0."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", groups is not a number or 0."; + std::cerr << std::endl; success = false; break; } @@ -3435,8 +3433,8 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() workStr = TString(workStr.Data()+workStr.First(":")+2); channels = workStr.Atoi(); if (channels == 0) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", channels is not a number or 0."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", channels is not a number or 0."; + std::cerr << std::endl; success = false; break; } @@ -3444,9 +3442,9 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() tokens = workStr.Tokenize(":("); // resolution: val (units) // check if expected number of tokens present if (tokens->GetEntries() != 3) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", invalid time resolution entry in header."; - cerr << endl << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", invalid time resolution entry in header."; + std::cerr << std::endl << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3455,9 +3453,9 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() if (ostr->GetString().IsFloat()) { dval = ostr->GetString().Atof(); } else { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", time resolution value is not float/doulbe."; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", time resolution value is not float/doulbe."; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3472,9 +3470,9 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() else if (ostr->GetString().Contains("us")) unitScaling = 1.0e3; else { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", unkown time resolution units."; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", unkown time resolution units."; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3483,11 +3481,11 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } else { // error - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", illegal header line."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** line no " << lineNo << ", illegal header line."; + std::cerr << std::endl; success = false; break; } @@ -3496,10 +3494,10 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() tokens = line.Tokenize(" ,\t"); // check if the number of data line entries is correct if (tokens->GetEntries() != groups+1) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** found data line with a wrong data format, cannot be handled (line no " << lineNo << ")"; - cerr << endl << ">> line:"; - cerr << endl << ">> " << line.Data(); - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **ERROR** found data line with a wrong data format, cannot be handled (line no " << lineNo << ")"; + std::cerr << std::endl << ">> line:"; + std::cerr << std::endl << ">> " << line.Data(); + std::cerr << std::endl; success = false; break; } @@ -3512,7 +3510,7 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } } } @@ -3545,8 +3543,8 @@ Bool_t PRunDataHandler::ReadMduAsciiFile() data.clear(); if (dataLineCounter != channels) { - cerr << endl << ">> PRunDataHandler::ReadMduAsciiFile **WARNING** found " << dataLineCounter << " data bins,"; - cerr << endl << ">> expected " << channels << " according to the header." << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadMduAsciiFile **WARNING** found " << dataLineCounter << " data bins,"; + std::cerr << std::endl << ">> expected " << channels << " according to the header." << std::endl; } fData.push_back(runData); @@ -3598,13 +3596,13 @@ Bool_t PRunDataHandler::ReadAsciiFile() Bool_t success = true; // open file - ifstream f; + std::ifstream f; // open data-file - f.open(fRunPathName.Data(), ifstream::in); + f.open(fRunPathName.Data(), std::ifstream::in); if (!f.is_open()) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ..."; + std::cerr << std::endl; return false; } @@ -3664,8 +3662,8 @@ Bool_t PRunDataHandler::ReadAsciiFile() } else if (workStr.BeginsWith("field:", TString::kIgnoreCase)) { workStr = TString(workStr.Data()+workStr.First(":")+2); if (!workStr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", field is not a number."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", field is not a number."; + std::cerr << std::endl; success = false; break; } @@ -3677,8 +3675,8 @@ Bool_t PRunDataHandler::ReadAsciiFile() } else if (workStr.BeginsWith("temp:", TString::kIgnoreCase)) { workStr = TString(workStr.Data()+workStr.First(":")+2); if (!workStr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", temperature is not a number."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", temperature is not a number."; + std::cerr << std::endl; success = false; break; } @@ -3686,16 +3684,16 @@ Bool_t PRunDataHandler::ReadAsciiFile() } else if (workStr.BeginsWith("energy:", TString::kIgnoreCase)) { workStr = TString(workStr.Data()+workStr.First(":")+2); if (!workStr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", energy is not a number."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", energy is not a number."; + std::cerr << std::endl; success = false; break; } runData.SetEnergy(workStr.Atof()); runData.SetTransport(PMUSR_UNDEFINED); // just to initialize the variables to some "meaningful" value } else { // error - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", illegal header line."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ", illegal header line."; + std::cerr << std::endl; success = false; break; } @@ -3712,8 +3710,8 @@ Bool_t PRunDataHandler::ReadAsciiFile() tokens = line.Tokenize(" ,\t"); // check if the number of data line entries is 2 or 3 if ((tokens->GetEntries() != 2) && (tokens->GetEntries() != 3)) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** found data line with a structure different than \"x, y [, error y]\", cannot be handled (line no " << lineNo << ")"; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** found data line with a structure different than \"x, y [, error y]\", cannot be handled (line no " << lineNo << ")"; + std::cerr << std::endl; success = false; break; } @@ -3721,8 +3719,8 @@ Bool_t PRunDataHandler::ReadAsciiFile() // get x ostr = dynamic_cast(tokens->At(0)); if (!ostr->GetString().IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ": x = " << ostr->GetString().Data() << " is not a number, sorry."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ": x = " << ostr->GetString().Data() << " is not a number, sorry."; + std::cerr << std::endl; success = false; break; } @@ -3731,8 +3729,8 @@ Bool_t PRunDataHandler::ReadAsciiFile() // get y ostr = dynamic_cast(tokens->At(1)); if (!ostr->GetString().IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ": y = " << ostr->GetString().Data() << " is not a number, sorry."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ": y = " << ostr->GetString().Data() << " is not a number, sorry."; + std::cerr << std::endl; success = false; break; } @@ -3742,8 +3740,8 @@ Bool_t PRunDataHandler::ReadAsciiFile() if (tokens->GetEntries() == 3) { ostr = dynamic_cast(tokens->At(2)); if (!ostr->GetString().IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ": error y = " << ostr->GetString().Data() << " is not a number, sorry."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << ": error y = " << ostr->GetString().Data() << " is not a number, sorry."; + std::cerr << std::endl; success = false; break; } @@ -3755,7 +3753,7 @@ Bool_t PRunDataHandler::ReadAsciiFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } // keep values @@ -3765,8 +3763,8 @@ Bool_t PRunDataHandler::ReadAsciiFile() eyVec.push_back(ey); } else { - cerr << endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << " neither header nor data line. No idea how to handle it!"; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadAsciiFile **ERROR** line no " << lineNo << " neither header nor data line. No idea how to handle it!"; + std::cerr << std::endl; success = false; break; } @@ -3909,13 +3907,13 @@ Bool_t PRunDataHandler::ReadDBFile() Bool_t success = true; // open file - ifstream f; + std::ifstream f; // open db-file - f.open(fRunPathName.Data(), ifstream::in); + f.open(fRunPathName.Data(), std::ifstream::in); if (!f.is_open()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ..."; + std::cerr << std::endl; return false; } @@ -3936,7 +3934,7 @@ Bool_t PRunDataHandler::ReadDBFile() // variables needed to tokenize strings TString tstr; TObjString *ostr; - TObjArray *tokens = 0; + TObjArray *tokens = nullptr; while (!f.eof()) { // get next line from file @@ -3981,7 +3979,7 @@ Bool_t PRunDataHandler::ReadDBFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } continue; } @@ -4021,7 +4019,7 @@ Bool_t PRunDataHandler::ReadDBFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } // prepare data vector for use @@ -4041,9 +4039,9 @@ Bool_t PRunDataHandler::ReadDBFile() TString run("run"); idx = GetDataTagIndex(run, runData.fDataNonMusr.GetDataTags()); if (idx == -1) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> found potential run data line without run data tag."; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> found potential run data line without run data tag."; return false; } // split string in tokens @@ -4051,10 +4049,10 @@ Bool_t PRunDataHandler::ReadDBFile() ostr = dynamic_cast(tokens->At(0)); tstr = ostr->GetString(); if (!tstr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: runNo,,, runTitle"; - cerr << endl << ">> runNo = " << tstr.Data() << ", seems to be not a number."; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: runNo,,, runTitle"; + std::cerr << std::endl << ">> runNo = " << tstr.Data() << ", seems to be not a number."; delete tokens; return false; } @@ -4067,9 +4065,9 @@ Bool_t PRunDataHandler::ReadDBFile() // split string in tokens tokens = workStr.Tokenize("=,"); // line has structure: tag = val,err1,err2, if (tokens->GetEntries() < 3) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; delete tokens; return false; } @@ -4077,9 +4075,9 @@ Bool_t PRunDataHandler::ReadDBFile() tstr = ostr->GetString(); idx = GetDataTagIndex(tstr, runData.fDataNonMusr.GetDataTags()); if (idx == -1) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> data tag error: " << tstr.Data() << " seems not present in the data tag list"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> data tag error: " << tstr.Data() << " seems not present in the data tag list"; delete tokens; return false; } @@ -4089,10 +4087,10 @@ Bool_t PRunDataHandler::ReadDBFile() ostr = dynamic_cast(tokens->At(1)); tstr = ostr->GetString(); if (!tstr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; - cerr << endl << ">> val = " << tstr.Data() << ", seems to be not a number."; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; + std::cerr << std::endl << ">> val = " << tstr.Data() << ", seems to be not a number."; delete tokens; return false; } @@ -4106,10 +4104,10 @@ Bool_t PRunDataHandler::ReadDBFile() ostr = dynamic_cast(tokens->At(1)); tstr = ostr->GetString(); if (!tstr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; - cerr << endl << ">> val = " << tstr.Data() << ", seems to be not a number."; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; + std::cerr << std::endl << ">> val = " << tstr.Data() << ", seems to be not a number."; delete tokens; return false; } @@ -4119,10 +4117,10 @@ Bool_t PRunDataHandler::ReadDBFile() ostr = dynamic_cast(tokens->At(2)); tstr = ostr->GetString(); if (!tstr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; - cerr << endl << ">> err1 = " << tstr.Data() << ", seems to be not a number."; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; + std::cerr << std::endl << ">> err1 = " << tstr.Data() << ", seems to be not a number."; delete tokens; return false; } @@ -4130,24 +4128,23 @@ Bool_t PRunDataHandler::ReadDBFile() runData.fDataNonMusr.AppendSubErrData(idx, val); break; default: - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: tag = val,err1,err2,\\"; delete tokens; return false; - break; } } } else { // handle row formated data // split string in tokens tokens = workStr.Tokenize(","); // line has structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle - if (tokens->GetEntries() != (Int_t)(3*runData.fDataNonMusr.GetDataTags()->size()+1)) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle"; - cerr << endl << ">> found = " << tokens->GetEntries() << " tokens, however expected " << 3*runData.fDataNonMusr.GetDataTags()->size()+1; - cerr << endl << ">> Perhaps there are commas without space inbetween, like 12.3,, 3.2,..."; + if (tokens->GetEntries() != static_cast(3*runData.fDataNonMusr.GetDataTags()->size()+1)) { + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle"; + std::cerr << std::endl << ">> found = " << tokens->GetEntries() << " tokens, however expected " << 3*runData.fDataNonMusr.GetDataTags()->size()+1; + std::cerr << std::endl << ">> Perhaps there are commas without space inbetween, like 12.3,, 3.2,..."; delete tokens; return false; } @@ -4158,10 +4155,10 @@ Bool_t PRunDataHandler::ReadDBFile() ostr = dynamic_cast(tokens->At(i)); tstr = ostr->GetString(); if (!tstr.IsFloat()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle"; - cerr << endl << ">> value=" << tstr.Data() << " seems not to be a number"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle"; + std::cerr << std::endl << ">> value=" << tstr.Data() << " seems not to be a number"; delete tokens; return false; } @@ -4175,10 +4172,10 @@ Bool_t PRunDataHandler::ReadDBFile() } else if (tstr.IsFloat()) { runData.fDataNonMusr.AppendSubErrData(j, tstr.Atof()); } else { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; - cerr << endl << ">> " << workStr.Data(); - cerr << endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle"; - cerr << endl << ">> error1=" << tstr.Data() << " seems not to be a number"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":"; + std::cerr << std::endl << ">> " << workStr.Data(); + std::cerr << std::endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle"; + std::cerr << std::endl << ">> error1=" << tstr.Data() << " seems not to be a number"; delete tokens; return false; } @@ -4195,13 +4192,13 @@ Bool_t PRunDataHandler::ReadDBFile() // check that the number of labels == the number of data tags if (runData.fDataNonMusr.GetLabels()->size() != runData.fDataNonMusr.GetDataTags()->size()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR**"; - cerr << endl << ">> number of LABELS found = " << runData.fDataNonMusr.GetLabels()->size(); - cerr << endl << ">> number of Data tags found = " << runData.fDataNonMusr.GetDataTags()->size(); - cerr << endl << ">> They have to be equal!!"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR**"; + std::cerr << std::endl << ">> number of LABELS found = " << runData.fDataNonMusr.GetLabels()->size(); + std::cerr << std::endl << ">> number of Data tags found = " << runData.fDataNonMusr.GetDataTags()->size(); + std::cerr << std::endl << ">> They have to be equal!!"; if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } return false; } @@ -4209,18 +4206,18 @@ Bool_t PRunDataHandler::ReadDBFile() // check if all vectors have the same size for (UInt_t i=1; isize(); i++) { if (runData.fDataNonMusr.GetData()->at(i).size() != runData.fDataNonMusr.GetData()->at(i-1).size()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo; - cerr << endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i-1).Data() << ", number data elements = " << runData.fDataNonMusr.GetData()->at(i-1).size(); - cerr << endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i).Data() << ", number data elements = " << runData.fDataNonMusr.GetData()->at(i).size(); - cerr << endl << ">> They have to be equal!!"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo; + std::cerr << std::endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i-1).Data() << ", number data elements = " << runData.fDataNonMusr.GetData()->at(i-1).size(); + std::cerr << std::endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i).Data() << ", number data elements = " << runData.fDataNonMusr.GetData()->at(i).size(); + std::cerr << std::endl << ">> They have to be equal!!"; success = false; break; } if (runData.fDataNonMusr.GetErrData()->at(i).size() != runData.fDataNonMusr.GetErrData()->at(i-1).size()) { - cerr << endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo; - cerr << endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i-1).Data() << ", number data elements = " << runData.fDataNonMusr.GetData()->at(i-1).size(); - cerr << endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i).Data() << ", number error data elements = " << runData.fDataNonMusr.GetErrData()->at(i).size(); - cerr << endl << ">> They have to be equal!!"; + std::cerr << std::endl << ">> PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo; + std::cerr << std::endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i-1).Data() << ", number data elements = " << runData.fDataNonMusr.GetData()->at(i-1).size(); + std::cerr << std::endl << ">> label: " << runData.fDataNonMusr.GetDataTags()->at(i).Data() << ", number error data elements = " << runData.fDataNonMusr.GetErrData()->at(i).size(); + std::cerr << std::endl << ">> They have to be equal!!"; success = false; break; } @@ -4229,7 +4226,7 @@ Bool_t PRunDataHandler::ReadDBFile() // clean up tokens if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } // keep run name @@ -4260,7 +4257,7 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) return false; if (!fAny2ManyInfo->useStandardOutput) - cout << endl << ">> PRunDataHandler::WriteMusrRootFile(): writing a root data file (" << fln.Data() << ") ... " << endl; + std::cout << std::endl << ">> PRunDataHandler::WriteMusrRootFile(): writing a root data file (" << fln.Data() << ") ... " << std::endl; // generate data file TFolder *histosFolder; @@ -4325,7 +4322,7 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) dval[0] = fData[0].GetField(); prop.Set("Sample Magnetic Field", dval[0], "G"); header->Set("RunInfo/Sample Magnetic Field", prop); - header->Set("RunInfo/No of Histos", (Int_t)fData[0].GetNoOfHistos()); + header->Set("RunInfo/No of Histos", static_cast(fData[0].GetNoOfHistos())); dval[0] = fData[0].GetTimeResolution(); prop.Set("Time Resolution", dval[0], "ns"); header->Set("RunInfo/Time Resolution", prop); @@ -4337,9 +4334,9 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) UInt_t size = fData[0].GetNoOfHistos(); for (UInt_t i=0; i> PRunDataHandler::WriteMusrRootFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteMusrRootFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } histoNo = dataSet->GetHistoNo(); @@ -4351,15 +4348,15 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) pathName.Form("DetectorInfo/Detector%03d/Histo Number", histoNo); header->Set(pathName, histoNo); pathName.Form("DetectorInfo/Detector%03d/Histo Length", histoNo); - header->Set(pathName, (Int_t)(dataSet->GetData()->size()/fAny2ManyInfo->rebin)); + header->Set(pathName, static_cast(dataSet->GetData()->size()/fAny2ManyInfo->rebin)); pathName.Form("DetectorInfo/Detector%03d/Time Zero Bin", histoNo); header->Set(pathName, dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin); pathName.Form("DetectorInfo/Detector%03d/First Good Bin", histoNo); ival = dataSet->GetFirstGoodBin(); - header->Set(pathName, (Int_t)(ival/fAny2ManyInfo->rebin)); + header->Set(pathName, static_cast(ival/fAny2ManyInfo->rebin)); pathName.Form("DetectorInfo/Detector%03d/Last Good Bin", histoNo); ival = dataSet->GetLastGoodBin(); - header->Set(pathName, (Int_t)(ival/fAny2ManyInfo->rebin)); + header->Set(pathName, static_cast(ival/fAny2ManyInfo->rebin)); } // feed SampleEnvironmentInfo @@ -4375,20 +4372,20 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) header->Set("BeamlineInfo/Name", str); // feed histos - vector histos; - TH1F *histo = 0; + std::vector histos; + TH1F *histo = nullptr; UInt_t length = 0; if (fAny2ManyInfo->rebin == 1) { for (UInt_t i=0; i> PRunDataHandler::WriteMusrRootFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteMusrRootFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } str.Form("hDecay%03d", dataSet->GetHistoNo()); length = dataSet->GetData()->size(); - histo = new TH1F(str.Data(), str.Data(), length+1, -0.5, (Double_t)length+0.5); + histo = new TH1F(str.Data(), str.Data(), length+1, -0.5, static_cast(length)+0.5); for (UInt_t j=0; jSetBinContent(j+1, dataSet->GetData()->at(j)); } @@ -4399,14 +4396,14 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) UInt_t dataCount = 0; for (UInt_t i=0; i> PRunDataHandler::WriteMusrRootFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteMusrRootFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } str.Form("hDecay%03d", dataSet->GetHistoNo()); length = dataSet->GetData()->size(); - histo = new TH1F(str.Data(), str.Data(), (Int_t)(length/fAny2ManyInfo->rebin)+1, -0.5, (Double_t)((Int_t)(length/fAny2ManyInfo->rebin))+0.5); + histo = new TH1F(str.Data(), str.Data(), static_cast(length/fAny2ManyInfo->rebin)+1, -0.5, static_cast(static_cast(length/fAny2ManyInfo->rebin))+0.5); dataCount = 0; for (UInt_t j=0; j 0) && (j % fAny2ManyInfo->rebin == 0)) { @@ -4426,8 +4423,8 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) // write file TFile *fout = new TFile(fln, "RECREATE", fln); - if (fout == 0) { - cerr << endl << "PRunDataHandler::WriteMusrRootFile(): **ERROR** Couldn't create ROOT file '" << fln << "'" << endl; + if (fout == nullptr) { + std::cerr << std::endl << "PRunDataHandler::WriteMusrRootFile(): **ERROR** Couldn't create ROOT file '" << fln << "'" << std::endl; return false; } @@ -4440,24 +4437,24 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) // check if root file shall be streamed to stdout if (fAny2ManyInfo->useStandardOutput && (fAny2ManyInfo->compressionTag == 0)) { // stream file to stdout - ifstream is; + std::ifstream is; int length=1024; char *buffer; - is.open(fln.Data(), ios::binary); + is.open(fln.Data(), std::ios::binary); if (!is.is_open()) { - cerr << endl << "PRunDataHandler::WriteMusrRootFile(): **ERROR** Couldn't open the root-file for streaming." << endl; + std::cerr << std::endl << "PRunDataHandler::WriteMusrRootFile(): **ERROR** Couldn't open the root-file for streaming." << std::endl; remove(fln.Data()); return false; } // get length of file - is.seekg(0, ios::end); + is.seekg(0, std::ios::end); length = is.tellg(); - is.seekg(0, ios::beg); + is.seekg(0, std::ios::beg); if (length == -1) { - cerr << endl << "PRunDataHandler::WriteMusrRootFile(): **ERROR** Couldn't determine the root-file size." << endl; + std::cerr << std::endl << "PRunDataHandler::WriteMusrRootFile(): **ERROR** Couldn't determine the root-file size." << std::endl; remove(fln.Data()); return false; } @@ -4468,7 +4465,7 @@ Bool_t PRunDataHandler::WriteMusrRootFile(TString fln) // read data as a block while (!is.eof()) { is.read(buffer, length); - cout.write(buffer, length); + std::cout.write(buffer, length); } is.close(); @@ -4503,7 +4500,7 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln) if (!fAny2ManyInfo->useStandardOutput) - cout << endl << ">> PRunDataHandler::WriteRootFile(): writing a root data file (" << fln.Data() << ") ... " << endl; + std::cout << std::endl << ">> PRunDataHandler::WriteRootFile(): writing a root data file (" << fln.Data() << ") ... " << std::endl; // generate data file TFolder *histosFolder; @@ -4544,8 +4541,8 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln) // feed t0's if possible UInt_t NoT0s = fData[0].GetNoOfHistos(); if (fData[0].GetNoOfHistos() > NHIST) { - cerr << endl << ">> PRunDataHandler::WriteRootFile: **WARNING** found more T0's (" << NoT0s << ") than can be handled (" << NHIST << ")."; - cerr << endl << ">> Will only write the first " << NHIST << " T0s!!" << endl; + std::cerr << std::endl << ">> PRunDataHandler::WriteRootFile: **WARNING** found more T0's (" << NoT0s << ") than can be handled (" << NHIST << ")."; + std::cerr << std::endl << ">> Will only write the first " << NHIST << " T0s!!" << std::endl; NoT0s = NHIST; } Double_t *tt0 = new Double_t[NoT0s]; @@ -4558,20 +4555,20 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln) runInfo->Add(header); // add header to RunInfo folder // feed histos - vector histos; - TH1F *histo = 0; + std::vector histos; + TH1F *histo = nullptr; Char_t str[32]; UInt_t size = 0; if (fAny2ManyInfo->rebin == 1) { for (UInt_t i=0; i> PRunDataHandler::WriteRootFile: **ERROR** Couldn't get data set (idx=0" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteRootFile: **ERROR** Couldn't get data set (idx=0" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } size = dataSet->GetData()->size(); - sprintf(str, "hDecay%02d", (Int_t)i); + sprintf(str, "hDecay%02d", static_cast(i)); histo = new TH1F(str, str, size+1, -0.5, static_cast(size)+0.5); for (UInt_t j=0; jSetBinContent(j+1, dataSet->GetData()->at(j)); @@ -4583,14 +4580,14 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln) UInt_t dataCount = 0; for (UInt_t i=0; i> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=0" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=0" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } size = dataSet->GetData()->size(); - sprintf(str, "hDecay%02d", (Int_t)i); - histo = new TH1F(str, str, (UInt_t)(size/fAny2ManyInfo->rebin)+1, -0.5, (Double_t)size/(Double_t)fAny2ManyInfo->rebin+0.5); + sprintf(str, "hDecay%02d", static_cast(i)); + histo = new TH1F(str, str, static_cast(size/fAny2ManyInfo->rebin)+1, -0.5, static_cast(size)/static_cast(fAny2ManyInfo->rebin)+0.5); dataCount = 0; for (UInt_t j=0; j 0) && (j % fAny2ManyInfo->rebin == 0)) { @@ -4610,8 +4607,8 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln) // write file TFile *fout = new TFile(fln, "RECREATE", fln); - if (fout == 0) { - cerr << endl << "PRunDataHandler::WriteRootFile(): **ERROR** Couldn't create ROOT file '" << fln << "'" << endl; + if (fout == nullptr) { + std::cerr << std::endl << "PRunDataHandler::WriteRootFile(): **ERROR** Couldn't create ROOT file '" << fln << "'" << std::endl; return false; } @@ -4632,24 +4629,24 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln) // check if root file shall be streamed to stdout if (fAny2ManyInfo->useStandardOutput && (fAny2ManyInfo->compressionTag == 0)) { // stream file to stdout - ifstream is; + std::ifstream is; int length=1024; char *buffer; - is.open(fln.Data(), ios::binary); + is.open(fln.Data(), std::ios::binary); if (!is.is_open()) { - cerr << endl << "PRunDataHandler::WriteRootFile(): **ERROR** Couldn't open the root-file for streaming." << endl; + std::cerr << std::endl << "PRunDataHandler::WriteRootFile(): **ERROR** Couldn't open the root-file for streaming." << std::endl; remove(fln.Data()); return false; } // get length of file - is.seekg(0, ios::end); + is.seekg(0, std::ios::end); length = is.tellg(); - is.seekg(0, ios::beg); + is.seekg(0, std::ios::beg); if (length == -1) { - cerr << endl << "PRunDataHandler::WriteRootFile(): **ERROR** Couldn't determine the root-file size." << endl; + std::cerr << std::endl << "PRunDataHandler::WriteRootFile(): **ERROR** Couldn't determine the root-file size." << std::endl; remove(fln.Data()); return false; } @@ -4660,7 +4657,7 @@ Bool_t PRunDataHandler::WriteRootFile(TString fln) // read data as a block while (!is.eof()) { is.read(buffer, length); - cout.write(buffer, length); + std::cout.write(buffer, length); } is.close(); @@ -4695,12 +4692,12 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) return false; if (!fAny2ManyInfo->useStandardOutput) - cout << endl << ">> PRunDataHandler::WriteNexusFile(): writing a NeXus data file (" << fln.Data() << ") ... " << endl; + std::cout << std::endl << ">> PRunDataHandler::WriteNexusFile(): writing a NeXus data file (" << fln.Data() << ") ... " << std::endl; // create NeXus object PNeXus *nxs = new PNeXus(); - if (nxs == 0) { - cerr << endl << ">> PRunDataHandler::WriteNexusFile(): **ERROR** couldn't invoke the NeXus object." << endl; + if (nxs == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile(): **ERROR** couldn't invoke the NeXus object." << std::endl; return false; } @@ -4716,10 +4713,10 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) struct tm *tm; time(&now); tm = localtime(&now); - string str(""); + std::string str(""); char cstr[128]; strftime(cstr, sizeof(cstr), "%FT%T", tm); - str = string(cstr); + str = std::string(cstr); nxs->SetFileTime(str); nxs->GetEntryIdf1()->SetProgramName("any2many"); @@ -4732,9 +4729,9 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) nxs->GetEntryIdf1()->SetLaboratory(fData[0].GetLaboratory()->Data()); if (*fData[0].GetBeamline() != "n/a") nxs->GetEntryIdf1()->SetBeamline(fData[0].GetBeamline()->Data()); - str = string(fData[0].GetStartDate()->Data()) + string("T") + string(fData[0].GetStartTime()->Data()); + str = std::string(fData[0].GetStartDate()->Data()) + std::string("T") + std::string(fData[0].GetStartTime()->Data()); nxs->GetEntryIdf1()->SetStartTime(str); - str = string(fData[0].GetStopDate()->Data()) + string("T") + string(fData[0].GetStopTime()->Data()); + str = std::string(fData[0].GetStopDate()->Data()) + std::string("T") + std::string(fData[0].GetStopTime()->Data()); nxs->GetEntryIdf1()->SetStopTime(str); nxs->GetEntryIdf1()->SetSwitchingState(1); nxs->GetEntryIdf1()->GetUser()->SetName("n/a"); @@ -4751,12 +4748,12 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) nxs->GetEntryIdf1()->GetInstrument()->GetCollimator()->SetType("n/a"); // calculate the total number of counts double total_counts = 0; - PRawRunDataSet *dataSet = 0; + PRawRunDataSet *dataSet = nullptr; for (unsigned int i=0; i> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=0" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=0" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } for (unsigned int j=0; jGetData()->size(); j++) @@ -4770,9 +4767,9 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) for (unsigned int i=0; iGetEntryIdf1()->GetData()->SetT0((Int_t)(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin), i); - nxs->GetEntryIdf1()->GetData()->SetFirstGoodBin((Int_t)(dataSet->GetFirstGoodBin()/fAny2ManyInfo->rebin), i); - nxs->GetEntryIdf1()->GetData()->SetLastGoodBin((Int_t)(dataSet->GetLastGoodBin()/fAny2ManyInfo->rebin), i); + nxs->GetEntryIdf1()->GetData()->SetT0(static_cast(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin), i); + nxs->GetEntryIdf1()->GetData()->SetFirstGoodBin(static_cast(dataSet->GetFirstGoodBin()/fAny2ManyInfo->rebin), i); + nxs->GetEntryIdf1()->GetData()->SetLastGoodBin(static_cast(dataSet->GetLastGoodBin()/fAny2ManyInfo->rebin), i); } // feed histos @@ -4781,9 +4778,9 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) if (fAny2ManyInfo->rebin == 1) { for (UInt_t i=0; i> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } size = dataSet->GetData()->size(); @@ -4798,9 +4795,9 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) UInt_t dataCount = 0; for (UInt_t i=0; i> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } size = dataSet->GetData()->size(); @@ -4826,10 +4823,10 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) struct tm *tm; time(&now); tm = localtime(&now); - string str(""); + std::string str(""); char cstr[128]; strftime(cstr, sizeof(cstr), "%FT%T", tm); - str = string(cstr); + str = std::string(cstr); nxs->SetFileTime(str); // NXroot info @@ -4841,9 +4838,9 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) nxs->GetEntryIdf2()->SetProgramVersion("$Id$"); nxs->GetEntryIdf2()->SetRunNumber(fData[0].GetRunNumber()); nxs->GetEntryIdf2()->SetTitle(fData[0].GetRunTitle()->Data()); - str = string(fData[0].GetStartDate()->Data()) + string("T") + string(fData[0].GetStartTime()->Data()); + str = std::string(fData[0].GetStartDate()->Data()) + std::string("T") + std::string(fData[0].GetStartTime()->Data()); nxs->GetEntryIdf2()->SetStartTime(str); - str = string(fData[0].GetStopDate()->Data()) + string("T") + string(fData[0].GetStopTime()->Data()); + str = std::string(fData[0].GetStopDate()->Data()) + std::string("T") + std::string(fData[0].GetStopTime()->Data()); nxs->GetEntryIdf2()->SetStopTime(str); nxs->GetEntryIdf2()->SetExperimentIdentifier("n/a"); @@ -4875,23 +4872,23 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfPeriods(0); // currently red/green is not distinguished nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfSpectra(fData[0].GetNoOfHistos()); PRawRunDataSet *dataSet = fData[0].GetDataSet(0, false); // i.e. the false means, that i is the index and NOT the histo number - if (dataSet == 0) { // something is really wrong - cerr << endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=0)"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=0)"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetNoOfBins((unsigned int)(dataSet->GetData()->size() / fAny2ManyInfo->rebin)); nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetTimeResolution(fData[0].GetTimeResolution()*fAny2ManyInfo->rebin, "ns"); - int *histo = 0; + int *histo = nullptr; int idx = 0; if (fAny2ManyInfo->rebin == 1) { histo = new int[fData[0].GetNoOfHistos()*dataSet->GetData()->size()]; idx = 0; for (int i=0; iGetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); i++) { dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number - if (dataSet == 0) { // something is really wrong - cerr << endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } for (unsigned int j=0; jGetData()->size(); j++) { @@ -4902,7 +4899,7 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) // clean up if (histo) { delete [] histo; - histo = 0; + histo = nullptr; } } else { // rebin > 1 histo = new int[fData[0].GetNoOfHistos()*(int)(dataSet->GetData()->size()/fAny2ManyInfo->rebin)]; @@ -4910,9 +4907,9 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) idx = 0; for (int i=0; iGetEntryIdf2()->GetInstrument()->GetDetector()->GetNoOfSpectra(); i++) { dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number - if (dataSet == 0) { // something is really wrong - cerr << endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } for (unsigned int j=0; jGetData()->size(); j++) { @@ -4927,7 +4924,7 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) // clean up if (histo) { delete [] histo; - histo = 0; + histo = nullptr; } } @@ -4939,7 +4936,7 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) nxs->GetEntryIdf2()->GetInstrument()->GetDetector()->SetTimeResolution(fData[0].GetTimeResolution()*fAny2ManyInfo->rebin, "ns"); // handle raw time - vector raw_time; + std::vector raw_time; UInt_t size = (unsigned int)(dataSet->GetData()->size() / fAny2ManyInfo->rebin); for (unsigned int i=0; irebin * 1.0e-3); // since time resolution is given in ns, the factor 1.0e-3 is needed to convert to us @@ -4955,14 +4952,14 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) int *fgb = new int[fData[0].GetNoOfHistos()]; int *lgb = new int[fData[0].GetNoOfHistos()]; if ((t0==0) || (fgb==0) || (lgb==0)) { - cerr << endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't allocate memory for t0, fgb, lgb" << endl; + std::cerr << std::endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't allocate memory for t0, fgb, lgb" << std::endl; return false; } for (unsigned int i=0; i> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=0)"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteNeXusFile: **ERROR** Couldn't get data set (idx=0)"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } t0[i] = (int)(dataSet->GetTimeZeroBin() / fAny2ManyInfo->rebin); @@ -4981,7 +4978,7 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) // clean up if (nxs != 0) { delete nxs; - nxs = 0; + nxs = nullptr; } return false; } @@ -4996,11 +4993,11 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) else if (!fAny2ManyInfo->outFormat.CompareTo("nexus1-xml", TString::kIgnoreCase) || !fAny2ManyInfo->outFormat.CompareTo("nexus2-xml", TString::kIgnoreCase)) strncpy(fileType, "xml", sizeof(fileType)); else { - cerr << endl << ">> PRunDataHandler::WriteNexusFile(): **ERROR** undefined output NeXus format " << fAny2ManyInfo->outFormat.Data() << " found."; - cerr << endl << ">> Allowed are: hdf4, hdf5, xml" << endl; + std::cerr << std::endl << ">> PRunDataHandler::WriteNexusFile(): **ERROR** undefined output NeXus format " << fAny2ManyInfo->outFormat.Data() << " found."; + std::cerr << std::endl << ">> Allowed are: hdf4, hdf5, xml" << std::endl; if (nxs != 0) { delete nxs; - nxs = 0; + nxs = nullptr; } return false; } @@ -5010,10 +5007,10 @@ Bool_t PRunDataHandler::WriteNexusFile(TString fln) if (nxs != 0) { delete nxs; - nxs = 0; + nxs = nullptr; } #else - cout << endl << ">> PRunDataHandler::WriteNexusFile(): Sorry, not enabled at configuration level, i.e. --enable-NeXus when executing configure" << endl << endl; + std::cout << std::endl << ">> PRunDataHandler::WriteNexusFile(): Sorry, not enabled at configuration level, i.e. --enable-NeXus when executing configure" << std::endl << std::endl; #endif return true; @@ -5050,64 +5047,64 @@ Bool_t PRunDataHandler::WriteWkmFile(TString fln) TString fileName = fln; if (!fAny2ManyInfo->useStandardOutput) - cout << endl << ">> PRunDataHandler::WriteWkmFile(): writing a wkm data file (" << fln.Data() << ") ... " << endl; + std::cout << std::endl << ">> PRunDataHandler::WriteWkmFile(): writing a wkm data file (" << fln.Data() << ") ... " << std::endl; // write ascii file - ofstream fout; - streambuf* strm_buffer = 0; + std::ofstream fout; + std::streambuf* strm_buffer = nullptr; if (!fAny2ManyInfo->useStandardOutput || (fAny2ManyInfo->compressionTag > 0)) { // open data-file - fout.open(fln.Data(), ofstream::out); + fout.open(fln.Data(), std::ofstream::out); if (!fout.is_open()) { - cerr << endl << ">> PRunDataHandler::WriteWkmFile **ERROR** Couldn't open data file (" << fln.Data() << ") for writing, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::WriteWkmFile **ERROR** Couldn't open data file (" << fln.Data() << ") for writing, sorry ..."; + std::cerr << std::endl; return false; } // save output buffer of the stream - strm_buffer = cout.rdbuf(); + strm_buffer = std::cout.rdbuf(); // redirect output into the file - cout.rdbuf(fout.rdbuf()); + std::cout.rdbuf(fout.rdbuf()); } // write header - cout << "- WKM data file converted with any2many"; + std::cout << "- WKM data file converted with any2many"; if (lem_wkm_style) { - cout << endl << "NEMU_Run: " << fData[0].GetRunNumber(); - cout << endl << "nemu_Run: " << fileName.Data(); + std::cout << std::endl << "NEMU_Run: " << fData[0].GetRunNumber(); + std::cout << std::endl << "nemu_Run: " << fileName.Data(); } else { - cout << endl << "Run: " << fData[0].GetRunNumber(); + std::cout << std::endl << "Run: " << fData[0].GetRunNumber(); } - cout << endl << "Date: " << fData[0].GetStartTime()->Data() << " " << fData[0].GetStartDate()->Data() << " / " << fData[0].GetStopTime()->Data() << " " << fData[0].GetStopDate()->Data(); + std::cout << std::endl << "Date: " << fData[0].GetStartTime()->Data() << " " << fData[0].GetStartDate()->Data() << " / " << fData[0].GetStopTime()->Data() << " " << fData[0].GetStopDate()->Data(); if (fData[0].GetRunTitle()->Length() > 0) - cout << endl << "Title: " << fData[0].GetRunTitle()->Data(); + std::cout << std::endl << "Title: " << fData[0].GetRunTitle()->Data(); if (fData[0].GetField() != PMUSR_UNDEFINED) { - cout << endl << "Field: " << fData[0].GetField(); + std::cout << std::endl << "Field: " << fData[0].GetField(); } else { - cout << endl << "Field: ??"; + std::cout << std::endl << "Field: ??"; } - cout << endl << "Setup: " << fData[0].GetSetup()->Data(); + std::cout << std::endl << "Setup: " << fData[0].GetSetup()->Data(); if (fData[0].GetNoOfTemperatures() == 1) { - cout << endl << "Temp: " << fData[0].GetTemperature(0); + std::cout << std::endl << "Temp: " << fData[0].GetTemperature(0); } else if (fData[0].GetNoOfTemperatures() > 1) { - cout << endl << "Temp(meas1): " << fData[0].GetTemperature(0) << " +- " << fData[0].GetTempError(0); - cout << endl << "Temp(meas2): " << fData[0].GetTemperature(1) << " +- " << fData[0].GetTempError(1); + std::cout << std::endl << "Temp(meas1): " << fData[0].GetTemperature(0) << " +- " << fData[0].GetTempError(0); + std::cout << std::endl << "Temp(meas2): " << fData[0].GetTemperature(1) << " +- " << fData[0].GetTempError(1); } else { - cout << endl << "Temp: ??"; + std::cout << std::endl << "Temp: ??"; } if (lem_wkm_style) - cout << endl << "TOF(M3S1): nocut"; - cout << endl << "Groups: " << fData[0].GetNoOfHistos(); + std::cout << std::endl << "TOF(M3S1): nocut"; + std::cout << std::endl << "Groups: " << fData[0].GetNoOfHistos(); UInt_t histo0 = 1; if (fAny2ManyInfo->groupHistoList.size() != 0) { // red/green list found histo0 = fAny2ManyInfo->groupHistoList[0]+1; // take the first available red/green entry } - cout << endl << "Channels: " << static_cast(fData[0].GetDataBin(histo0)->size()/fAny2ManyInfo->rebin); - cout.precision(10); - cout << endl << "Resolution: " << fData[0].GetTimeResolution()*fAny2ManyInfo->rebin/1.0e3; // ns->us - cout.setf(ios::fixed,ios::floatfield); // floatfield set to fixed + std::cout << std::endl << "Channels: " << static_cast(fData[0].GetDataBin(histo0)->size()/fAny2ManyInfo->rebin); + std::cout.precision(10); + std::cout << std::endl << "Resolution: " << fData[0].GetTimeResolution()*fAny2ManyInfo->rebin/1.0e3; // ns->us + std::cout.setf(std::ios::fixed,std::ios::floatfield); // floatfield set to fixed // write data UInt_t no_of_bins_per_line = 16; @@ -5118,35 +5115,35 @@ Bool_t PRunDataHandler::WriteWkmFile(TString fln) if (fAny2ManyInfo->rebin == 1) { for (UInt_t i=0; iGetData()->size(); j++) { if ((j > 0) && (j % no_of_bins_per_line == 0)) - cout << endl; + std::cout << std::endl; if (lem_wkm_style) - cout << setw(8) << static_cast(dataSet->GetData()->at(j)); + std::cout << std::setw(8) << static_cast(dataSet->GetData()->at(j)); else - cout << static_cast(dataSet->GetData()->at(j)) << " "; + std::cout << static_cast(dataSet->GetData()->at(j)) << " "; } } } else { // rebin > 1 Int_t dataRebin = 0; UInt_t count = 0; for (UInt_t i=0; iGetData()->size(); j++) { if ((j > 0) && (j % fAny2ManyInfo->rebin == 0)) { if (lem_wkm_style) - cout << setw(8) << dataRebin; + std::cout << std::setw(8) << dataRebin; else - cout << dataRebin << " "; + std::cout << dataRebin << " "; count++; dataRebin = 0; if ((count > 0) && (count % no_of_bins_per_line == 0) && (j != dataSet->GetData()->size()-1)) - cout << endl; + std::cout << std::endl; } else { dataRebin += static_cast(dataSet->GetData()->at(j)); } @@ -5156,7 +5153,7 @@ Bool_t PRunDataHandler::WriteWkmFile(TString fln) if (!fAny2ManyInfo->useStandardOutput || (fAny2ManyInfo->compressionTag > 0)) { // restore old output buffer - cout.rdbuf(strm_buffer); + std::cout.rdbuf(strm_buffer); fout.close(); } @@ -5184,7 +5181,7 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) return false; if (!fAny2ManyInfo->useStandardOutput) - cout << endl << ">> PRunDataHandler::WritePsiBinFile(): writing a psi-bin data file (" << fln.Data() << ") ... " << endl; + std::cout << std::endl << ">> PRunDataHandler::WritePsiBinFile(): writing a psi-bin data file (" << fln.Data() << ") ... " << std::endl; MuSR_td_PSI_bin psibin; int status = 0; @@ -5197,9 +5194,9 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) if (fAny2ManyInfo->groupHistoList.size() != 0) { // red/green list found histo0 = fAny2ManyInfo->groupHistoList[0]+1; // take the first available red/green entry } - psibin.put_histoLength_bin((int)(fData[0].GetDataBin(histo0)->size()/fAny2ManyInfo->rebin)); + psibin.put_histoLength_bin(static_cast(fData[0].GetDataBin(histo0)->size()/fAny2ManyInfo->rebin)); // number of histograms - psibin.put_numberHisto_int((int)fData[0].GetNoOfHistos()); + psibin.put_numberHisto_int(static_cast(fData[0].GetNoOfHistos())); // run title = sample (10 char) / temp (10 char) / field (10 char) / orientation (10 char) char cstr[11]; // sample @@ -5241,7 +5238,7 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) // handle PSI-BIN start/stop Time/Date. PSI-BIN requires: Time -> HH:MM:SS, and Date -> DD-MMM-YY // internally given: Time -> HH:MM:SS, and Date -> YYYY-MM-DD // run start date - vector svec; + std::vector svec; TString str, date; TDatime dt; int year, month, day; @@ -5294,7 +5291,7 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) psibin.put_numberTemperature_int(fData[0].GetNoOfTemperatures()); // mean temperatures - vector dvec; + std::vector dvec; for (UInt_t i=0; i> PRunDataHandler::WritePsiBinFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WritePsiBinFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } @@ -5332,32 +5329,32 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) str.Form("Detector%3d", i+1); psibin.put_nameHisto(str.Data(), i); // time zero bin - ival = (Int_t)(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin); + ival = static_cast(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin); psibin.put_t0_int(i, ival); // first good bin - ival = (Int_t)(dataSet->GetFirstGoodBin()/fAny2ManyInfo->rebin); + ival = static_cast(dataSet->GetFirstGoodBin()/fAny2ManyInfo->rebin); psibin.put_firstGood_int(i, ival); // last good bin - ival = (Int_t)(dataSet->GetLastGoodBin()/fAny2ManyInfo->rebin); + ival = static_cast(dataSet->GetLastGoodBin()/fAny2ManyInfo->rebin); psibin.put_lastGood_int(i, ival); } // feed histos - vector< vector > histos; + std::vector< std::vector > histos; histos.resize(fData[0].GetNoOfHistos()); UInt_t length = 0; if (fAny2ManyInfo->rebin == 1) { for (UInt_t i=0; i> PRunDataHandler::WritePsiBinFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WritePsiBinFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } length = dataSet->GetData()->size(); histos[i].resize(length); for (UInt_t j=0; jGetData()->at(j); + histos[i][j] = static_cast(dataSet->GetData()->at(j)); } } } else { // rebin > 1 @@ -5365,9 +5362,9 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) UInt_t dataCount = 0; for (UInt_t i=0; i> PRunDataHandler::WritePsiBinFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WritePsiBinFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } length = dataSet->GetData()->size(); @@ -5384,12 +5381,12 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) } status = psibin.put_histo_array_int(histos); if (status != 0) { - cerr << endl << ">> PRunDataHandler::WritePsiBinFile(): " << psibin.ConsistencyStatus() << endl; + std::cerr << std::endl << ">> PRunDataHandler::WritePsiBinFile(): " << psibin.ConsistencyStatus() << std::endl; return false; } if (!psibin.CheckDataConsistency()) { - cerr << endl << ">> PRunDataHandler::WritePsiBinFile(): " << psibin.ConsistencyStatus() << endl; + std::cerr << std::endl << ">> PRunDataHandler::WritePsiBinFile(): " << psibin.ConsistencyStatus() << std::endl; return false; } @@ -5397,7 +5394,7 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln) status = psibin.write(fln.Data()); if (status != 0) { - cerr << endl << ">> PRunDataHandler::WritePsiBinFile(): " << psibin.WriteStatus() << endl; + std::cerr << std::endl << ">> PRunDataHandler::WritePsiBinFile(): " << psibin.WriteStatus() << std::endl; return false; } @@ -5424,12 +5421,12 @@ Bool_t PRunDataHandler::WriteMudFile(TString fln) return false; if (!fAny2ManyInfo->useStandardOutput) - cout << endl << ">> PRunDataHandler::WriteMudFile(): writing a mud data file (" << fln.Data() << ") ... " << endl; + std::cout << std::endl << ">> PRunDataHandler::WriteMudFile(): writing a mud data file (" << fln.Data() << ") ... " << std::endl; // generate the mud data file int fd = MUD_openWrite((char*)fln.Data(), MUD_FMT_TRI_TD_ID); if (fd == -1) { - cerr << endl << ">> PRunDataHandler::WriteMudFile(): **ERROR** couldn't open mud data file for write ..." << endl; + std::cerr << std::endl << ">> PRunDataHandler::WriteMudFile(): **ERROR** couldn't open mud data file for write ..." << std::endl; return false; } @@ -5463,8 +5460,8 @@ Bool_t PRunDataHandler::WriteMudFile(TString fln) UInt_t *data, dataSize = fData[0].GetDataSet(0, false)->GetData()->size()/fAny2ManyInfo->rebin + 1; data = new UInt_t[dataSize]; - if (data == 0) { - cerr << endl << ">> PRunDataHandler::WriteMudFile(): **ERROR** couldn't allocate memory for the data ..." << endl; + if (data == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::WriteMudFile(): **ERROR** couldn't allocate memory for the data ..." << std::endl; MUD_closeWrite(fd); return false; } @@ -5474,9 +5471,9 @@ Bool_t PRunDataHandler::WriteMudFile(TString fln) PRawRunDataSet *dataSet; for (UInt_t i=0; i> PRunDataHandler::WriteMudFile: **ERROR** Couldn't get data set (idx=" << i << ")"; - cerr << endl << ">> something is really wrong!" << endl; + if (dataSet == nullptr) { // something is really wrong + std::cerr << std::endl << ">> PRunDataHandler::WriteMudFile: **ERROR** Couldn't get data set (idx=" << i << ")"; + std::cerr << std::endl << ">> something is really wrong!" << std::endl; return false; } @@ -5523,24 +5520,24 @@ Bool_t PRunDataHandler::WriteMudFile(TString fln) // check if mud file shall be streamed to stdout if (fAny2ManyInfo->useStandardOutput && (fAny2ManyInfo->compressionTag == 0)) { // stream file to stdout - ifstream is; + std::ifstream is; int length=1024; char *buffer; - is.open(fln.Data(), ios::binary); + is.open(fln.Data(), std::ios::binary); if (!is.is_open()) { - cerr << endl << "PRunDataHandler::WriteMudFile(): **ERROR** Couldn't open the mud-file for streaming." << endl; + std::cerr << std::endl << "PRunDataHandler::WriteMudFile(): **ERROR** Couldn't open the mud-file for streaming." << std::endl; remove(fln.Data()); return false; } // get length of file - is.seekg(0, ios::end); + is.seekg(0, std::ios::end); length = is.tellg(); - is.seekg(0, ios::beg); + is.seekg(0, std::ios::beg); if (length == -1) { - cerr << endl << "PRunDataHandler::WriteMudFile(): **ERROR** Couldn't determine the mud-file size." << endl; + std::cerr << std::endl << "PRunDataHandler::WriteMudFile(): **ERROR** Couldn't determine the mud-file size." << std::endl; remove(fln.Data()); return false; } @@ -5551,7 +5548,7 @@ Bool_t PRunDataHandler::WriteMudFile(TString fln) // read data as a block while (!is.eof()) { is.read(buffer, length); - cout.write(buffer, length); + std::cout.write(buffer, length); } is.close(); @@ -5586,79 +5583,79 @@ Bool_t PRunDataHandler::WriteAsciiFile(TString fln) TString fileName = fln; if (!fAny2ManyInfo->useStandardOutput) - cout << endl << ">> PRunDataHandler::WriteAsciiFile(): writing an ascii data file (" << fln.Data() << ") ... " << endl; + std::cout << std::endl << ">> PRunDataHandler::WriteAsciiFile(): writing an ascii data file (" << fln.Data() << ") ... " << std::endl; // write ascii file - ofstream fout; - streambuf* strm_buffer = 0; + std::ofstream fout; + std::streambuf* strm_buffer = nullptr; if (!fAny2ManyInfo->useStandardOutput || (fAny2ManyInfo->compressionTag > 0)) { // open data-file - fout.open(fln.Data(), ofstream::out); + fout.open(fln.Data(), std::ofstream::out); if (!fout.is_open()) { - cerr << endl << ">> PRunDataHandler::WriteAsciiFile **ERROR** Couldn't open data file (" << fln.Data() << ") for writing, sorry ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunDataHandler::WriteAsciiFile **ERROR** Couldn't open data file (" << fln.Data() << ") for writing, sorry ..."; + std::cerr << std::endl; return false; } // save output buffer of the stream - strm_buffer = cout.rdbuf(); + strm_buffer = std::cout.rdbuf(); // redirect output into the file - cout.rdbuf(fout.rdbuf()); + std::cout.rdbuf(fout.rdbuf()); } // write header - cout << "%*************************************************************************"; - cout << endl << "% file name : " << fileName.Data(); + std::cout << "%*************************************************************************"; + std::cout << std::endl << "% file name : " << fileName.Data(); if (fData[0].GetRunTitle()->Length() > 0) - cout << endl << "% title : " << fData[0].GetRunTitle()->Data(); + std::cout << std::endl << "% title : " << fData[0].GetRunTitle()->Data(); if (fData[0].GetRunNumber() >= 0) - cout << endl << "% run number : " << fData[0].GetRunNumber(); + std::cout << std::endl << "% run number : " << fData[0].GetRunNumber(); if (fData[0].GetSetup()->Length() > 0) - cout << endl << "% setup : " << fData[0].GetSetup()->Data(); - cout << endl << "% field : " << fData[0].GetField() << " (G)"; + std::cout << std::endl << "% setup : " << fData[0].GetSetup()->Data(); + std::cout << std::endl << "% field : " << fData[0].GetField() << " (G)"; if (fData[0].GetStartTime()->Length() > 0) - cout << endl << "% date : " << fData[0].GetStartTime()->Data() << " " << fData[0].GetStartDate()->Data() << " / " << fData[0].GetStopTime()->Data() << " " << fData[0].GetStopDate()->Data(); + std::cout << std::endl << "% date : " << fData[0].GetStartTime()->Data() << " " << fData[0].GetStartDate()->Data() << " / " << fData[0].GetStopTime()->Data() << " " << fData[0].GetStopDate()->Data(); if (fData[0].GetNoOfTemperatures() > 0) { - cout << endl << "% temperature : "; + std::cout << std::endl << "% temperature : "; for (UInt_t i=0; irebin << " (ns)"; - cout.setf(ios::fixed,ios::floatfield); // floatfield set to fixed + std::cout.precision(10); + std::cout << std::endl << "% time resolution : " << fData[0].GetTimeResolution()*fAny2ManyInfo->rebin << " (ns)"; + std::cout.setf(std::ios::fixed,std::ios::floatfield); // floatfield set to fixed } PRawRunDataSet *dataSet; - cout << endl << "% t0 : "; + std::cout << std::endl << "% t0 : "; for (UInt_t i=0; i(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin) << ", "; + std::cout << static_cast(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin) << ", "; } dataSet = fData[0].GetDataSet(fData[0].GetNoOfHistos()-1, false); // i.e. the false means, that i is the index and NOT the histo number - cout << static_cast(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin); + std::cout << static_cast(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin); - cout << endl << "% # histos : " << fData[0].GetNoOfHistos(); + std::cout << std::endl << "% # histos : " << fData[0].GetNoOfHistos(); dataSet = fData[0].GetDataSet(0, false); // i.e. the false means, that i is the index and NOT the histo number - cout << endl << "% # of bins : " << static_cast(dataSet->GetData()->size()/fAny2ManyInfo->rebin); - cout << endl << "%*************************************************************************"; + std::cout << std::endl << "% # of bins : " << static_cast(dataSet->GetData()->size()/fAny2ManyInfo->rebin); + std::cout << std::endl << "%*************************************************************************"; // write data UInt_t length = fData[0].GetDataSet(0,false)->GetData()->size(); if (fAny2ManyInfo->rebin == 1) { for (UInt_t i=0; i(dataSet->GetData()->at(i)); + std::cout.width(8); + std::cout << static_cast(dataSet->GetData()->at(i)); } } } else { @@ -5672,10 +5669,10 @@ Bool_t PRunDataHandler::WriteAsciiFile(TString fln) for (UInt_t i=0; i 0) && ((i % fAny2ManyInfo->rebin) == 0)) { - cout << endl; + std::cout << std::endl; for (UInt_t j=0; juseStandardOutput || (fAny2ManyInfo->compressionTag > 0)) { // restore old output buffer - cout.rdbuf(strm_buffer); + std::cout.rdbuf(strm_buffer); fout.close(); } @@ -5719,14 +5716,14 @@ Bool_t PRunDataHandler::WriteAsciiFile(TString fln) */ Bool_t PRunDataHandler::StripWhitespace(TString &str) { - Char_t *s = 0; - Char_t *subs = 0; + Char_t *s = nullptr; + Char_t *subs = nullptr; Int_t i; Int_t start; Int_t end; Int_t size; - size = (Int_t)str.Length(); + size = static_cast(str.Length()); s = new Char_t[size+1]; if (!s) @@ -5766,11 +5763,11 @@ Bool_t PRunDataHandler::StripWhitespace(TString &str) // clean up if (subs) { delete [] subs; - subs = 0; + subs = nullptr; } if (s) { delete [] s; - s = 0; + s = nullptr; } return true; @@ -5826,7 +5823,7 @@ Double_t PRunDataHandler::ToDouble(TString &str, Bool_t &ok) ok = true; - size = (Int_t)str.Length(); + size = static_cast(str.Length()); s = new Char_t[size+1]; if (!s) { @@ -5849,7 +5846,7 @@ Double_t PRunDataHandler::ToDouble(TString &str, Bool_t &ok) // clean up if (s) { delete [] s; - s = 0; + s = nullptr; } return value; @@ -5876,7 +5873,7 @@ Int_t PRunDataHandler::ToInt(TString &str, Bool_t &ok) ok = true; - size = (Int_t)str.Length(); + size = static_cast(str.Length()); s = new Char_t[size+1]; if (!s) { @@ -5899,7 +5896,7 @@ Int_t PRunDataHandler::ToInt(TString &str, Bool_t &ok) // clean up if (s) { delete [] s; - s = 0; + s = nullptr; } return value; @@ -5976,8 +5973,8 @@ TString PRunDataHandler::GenerateOutputFileName(const TString fileName, const TS newFln = fln; newFln.Insert(newFln.Last('.'), TString::Format(".%d", count++)); } while (!gSystem->AccessPathName(newFln)); - cerr << endl << ">> PRunDataHandler::GenerateOutputFileName **WARNING** needed to modify output filename to " << newFln << ","; - cerr << endl << ">> due to potential conflict with already existing files." << endl << endl; + std::cerr << std::endl << ">> PRunDataHandler::GenerateOutputFileName **WARNING** needed to modify output filename to " << newFln << ","; + std::cerr << std::endl << ">> due to potential conflict with already existing files." << std::endl << std::endl; fln = newFln; } @@ -6011,7 +6008,7 @@ TString PRunDataHandler::GetFileName(const TString extension, Bool_t &ok) Int_t start = fRunPathName.Last('/'); Int_t end = fRunPathName.Last('.'); if (end == -1) { - cerr << endl << ">> PRunDataHandler::GetFileName(): **ERROR** couldn't generate the output file name ..." << endl; + std::cerr << std::endl << ">> PRunDataHandler::GetFileName(): **ERROR** couldn't generate the output file name ..." << std::endl; ok = false; return fileName; } @@ -6058,14 +6055,14 @@ TString PRunDataHandler::FileNameFromTemplate(TString &fileNameTemplate, Int_t r { TString result(""); - TObjArray *tok=0; + TObjArray *tok=nullptr; TObjString *ostr; TString str; // check year string if ((year.Length() != 2) && (year.Length() != 4)) { - cerr << endl << ">> PRunDataHandler::FileNameFromTemplate: **ERROR** year needs to be of the format"; - cerr << endl << ">> 'yy' or 'yyyy', found " << year << endl; + std::cerr << std::endl << ">> PRunDataHandler::FileNameFromTemplate: **ERROR** year needs to be of the format"; + std::cerr << std::endl << ">> 'yy' or 'yyyy', found " << year << std::endl; return result; } @@ -6083,17 +6080,17 @@ TString PRunDataHandler::FileNameFromTemplate(TString &fileNameTemplate, Int_t r // tokenize template string tok = fileNameTemplate.Tokenize("[]"); - if (tok == 0) { - cerr << endl << ">> PRunDataHandler::FileNameFromTemplate: **ERROR** couldn't tokenize template!" << endl; + if (tok == nullptr) { + std::cerr << std::endl << ">> PRunDataHandler::FileNameFromTemplate: **ERROR** couldn't tokenize template!" << std::endl; return result; } if (tok->GetEntries()==1) { - cerr << endl << ">> PRunDataHandler::FileNameFromTemplate: **WARNING** template without tags." << endl; + std::cerr << std::endl << ">> PRunDataHandler::FileNameFromTemplate: **WARNING** template without tags." << std::endl; } // go through the tokens and generate the result string for (Int_t i=0; iGetEntries(); i++) { - ostr = (TObjString*)tok->At(i); + ostr = dynamic_cast(tok->At(i)); str = ostr->GetString(); // check tokens @@ -6143,9 +6140,9 @@ TString PRunDataHandler::FileNameFromTemplate(TString &fileNameTemplate, Int_t r * \param inDate input date which should be converted to an ISO 8601 date. * \param iso8601Date on success the converted iso8601Date, otherwise an empty string */ -bool PRunDataHandler::DateToISO8601(string inDate, string &iso8601Date) +bool PRunDataHandler::DateToISO8601(std::string inDate, std::string &iso8601Date) { - iso8601Date = string(""); + iso8601Date = std::string(""); struct tm tm; diff --git a/src/classes/PRunListCollection.cpp b/src/classes/PRunListCollection.cpp index e11bb0c6..2a546ba3 100644 --- a/src/classes/PRunListCollection.cpp +++ b/src/classes/PRunListCollection.cpp @@ -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 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& 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 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(); diff --git a/src/classes/PRunMuMinus.cpp b/src/classes/PRunMuMinus.cpp index 2a1dcefa..83101a8e 100644 --- a/src/classes/PRunMuMinus.cpp +++ b/src/classes/PRunMuMinus.cpp @@ -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 * @@ -36,7 +36,6 @@ #endif #include -using namespace std; #include #include @@ -86,9 +85,9 @@ PRunMuMinus::PRunMuMinus(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t fPacking = fMsrInfo->GetMsrGlobal()->GetPacking(); } if (fPacking == -1) { // this should NOT happen, somethin is severely wrong - cerr << endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't find any packing information!"; - cerr << endl << ">> This is very bad :-(, will quit ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't find any packing information!"; + std::cerr << std::endl << ">> This is very bad :-(, will quit ..."; + std::cerr << std::endl; fValid = false; return; } @@ -102,9 +101,9 @@ PRunMuMinus::PRunMuMinus(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t fEndTimeBin = -1; if (!PrepareData()) { - cerr << endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't prepare data for fitting!"; - cerr << endl << ">> This is very bad :-(, will quit ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't prepare data for fitting!"; + std::cerr << std::endl << ">> This is very bad :-(, will quit ..."; + std::cerr << std::endl; fValid = false; } } @@ -159,7 +158,7 @@ Double_t PRunMuMinus::CalcChiSquare(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i < fEndTimeBin; ++i) { - time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep(); + time = fData.GetDataTimeStart() + static_cast(i)*fData.GetDataTimeStep(); diff = fData.GetValue()->at(i) - fTheory->Func(time, par, fFuncValues); chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i)); } @@ -207,7 +206,7 @@ Double_t PRunMuMinus::CalcChiSquareExpected(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i < fEndTimeBin; ++i) { - time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep(); + time = fData.GetDataTimeStart() + static_cast(i)*fData.GetDataTimeStep(); theo = fTheory->Func(time, par, fFuncValues); diff = fData.GetValue()->at(i) - theo; chisq += diff*diff / theo; @@ -256,14 +255,14 @@ Double_t PRunMuMinus::CalcMaxLikelihood(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh) #endif for (i=fStartTimeBin; i < fEndTimeBin; ++i) { - time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep(); + time = fData.GetDataTimeStart() + static_cast(i)*fData.GetDataTimeStep(); // calculate theory for the given parameter set theo = fTheory->Func(time, par, fFuncValues); data = fData.GetValue()->at(i); if (theo <= 0.0) { - cerr << ">> PRunMuMinus::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl; + std::cerr << ">> PRunMuMinus::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << std::endl; continue; } @@ -308,8 +307,8 @@ UInt_t PRunMuMinus::GetNoOfFitBins() */ void PRunMuMinus::SetFitRangeBin(const TString fitRange) { - TObjArray *tok = 0; - TObjString *ostr = 0; + TObjArray *tok = nullptr; + TObjString *ostr = nullptr; TString str; Ssiz_t idx = -1; Int_t offset = 0; @@ -318,7 +317,7 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange) if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1 // handle fgb+n0 entry - ostr = (TObjString*) tok->At(1); + ostr = dynamic_cast(tok->At(1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -330,7 +329,7 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(2); + ostr = dynamic_cast(tok->At(2)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -344,11 +343,11 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange) Int_t pos = 2*(fRunNo+1)-1; if (pos + 1 >= tok->GetEntries()) { - cerr << endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } else { // handle fgb+n0 entry - ostr = (TObjString*) tok->At(pos); + ostr = dynamic_cast(tok->At(pos)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -360,7 +359,7 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(pos+1); + ostr = dynamic_cast(tok->At(pos+1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -372,8 +371,8 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange) fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution; } } else { // error - cerr << endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunMuMinus::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } // clean up @@ -429,7 +428,7 @@ void PRunMuMinus::CalcTheory() Double_t resolution = fData.GetDataTimeStep(); Double_t time; for (UInt_t i=0; i(i)*resolution; fData.AppendTheoryValue(fTheory->Func(time, par, fFuncValues)); } @@ -463,8 +462,8 @@ Bool_t PRunMuMinus::PrepareData() // get the proper run PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName()); if (!runData) { // couldn't get run - cerr << endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; + std::cerr << std::endl; return false; } @@ -474,10 +473,10 @@ Bool_t PRunMuMinus::PrepareData() histoNo.push_back(fRunInfo->GetForwardHistoNo(i)); if (!runData->IsPresent(histoNo[i])) { - cerr << endl << ">> PRunMuMinus::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?"; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?"; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; histoNo.clear(); return false; } @@ -485,8 +484,8 @@ Bool_t PRunMuMinus::PrepareData() // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; - cout.precision(10); - cout << endl << ">> PRunMuMinus::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl; + std::cout.precision(10); + std::cout << std::endl << ">> PRunMuMinus::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl; // get all the proper t0's and addt0's for the current RUN block if (!GetProperT0(runData, globalBlock, histoNo)) { @@ -494,7 +493,7 @@ Bool_t PRunMuMinus::PrepareData() } // keep the histo of each group at this point (addruns handled below) - vector forward; + std::vector forward; forward.resize(histoNo.size()); // resize to number of groups for (UInt_t i=0; iGetDataBin(histoNo[i])->size()); @@ -508,9 +507,9 @@ Bool_t PRunMuMinus::PrepareData() // get run to be added to the main one addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i)); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -520,8 +519,9 @@ Bool_t PRunMuMinus::PrepareData() addRunSize = addRunData->GetDataBin(histoNo[k])->size(); for (UInt_t j=0; jGetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices // make sure that the index stays in the proper range - if (((Int_t)j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] >= 0) && (j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] < addRunSize)) { - forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k]); + if ((static_cast(j)+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k]) >= 0) && + (j+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k]) < addRunSize)) { + forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k])); } } } @@ -538,8 +538,8 @@ Bool_t PRunMuMinus::PrepareData() for (UInt_t i=1; iGetDataBin(histoNo[i])->size(); j++) { // loop over the bin indices // make sure that the index stays within proper range - if (((Int_t)j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) { - fForward[j] += forward[i][j+(Int_t)fT0s[i]-(Int_t)fT0s[0]]; + if ((static_cast(j)+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) { + fForward[j] += forward[i][j+static_cast(fT0s[i])-static_cast(fT0s[0])]; } } } @@ -589,11 +589,11 @@ Bool_t PRunMuMinus::PrepareFitData(PRawRunData* runData, const UInt_t histoNo) // for the single histo fit, just the rebinned raw data are copied // fill data set - Int_t t0 = (Int_t)fT0s[0]; + Int_t t0 = static_cast(fT0s[0]); Double_t value = 0.0; // data start at data_start-t0 // time shifted so that packing is included correctly, i.e. t0 == t0 after packing - fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-(Double_t)t0+(Double_t)(fPacking-1)/2.0)); + fData.SetDataTimeStart(fTimeResolution*(static_cast(fGoodBins[0])-static_cast(t0)+static_cast(fPacking-1)/2.0)); fData.SetDataTimeStep(fTimeResolution*fPacking); for (Int_t i=fGoodBins[0]; iGetMsrPlotList()->at(0).fViewPacking > 0) { - theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking; + theoryNorm = static_cast(fMsrInfo->GetMsrPlotList()->at(0).fViewPacking)/static_cast(fPacking); } // raw data, since PMusrCanvas is doing ranging etc. @@ -662,12 +662,12 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN Int_t end = start + ((fForward.size()-start)/packing)*packing; // check if data range has been provided, and if not try to estimate them if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = ((Int_t)fT0s[0]+offset) - (((Int_t)fT0s[0]+offset)/packing)*packing; + Int_t offset = static_cast(10.0e-3/fTimeResolution); + start = (static_cast(fT0s[0])+offset) - ((static_cast(fT0s[0])+offset)/packing)*packing; end = start + ((fForward.size()-start)/packing)*packing; - cerr << endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start, end, and t0 make any sense // 1st check if start and end are in proper order @@ -677,15 +677,15 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN start = keep; } // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start < 0) || (start > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds - if ((end < 0) || (end > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; + if ((end < 0) || (end > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunMuMinus::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } @@ -696,11 +696,11 @@ Bool_t PRunMuMinus::PrepareRawViewData(PRawRunData* runData, const UInt_t histoN } // everything looks fine, hence fill data set - Int_t t0 = (Int_t)fT0s[0]; + Int_t t0 = static_cast(fT0s[0]); Double_t value = 0.0; // data start at data_start-t0 // time shifted so that packing is included correctly, i.e. t0 == t0 after packing - fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0)); + fData.SetDataTimeStart(fTimeResolution*(static_cast(start)-static_cast(t0)+static_cast(packing-1)/2.0)); fData.SetDataTimeStep(fTimeResolution*packing); for (Int_t i=start; isize() * 10 > fForward.size()) { size = fData.GetValue()->size() * 10; - factor = (Double_t)fForward.size() / (Double_t)size; + factor = static_cast(fForward.size()) / static_cast(size); } Double_t time; Double_t theoryValue; @@ -791,7 +791,7 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo // fill in the T0's from the GLOBAL block section (if present) for (UInt_t i=0; iGetT0BinSize(); i++) { - if (fT0s[i] == -1) { // i.e. not given in the RUN block section + if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section fT0s[i] = globalBlock->GetT0Bin(i); } } @@ -812,19 +812,19 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo fT0s[i] = runData->GetT0BinEstimated(histoNo[i]); fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file - cerr << endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t i=0; iGetForwardHistoNoSize(); i++) { - if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunMuMinus::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!"; - cerr << endl; + if ((fT0s[i] < 0) || (fT0s[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -837,9 +837,9 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo // get run to be added to the main one addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i)); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunMuMinus::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -870,19 +870,19 @@ Bool_t PRunMuMinus::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlo fAddT0s[i-1][j] = addRunData->GetT0BinEstimated(histoNo[j]); fRunInfo->SetAddT0Bin(fAddT0s[i-1][j], i-1, j); // keep value for the msr-file - cerr << endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t j=0; jGetForwardHistoNoSize(); j++) { - if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) { - cerr << endl << ">> PRunMuMinus::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!"; - cerr << endl; + if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > static_cast(addRunData->GetDataBin(histoNo[j])->size()))) { + std::cerr << std::endl << ">> PRunMuMinus::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -923,19 +923,19 @@ Bool_t PRunMuMinus::GetProperDataRange() // check if data range has been provided, and if not try to estimate them if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = (Int_t)fT0s[0]+offset; + Int_t offset = static_cast(10.0e-3/fTimeResolution); + start = static_cast(fT0s[0])+offset; fRunInfo->SetDataRange(start, 0); - cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (end < 0) { end = fForward.size(); fRunInfo->SetDataRange(end, 1); - cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start and end make any sense @@ -946,15 +946,15 @@ Bool_t PRunMuMinus::GetProperDataRange() start = keep; } // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!"; - cerr << endl; + if ((start < 0) || (start > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds - if ((end < 0) || (end > (Int_t)fForward.size())) { - cerr << endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!"; - cerr << endl; + if ((end < 0) || (end > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunMuMinus::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } @@ -1008,7 +1008,7 @@ void PRunMuMinus::GetProperFitRange(PMsrGlobalBlock *globalBlock) if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) { fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt - cerr << ">> PRunMuMinus::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; - cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; + std::cerr << ">> PRunMuMinus::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl; + std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl; } } diff --git a/src/classes/PRunNonMusr.cpp b/src/classes/PRunNonMusr.cpp index 412aa8a8..7119ba86 100644 --- a/src/classes/PRunNonMusr.cpp +++ b/src/classes/PRunNonMusr.cpp @@ -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& par) */ Double_t PRunNonMusr::CalcChiSquareExpected(const std::vector& 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& par) */ Double_t PRunNonMusr::CalcMaxLikelihood(const std::vector& 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); } diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index a882c44b..4931703f 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -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 * @@ -38,7 +38,6 @@ #include #include #include -using namespace std; #include #include @@ -91,9 +90,9 @@ PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData, fPacking = fMsrInfo->GetMsrGlobal()->GetPacking(); } if (fPacking == -1) { // this should NOT happen, somethin is severely wrong - cerr << endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't find any packing information!"; - cerr << endl << ">> This is very bad :-(, will quit ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't find any packing information!"; + std::cerr << std::endl << ">> This is very bad :-(, will quit ..."; + std::cerr << std::endl; fValid = false; return; } @@ -107,9 +106,9 @@ PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData, fEndTimeBin = -1; if (!PrepareData()) { - cerr << endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't prepare data for fitting!"; - cerr << endl << ">> This is very bad :-(, will quit ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't prepare data for fitting!"; + std::cerr << std::endl << ">> This is very bad :-(, will quit ..."; + std::cerr << std::endl; fValid = false; } } @@ -174,7 +173,7 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector& par) // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - Int_t funcNo = fMsrInfo->GetFuncNo(i); + UInt_t funcNo = fMsrInfo->GetFuncNo(i); fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par); } @@ -195,7 +194,7 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i(i)*fData.GetDataTimeStep(); diff = fData.GetValue()->at(i) - (N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg); chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i)); @@ -280,7 +279,7 @@ Double_t PRunSingleHisto::CalcChiSquareExpected(const std::vector& par #pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i < fEndTimeBin; ++i) { - time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep(); + time = fData.GetDataTimeStart() + static_cast(i)*fData.GetDataTimeStep(); theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg; diff = fData.GetValue()->at(i) - theo; chisq += diff*diff / theo; @@ -316,7 +315,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector& par) N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; + Int_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } @@ -342,7 +341,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector& par) // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - Int_t funcNo = fMsrInfo->GetFuncNo(i); + UInt_t funcNo = fMsrInfo->GetFuncNo(i); fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par); } @@ -371,7 +370,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh) #endif for (i=fStartTimeBin; i(i)*fData.GetDataTimeStep(); // calculate theory for the given parameter set theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg; theo *= normalizer; @@ -379,7 +378,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector& par) data = normalizer*fData.GetValue()->at(i); if (theo <= 0.0) { - cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl; + std::cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << std::endl; continue; } @@ -415,7 +414,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector& N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; + Int_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } @@ -441,7 +440,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector& // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - Int_t funcNo = fMsrInfo->GetFuncNo(i); + UInt_t funcNo = fMsrInfo->GetFuncNo(i); fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par); } @@ -470,7 +469,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector& #pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh) #endif for (i=fStartTimeBin; i(i)*fData.GetDataTimeStep(); // calculate theory for the given parameter set theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg; theo *= normalizer; @@ -478,7 +477,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihoodExpected(const std::vector& data = normalizer*fData.GetValue()->at(i); if (theo <= 0.0) { - cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << endl; + std::cerr << ">> PRunSingleHisto::CalcMaxLikelihood: **WARNING** NEGATIVE theory!!" << std::endl; continue; } @@ -511,7 +510,7 @@ void PRunSingleHisto::CalcTheory() N0 = par[fRunInfo->GetNormParamNo()-1]; } else { // norm is a function // get function number - UInt_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; + Int_t funNo = fRunInfo->GetNormParamNo()-MSR_PARAM_FUN_OFFSET; // evaluate function N0 = fMsrInfo->EvalFunc(funNo, *fRunInfo->GetMap(), par); } @@ -546,7 +545,7 @@ void PRunSingleHisto::CalcTheory() Double_t resolution = fData.GetDataTimeStep(); Double_t time; for (UInt_t i=0; i(i)*resolution; fData.AppendTheoryValue(N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg); } @@ -585,8 +584,8 @@ UInt_t PRunSingleHisto::GetNoOfFitBins() */ void PRunSingleHisto::SetFitRangeBin(const TString fitRange) { - TObjArray *tok = 0; - TObjString *ostr = 0; + TObjArray *tok = nullptr; + TObjString *ostr = nullptr; TString str; Ssiz_t idx = -1; Int_t offset = 0; @@ -595,7 +594,7 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange) if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1 // handle fgb+n0 entry - ostr = (TObjString*) tok->At(1); + ostr = dynamic_cast(tok->At(1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -607,7 +606,7 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(2); + ostr = dynamic_cast(tok->At(2)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -621,11 +620,11 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange) Int_t pos = 2*(fRunNo+1)-1; if (pos + 1 >= tok->GetEntries()) { - cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } else { // handle fgb+n0 entry - ostr = (TObjString*) tok->At(pos); + ostr = dynamic_cast(tok->At(pos)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -637,7 +636,7 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(pos+1); + ostr = dynamic_cast(tok->At(pos+1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -649,8 +648,8 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange) fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution; } } else { // error - cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } // clean up @@ -707,8 +706,8 @@ Bool_t PRunSingleHisto::PrepareData() // get the proper run PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName()); if (!runData) { // couldn't get run - cerr << endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; + std::cerr << std::endl; return false; } @@ -718,10 +717,10 @@ Bool_t PRunSingleHisto::PrepareData() histoNo.push_back(fRunInfo->GetForwardHistoNo(i)); if (!runData->IsPresent(histoNo[i])) { - cerr << endl << ">> PRunSingleHisto::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?"; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?"; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; histoNo.clear(); return false; } @@ -729,8 +728,8 @@ Bool_t PRunSingleHisto::PrepareData() // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; - cout.precision(10); - cout << endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl; + std::cout.precision(10); + std::cout << std::endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl; // get all the proper t0's and addt0's for the current RUN block if (!GetProperT0(runData, globalBlock, histoNo)) { @@ -738,7 +737,7 @@ Bool_t PRunSingleHisto::PrepareData() } // keep the histo of each group at this point (addruns handled below) - vector forward; + std::vector forward; forward.resize(histoNo.size()); // resize to number of groups for (UInt_t i=0; iGetDataBin(histoNo[i])->size()); @@ -752,9 +751,9 @@ Bool_t PRunSingleHisto::PrepareData() // get run to be added to the main one addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i)); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunSingleHisto::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -764,8 +763,9 @@ Bool_t PRunSingleHisto::PrepareData() addRunSize = addRunData->GetDataBin(histoNo[k])->size(); for (UInt_t j=0; jGetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices // make sure that the index stays in the proper range - if (((Int_t)j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] >= 0) && (j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] < addRunSize)) { - forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k]); + if ((static_cast(j)+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k]) >= 0) && + (j+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k]) < addRunSize)) { + forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k])); } } } @@ -782,8 +782,8 @@ Bool_t PRunSingleHisto::PrepareData() for (UInt_t i=1; iGetDataBin(histoNo[i])->size(); j++) { // loop over the bin indices // make sure that the index stays within proper range - if (((Int_t)j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) { - fForward[j] += forward[i][j+(Int_t)fT0s[i]-(Int_t)fT0s[0]]; + if ((static_cast(j)+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) { + fForward[j] += forward[i][j+static_cast(fT0s[i])-static_cast(fT0s[0])]; } } } @@ -854,10 +854,10 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN } else { // no background given to do the job, try estimate fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.1), 0); fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.6), 1); - cerr << endl << ">> PRunSingleHisto::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!"; - cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); - cerr << endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!"; + std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; + std::cerr << std::endl; if (!EstimateBkg(histoNo)) return false; } @@ -869,7 +869,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN } // everything looks fine, hence fill data set - Int_t t0 = (Int_t)fT0s[0]; + Int_t t0 = static_cast(fT0s[0]); Double_t value = 0.0; Double_t normalizer = 1.0; // in order that after rebinning the fit does not need to be redone (important for plots) @@ -878,7 +878,7 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN normalizer = fPacking * (fTimeResolution * 1.0e3); // fTimeResolution us->ns // data start at data_start-t0 // time shifted so that packing is included correctly, i.e. t0 == t0 after packing - fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-(Double_t)t0+(Double_t)(fPacking-1)/2.0)); + fData.SetDataTimeStart(fTimeResolution*(static_cast(fGoodBins[0])-static_cast(t0)+static_cast(fPacking-1)/2.0)); fData.SetDataTimeStep(fTimeResolution*fPacking); for (Int_t i=fGoodBins[0]; ins } else if (!fScaleN0AndBkg && (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0)) { - theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking; + theoryNorm = static_cast(fMsrInfo->GetMsrPlotList()->at(0).fViewPacking)/static_cast(fPacking); } // raw data, since PMusrCanvas is doing ranging etc. // start = the first bin which is a multiple of packing backward from first good data bin Int_t start = fGoodBins[0] - (fGoodBins[0]/packing)*packing; - // end = last bin starting from start which is a multipl of packing and still within the data + // end = last bin starting from start which is a multiple of packing and still within the data Int_t end = start + ((fForward.size()-start)/packing)*packing; // check if data range has been provided, and if not try to estimate them if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = ((Int_t)fT0s[0]+offset) - (((Int_t)fT0s[0]+offset)/packing)*packing; + Int_t offset = static_cast(10.0e-3/fTimeResolution); + start = (static_cast(fT0s[0])+offset) - ((static_cast(fT0s[0])+offset)/packing)*packing; end = start + ((fForward.size()-start)/packing)*packing; - cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** data range was not provided, will try data range start = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** data range was not provided, will try data range start = " << start << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start, end, and t0 make any sense // 1st check if start and end are in proper order @@ -966,24 +966,24 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi start = keep; } // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start < 0) || (start > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds - if ((end < 0) || (end > (Int_t)fForward.size())) { - cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; + if ((end < 0) || (end > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **ERROR** end data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // everything looks fine, hence fill data set - Int_t t0 = (Int_t)fT0s[0]; + Int_t t0 = static_cast(fT0s[0]); Double_t value = 0.0; // data start at data_start-t0 // time shifted so that packing is included correctly, i.e. t0 == t0 after packing - fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0)); + fData.SetDataTimeStart(fTimeResolution*(static_cast(start)-static_cast(t0)+static_cast(packing-1)/2.0)); fData.SetDataTimeStep(fTimeResolution*packing); for (Int_t i=start; iSetBkgRange(static_cast(fT0s[0]*0.1), 0); fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.6), 1); - cerr << endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** Neither fix background nor background bins are given!"; - cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); - cerr << endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PrepareRawViewData(): **WARNING** Neither fix background nor background bins are given!"; + std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; + std::cerr << std::endl; if (!EstimateBkg(histoNo)) return false; } @@ -1065,7 +1065,7 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi Double_t factor = 1.0; if (fData.GetValue()->size() * 10 > fForward.size()) { size = fData.GetValue()->size() * 10; - factor = (Double_t)fForward.size() / (Double_t)size; + factor = static_cast(fForward.size()) / static_cast(size); } Double_t time; Double_t theoryValue; @@ -1132,13 +1132,13 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo if (fScaleN0AndBkg) { dataNorm = 1.0/ (packing * (fTimeResolution * 1.0e3)); // fTimeResolution us->ns } else if (!fScaleN0AndBkg && (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0)) { - theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking; + theoryNorm = static_cast(fMsrInfo->GetMsrPlotList()->at(0).fViewPacking)/static_cast(fPacking); } // transform raw histo data. This is done the following way (for details see the manual): // for the single histo fit, just the rebinned raw data are copied // first get start data, end data, and t0 - Int_t t0 = (Int_t)fT0s[0]; + Int_t t0 = static_cast(fT0s[0]); // start = the first bin which is a multiple of packing backward from first good data bin Int_t start = fGoodBins[0] - (fGoodBins[0]/packing)*packing; @@ -1147,12 +1147,12 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo // check if data range has been provided, and if not try to estimate them if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = ((Int_t)fT0s[0]+offset) - (((Int_t)fT0s[0]+offset)/packing)*packing; + Int_t offset = static_cast(10.0e-3/fTimeResolution); + start = (static_cast(fT0s[0])+offset) - ((static_cast(fT0s[0])+offset)/packing)*packing; end = start + ((fForward.size()-start)/packing)*packing; - cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** data range was not provided, will try data range start = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** data range was not provided, will try data range start = " << start << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start, end, and t0 make any sense @@ -1163,15 +1163,15 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo start = keep; } // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** start data bin doesn't make any sense!"; - cerr << endl; + if ((start < 0) || (start > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** start data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds - if ((end < 0) || (end > (Int_t)fForward.size())) { - cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!"; - cerr << endl; + if ((end < 0) || (end > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **ERROR** end data bin doesn't make any sense!"; + std::cerr << std::endl; return false; } @@ -1213,10 +1213,10 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo } else { // no background given to do the job, try estimate fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.1), 0); fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.6), 1); - cerr << endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** Neither fix background nor background bins are given!"; - cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); - cerr << endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::PrepareViewData(): **WARNING** Neither fix background nor background bins are given!"; + std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; + std::cerr << std::endl; if (!EstimateBkg(histoNo)) return false; } @@ -1235,7 +1235,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo Double_t time = 0.0; // data start at data_start-t0 shifted by (pack-1)/2 - fData.SetDataTimeStart(fTimeResolution*((Double_t)start-(Double_t)t0+(Double_t)(packing-1)/2.0)); + fData.SetDataTimeStart(fTimeResolution*(static_cast(start)-static_cast(t0)+static_cast(packing-1)/2.0)); fData.SetDataTimeStep(fTimeResolution*packing); // data is always normalized to (per nsec!!) @@ -1244,7 +1244,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo for (Int_t i=start; i(i)-static_cast(packing-1)/2.0)-t0)*fTimeResolution; expval = TMath::Exp(+time/tau)/N0; fData.AppendValue(-1.0+expval*(value-bkg)); fData.AppendErrorValue(expval*TMath::Sqrt(value*dataNorm)); @@ -1285,7 +1285,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo value = 0.0; error = 0.0; } - time = ((Double_t)i-t0)*fTimeResolution; + time = (static_cast(i)-t0)*fTimeResolution; expval = TMath::Exp(+time/tau)/N0; rrf_val = (-1.0+expval*(fForward[i]/(fTimeResolution*1.0e3)-bkg))*TMath::Cos(wRRF * time + phaseRRF); value += rrf_val; @@ -1310,7 +1310,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo // check if a finer binning for the theory is needed if (fData.GetValue()->size() * 10 > fForward.size()) { size = fData.GetValue()->size() * 10; - factor = (Double_t)fForward.size() / (Double_t)size; + factor = static_cast(fForward.size()) / static_cast(size); } fData.SetTheoryTimeStart(fData.GetDataTimeStart()); fData.SetTheoryTimeStep(fTimeResolution*factor); @@ -1321,7 +1321,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo } for (UInt_t i=0; i(i)*fData.GetTheoryTimeStep(); theoryValue = fTheory->Func(time, par, fFuncValues); if (wRRF != 0.0) { theoryValue *= 2.0*TMath::Cos(wRRF * time + phaseRRF); @@ -1399,7 +1399,7 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa // fill in the T0's from the GLOBAL block section (if present) for (UInt_t i=0; iGetT0BinSize(); i++) { - if (fT0s[i] == -1) { // i.e. not given in the RUN block section + if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section fT0s[i] = globalBlock->GetT0Bin(i); } } @@ -1420,19 +1420,19 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa fT0s[i] = runData->GetT0BinEstimated(histoNo[i]); fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file - cerr << endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t i=0; iGetForwardHistoNoSize(); i++) { - if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!"; - cerr << endl; + if ((fT0s[i] < 0.0) || (fT0s[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -1445,9 +1445,9 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa // get run to be added to the main one addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i)); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -1478,19 +1478,19 @@ Bool_t PRunSingleHisto::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globa fAddT0s[i-1][j] = addRunData->GetT0BinEstimated(histoNo[j]); fRunInfo->SetAddT0Bin(fAddT0s[i-1][j], i-1, j); // keep value for the msr-file - cerr << endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t j=0; jGetForwardHistoNoSize(); j++) { - if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) { - cerr << endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!"; - cerr << endl; + if ((fAddT0s[i-1][j] < 0.0) || (fAddT0s[i-1][j] > static_cast(addRunData->GetDataBin(histoNo[j])->size()))) { + std::cerr << std::endl << ">> PRunSingleHisto::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -1531,19 +1531,19 @@ Bool_t PRunSingleHisto::GetProperDataRange() // check if data range has been provided, and if not try to estimate them if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = (Int_t)fT0s[0]+offset; + Int_t offset = static_cast(10.0e-3/fTimeResolution); + start = static_cast(fT0s[0])+offset; fRunInfo->SetDataRange(start, 0); - cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (end < 0) { end = fForward.size(); fRunInfo->SetDataRange(end, 1); - cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start and end make any sense @@ -1554,22 +1554,22 @@ Bool_t PRunSingleHisto::GetProperDataRange() start = keep; } // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!"; - cerr << endl; + if ((start < 0) || (start > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds if (end < 0) { - cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } - if (end > (Int_t)fForward.size()) { - cerr << endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << (Int_t)fForward.size() << ")."; - cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl; - cerr << endl; - end = (Int_t)fForward.size()-1; + if (end > static_cast(fForward.size())) { + std::cerr << std::endl << ">> PRunSingleHisto::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << fForward.size() << ")."; + std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl; + std::cerr << std::endl; + end = static_cast(fForward.size())-1; } // keep good bins for potential later use @@ -1622,8 +1622,8 @@ void PRunSingleHisto::GetProperFitRange(PMsrGlobalBlock *globalBlock) if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) { fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt - cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; - cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; + std::cerr << ">> PRunSingleHisto::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl; + std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl; } } @@ -1646,7 +1646,7 @@ void PRunSingleHisto::EstimateN0() assert(param); if (paramNo > param->size()) { - cerr << endl << ">> PRunSingleHisto::EstimateN0: **ERROR** found parameter number " << paramNo << ", which is larger than the number of parameters = " << param->size() << endl; + std::cerr << std::endl << ">> PRunSingleHisto::EstimateN0: **ERROR** found parameter number " << paramNo << ", which is larger than the number of parameters = " << param->size() << std::endl; return; } @@ -1663,7 +1663,7 @@ void PRunSingleHisto::EstimateN0() if ((paramNoBkg > 10000) || (paramNoBkg == -1)) { // i.e. fun or map scaleBkg = false; } else { - if (paramNoBkg-1 < (Int_t)param->size()) { + if (paramNoBkg-1 < static_cast(param->size())) { bkg = param->at(paramNoBkg-1).fValue; errBkg = param->at(paramNoBkg-1).fStep; } @@ -1673,7 +1673,7 @@ void PRunSingleHisto::EstimateN0() Double_t dt = fTimeResolution; Double_t tau = PMUON_LIFETIME; - UInt_t t0 = (UInt_t)round(fT0s[0]); + UInt_t t0 = static_cast(round(fT0s[0])); Double_t dval = 0.0; Double_t nom = 0.0; Double_t denom = 0.0; @@ -1681,13 +1681,13 @@ void PRunSingleHisto::EstimateN0() // calc nominator for (UInt_t i=t0; i(i-t0)/tau); nom += xx; } // calc denominator for (UInt_t i=t0; i(i-t0)/tau); dval = fForward[i]; if (dval > 0) denom += xx*xx/dval; @@ -1707,9 +1707,9 @@ void PRunSingleHisto::EstimateN0() errBkg *= rescale; } - cout << ">> PRunSingleHisto::EstimateN0: found N0=" << param->at(paramNo-1).fValue << ", will set it to N0=" << N0 << endl; + std::cout << ">> PRunSingleHisto::EstimateN0: found N0=" << param->at(paramNo-1).fValue << ", will set it to N0=" << N0 << std::endl; if (scaleBkg) - cout << ">> PRunSingleHisto::EstimateN0: found Bkg=" << param->at(paramNoBkg-1).fValue << ", will set it to Bkg=" << bkg << endl; + std::cout << ">> PRunSingleHisto::EstimateN0: found Bkg=" << param->at(paramNoBkg-1).fValue << ", will set it to Bkg=" << bkg << std::endl; fMsrInfo->SetMsrParamValue(paramNo-1, N0); fMsrInfo->SetMsrParamStep(paramNo-1, sqrt(fabs(N0))); if (scaleBkg) { @@ -1745,41 +1745,41 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo) beamPeriod = 0.0; // check if start and end are in proper order - UInt_t start = fRunInfo->GetBkgRange(0); - UInt_t end = fRunInfo->GetBkgRange(1); + Int_t start = fRunInfo->GetBkgRange(0); + Int_t end = fRunInfo->GetBkgRange(1); if (end < start) { - cout << endl << "PRunSingleHisto::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!"; - UInt_t keep = end; + std::cout << std::endl << "PRunSingleHisto::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!"; + Int_t keep = end; end = start; start = keep; } // calculate proper background range if (beamPeriod != 0.0) { - Double_t timeBkg = (Double_t)(end-start)*(fTimeResolution*fPacking); // length of the background intervall in time - UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall + Double_t timeBkg = static_cast(end-start)*(fTimeResolution*fPacking); // length of the background intervall in time + UInt_t fullCycles = static_cast(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall // correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce - end = start + (UInt_t) ((fullCycles*beamPeriod)/(fTimeResolution*fPacking)); - cout << endl << "PRunSingleHisto::EstimatBkg(): Background " << start << ", " << end; + end = start + static_cast((fullCycles*beamPeriod)/(fTimeResolution*fPacking)); + std::cout << std::endl << "PRunSingleHisto::EstimatBkg(): Background " << start << ", " << end; if (end == start) end = fRunInfo->GetBkgRange(1); } // check if start is within histogram bounds if (start >= fForward.size()) { - cerr << endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths = " << fForward.size(); - cerr << endl << ">> background start = " << start; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths = " << fForward.size(); + std::cerr << std::endl << ">> background start = " << start; + std::cerr << std::endl; return false; } // check if end is within histogram bounds if (end >= fForward.size()) { - cerr << endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths = " << fForward.size(); - cerr << endl << ">> background end = " << end; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHisto::EstimatBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths = " << fForward.size(); + std::cerr << std::endl << ">> background end = " << end; + std::cerr << std::endl; return false; } @@ -1821,13 +1821,13 @@ Bool_t PRunSingleHisto::IsScaleN0AndBkg() PMsrLines *cmd = fMsrInfo->GetMsrCommands(); for (UInt_t i=0; isize(); i++) { if (cmd->at(i).fLine.Contains("SCALE_N0_BKG", TString::kIgnoreCase)) { - TObjArray *tokens = 0; - TObjString *ostr = 0; + TObjArray *tokens = nullptr; + TObjString *ostr = nullptr; TString str; tokens = cmd->at(i).fLine.Tokenize(" \t"); if (tokens->GetEntries() != 2) { - cerr << endl << ">> PRunSingleHisto::IsScaleN0AndBkg(): **WARNING** Found uncorrect 'SCALE_N0_BKG' command, will ignore it."; - cerr << endl << ">> Allowed commands: SCALE_N0_BKG TRUE | FALSE" << endl; + std::cerr << std::endl << ">> PRunSingleHisto::IsScaleN0AndBkg(): **WARNING** Found uncorrect 'SCALE_N0_BKG' command, will ignore it."; + std::cerr << std::endl << ">> Allowed commands: SCALE_N0_BKG TRUE | FALSE" << std::endl; return willScale; } ostr = dynamic_cast(tokens->At(1)); diff --git a/src/classes/PRunSingleHistoRRF.cpp b/src/classes/PRunSingleHistoRRF.cpp index 62314a23..ec9ab895 100644 --- a/src/classes/PRunSingleHistoRRF.cpp +++ b/src/classes/PRunSingleHistoRRF.cpp @@ -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 * @@ -38,7 +38,6 @@ #include #include #include -using namespace std; #include #include @@ -88,24 +87,24 @@ PRunSingleHistoRRF::PRunSingleHistoRRF(PMsrHandler *msrInfo, PRunDataHandler *ra PMsrGlobalBlock *global = msrInfo->GetMsrGlobal(); if (!global->IsPresent()) { - cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no GLOBAL-block present!"; - cerr << endl << ">> For Single Histo RRF the GLOBAL-block is mandatory! Please fix this first."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no GLOBAL-block present!"; + std::cerr << std::endl << ">> For Single Histo RRF the GLOBAL-block is mandatory! Please fix this first."; + std::cerr << std::endl; fValid = false; return; } if (!global->GetRRFUnit().CompareTo("??")) { - cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Frequency found!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Frequency found!"; + std::cerr << std::endl; fValid = false; return; } fRRFPacking = global->GetRRFPacking(); if (fRRFPacking == -1) { - cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Packing found!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: no RRF-Packing found!"; + std::cerr << std::endl; fValid = false; return; } @@ -118,9 +117,9 @@ PRunSingleHistoRRF::PRunSingleHistoRRF(PMsrHandler *msrInfo, PRunDataHandler *ra fN0EstimateEndTime = 1.0; // end time in (us) over which N0 is estimated. if (!PrepareData()) { - cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: Couldn't prepare data for fitting!"; - cerr << endl << ">> This is very bad :-(, will quit ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: Couldn't prepare data for fitting!"; + std::cerr << std::endl << ">> This is very bad :-(, will quit ..."; + std::cerr << std::endl; fValid = false; } } @@ -154,7 +153,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquare(const std::vector& par) // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - Int_t funcNo = fMsrInfo->GetFuncNo(i); + UInt_t funcNo = fMsrInfo->GetFuncNo(i); fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par); } @@ -175,7 +174,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquare(const std::vector& par) #pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i(i)*fData.GetDataTimeStep(); diff = fData.GetValue()->at(i) - fTheory->Func(time, par, fFuncValues); chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i)); } @@ -202,7 +201,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquareExpected(const std::vector& // calculate functions for (Int_t i=0; iGetNoOfFuncs(); i++) { - Int_t funcNo = fMsrInfo->GetFuncNo(i); + UInt_t funcNo = fMsrInfo->GetFuncNo(i); fFuncValues[i] = fMsrInfo->EvalFunc(funcNo, *fRunInfo->GetMap(), par); } @@ -223,7 +222,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquareExpected(const std::vector& #pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq) #endif for (i=fStartTimeBin; i < fEndTimeBin; ++i) { - time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep(); + time = fData.GetDataTimeStart() + static_cast(i)*fData.GetDataTimeStep(); theo = fTheory->Func(time, par, fFuncValues); diff = fData.GetValue()->at(i) - theo; chisq += diff*diff / theo; @@ -275,7 +274,7 @@ void PRunSingleHistoRRF::CalcTheory() Double_t resolution = fData.GetDataTimeStep(); Double_t time; for (UInt_t i=0; i(i)*resolution; fData.AppendTheoryValue(fTheory->Func(time, par, fFuncValues)); } @@ -314,8 +313,8 @@ UInt_t PRunSingleHistoRRF::GetNoOfFitBins() */ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange) { - TObjArray *tok = 0; - TObjString *ostr = 0; + TObjArray *tok = nullptr; + TObjString *ostr = nullptr; TString str; Ssiz_t idx = -1; Int_t offset = 0; @@ -324,7 +323,7 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange) if (tok->GetEntries() == 3) { // structure FIT_RANGE fgb+n0 lgb-n1 // handle fgb+n0 entry - ostr = (TObjString*) tok->At(1); + ostr = dynamic_cast(tok->At(1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -336,7 +335,7 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(2); + ostr = dynamic_cast(tok->At(2)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -350,11 +349,11 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange) Int_t pos = 2*(fRunNo+1)-1; if (pos + 1 >= tok->GetEntries()) { - cerr << endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } else { // handle fgb+n0 entry - ostr = (TObjString*) tok->At(pos); + ostr = dynamic_cast(tok->At(pos)); str = ostr->GetString(); // check if there is an offset present idx = str.First("+"); @@ -366,7 +365,7 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange) fFitStartTime = (fGoodBins[0] + offset - fT0s[0]) * fTimeResolution; // handle lgb-n1 entry - ostr = (TObjString*) tok->At(pos+1); + ostr = dynamic_cast(tok->At(pos+1)); str = ostr->GetString(); // check if there is an offset present idx = str.First("-"); @@ -378,8 +377,8 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange) fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution; } } else { // error - cerr << endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; - cerr << endl << ">> will ignore it. Sorry ..." << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'"; + std::cerr << std::endl << ">> will ignore it. Sorry ..." << std::endl; } // clean up @@ -436,8 +435,8 @@ Bool_t PRunSingleHistoRRF::PrepareData() // get the proper run PRawRunData* runData = fRawData->GetRunData(*fRunInfo->GetRunName()); if (!runData) { // couldn't get run - cerr << endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get run " << fRunInfo->GetRunName()->Data() << "!"; + std::cerr << std::endl; return false; } @@ -447,10 +446,10 @@ Bool_t PRunSingleHistoRRF::PrepareData() histoNo.push_back(fRunInfo->GetForwardHistoNo(i)); if (!runData->IsPresent(histoNo[i])) { - cerr << endl << ">> PRunSingleHistoRRF::PrepareData(): **PANIC ERROR**:"; - cerr << endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?"; - cerr << endl << ">> Will quit :-("; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareData(): **PANIC ERROR**:"; + std::cerr << std::endl << ">> histoNo found = " << histoNo[i] << ", which is NOT present in the data file!?!?"; + std::cerr << std::endl << ">> Will quit :-("; + std::cerr << std::endl; histoNo.clear(); return false; } @@ -458,8 +457,8 @@ Bool_t PRunSingleHistoRRF::PrepareData() // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; - cout.precision(10); - cout << endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl; + std::cout.precision(10); + std::cout << std::endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << std::fixed << runData->GetTimeResolution() << "(ns)" << std::endl; // get all the proper t0's and addt0's for the current RUN block if (!GetProperT0(runData, globalBlock, histoNo)) { @@ -467,7 +466,7 @@ Bool_t PRunSingleHistoRRF::PrepareData() } // keep the histo of each group at this point (addruns handled below) - vector forward; + std::vector forward; forward.resize(histoNo.size()); // resize to number of groups for (UInt_t i=0; iGetDataBin(histoNo[i])->size()); @@ -481,9 +480,9 @@ Bool_t PRunSingleHistoRRF::PrepareData() // get run to be added to the main one addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i)); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareData(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -493,8 +492,9 @@ Bool_t PRunSingleHistoRRF::PrepareData() addRunSize = addRunData->GetDataBin(histoNo[k])->size(); for (UInt_t j=0; jGetDataBin(histoNo[k])->size(); j++) { // loop over the bin indices // make sure that the index stays in the proper range - if (((Int_t)j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] >= 0) && (j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k] < addRunSize)) { - forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+(Int_t)fAddT0s[i-1][k]-(Int_t)fT0s[k]); + if ((static_cast(j)+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k]) >= 0) && + (j+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k]) < addRunSize)) { + forward[k][j] += addRunData->GetDataBin(histoNo[k])->at(j+static_cast(fAddT0s[i-1][k])-static_cast(fT0s[k])); } } } @@ -511,8 +511,9 @@ Bool_t PRunSingleHistoRRF::PrepareData() for (UInt_t i=1; iGetDataBin(histoNo[i])->size(); j++) { // loop over the bin indices // make sure that the index stays within proper range - if (((Int_t)j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) { - fForward[j] += forward[i][j+(Int_t)fT0s[i]-(Int_t)fT0s[0]]; + if ((static_cast(j)+static_cast(fT0s[i])-static_cast(fT0s[0]) >= 0) && + (j+static_cast(fT0s[i])-static_cast(fT0s[0]) < runData->GetDataBin(histoNo[i])->size())) { + fForward[j] += forward[i][j+static_cast(fT0s[i])-static_cast(fT0s[0])]; } } } @@ -567,13 +568,13 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his rawNt.push_back(fForward[i]); // N(t) without any corrections } Double_t freqMax = GetMainFrequency(rawNt); - cout << "info> freqMax=" << freqMax << " (MHz)" << endl; + std::cout << "info> freqMax=" << freqMax << " (MHz)" << std::endl; // "optimal packing" Double_t optNoPoints = 8; if (freqMax < 271.0) // < 271 MHz, i.e ~ 2T optNoPoints = 5; - cout << "info> optimal packing: " << (Int_t)(1.0 / (fTimeResolution*(freqMax - fMsrInfo->GetMsrGlobal()->GetRRFFreq("MHz"))) / optNoPoints); + std::cout << "info> optimal packing: " << static_cast(1.0 / (fTimeResolution*(freqMax - fMsrInfo->GetMsrGlobal()->GetRRFFreq("MHz"))) / optNoPoints); // initially fForward is the "raw data set" (i.e. grouped histo and raw runs already added) to be fitted. This means fForward = N(t) at this point. @@ -586,10 +587,10 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his } else { // no background given to do the job, try estimate fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.1), 0); fRunInfo->SetBkgRange(static_cast(fT0s[0]*0.6), 1); - cerr << endl << ">> PRunSingleHistoRRF::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!"; - cerr << endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); - cerr << endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!"; + std::cerr << std::endl << ">> Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ..."; + std::cerr << std::endl; if (!EstimateBkg(histoNo)) return false; } @@ -604,10 +605,10 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his } // here fForward = N(t) - Nbkg - Int_t t0 = (Int_t)fT0s[0]; + Int_t t0 = static_cast(fT0s[0]); // 2) N(t) - Nbkg -> exp(+t/tau) [N(t)-Nbkg] - Double_t startTime = fTimeResolution * ((Double_t)fGoodBins[0] - (Double_t)t0); + Double_t startTime = fTimeResolution * (static_cast(fGoodBins[0]) - static_cast(t0)); Double_t time_tau=0.0; Double_t exp_t_tau=0.0; @@ -650,7 +651,7 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his Double_t phaseRRF = globalBlock->GetRRFPhase()*TMath::TwoPi()/180.0; Double_t time = 0.0; for (Int_t i=fGoodBins[0]; i<=fGoodBins[1]; i++) { - time = startTime + fTimeResolution * ((Double_t)i - (Double_t)fGoodBins[0]); + time = startTime + fTimeResolution * (static_cast(i) - static_cast(fGoodBins[0])); fForward[i] *= 2.0*cos(wRRF * time + phaseRRF); } @@ -683,7 +684,7 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his } // set start time and time step - fData.SetDataTimeStart(fTimeResolution*((Double_t)fGoodBins[0]-(Double_t)t0+(Double_t)(fRRFPacking-1)/2.0)); + fData.SetDataTimeStart(fTimeResolution*(static_cast(fGoodBins[0])-static_cast(t0)+static_cast(fRRFPacking-1)/2.0)); fData.SetDataTimeStep(fTimeResolution*fRRFPacking); CalcNoOfFitBins(); @@ -723,8 +724,8 @@ Bool_t PRunSingleHistoRRF::PrepareViewData(PRawRunData* runData, const UInt_t hi Int_t viewPacking = fMsrInfo->GetMsrPlotList()->at(0).fViewPacking; if (viewPacking > 0) { if (viewPacking < fRRFPacking) { - cerr << ">> PRunSingleHistoRRF::PrepareViewData(): **WARNING** Found View Packing (" << viewPacking << ") < RRF Packing (" << fRRFPacking << ")."; - cerr << ">> Will ignore View Packing." << endl; + std::cerr << ">> PRunSingleHistoRRF::PrepareViewData(): **WARNING** Found View Packing (" << viewPacking << ") < RRF Packing (" << fRRFPacking << ")."; + std::cerr << ">> Will ignore View Packing." << std::endl; } else { // STILL MISSING } @@ -753,14 +754,14 @@ Bool_t PRunSingleHistoRRF::PrepareViewData(PRawRunData* runData, const UInt_t hi if (fData.GetValue()->size() * 10 > fForward.size()) { size = fData.GetValue()->size() * 10; - factor = (Double_t)fForward.size() / (Double_t)size; + factor = static_cast(fForward.size()) / static_cast(size); } fData.SetTheoryTimeStart(fData.GetDataTimeStart()); fData.SetTheoryTimeStep(fTimeResolution*factor); // calculate theory for (UInt_t i=0; i(i)*fData.GetTheoryTimeStep(); theoryValue = fTheory->Func(time, par, fFuncValues); if (fabs(theoryValue) > 10.0) { // dirty hack needs to be fixed!! theoryValue = 0.0; @@ -808,7 +809,7 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl // fill in the T0's from the GLOBAL block section (if present) for (UInt_t i=0; iGetT0BinSize(); i++) { - if (fT0s[i] == -1) { // i.e. not given in the RUN block section + if (fT0s[i] == -1.0) { // i.e. not given in the RUN block section fT0s[i] = globalBlock->GetT0Bin(i); } } @@ -829,19 +830,19 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl fT0s[i] = runData->GetT0BinEstimated(histoNo[i]); fRunInfo->SetT0Bin(fT0s[i], i); // keep value for the msr-file - cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName()->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << runData->GetT0BinEstimated(histoNo[i]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t i=0; iGetForwardHistoNoSize(); i++) { - if ((fT0s[i] < 0) || (fT0s[i] > (Int_t)runData->GetDataBin(histoNo[i])->size())) { - cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!"; - cerr << endl; + if ((fT0s[i] < 0.0) || (fT0s[i] > static_cast(runData->GetDataBin(histoNo[i])->size()))) { + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** t0 data bin (" << fT0s[i] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -854,9 +855,9 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl // get run to be added to the main one addRunData = fRawData->GetRunData(*fRunInfo->GetRunName(i)); - if (addRunData == 0) { // couldn't get run - cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; - cerr << endl; + if (addRunData == nullptr) { // couldn't get run + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** Couldn't get addrun " << fRunInfo->GetRunName(i)->Data() << "!"; + std::cerr << std::endl; return false; } @@ -887,19 +888,19 @@ Bool_t PRunSingleHistoRRF::GetProperT0(PRawRunData* runData, PMsrGlobalBlock *gl fAddT0s[i-1][j] = addRunData->GetT0BinEstimated(histoNo[j]); fRunInfo->SetAddT0Bin(fAddT0s[i-1][j], i-1, j); // keep value for the msr-file - cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; - cerr << endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); - cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]); - cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!"; + std::cerr << std::endl << ">> run: " << fRunInfo->GetRunName(i)->Data(); + std::cerr << std::endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0BinEstimated(histoNo[j]); + std::cerr << std::endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!"; + std::cerr << std::endl; } } // check if t0 is within proper bounds for (UInt_t j=0; jGetForwardHistoNoSize(); j++) { - if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > (Int_t)addRunData->GetDataBin(histoNo[j])->size())) { - cerr << endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!"; - cerr << endl; + if ((fAddT0s[i-1][j] < 0) || (fAddT0s[i-1][j] > static_cast(addRunData->GetDataBin(histoNo[j])->size()))) { + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperT0(): **ERROR** addt0 data bin (" << fAddT0s[i-1][j] << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } } @@ -940,19 +941,19 @@ Bool_t PRunSingleHistoRRF::GetProperDataRange() // check if data range has been provided, and if not try to estimate them if (start < 0) { - Int_t offset = (Int_t)(10.0e-3/fTimeResolution); - start = (Int_t)fT0s[0]+offset; + Int_t offset = static_cast(10.0e-3/fTimeResolution); + start = static_cast(fT0s[0])+offset; fRunInfo->SetDataRange(start, 0); - cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range start = t0+" << offset << "(=10ns) = " << start << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } if (end < 0) { end = fForward.size(); fRunInfo->SetDataRange(end, 1); - cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << "."; - cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** data range was not provided, will try data range end = " << end << "."; + std::cerr << std::endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + std::cerr << std::endl; } // check if start and end make any sense @@ -963,22 +964,22 @@ Bool_t PRunSingleHistoRRF::GetProperDataRange() start = keep; } // 2nd check if start is within proper bounds - if ((start < 0) || (start > (Int_t)fForward.size())) { - cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!"; - cerr << endl; + if ((start < 0) || (start > static_cast(fForward.size()))) { + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** start data bin (" << start << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } // 3rd check if end is within proper bounds if (end < 0) { - cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!"; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **ERROR** end data bin (" << end << ") doesn't make any sense!"; + std::cerr << std::endl; return false; } - if (end > (Int_t)fForward.size()) { - cerr << endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << (Int_t)fForward.size() << ")."; - cerr << endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << endl; - cerr << endl; - end = (Int_t)fForward.size()-1; + if (end > static_cast(fForward.size())) { + std::cerr << std::endl << ">> PRunSingleHistoRRF::GetProperDataRange(): **WARNING** end data bin (" << end << ") > histo length (" << fForward.size() << ")."; + std::cerr << std::endl << ">> Will set end = (histo length - 1). Consider to change it in the msr-file." << std::endl; + std::cerr << std::endl; + end = static_cast(fForward.size()-1); } // keep good bins for potential later use @@ -1031,8 +1032,8 @@ void PRunSingleHistoRRF::GetProperFitRange(PMsrGlobalBlock *globalBlock) if ((fFitStartTime == PMUSR_UNDEFINED) || (fFitEndTime == PMUSR_UNDEFINED)) { fFitStartTime = (fGoodBins[0] - fT0s[0]) * fTimeResolution; // (fgb-t0)*dt fFitEndTime = (fGoodBins[1] - fT0s[0]) * fTimeResolution; // (lgb-t0)*dt - cerr << ">> PRunSingleHistoRRF::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << endl; - cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << endl; + std::cerr << ">> PRunSingleHistoRRF::GetProperFitRange(): **WARNING** Couldn't get fit start/end time!" << std::endl; + std::cerr << ">> Will set it to fgb/lgb which given in time is: " << fFitStartTime << "..." << fFitEndTime << " (usec)" << std::endl; } } @@ -1102,7 +1103,7 @@ Double_t PRunSingleHistoRRF::EstimateN0(Double_t &errN0, Double_t freqMax) { // endBin is estimated such that the number of full cycles (according to the maximum frequency of the data) // is approximately the time fN0EstimateEndTime. - Int_t endBin = (Int_t)round(ceil(fN0EstimateEndTime*freqMax/TMath::TwoPi()) * (TMath::TwoPi()/freqMax) / fTimeResolution); + Int_t endBin = static_cast(round(ceil(fN0EstimateEndTime*freqMax/TMath::TwoPi()) * (TMath::TwoPi()/freqMax) / fTimeResolution)); Double_t n0 = 0.0; Double_t wN = 0.0; @@ -1120,7 +1121,7 @@ Double_t PRunSingleHistoRRF::EstimateN0(Double_t &errN0, Double_t freqMax) } errN0 = sqrt(errN0)/wN; - cout << "info> PRunSingleHistoRRF::EstimateN0(): N0=" << n0 << "(" << errN0 << ")" << endl; + std::cout << "info> PRunSingleHistoRRF::EstimateN0(): N0=" << n0 << "(" << errN0 << ")" << std::endl; return n0; } @@ -1155,7 +1156,7 @@ Bool_t PRunSingleHistoRRF::EstimateBkg(UInt_t histoNo) UInt_t start = fRunInfo->GetBkgRange(0); UInt_t end = fRunInfo->GetBkgRange(1); if (end < start) { - cout << endl << "PRunSingleHistoRRF::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!"; + std::cout << std::endl << "PRunSingleHistoRRF::EstimatBkg(): end = " << end << " > start = " << start << "! Will swap them!"; UInt_t keep = end; end = start; start = keep; @@ -1163,30 +1164,30 @@ Bool_t PRunSingleHistoRRF::EstimateBkg(UInt_t histoNo) // calculate proper background range if (beamPeriod != 0.0) { - Double_t timeBkg = (Double_t)(end-start)*fTimeResolution; // length of the background intervall in time - UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall + Double_t timeBkg = static_cast(end-start)*fTimeResolution; // length of the background intervall in time + UInt_t fullCycles = static_cast(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall // correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce - end = start + (UInt_t) ((fullCycles*beamPeriod)/fTimeResolution); - cout << endl << "PRunSingleHistoRRF::EstimatBkg(): Background " << start << ", " << end; + end = start + static_cast((fullCycles*beamPeriod)/fTimeResolution); + std::cout << std::endl << "PRunSingleHistoRRF::EstimatBkg(): Background " << start << ", " << end; if (end == start) end = fRunInfo->GetBkgRange(1); } // check if start is within histogram bounds if (start >= fForward.size()) { - cerr << endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths = " << fForward.size(); - cerr << endl << ">> background start = " << start; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths = " << fForward.size(); + std::cerr << std::endl << ">> background start = " << start; + std::cerr << std::endl; return false; } // check if end is within histogram bounds if (end >= fForward.size()) { - cerr << endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!"; - cerr << endl << ">> histo lengths = " << fForward.size(); - cerr << endl << ">> background end = " << end; - cerr << endl; + std::cerr << std::endl << ">> PRunSingleHistoRRF::EstimatBkg(): **ERROR** background bin values out of bound!"; + std::cerr << std::endl << ">> histo lengths = " << fForward.size(); + std::cerr << std::endl << ">> background end = " << end; + std::cerr << std::endl; return false; } @@ -1205,7 +1206,7 @@ Bool_t PRunSingleHistoRRF::EstimateBkg(UInt_t histoNo) bkg += pow(fForward[i]-fBackground, 2.0); fBkgErr = sqrt(bkg/(static_cast(end - start))); - cout << endl << "info> fBackground=" << fBackground << "(" << fBkgErr << ")" << endl; + std::cout << std::endl << "info> fBackground=" << fBackground << "(" << fBkgErr << ")" << std::endl; fRunInfo->SetBkgEstimated(fBackground, 0); diff --git a/src/classes/PStartupHandler.cpp b/src/classes/PStartupHandler.cpp index 2c1c4577..5deb59c9 100644 --- a/src/classes/PStartupHandler.cpp +++ b/src/classes/PStartupHandler.cpp @@ -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 #include #include -using namespace std; #include #include @@ -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 << "" << endl; - fout << "" << endl; - fout << " " << endl; - fout << " Defines default settings for the musrfit package" << endl; - fout << " " << endl; - fout << " /afs/psi.ch/project/nemu/data/his" << endl; - fout << " /afs/psi.ch/project/nemu/data/wkm" << endl; - fout << " /afs/psi.ch/project/bulkmusr/data/gps" << endl; - fout << " /afs/psi.ch/project/bulkmusr/data/dolly" << endl; - fout << " /afs/psi.ch/project/bulkmusr/data/gpd" << endl; - fout << " /afs/psi.ch/project/bulkmusr/data/ltf" << endl; - fout << " /afs/psi.ch/project/bulkmusr/data/alc" << endl; - fout << " /afs/psi.ch/project/bulkmusr/data/hifi" << endl; - fout << " /afs/psi.ch/project/bulkmusr/data/lem" << endl; - fout << " " << endl; - fout << " Gauss" << endl; - fout << " 0" << endl; - fout << " none" << endl; - fout << " real_and_imag" << endl; - fout << " 0.0" << endl; - fout << " 1.0" << endl; - fout << " " << endl; - fout << " " << endl; - fout << " " << endl; - fout << " " << endl; - fout << " 24 " << endl; - fout << " 25 " << endl; - fout << " 26 " << endl; - fout << " 27 " << endl; - fout << " 28 " << endl; - fout << " 29 " << endl; - fout << " 30 " << endl; - fout << " 20 " << endl; - fout << " 21 " << endl; - fout << " 22 " << endl; - fout << " 23 " << endl; - fout << " 2 " << endl; - fout << " 3 " << endl; - fout << " 5 " << endl; - fout << " " << endl; - fout << " " << endl; - fout << " " << endl; - fout << " 0,0,0 " << endl; - fout << " 255,0,0 " << endl; - fout << " 0,255,0 " << endl; - fout << " 0,0,255 " << endl; - fout << " 255,0,255 " << endl; - fout << " 0,255,255 " << endl; - fout << " 153,0,255 " << endl; - fout << " 102,102,51 " << endl; - fout << " 51,102,51 " << endl; - fout << " 153,0,0 " << endl; - fout << " " << endl; - fout << " " << endl; - fout << "" << endl; + fout << "" << std::endl; + fout << "" << std::endl; + fout << " " << std::endl; + fout << " Defines default settings for the musrfit package" << std::endl; + fout << " " << std::endl; + fout << " /afs/psi.ch/project/nemu/data/his" << std::endl; + fout << " /afs/psi.ch/project/nemu/data/wkm" << std::endl; + fout << " /afs/psi.ch/project/bulkmusr/data/gps" << std::endl; + fout << " /afs/psi.ch/project/bulkmusr/data/dolly" << std::endl; + fout << " /afs/psi.ch/project/bulkmusr/data/gpd" << std::endl; + fout << " /afs/psi.ch/project/bulkmusr/data/ltf" << std::endl; + fout << " /afs/psi.ch/project/bulkmusr/data/alc" << std::endl; + fout << " /afs/psi.ch/project/bulkmusr/data/hifi" << std::endl; + fout << " /afs/psi.ch/project/bulkmusr/data/lem" << std::endl; + fout << " " << std::endl; + fout << " Gauss" << std::endl; + fout << " 0" << std::endl; + fout << " none" << std::endl; + fout << " real_and_imag" << std::endl; + fout << " 0.0" << std::endl; + fout << " 1.0" << std::endl; + fout << " " << std::endl; + fout << " " << std::endl; + fout << " " << std::endl; + fout << " " << std::endl; + fout << " 24 " << std::endl; + fout << " 25 " << std::endl; + fout << " 26 " << std::endl; + fout << " 27 " << std::endl; + fout << " 28 " << std::endl; + fout << " 29 " << std::endl; + fout << " 30 " << std::endl; + fout << " 20 " << std::endl; + fout << " 21 " << std::endl; + fout << " 22 " << std::endl; + fout << " 23 " << std::endl; + fout << " 2 " << std::endl; + fout << " 3 " << std::endl; + fout << " 5 " << std::endl; + fout << " " << std::endl; + fout << " " << std::endl; + fout << " " << std::endl; + fout << " 0,0,0 " << std::endl; + fout << " 255,0,0 " << std::endl; + fout << " 0,255,0 " << std::endl; + fout << " 0,0,255 " << std::endl; + fout << " 255,0,255 " << std::endl; + fout << " 0,255,255 " << std::endl; + fout << " 153,0,255 " << std::endl; + fout << " 102,102,51 " << std::endl; + fout << " 51,102,51 " << std::endl; + fout << " 153,0,0 " << std::endl; + fout << " " << std::endl; + fout << " " << std::endl; + fout << "" << std::endl; fout.close(); diff --git a/src/classes/PTheory.cpp b/src/classes/PTheory.cpp index b9f19285..4e7efece 100644 --- a/src/classes/PTheory.cpp +++ b/src/classes/PTheory.cpp @@ -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 #include -using namespace std; #include #include @@ -47,7 +46,7 @@ using namespace std; #define SQRT_TWO 1.41421356237 #define SQRT_PI 1.77245385091 -extern vector gGlobalUserFcn; +extern std::vector 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(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(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(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(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(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; isize(); i++) { @@ -956,19 +831,19 @@ void PTheory::MakeCleanAndTidyTheoryBlock(PMsrLines *fullTheoryBlock) for (UInt_t j=0; j(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(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; jGetEntries(); j++) { ostr = dynamic_cast(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(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; jGetEntries(); + for (Int_t j=1; j(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(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; jGetEntries(); j++) { ostr = dynamic_cast(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; } diff --git a/src/classes/PUserFcn.cpp b/src/classes/PUserFcn.cpp index 287d63aa..22bffa99 100644 --- a/src/classes/PUserFcn.cpp +++ b/src/classes/PUserFcn.cpp @@ -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 -using namespace std; - #include #include "PUserFcn.h" diff --git a/src/classes/PUserFcnBase.cpp b/src/classes/PUserFcnBase.cpp index d5ec6525..f461a22b 100644 --- a/src/classes/PUserFcnBase.cpp +++ b/src/classes/PUserFcnBase.cpp @@ -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 #include -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 gGlobalUserFcn; +std::vector gGlobalUserFcn; diff --git a/src/dump_header.cpp b/src/dump_header.cpp index aa69fafc..b18fcd32 100644 --- a/src/dump_header.cpp +++ b/src/dump_header.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2012 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 * @@ -45,9 +45,13 @@ #include #include -using namespace std; +#include +#include +#include #include +#include +#include #include "git-revision.h" #include "PStartupHandler.h" @@ -69,37 +73,37 @@ using namespace std; */ void dump_header_syntax() { - cout << endl << "usage: dump_header [-rn | -fn ] [-ff, --fileFormat ]"; - cout << endl << " [-y, --year ] [-s, --summary] [--psi-bulk ] |"; - cout << endl << " --help | --version"; - cout << endl; - cout << endl << " Dumps the header information of a given muSR data file onto the standard output."; - cout << endl << " If no info is povided, it will try to guess what it might be."; - cout << endl << " For guessing of the file format is not possible. The default assumption here is 'MusrRoot'."; - cout << endl; - cout << endl << " -rn, --runNo : run number of the header to be dumped."; - cout << endl << " -fn, --fileName : muSR data file name."; - cout << endl << " -ff, --fileFormat : where can be:"; - cout << endl << " MusrRoot, NeXus, ROOT (old LEM), PSI-BIN, PSI-MDU, MUD, WKM"; - cout << endl << " NeXus is only supported if enabled."; - cout << endl << " -y, --year : has to be 4 digit, e.g. 2005, if provided it is used to"; - cout << endl << " generate the file name for the given , otherwise the current"; - cout << endl << " year is used. If a file name is given, this option has no effect."; - cout << endl << " -s, --summary : this option is used for LE-uSR data sets only. It will, additionally"; - cout << endl << " to the header information, print the summary file content."; - cout << endl << " --psi-bulk : where consists of two items: (i) pta or tdc, "; - cout << endl << " (ii) gps | ltf | dolly | gpd | hifi. This is needed in combination with"; - cout << endl << " the file formats PSI-BIN and PSI-MDU."; - cout << endl << " -h, --help : will show this help"; - cout << endl << " -v, --version : will show the current version."; - cout << endl << endl; + std::cout << std::endl << "usage: dump_header [-rn | -fn ] [-ff, --fileFormat ]"; + std::cout << std::endl << " [-y, --year ] [-s, --summary] [--psi-bulk ] |"; + std::cout << std::endl << " --help | --version"; + std::cout << std::endl; + std::cout << std::endl << " Dumps the header information of a given muSR data file onto the standard output."; + std::cout << std::endl << " If no info is povided, it will try to guess what it might be."; + std::cout << std::endl << " For guessing of the file format is not possible. The default assumption here is 'MusrRoot'."; + std::cout << std::endl; + std::cout << std::endl << " -rn, --runNo : run number of the header to be dumped."; + std::cout << std::endl << " -fn, --fileName : muSR data file name."; + std::cout << std::endl << " -ff, --fileFormat : where can be:"; + std::cout << std::endl << " MusrRoot, NeXus, ROOT (old LEM), PSI-BIN, PSI-MDU, MUD, WKM"; + std::cout << std::endl << " NeXus is only supported if enabled."; + std::cout << std::endl << " -y, --year : has to be 4 digit, e.g. 2005, if provided it is used to"; + std::cout << std::endl << " generate the file name for the given , otherwise the current"; + std::cout << std::endl << " year is used. If a file name is given, this option has no effect."; + std::cout << std::endl << " -s, --summary : this option is used for LE-uSR data sets only. It will, additionally"; + std::cout << std::endl << " to the header information, print the summary file content."; + std::cout << std::endl << " --psi-bulk : where consists of two items: (i) pta or tdc, "; + std::cout << std::endl << " (ii) gps | ltf | dolly | gpd | hifi. This is needed in combination with"; + std::cout << std::endl << " the file formats PSI-BIN and PSI-MDU."; + std::cout << std::endl << " -h, --help : will show this help"; + std::cout << std::endl << " -v, --version : will show the current version."; + std::cout << std::endl << std::endl; } //------------------------------------------------------------------------ /** * */ -int dump_header_root(const string fileName, const string fileFormat, const bool summary) +int dump_header_root(const std::string fileName, const std::string fileFormat, const bool summary) { TFile f(fileName.c_str()); if (f.IsZombie()) { @@ -113,7 +117,7 @@ int dump_header_root(const string fileName, const string fileFormat, const bool if (!folder) { // either something is wrong, or it is a MusrRoot file f.GetObject("RunHeader", folder); if (!folder) { // something is wrong!! - cerr << endl << "**ERROR** Couldn't neither obtain RunInfo (LEM), nor RunHeader (MusrRoot) from " << fileName << endl; + std::cerr << std::endl << "**ERROR** Couldn't neither obtain RunInfo (LEM), nor RunHeader (MusrRoot) from " << fileName << std::endl; f.Close(); return 1; } else { @@ -129,64 +133,64 @@ int dump_header_root(const string fileName, const string fileFormat, const bool // check if run header is valid if (!runHeader) { - cerr << endl << "**ERROR** Couldn't obtain run header info from ROOT file " << fileName << endl; + std::cerr << std::endl << "**ERROR** Couldn't obtain run header info from ROOT file " << fileName << std::endl; f.Close(); return 1; } - cout << endl << "-------------------"; - cout << endl << "fileName = " << fileName << ", fileFormat = " << fileFormat; - cout << endl << "-------------------"; - cout << endl << "Run Title : " << runHeader->GetRunTitle().GetString().Data(); - cout << endl << "Run Number : " << runHeader->GetRunNumber(); - cout << endl << "Run Start Time : " << runHeader->GetStartTimeString().GetString().Data(); - cout << endl << "Run Stop Time : " << runHeader->GetStopTimeString().GetString().Data(); - cout << endl << "Laboratory : PSI"; - cout << endl << "Instrument : LEM"; - cout << endl << "Beamline : muE4"; - cout << endl << "Muon Beam Momentum : 28 MeV/c"; - cout << endl << "Muon Species : positive muons"; - cout << endl << "Muon Source : Target E - slow muons"; - cout << endl << "Setup : " << runHeader->GetLemSetup().GetString().Data(); - cout << endl << "Comment : n/a"; - cout << endl << "Sample Name : n/a"; - cout << endl << "Sample Orientation : n/a"; - cout << endl << "Sample Temperature : " << runHeader->GetSampleTemperature() << "+-" << runHeader->GetSampleTemperatureError() << " K"; - cout << endl << "Sample Mag. Field : " << runHeader->GetSampleBField() << "+-" << runHeader->GetSampleBFieldError() << " G"; - cout << endl << "No of Histos : " << runHeader->GetNHist(); - cout << endl << "Time Resolution : " << runHeader->GetTimeResolution() << " ns"; - cout << endl << "-------------------"; - cout << endl << "LEM Specific Entries :"; - cout << endl << "Moderator : " << runHeader->GetModerator().GetString().Data(); - cout << endl << "Moderator HV : " << runHeader->GetModeratorHV() << " kV"; - cout << endl << "Sample HV : " << runHeader->GetSampleHV() << " kV"; - cout << endl << "Impl. Energy : " << runHeader->GetImpEnergy() << " keV"; - cout << endl << "-------------------"; - cout << endl << "Detector Info (for all detectors the same): "; - cout << endl << "-------------------"; - cout << endl << "Histo Length : " << runHeader->GetNChannels(); + std::cout << std::endl << "-------------------"; + std::cout << std::endl << "fileName = " << fileName << ", fileFormat = " << fileFormat; + std::cout << std::endl << "-------------------"; + std::cout << std::endl << "Run Title : " << runHeader->GetRunTitle().GetString().Data(); + std::cout << std::endl << "Run Number : " << runHeader->GetRunNumber(); + std::cout << std::endl << "Run Start Time : " << runHeader->GetStartTimeString().GetString().Data(); + std::cout << std::endl << "Run Stop Time : " << runHeader->GetStopTimeString().GetString().Data(); + std::cout << std::endl << "Laboratory : PSI"; + std::cout << std::endl << "Instrument : LEM"; + std::cout << std::endl << "Beamline : muE4"; + std::cout << std::endl << "Muon Beam Momentum : 28 MeV/c"; + std::cout << std::endl << "Muon Species : positive muons"; + std::cout << std::endl << "Muon Source : Target E - slow muons"; + std::cout << std::endl << "Setup : " << runHeader->GetLemSetup().GetString().Data(); + std::cout << std::endl << "Comment : n/a"; + std::cout << std::endl << "Sample Name : n/a"; + std::cout << std::endl << "Sample Orientation : n/a"; + std::cout << std::endl << "Sample Temperature : " << runHeader->GetSampleTemperature() << "+-" << runHeader->GetSampleTemperatureError() << " K"; + std::cout << std::endl << "Sample Mag. Field : " << runHeader->GetSampleBField() << "+-" << runHeader->GetSampleBFieldError() << " G"; + std::cout << std::endl << "No of Histos : " << runHeader->GetNHist(); + std::cout << std::endl << "Time Resolution : " << runHeader->GetTimeResolution() << " ns"; + std::cout << std::endl << "-------------------"; + std::cout << std::endl << "LEM Specific Entries :"; + std::cout << std::endl << "Moderator : " << runHeader->GetModerator().GetString().Data(); + std::cout << std::endl << "Moderator HV : " << runHeader->GetModeratorHV() << " kV"; + std::cout << std::endl << "Sample HV : " << runHeader->GetSampleHV() << " kV"; + std::cout << std::endl << "Impl. Energy : " << runHeader->GetImpEnergy() << " keV"; + std::cout << std::endl << "-------------------"; + std::cout << std::endl << "Detector Info (for all detectors the same): "; + std::cout << std::endl << "-------------------"; + std::cout << std::endl << "Histo Length : " << runHeader->GetNChannels(); double *timeZero; timeZero = runHeader->GetTimeZero(); - cout << endl << "Time Zero Bin : " << timeZero[0]; - cout << endl << "First Good Bin : " << timeZero[0]; - cout << endl << "Last Good Bin : " << runHeader->GetNChannels()-1; - cout << endl << "-------------------" << endl << endl; + std::cout << std::endl << "Time Zero Bin : " << timeZero[0]; + std::cout << std::endl << "First Good Bin : " << timeZero[0]; + std::cout << std::endl << "Last Good Bin : " << runHeader->GetNChannels()-1; + std::cout << std::endl << "-------------------" << std::endl << std::endl; delete runHeader; } else { // MusrRoot // invoke the MusrRoot header object TMusrRunHeader *header = new TMusrRunHeader(fileName.c_str(), true); // read quite if (header == 0) { - cerr << endl << "**ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fileName; - cerr << endl; + std::cerr << std::endl << "**ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fileName; + std::cerr << std::endl; f.Close(); return 1; } // try to populate the MusrRoot header object if (!header->ExtractAll(folder)) { - cerr << endl << "**ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fileName; - cerr << endl; + std::cerr << std::endl << "**ERROR** Couldn't invoke MusrRoot RunHeader in file:" << fileName; + std::cerr << std::endl; f.Close(); return 1; } @@ -198,22 +202,22 @@ int dump_header_root(const string fileName, const string fileFormat, const bool // summary as well? if (summary && (fileType == DH_MUSR_ROOT)) { - TObjArray *runSum=0; - runSum = (TObjArray*)folder->FindObject("RunSummary"); + TObjArray *runSum=nullptr; + runSum = static_cast(folder->FindObject("RunSummary")); if (!runSum) { // something is wrong!! - cerr << endl << "**ERROR** Couldn't obtain RunSummary " << fileName << endl; + std::cerr << std::endl << "**ERROR** Couldn't obtain RunSummary " << fileName << std::endl; f.Close(); return 1; } - cout << "++++++++++++++++++++" << endl; - cout << " Run Summary" << endl; - cout << "++++++++++++++++++++" << endl; + std::cout << "++++++++++++++++++++" << std::endl; + std::cout << " Run Summary" << std::endl; + std::cout << "++++++++++++++++++++" << std::endl; TObjString *tstr; TString str; for (Int_t i=0; iGetEntries(); i++) { - tstr = (TObjString*)runSum->At(i); + tstr = static_cast(runSum->At(i)); str = tstr->String(); - cout << str; + std::cout << str; } } @@ -226,7 +230,7 @@ int dump_header_root(const string fileName, const string fileFormat, const bool /** * */ -int dump_header_nexus(const string fileName) { +int dump_header_nexus(const std::string fileName) { #ifdef PNEXUS_ENABLED PNeXus *nxs_file = new PNeXus(fileName.c_str()); @@ -238,7 +242,7 @@ int dump_header_nexus(const string fileName) { if (nxs_file) delete nxs_file; #else - cout << endl << "NeXus not enabled, hence the header information cannot be dumped." << endl << endl; + std::cout << std::endl << "NeXus not enabled, hence the header information cannot be dumped." << std::endl << std::endl; #endif return 0; @@ -248,44 +252,44 @@ int dump_header_nexus(const string fileName) { /** * */ -vector dump_header_instrument_info(string fileName) +std::vector dump_header_instrument_info(std::string fileName) { - vector result; - string fln(fileName); + std::vector result; + std::string fln(fileName); boost::to_lower(fln); - if ((fln.find(".bin") != string::npos) || (fln.find(".mdu") != string::npos)) { // PSI-BIN or PSI-MDU format - if (fln.find("_gps_") != string::npos) { + if ((fln.find(".bin") != std::string::npos) || (fln.find(".mdu") != std::string::npos)) { // PSI-BIN or PSI-MDU format + if (fln.find("_gps_") != std::string::npos) { result.push_back("GPS"); result.push_back("piM3.2"); result.push_back("28 MeV/c"); result.push_back("likely to be positive muons"); result.push_back("Target M"); - } else if (fln.find("_ltf_") != string::npos) { + } else if (fln.find("_ltf_") != std::string::npos) { result.push_back("LTF"); result.push_back("piM3.1"); result.push_back("28 MeV/c"); result.push_back("likely to be positive muons"); result.push_back("Target M"); - } else if (fln.find("_dolly_") != string::npos) { + } else if (fln.find("_dolly_") != std::string::npos) { result.push_back("DOLLY"); result.push_back("piE1"); result.push_back("28 MeV/c"); result.push_back("likely to be positive muons"); result.push_back("Target E"); - } else if (fln.find("_alc_") != string::npos) { + } else if (fln.find("_alc_") != std::string::npos) { result.push_back("ALC"); result.push_back("piE3"); result.push_back("28 MeV/c"); result.push_back("likely to be positive muons"); result.push_back("Target E"); - } else if (fln.find("_hifi_") != string::npos) { + } else if (fln.find("_hifi_") != std::string::npos) { result.push_back("HAL9500"); result.push_back("piE3"); result.push_back("28 MeV/c"); result.push_back("likely to be positive muons"); result.push_back("Target E"); - } else if (fln.find("_gpd_") != string::npos) { + } else if (fln.find("_gpd_") != std::string::npos) { result.push_back("GPD"); result.push_back("muE1"); result.push_back("60-125 MeV/c"); @@ -307,7 +311,7 @@ vector dump_header_instrument_info(string fileName) /** * */ -int dump_header_psi_bin(const string fileName, const string fileFormat) +int dump_header_psi_bin(const std::string fileName, const std::string fileFormat) { MuSR_td_PSI_bin psiBin; int status; @@ -320,23 +324,23 @@ int dump_header_psi_bin(const string fileName, const string fileFormat) success = true; break; case 1: // couldn't open file, or failed while reading the header - cout << endl << "**ERROR** couldn't open psi-bin file, or failed while reading the header." << endl; + std::cout << std::endl << "**ERROR** couldn't open psi-bin file, or failed while reading the header." << std::endl; success = false; break; case 2: // unsupported version of the data - cout << endl << "**ERROR** psi-bin file: unsupported version of the data." << endl; + std::cout << std::endl << "**ERROR** psi-bin file: unsupported version of the data." << std::endl; success = false; break; case 3: // error when allocating data buffer - cout << endl << "**ERROR** psi-bin file: error when allocating data buffer." << endl; + std::cout << std::endl << "**ERROR** psi-bin file: error when allocating data buffer." << std::endl; success = false; break; case 4: // number of histograms/record not equals 1 - cout << endl << ">> **ERROR** psi-bin file: number of histograms/record not equals 1." << endl; + std::cout << std::endl << ">> **ERROR** psi-bin file: number of histograms/record not equals 1." << std::endl; success = false; break; default: // you never should have reached this point - cout << endl << ">> **ERROR** psi-bin file: no clue why you reached this point." << endl; + std::cout << std::endl << ">> **ERROR** psi-bin file: no clue why you reached this point." << std::endl; success = false; break; } @@ -345,63 +349,63 @@ int dump_header_psi_bin(const string fileName, const string fileFormat) if (!success) return 1; - vector vstr; - vector dVal, dErrVal; - cout << endl << "-------------------"; - cout << endl << "fileName = " << fileName << ", fileFormat = " << fileFormat; - cout << endl << "-------------------"; - cout << endl << "Run Title : " << psiBin.get_comment(); - cout << endl << "Run Number : " << psiBin.get_runNumber_int(); + std::vector vstr; + std::vector dVal, dErrVal; + std::cout << std::endl << "-------------------"; + std::cout << std::endl << "fileName = " << fileName << ", fileFormat = " << fileFormat; + std::cout << std::endl << "-------------------"; + std::cout << std::endl << "Run Title : " << psiBin.get_comment(); + std::cout << std::endl << "Run Number : " << psiBin.get_runNumber_int(); vstr = psiBin.get_timeStart_vector(); if (vstr.size() < 2) { - cout << endl << "**ERROR** couldn't obtain \"Run Start Time\" will quit." << endl << endl; + std::cout << std::endl << "**ERROR** couldn't obtain \"Run Start Time\" will quit." << std::endl << std::endl; return 1; } - cout << endl << "Run Start Time : " << vstr[0] << "; " << vstr[1]; + std::cout << std::endl << "Run Start Time : " << vstr[0] << "; " << vstr[1]; vstr = psiBin.get_timeStop_vector(); if (vstr.size() < 2) { - cout << endl << "**ERROR** couldn't obtain \"Run Stop Time\" will quit." << endl << endl; + std::cout << std::endl << "**ERROR** couldn't obtain \"Run Stop Time\" will quit." << std::endl << std::endl; return 1; } - cout << endl << "Run Stop Time : " << vstr[0] << "; " << vstr[1]; - cout << endl << "Laboratory : PSI"; + std::cout << std::endl << "Run Stop Time : " << vstr[0] << "; " << vstr[1]; + std::cout << std::endl << "Laboratory : PSI"; vstr = dump_header_instrument_info(fileName); if (vstr.size() < 5) { - cout << endl << "**ERROR** couldn't obtain \"Instrument\" will quit." << endl << endl; + std::cout << std::endl << "**ERROR** couldn't obtain \"Instrument\" will quit." << std::endl << std::endl; return 1; } - cout << endl << "Instrument : " << vstr[0]; - cout << endl << "Beamline : " << vstr[1]; - cout << endl << "Muon Beam Momentum : " << vstr[2]; - cout << endl << "Muon Species : " << vstr[3]; - cout << endl << "Muon Source : " << vstr[4]; - cout << endl << "Setup : " << psiBin.get_comment(); - cout << endl << "Comment : n/a"; - cout << endl << "Sample Name : " << psiBin.get_sample(); - cout << endl << "Sample Orientation : " << psiBin.get_orient(); + std::cout << std::endl << "Instrument : " << vstr[0]; + std::cout << std::endl << "Beamline : " << vstr[1]; + std::cout << std::endl << "Muon Beam Momentum : " << vstr[2]; + std::cout << std::endl << "Muon Species : " << vstr[3]; + std::cout << std::endl << "Muon Source : " << vstr[4]; + std::cout << std::endl << "Setup : " << psiBin.get_comment(); + std::cout << std::endl << "Comment : n/a"; + std::cout << std::endl << "Sample Name : " << psiBin.get_sample(); + std::cout << std::endl << "Sample Orientation : " << psiBin.get_orient(); dVal = psiBin.get_temperatures_vector(); dErrVal = psiBin.get_devTemperatures_vector(); if (dVal.size() != dErrVal.size()) { - cout << endl << "Sample Temperature : " << psiBin.get_temp(); + std::cout << std::endl << "Sample Temperature : " << psiBin.get_temp(); } else { for (unsigned int i=0; i(&tval)); assert(dt); strftime(str, sizeof(str), "%F; %T", dt); - cout << endl << "Run Start Time : " << str; + std::cout << std::endl << "Run Start Time : " << str; } else { - cout << endl << "Run Start Time : ???"; + std::cout << std::endl << "Run Start Time : ???"; } // stop time success = MUD_getTimeEnd( fh, (UINT32*)&tval ); if (success) { - dt = localtime((const time_t*)&tval); + dt = localtime(static_cast(&tval)); assert(dt); strftime(str, sizeof(str), "%F; %T", dt); - cout << endl << "Run Stop Time : " << str; + std::cout << std::endl << "Run Stop Time : " << str; } else { - cout << endl << "Run Stop Time : ???"; + std::cout << std::endl << "Run Stop Time : ???"; } // laboratory success = MUD_getLab( fh, str, sizeof(str) ); if (success) - cout << endl << "Laboratory : " << str; + std::cout << std::endl << "Laboratory : " << str; else - cout << endl << "Laboratory : ???"; + std::cout << std::endl << "Laboratory : ???"; // instrument success = MUD_getApparatus( fh, str, sizeof(str) ); if (success) - cout << endl << "Instrument : " << str; + std::cout << std::endl << "Instrument : " << str; else - cout << endl << "Instrument : ???"; + std::cout << std::endl << "Instrument : ???"; // beamline success = MUD_getArea( fh, str, sizeof(str) ); if (success) - cout << endl << "Beamline : " << str; + std::cout << std::endl << "Beamline : " << str; else - cout << endl << "Beamline : ???"; + std::cout << std::endl << "Beamline : ???"; - cout << endl << "Muon Beam Momentum : ???"; - cout << endl << "Muon Species : positive muon?"; - cout << endl << "Muon Source : ???"; + std::cout << std::endl << "Muon Beam Momentum : ???"; + std::cout << std::endl << "Muon Species : positive muon?"; + std::cout << std::endl << "Muon Source : ???"; // method success = MUD_getMethod( fh, str, sizeof(str) ); if (success) - cout << endl << "Method : " << str; + std::cout << std::endl << "Method : " << str; else - cout << endl << "Method : ???"; + std::cout << std::endl << "Method : ???"; // sample success = MUD_getSample( fh, str, sizeof(str) ); if (success) - cout << endl << "Sample Name : " << str; + std::cout << std::endl << "Sample Name : " << str; else - cout << endl << "Sample Name : ???"; + std::cout << std::endl << "Sample Name : ???"; // orientation success = MUD_getOrient( fh, str, sizeof(str) ); if (success) - cout << endl << "Sample Orientation : " << str; + std::cout << std::endl << "Sample Orientation : " << str; else - cout << endl << "Sample Orientation : ???"; + std::cout << std::endl << "Sample Orientation : ???"; // temperature success = MUD_getTemperature( fh, str, sizeof(str) ); if (success) - cout << endl << "Sample Temperature : " << str; + std::cout << std::endl << "Sample Temperature : " << str; else - cout << endl << "Sample Temperature : ???"; + std::cout << std::endl << "Sample Temperature : ???"; // magnetic field success = MUD_getField( fh, str, sizeof(str) ); if (success) - cout << endl << "Sample Magn. Field : " << str; + std::cout << std::endl << "Sample Magn. Field : " << str; else - cout << endl << "Sample Magn. Field : ???"; + std::cout << std::endl << "Sample Magn. Field : ???"; // number of histograms int noHistos = 0; success = MUD_getHists(fh, &type, &val); if (success) { - cout << endl << "No of Histos : " << val; + std::cout << std::endl << "No of Histos : " << val; noHistos = val; } else { - cout << endl << "No of Histos : ???"; + std::cout << std::endl << "No of Histos : ???"; } // time resolution @@ -535,47 +539,47 @@ int dump_header_mud(const string fileName, const string fileFormat) success = MUD_getHistSecondsPerBin( fh, 1, &timeResolution ); timeResolution *= 1.0e9; // sec -> nsec if (success) - cout << endl << "Time Resolution : " << timeResolution << " ns"; + std::cout << std::endl << "Time Resolution : " << timeResolution << " ns"; else - cout << endl << "Time Resolution : ??? ns"; + std::cout << std::endl << "Time Resolution : ??? ns"; // detector related stuff for (int i=0; i= argc) { - cerr << endl << "**ERROR** found -rn, --runNo without !" << endl; + std::cerr << std::endl << "**ERROR** found -rn, --runNo without !" << std::endl; dump_header_syntax(); return 1; } @@ -789,12 +793,12 @@ int main(int argc, char *argv[]) count++; // make sure there is one and only one run number given if (count == 1) { - cerr << endl << "**ERROR** found -rn, --runNo without , or the provided ('" << argv[i+1] << "') is not a number!" << endl; + std::cerr << std::endl << "**ERROR** found -rn, --runNo without , or the provided ('" << argv[i+1] << "') is not a number!" << std::endl; dump_header_syntax(); return 1; } if (count > 2) { - cerr << endl << "**ERROR** found -rn, --runNo with more than one ! This is not yet supported." << endl; + std::cerr << std::endl << "**ERROR** found -rn, --runNo with more than one ! This is not yet supported." << std::endl; dump_header_syntax(); return 1; } @@ -802,7 +806,7 @@ int main(int argc, char *argv[]) i++; } else if (!strcmp(argv[i], "-fn") || !strcmp(argv[i], "--fileName")) { if (i+1 >= argc) { - cerr << endl << "**ERROR** found -fn, --fileName without !" << endl; + std::cerr << std::endl << "**ERROR** found -fn, --fileName without !" << std::endl; dump_header_syntax(); return 1; } @@ -810,15 +814,15 @@ int main(int argc, char *argv[]) i++; } else if (!strcmp(argv[i], "--fileFormat") || !strcmp(argv[i], "-ff")) { if (i+1 >= argc) { - cerr << endl << "**ERROR** found -ff, --fileFormat without !" << endl; + std::cerr << std::endl << "**ERROR** found -ff, --fileFormat without !" << std::endl; dump_header_syntax(); return 1; } - string ff(argv[i+1]); + std::string ff(argv[i+1]); if (!boost::iequals(ff, "MusrRoot") && !boost::iequals(ff, "NeXus") && !boost::iequals(ff, "ROOT") && !boost::iequals(ff, "PSI-BIN") && !boost::iequals(ff, "PSI-MDU") && !boost::iequals(ff, "MUD") && !boost::iequals(ff, "WKM")) { // none of the listed found - cerr << endl << "**ERROR** found unsupported muSR file data format: " << argv[i+1] << endl; + std::cerr << std::endl << "**ERROR** found unsupported muSR file data format: " << argv[i+1] << std::endl; dump_header_syntax(); return 1; } @@ -826,19 +830,19 @@ int main(int argc, char *argv[]) i++; } else if (!strcmp(argv[i], "-y") || !strcmp(argv[i], "--year")) { if (i+1 >= argc) { - cerr << endl << "**ERROR** found -y, --year without !" << endl; + std::cerr << std::endl << "**ERROR** found -y, --year without !" << std::endl; dump_header_syntax(); return 1; } if (!dump_is_number(argv[i+1])) { - cerr << endl << "**ERROR** found -y, --year with sensless '" << argv[i+1] << "'!" << endl; + std::cerr << std::endl << "**ERROR** found -y, --year with sensless '" << argv[i+1] << "'!" << std::endl; dump_header_syntax(); return 1; } - int yy = strtod(argv[i+1], (char**)0); + int yy = static_cast(strtod(argv[i+1], static_cast(nullptr))); if ((yy < 1950) || (yy > dump_current_year())) { - cerr << endl << "**ERROR** found -y, --year with '" << yy << "'!"; - cerr << endl << " Well, cannot handle files in the pre-muSR time nor in the future." << endl; + std::cerr << std::endl << "**ERROR** found -y, --year with '" << yy << "'!"; + std::cerr << std::endl << " Well, cannot handle files in the pre-muSR time nor in the future." << std::endl; dump_header_syntax(); return 1; } @@ -848,7 +852,7 @@ int main(int argc, char *argv[]) summary = true; } else if (!strcmp(argv[i], "--psi-bulk")) { if (i+2 >= argc) { - cerr << endl << "**ERROR** found --psi-bulk with insufficient input!" << endl; + std::cerr << std::endl << "**ERROR** found --psi-bulk with insufficient input!" << std::endl; dump_header_syntax(); return 1; } @@ -857,20 +861,20 @@ int main(int argc, char *argv[]) else if (!strcmp(argv[i+1], "tdc")) pta = false; else { - cerr << endl << "**ERROR** found --psi-bulk with 1st argument '" << argv[i+1] << "'! Allowed is 'pta' or 'tdc'." << endl; + std::cerr << std::endl << "**ERROR** found --psi-bulk with 1st argument '" << argv[i+1] << "'! Allowed is 'pta' or 'tdc'." << std::endl; dump_header_syntax(); return 1; } if (strcmp(argv[i+2], "gps") && strcmp(argv[i+2], "ltf") && strcmp(argv[i+2], "dolly") && strcmp(argv[i+2], "gpd") && strcmp(argv[i+2], "hifi")) { - cerr << endl << "**ERROR** found --psi-bulk with 2nd argument '" << argv[i+1] << "'! This is an unkown instrument." << endl; + std::cerr << std::endl << "**ERROR** found --psi-bulk with 2nd argument '" << argv[i+1] << "'! This is an unkown instrument." << std::endl; dump_header_syntax(); return 1; } instrument = argv[i+2]; i += 2; } else { - cerr << endl << "**ERROR** found unkown option '" << argv[i] << "'." << endl; + std::cerr << std::endl << "**ERROR** found unkown option '" << argv[i] << "'." << std::endl; dump_header_syntax(); return 1; } @@ -878,13 +882,13 @@ int main(int argc, char *argv[]) // if year is not provided, take the current one if (year.empty()) { - stringstream ss; + std::stringstream ss; ss << dump_current_year(); year = ss.str(); } if ((runNo.length() != 0) && (fileName.length() != 0)) { - cerr << endl << "**ERROR** currently only either runNo or fileName can be handled, not both simultanously." << endl; + std::cerr << std::endl << "**ERROR** currently only either runNo or fileName can be handled, not both simultanously." << std::endl; return 1; } @@ -894,16 +898,16 @@ int main(int argc, char *argv[]) TSAXParser *saxParser = new TSAXParser(); PStartupHandler *startupHandler = new PStartupHandler(); if (!startupHandler->StartupFileFound()) { - cerr << endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data(); - cerr << endl; + std::cerr << std::endl << ">> musrfit **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data(); + std::cerr << std::endl; // clean up if (saxParser) { delete saxParser; - saxParser = 0; + saxParser = nullptr; } if (startupHandler) { delete startupHandler; - startupHandler = 0; + startupHandler = nullptr; } } else { strcpy(startup_path_name, startupHandler->GetStartupFilePath().Data()); @@ -914,32 +918,32 @@ int main(int argc, char *argv[]) int status = parseXmlFile(saxParser, startup_path_name); // check for parse errors if (status) { // error - cerr << endl << ">> musrfit **WARNING** Reading/parsing musrfit_startup.xml failed."; - cerr << endl; + std::cerr << std::endl << ">> musrfit **WARNING** Reading/parsing musrfit_startup.xml failed."; + std::cerr << std::endl; // clean up if (saxParser) { delete saxParser; - saxParser = 0; + saxParser = nullptr; } if (startupHandler) { delete startupHandler; - startupHandler = 0; + startupHandler = nullptr; } } } // runNo given, hence try to create the necessary file name based on the provided information if (runNo != "") { - string str = dump_create_fln(runNo, year, fileFormat, pta, instrument); + std::string str = dump_create_fln(runNo, year, fileFormat, pta, instrument); if (str == "??") { - cerr << endl << "**ERROR** couldn't get a proper file name." << endl; + std::cerr << std::endl << "**ERROR** couldn't get a proper file name." << std::endl; return 1; } fileName = str; } bool found_fln = false; - string pathFln(""); + std::string pathFln(""); // 1st check if the file name is the full path-file name and the file exists pathFln = fileName; if (dump_file_exists(pathFln)) @@ -973,7 +977,7 @@ int main(int argc, char *argv[]) } if (!found_fln) { - cerr << "**ERROR** couldn't find any appropriate file." << endl; + std::cerr << "**ERROR** couldn't find any appropriate file." << std::endl; // cleanup if (saxParser) { delete saxParser; @@ -981,33 +985,33 @@ int main(int argc, char *argv[]) } if (startupHandler) { delete startupHandler; - startupHandler = 0; + startupHandler = nullptr; } return 1; } // if file format is not given explicitly try to guess it based on the file name extension if ((fileFormat == "") && (fileName != "")) { - string fln(fileName); + std::string fln(fileName); boost::to_lower(fln); - if (fln.find(".root") != string::npos) + if (fln.find(".root") != std::string::npos) fileFormat = "MusrRoot"; // could be old ROOT (LEM) as well - else if (fln.find(".nxs") != string::npos) + else if (fln.find(".nxs") != std::string::npos) fileFormat = "NeXus"; - else if (fln.find(".bin") != string::npos) + else if (fln.find(".bin") != std::string::npos) fileFormat = "PSI-BIN"; - else if (fln.find(".mdu") != string::npos) + else if (fln.find(".mdu") != std::string::npos) fileFormat = "PSI-MDU"; - else if (fln.find(".msr") != string::npos) + else if (fln.find(".msr") != std::string::npos) fileFormat = "MUD"; - else if ((fln.find(".nemu") != string::npos) || (fln.find(".wkm") != string::npos)) + else if ((fln.find(".nemu") != std::string::npos) || (fln.find(".wkm") != std::string::npos)) fileFormat = "WKM"; if (fileFormat != "") - cout << endl << "**INFO** the guessed file format is " << fileFormat << endl; + std::cout << std::endl << "**INFO** the guessed file format is " << fileFormat << std::endl; } if (fileFormat == "") { - cout << endl << "**ERROR** Couldn't guess your file format. You will need to provide it explicitly" << endl << endl; + std::cout << std::endl << "**ERROR** Couldn't guess your file format. You will need to provide it explicitly" << std::endl << std::endl; return 1; } @@ -1019,7 +1023,7 @@ int main(int argc, char *argv[]) #ifdef PNEXUS_ENABLED dump_header_nexus(pathFln); #else - cout << endl << "Sorry, NeXus is not enabled, hence I cannot help you." << endl; + std::cout << std::endl << "Sorry, NeXus is not enabled, hence I cannot help you." << std::endl; #endif } else if (boost::iequals(fileFormat, "PSI-BIN") || boost::iequals(fileFormat, "PSI-MDU")) { dump_header_psi_bin(pathFln, fileFormat); @@ -1032,11 +1036,11 @@ int main(int argc, char *argv[]) // cleanup if (saxParser) { delete saxParser; - saxParser = 0; + saxParser = nullptr; } if (startupHandler) { delete startupHandler; - startupHandler = 0; + startupHandler = nullptr; } return 0; diff --git a/src/external/BMWtools/BMWIntegrator.h b/src/external/BMWtools/BMWIntegrator.h index 94da8347..a901004a 100644 --- a/src/external/BMWtools/BMWIntegrator.h +++ b/src/external/BMWtools/BMWIntegrator.h @@ -36,8 +36,6 @@ #include #include -using namespace std; - /** *

Alternative base class for 1D integrations using the GNU Scientific Library integrator. * The difference to the other class is that here the integration parameters have to be supplied directly to the IntegrateFunc method. @@ -67,7 +65,7 @@ class T2Integrator { */ inline double T2Integrator::FuncAtXgsl(double x, void *ptrPair) { - pair*> *pairOfPointers = static_cast*>*>(ptrPair); + std::pair*> *pairOfPointers = static_cast*>*>(ptrPair); return pairOfPointers->first->FuncAtX(x, *(pairOfPointers->second)); } @@ -83,14 +81,14 @@ inline double T2Integrator::FuncAtXgsl(double x, void *ptrPair) */ inline double T2Integrator::IntegrateFunc(double x1, double x2, const std::vector &par) { - pair*> ptrPair; + std::pair*> ptrPair; ptrPair.first = (this); ptrPair.second = ∥ ROOT::Math::GSLIntegrator *integrator = new ROOT::Math::GSLIntegrator(ROOT::Math::Integration::kADAPTIVE,ROOT::Math::Integration::kGAUSS31); double value(integrator->Integral(&T2Integrator::FuncAtXgsl, static_cast(&ptrPair), x1, x2)); delete integrator; - integrator = 0; + integrator = nullptr; return value; } @@ -123,7 +121,7 @@ class TIntegrator { double IntegrateFunc(double, double); protected: - mutable vector fPar; ///< parameters of the integrand + mutable std::vector fPar; ///< parameters of the integrand private: static double FuncAtXgsl(double, void *); @@ -146,7 +144,7 @@ inline TIntegrator::TIntegrator() : fFunc(0) { inline TIntegrator::~TIntegrator(){ fPar.clear(); delete fIntegrator; - fIntegrator=0; + fIntegrator=nullptr; fFunc=0; } @@ -193,7 +191,7 @@ class TMCIntegrator { double IntegrateFunc(size_t, double *, double *); protected: - mutable vector fPar; ///< parameters of the integrand + mutable std::vector fPar; ///< parameters of the integrand private: static double FuncAtXgsl(double *, size_t, void *); @@ -216,7 +214,7 @@ inline TMCIntegrator::TMCIntegrator() : fFunc(0) { inline TMCIntegrator::~TMCIntegrator(){ fPar.clear(); delete fMCIntegrator; - fMCIntegrator=0; + fMCIntegrator=nullptr; fFunc=0; } @@ -265,7 +263,7 @@ class TDWaveGapIntegralCuhre { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -284,7 +282,7 @@ class TCosSqDWaveGapIntegralCuhre { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -303,7 +301,7 @@ class TSinSqDWaveGapIntegralCuhre { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -321,7 +319,7 @@ class TAnSWaveGapIntegralCuhre { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -339,7 +337,7 @@ class TAnSWaveGapIntegralDivonne { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -357,7 +355,7 @@ class TAnSWaveGapIntegralSuave { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -375,7 +373,7 @@ class TNonMonDWave1GapIntegralCuhre { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -393,7 +391,7 @@ class TNonMonDWave2GapIntegralCuhre { double IntegrateFunc(); protected: - static vector fPar; ///< parameters of the integrand + static std::vector fPar; ///< parameters of the integrand unsigned int fNDim; ///< dimension of the integral }; @@ -485,7 +483,7 @@ class TIntBesselJ0Exp : public T2Integrator { ~TIntBesselJ0Exp() {} private: - double FuncAtX(double, const vector&) const; + double FuncAtX(double, const std::vector&) const; }; /** @@ -496,7 +494,7 @@ class TIntBesselJ0Exp : public T2Integrator { * * \param x point where the function should be evaluated */ -inline double TIntBesselJ0Exp::FuncAtX(double x, const vector &par) const +inline double TIntBesselJ0Exp::FuncAtX(double x, const std::vector &par) const { double w0t(TMath::TwoPi()*par[0]*x); double j0; @@ -518,7 +516,7 @@ class TIntSinGss : public T2Integrator { ~TIntSinGss() {} private: - double FuncAtX(double, const vector&) const; + double FuncAtX(double, const std::vector&) const; }; /** @@ -529,7 +527,7 @@ class TIntSinGss : public T2Integrator { * * \param x point where the function should be evaluated */ -inline double TIntSinGss::FuncAtX(double x, const vector &par) const +inline double TIntSinGss::FuncAtX(double x, const std::vector &par) const { return TMath::Sin(TMath::TwoPi()*par[0]*x) * TMath::Exp(-0.5*par[1]*par[1]*x*x); } @@ -546,7 +544,7 @@ class TIntSGInterpolation : public T2Integrator { ~TIntSGInterpolation() {} private: - double FuncAtX(double, const vector&) const; + double FuncAtX(double, const std::vector&) const; }; /** @@ -557,7 +555,7 @@ class TIntSGInterpolation : public T2Integrator { * * \param x point where the function should be evaluated */ -inline double TIntSGInterpolation::FuncAtX(double x, const vector &par) const +inline double TIntSGInterpolation::FuncAtX(double x, const std::vector &par) const { // Parameters: nu_L [MHz], a [1/us], lambda [1/us], beta [1], t [us] double wt(TMath::TwoPi()*par[0]*x); @@ -600,7 +598,7 @@ class TFirstUniaxialGssKTIntegral : public T2Integrator { virtual ~TFirstUniaxialGssKTIntegral() {} private: - virtual double FuncAtX(double, const vector&) const; // variable: x + virtual double FuncAtX(double, const std::vector&) const; // variable: x }; /** @@ -611,7 +609,7 @@ class TFirstUniaxialGssKTIntegral : public T2Integrator { * * \param x point where the function should be evaluated */ -inline double TFirstUniaxialGssKTIntegral::FuncAtX(double x, const vector &par) const +inline double TFirstUniaxialGssKTIntegral::FuncAtX(double x, const std::vector &par) const { double eps(par[0]*par[0]/(par[1]*par[1]) - 1.0); double p(1.0 + eps*x*x); @@ -630,7 +628,7 @@ class TSecondUniaxialGssKTIntegral : public T2Integrator { virtual ~TSecondUniaxialGssKTIntegral() {} private: - virtual double FuncAtX(double, const vector&) const; // variable: x + virtual double FuncAtX(double, const std::vector&) const; // variable: x }; /** @@ -641,7 +639,7 @@ class TSecondUniaxialGssKTIntegral : public T2Integrator { * * \param x point where the function should be evaluated */ -inline double TSecondUniaxialGssKTIntegral::FuncAtX(double x, const vector &par) const +inline double TSecondUniaxialGssKTIntegral::FuncAtX(double x, const std::vector &par) const { double eps(par[0]*par[0]/(par[1]*par[1]) - 1.0); double p(1.0 + eps*x*x); diff --git a/src/external/BMWtools/BMWStartupHandler.cpp b/src/external/BMWtools/BMWStartupHandler.cpp index 6e8e12e0..3cf557d8 100644 --- a/src/external/BMWtools/BMWStartupHandler.cpp +++ b/src/external/BMWtools/BMWStartupHandler.cpp @@ -32,7 +32,6 @@ #include #include -using namespace std; #include @@ -245,8 +244,8 @@ void BMWStartupHandler::OnComment(const char *str) */ void BMWStartupHandler::OnWarning(const char *str) { - cerr << endl << "BMWStartupHandler::OnWarning: BMWStartupHandler **WARNING** " << str; - cerr << endl; + std::cerr << std::endl << "BMWStartupHandler::OnWarning: BMWStartupHandler **WARNING** " << str; + std::cerr << std::endl; } //-------------------------------------------------------------------------- @@ -259,8 +258,8 @@ void BMWStartupHandler::OnWarning(const char *str) */ void BMWStartupHandler::OnError(const char *str) { - cerr << endl << "BMWStartupHandler::OnError: BMWStartupHandler **ERROR** " << str; - cerr << endl; + std::cerr << std::endl << "BMWStartupHandler::OnError: BMWStartupHandler **ERROR** " << str; + std::cerr << std::endl; } //-------------------------------------------------------------------------- @@ -273,8 +272,8 @@ void BMWStartupHandler::OnError(const char *str) */ void BMWStartupHandler::OnFatalError(const char *str) { - cerr << endl << "BMWStartupHandler::OnFatalError: BMWStartupHandler **FATAL ERROR** " << str; - cerr << endl; + std::cerr << std::endl << "BMWStartupHandler::OnFatalError: BMWStartupHandler **FATAL ERROR** " << str; + std::cerr << std::endl; } //-------------------------------------------------------------------------- @@ -305,107 +304,107 @@ void BMWStartupHandler::CheckLists() if(fLF) { // check if delta_t_LF is given, if not set default if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check specified LF time resolution for the Laplace transform ... " << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check specified LF time resolution for the Laplace transform ... " << std::endl; if(!fDeltatLF) { - cout << "BMWStartupHandler::CheckLists: You did not specify the LF time resolution. Setting the default (0.04 ns)." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify the LF time resolution. Setting the default (0.04 ns)." << std::endl; fDeltatLF = 0.00004; } else { if(fDebug) - cout << fDeltatLF << " us" << endl; + std::cout << fDeltatLF << " us" << std::endl; } // check if N_LF is given, if not set default if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check length of the Laplace transform ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check length of the Laplace transform ..." << std::endl; if (!fNStepsLF) { - cout << "BMWStartupHandler::CheckLists: You did not specify the length of the Laplace transform. Setting the default (524288)." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify the length of the Laplace transform. Setting the default (524288)." << std::endl; fNStepsLF = 524288; } else { if(fDebug) - cout << fNStepsLF << endl; + std::cout << fNStepsLF << std::endl; } } else { // check if delta_t is given, if not set default if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check specified time resolution ... " << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check specified time resolution ... " << std::endl; if(!fDeltat) { - cout << "BMWStartupHandler::CheckLists: You did not specify the time resolution. Setting the default (10 ns)." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify the time resolution. Setting the default (10 ns)." << std::endl; fDeltat = 0.01; } else { if(fDebug) - cout << fDeltat << " us" << endl; + std::cout << fDeltat << " us" << std::endl; } // check if delta_B is given, if not set default if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check specified field resolution ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check specified field resolution ..." << std::endl; if(!fDeltaB) { - cout << "BMWStartupHandler::CheckLists: You did not specify the field resolution. Setting the default (0.1 G)." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify the field resolution. Setting the default (0.1 G)." << std::endl; fDeltaB = 0.1; } else { if(fDebug) - cout << fDeltaB << " G" << endl; + std::cout << fDeltaB << " G" << std::endl; } } // check if any wisdom-file is specified if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check wisdom file ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check wisdom file ..." << std::endl; if (!fWisdomFile.size()) { - cout << "BMWStartupHandler::CheckLists: You did not specify a wisdom file. No FFTW plans will be loaded or saved." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify a wisdom file. No FFTW plans will be loaded or saved." << std::endl; fWisdomFile = ""; } else { if(fDebug) - cout << fWisdomFile << endl; + std::cout << fWisdomFile << std::endl; } // check if any float-wisdom-file is specified if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check float-wisdom file ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check float-wisdom file ..." << std::endl; if (!fWisdomFile.size()) { - cout << "BMWStartupHandler::CheckLists: You did not specify a float-wisdom file. No FFTW plans will be loaded or saved." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify a float-wisdom file. No FFTW plans will be loaded or saved." << std::endl; fWisdomFileFloat = ""; } else { if(fDebug) - cout << fWisdomFileFloat << endl; + std::cout << fWisdomFileFloat << std::endl; } if (fLEM) { // check if any data path is given if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check data path ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check data path ..." << std::endl; if (fDataPath.empty()) { - cerr << "BMWStartupHandler::CheckLists: This is not going to work, you have to set a valid data path where to find the rge-files in the xml-file!" << endl; + std::cerr << "BMWStartupHandler::CheckLists: This is not going to work, you have to set a valid data path where to find the rge-files in the xml-file!" << std::endl; assert(!fDataPath.empty()); } else { if(fDebug) - cout << fDataPath << endl; + std::cout << fDataPath << std::endl; } // check if any energies are given if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check energy list ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check energy list ..." << std::endl; if (fEnergyList.size() != fEnergyLabelList.size()) { - cerr << "BMWStartupHandler::CheckLists: The number of energies and energy labels are different! Please fix it!" << endl \ - << "BMWStartupHandler::CheckLists: The program will be terminated now!" << endl; + std::cerr << "BMWStartupHandler::CheckLists: The number of energies and energy labels are different! Please fix it!" << std::endl \ + << "BMWStartupHandler::CheckLists: The program will be terminated now!" << std::endl; assert(fEnergyList.size() == fEnergyLabelList.size()); } if (fEnergyList.empty()) { - cerr << "BMWStartupHandler::CheckLists: Energy list empty!" << endl \ - << "BMWStartupHandler::CheckLists: Trying to use the standard energies: 0.0 to 35.0 keV in 0.1 keV steps" << endl; + std::cerr << "BMWStartupHandler::CheckLists: Energy list empty!" << std::endl \ + << "BMWStartupHandler::CheckLists: Trying to use the standard energies: 0.0 to 35.0 keV in 0.1 keV steps" << std::endl; for (double x(0.0); x<= 35.0; x+=0.1) { fEnergyList.push_back(x); } } if (fEnergyLabelList.empty()) { - cerr << "BMWStartupHandler::CheckLists: Energy label list empty!" << endl \ - << "BMWStartupHandler::CheckLists: Trying to use the specified energies as labels in the format %02.1f..." << endl \ - << "BMWStartupHandler::CheckLists: Most probably this will go wrong and should therefore be fixed in the xml-file!" << endl; + std::cerr << "BMWStartupHandler::CheckLists: Energy label list empty!" << std::endl \ + << "BMWStartupHandler::CheckLists: Trying to use the specified energies as labels in the format %02.1f..." << std::endl \ + << "BMWStartupHandler::CheckLists: Most probably this will go wrong and should therefore be fixed in the xml-file!" << std::endl; char eChar[5]; for(unsigned int i(0); i::const_iterator iter(fEnergies.begin()); iter != fEnergies.end(); ++iter ) - cout << iter->first << " " << iter->second << endl; + std::cout << "Energies and Labels:" << std::endl; + for ( std::map::const_iterator iter(fEnergies.begin()); iter != fEnergies.end(); ++iter ) + std::cout << iter->first << " " << iter->second << std::endl; } // check if any number of steps for the theory function is specified if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check number of steps for theory ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check number of steps for theory ..." << std::endl; if (!fNSteps) { - cout << "BMWStartupHandler::CheckLists: You did not specify the number of steps for the theory. Setting the default (3000)." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify the number of steps for the theory. Setting the default (3000)." << std::endl; fNSteps = 3000; } else { if(fDebug) - cout << fNSteps << endl; + std::cout << fNSteps << std::endl; } } if (fVortex) { // check if any number of steps for the theory function is specified if(fDebug) - cout << endl << "BMWStartupHandler::CheckLists: check number of steps for Vortex grid ..." << endl; + std::cout << std::endl << "BMWStartupHandler::CheckLists: check number of steps for Vortex grid ..." << std::endl; if (!fGridSteps) { - cout << "BMWStartupHandler::CheckLists: You did not specify the number of steps for the grid. Setting the default (256)." << endl; + std::cout << "BMWStartupHandler::CheckLists: You did not specify the number of steps for the grid. Setting the default (256)." << std::endl; fGridSteps = 256; } else { if(fDebug) - cout << fGridSteps << endl; + std::cout << fGridSteps << std::endl; } } } diff --git a/src/external/BMWtools/BMWStartupHandler.h b/src/external/BMWtools/BMWStartupHandler.h index 53fc03d0..36f579f6 100644 --- a/src/external/BMWtools/BMWStartupHandler.h +++ b/src/external/BMWtools/BMWStartupHandler.h @@ -11,7 +11,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2014 by Andreas Suter, Bastian M. Wojek * + * Copyright (C) 2007-2019 by Andreas Suter, Bastian M. Wojek * * * * * * This program is free software; you can redistribute it and/or modify * @@ -67,12 +67,12 @@ class BMWStartupHandler : public TQObject { virtual void CheckLists(); - virtual const string GetDataPath() const { return fDataPath; } ///< returns the path to TRIM.SP files - virtual map GetEnergies() const { return fEnergies; } ///< returns energies and file labels of available TRIM.SP files + virtual const std::string GetDataPath() const { return fDataPath; } ///< returns the path to TRIM.SP files + virtual std::map GetEnergies() const { return fEnergies; } ///< returns energies and file labels of available TRIM.SP files virtual const double GetDeltat() const { return fDeltat; } ///< returns the time resolution of P(t) when using Fourier transforms virtual const double GetDeltaB() const { return fDeltaB; } ///< returns the field resolution of p(B) when using Fourier transforms - virtual const string GetWisdomFile() const { return fWisdomFile; } ///< returns the path to the FFTW3 double-wisdom file - virtual const string GetWisdomFileFloat() const { return fWisdomFileFloat; } ///< returns the path to the FFTW3 float-wisdom file + virtual const std::string GetWisdomFile() const { return fWisdomFile; } ///< returns the path to the FFTW3 double-wisdom file + virtual const std::string GetWisdomFileFloat() const { return fWisdomFileFloat; } ///< returns the path to the FFTW3 float-wisdom file virtual const unsigned int GetNSteps() const { return fNSteps; } ///< returns the number of steps in one-dimensional theory functions virtual const unsigned int GetGridSteps() const { return fGridSteps; } ///< returns the number of steps in each direction when calculating two-dimensional spatial field distributions virtual const double GetDeltatLF() const { return fDeltatLF; } ///< returns the time resolution of P(t) when using Laplace transforms for the calculation of LF-relaxation functions @@ -90,14 +90,14 @@ class BMWStartupHandler : public TQObject { bool fLEM; ///< low-energy muSR flag bool fVortex; ///< vortex-lattice flag bool fLF; ///< longitudinal-field flag - string fDataPath; ///< path to TRIM.SP files - vector fEnergyLabelList; ///< file labels of the TRIM.SP files - vector fEnergyList; ///< muon implantation energies of the TRIM.SP files - map fEnergies; ///< muon implantation energies and file labels of the TRIM.SP files + std::string fDataPath; ///< path to TRIM.SP files + std::vector fEnergyLabelList; ///< file labels of the TRIM.SP files + std::vector fEnergyList; ///< muon implantation energies of the TRIM.SP files + std::map fEnergies; ///< muon implantation energies and file labels of the TRIM.SP files double fDeltat; ///< time resolution of P(t) when using Fourier transforms double fDeltaB; ///< field resolution of p(B) when using Fourier transforms - string fWisdomFile; ///< FFTW3 double-wisdom file - string fWisdomFileFloat; ///< FFTW3 float-wisdom file + std::string fWisdomFile; ///< FFTW3 double-wisdom file + std::string fWisdomFileFloat; ///< FFTW3 float-wisdom file unsigned int fNSteps; ///< number of steps in one-dimensional theory functions unsigned int fGridSteps; ///< number of steps in each direction when calculating two-dimensional spatial field distributions double fDeltatLF; ///< time resolution of P(t) when using Laplace transforms for the calculation of LF-relaxation functions diff --git a/src/external/MagProximity/PMPRgeHandler.cpp b/src/external/MagProximity/PMPRgeHandler.cpp index 760fac01..193b63b7 100644 --- a/src/external/MagProximity/PMPRgeHandler.cpp +++ b/src/external/MagProximity/PMPRgeHandler.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2011 by Andreas Suter * + * Copyright (C) 2011-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -31,7 +31,6 @@ #include #include -using namespace std; #include "PMPRgeHandler.h" @@ -92,7 +91,7 @@ Double_t PMPRgeHandler::GetRgeValue(const Int_t index, const Double_t dist) { Double_t rgeVal = 0.0; - UInt_t distIdx = (UInt_t)(dist/(fRgeDataList[index].stoppingDistance[1]-fRgeDataList[index].stoppingDistance[0])); + UInt_t distIdx = static_cast(dist/(fRgeDataList[index].stoppingDistance[1]-fRgeDataList[index].stoppingDistance[0])); if (distIdx >= fRgeDataList[index].stoppingDistance.size()) { rgeVal = 0.0; @@ -140,7 +139,7 @@ Double_t PMPRgeHandler::GetRgeValue(const Double_t energy, const Double_t dist) */ Bool_t PMPRgeHandler::LoadRgeData(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList) { - ifstream fin; + std::ifstream fin; PMPRgeData data; Int_t idx=0; TString dataName, tstr; @@ -150,11 +149,11 @@ Bool_t PMPRgeHandler::LoadRgeData(const PStringVector &rgeDataPathList, const PD for (UInt_t i=0; i #include -using namespace std; #include "PMPStartupHandler.h" @@ -61,7 +60,7 @@ PMPStartupHandler::PMPStartupHandler() fStartupFileFound = true; fStartupFilePath = TString(startup_path_name); } else { // startup file is not found in the current directory - cout << endl << "PMPStartupHandler(): **WARNING** Couldn't find mag_proximity_startup.xml in the current directory, will try default one." << endl; + std::cout << std::endl << "PMPStartupHandler(): **WARNING** Couldn't find mag_proximity_startup.xml in the current directory, will try default one." << std::endl; strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/MagProximity/mag_proximity_startup.xml", sizeof(startup_path_name)); if (StartupFileExists(startup_path_name)) { fStartupFileFound = true; @@ -160,9 +159,9 @@ void PMPStartupHandler::OnCharacters(const char *str) tstr += ".rge"; fTrimSpDataPathList.push_back(tstr); } else { - cout << endl << "PMPStartupHandler::OnCharacters: **ERROR** when finding energy:"; - cout << endl << "\"" << str << "\" is not a floating point number, will ignore it and use the default value."; - cout << endl; + std::cout << std::endl << "PMPStartupHandler::OnCharacters: **ERROR** when finding energy:"; + std::cout << std::endl << "\"" << str << "\" is not a floating point number, will ignore it and use the default value."; + std::cout << std::endl; } break; default: @@ -193,8 +192,8 @@ void PMPStartupHandler::OnComment(const char *str) */ void PMPStartupHandler::OnWarning(const char *str) { - cout << endl << "PMPStartupHandler **WARNING** " << str; - cout << endl; + std::cout << std::endl << "PMPStartupHandler **WARNING** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -207,8 +206,8 @@ void PMPStartupHandler::OnWarning(const char *str) */ void PMPStartupHandler::OnError(const char *str) { - cout << endl << "PMPStartupHandler **ERROR** " << str; - cout << endl; + std::cout << std::endl << "PMPStartupHandler **ERROR** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -221,8 +220,8 @@ void PMPStartupHandler::OnError(const char *str) */ void PMPStartupHandler::OnFatalError(const char *str) { - cout << endl << "PMPStartupHandler **FATAL ERROR** " << str; - cout << endl; + std::cout << std::endl << "PMPStartupHandler **FATAL ERROR** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -249,7 +248,7 @@ bool PMPStartupHandler::StartupFileExists(char *fln) { bool result = false; - ifstream ifile(fln); + std::ifstream ifile(fln); if (ifile.fail()) { result = false; diff --git a/src/external/MagProximity/PMPStartupHandler.h b/src/external/MagProximity/PMPStartupHandler.h index 86cbbd00..a6b61022 100644 --- a/src/external/MagProximity/PMPStartupHandler.h +++ b/src/external/MagProximity/PMPStartupHandler.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2011 by Andreas Suter * + * Copyright (C) 2011-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/MagProximity/PMPStartupHandlerLinkDef.h b/src/external/MagProximity/PMPStartupHandlerLinkDef.h index 69616f29..5001bcbd 100644 --- a/src/external/MagProximity/PMPStartupHandlerLinkDef.h +++ b/src/external/MagProximity/PMPStartupHandlerLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2011 by Andreas Suter * + * Copyright (C) 2011-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/MagProximity/PMagProximity.h b/src/external/MagProximity/PMagProximity.h index 30f95d3c..b364402a 100644 --- a/src/external/MagProximity/PMagProximity.h +++ b/src/external/MagProximity/PMagProximity.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2011 by Andreas Suter * + * Copyright (C) 2011-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/MagProximity/PMagProximityFitter.cpp b/src/external/MagProximity/PMagProximityFitter.cpp index b720101c..46336185 100644 --- a/src/external/MagProximity/PMagProximityFitter.cpp +++ b/src/external/MagProximity/PMagProximityFitter.cpp @@ -10,7 +10,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2011 by Andreas Suter * + * Copyright (C) 2011-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 #include -using namespace std; #include #include @@ -70,8 +69,8 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal() Int_t status = parseXmlFile(saxParser, startup_path_name); // check for parse errors if (status) { // error - cout << endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed."; - cout << endl; + std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal: **WARNING** Reading/parsing mag_proximity_startup.xml failed."; + std::cout << std::endl; fValid = false; } @@ -83,18 +82,18 @@ PMagProximityFitterGlobal::PMagProximityFitterGlobal() // check if everything went fine with the startup handler if (!fStartupHandler->IsValid()) { - cout << endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; - cout << endl << ">> startup handler too unhappy. Will terminate unfriendly, sorry."; - cout << endl; + std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; + std::cout << std::endl << ">> startup handler too unhappy. Will terminate unfriendly, sorry."; + std::cout << std::endl; fValid = false; } // load all the TRIM.SP rge-files fRgeHandler = new PMPRgeHandler(fStartupHandler->GetTrimSpDataPathList(), fStartupHandler->GetTrimSpDataVectorList()); if (!fRgeHandler->IsValid()) { - cout << endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; - cout << endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry."; - cout << endl; + std::cout << std::endl << ">> PMagProximityFitterGlobal::PMagProximityFitterGlobal **PANIC ERROR**"; + std::cout << std::endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry."; + std::cout << std::endl; fValid = false; } } @@ -113,11 +112,11 @@ PMagProximityFitterGlobal::~PMagProximityFitterGlobal() if (fRgeHandler) { delete fRgeHandler; - fRgeHandler = 0; + fRgeHandler = nullptr; } if (fStartupHandler) { delete fStartupHandler; - fStartupHandler = 0; + fStartupHandler = nullptr; } } @@ -198,19 +197,6 @@ Double_t PMagProximityFitterGlobal::GetMagneticField(const Double_t z) const } } -/* -static UInt_t count=0; -if (count < 10) { -count++; -if (idx == fField.size()-1) - cout << endl << "debug> z=" << z << ", idx=" << idx << ", fDz=" << fDz << ", fField[idx]=" << fField[idx] << ", result=" << result; -else - cout << endl << "debug> z=" << z << ", idx=" << idx << ", fDz=" << fDz << ", fField[idx]=" << fField[idx] << ", fField[idx+1]=" << fField[idx+1] << ", result=" << result; -cout << endl; -} -*/ -// cout << endl << z << ", " << result; - return result; } @@ -228,7 +214,7 @@ PMagProximityFitter::PMagProximityFitter() { fValid = false; fInvokedGlobal = false; - fMagProximityFitterGlobal = 0; + fMagProximityFitterGlobal = nullptr; } //-------------------------------------------------------------------------- @@ -241,7 +227,7 @@ PMagProximityFitter::~PMagProximityFitter() { if ((fMagProximityFitterGlobal != 0) && fInvokedGlobal) { delete fMagProximityFitterGlobal; - fMagProximityFitterGlobal = 0; + fMagProximityFitterGlobal = nullptr; } } @@ -256,7 +242,7 @@ PMagProximityFitter::~PMagProximityFitter() * \param globalPart * \param idx */ -void PMagProximityFitter::SetGlobalPart(vector &globalPart, UInt_t idx) +void PMagProximityFitter::SetGlobalPart(std::vector &globalPart, UInt_t idx) { fIdxGlobal = static_cast(idx); @@ -264,10 +250,10 @@ void PMagProximityFitter::SetGlobalPart(vector &globalPart, UInt_t idx) fMagProximityFitterGlobal = new PMagProximityFitterGlobal(); if (fMagProximityFitterGlobal == 0) { fValid = false; - cerr << endl << ">> PMagProximityFitter::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << endl; + std::cerr << std::endl << ">> PMagProximityFitter::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << std::endl; } else if (!fMagProximityFitterGlobal->IsValid()) { fValid = false; - cerr << endl << ">> PMagProximityFitter::SetGlobalPart(): **ERROR** initialization of global user function object failed, sorry ..." << endl; + std::cerr << std::endl << ">> PMagProximityFitter::SetGlobalPart(): **ERROR** initialization of global user function object failed, sorry ..." << std::endl; } else { fValid = true; fInvokedGlobal = true; diff --git a/src/external/MagProximity/PMagProximityFitter.h b/src/external/MagProximity/PMagProximityFitter.h index d09f09c2..59f35d07 100644 --- a/src/external/MagProximity/PMagProximityFitter.h +++ b/src/external/MagProximity/PMagProximityFitter.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009 by Andreas Suter * + * Copyright (C) 2009-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -69,7 +69,7 @@ class PMagProximityFitter : public PUserFcnBase virtual ~PMagProximityFitter(); virtual Bool_t NeedGlobalPart() const { return true; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx); + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx); virtual Bool_t GlobalPartIsValid() const; virtual Double_t operator()(Double_t t, const std::vector ¶m) const; diff --git a/src/external/MagProximity/PMagProximityFitterLinkDef.h b/src/external/MagProximity/PMagProximityFitterLinkDef.h index 2ddaa41f..063facb9 100644 --- a/src/external/MagProximity/PMagProximityFitterLinkDef.h +++ b/src/external/MagProximity/PMagProximityFitterLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2011 by Andreas Suter * + * Copyright (C) 2011-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp index aac7acbe..75d0e96f 100644 --- a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp +++ b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp @@ -26,7 +26,6 @@ #include -using namespace std; #include #include #include @@ -42,7 +41,7 @@ using namespace std; MuSR_td_PSI_bin::MuSR_td_PSI_bin() { - histo = NULL; + histo = nullptr; Clear(); } @@ -81,13 +80,13 @@ MuSR_td_PSI_bin::MuSR_td_PSI_bin() int MuSR_td_PSI_bin::read(const char * fileName) { - ifstream file_name; + std::ifstream file_name; Clear(); filename = fileName; - file_name.open(fileName, ios_base::binary); // open file + file_name.open(fileName, std::ios_base::binary); // open file if (file_name.fail()) { readstatus = "ERROR Open "+filename+" failed!"; @@ -158,12 +157,12 @@ MuSR_td_PSI_bin::MuSR_td_PSI_bin() int MuSR_td_PSI_bin::write(const char *fileName) { - string fln = fileName; + std::string fln = fileName; size_t found = fln.find_last_of("."); if (found == fln.npos) { return 1; // no extension found } - string ext = fln.substr(found+1); + std::string ext = fln.substr(found+1); int status = 0; if (ext == "bin") status = writebin(fileName); @@ -238,7 +237,7 @@ typedef float Float32; int MuSR_td_PSI_bin::readbin(const char * fileName) { - ifstream file_name; + std::ifstream file_name; Int16 *dum_Int16; Int32 *dum_Int32; Float32 *dum_Float32; @@ -281,7 +280,7 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) filename = fileName; - file_name.open(fileName, ios_base::binary); // open PSI bin file + file_name.open(fileName, std::ios_base::binary); // open PSI bin file if (file_name.fail()) { readstatus = "ERROR Open "+filename+" failed!"; @@ -450,8 +449,8 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) dum_Int16 = (Int16 *) &buffer_file[134]; // khidaf if (*dum_Int16 != 1) { - cout << "ERROR number of histograms/record not equals 1!" - << " Required algorithm is not implemented!" << endl; + std::cout << "ERROR number of histograms/record not equals 1!" + << " Required algorithm is not implemented!" << std::endl; delete [] buffer_file; file_name.close(); readstatus = "ERROR Algorithm to read multiple histograms in one block -" @@ -493,7 +492,7 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) for (int j=0; j dummy_vector; + std::vector dummy_vector; histos_vector.clear(); for (i=0; i 0) length_histo -= 1; @@ -1400,7 +1399,7 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) // different histogram length? else if (length_histo != nbins+gpTAsettdc.tag[i].Histominb) { - cout << "Different histogram lengths!" << endl; + std::cout << "Different histogram lengths!" << std::endl; } number_histo++; } @@ -1497,7 +1496,7 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) // different histogram length? else if (length_histo != nbins+gpTAsettdc32.tag[i].Histominb) { - cout << "Different histogram lengths!" << endl; + std::cout << "Different histogram lengths!" << std::endl; } number_histo++; } @@ -1521,8 +1520,8 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) if (tothist > MAXHISTO) { - cout << "ERROR number of histograms " << tothist << " exceedes maximum " - << MAXHISTO << "! - Setting maximum number " << endl; + std::cout << "ERROR number of histograms " << tothist << " exceedes maximum " + << MAXHISTO << "! - Setting maximum number " << std::endl; tothist = MAXHISTO; } @@ -1569,8 +1568,8 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) events_per_histo[i] = 0; int ihist = 0; - Int32 *thist = NULL; - vector dummy_vector; + Int32 *thist = nullptr; + std::vector dummy_vector; histos_vector.clear(); for (i=0,ihist=0; i< tothist; i++) @@ -1580,7 +1579,10 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) { dummy_vector.clear(); Clear(); - if (thist != NULL) delete [] thist; thist = NULL; + if (thist != nullptr) { + delete [] thist; + thist = nullptr; + } file_name.close(); readstatus = "ERROR Reading "+filename+" tag failed!"; return 6; // ERROR reading tag failed @@ -1597,9 +1599,9 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) // is a histogram there? if ((nbins=(tag.Histomaxb-tag.Histominb + 1))>1) { - if (thist == NULL) thist = new Int32[nbins]; - if (thist == NULL) - { + if (thist == nullptr) + thist = new Int32[nbins]; + if (thist == nullptr) { Clear(); file_name.close(); readstatus = "ERROR Allocating histogram buffer failed!"; @@ -1610,7 +1612,10 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) if (file_name.fail()) { Clear(); - if (thist != NULL) delete [] thist; thist = NULL; + if (thist != nullptr) { + delete [] thist; + thist = nullptr; + } file_name.close(); readstatus = "ERROR Reading "+filename+" hist failed!"; return 6; // ERROR reading hist failed @@ -1668,7 +1673,10 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) } } - if (thist != NULL) delete [] thist; thist = NULL; + if (thist != nullptr) { + delete [] thist; + thist = nullptr; + } file_name.close(); @@ -1698,7 +1706,7 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) int MuSR_td_PSI_bin::writemdu(const char * fileName) { - cerr << endl << "MuSR_td_PSI_bin::writemdu - not yet implemented" << endl; + std::cerr << std::endl << "MuSR_td_PSI_bin::writemdu - not yet implemented" << std::endl; return 0; } @@ -1815,7 +1823,7 @@ bool MuSR_td_PSI_bin::CheckDataConsistency(int tag) * - "SUCCESS" if reading was OK * - "ERROR " if reading was NOT OK */ -string MuSR_td_PSI_bin::ReadStatus() const +std::string MuSR_td_PSI_bin::ReadStatus() const { return readstatus; } @@ -1830,7 +1838,7 @@ string MuSR_td_PSI_bin::ReadStatus() const * - "SUCCESS" if writing was OK * - "ERROR " if writing was NOT OK */ -string MuSR_td_PSI_bin::WriteStatus() const +std::string MuSR_td_PSI_bin::WriteStatus() const { return writestatus; } @@ -1845,7 +1853,7 @@ string MuSR_td_PSI_bin::WriteStatus() const * - "SUCCESS" if data are consistent OK * - "ERROR " otherwise */ -string MuSR_td_PSI_bin::ConsistencyStatus() const +std::string MuSR_td_PSI_bin::ConsistencyStatus() const { return consistencyStatus; } @@ -1859,7 +1867,7 @@ string MuSR_td_PSI_bin::ConsistencyStatus() const * This method gives back: * - */ -string MuSR_td_PSI_bin::Filename() const +std::string MuSR_td_PSI_bin::Filename() const { return filename; } @@ -1908,7 +1916,7 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) #ifdef MIDEBUG cout << "histos_vector[0][0] = " << histos_vector[0][0] << endl; #endif - return (double)histo[histo_num][j]; + return static_cast(histo[histo_num][j]); } //******************************* @@ -1929,14 +1937,14 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) { - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; double *histo_array = new double[int(int(length_histo)/binning)]; - if (!histo_array) return NULL; + if (!histo_array) return nullptr; for (int i = 0; i < int(int(length_histo)/binning); i++) { @@ -1971,7 +1979,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param tag 0: rebin and zero pad at need, 1: truncate at need */ - int MuSR_td_PSI_bin::put_histo_array_int(vector< vector > histoData, int tag) + int MuSR_td_PSI_bin::put_histo_array_int(std::vector< std::vector > histoData, int tag) { // check that the number of histograms are within allowed boundaries if ((histoData.size() == 0) || (histoData.size() > 32)) { @@ -1996,7 +2004,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) } // overwrite number_histo - number_histo = (int)histoData.size(); + number_histo = static_cast(histoData.size()); // calculate the allowed histo length int lengthHisto = (65536 / histoData.size()) - ((65536 / histoData.size()) % 256); @@ -2025,17 +2033,17 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) // clean up if needed if (histo) { for (int i=0; i > data; + std::vector< std::vector > data; data.resize(number_histo); int val = 0; @@ -2133,9 +2141,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) representing the desired histogram number and binning. */ - vector MuSR_td_PSI_bin::get_histo_vector(int histo_num, int binning) + std::vector MuSR_td_PSI_bin::get_histo_vector(int histo_num, int binning) { - vector histo_vector; //(int(length_histo/binning)) + std::vector histo_vector; //(int(length_histo/binning)) if (!readingok) return histo_vector; @@ -2170,9 +2178,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - vector MuSR_td_PSI_bin::get_histo_vector_no0(int histo_num, int binning) + std::vector MuSR_td_PSI_bin::get_histo_vector_no0(int histo_num, int binning) { - vector histo_vector; //(int(length_histo/binning)); + std::vector histo_vector; //(int(length_histo/binning)); if (!readingok) return histo_vector; @@ -2214,14 +2222,14 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) int * MuSR_td_PSI_bin::get_histo_array_int(int histo_num) { - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num < 0 || histo_num >= int(number_histo)) - return NULL; + return nullptr; int *histo_array = new int[length_histo]; - if (!histo_array) return NULL; + if (!histo_array) return nullptr; for (int i = 0; i < int(length_histo); i++) { @@ -2251,15 +2259,15 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double * MuSR_td_PSI_bin::get_histo_fromt0_array(int histo_num, int binning, int offset) { - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; double *histo_fromt0_array = new double[int((int(length_histo)-get_t0_int(histo_num)-offset+1)/binning)]; - if (!histo_fromt0_array) return NULL; + if (!histo_fromt0_array) return nullptr; for (int i = 0; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning); i++) { @@ -2289,9 +2297,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - vector MuSR_td_PSI_bin::get_histo_fromt0_vector(int histo_num, int binning, int offset) + std::vector MuSR_td_PSI_bin::get_histo_fromt0_vector(int histo_num, int binning, int offset) { - vector histo_fromt0_vector; // (int((int(length_histo)-get_t0_int(histo_num)+1)/binning)); + std::vector histo_fromt0_vector; // (int((int(length_histo)-get_t0_int(histo_num)+1)/binning)); if (!readingok) return histo_fromt0_vector; @@ -2330,14 +2338,14 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double * MuSR_td_PSI_bin::get_histo_goodBins_array(int histo_num, int binning) { - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; double *histo_goodBins_array = new double[int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num)+1)/binning)]; - if (!histo_goodBins_array) return NULL; + if (!histo_goodBins_array) return nullptr; for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) { @@ -2367,9 +2375,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - vector MuSR_td_PSI_bin::get_histo_goodBins_vector(int histo_num, int binning) + std::vector MuSR_td_PSI_bin::get_histo_goodBins_vector(int histo_num, int binning) { - vector histo_goodBins_vector; + std::vector histo_goodBins_vector; if (!readingok) return histo_goodBins_vector; @@ -2416,13 +2424,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning, int offset) { - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; if ( lower_bckgrd < 0 || higher_bckgrd >= int(length_histo) || lower_bckgrd > higher_bckgrd ) - return NULL; + return nullptr; double bckgrd = 0; @@ -2470,10 +2478,10 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * between which the background is calculated. */ - vector MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_vector(int histo_num, int lower_bckgrd, + std::vector MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_vector(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning, int offset) { - vector histo_fromt0_minus_bckgrd_vector; // (int((int(length_histo)-get_t0_int(histo_num)+1)/binning)); + std::vector histo_fromt0_minus_bckgrd_vector; // (int((int(length_histo)-get_t0_int(histo_num)+1)/binning)); if (!readingok) return histo_fromt0_minus_bckgrd_vector; @@ -2530,13 +2538,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning) { - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; if ( lower_bckgrd < 0 || higher_bckgrd >= int(length_histo) || lower_bckgrd > higher_bckgrd ) - return NULL; + return nullptr; double bckgrd = 0; for (int k = lower_bckgrd; k <= higher_bckgrd; k++) @@ -2548,7 +2556,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double *histo_goodBins_minus_bckgrd_array = new double[int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num)+1)/binning)]; - if (!histo_goodBins_minus_bckgrd_array) return NULL; + if (!histo_goodBins_minus_bckgrd_array) return nullptr; for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) { @@ -2584,10 +2592,10 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * between which the background is calculated. */ - vector MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_vector(int histo_num, int lower_bckgrd, + std::vector MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_vector(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning) { - vector histo_goodBins_minus_bckgrd_vector; ; + std::vector histo_goodBins_minus_bckgrd_vector; ; if (!readingok) return histo_goodBins_minus_bckgrd_vector; @@ -2650,36 +2658,36 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) { int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) - return NULL; + return nullptr; if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) - return NULL; + return nullptr; if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) - return NULL; + return nullptr; double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning, offset); - if (dummy_1 == NULL) return NULL; + if (dummy_1 == nullptr) return nullptr; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning, offset); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; - return NULL; + return nullptr; } double *asymmetry_array = new double[int((int(length_histo)-max_t0-offset+1)/binning)]; - if (!asymmetry_array) return NULL; + if (!asymmetry_array) return nullptr; for (int i = 0; i < int((int(length_histo)-max_t0)/binning); i++) { @@ -2716,13 +2724,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - vector MuSR_td_PSI_bin::get_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, + std::vector MuSR_td_PSI_bin::get_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, int lower_bckgrd_minus, int higher_bckgrd_minus, int offset, double y_offset) { int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); - vector asymmetry_vector; // (int((int(length_histo)-max_t0+1)/binning)); + std::vector asymmetry_vector; // (int((int(length_histo)-max_t0+1)/binning)); if (!readingok) return asymmetry_vector; @@ -2740,11 +2748,11 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning, offset); - if (dummy_1 == NULL) return asymmetry_vector; + if (dummy_1 == nullptr) return asymmetry_vector; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning, offset); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; return asymmetry_vector; @@ -2794,35 +2802,35 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) { int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) - return NULL; + return nullptr; if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) - return NULL; + return nullptr; if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) - return NULL; + return nullptr; double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning, offset); - if (dummy_1 == NULL) return NULL; + if (dummy_1 == nullptr) return nullptr; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning, offset); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; - return NULL; + return nullptr; } double *error_asymmetry_array = new double[int((int(length_histo)-max_t0-offset+1)/binning)]; - if (!error_asymmetry_array) return NULL; + if (!error_asymmetry_array) return nullptr; for (int i = 0; i < int((length_histo-max_t0-offset)/binning); i++) { @@ -2861,13 +2869,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - vector MuSR_td_PSI_bin::get_error_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, + std::vector MuSR_td_PSI_bin::get_error_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, int lower_bckgrd_minus, int higher_bckgrd_minus, int offset) { int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); - vector error_asymmetry_vector; //(int((int(length_histo)-max_t0+1)/binning)); + std::vector error_asymmetry_vector; //(int((int(length_histo)-max_t0+1)/binning)); if (!readingok) return error_asymmetry_vector; @@ -2885,11 +2893,11 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning, offset); - if (dummy_1 == NULL) return error_asymmetry_vector; + if (dummy_1 == nullptr) return error_asymmetry_vector; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning, offset); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; return error_asymmetry_vector; @@ -2944,37 +2952,37 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) int hsize = int((tmin(get_lastGood_int(histo_num_plus)-get_firstGood_int(histo_num_plus), get_lastGood_int(histo_num_minus)-get_firstGood_int(histo_num_minus))+1)/binning); - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) - return NULL; + return nullptr; if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) - return NULL; + return nullptr; if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) - return NULL; + return nullptr; double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning); - if (dummy_1 == NULL) return NULL; + if (dummy_1 == nullptr) return nullptr; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; - return NULL; + return nullptr; } int hstart = tmax(get_firstGood_int(histo_num_plus)-get_t0_int(histo_num_plus),get_firstGood_int(histo_num_minus)-get_t0_int(histo_num_minus)); double *asymmetry_goodBins_array = new double[hsize]; - if (!asymmetry_goodBins_array) return NULL; + if (!asymmetry_goodBins_array) return nullptr; for (int i = 0; i < hsize; i++) { @@ -3011,14 +3019,14 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - vector MuSR_td_PSI_bin::get_asymmetry_goodBins_vector(int histo_num_plus, int histo_num_minus, double alpha_param, + std::vector MuSR_td_PSI_bin::get_asymmetry_goodBins_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, int lower_bckgrd_minus, int higher_bckgrd_minus) { int hsize = int((tmin(get_lastGood_int(histo_num_plus)-get_firstGood_int(histo_num_plus), get_lastGood_int(histo_num_minus)-get_firstGood_int(histo_num_minus))+1)/binning); - vector asymmetry_goodBins_vector; + std::vector asymmetry_goodBins_vector; if (!readingok) return asymmetry_goodBins_vector; @@ -3036,11 +3044,11 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning); - if (dummy_1 == NULL) return asymmetry_goodBins_vector; + if (dummy_1 == nullptr) return asymmetry_goodBins_vector; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; return asymmetry_goodBins_vector; @@ -3094,37 +3102,37 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) get_lastGood_int(histo_num_minus) -get_firstGood_int(histo_num_minus))+1)/binning); - if (!readingok) return NULL; + if (!readingok) return nullptr; if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) - return NULL; + return nullptr; if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) - return NULL; + return nullptr; if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) - return NULL; + return nullptr; if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) - return NULL; + return nullptr; double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning); - if (dummy_1 == NULL) return NULL; + if (dummy_1 == nullptr) return nullptr; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; - return NULL; + return nullptr; } int hstart = tmax(get_firstGood_int(histo_num_plus)-get_t0_int(histo_num_plus), get_firstGood_int(histo_num_minus)-get_t0_int(histo_num_minus)); double *error_asymmetry_goodBins_array = new double[hsize]; - if (!error_asymmetry_goodBins_array) return NULL; + if (!error_asymmetry_goodBins_array) return nullptr; for (int i = 0; i < hsize; i++) { @@ -3169,7 +3177,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - vector MuSR_td_PSI_bin::get_error_asymmetry_goodBins_vector(int histo_num_plus, + std::vector MuSR_td_PSI_bin::get_error_asymmetry_goodBins_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, @@ -3178,7 +3186,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) int hsize = int((tmin(get_lastGood_int(histo_num_plus)-get_firstGood_int(histo_num_plus), get_lastGood_int(histo_num_minus)-get_firstGood_int(histo_num_minus))+1)/binning); - vector error_asymmetry_goodBins_vector; + std::vector error_asymmetry_goodBins_vector; if (!readingok) return error_asymmetry_goodBins_vector; @@ -3196,11 +3204,11 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, higher_bckgrd_plus, binning); - if (dummy_1 == NULL) return error_asymmetry_goodBins_vector; + if (dummy_1 == nullptr) return error_asymmetry_goodBins_vector; double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, higher_bckgrd_minus, binning); - if (dummy_2 == NULL) + if (dummy_2 == nullptr) { delete [] dummy_1; return error_asymmetry_goodBins_vector; @@ -3270,9 +3278,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method providing a vector of long containing the values of the scalers */ - vector MuSR_td_PSI_bin::get_scalers_vector() + std::vector MuSR_td_PSI_bin::get_scalers_vector() { - vector scalers_vect(number_scaler); + std::vector scalers_vect(number_scaler); for ( int i = 0; i < number_scaler; i++ ) scalers_vect[i] = long(scalers[i]); @@ -3293,7 +3301,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param scalerData vector */ - int MuSR_td_PSI_bin::put_scalers_vector(vector scalerData) + int MuSR_td_PSI_bin::put_scalers_vector(std::vector scalerData) { if ((int)scalerData.size() > MAXSCALER) return -1; @@ -3525,9 +3533,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a vector of long containing the number of events in the histograms */ - vector MuSR_td_PSI_bin::get_eventsHisto_vector() + std::vector MuSR_td_PSI_bin::get_eventsHisto_vector() { - vector eventsHisto(number_histo); + std::vector eventsHisto(number_histo); for ( int i = 0; i < number_histo; i++ ) eventsHisto[i] = long(events_per_histo[i]); @@ -3616,9 +3624,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a vector of integer containing the t0 values of the histograms specified in the header */ - vector MuSR_td_PSI_bin::get_t0_vector() + std::vector MuSR_td_PSI_bin::get_t0_vector() { - vector t0(number_histo); + std::vector t0(number_histo); for ( int i = 0; i < int(number_histo); i++ ) t0[i] = int(integer_t0[i]); @@ -3637,9 +3645,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * - -1 if t0Data is too long (>MAXHISTO) */ - int MuSR_td_PSI_bin::put_t0_vector(vector &t0Data) + int MuSR_td_PSI_bin::put_t0_vector(std::vector &t0Data) { - if ((int)t0Data.size() >= MAXHISTO) + if (static_cast(t0Data.size()) >= MAXHISTO) return -1; for (unsigned int i=0; i MuSR_td_PSI_bin::get_firstGood_vector() + std::vector MuSR_td_PSI_bin::get_firstGood_vector() { - vector firstGood(number_histo); + std::vector firstGood(number_histo); for ( int i = 0; i < number_histo; i++ ) firstGood[i] = int(first_good[i]); @@ -3730,9 +3738,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a vector of integer containing the last good bin values of the histograms specified in the header */ - vector MuSR_td_PSI_bin::get_lastGood_vector() + std::vector MuSR_td_PSI_bin::get_lastGood_vector() { - vector lastGood(number_histo); + std::vector lastGood(number_histo); for ( int i = 0; i < number_histo; i++ ) lastGood[i] = int(last_good[i]); @@ -3888,9 +3896,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a string containing the sample name */ - string MuSR_td_PSI_bin::get_sample() + std::string MuSR_td_PSI_bin::get_sample() { - string strData; + std::string strData; strData = sample; @@ -3910,7 +3918,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param sample string containing the sample information */ - int MuSR_td_PSI_bin::put_sample(string sampleStr) + int MuSR_td_PSI_bin::put_sample(std::string sampleStr) { if (sampleStr.size() >= 11) return -1; @@ -3927,9 +3935,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a string containing the temperature specified in the title */ - string MuSR_td_PSI_bin::get_temp() + std::string MuSR_td_PSI_bin::get_temp() { - string strData; + std::string strData; strData = temp; @@ -3949,7 +3957,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param tempStr string containing the sample information */ - int MuSR_td_PSI_bin::put_temp(string tempStr) + int MuSR_td_PSI_bin::put_temp(std::string tempStr) { if (tempStr.size() >= 11) return -1; @@ -3966,9 +3974,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a string containing the orientation specified in the title */ - string MuSR_td_PSI_bin::get_orient() + std::string MuSR_td_PSI_bin::get_orient() { - string strData; + std::string strData; strData = orient; @@ -3988,7 +3996,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param orientStr string containing the sample information */ - int MuSR_td_PSI_bin::put_orient(string orientStr) + int MuSR_td_PSI_bin::put_orient(std::string orientStr) { if (orientStr.size() >= 11) return -1; @@ -4005,9 +4013,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a string containing the field specified in the title */ - string MuSR_td_PSI_bin::get_field() + std::string MuSR_td_PSI_bin::get_field() { - string strData; + std::string strData; strData = field; @@ -4027,7 +4035,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param fieldStr string containing the field */ - int MuSR_td_PSI_bin::put_field(string fieldStr) + int MuSR_td_PSI_bin::put_field(std::string fieldStr) { if (fieldStr.size() >= 11) return -1; @@ -4044,9 +4052,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a string containing the setup */ - string MuSR_td_PSI_bin::get_setup() + std::string MuSR_td_PSI_bin::get_setup() { - string strData; + std::string strData; strData = setup; @@ -4066,7 +4074,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param commentStr string containing the setup */ - int MuSR_td_PSI_bin::put_setup(string setupStr) + int MuSR_td_PSI_bin::put_setup(std::string setupStr) { if (setupStr.size() >= 11) return -1; @@ -4083,9 +4091,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a string containing the comment specified in the title */ - string MuSR_td_PSI_bin::get_comment() + std::string MuSR_td_PSI_bin::get_comment() { - string strData; + std::string strData; strData = comment; @@ -4104,7 +4112,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param commentStr string containing the comment */ - int MuSR_td_PSI_bin::put_comment(string commentStr) + int MuSR_td_PSI_bin::put_comment(std::string commentStr) { strncpy(comment, commentStr.c_str(), 62); comment[62] = '\0'; @@ -4121,12 +4129,12 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * returns NULL if the histogram specified is invalid */ - string MuSR_td_PSI_bin::get_nameHisto(int i) + std::string MuSR_td_PSI_bin::get_nameHisto(int i) { - string strData; + std::string strData; if (i < 0 || i >= int(number_histo)) - return NULL; + return nullptr; else { strData = labels_histo[i]; @@ -4149,12 +4157,12 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param i index of the histogram */ - int MuSR_td_PSI_bin::put_nameHisto(string histoName, int i) + int MuSR_td_PSI_bin::put_nameHisto(std::string histoName, int i) { if ((i<0) || (i>=number_histo)) return -1; - if ((int)histoName.length() >= MAXLABELSIZE) + if (static_cast(histoName.length()) >= MAXLABELSIZE) return -2; strcpy(labels_histo[i], histoName.c_str()); @@ -4169,11 +4177,11 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a vector of strings containing the names of the histograms */ - vector MuSR_td_PSI_bin::get_histoNames_vector() + std::vector MuSR_td_PSI_bin::get_histoNames_vector() { - vector str_Vector; + std::vector str_Vector; - string strData; + std::string strData; for (int i = 0; i < number_histo; i++) { strData = labels_histo[i]; @@ -4197,13 +4205,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param histoName name of the histogram */ - int MuSR_td_PSI_bin::put_histoNames_vector(vector &histoNames) + int MuSR_td_PSI_bin::put_histoNames_vector(std::vector &histoNames) { - if ((int)histoNames.size() > number_histo) + if (static_cast(histoNames.size()) > number_histo) return -1; for (unsigned int i=0; i= MAXLABELSIZE) + if (static_cast(histoNames[i].length()) >= MAXLABELSIZE) return -2; else strcpy(labels_histo[i], histoNames[i].c_str()); @@ -4219,11 +4227,11 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) /*! \brief Method returning a vector of strings containing the names of the scalers */ - vector MuSR_td_PSI_bin::get_scalersNames_vector() + std::vector MuSR_td_PSI_bin::get_scalersNames_vector() { - vector str_Vector; + std::vector str_Vector; - string strData; + std::string strData; for (int i = 0; i < number_scaler; i++) { strData = labels_scalers[i]; @@ -4246,9 +4254,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param scalersName scaler names */ - int MuSR_td_PSI_bin::put_scalersNames_vector(vector scalersName) + int MuSR_td_PSI_bin::put_scalersNames_vector(std::vector scalersName) { - if ((int)scalersName.size() > MAXSCALER) + if (static_cast(scalersName.size()) > MAXSCALER) return -1; for (unsigned int i=0; i MuSR_td_PSI_bin::get_temperatures_vector() + std::vector MuSR_td_PSI_bin::get_temperatures_vector() { - vector dbl_Temper; + std::vector dbl_Temper; for (int i = 0; i < number_temper; i++) { @@ -4326,9 +4334,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param tempVals vector containing the monitored values */ - int MuSR_td_PSI_bin::put_temperatures_vector(vector &tempVals) + int MuSR_td_PSI_bin::put_temperatures_vector(std::vector &tempVals) { - if ((int)tempVals.size() > MAXTEMPER) + if (static_cast(tempVals.size()) > MAXTEMPER) return -1; for (unsigned int i=0; i MuSR_td_PSI_bin::get_devTemperatures_vector() + std::vector MuSR_td_PSI_bin::get_devTemperatures_vector() { - vector dbl_devTemper; + std::vector dbl_devTemper; for (int i = 0; i < number_temper; i++) { @@ -4369,9 +4377,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param devTempVals vector containing standard deviations of the monitored values */ - int MuSR_td_PSI_bin::put_devTemperatures_vector(vector &devTempVals) + int MuSR_td_PSI_bin::put_devTemperatures_vector(std::vector &devTempVals) { - if ((int)devTempVals.size() > MAXTEMPER) + if (static_cast(devTempVals.size()) > MAXTEMPER) return -1; for (unsigned int i=0; i MuSR_td_PSI_bin::get_timeStart_vector() + std::vector MuSR_td_PSI_bin::get_timeStart_vector() { - vector timeStart(2); + std::vector timeStart(2); timeStart[0] = date_start; timeStart[1] = time_start; @@ -4415,7 +4423,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param timeStart vector where [0] contains the date, [1] the time string */ - int MuSR_td_PSI_bin::put_timeStart_vector(vector timeStart) + int MuSR_td_PSI_bin::put_timeStart_vector(std::vector timeStart) { if (timeStart.size() != 2) return -1; @@ -4442,9 +4450,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * stopped and 2) the time when the run was stopped */ - vector MuSR_td_PSI_bin::get_timeStop_vector() + std::vector MuSR_td_PSI_bin::get_timeStop_vector() { - vector timeStop(2); + std::vector timeStop(2); timeStop[0] = date_stop; timeStop[1] = time_stop; @@ -4468,7 +4476,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param timeStop vector where [0] contains the date, [1] the time string */ - int MuSR_td_PSI_bin::put_timeStop_vector(vector timeStop) + int MuSR_td_PSI_bin::put_timeStop_vector(std::vector timeStop) { if (timeStop.size() != 2) return -1; @@ -4501,16 +4509,16 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) // NIY maybe flag when histo should not be released // free private histograms - if (histo != NULL) + if (histo != nullptr) { for (i=0; i < number_histo; i++) - if (*(histo+i) != NULL) + if (*(histo+i) != nullptr) { delete[] *(histo+i); - *(histo+i) = NULL; + *(histo+i) = nullptr; } delete [] histo; - histo = NULL; + histo = nullptr; } // free public vector @@ -4586,54 +4594,54 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) int MuSR_td_PSI_bin::Show() const { - cout << "Filename is " << filename << endl; + std::cout << "Filename is " << filename << std::endl; if (readingok) { int i; - cout << "Format Identifier is " << format_id << endl; + std::cout << "Format Identifier is " << format_id << std::endl; - cout << "Run number is " << num_run << endl; - cout << "Sample is " << sample << endl; - cout << "Temperature is " << temp << endl; - cout << "Field is " << field << endl; - cout << "Orientation is " << orient << endl; - cout << "Comment is " << comment << endl; + std::cout << "Run number is " << num_run << std::endl; + std::cout << "Sample is " << sample << std::endl; + std::cout << "Temperature is " << temp << std::endl; + std::cout << "Field is " << field << std::endl; + std::cout << "Orientation is " << orient << std::endl; + std::cout << "Comment is " << comment << std::endl; - cout << "Start Date is " << date_start << endl; - cout << "Start Time is " << time_start << endl; + std::cout << "Start Date is " << date_start << std::endl; + std::cout << "Start Time is " << time_start << std::endl; - cout << "End Date is " << date_stop << endl; - cout << "End Time is " << time_stop << endl; + std::cout << "End Date is " << date_stop << std::endl; + std::cout << "End Time is " << time_stop << std::endl; - cout << "Bin width is " << bin_width << " [usec]" << endl; - cout << "Number of histograms is " << number_histo << endl; - cout << "Histogram length is " << length_histo << endl; - cout << "Default binning is " << default_binning << endl; - cout << "Total number of events is " << total_events << endl; + std::cout << "Bin width is " << bin_width << " [usec]" << std::endl; + std::cout << "Number of histograms is " << number_histo << std::endl; + std::cout << "Histogram length is " << length_histo << std::endl; + std::cout << "Default binning is " << default_binning << std::endl; + std::cout << "Total number of events is " << total_events << std::endl; for (i=0; i < number_histo; i++) { - cout << "Histogram " << i << " Name is >" << labels_histo[i] - << "< Events per histogram is " << events_per_histo[i] << endl; - cout << " real t0 is " << real_t0[i] << endl; - cout << " t0 is " << integer_t0[i] << endl; - cout << " first good bin is " << first_good[i] << endl; - cout << " last good bin is " << last_good[i] << endl; + std::cout << "Histogram " << i << " Name is >" << labels_histo[i] + << "< Events per histogram is " << events_per_histo[i] << std::endl; + std::cout << " real t0 is " << real_t0[i] << std::endl; + std::cout << " t0 is " << integer_t0[i] << std::endl; + std::cout << " first good bin is " << first_good[i] << std::endl; + std::cout << " last good bin is " << last_good[i] << std::endl; } - cout << "Number of scalers is " << number_scaler << endl; + std::cout << "Number of scalers is " << number_scaler << std::endl; for (i=0; i < number_scaler; i++) { - cout << "Scaler " << i << " Name is >" << labels_scalers[i] - << "< Value is " << scalers[i] << endl; + std::cout << "Scaler " << i << " Name is >" << labels_scalers[i] + << "< Value is " << scalers[i] << std::endl; } - cout << "Number of temperatures is " << number_temper << endl; + std::cout << "Number of temperatures is " << number_temper << std::endl; for (i=0; i < number_temper; i++) { - cout << "Temperature " << i << " is " << temper[i] - << " Deviation is " << temp_deviation[i] << endl; + std::cout << "Temperature " << i << " is " << temper[i] + << " Deviation is " << temp_deviation[i] << std::endl; } } else { - cout << readstatus << endl; + std::cout << readstatus << std::endl; } return 0; } diff --git a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h index 7233892a..a0fc63f6 100644 --- a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h +++ b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h @@ -10,6 +10,7 @@ begin : Alex Amato, October 2005 modified : Andrea Raselli, October 2009 + : Andreas Suter, April 2019 copyright : (C) 2005 by email : alex.amato@psi.ch @@ -30,7 +31,6 @@ #define MuSR_td_PSI_bin_H_ #include -using namespace std ; #include #include #include @@ -58,10 +58,10 @@ class MuSR_td_PSI_bin { private: // ------------------------------------start of the variables - string filename; - string readstatus; - string writestatus; - string consistencyStatus; + std::string filename; + std::string readstatus; + std::string writestatus; + std::string consistencyStatus; bool readingok; bool writingok; bool consistencyOk; @@ -118,7 +118,7 @@ class MuSR_td_PSI_bin { NOTE: Histogram information returned by \ = ..._array() methods should be freed by delete [] \; */ - vector< vector > histos_vector ; + std::vector< std::vector > histos_vector ; // ------------------------------------end of the variables @@ -135,10 +135,10 @@ class MuSR_td_PSI_bin { bool readingOK() const; bool writingOK() const; bool CheckDataConsistency(int tag=0); // tag: 0=reasonable, 1=strict - string ReadStatus() const; - string WriteStatus() const; - string ConsistencyStatus() const; - string Filename() const; + std::string ReadStatus() const; + std::string WriteStatus() const; + std::string ConsistencyStatus() const; + std::string Filename() const; int Show() const; int Clear(); @@ -148,17 +148,17 @@ class MuSR_td_PSI_bin { int *get_histo_array_int(int histo_num); double *get_histo_array(int histo_num, int binning); - int put_histo_array_int(vector< vector > histo, int tag = 0); - vector get_histo_vector(int histo_num, int binning); - vector get_histo_vector_no0(int histo_num, int binning); + int put_histo_array_int(std::vector< std::vector > histo, int tag = 0); + std::vector get_histo_vector(int histo_num, int binning); + std::vector get_histo_vector_no0(int histo_num, int binning); double *get_histo_fromt0_array(int histo_num, int binning, int offset = 0); - vector get_histo_fromt0_vector(int histo_num, int binning, int offset = 0); + std::vector get_histo_fromt0_vector(int histo_num, int binning, int offset = 0); double *get_histo_goodBins_array(int histo_num, int binning); - vector get_histo_goodBins_vector(int histo_num, int binning); + std::vector get_histo_goodBins_vector(int histo_num, int binning); double *get_histo_fromt0_minus_bckgrd_array(int histo_num, int lower_bckgdr, @@ -166,23 +166,23 @@ class MuSR_td_PSI_bin { int binning, int offset = 0); - vector get_histo_fromt0_minus_bckgrd_vector(int histo_num, + std::vector get_histo_fromt0_minus_bckgrd_vector(int histo_num, int lower_bckgdr, int higher_bckgdr, int binning, int offset = 0); - double *get_histo_goodBins_minus_bckgrd_array(int histo_num, + double *get_histo_goodBins_minus_bckgrd_array(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning); - vector get_histo_goodBins_minus_bckgrd_vector(int histo_num, + std::vector get_histo_goodBins_minus_bckgrd_vector(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning); - double *get_asymmetry_array(int histo_num_plus, + double *get_asymmetry_array(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -193,7 +193,7 @@ class MuSR_td_PSI_bin { int offset = 0, double y_offset = 0.); - vector get_asymmetry_vector(int histo_num_plus, + std::vector get_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -204,7 +204,7 @@ class MuSR_td_PSI_bin { int offset = 0, double y_offset = 0.); - double *get_error_asymmetry_array(int histo_num_plus, + double *get_error_asymmetry_array(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -214,7 +214,7 @@ class MuSR_td_PSI_bin { int higher_bckgrd_minus, int offset = 0); - vector get_error_asymmetry_vector(int histo_num_plus, + std::vector get_error_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -224,7 +224,7 @@ class MuSR_td_PSI_bin { int higher_bckgrd_minus, int offset = 0); - double *get_asymmetry_goodBins_array(int histo_num_plus, + double *get_asymmetry_goodBins_array(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -233,7 +233,7 @@ class MuSR_td_PSI_bin { int lower_bckgrd_minus, int higher_bckgrd_minus); - vector get_asymmetry_goodBins_vector(int histo_num_plus, + std::vector get_asymmetry_goodBins_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -251,7 +251,7 @@ class MuSR_td_PSI_bin { int lower_bckgrd_minus, int higher_bckgrd_minus); - vector get_error_asymmetry_goodBins_vector(int histo_num_plus, + std::vector get_error_asymmetry_goodBins_vector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -274,28 +274,28 @@ class MuSR_td_PSI_bin { int get_numberHisto_int(); void put_numberHisto_int(int val) { number_histo = val; } - string get_nameHisto(int i); - int put_nameHisto(string histoName, int i); - vector get_histoNames_vector(); - int put_histoNames_vector(vector &histoNames); + std::string get_nameHisto(int i); + int put_nameHisto(std::string histoName, int i); + std::vector get_histoNames_vector(); + int put_histoNames_vector(std::vector &histoNames); long get_eventsHisto_long(int i); - vector get_eventsHisto_vector(); + std::vector get_eventsHisto_vector(); long get_totalEvents_long(); int get_numberScaler_int(); int put_numberScaler_int(int val); - vector get_scalers_vector(); - int put_scalers_vector(vector scalerData); - vector get_scalersNames_vector(); - int put_scalersNames_vector(vector scalersName); + std::vector get_scalers_vector(); + int put_scalers_vector(std::vector scalerData); + std::vector get_scalersNames_vector(); + int put_scalersNames_vector(std::vector scalersName); int get_default_binning(); int get_t0_int(int i); int put_t0_int(int histoNo, int t0); - vector get_t0_vector(); - int put_t0_vector(vector &t0Data); + std::vector get_t0_vector(); + int put_t0_vector(std::vector &t0Data); double get_t0_double(int i); int get_max_t0_int (); @@ -304,11 +304,11 @@ class MuSR_td_PSI_bin { int get_min_2_t0_int (int k, int j); int get_firstGood_int(int i); - vector get_firstGood_vector(); + std::vector get_firstGood_vector(); int put_firstGood_int(int i, int j); int get_lastGood_int(int i); - vector get_lastGood_vector(); + std::vector get_lastGood_vector(); int put_lastGood_int(int i, int j); int get_max_lastGood_int (); @@ -319,30 +319,30 @@ class MuSR_td_PSI_bin { int get_runNumber_int(); int put_runNumber_int(int i); - string get_sample(); - int put_sample(string sample); - string get_field(); - int put_field(string field); - string get_orient(); - int put_orient(string orientation); - string get_temp(); - int put_temp(string temp); - string get_setup(); - int put_setup(string setup); - string get_comment(); - int put_comment(string comment); + std::string get_sample(); + int put_sample(std::string sample); + std::string get_field(); + int put_field(std::string field); + std::string get_orient(); + int put_orient(std::string orientation); + std::string get_temp(); + int put_temp(std::string temp); + std::string get_setup(); + int put_setup(std::string setup); + std::string get_comment(); + int put_comment(std::string comment); - vector get_timeStart_vector(); - int put_timeStart_vector(vector timeStart); - vector get_timeStop_vector(); - int put_timeStop_vector(vector timeStop); + std::vector get_timeStart_vector(); + int put_timeStart_vector(std::vector timeStart); + std::vector get_timeStop_vector(); + int put_timeStop_vector(std::vector timeStop); int get_numberTemperature_int(); int put_numberTemperature_int(int noOfTemps); - vector get_temperatures_vector(); - int put_temperatures_vector(vector &temps); - vector get_devTemperatures_vector(); - int put_devTemperatures_vector(vector &devTemps); + std::vector get_temperatures_vector(); + int put_temperatures_vector(std::vector &temps); + std::vector get_devTemperatures_vector(); + int put_devTemperatures_vector(std::vector &devTemps); private: diff --git a/src/external/MusrRoot/TMusrRunHeader.cpp b/src/external/MusrRoot/TMusrRunHeader.cpp index 1fbab84b..4d2324ff 100644 --- a/src/external/MusrRoot/TMusrRunHeader.cpp +++ b/src/external/MusrRoot/TMusrRunHeader.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2014 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,7 +31,6 @@ #include #include #include -using namespace std; #include "TMusrRunHeader.h" @@ -275,14 +274,14 @@ void TMusrRunHeader::Init(TString fileName) Set("RunInfo/No of Histos", 0); prop.Set("Time Resolution", 0.0, "ns"); Set("RunInfo/Time Resolution", prop); - vector ivec; + std::vector ivec; ivec.push_back(0); Set("RunInfo/RedGreen Offsets", ivec); Set("DetectorInfo/Detector001/Name", "n/a"); Set("DetectorInfo/Detector001/Histo Number", 0); Set("DetectorInfo/Detector001/Histo Length", 0); - Set("DetectorInfo/Detector001/Time Zero Bin", (Double_t)0.0); + Set("DetectorInfo/Detector001/Time Zero Bin", static_cast(0.0)); Set("DetectorInfo/Detector001/First Good Bin", 0); Set("DetectorInfo/Detector001/Last Good Bin", 0); @@ -341,8 +340,8 @@ Bool_t TMusrRunHeader::FillFolder(TFolder *folder) Ssiz_t pos=0; bool found=false; - if (folder == 0) { - cerr << endl << ">> TMusrRunHeader::FillFolder(): **ERROR** folder == 0!!" << endl; + if (folder == nullptr) { + std::cerr << std::endl << ">> TMusrRunHeader::FillFolder(): **ERROR** folder == 0!!" << std::endl; return false; } @@ -361,14 +360,14 @@ Bool_t TMusrRunHeader::FillFolder(TFolder *folder) path=fPathNameOrder[i]; pos = path.Last('/'); if (pos == -1) { - cerr << endl << ">> TMusrRunHeader::FillFolder(): **ERROR** somethig is wrong with the path=" << path << " !!" << endl; + std::cerr << std::endl << ">> TMusrRunHeader::FillFolder(): **ERROR** somethig is wrong with the path=" << path << " !!" << std::endl; return false; } path.Remove(pos); // remove the value from the path - oarray = (TObjArray*)FindObject(folder, path); + oarray = dynamic_cast(FindObject(folder, path)); if (!oarray) { - cerr << endl << ">> TMusrRunHeader::FillFolder(): **ERROR** couldn't create header structure!!" << endl; + std::cerr << std::endl << ">> TMusrRunHeader::FillFolder(): **ERROR** couldn't create header structure!!" << std::endl; return false; } @@ -378,7 +377,7 @@ Bool_t TMusrRunHeader::FillFolder(TFolder *folder) str = GetFirst(name, ':'); // get the first part of the encoded string, i.e. - found = false; for (Int_t j=0; jGetEntriesFast(); j++) { - p_ostr = (TObjString*) oarray->At(j); + p_ostr = dynamic_cast(oarray->At(j)); if (p_ostr->GetString().BeginsWith(str)) { // present hence replace oarray->AddAt(ostr.Clone(), j); found = true; @@ -563,7 +562,7 @@ void TMusrRunHeader::Set(TString pathName, TString value) for (i=0; i> **WARNING** " << pathName.Data() << " already exists, will replace it." << endl; + std::cerr << std::endl << ">> **WARNING** " << pathName.Data() << " already exists, will replace it." << std::endl; fStringObj[i].SetType("TString"); fStringObj[i].SetValue(value); break; @@ -597,7 +596,7 @@ void TMusrRunHeader::Set(TString pathName, Int_t value) for (i=0; i> **WARNING** " << pathName.Data() << " already exists, will replace it." << endl; + std::cerr << std::endl << ">> **WARNING** " << pathName.Data() << " already exists, will replace it." << std::endl; fIntObj[i].SetType("Int_t"); fIntObj[i].SetValue(value); break; @@ -631,7 +630,7 @@ void TMusrRunHeader::Set(TString pathName, Double_t value) for (i=0; i> **WARNING** " << pathName.Data() << " already exists, will replace it." << endl; + std::cerr << std::endl << ">> **WARNING** " << pathName.Data() << " already exists, will replace it." << std::endl; fDoubleObj[i].SetType("Double_t"); fDoubleObj[i].SetValue(value); break; @@ -665,7 +664,7 @@ void TMusrRunHeader::Set(TString pathName, TMusrRunPhysicalQuantity value) for (i=0; i> **WARNING** " << pathName.Data() << " already exists, will replace it." << endl; + std::cerr << std::endl << ">> **WARNING** " << pathName.Data() << " already exists, will replace it." << std::endl; fMusrRunPhysQuantityObj[i].SetType("TMusrRunHeader"); fMusrRunPhysQuantityObj[i].SetValue(value); break; @@ -699,7 +698,7 @@ void TMusrRunHeader::Set(TString pathName, TStringVector value) for (i=0; i> **WARNING** " << pathName.Data() << " already exists, will replace it." << endl; + std::cerr << std::endl << ">> **WARNING** " << pathName.Data() << " already exists, will replace it." << std::endl; fStringVectorObj[i].SetType("TStringVector"); fStringVectorObj[i].SetValue(value); break; @@ -733,7 +732,7 @@ void TMusrRunHeader::Set(TString pathName, TIntVector value) for (i=0; i> **WARNING** " << pathName.Data() << " already exists, will replace it." << endl; + std::cerr << std::endl << ">> **WARNING** " << pathName.Data() << " already exists, will replace it." << std::endl; fIntVectorObj[i].SetType("TIntVector"); fIntVectorObj[i].SetValue(value); break; @@ -767,7 +766,7 @@ void TMusrRunHeader::Set(TString pathName, TDoubleVector value) for (i=0; i> **WARNING** " << pathName.Data() << " already exists, will replace it." << endl; + std::cerr << std::endl << ">> **WARNING** " << pathName.Data() << " already exists, will replace it." << std::endl; fDoubleVectorObj[i].SetType("TDoubleVector"); fDoubleVectorObj[i].SetValue(value); break; @@ -803,7 +802,7 @@ Bool_t TMusrRunHeader::ExtractAll(TFolder *folder) // clean up all internal structures - just in case this is called multiple times CleanUp(); - while ((entry = (TObjArray*)next())) { + while ((entry = dynamic_cast(next()))) { ExtractHeaderInformation(entry, entry->GetName()); } return true; @@ -821,8 +820,8 @@ Bool_t TMusrRunHeader::ExtractAll(TFolder *folder) Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath) { TString label(""), path(""), pathName(""), str(""), strValue(""), type(""); - TObjString *ostr = 0; - TObjArray *tokens = 0; + TObjString *ostr = nullptr; + TObjArray *tokens = nullptr; Ssiz_t idx1; Int_t intValue; Double_t dval; @@ -833,7 +832,7 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r str = TString(headerInfo->At(i)->ClassName()); if (str == "TObjArray") { // sub tree path = requestedPath + "/" + TString(headerInfo->At(i)->GetName()); - ExtractHeaderInformation((TObjArray*)headerInfo->At(i), path); + ExtractHeaderInformation(dynamic_cast(headerInfo->At(i)), path); } else { // handle all the rest, i.e. already data ostr = dynamic_cast(headerInfo->At(i)); @@ -869,8 +868,8 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r // 1st get the description if present tokens = strValue.Tokenize(";"); - if (tokens == 0) { - cerr << endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << endl; + if (tokens == nullptr) { + std::cerr << std::endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << std::endl; return false; } @@ -892,7 +891,7 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } // 2nd collect all the other properties, this is easier when first a potential description is removed @@ -911,8 +910,8 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r } tokens = strValue.Tokenize(" +;"); - if (tokens == 0) { - cerr << endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << endl; + if (tokens == nullptr) { + std::cerr << std::endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << std::endl; return false; } @@ -965,15 +964,15 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } Set(pathName, prop); } else if (type == "TStringVector") { TStringVector svec; tokens = strValue.Tokenize(";"); - if (tokens == 0) { - cerr << endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << endl; + if (tokens == nullptr) { + std::cerr << std::endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << std::endl; return false; } for (Int_t i=0; iGetEntries(); i++) { @@ -984,14 +983,14 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r } if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } Set(pathName, svec); } else if (type == "TIntVector") { TIntVector ivec; tokens = strValue.Tokenize(";"); - if (tokens == 0) { - cerr << endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << endl; + if (tokens == nullptr) { + std::cerr << std::endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << std::endl; return false; } for (Int_t i=0; iGetEntries(); i++) { @@ -1000,14 +999,14 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r } if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } Set(pathName, ivec); } else if (type == "TDoubleVector") { TDoubleVector dvec; tokens = strValue.Tokenize(";"); - if (tokens == 0) { - cerr << endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << endl; + if (tokens == nullptr) { + std::cerr << std::endl << ">> **ERROR** Couldn't tokenize entry in Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString requestedPath)" << std::endl; return false; } for (Int_t i=0; iGetEntries(); i++) { @@ -1016,7 +1015,7 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r } if (tokens) { delete tokens; - tokens = 0; + tokens = nullptr; } Set(pathName, dvec); } @@ -1034,9 +1033,9 @@ Bool_t TMusrRunHeader::ExtractHeaderInformation(TObjArray *headerInfo, TString r */ void TMusrRunHeader::DumpHeader() { - cout << endl << "***************************************"; - cout << endl << "header info of file : " << fFileName; - cout << endl << "***************************************"; + std::cout << std::endl << "***************************************"; + std::cout << std::endl << "header info of file : " << fFileName; + std::cout << std::endl << "***************************************"; TString str(""), tstr(""), fmt(""), path(""), name(""), currentPath(""); TMusrRunPhysicalQuantity prop; @@ -1046,7 +1045,7 @@ void TMusrRunHeader::DumpHeader() SplitPathName(fPathNameOrder[i], path, name); if (path != currentPath) { currentPath = path; - cout << endl << currentPath; + std::cout << std::endl << currentPath; } // go through all objects and try to find it @@ -1055,7 +1054,7 @@ void TMusrRunHeader::DumpHeader() if (fStringObj[j].GetPathName() == fPathNameOrder[i]) { // found correct object SplitPathName(fStringObj[j].GetPathName(), path, name); str.Form(" %03d - %s: %s -@%d", i, name.Data(), fStringObj[j].GetValue().Data(), MRH_TSTRING); - cout << endl << str; + std::cout << std::endl << str; } } // 2nd check Int_t @@ -1063,7 +1062,7 @@ void TMusrRunHeader::DumpHeader() if (fIntObj[j].GetPathName() == fPathNameOrder[i]) { // found correct object SplitPathName(fIntObj[j].GetPathName(), path, name); str.Form(" %03d - %s: %d -@%d", i, name.Data(), fIntObj[j].GetValue(), MRH_INT); - cout << endl << str; + std::cout << std::endl << str; } } // 3rd check Double_t @@ -1072,7 +1071,7 @@ void TMusrRunHeader::DumpHeader() SplitPathName(fDoubleObj[j].GetPathName(), path, name); fmt.Form(" %%03d - %%s: %%.%dlf -@%%d", MRH_DOUBLE_PREC); str.Form(fmt, i, name.Data(), fDoubleObj[j].GetValue(), MRH_DOUBLE); - cout << endl << str; + std::cout << std::endl << str; } } // 4th check TMusrRunPhysicalQuantity @@ -1125,7 +1124,7 @@ void TMusrRunHeader::DumpHeader() } } str.Form(" %03d - %s -@%d", i, tstr.Data(), MRH_TMUSR_RUN_PHYSICAL_QUANTITY); - cout << endl << str; + std::cout << std::endl << str; } } // 5th check TStringVector @@ -1139,7 +1138,7 @@ void TMusrRunHeader::DumpHeader() str += vstr[vstr.size()-1]; str += " -@"; str += MRH_TSTRING_VECTOR; - cout << endl << str; + std::cout << std::endl << str; } } // 6th check TIntVector @@ -1155,7 +1154,7 @@ void TMusrRunHeader::DumpHeader() str += vint[vint.size()-1]; str += " -@"; str += MRH_INT_VECTOR; - cout << endl << str; + std::cout << std::endl << str; } } // 7th check TDoubleVector @@ -1175,12 +1174,12 @@ void TMusrRunHeader::DumpHeader() str += subStr; str += " -@"; str += MRH_DOUBLE_VECTOR; - cout << endl << str; + std::cout << std::endl << str; } } } - cout << endl; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -1303,8 +1302,8 @@ TString TMusrRunHeader::GetLabel(TString str) Ssiz_t idx2 = str.First(':'); if ((idx1 == -1) || (idx2 == -1)) { if (!fQuiet) { - cerr << endl << ">> TMusrRunHeader::GetLabel(): **WARNING** str='" << str << "', seems not correctly encoded."; - cerr << endl << ">> Will omit it." << endl; + std::cerr << std::endl << ">> TMusrRunHeader::GetLabel(): **WARNING** str='" << str << "', seems not correctly encoded."; + std::cerr << std::endl << ">> Will omit it." << std::endl; } return label; } @@ -1335,8 +1334,8 @@ TString TMusrRunHeader::GetStrValue(TString str) Ssiz_t idx2 = str.Last('-'); if ((idx1 == -1) || (idx2 == -1)) { if (!fQuiet) { - cerr << endl << ">> TMusrRunHeader::GetStrValue(): **WARNING** str='" << str << "', seems not correctly encoded."; - cerr << endl << ">> Will omit it." << endl; + std::cerr << std::endl << ">> TMusrRunHeader::GetStrValue(): **WARNING** str='" << str << "', seems not correctly encoded."; + std::cerr << std::endl << ">> Will omit it." << std::endl; } return strValue; } @@ -1366,8 +1365,8 @@ TString TMusrRunHeader::GetType(TString str) if (pos == -1) { // i.e. NOT found if (!fQuiet) { - cerr << endl << ">> TMusrRunHeader::GetType(): **WARNING** str=" << str << " seems to be an invalid MusrROOT run header string."; - cerr << endl << ">> Will omit it." << endl; + std::cerr << std::endl << ">> TMusrRunHeader::GetType(): **WARNING** str=" << str << " seems to be an invalid MusrROOT run header string."; + std::cerr << std::endl << ">> Will omit it." << std::endl; } return result; } @@ -1377,7 +1376,7 @@ TString TMusrRunHeader::GetType(TString str) typeStr.Remove(0, pos+1); Int_t typeVal; if (!typeStr.IsDigit()) { - cerr << endl << ">> TMusrRunHeader::GetType(): **ERROR** typeStr=" << typeStr << " is not supported." << endl; + std::cerr << std::endl << ">> TMusrRunHeader::GetType(): **ERROR** typeStr=" << typeStr << " is not supported." << std::endl; return result; } @@ -1406,7 +1405,7 @@ TString TMusrRunHeader::GetType(TString str) result = "TDoubleVector"; break; default: - cerr << endl << ">> TMusrRunHeader::GetType(): **ERROR** found unsupport type encoded with: " << typeVal << "." << endl; + std::cerr << std::endl << ">> TMusrRunHeader::GetType(): **ERROR** found unsupport type encoded with: " << typeVal << "." << std::endl; break; } @@ -1437,23 +1436,23 @@ bool TMusrRunHeader::UpdateFolder(TObject *treeObj, TString path) // remove the first path element if (!RemoveFirst(path, '/')) { - cerr << endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't tokenize path!!" << endl; + std::cerr << std::endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't tokenize path!!" << std::endl; return false; } if (!obj) { // required object not present, create it TObjArray *oarray = new TObjArray(); if (!oarray) { - cerr << endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't create header structure!!" << endl; + std::cerr << std::endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't create header structure!!" << std::endl; return false; } // set the name of the new TObjArray oarray->SetName(str); if (!strcmp(treeObj->ClassName(), "TFolder")) - ((TFolder*)treeObj)->Add(oarray); + (dynamic_cast(treeObj))->Add(oarray); else // it is a TObjArray - ((TObjArray*)treeObj)->AddLast(oarray); + (dynamic_cast(treeObj))->AddLast(oarray); return UpdateFolder(oarray, path); } else { // object present, hence check rest of the path @@ -1477,7 +1476,7 @@ bool TMusrRunHeader::UpdateFolder(TObject *treeObj, TString path) TObject* TMusrRunHeader::FindObject(TObject *treeObj, TString path) { Ssiz_t pos; - TObject *obj=0; + TObject *obj=nullptr; // make sure that treeObj is either TFolder or TObjArray if (strcmp(treeObj->ClassName(), "TFolder") && strcmp(treeObj->ClassName(), "TObjArray")) diff --git a/src/external/MusrRoot/TMusrRunHeader.h b/src/external/MusrRoot/TMusrRunHeader.h index 6e8ffaba..f4201f32 100644 --- a/src/external/MusrRoot/TMusrRunHeader.h +++ b/src/external/MusrRoot/TMusrRunHeader.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2014 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,7 +31,6 @@ #define TMUSRRUNHEADER_H #include -using namespace std; #include #include @@ -52,9 +51,9 @@ using namespace std; #define MRH_INT_VECTOR 5 #define MRH_DOUBLE_VECTOR 6 -typedef vector TIntVector; -typedef vector TDoubleVector; -typedef vector TStringVector; +typedef std::vector TIntVector; +typedef std::vector TDoubleVector; +typedef std::vector TStringVector; //------------------------------------------------------------------------- template class TMusrRunObject : public TObject @@ -160,15 +159,15 @@ private: TString fFileName; TString fVersion; - vector< TMusrRunObject > fStringObj; - vector< TMusrRunObject > fIntObj; - vector< TMusrRunObject > fDoubleObj; - vector< TMusrRunObject > fMusrRunPhysQuantityObj; - vector< TMusrRunObject > fStringVectorObj; - vector< TMusrRunObject > fIntVectorObj; - vector< TMusrRunObject > fDoubleVectorObj; + std::vector< TMusrRunObject > fStringObj; + std::vector< TMusrRunObject > fIntObj; + std::vector< TMusrRunObject > fDoubleObj; + std::vector< TMusrRunObject > fMusrRunPhysQuantityObj; + std::vector< TMusrRunObject > fStringVectorObj; + std::vector< TMusrRunObject > fIntVectorObj; + std::vector< TMusrRunObject > fDoubleVectorObj; - vector< TString > fPathNameOrder; ///< keeps the path-name as they were created in ordered to keep ordering + std::vector< TString > fPathNameOrder; ///< keeps the path-name as they were created in ordered to keep ordering virtual void Init(TString str="n/a"); virtual void CleanUp(); diff --git a/src/external/MusrRoot/TMusrRunHeaderLinkDef.h b/src/external/MusrRoot/TMusrRunHeaderLinkDef.h index 5d00da6c..a792a705 100644 --- a/src/external/MusrRoot/TMusrRunHeaderLinkDef.h +++ b/src/external/MusrRoot/TMusrRunHeaderLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2014 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 * diff --git a/src/external/Nonlocal/PNL_PippardFitter.cpp b/src/external/Nonlocal/PNL_PippardFitter.cpp index f1652216..4c82cfbe 100644 --- a/src/external/Nonlocal/PNL_PippardFitter.cpp +++ b/src/external/Nonlocal/PNL_PippardFitter.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009 by Andreas Suter * + * Copyright (C) 2009-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/Nonlocal/PNL_PippardFitter.h b/src/external/Nonlocal/PNL_PippardFitter.h index 3e0a899e..9d0fb4d1 100644 --- a/src/external/Nonlocal/PNL_PippardFitter.h +++ b/src/external/Nonlocal/PNL_PippardFitter.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009 by Andreas Suter * + * Copyright (C) 2009-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/Nonlocal/PNL_PippardFitterLinkDef.h b/src/external/Nonlocal/PNL_PippardFitterLinkDef.h index d641a419..6a8f181f 100644 --- a/src/external/Nonlocal/PNL_PippardFitterLinkDef.h +++ b/src/external/Nonlocal/PNL_PippardFitterLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009 by Andreas Suter * + * Copyright (C) 2009-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/Nonlocal/PNL_RgeHandler.cpp b/src/external/Nonlocal/PNL_RgeHandler.cpp index 8ed0bf2c..a08aeb89 100644 --- a/src/external/Nonlocal/PNL_RgeHandler.cpp +++ b/src/external/Nonlocal/PNL_RgeHandler.cpp @@ -33,7 +33,6 @@ #include #include -using namespace std; #include "PNL_RgeHandler.h" @@ -145,7 +144,7 @@ Double_t PNL_RgeHandler::GetRgeValue(const Double_t energy, const Double_t dist) */ Bool_t PNL_RgeHandler::LoadRgeData(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList) { - ifstream fin; + std::ifstream fin; PNL_RgeData data; TString tstr; char line[512]; @@ -154,11 +153,11 @@ Bool_t PNL_RgeHandler::LoadRgeData(const PStringVector &rgeDataPathList, const P for (UInt_t i=0; i #include -using namespace std; #include "PNL_StartupHandler.h" @@ -63,7 +62,7 @@ PNL_StartupHandler::PNL_StartupHandler() fStartupFileFound = true; fStartupFilePath = TString(startup_path_name); } else { // startup file is not found in the current directory - cout << endl << "PNL_StartupHandler(): **WARNING** Couldn't find nonlocal_startup.xml in the current directory, will try default one." << endl; + std::cout << std::endl << "PNL_StartupHandler(): **WARNING** Couldn't find nonlocal_startup.xml in the current directory, will try default one." << std::endl; home_str = getenv("HOME"); snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/nonlocal_startup.xml", home_str); if (StartupFileExists(startup_path_name)) { @@ -107,8 +106,8 @@ void PNL_StartupHandler::OnEndDocument() // check if anything was set, and if not set some default stuff if (fFourierPoints == 0) { fFourierPoints = 262144; - cout << endl << "PNL_StartupHandler::OnEndDocument: **WARNING** \"fourier_points\" not defined in nonlocal_startup.xml."; - cout << endl << " will set it to " << fFourierPoints << "." << endl; + std::cout << std::endl << "PNL_StartupHandler::OnEndDocument: **WARNING** \"fourier_points\" not defined in nonlocal_startup.xml."; + std::cout << std::endl << " will set it to " << fFourierPoints << "." << std::endl; } } @@ -163,9 +162,9 @@ void PNL_StartupHandler::OnCharacters(const char *str) if (tstr.IsDigit()) { fFourierPoints = tstr.Atoi(); } else { - cout << endl << "PNL_StartupHandler::OnCharacters: **ERROR** when finding fourier_points:"; - cout << endl << "\"" << str << "\" is not a number, will ignore it and use the default value."; - cout << endl; + std::cout << std::endl << "PNL_StartupHandler::OnCharacters: **ERROR** when finding fourier_points:"; + std::cout << std::endl << "\"" << str << "\" is not a number, will ignore it and use the default value."; + std::cout << std::endl; } break; case eDataPath: @@ -180,9 +179,9 @@ void PNL_StartupHandler::OnCharacters(const char *str) tstr += ".rge"; fTrimSpDataPathList.push_back(tstr); } else { - cout << endl << "PNL_StartupHandler::OnCharacters: **ERROR** when finding energy:"; - cout << endl << "\"" << str << "\" is not a floating point number, will ignore it and use the default value."; - cout << endl; + std::cout << std::endl << "PNL_StartupHandler::OnCharacters: **ERROR** when finding energy:"; + std::cout << std::endl << "\"" << str << "\" is not a floating point number, will ignore it and use the default value."; + std::cout << std::endl; } break; default: @@ -213,8 +212,8 @@ void PNL_StartupHandler::OnComment(const char *str) */ void PNL_StartupHandler::OnWarning(const char *str) { - cout << endl << "PNL_StartupHandler **WARNING** " << str; - cout << endl; + std::cout << std::endl << "PNL_StartupHandler **WARNING** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -227,8 +226,8 @@ void PNL_StartupHandler::OnWarning(const char *str) */ void PNL_StartupHandler::OnError(const char *str) { - cout << endl << "PNL_StartupHandler **ERROR** " << str; - cout << endl; + std::cout << std::endl << "PNL_StartupHandler **ERROR** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -241,8 +240,8 @@ void PNL_StartupHandler::OnError(const char *str) */ void PNL_StartupHandler::OnFatalError(const char *str) { - cout << endl << "PNL_StartupHandler **FATAL ERROR** " << str; - cout << endl; + std::cout << std::endl << "PNL_StartupHandler **FATAL ERROR** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -269,7 +268,7 @@ bool PNL_StartupHandler::StartupFileExists(char *fln) { bool result = false; - ifstream ifile(fln); + std::ifstream ifile(fln); if (ifile.fail()) { result = false; diff --git a/src/external/Nonlocal/PNL_StartupHandler.h b/src/external/Nonlocal/PNL_StartupHandler.h index b9a55502..20026741 100644 --- a/src/external/Nonlocal/PNL_StartupHandler.h +++ b/src/external/Nonlocal/PNL_StartupHandler.h @@ -10,7 +10,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009 by Andreas Suter * + * Copyright (C) 2009-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/Nonlocal/PNL_StartupHandlerLinkDef.h b/src/external/Nonlocal/PNL_StartupHandlerLinkDef.h index b31feacc..70055d19 100644 --- a/src/external/Nonlocal/PNL_StartupHandlerLinkDef.h +++ b/src/external/Nonlocal/PNL_StartupHandlerLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009 by Andreas Suter * + * Copyright (C) 2009-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/Nonlocal/PNonlocal.h b/src/external/Nonlocal/PNonlocal.h index ead8e0f3..5c3352ba 100644 --- a/src/external/Nonlocal/PNonlocal.h +++ b/src/external/Nonlocal/PNonlocal.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009 by Andreas Suter * + * Copyright (C) 2009-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/TLemRunHeader/TLemRunHeader.cxx b/src/external/TLemRunHeader/TLemRunHeader.cxx index 5fdca5ee..1ab427e0 100644 --- a/src/external/TLemRunHeader/TLemRunHeader.cxx +++ b/src/external/TLemRunHeader/TLemRunHeader.cxx @@ -4,9 +4,6 @@ // 18/06/2006 // // -#include -using namespace std; - #include "TLemRunHeader.h" ClassImp(TLemRunHeader) diff --git a/src/external/libBNMR/TBNMR.cpp b/src/external/libBNMR/TBNMR.cpp index b1f7b042..55fbcd5a 100644 --- a/src/external/libBNMR/TBNMR.cpp +++ b/src/external/libBNMR/TBNMR.cpp @@ -40,7 +40,7 @@ ClassImp(ExpRlx) // for the ROOT-dictionary ClassImp(SExpRlx) -double ExpRlx::operator()(double x, const vector &par) const { +double ExpRlx::operator()(double x, const std::vector &par) const { assert(par.size()==2); // make sure the number of parameters handed to the function is correct // par[0] time of beam off @@ -66,7 +66,7 @@ double ExpRlx::operator()(double x, const vector &par) const { TF1 SExpRlx::sexp1=TF1("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0); TF1 SExpRlx::sexp2=TF1("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0); -double SExpRlx::operator()(double x, const vector &par) const { +double SExpRlx::operator()(double x, const std::vector &par) const { assert(par.size()==3); // make sure the number of parameters handed to the function is correct // par[0] time of beam off diff --git a/src/external/libBNMR/TBNMR.h b/src/external/libBNMR/TBNMR.h index 24d95172..b3a90256 100644 --- a/src/external/libBNMR/TBNMR.h +++ b/src/external/libBNMR/TBNMR.h @@ -52,11 +52,11 @@ public: ~ExpRlx(){} Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } // function operator - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; // definition of the class for the ROOT-dictionary ClassDef(ExpRlx,1) @@ -70,11 +70,11 @@ public: ~SExpRlx(){} Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } // function operator - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: static TF1 sexp1; static TF1 sexp2; diff --git a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp index c71bbb79..93951ccb 100644 --- a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp +++ b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.cpp @@ -32,7 +32,6 @@ #include #include #include -using namespace std; #include #include "BMWStartupHandler.h" @@ -49,7 +48,7 @@ ClassImp(TMeanFieldsForScTrilayer) TMeanFieldsForScHalfSpace::TMeanFieldsForScHalfSpace() { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -63,8 +62,8 @@ TMeanFieldsForScHalfSpace::TMeanFieldsForScHalfSpace() { assert(false); } - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + map energy_vec(startupHandler->GetEnergies()); fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug()); @@ -83,15 +82,15 @@ TMeanFieldsForScHalfSpace::TMeanFieldsForScHalfSpace() { // Operator-method that returns the mean field for a given implantation energy // Parameters: field, deadlayer, lambda -double TMeanFieldsForScHalfSpace::operator()(double E, const vector &par_vec) const{ +double TMeanFieldsForScHalfSpace::operator()(double E, const std::vector &par_vec) const{ // Calculate field profile - vector parForBofZ(par_vec); + std::vector parForBofZ(par_vec); TLondon1D_HS BofZ(parForBofZ); - vector energies(fImpProfile->Energy()); - vector::const_iterator energyIter; + std::vector energies(fImpProfile->Energy()); + std::vector::const_iterator energyIter; energyIter = find(energies.begin(), energies.end(), E); if (energyIter != energies.end()) { // implantation profile found - no interpolation needed @@ -121,8 +120,8 @@ double TMeanFieldsForScHalfSpace::CalcMeanB (double E, const TLondon1D_HS& BofZ) fImpProfile->Normalize(E); - vector z(fImpProfile->DataZ(E)); - vector nz(fImpProfile->DataNZ(E)); + std::vector z(fImpProfile->DataZ(E)); + std::vector nz(fImpProfile->DataNZ(E)); double dz(fImpProfile->DataDZ(E)); // calculate mean field @@ -140,7 +139,7 @@ double TMeanFieldsForScHalfSpace::CalcMeanB (double E, const TLondon1D_HS& BofZ) TMeanFieldsForScSingleLayer::TMeanFieldsForScSingleLayer() { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -154,8 +153,8 @@ TMeanFieldsForScSingleLayer::TMeanFieldsForScSingleLayer() { assert(false); } - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + map energy_vec(startupHandler->GetEnergies()); fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug()); @@ -174,24 +173,24 @@ TMeanFieldsForScSingleLayer::TMeanFieldsForScSingleLayer() { // Operator-method that returns the mean field for a given implantation energy // Parameters: field, deadlayer, thicknessSC, lambda, weight (deadlayer), weight (SC), weight (substrate) -double TMeanFieldsForScSingleLayer::operator()(double E, const vector &par_vec) const{ +double TMeanFieldsForScSingleLayer::operator()(double E, const std::vector &par_vec) const{ - vector interfaces; + std::vector interfaces; interfaces.push_back(par_vec[1]); interfaces.push_back(par_vec[1]+par_vec[2]); - vector weights; + std::vector weights; weights.push_back(par_vec[4]); weights.push_back(par_vec[5]); weights.push_back(par_vec[6]); // Calculate field profile - vector parForBofZ(par_vec); + std::vector parForBofZ(par_vec); TLondon1D_1L BofZ(parForBofZ); - vector energies(fImpProfile->Energy()); - vector::const_iterator energyIter; + std::vector energies(fImpProfile->Energy()); + std::vector::const_iterator energyIter; energyIter = find(energies.begin(), energies.end(), E); if (energyIter != energies.end()) { // implantation profile found - no interpolation needed @@ -215,13 +214,13 @@ double TMeanFieldsForScSingleLayer::operator()(double E, const vector &p } } -double TMeanFieldsForScSingleLayer::CalcMeanB (double E, const vector& interfaces, const vector& weights, const TLondon1D_1L& BofZ) const { +double TMeanFieldsForScSingleLayer::CalcMeanB (double E, const std::vector& interfaces, const std::vector& weights, const TLondon1D_1L& BofZ) const { //calcData->UseHighResolution(E); fImpProfile->WeightLayers(E, interfaces, weights); fImpProfile->Normalize(E); - vector z(fImpProfile->DataZ(E)); - vector nz(fImpProfile->DataNZ(E)); + std::vector z(fImpProfile->DataZ(E)); + std::vector nz(fImpProfile->DataNZ(E)); double dz(fImpProfile->DataDZ(E)); // calculate mean field @@ -239,7 +238,7 @@ double TMeanFieldsForScSingleLayer::CalcMeanB (double E, const vector& i TMeanFieldsForScBilayer::TMeanFieldsForScBilayer() { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -253,8 +252,8 @@ TMeanFieldsForScBilayer::TMeanFieldsForScBilayer() { assert(false); } - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + map energy_vec(startupHandler->GetEnergies()); fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug(), 1); @@ -274,33 +273,33 @@ TMeanFieldsForScBilayer::TMeanFieldsForScBilayer() { // Parameters: field, deadlayer, layer1, layer2, lambda1, lambda2, weight1 (deadlayer), weight2, weight3, weight4 (substrate), // [Gss width for profile convolution] -double TMeanFieldsForScBilayer::operator()(double E, const vector &par_vec) const{ +double TMeanFieldsForScBilayer::operator()(double E, const std::vector &par_vec) const{ double width(0.0); if (par_vec.size() == 11) { width = par_vec[10]; } - vector interfaces; + std::vector interfaces; interfaces.push_back(par_vec[1]); interfaces.push_back(par_vec[1]+par_vec[2]); interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]); - vector weights; + std::vector weights; weights.push_back(par_vec[6]); weights.push_back(par_vec[7]); weights.push_back(par_vec[8]); weights.push_back(par_vec[9]); // Calculate field profile - vector parForBofZ; + std::vector parForBofZ; for (unsigned int i(0); i<6; i++) parForBofZ.push_back(par_vec[i]); TLondon1D_2L BofZ(parForBofZ); - vector energies(fImpProfile->Energy()); - vector::const_iterator energyIter; + std::vector energies(fImpProfile->Energy()); + std::vector::const_iterator energyIter; energyIter = find(energies.begin(), energies.end(), E); if (energyIter != energies.end()) { // implantation profile found - no interpolation needed @@ -324,7 +323,7 @@ double TMeanFieldsForScBilayer::operator()(double E, const vector &par_v } } -double TMeanFieldsForScBilayer::CalcMeanB (double E, const vector& interfaces, const vector& weights, const TLondon1D_2L& BofZ, double width=0.0) const { +double TMeanFieldsForScBilayer::CalcMeanB (double E, const std::vector& interfaces, const std::vector& weights, const TLondon1D_2L& BofZ, double width=0.0) const { //fImpProfile->UseHighResolution(E); //fImpProfile->ConvolveGss(width, E); //fImpProfile->SetOriginal(); @@ -332,8 +331,8 @@ double TMeanFieldsForScBilayer::CalcMeanB (double E, const vector& inter fImpProfile->ConvolveGss(width, E); fImpProfile->Normalize(E); - vector z(fImpProfile->DataZ(E)); - vector nz(fImpProfile->DataNZ(E)); + std::vector z(fImpProfile->DataZ(E)); + std::vector nz(fImpProfile->DataNZ(E)); double dz(fImpProfile->DataDZ(E)); if (E==20.0){ @@ -358,7 +357,7 @@ double TMeanFieldsForScBilayer::CalcMeanB (double E, const vector& inter TMeanFieldsForScTrilayer::TMeanFieldsForScTrilayer() { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -372,8 +371,8 @@ TMeanFieldsForScTrilayer::TMeanFieldsForScTrilayer() { assert(false); } - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + map energy_vec(startupHandler->GetEnergies()); fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug()); @@ -392,15 +391,15 @@ TMeanFieldsForScTrilayer::TMeanFieldsForScTrilayer() { // Operator-method that returns the mean field for a given implantation energy // Parameters: field, deadlayer, layer1, layer2, layer3, lambda1, lambda2, lambda3, weight1, weight2, weight3, weight4, weight5 -double TMeanFieldsForScTrilayer::operator()(double E, const vector &par_vec) const{ +double TMeanFieldsForScTrilayer::operator()(double E, const std::vector &par_vec) const{ - vector interfaces; + std::vector interfaces; interfaces.push_back(par_vec[1]); interfaces.push_back(par_vec[1]+par_vec[2]); interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]); interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]+par_vec[4]); - vector weights; + std::vector weights; weights.push_back(par_vec[8]); weights.push_back(par_vec[9]); weights.push_back(par_vec[10]); @@ -408,14 +407,14 @@ double TMeanFieldsForScTrilayer::operator()(double E, const vector &par_ weights.push_back(par_vec[12]); // Calculate field profile - vector parForBofZ; + std::vector parForBofZ; for (unsigned int i(0); i<8; i++) parForBofZ.push_back(par_vec[i]); TLondon1D_3L BofZ(parForBofZ); - vector energies(fImpProfile->Energy()); - vector::const_iterator energyIter; + std::vector energies(fImpProfile->Energy()); + std::vector::const_iterator energyIter; energyIter = find(energies.begin(), energies.end(), E); if (energyIter != energies.end()) { // implantation profile found - no interpolation needed @@ -439,13 +438,13 @@ double TMeanFieldsForScTrilayer::operator()(double E, const vector &par_ } } -double TMeanFieldsForScTrilayer::CalcMeanB (double E, const vector& interfaces, const vector& weights, const TLondon1D_3L& BofZ) const { +double TMeanFieldsForScTrilayer::CalcMeanB (double E, const std::vector& interfaces, const std::vector& weights, const TLondon1D_3L& BofZ) const { //calcData->UseHighResolution(E); fImpProfile->WeightLayers(E, interfaces, weights); fImpProfile->Normalize(E); - vector z(fImpProfile->DataZ(E)); - vector nz(fImpProfile->DataNZ(E)); + std::vector z(fImpProfile->DataZ(E)); + std::vector nz(fImpProfile->DataNZ(E)); double dz(fImpProfile->DataDZ(E)); // calculate mean field @@ -463,7 +462,7 @@ double TMeanFieldsForScTrilayer::CalcMeanB (double E, const vector& inte TMeanFieldsForScTrilayerWithInsulator::TMeanFieldsForScTrilayerWithInsulator() { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -477,8 +476,8 @@ TMeanFieldsForScTrilayerWithInsulator::TMeanFieldsForScTrilayerWithInsulator() { assert(false); } - string rge_path(startupHandler->GetDataPath()); - map energy_vec(startupHandler->GetEnergies()); + std::string rge_path(startupHandler->GetDataPath()); + map energy_vec(startupHandler->GetEnergies()); fImpProfile = new TTrimSPData(rge_path, energy_vec, startupHandler->GetDebug()); @@ -497,15 +496,15 @@ TMeanFieldsForScTrilayerWithInsulator::TMeanFieldsForScTrilayerWithInsulator() { // Operator-method that returns the mean field for a given implantation energy // Parameters: field, deadlayer, layer1, layer2, layer3, lambda1, lambda2, weight1, weight2, weight3, weight4, weight5 -double TMeanFieldsForScTrilayerWithInsulator::operator()(double E, const vector &par_vec) const{ +double TMeanFieldsForScTrilayerWithInsulator::operator()(double E, const std::vector &par_vec) const{ - vector interfaces; + std::vector interfaces; interfaces.push_back(par_vec[1]); interfaces.push_back(par_vec[1]+par_vec[2]); interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]); interfaces.push_back(par_vec[1]+par_vec[2]+par_vec[3]+par_vec[4]); - vector weights; + std::vector weights; weights.push_back(par_vec[7]); weights.push_back(par_vec[8]); weights.push_back(par_vec[9]); @@ -513,14 +512,14 @@ double TMeanFieldsForScTrilayerWithInsulator::operator()(double E, const vector< weights.push_back(par_vec[11]); // Calculate field profile - vector parForBofZ; + std::vector parForBofZ; for (unsigned int i(0); i<7; i++) parForBofZ.push_back(par_vec[i]); TLondon1D_3LwInsulator BofZ(parForBofZ); - vector energies(fImpProfile->Energy()); - vector::const_iterator energyIter; + std::vector energies(fImpProfile->Energy()); + std::vector::const_iterator energyIter; energyIter = find(energies.begin(), energies.end(), E); if (energyIter != energies.end()) { // implantation profile found - no interpolation needed @@ -545,13 +544,13 @@ double TMeanFieldsForScTrilayerWithInsulator::operator()(double E, const vector< } double TMeanFieldsForScTrilayerWithInsulator::CalcMeanB - (double E, const vector& interfaces, const vector& weights, const TLondon1D_3LwInsulator& BofZ) const { + (double E, const std::vector& interfaces, const std::vector& weights, const TLondon1D_3LwInsulator& BofZ) const { //calcData->UseHighResolution(E); fImpProfile->WeightLayers(E, interfaces, weights); fImpProfile->Normalize(E); - vector z(fImpProfile->DataZ(E)); - vector nz(fImpProfile->DataNZ(E)); + std::vector z(fImpProfile->DataZ(E)); + std::vector nz(fImpProfile->DataNZ(E)); double dz(fImpProfile->DataDZ(E)); // calculate mean field diff --git a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h index ba3c234f..641f5239 100644 --- a/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h +++ b/src/external/libCalcMeanFieldsLEM/TCalcMeanFieldsLEM.h @@ -39,10 +39,10 @@ public: ~TMeanFieldsForScHalfSpace() {delete fImpProfile; fImpProfile = 0;} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; double CalcMeanB (double, const TLondon1D_HS&) const; private: @@ -59,11 +59,11 @@ public: ~TMeanFieldsForScSingleLayer() {delete fImpProfile; fImpProfile = 0;} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; - double CalcMeanB (double, const vector&, const vector&, const TLondon1D_1L&) const; + double operator()(double, const std::vector&) const; + double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_1L&) const; private: TTrimSPData *fImpProfile; @@ -79,11 +79,11 @@ public: ~TMeanFieldsForScBilayer() {delete fImpProfile; fImpProfile = 0;} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; - double CalcMeanB (double, const vector&, const vector&, const TLondon1D_2L&, double) const; + double operator()(double, const std::vector&) const; + double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_2L&, double) const; private: TTrimSPData *fImpProfile; @@ -99,11 +99,11 @@ public: ~TMeanFieldsForScTrilayer() {delete fImpProfile; fImpProfile = 0;} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; - double CalcMeanB (double, const vector&, const vector&, const TLondon1D_3L&) const; + double operator()(double, const std::vector&) const; + double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_3L&) const; private: TTrimSPData *fImpProfile; @@ -119,11 +119,11 @@ public: ~TMeanFieldsForScTrilayerWithInsulator() {delete fImpProfile; fImpProfile = 0;} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; - double CalcMeanB (double, const vector&, const vector&, const TLondon1D_3LwInsulator&) const; + double operator()(double, const std::vector&) const; + double CalcMeanB (double, const std::vector&, const std::vector&, const TLondon1D_3LwInsulator&) const; private: TTrimSPData *fImpProfile; diff --git a/src/external/libFitPofB/classes/TBofZCalc.cpp b/src/external/libFitPofB/classes/TBofZCalc.cpp index 002a1b34..0064aa2d 100644 --- a/src/external/libFitPofB/classes/TBofZCalc.cpp +++ b/src/external/libFitPofB/classes/TBofZCalc.cpp @@ -37,8 +37,6 @@ #endif #include -//#include -//#include #include //------------------ @@ -122,7 +120,7 @@ void TBofZCalc::Calculate() // Parameters: Bext[G], deadlayer[nm], lambda[nm] //------------------ -TLondon1D_HS::TLondon1D_HS(const vector ¶m, unsigned int steps) +TLondon1D_HS::TLondon1D_HS(const std::vector ¶m, unsigned int steps) { fSteps = steps; fDZ = 200.0/double(steps); @@ -149,14 +147,14 @@ double TLondon1D_HS::GetBmin() const return fParam[0]*exp((fParam[1]-200.0)/fParam[2]); } -vector< pair > TLondon1D_HS::GetInverseAndDerivative(double BB) const +std::vector< std::pair > TLondon1D_HS::GetInverseAndDerivative(double BB) const { - vector< pair > inv; + std::vector< std::pair > inv; if(BB <= 0.0 || BB > fParam[0]) return inv; - pair invAndDerivative; + std::pair invAndDerivative; invAndDerivative.first = fParam[1] - fParam[2]*log(BB/fParam[0]); invAndDerivative.second = -fParam[2]/BB; @@ -173,7 +171,7 @@ vector< pair > TLondon1D_HS::GetInverseAndDerivative(double BB) // Parameters: Bext[G], deadlayer[nm], thickness[nm], lambda[nm] //------------------ -TLondon1D_1L::TLondon1D_1L(const vector ¶m, unsigned int steps) +TLondon1D_1L::TLondon1D_1L(const std::vector ¶m, unsigned int steps) { fSteps = steps; fDZ = param[2]/double(steps); @@ -254,15 +252,15 @@ void TLondon1D_1L::SetBmin() return; } -vector< pair > TLondon1D_1L::GetInverseAndDerivative(double BB) const +std::vector< std::pair > TLondon1D_1L::GetInverseAndDerivative(double BB) const { - vector< pair > inv; + std::vector< std::pair > inv; if(BB <= fMinB || BB > fParam[0]) return inv; double inverse[2]; - pair invAndDerivative; + std::pair invAndDerivative; inverse[0]=fParam[3]*log((BB-sqrt(BB*BB-4.0*fCoeff[0]*fCoeff[1]))/(2.0*fCoeff[1])); inverse[1]=fParam[3]*log((BB+sqrt(BB*BB-4.0*fCoeff[0]*fCoeff[1]))/(2.0*fCoeff[1])); @@ -288,7 +286,7 @@ vector< pair > TLondon1D_1L::GetInverseAndDerivative(double BB) // Parameters: Bext[G], deadlayer[nm], thickness1[nm], thickness2[nm], lambda1[nm], lambda2[nm] //------------------ -TLondon1D_2L::TLondon1D_2L(const vector ¶m, unsigned int steps) +TLondon1D_2L::TLondon1D_2L(const std::vector ¶m, unsigned int steps) { fSteps = steps; fDZ = (param[2]+param[3])/double(steps); @@ -389,15 +387,15 @@ void TLondon1D_2L::SetBmin() return; } -vector< pair > TLondon1D_2L::GetInverseAndDerivative(double BB) const +std::vector< std::pair > TLondon1D_2L::GetInverseAndDerivative(double BB) const { - vector< pair > inv; + std::vector< std::pair > inv; if(BB <= fMinB || BB >= fParam[0]) return inv; double inverse[3]; - pair invAndDerivative; + std::pair invAndDerivative; switch(fMinTag) { @@ -457,7 +455,7 @@ vector< pair > TLondon1D_2L::GetInverseAndDerivative(double BB) // Parameters: Bext[G], B1[G], deadlayer[nm], thickness1[nm], lambda[nm] //------------------ -TProximity1D_1LHS::TProximity1D_1LHS(const vector ¶m, unsigned int steps) +TProximity1D_1LHS::TProximity1D_1LHS(const std::vector ¶m, unsigned int steps) { fSteps = steps; fDZ = 200./double(steps); @@ -512,15 +510,15 @@ void TProximity1D_1LHS::SetBmin() return; } -vector< pair > TProximity1D_1LHS::GetInverseAndDerivative(double BB) const +std::vector< std::pair > TProximity1D_1LHS::GetInverseAndDerivative(double BB) const { - vector< pair > inv; + std::vector< std::pair > inv; if(BB <= fMinB || BB > fParam[0]) return inv; double inverse[2]; - pair invAndDerivative; + std::pair invAndDerivative; inverse[0]=(fParam[0]*(fParam[2]+fParam[3])-fParam[1]*fParam[2]-BB*fParam[3])/(fParam[0]-fParam[1]); inverse[1]=fParam[2]+fParam[3]-fParam[4]*log(BB/fParam[1]); @@ -545,7 +543,7 @@ vector< pair > TProximity1D_1LHS::GetInverseAndDerivative(double // Parameters: Bext[G], deadlayer[nm], thickness1[nm], thickness2[nm], thickness3[nm], lambda1[nm], lambda2[nm], lambda3[nm] //------------------ -TLondon1D_3L::TLondon1D_3L(const vector ¶m, unsigned int steps) +TLondon1D_3L::TLondon1D_3L(const std::vector ¶m, unsigned int steps) // : fSteps(steps), fDZ((param[2]+param[3]+param[4])/double(steps)), fParam(param), fMinTag(-1), fMinZ(-1.0), fMinB(-1.0) { // no members of TLondon1D_3L, therefore the initialization list cannot be used!! @@ -681,15 +679,15 @@ void TLondon1D_3L::SetBmin() return; } -vector< pair > TLondon1D_3L::GetInverseAndDerivative(double BB) const +std::vector< std::pair > TLondon1D_3L::GetInverseAndDerivative(double BB) const { - vector< pair > inv; + std::vector< std::pair > inv; if(BB <= fMinB || BB > fParam[0]) return inv; double inverse[4]; - pair invAndDerivative; + std::pair invAndDerivative; switch(fMinTag) { @@ -791,7 +789,7 @@ vector< pair > TLondon1D_3L::GetInverseAndDerivative(double BB) // Parameters: Bext[G], deadlayer[nm], thickness1[nm], thickness2[nm], thickness3[nm], lambda1[nm], lambda2[nm] //------------------ -TLondon1D_3LS::TLondon1D_3LS(const vector ¶m, unsigned int steps) +TLondon1D_3LS::TLondon1D_3LS(const std::vector ¶m, unsigned int steps) { fSteps = steps; fDZ = (param[2]+param[3]+param[4])/double(steps); @@ -915,15 +913,15 @@ void TLondon1D_3LS::SetBmin() return; } -vector< pair > TLondon1D_3LS::GetInverseAndDerivative(double BB) const +std::vector< std::pair > TLondon1D_3LS::GetInverseAndDerivative(double BB) const { - vector< pair > inv; + std::vector< std::pair > inv; if(BB <= fMinB || BB > fParam[0]) return inv; double inverse[4]; - pair invAndDerivative; + std::pair invAndDerivative; switch(fMinTag) { @@ -1025,7 +1023,7 @@ vector< pair > TLondon1D_3LS::GetInverseAndDerivative(double BB) // Parameters: Bext[G], deadlayer[nm], thickness1[nm], thickness2[nm], thickness3[nm], lambda1[nm], lambda2[nm] //------------------ -TLondon1D_3LwInsulator::TLondon1D_3LwInsulator(const vector ¶m, unsigned int steps) +TLondon1D_3LwInsulator::TLondon1D_3LwInsulator(const std::vector ¶m, unsigned int steps) { fSteps = steps; fDZ = (param[2]+param[3]+param[4])/static_cast(steps); diff --git a/src/external/libFitPofB/classes/TBulkTriVortexFieldCalc.cpp b/src/external/libFitPofB/classes/TBulkTriVortexFieldCalc.cpp index 9154635f..5e8fe69e 100644 --- a/src/external/libFitPofB/classes/TBulkTriVortexFieldCalc.cpp +++ b/src/external/libFitPofB/classes/TBulkTriVortexFieldCalc.cpp @@ -40,7 +40,6 @@ #endif #include -using namespace std; #include "TMath.h" @@ -73,7 +72,7 @@ TBulkVortexFieldCalc::~TBulkVortexFieldCalc() { FILE *wordsOfWisdomW; wordsOfWisdomW = fopen(fWisdom.c_str(), "w"); if (wordsOfWisdomW == NULL) { - cout << "TBulkVortexFieldCalc::~TBulkVortexFieldCalc(): Could not open file ... No wisdom is exported..." << endl; + std::cout << "TBulkVortexFieldCalc::~TBulkVortexFieldCalc(): Could not open file ... No wisdom is exported..." << std::endl; } else { fftw_export_wisdom_to_file(wordsOfWisdomW); fclose(wordsOfWisdomW); @@ -123,7 +122,7 @@ double TBulkVortexFieldCalc::GetBmax() const { } } -TBulkTriVortexLondonFieldCalc::TBulkTriVortexLondonFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkTriVortexLondonFieldCalc::TBulkTriVortexLondonFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -143,7 +142,7 @@ TBulkTriVortexLondonFieldCalc::TBulkTriVortexLondonFieldCalc(const string& wisdo fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -174,11 +173,11 @@ TBulkTriVortexLondonFieldCalc::TBulkTriVortexLondonFieldCalc(const string& wisdo void TBulkTriVortexLondonFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 3) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2]) { - cout << endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << endl; + std::cout << std::endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << std::endl; return; } @@ -302,7 +301,7 @@ void TBulkTriVortexLondonFieldCalc::CalculateGrid() const { } -TBulkSqVortexLondonFieldCalc::TBulkSqVortexLondonFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkSqVortexLondonFieldCalc::TBulkSqVortexLondonFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -322,7 +321,7 @@ TBulkSqVortexLondonFieldCalc::TBulkSqVortexLondonFieldCalc(const string& wisdom, fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -353,11 +352,11 @@ TBulkSqVortexLondonFieldCalc::TBulkSqVortexLondonFieldCalc(const string& wisdom, void TBulkSqVortexLondonFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 3) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2]) { - cout << endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << endl; + std::cout << std::endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << std::endl; return; } @@ -449,7 +448,7 @@ void TBulkSqVortexLondonFieldCalc::CalculateGrid() const { -TBulkTriVortexMLFieldCalc::TBulkTriVortexMLFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkTriVortexMLFieldCalc::TBulkTriVortexMLFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -469,7 +468,7 @@ TBulkTriVortexMLFieldCalc::TBulkTriVortexMLFieldCalc(const string& wisdom, const fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -500,11 +499,11 @@ TBulkTriVortexMLFieldCalc::TBulkTriVortexMLFieldCalc(const string& wisdom, const void TBulkTriVortexMLFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 3) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2]) { - cout << endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << endl; + std::cout << std::endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << std::endl; return; } @@ -645,7 +644,7 @@ void TBulkTriVortexMLFieldCalc::CalculateGrid() const { } -TBulkTriVortexAGLFieldCalc::TBulkTriVortexAGLFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkTriVortexAGLFieldCalc::TBulkTriVortexAGLFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -665,7 +664,7 @@ TBulkTriVortexAGLFieldCalc::TBulkTriVortexAGLFieldCalc(const string& wisdom, con fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -696,11 +695,11 @@ TBulkTriVortexAGLFieldCalc::TBulkTriVortexAGLFieldCalc(const string& wisdom, con void TBulkTriVortexAGLFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 3) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2]) { - cout << endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << endl; + std::cout << std::endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << std::endl; return; } @@ -850,7 +849,7 @@ void TBulkTriVortexAGLFieldCalc::CalculateGrid() const { -TBulkTriVortexAGLIIFieldCalc::TBulkTriVortexAGLIIFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkTriVortexAGLIIFieldCalc::TBulkTriVortexAGLIIFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -870,7 +869,7 @@ TBulkTriVortexAGLIIFieldCalc::TBulkTriVortexAGLIIFieldCalc(const string& wisdom, fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -901,11 +900,11 @@ TBulkTriVortexAGLIIFieldCalc::TBulkTriVortexAGLIIFieldCalc(const string& wisdom, void TBulkTriVortexAGLIIFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 3) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2]) { - cout << endl << "The field, penetration depth and vortex-core radius have to have finite values in order to calculate B(x,y)!" << endl; + std::cout << std::endl << "The field, penetration depth and vortex-core radius have to have finite values in order to calculate B(x,y)!" << std::endl; return; } @@ -1054,7 +1053,7 @@ void TBulkTriVortexAGLIIFieldCalc::CalculateGrid() const { } -TBulkTriVortexNGLFieldCalc::TBulkTriVortexNGLFieldCalc(const string& wisdom, const unsigned int steps) +TBulkTriVortexNGLFieldCalc::TBulkTriVortexNGLFieldCalc(const std::string& wisdom, const unsigned int steps) : fLatticeConstant(0.0), fKappa(0.0), fSumAk(0.0), fSumOmegaSq(0.0), fSumSum(0.0) { fWisdom = wisdom; @@ -1332,7 +1331,7 @@ void TBulkTriVortexNGLFieldCalc::CalculateGradient() const { // // #pragma omp parallel for default(shared) private(i) schedule(dynamic) // for (i = 0; i < NFFTsq; i += 1) { // if (fOmegaMatrix[i] < 0.0) { -// cout << "Omega negative for index " << i << ", value: " << fOmegaMatrix[i] << endl; +// std::cout << "Omega negative for index " << i << ", value: " << fOmegaMatrix[i] << std::endl; // fOmegaMatrix[i] = 0.0; // } // } @@ -1909,11 +1908,11 @@ void TBulkTriVortexNGLFieldCalc::CalculateSumAk() const { void TBulkTriVortexNGLFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 3) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2]) { - cout << endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << endl; + std::cout << std::endl << "The field, penetration depth and coherence length have to have finite values in order to calculate B(x,y)!" << std::endl; return; } @@ -1967,7 +1966,7 @@ void TBulkTriVortexNGLFieldCalc::CalculateGrid() const { CalculateSumAk(); - // cout << "fSumAk = " << fSumAk << endl; + // std::cout << "fSumAk = " << fSumAk << std::endl; // Do the Fourier transform to get omega(x,y) - Abrikosov @@ -2060,7 +2059,7 @@ void TBulkTriVortexNGLFieldCalc::CalculateGrid() const { CalculateSumAk(); - // cout << "fSumAk = " << fSumAk << endl; + // std::cout << "fSumAk = " << fSumAk << std::endl; // Need a copy of the aK-matrix since FFTW is manipulating the input in c2r and r2c transforms // Store it in the first half of the bK-matrix @@ -2133,9 +2132,9 @@ void TBulkTriVortexNGLFieldCalc::CalculateGrid() const { if (fFFTin[l][0]){ if (((fabs(fFFTin[l][0]) > 1.0E-6) && (fabs(fCheckAkConvergence[l] - fFFTin[l][0])/fFFTin[l][0] > 1.0E-3)) || \ (fCheckAkConvergence[l]/fFFTin[l][0] < 0.0)) { - //cout << "old: " << fCheckAkConvergence[l] << ", new: " << fFFTin[l][0] << endl; + //std::cout << "old: " << fCheckAkConvergence[l] << ", new: " << fFFTin[l][0] << std::endl; akConverged = false; - //cout << "index = " << l << endl; + //std::cout << "index = " << l << std::endl; break; } } @@ -2156,13 +2155,13 @@ void TBulkTriVortexNGLFieldCalc::CalculateGrid() const { //break; } - // cout << "Ak Convergence: " << akConverged << endl; + // std::cout << "Ak Convergence: " << akConverged << std::endl; // Calculate omega again either for the bK-iteration step or again the aK-iteration CalculateSumAk(); - // cout << "fSumAk = " << fSumAk << " count = " << count << endl; + // std::cout << "fSumAk = " << fSumAk << " count = " << count << std::endl; // Do the Fourier transform to get omega(x,y) @@ -2222,14 +2221,14 @@ void TBulkTriVortexNGLFieldCalc::CalculateGrid() const { if (fBkMatrix[l][0]) { if (((fabs(fBkMatrix[l][0]) > 1.0E-6) && (fabs(fCheckBkConvergence[l] - fBkMatrix[l][0])/fabs(fBkMatrix[l][0]) > 1.0E-3)) || \ (fCheckBkConvergence[l]/fBkMatrix[l][0] < 0.0)) { - // cout << "old: " << fCheckBkConvergence[l] << ", new: " << fBkMatrix[l][0] << endl; + // std::cout << "old: " << fCheckBkConvergence[l] << ", new: " << fBkMatrix[l][0] << std::endl; bkConverged = false; break; } } } - // cout << "Bk Convergence: " << bkConverged << endl; + // std::cout << "Bk Convergence: " << bkConverged << std::endl; if (!bkConverged) { #ifdef HAVE_GOMP @@ -2338,7 +2337,7 @@ void TBulkTriVortexNGLFieldCalc::CalculateGrid() const { } -TBulkAnisotropicTriVortexLondonFieldCalc::TBulkAnisotropicTriVortexLondonFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkAnisotropicTriVortexLondonFieldCalc::TBulkAnisotropicTriVortexLondonFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -2358,7 +2357,7 @@ TBulkAnisotropicTriVortexLondonFieldCalc::TBulkAnisotropicTriVortexLondonFieldCa fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -2389,12 +2388,12 @@ TBulkAnisotropicTriVortexLondonFieldCalc::TBulkAnisotropicTriVortexLondonFieldCa void TBulkAnisotropicTriVortexLondonFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 5) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2] || !fParam[3] || !fParam[4]) { - cout << endl << "The field, penetration depths and coherence lengths have to have finite values in order to calculate B(x,y)!" \ - << endl; + std::cout << std::endl << "The field, penetration depths and coherence lengths have to have finite values in order to calculate B(x,y)!" \ + << std::endl; return; } @@ -2555,7 +2554,7 @@ void TBulkAnisotropicTriVortexLondonFieldCalc::CalculateGrid() const { } -TBulkAnisotropicTriVortexMLFieldCalc::TBulkAnisotropicTriVortexMLFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkAnisotropicTriVortexMLFieldCalc::TBulkAnisotropicTriVortexMLFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -2575,7 +2574,7 @@ TBulkAnisotropicTriVortexMLFieldCalc::TBulkAnisotropicTriVortexMLFieldCalc(const fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -2606,12 +2605,12 @@ TBulkAnisotropicTriVortexMLFieldCalc::TBulkAnisotropicTriVortexMLFieldCalc(const void TBulkAnisotropicTriVortexMLFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 5) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2] || !fParam[3] || !fParam[4]) { - cout << endl << "The field, penetration depths and coherence lengths have to have finite values in order to calculate B(x,y)!" \ - << endl; + std::cout << std::endl << "The field, penetration depths and coherence lengths have to have finite values in order to calculate B(x,y)!" \ + << std::endl; return; } @@ -2754,7 +2753,7 @@ void TBulkAnisotropicTriVortexMLFieldCalc::CalculateGrid() const { } -TBulkAnisotropicTriVortexAGLFieldCalc::TBulkAnisotropicTriVortexAGLFieldCalc(const string& wisdom, const unsigned int steps) { +TBulkAnisotropicTriVortexAGLFieldCalc::TBulkAnisotropicTriVortexAGLFieldCalc(const std::string& wisdom, const unsigned int steps) { fWisdom = wisdom; if (steps % 2) { fSteps = steps + 1; @@ -2774,7 +2773,7 @@ TBulkAnisotropicTriVortexAGLFieldCalc::TBulkAnisotropicTriVortexAGLFieldCalc(con fFFTin = new fftw_complex[(fSteps/2 + 1) * fSteps]; fFFTout = new double[fSteps*fSteps]; -// cout << "Check for the FFT plan..." << endl; +// std::cout << "Check for the FFT plan..." << std::endl; // Load wisdom from file if it exists and should be used @@ -2805,12 +2804,12 @@ TBulkAnisotropicTriVortexAGLFieldCalc::TBulkAnisotropicTriVortexAGLFieldCalc(con void TBulkAnisotropicTriVortexAGLFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 5) { - cout << endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2] || !fParam[3] || !fParam[4]) { - cout << endl << "The field, penetration depths and coherence lengths have to have finite values in order to calculate B(x,y)!" \ - << endl; + std::cout << std::endl << "The field, penetration depths and coherence lengths have to have finite values in order to calculate B(x,y)!" \ + << std::endl; return; } diff --git a/src/external/libFitPofB/classes/TFilmTriVortexFieldCalc.cpp b/src/external/libFitPofB/classes/TFilmTriVortexFieldCalc.cpp index fc7c0009..f551a5e9 100644 --- a/src/external/libFitPofB/classes/TFilmTriVortexFieldCalc.cpp +++ b/src/external/libFitPofB/classes/TFilmTriVortexFieldCalc.cpp @@ -41,7 +41,6 @@ #endif #include -using namespace std; #include "TMath.h" @@ -60,7 +59,7 @@ TFilmVortexFieldCalc::~TFilmVortexFieldCalc() { FILE *wordsOfWisdomW; wordsOfWisdomW = fopen(fWisdom.c_str(), "w"); if (wordsOfWisdomW == NULL) { - cout << "TFilmVortexFieldCalc::~TFilmVortexFieldCalc(): Could not open file ... No wisdom is exported..." << endl; + std::cout << "TFilmVortexFieldCalc::~TFilmVortexFieldCalc(): Could not open file ... No wisdom is exported..." << std::endl; } else { fftwf_export_wisdom_to_file(wordsOfWisdomW); fclose(wordsOfWisdomW); @@ -71,7 +70,7 @@ TFilmVortexFieldCalc::~TFilmVortexFieldCalc() { fftwf_destroy_plan(fFFTplan); - delete[] fFFTin; fFFTin = 0; + delete[] fFFTin; fFFTin = nullptr; for(unsigned int i(0); i<3; ++i){ delete[] fBout[i]; fBout[i] = 0; @@ -117,10 +116,10 @@ float TFilmVortexFieldCalc::GetBmax() const { } -TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc(const string& wisdom, const unsigned int steps, const unsigned int stepsZ) +TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc(const std::string& wisdom, const unsigned int steps, const unsigned int stepsZ) : fLatticeConstant(0.0), fKappa(0.0), fSumOmegaSq(0.0), fSumSum(0.0), fFind3dSolution(false) { -// cout << "TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc... "; +// std::cout << "TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc... "; fWisdom = wisdom; switch (stepsZ % 2) { @@ -171,7 +170,7 @@ TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc(const string& wisdom, con temp = new float[stepsSqStZ]; // (grad omega)_(x,y,z) fOmegaDiffMatrix.push_back(temp); } - temp = 0; + temp = nullptr; fOmegaMatrix = new float[stepsSqStZ]; // |psi|^2 @@ -201,7 +200,7 @@ TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc(const string& wisdom, con FILE *wordsOfWisdomR; wordsOfWisdomR = fopen(fWisdom.c_str(), "r"); - if (wordsOfWisdomR == NULL) { + if (wordsOfWisdomR == nullptr) { fUseWisdom = false; } else { wisdomLoaded = fftwf_import_wisdom_from_file(wordsOfWisdomR); @@ -215,7 +214,7 @@ TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc(const string& wisdom, con // create the FFT plans if (fUseWisdom) { -// cout << "use wisdom ... "; +// std::cout << "use wisdom ... "; // use the first plan from the base class here - it will be destroyed by the base class destructor fFFTplan = fftwf_plan_dft_3d(fSteps, fSteps, fStepsZ, fFFTin, fRealSpaceMatrix, FFTW_BACKWARD, FFTW_EXHAUSTIVE); fFFTplanBkToBandQ = fftwf_plan_dft_3d(fSteps, fSteps, fStepsZ, fBkMatrix, fBkMatrix, FFTW_BACKWARD, FFTW_EXHAUSTIVE); @@ -226,7 +225,7 @@ TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc(const string& wisdom, con fFFTplanForBatSurf = fftwf_plan_dft_2d(fSteps, fSteps, fBkS, fBkS, FFTW_FORWARD, FFTW_EXHAUSTIVE); } else { -// cout << "do not use wisdom ... "; +// std::cout << "do not use wisdom ... "; // use the first plan from the base class here - it will be destroyed by the base class destructor fFFTplan = fftwf_plan_dft_3d(fSteps, fSteps, fStepsZ, fFFTin, fRealSpaceMatrix, FFTW_BACKWARD, FFTW_ESTIMATE); fFFTplanBkToBandQ = fftwf_plan_dft_3d(fSteps, fSteps, fStepsZ, fBkMatrix, fBkMatrix, FFTW_BACKWARD, FFTW_ESTIMATE); @@ -236,7 +235,7 @@ TFilmTriVortexNGLFieldCalc::TFilmTriVortexNGLFieldCalc(const string& wisdom, con fFFTplanForPk2 = fftwf_plan_dft_3d(fSteps, fSteps, fStepsZ, fQMatrix, fQMatrix, FFTW_BACKWARD, FFTW_ESTIMATE); fFFTplanForBatSurf = fftwf_plan_dft_2d(fSteps, fSteps, fBkS, fBkS, FFTW_FORWARD, FFTW_ESTIMATE); } -// cout << "done" << endl; +// std::cout << "done" << endl; } TFilmTriVortexNGLFieldCalc::~TFilmTriVortexNGLFieldCalc() { @@ -254,19 +253,19 @@ TFilmTriVortexNGLFieldCalc::~TFilmTriVortexNGLFieldCalc() { } fOmegaDiffMatrix.clear(); - delete[] fOmegaMatrix; fOmegaMatrix = 0; - delete[] fBkMatrix; fBkMatrix = 0; - delete[] fRealSpaceMatrix; fRealSpaceMatrix = 0; - delete[] fPkMatrix; fPkMatrix = 0; - delete[] fQMatrix; fQMatrix = 0; - delete[] fQMatrixA; fQMatrixA = 0; - delete[] fSumAkFFTin; fSumAkFFTin = 0; - delete[] fSumAk; fSumAk = 0; - delete[] fBkS; fBkS = 0; - delete[] fGstorage; fGstorage = 0; + delete[] fOmegaMatrix; fOmegaMatrix = nullptr; + delete[] fBkMatrix; fBkMatrix = nullptr; + delete[] fRealSpaceMatrix; fRealSpaceMatrix = nullptr; + delete[] fPkMatrix; fPkMatrix = nullptr; + delete[] fQMatrix; fQMatrix = nullptr; + delete[] fQMatrixA; fQMatrixA = nullptr; + delete[] fSumAkFFTin; fSumAkFFTin = nullptr; + delete[] fSumAk; fSumAk = nullptr; + delete[] fBkS; fBkS = nullptr; + delete[] fGstorage; fGstorage = nullptr; - delete[] fCheckAkConvergence; fCheckAkConvergence = 0; - delete[] fCheckBkConvergence; fCheckBkConvergence = 0; + delete[] fCheckAkConvergence; fCheckAkConvergence = nullptr; + delete[] fCheckBkConvergence; fCheckBkConvergence = nullptr; } void TFilmTriVortexNGLFieldCalc::CalculateGatVortexCore() const { @@ -2612,11 +2611,11 @@ void TFilmTriVortexNGLFieldCalc::CalculateSumAk() const { void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { // SetParameters - method has to be called from the user before the calculation!! if (fParam.size() < 4) { - cout << endl << "The SetParameters-method has to be called before B(x,y,z) can be calculated!" << endl; + std::cout << std::endl << "The SetParameters-method has to be called before B(x,y,z) can be calculated!" << std::endl; return; } if (!fParam[0] || !fParam[1] || !fParam[2] || !fParam[3]) { - cout << endl << "The field, penetration depth, coherence length and layer thickness have to have finite values in order to calculate B(x,y,z)!" << endl; + std::cout << std::endl << "The field, penetration depth, coherence length and layer thickness have to have finite values in order to calculate B(x,y,z)!" << std::endl; return; } @@ -2785,7 +2784,7 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { // CalculateGatVortexCore(); // for (k = 0; k < NFFTz; ++k) { -// cout << "g[" << k << "] = " << fGstorage[k] << endl; +// std::cout << "g[" << k << "] = " << fGstorage[k] << std::endl; // } #ifdef HAVE_GOMP @@ -2800,7 +2799,7 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { (fOmegaDiffMatrix[0][l]*fOmegaDiffMatrix[0][l] + fOmegaDiffMatrix[1][l]*fOmegaDiffMatrix[1][l] + \ fOmegaDiffMatrix[2][l]*fOmegaDiffMatrix[2][l])/(fourKappaSq*fOmegaMatrix[l]); } else { -// cout << "index where omega is zero: " << l << endl; +// std::cout << "index where omega is zero: " << l << std::endl; fRealSpaceMatrix[l][0] = 0.0; } fRealSpaceMatrix[l][1] = 0.0; @@ -2862,7 +2861,7 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { (fOmegaDiffMatrix[0][index]*fOmegaDiffMatrix[0][index] + fOmegaDiffMatrix[1][index]*fOmegaDiffMatrix[1][index] + \ fOmegaDiffMatrix[2][index]*fOmegaDiffMatrix[2][index])/(fourKappaSq*fOmegaMatrix[index]); } else { -// cout << "! fOmegaMatrix at index " << index << endl; +// std::cout << "! fOmegaMatrix at index " << index << std::endl; // fSumSum -= fGstorage[k]; index = k + fStepsZ*(j + fSteps*(i + 1)); if (i < NFFT - 1 && fOmegaMatrix[index]) { @@ -2898,9 +2897,9 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { if (fFFTin[index][0]) { if (((fabs(fFFTin[index][0]) > 1.0E-5f) && (fabs(fCheckAkConvergence[index] - fFFTin[index][0])/fFFTin[index][0] > 5.0E-3f)) \ || ((fabs(fFFTin[index][0]) > 1.0E-10f) && (fCheckAkConvergence[index]/fFFTin[index][0] < 0.0))) { - //cout << "old: " << fCheckAkConvergence[index] << ", new: " << fFFTin[index][0] << endl; + //std::cout << "old: " << fCheckAkConvergence[index] << ", new: " << fFFTin[index][0] << std::endl; akConverged = false; - //cout << "count = " << count << ", Ak index = " << index << endl; + //std::cout << "count = " << count << ", Ak index = " << index << std::endl; break; } } @@ -2926,17 +2925,17 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { } } - // cout << "Ak Convergence: " << akConverged << endl; + // std::cout << "Ak Convergence: " << akConverged << std::endl; // Calculate omega again either for the bK-iteration step or again the aK-iteration CalculateSumAk(); -// cout << "fSumAk = "; +// std::cout << "fSumAk = "; // for (k = 0; k < NFFTz; ++k){ -// cout << fSumAk[k][0] << ", "; +// std::cout << fSumAk[k][0] << ", "; // } -// cout << endl; +// std::cout << endl; meanAk = 0.0f; for (k = 0; k < NFFTz; ++k) { @@ -2995,7 +2994,7 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { fBkS[index][1] = 0.f; } - // cout << "fC = " << fC << ", meanAk = " << meanAk << endl; + // std::cout << "fC = " << fC << ", meanAk = " << meanAk << endl; fSumSum = fC*meanAk; @@ -3027,9 +3026,9 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { if (((fabs(fBkMatrix[index][0]) > 1.0E-5f) && \ (fabs(fCheckBkConvergence[index] - fBkMatrix[index][0])/fBkMatrix[index][0] > 5.0E-3f)) \ || ((fabs(fBkMatrix[index][0]) > 1.0E-10f) && (fCheckBkConvergence[index]/fBkMatrix[index][0] < 0.0))) { - //cout << "old: " << fCheckBkConvergence[index] << ", new: " << fBkMatrix[index][0] << endl; + //std::cout << "old: " << fCheckBkConvergence[index] << ", new: " << fBkMatrix[index][0] << std::endl; bkConverged = false; - //cout << "count = " << count << ", Bk index = " << index << endl; + //std::cout << "count = " << count << ", Bk index = " << index << std::endl; break; } } @@ -3038,7 +3037,7 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { break; } - // cout << "Bk Convergence: " << bkConverged << endl; + // std::cout << "Bk Convergence: " << bkConverged << std::endl; if (!bkConverged) { #ifdef HAVE_GOMP @@ -3069,7 +3068,7 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { } if (count == 50) { - cout << "3D iterations aborted after " << count << " steps" << endl; + std::cout << "3D iterations aborted after " << count << " steps" << std::endl; break; } @@ -3080,14 +3079,14 @@ void TFilmTriVortexNGLFieldCalc::CalculateGrid() const { if (bkConverged && akConverged) { if (!fFind3dSolution) { - //cout << "count = " << count << " 2D converged" << endl; - //cout << "2D iterations converged after " << count << " steps" << endl; + //std::cout << "count = " << count << " 2D converged" << std::endl; + //std::cout << "2D iterations converged after " << count << " steps" << std::endl; //break; akConverged = false; bkConverged = false; fFind3dSolution = true; } else { - cout << "3D iterations converged after " << count << " steps" << endl; + std::cout << "3D iterations converged after " << count << " steps" << std::endl; break; } } diff --git a/src/external/libFitPofB/classes/TLondon1D.cpp b/src/external/libFitPofB/classes/TLondon1D.cpp index e569e318..b0dc0b12 100644 --- a/src/external/libFitPofB/classes/TLondon1D.cpp +++ b/src/external/libFitPofB/classes/TLondon1D.cpp @@ -32,7 +32,6 @@ #include #include #include -using namespace std; #include #include "BMWStartupHandler.h" @@ -256,7 +255,7 @@ double TLondon1DHS::operator()(double t, const vector &par) const { if(!only_phase_changed) { -// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; +// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; for (unsigned int i(2); i &par) const { fPofT->DoFFT(); }/* else { - cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; + std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; }*/ fPofT->CalcPol(fParForPofT); @@ -416,7 +415,7 @@ double TLondon1D1L::operator()(double t, const vector &par) const { if(!only_phase_changed) { -// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; +// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; for (unsigned int i(2); i &par) const { for(unsigned int i(6); i<8; i++) weights.push_back(par[i]); -// cout << "Weighting has changed, re-calculating n(z) now..." << endl; +// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; fImpProfile->WeightLayers(par[1], interfaces, weights); interfaces.clear(); @@ -456,7 +455,7 @@ double TLondon1D1L::operator()(double t, const vector &par) const { fPofT->DoFFT(); }/* else { - cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; + std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; }*/ fPofT->CalcPol(fParForPofT); @@ -466,11 +465,11 @@ double TLondon1D1L::operator()(double t, const vector &par) const { // // Debugging start // if (!(fCallCounter%10000)){ -// cout << fCallCounter-1 << "\t"; +// std::cout << fCallCounter-1 << "\t"; // for (unsigned int i(0); i &par) const { if(!only_phase_changed) { -// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; +// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; for (unsigned int i(2); i &par) const { for(unsigned int i(8); i<11; i++) weights.push_back(par[i]); -// cout << "Weighting has changed, re-calculating n(z) now..." << endl; +// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; fImpProfile->WeightLayers(par[1], interfaces, weights); interfaces.clear(); @@ -638,7 +637,7 @@ double TLondon1D2L::operator()(double t, const vector &par) const { }/* else { - cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; + std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; }*/ fPofT->CalcPol(fParForPofT); @@ -766,7 +765,7 @@ double TProximity1D1LHS::operator()(double t, const vector &par) const { if(!only_phase_changed) { -// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; +// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; for (unsigned int i(2); i &par) const { }/* else { - cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; + std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; }*/ fPofT->CalcPol(fParForPofT); @@ -920,7 +919,7 @@ double TLondon1D3L::operator()(double t, const vector &par) const { if(!only_phase_changed) { -// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; +// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; for (unsigned int i(2); i &par) const { for(unsigned int i(10); i<14; i++) weights.push_back(par[i]); -// cout << "Weighting has changed, re-calculating n(z) now..." << endl; +// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; fImpProfile->WeightLayers(par[1], interfaces, weights); interfaces.clear(); @@ -961,7 +960,7 @@ double TLondon1D3L::operator()(double t, const vector &par) const { fPofT->DoFFT(); }/* else { - cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; + std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; }*/ fPofT->CalcPol(fParForPofT); @@ -1092,7 +1091,7 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { if(!only_phase_changed) { -// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; +// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; for (unsigned int i(2); i &par) const { for(unsigned int i(9); i<13; i++) weights.push_back(par[i]); -// cout << "Weighting has changed, re-calculating n(z) now..." << endl; +// std::cout << "Weighting has changed, re-calculating n(z) now..." << std::endl; fImpProfile->WeightLayers(par[1], interfaces, weights); interfaces.clear(); @@ -1133,7 +1132,7 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { fPofT->DoFFT(); }/* else { - cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; + std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; }*/ fPofT->CalcPol(fParForPofT); @@ -1163,7 +1162,7 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { // int status = parseXmlFile(saxParser, startup_path_name.c_str()); // // check for parse errors // if (status) { // error -// cout << endl << "**WARNING** Reading/parsing " << startup_path_name << " failed." << endl; +// std::cout << endl << "**WARNING** Reading/parsing " << startup_path_name << " failed." << std::endl; // } // // fNSteps = startupHandler->GetNSteps(); @@ -1213,12 +1212,12 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { // fPar = par; // // /* for (unsigned int i(0); i &par) const { // // /* DEBUG --------------------------- // for(unsigned int i(0); iWeightLayers(par[1], interfaces, weights); // } // @@ -1293,7 +1292,7 @@ double TLondon1D3LS::operator()(double t, const vector &par) const { // fPofT->DoFFT(PofB4); // // }/* else { -// cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; +// std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; // }*/ // // fPofT->CalcPol(fParForPofT); diff --git a/src/external/libFitPofB/classes/TPofBCalc.cpp b/src/external/libFitPofB/classes/TPofBCalc.cpp index c36589e4..8ac08893 100644 --- a/src/external/libFitPofB/classes/TPofBCalc.cpp +++ b/src/external/libFitPofB/classes/TPofBCalc.cpp @@ -46,7 +46,7 @@ #include /-------------------------------------------------------*/ -TPofBCalc::TPofBCalc(const vector ¶) : fBmin(0.0), fBmax(0.0), fDT(para[0]), fDB(para[1]), fPBExists(false) { +TPofBCalc::TPofBCalc(const std::vector ¶) : fBmin(0.0), fBmax(0.0), fDT(para[0]), fDB(para[1]), fPBExists(false) { fPBSize = static_cast(1.0/(gBar*fDT*fDB)); if (fPBSize % 2) { fPBSize += 1; @@ -74,7 +74,7 @@ TPofBCalc::TPofBCalc(const vector ¶) : fBmin(0.0), fBmax(0.0), fDT(p // Do not actually calculate P(B) but take it from a B and a P(B) vector of the same size -TPofBCalc::TPofBCalc(const vector& b, const vector& pb, double dt) { +TPofBCalc::TPofBCalc(const std::vector& b, const std::vector& pb, double dt) { assert(b.size() == pb.size() && b.size() >= 2); fPBSize = pb.size(); @@ -94,7 +94,7 @@ TPofBCalc::TPofBCalc(const vector& b, const vector& pb, double d fPB[i] = pb[i]; } - vector::const_iterator iter, iterB; + std::vector::const_iterator iter, iterB; iterB = b.begin(); for(iter = pb.begin(); iter != pb.end(); ++iter){ @@ -165,7 +165,7 @@ void TPofBCalc::Normalize(unsigned int minFilledIndex = 0, unsigned int maxFille // Do not actually calculate P(B) but take it from a B and a P(B) vector of the same size -void TPofBCalc::SetPB(const vector &pb) const { +void TPofBCalc::SetPB(const std::vector &pb) const { assert(fPBSize == pb.size()); int i; @@ -183,7 +183,7 @@ void TPofBCalc::SetPB(const vector &pb) const { return; } -void TPofBCalc::Calculate(const string &type, const vector ¶) { +void TPofBCalc::Calculate(const std::string &type, const std::vector ¶) { if (type == "skg"){ // skewed Gaussian @@ -235,7 +235,7 @@ void TPofBCalc::Calculate(const string &type, const vector ¶) { // Parameters: dt[us], dB[G], Energy[keV], Bbg[G], width[us^{-1}], weight[1] //----------- -void TPofBCalc::Calculate(const TBofZCalcInverse *BofZ, const TTrimSPData *dataTrimSP, const vector ¶) { +void TPofBCalc::Calculate(const TBofZCalcInverse *BofZ, const TTrimSPData *dataTrimSP, const std::vector ¶) { if(fPBExists) return; @@ -261,7 +261,7 @@ void TPofBCalc::Calculate(const TBofZCalcInverse *BofZ, const TTrimSPData *dataT for (i = firstZerosEnd; i <= lastZerosStart; ++i) { - vector< pair > inv; + std::vector< std::pair > inv; inv = BofZ->GetInverseAndDerivative(fB[i]); for (unsigned int j(0); j < inv.size(); ++j) { @@ -285,7 +285,7 @@ void TPofBCalc::Calculate(const TBofZCalcInverse *BofZ, const TTrimSPData *dataT // Parameters: dt[us], dB[G], Energy[keV] //----------- -void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP, const vector ¶, unsigned int zonk) { +void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP, const std::vector ¶, unsigned int zonk) { if(fPBExists) return; @@ -306,8 +306,8 @@ void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP, // calculate p(B) from B(z) - vector *bofzZ = BofZ->DataZ(); - vector *bofzBZ = BofZ->DataBZ(); + std::vector *bofzZ = BofZ->DataZ(); + std::vector *bofzBZ = BofZ->DataBZ(); double ddZ(BofZ->GetDZ()); /* USED FOR DEBUGGING----------------------------------- @@ -439,7 +439,7 @@ void TPofBCalc::Calculate(const TBofZCalc *BofZ, const TTrimSPData *dataTrimSP, // Parameters: dt[us], dB[G] [, Bbg[G], width[us^{-1}], weight[1] ] //----------- -void TPofBCalc::Calculate(const TBulkVortexFieldCalc *vortexLattice, const vector ¶) { +void TPofBCalc::Calculate(const TBulkVortexFieldCalc *vortexLattice, const std::vector ¶) { if(fPBExists) return; @@ -569,7 +569,7 @@ void TPofBCalc::Calculate(const TBulkVortexFieldCalc *vortexLattice, const vecto if (chunk < 10) chunk = 10; - vector< vector > pBvec(n, vector(fPBSize, 0)); + std::vector< std::vector > pBvec(n, std::vector(fPBSize, 0)); int indexStep(static_cast(floor(static_cast(numberOfSteps_2)/static_cast(n)))); diff --git a/src/external/libFitPofB/classes/TPofTCalc.cpp b/src/external/libFitPofB/classes/TPofTCalc.cpp index 775e9863..5e292e76 100644 --- a/src/external/libFitPofB/classes/TPofTCalc.cpp +++ b/src/external/libFitPofB/classes/TPofTCalc.cpp @@ -66,12 +66,12 @@ // Parameters: phase, dt, dB //------------------ -TPofTCalc::TPofTCalc (const TPofBCalc *PofB, const string &wisdom, const vector &par) : fWisdom(wisdom) { +TPofTCalc::TPofTCalc (const TPofBCalc *PofB, const std::string &wisdom, const std::vector &par) : fWisdom(wisdom) { #if !defined(_WIN32GCC) && defined(HAVE_LIBFFTW3_THREADS) && defined(HAVE_GOMP) int init_threads(fftw_init_threads()); if (!init_threads) - cout << "TPofTCalc::TPofTCalc: Couldn't initialize multiple FFTW-threads ..." << endl; + std::cout << "TPofTCalc::TPofTCalc: Couldn't initialize multiple FFTW-threads ..." << std::endl; else fftw_plan_with_nthreads(omp_get_num_procs()); #endif @@ -144,7 +144,7 @@ TPofTCalc::~TPofTCalc() { FILE *wordsOfWisdomW; wordsOfWisdomW = fopen(fWisdom.c_str(), "w"); if (wordsOfWisdomW == NULL) { - cout << "TPofTCalc::~TPofTCalc(): Could not open file ... No wisdom is exported..." << endl; + std::cout << "TPofTCalc::~TPofTCalc(): Could not open file ... No wisdom is exported..." << std::endl; } else { fftw_export_wisdom_to_file(wordsOfWisdomW); fclose(wordsOfWisdomW); @@ -180,7 +180,7 @@ void TPofTCalc::DoFFT() { // Parameters: phase, dt, dB //--------------------- -void TPofTCalc::CalcPol(const vector &par) { +void TPofTCalc::CalcPol(const std::vector &par) { double sinph(sin(par[0]*PI/180.0)), cosph(cos(par[0]*PI/180.0)); int i; @@ -206,7 +206,7 @@ double TPofTCalc::Eval(double t) const { if (i < fNFFT/2){ return fPT[i]+(fPT[i+1]-fPT[i])/(fT[i+1]-fT[i])*(t-fT[i]); } - cout << "TPofTCalc::Eval: No data for the time " << t << " us available! Returning -999.0 ..." << endl; + std::cout << "TPofTCalc::Eval: No data for the time " << t << " us available! Returning -999.0 ..." << std::endl; return -999.0; } @@ -217,7 +217,7 @@ double TPofTCalc::Eval(double t) const { // Parameters: output filename, par(dt, dB, timeres, channels, asyms, phases, t0s, N0s, bgs) optPar(field, energy) //--------------------- -void TPofTCalc::FakeData(const string &rootOutputFileName, const vector &par, const vector *optPar = 0) { +void TPofTCalc::FakeData(const string &rootOutputFileName, const std::vector &par, const std::vector *optPar = 0) { //determine the number of histograms to be built unsigned int numHist(0); @@ -225,18 +225,18 @@ void TPofTCalc::FakeData(const string &rootOutputFileName, const vector numHist=(par.size()-4)/5; if(!numHist){ - cout << "TPofTCalc::FakeData: The number of parameters for the histogram creation is not correct. Do nothing." << endl; + std::cout << "TPofTCalc::FakeData: The number of parameters for the histogram creation is not correct. Do nothing." << std::endl; return; } - cout << "TPofTCalc::FakeData: " << numHist << " histograms to be built" << endl; + std::cout << "TPofTCalc::FakeData: " << numHist << " histograms to be built" << std::endl; int nChannels = int(par[3]); - vector t0; - vector asy0; - vector phase0; - vector N0; - vector bg; + std::vector t0; + std::vector asy0; + std::vector phase0; + std::vector N0; + std::vector bg; for(unsigned int i(0); i bg.push_back(par[i+4+numHist*4]); } - vector param; // Parameters for TPofTCalc::CalcPol + std::vector param; // Parameters for TPofTCalc::CalcPol param.push_back(0.0); // phase param.push_back(par[0]); // dt param.push_back(par[1]); // dB - vector< vector > asy; - vector asydata(nChannels); + std::vector< std::vector > asy; + std::vector asydata(nChannels); double ttime; int j,k; @@ -286,12 +286,12 @@ void TPofTCalc::FakeData(const string &rootOutputFileName, const vector // } asy.push_back(asydata); // asydata.clear(); - cout << "TPofTCalc::FakeData: " << i+1 << "/" << numHist << " calculated!" << endl; + std::cout << "TPofTCalc::FakeData: " << i+1 << "/" << numHist << " calculated!" << std::endl; } // calculate the histograms - vector< vector > histo; - vector data(nChannels); + std::vector< std::vector > histo; + std::vector data(nChannels); for (unsigned int i(0); i // end omp histo.push_back(data); - cout << "TPofTCalc::FakeData: " << i+1 << "/" << numHist << " done ..." << endl; + std::cout << "TPofTCalc::FakeData: " << i+1 << "/" << numHist << " done ..." << std::endl; } // add Poisson noise to the histograms - cout << "TPofTCalc::FakeData: Adding Poisson noise ..." << endl; + std::cout << "TPofTCalc::FakeData: Adding Poisson noise ..." << std::endl; TH1F* theoHisto; TH1F* fakeHisto; - vector histoData; + std::vector histoData; TString name; for (unsigned int i(0); i } } - cout << "TPofTCalc::FakeData: Write histograms and header information to the file ..." << endl; + std::cout << "TPofTCalc::FakeData: Write histograms and header information to the file ..." << std::endl; // save the histograms as root files // create run info folder and content @@ -385,7 +385,7 @@ void TPofTCalc::FakeData(const string &rootOutputFileName, const vector for (unsigned int i(0); iAdd(histoData[i]); // post pileup corrected (PPC) - vector histoDataPPC; + std::vector histoDataPPC; for (unsigned int i(0); i(histoData[i]->Clone())); if (i < 10) @@ -434,7 +434,7 @@ void TPofTCalc::FakeData(const string &rootOutputFileName, const vector N0.clear(); bg.clear(); - cout << "TPofTCalc::FakeData: DONE." << endl << endl; + std::cout << "TPofTCalc::FakeData: DONE." << std::endl << std::endl; return; } diff --git a/src/external/libFitPofB/classes/TSkewedGss.cpp b/src/external/libFitPofB/classes/TSkewedGss.cpp index 39d2c2da..bd1ce59e 100644 --- a/src/external/libFitPofB/classes/TSkewedGss.cpp +++ b/src/external/libFitPofB/classes/TSkewedGss.cpp @@ -29,7 +29,6 @@ #include "TSkewedGss.h" #include #include -using namespace std; #include #include "BMWStartupHandler.h" @@ -57,7 +56,7 @@ TSkewedGss::~TSkewedGss() { TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -104,7 +103,7 @@ TSkewedGss::TSkewedGss() : fCalcNeeded(true), fFirstCall(true) { // Parameters: all the parameters for the function to be fitted through TSkewedGss (phase,freq0,sigma-,sigma+) //------------------ -double TSkewedGss::operator()(double t, const vector &par) const { +double TSkewedGss::operator()(double t, const std::vector &par) const { assert(par.size() == 4); @@ -146,7 +145,7 @@ double TSkewedGss::operator()(double t, const vector &par) const { if(!only_phase_changed) { -// cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << endl; +// std::cout << " Parameters have changed, (re-)calculating p(B) and P(t) now..." << std::endl; fParForPofB[2] = par[1]; // nu0 fParForPofB[3] = par[2]; // sigma- @@ -156,7 +155,7 @@ double TSkewedGss::operator()(double t, const vector &par) const { fPofT->DoFFT(); }/* else { - cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << endl; + std::cout << "Only the phase parameter has changed, (re-)calculating P(t) now..." << std::endl; }*/ fPofT->CalcPol(fParForPofT); diff --git a/src/external/libFitPofB/classes/TVortex.cpp b/src/external/libFitPofB/classes/TVortex.cpp index a1eef5ad..1341586c 100644 --- a/src/external/libFitPofB/classes/TVortex.cpp +++ b/src/external/libFitPofB/classes/TVortex.cpp @@ -30,7 +30,6 @@ #include #include #include -using namespace std; #include #include "BMWStartupHandler.h" @@ -158,7 +157,7 @@ TBulkTriVortexNGL::~TBulkTriVortexNGL() { TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -218,7 +217,7 @@ TBulkTriVortexLondon::TBulkTriVortexLondon() : fCalcNeeded(true), fFirstCall(tru TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -274,7 +273,7 @@ TBulkSqVortexLondon::TBulkSqVortexLondon() : fCalcNeeded(true), fFirstCall(true) // Parameters: all the parameters for the function to be fitted through TBulkTriVortexLondon (phase, av.field, lambda, xi, [not implemented: bkg weight]) //------------------ -double TBulkTriVortexLondon::operator()(double t, const vector &par) const { +double TBulkTriVortexLondon::operator()(double t, const std::vector &par) const { assert(par.size() == 4 || par.size() == 5 || par.size() == 7 || par.size() == 8); // normal, +BkgWeight, +VortexWeighting, +AFfield @@ -365,7 +364,7 @@ double TBulkTriVortexLondon::operator()(double t, const vector &par) con // Parameters: all the parameters for the function to be fitted through TBulkSqVortexLondon (phase, av.field, lambda, xi, [not implemented: bkg weight]) //------------------ -double TBulkSqVortexLondon::operator()(double t, const vector &par) const { +double TBulkSqVortexLondon::operator()(double t, const std::vector &par) const { assert(par.size() == 4 || par.size() == 5); @@ -448,7 +447,7 @@ double TBulkSqVortexLondon::operator()(double t, const vector &par) cons TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -504,7 +503,7 @@ TBulkTriVortexML::TBulkTriVortexML() : fCalcNeeded(true), fFirstCall(true) { // Parameters: all the parameters for the function to be fitted through TBulkTriVortexML (phase, av.field, lambda, xi, [not implemented: bkg weight]) //------------------ -double TBulkTriVortexML::operator()(double t, const vector &par) const { +double TBulkTriVortexML::operator()(double t, const std::vector &par) const { assert(par.size() == 4 || par.size() == 5); @@ -587,7 +586,7 @@ double TBulkTriVortexML::operator()(double t, const vector &par) const { TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -643,7 +642,7 @@ TBulkTriVortexAGL::TBulkTriVortexAGL() : fCalcNeeded(true), fFirstCall(true) { // Parameters: all the parameters for the function to be fitted through TBulkTriVortexAGL (phase, av.field, lambda, xi, [not implemented: bkg weight]) //------------------ -double TBulkTriVortexAGL::operator()(double t, const vector &par) const { +double TBulkTriVortexAGL::operator()(double t, const std::vector &par) const { assert(par.size() == 4 || par.size() == 5); @@ -725,7 +724,7 @@ double TBulkTriVortexAGL::operator()(double t, const vector &par) const TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -783,7 +782,7 @@ TBulkTriVortexAGLII::TBulkTriVortexAGLII() : fCalcNeeded(true), fFirstCall(true) // Parameters: all the parameters for the function to be fitted through TBulkTriVortexAGLII (phase, av.field, lambda, core-radius, [not implemented: bkg weight]) //------------------ -double TBulkTriVortexAGLII::operator()(double t, const vector &par) const { +double TBulkTriVortexAGLII::operator()(double t, const std::vector &par) const { assert(par.size() == 4 || par.size() == 5 || par.size() == 7 || par.size() == 8); @@ -876,7 +875,7 @@ double TBulkTriVortexAGLII::operator()(double t, const vector &par) cons TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -932,7 +931,7 @@ TBulkTriVortexNGL::TBulkTriVortexNGL() : fCalcNeeded(true), fFirstCall(true) { // Parameters: all the parameters for the function to be fitted through TBulkTriVortexNGL (phase, appl.field, lambda, xi, [not implemented: bkg weight]) //------------------ -double TBulkTriVortexNGL::operator()(double t, const vector &par) const { +double TBulkTriVortexNGL::operator()(double t, const std::vector &par) const { assert(par.size() == 4 || par.size() == 5); @@ -1031,7 +1030,7 @@ TBulkAnisotropicTriVortexLondonGlobal::~TBulkAnisotropicTriVortexLondonGlobal() TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -1081,7 +1080,7 @@ TBulkAnisotropicTriVortexLondonGlobal::TBulkAnisotropicTriVortexLondonGlobal() : } } -void TBulkAnisotropicTriVortexLondonGlobal::Calc(const vector &par) const { +void TBulkAnisotropicTriVortexLondonGlobal::Calc(const std::vector &par) const { assert(par.size() == 6); /* @@ -1191,7 +1190,7 @@ TBulkAnisotropicTriVortexLondon::~TBulkAnisotropicTriVortexLondon() * \param globalPart reference to the global user function object vector * \param idx global user function index within the theory tree */ -void TBulkAnisotropicTriVortexLondon::SetGlobalPart(vector &globalPart, UInt_t idx) +void TBulkAnisotropicTriVortexLondon::SetGlobalPart(std::vector &globalPart, UInt_t idx) { fIdxGlobal = static_cast(idx); @@ -1273,7 +1272,7 @@ TBulkAnisotropicTriVortexMLGlobal::~TBulkAnisotropicTriVortexMLGlobal() { TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -1323,7 +1322,7 @@ TBulkAnisotropicTriVortexMLGlobal::TBulkAnisotropicTriVortexMLGlobal() : fCalcNe } } -void TBulkAnisotropicTriVortexMLGlobal::Calc(const vector &par) const { +void TBulkAnisotropicTriVortexMLGlobal::Calc(const std::vector &par) const { assert(par.size() == 6); /* @@ -1433,7 +1432,7 @@ TBulkAnisotropicTriVortexML::~TBulkAnisotropicTriVortexML() * \param globalPart reference to the global user function object vector * \param idx global user function index within the theory tree */ -void TBulkAnisotropicTriVortexML::SetGlobalPart(vector &globalPart, UInt_t idx) +void TBulkAnisotropicTriVortexML::SetGlobalPart(std::vector &globalPart, UInt_t idx) { fIdxGlobal = static_cast(idx); @@ -1515,7 +1514,7 @@ TBulkAnisotropicTriVortexAGLGlobal::~TBulkAnisotropicTriVortexAGLGlobal() { TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalcNeeded(true), fFirstCall(true) { // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -1565,7 +1564,7 @@ TBulkAnisotropicTriVortexAGLGlobal::TBulkAnisotropicTriVortexAGLGlobal() : fCalc } } -void TBulkAnisotropicTriVortexAGLGlobal::Calc(const vector &par) const { +void TBulkAnisotropicTriVortexAGLGlobal::Calc(const std::vector &par) const { assert(par.size() == 6); /* @@ -1676,7 +1675,7 @@ TBulkAnisotropicTriVortexAGL::~TBulkAnisotropicTriVortexAGL() * \param globalPart reference to the global user function object vector * \param idx global user function index within the theory tree */ -void TBulkAnisotropicTriVortexAGL::SetGlobalPart(vector &globalPart, UInt_t idx) +void TBulkAnisotropicTriVortexAGL::SetGlobalPart(std::vector &globalPart, UInt_t idx) { fIdxGlobal = static_cast(idx); diff --git a/src/external/libFitPofB/include/TBofZCalc.h b/src/external/libFitPofB/include/TBofZCalc.h index 77e00c45..a336ce1e 100644 --- a/src/external/libFitPofB/include/TBofZCalc.h +++ b/src/external/libFitPofB/include/TBofZCalc.h @@ -30,7 +30,6 @@ #define _TBofZCalc_H_ #include -using namespace std; /** *

Base class for any kind of theory function B(z) @@ -47,8 +46,8 @@ public: fParam.clear(); } - virtual vector* DataZ() const {return &fZ;} - virtual vector* DataBZ() const {return &fBZ;} + virtual std::vector* DataZ() const {return &fZ;} + virtual std::vector* DataBZ() const {return &fBZ;} virtual void Calculate(); virtual double GetBofZ(double) const = 0; virtual double GetBmin() const = 0; @@ -58,9 +57,9 @@ public: protected: int fSteps; ///< number of discrete points where B(z) is calculated double fDZ; ///< resolution in z (spacing between two neighboring discrete B(z) points) - vector fParam; ///< parameters of the B(z) function - mutable vector fZ; ///< vector holding all z-values - mutable vector fBZ; ///< vector holding all B(z)-values + std::vector fParam; ///< parameters of the B(z) function + mutable std::vector fZ; ///< vector holding all z-values + mutable std::vector fBZ; ///< vector holding all B(z)-values }; /** @@ -73,7 +72,7 @@ public: TBofZCalcInverse() {} virtual ~TBofZCalcInverse() {} - virtual vector< pair > GetInverseAndDerivative(double) const = 0; + virtual std::vector< std::pair > GetInverseAndDerivative(double) const = 0; }; /** @@ -83,11 +82,11 @@ class TLondon1D_HS : public TBofZCalcInverse { public: - TLondon1D_HS(const vector&, unsigned int steps = 3000); + TLondon1D_HS(const std::vector&, unsigned int steps = 3000); double GetBofZ(double) const; double GetBmin() const; double GetBmax() const; - vector< pair > GetInverseAndDerivative(double) const; + std::vector< std::pair > GetInverseAndDerivative(double) const; }; @@ -98,11 +97,11 @@ class TLondon1D_1L : public TBofZCalcInverse { public: - TLondon1D_1L(const vector&, unsigned int steps = 3000); + TLondon1D_1L(const std::vector&, unsigned int steps = 3000); double GetBofZ(double) const; double GetBmin() const; double GetBmax() const; - vector< pair > GetInverseAndDerivative(double) const; + std::vector< std::pair > GetInverseAndDerivative(double) const; private: void SetBmin(); @@ -121,11 +120,11 @@ class TLondon1D_2L : public TBofZCalcInverse { public: - TLondon1D_2L(const vector&, unsigned int steps = 3000); + TLondon1D_2L(const std::vector&, unsigned int steps = 3000); double GetBofZ(double) const; double GetBmin() const; double GetBmax() const; - vector< pair > GetInverseAndDerivative(double) const; + std::vector< std::pair > GetInverseAndDerivative(double) const; private: void SetBmin(); @@ -145,11 +144,11 @@ class TProximity1D_1LHS : public TBofZCalcInverse { public: - TProximity1D_1LHS(const vector&, unsigned int steps = 3000); + TProximity1D_1LHS(const std::vector&, unsigned int steps = 3000); double GetBofZ(double) const; double GetBmin() const; double GetBmax() const; - vector< pair > GetInverseAndDerivative(double) const; + std::vector< std::pair > GetInverseAndDerivative(double) const; private: void SetBmin(); @@ -168,11 +167,11 @@ class TLondon1D_3L : public TBofZCalcInverse { public: - TLondon1D_3L(const vector&, unsigned int steps = 3000); + TLondon1D_3L(const std::vector&, unsigned int steps = 3000); double GetBofZ(double) const; double GetBmin() const; double GetBmax() const; - vector< pair > GetInverseAndDerivative(double) const; + std::vector< std::pair > GetInverseAndDerivative(double) const; private: void SetBmin(); @@ -192,11 +191,11 @@ class TLondon1D_3LS : public TBofZCalcInverse { public: - TLondon1D_3LS(const vector&, unsigned int steps = 3000); + TLondon1D_3LS(const std::vector&, unsigned int steps = 3000); double GetBofZ(double) const; double GetBmin() const; double GetBmax() const; - vector< pair > GetInverseAndDerivative(double) const; + std::vector< std::pair > GetInverseAndDerivative(double) const; private: void SetBmin(); @@ -216,7 +215,7 @@ class TLondon1D_3LwInsulator : public TBofZCalc { public: - TLondon1D_3LwInsulator(const vector&, unsigned int steps = 3000); + TLondon1D_3LwInsulator(const std::vector&, unsigned int steps = 3000); double GetBofZ(double) const; double GetBmin() const; double GetBmax() const; diff --git a/src/external/libFitPofB/include/TBulkTriVortexFieldCalc.h b/src/external/libFitPofB/include/TBulkTriVortexFieldCalc.h index f918a151..f3b983ef 100644 --- a/src/external/libFitPofB/include/TBulkTriVortexFieldCalc.h +++ b/src/external/libFitPofB/include/TBulkTriVortexFieldCalc.h @@ -31,7 +31,6 @@ #include #include -using namespace std; // the following ifdef is needed for GCC 4.6 or higher, fftw 3.3 or higher and root 5.30.03 or lower //#ifdef __CINT__ @@ -51,7 +50,7 @@ public: virtual ~TBulkVortexFieldCalc(); virtual double* DataB() const {return fFFTout;} - virtual void SetParameters(const vector& par) {fParam = par; fGridExists = false;} + virtual void SetParameters(const std::vector& par) {fParam = par; fGridExists = false;} virtual void CalculateGrid() const = 0; virtual double GetBmin() const; virtual double GetBmax() const; @@ -61,13 +60,13 @@ public: virtual bool IsTriangular() const = 0; protected: - vector fParam; ///< parameters used to calculate B(x,y) + std::vector fParam; ///< parameters used to calculate B(x,y) unsigned int fSteps; ///< number of steps in which the "unit cell" of the vortex lattice is devided in (in each direction) mutable fftw_complex *fFFTin; ///< Fourier components of the field mutable double *fFFTout; ///< spatial field distribution B(x,y) in a "unit cell" of the vortex lattice fftw_plan fFFTplan; ///< FFTW plan for the 2D-Fourier transform from Fourier space to real space bool fUseWisdom; ///< tag determining if FFTW wisdom is used - string fWisdom; ///< file name of the FFTW wisdom-file + std::string fWisdom; ///< file name of the FFTW wisdom-file mutable bool fGridExists; ///< tag determining if B(x,y) has been calculated for the given set of parameters }; @@ -79,7 +78,7 @@ class TBulkTriVortexLondonFieldCalc : public TBulkVortexFieldCalc { public: - TBulkTriVortexLondonFieldCalc(const string&, const unsigned int steps = 256); + TBulkTriVortexLondonFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkTriVortexLondonFieldCalc() {} void CalculateGrid() const; @@ -95,7 +94,7 @@ class TBulkAnisotropicTriVortexLondonFieldCalc : public TBulkVortexFieldCalc { public: - TBulkAnisotropicTriVortexLondonFieldCalc(const string&, const unsigned int steps = 256); + TBulkAnisotropicTriVortexLondonFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkAnisotropicTriVortexLondonFieldCalc() {} void CalculateGrid() const; @@ -111,7 +110,7 @@ class TBulkSqVortexLondonFieldCalc : public TBulkVortexFieldCalc { public: - TBulkSqVortexLondonFieldCalc(const string&, const unsigned int steps = 256); + TBulkSqVortexLondonFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkSqVortexLondonFieldCalc() {} void CalculateGrid() const; @@ -127,7 +126,7 @@ class TBulkTriVortexMLFieldCalc : public TBulkVortexFieldCalc { public: - TBulkTriVortexMLFieldCalc(const string&, const unsigned int steps = 256); + TBulkTriVortexMLFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkTriVortexMLFieldCalc() {} void CalculateGrid() const; @@ -144,7 +143,7 @@ class TBulkAnisotropicTriVortexMLFieldCalc : public TBulkVortexFieldCalc { public: - TBulkAnisotropicTriVortexMLFieldCalc(const string&, const unsigned int steps = 256); + TBulkAnisotropicTriVortexMLFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkAnisotropicTriVortexMLFieldCalc() {} void CalculateGrid() const; @@ -160,7 +159,7 @@ class TBulkTriVortexAGLFieldCalc : public TBulkVortexFieldCalc { public: - TBulkTriVortexAGLFieldCalc(const string&, const unsigned int steps = 256); + TBulkTriVortexAGLFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkTriVortexAGLFieldCalc() {} void CalculateGrid() const; @@ -176,7 +175,7 @@ class TBulkTriVortexAGLIIFieldCalc : public TBulkVortexFieldCalc { public: - TBulkTriVortexAGLIIFieldCalc(const string&, const unsigned int steps = 256); + TBulkTriVortexAGLIIFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkTriVortexAGLIIFieldCalc() {} void CalculateGrid() const; @@ -193,7 +192,7 @@ class TBulkAnisotropicTriVortexAGLFieldCalc : public TBulkVortexFieldCalc { public: - TBulkAnisotropicTriVortexAGLFieldCalc(const string&, const unsigned int steps = 256); + TBulkAnisotropicTriVortexAGLFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkAnisotropicTriVortexAGLFieldCalc() {} void CalculateGrid() const; @@ -210,7 +209,7 @@ class TBulkTriVortexNGLFieldCalc : public TBulkVortexFieldCalc { public: - TBulkTriVortexNGLFieldCalc(const string&, const unsigned int steps = 256); + TBulkTriVortexNGLFieldCalc(const std::string&, const unsigned int steps = 256); ~TBulkTriVortexNGLFieldCalc(); void CalculateGrid() const; diff --git a/src/external/libFitPofB/include/TFilmTriVortexFieldCalc.h b/src/external/libFitPofB/include/TFilmTriVortexFieldCalc.h index 8fa7da44..d5eae149 100644 --- a/src/external/libFitPofB/include/TFilmTriVortexFieldCalc.h +++ b/src/external/libFitPofB/include/TFilmTriVortexFieldCalc.h @@ -32,7 +32,6 @@ #include #include -using namespace std; // the following ifdef is needed for GCC 4.6 or higher, fftw 3.3 or higher and root 5.30.03 or lower //#ifdef __CINT__ @@ -52,8 +51,8 @@ public: virtual ~TFilmVortexFieldCalc(); - virtual vector DataB() const {return fBout;} - virtual void SetParameters(const vector& par) {fParam = par; fGridExists = false;} + virtual std::vector DataB() const {return fBout;} + virtual void SetParameters(const std::vector& par) {fParam = par; fGridExists = false;} virtual void CalculateGrid() const = 0; virtual float GetBmin() const; virtual float GetBmax() const; @@ -62,14 +61,14 @@ public: virtual unsigned int GetNumberOfSteps() const {return fSteps;} protected: - vector fParam; + std::vector fParam; unsigned int fSteps; // number of steps, the "unit cell" of the vortex lattice is devided in (in x- and y- direction) unsigned int fStepsZ; // number of layers that should be calculated in z-direction (film slices) mutable fftwf_complex *fFFTin; // Fourier components of omega - mutable vector fBout; // three pointers to Bx, By, Bz; each of these arrays is in row-major order + mutable std::vector fBout; // three pointers to Bx, By, Bz; each of these arrays is in row-major order fftwf_plan fFFTplan; bool fUseWisdom; - string fWisdom; + std::string fWisdom; mutable bool fGridExists; }; @@ -81,7 +80,7 @@ class TFilmTriVortexNGLFieldCalc : public TFilmVortexFieldCalc { public: - TFilmTriVortexNGLFieldCalc(const string&, const unsigned int steps = 256, const unsigned int stepsZ = 32); + TFilmTriVortexNGLFieldCalc(const std::string&, const unsigned int steps = 256, const unsigned int stepsZ = 32); ~TFilmTriVortexNGLFieldCalc(); void CalculateGrid() const; @@ -91,7 +90,7 @@ public: fftwf_complex* GetRealSpaceMatrix() const {return fRealSpaceMatrix;} float* GetOmegaMatrix() const {return fOmegaMatrix;} fftwf_complex* GetBkSMatrix() const {return fBkS;} - vector GetOmegaDiffMatrix() const {return fOmegaDiffMatrix;} + std::vector GetOmegaDiffMatrix() const {return fOmegaDiffMatrix;} fftwf_complex* GetQMatrix() const {return fQMatrix;} fftwf_complex* GetPMatrix() const {return fPkMatrix;} @@ -113,7 +112,7 @@ private: void CalculateGatVortexCore() const; mutable float *fOmegaMatrix; - mutable vector fOmegaDiffMatrix; + mutable std::vector fOmegaDiffMatrix; mutable fftwf_complex *fRealSpaceMatrix; mutable fftwf_complex *fBkMatrix; mutable fftwf_complex *fPkMatrix; diff --git a/src/external/libFitPofB/include/TLondon1D.h b/src/external/libFitPofB/include/TLondon1D.h index 4c38bdd5..aa4f4e8f 100644 --- a/src/external/libFitPofB/include/TLondon1D.h +++ b/src/external/libFitPofB/include/TLondon1D.h @@ -44,13 +44,13 @@ public: ~TLondon1DHS(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TTrimSPData *fImpProfile; ///< low energy muon implantation profiles TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) @@ -77,22 +77,22 @@ public: ~TLondon1D1L(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TTrimSPData *fImpProfile; ///< low energy muon implantation profiles TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - mutable vector fParForBofZ; ///< parameters for the calculation of B(z) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + mutable std::vector fParForBofZ; ///< parameters for the calculation of B(z) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fNSteps; ///< number of points for which B(z) is calculated //mutable unsigned int fCallCounter; @@ -112,22 +112,22 @@ public: ~TLondon1D2L(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TTrimSPData *fImpProfile; ///< low energy muon implantation profiles TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - mutable vector fParForBofZ; ///< parameters for the calculation of B(z) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + mutable std::vector fParForBofZ; ///< parameters for the calculation of B(z) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fNSteps; ///< number of points for which B(z) is calculated ClassDef(TLondon1D2L,1) @@ -146,22 +146,22 @@ public: ~TProximity1D1LHS(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TTrimSPData *fImpProfile; ///< low energy muon implantation profiles TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - mutable vector fParForBofZ; ///< parameters for the calculation of B(z) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + mutable std::vector fParForBofZ; ///< parameters for the calculation of B(z) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fNSteps; ///< number of points for which B(z) is calculated ClassDef(TProximity1D1LHS,1) @@ -180,22 +180,22 @@ public: ~TLondon1D3L(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TTrimSPData *fImpProfile; ///< low energy muon implantation profiles TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - mutable vector fParForBofZ; ///< parameters for the calculation of B(z) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + mutable std::vector fParForBofZ; ///< parameters for the calculation of B(z) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fNSteps; ///< number of points for which B(z) is calculated ClassDef(TLondon1D3L,1) @@ -214,22 +214,22 @@ public: ~TLondon1D3LS(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TTrimSPData *fImpProfile; ///< low energy muon implantation profiles TPofBCalc *fPofB; ///< static field distribution P(B TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - mutable vector fParForBofZ; ///< parameters for the calculation of B(z) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + mutable std::vector fParForBofZ; ///< parameters for the calculation of B(z) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fNSteps; ///< number of points for which B(z) is calculated ClassDef(TLondon1D3LS,1) diff --git a/src/external/libFitPofB/include/TPofBCalc.h b/src/external/libFitPofB/include/TPofBCalc.h index 1bbdf4ba..b9caca4c 100644 --- a/src/external/libFitPofB/include/TPofBCalc.h +++ b/src/external/libFitPofB/include/TPofBCalc.h @@ -46,25 +46,25 @@ class TPofBCalc { public: // standard constructor: allocates memory for B and PB, the arrays are filled later by one of the Calculate-methods - TPofBCalc(const vector&); + TPofBCalc(const std::vector&); // alternative constructor: PB is not actually calculated but copied from a vector - TPofBCalc(const vector&, const vector& , double dt = 0.01); + TPofBCalc(const std::vector&, const std::vector& , double dt = 0.01); ~TPofBCalc() { - delete[] fB; fB = 0; - delete[] fPB; fPB = 0; + delete[] fB; fB = nullptr; + delete[] fPB; fPB = nullptr; } - void Calculate(const string&, const vector&); - void Calculate(const TBofZCalc*, const TTrimSPData*, const vector&, unsigned int); - void Calculate(const TBofZCalcInverse*, const TTrimSPData*, const vector&); - void Calculate(const TBulkVortexFieldCalc*, const vector&); + void Calculate(const std::string&, const std::vector&); + void Calculate(const TBofZCalc*, const TTrimSPData*, const std::vector&, unsigned int); + void Calculate(const TBofZCalcInverse*, const TTrimSPData*, const std::vector&); + void Calculate(const TBulkVortexFieldCalc*, const std::vector&); const double* DataB() const {return fB;} double* DataPB() const {return fPB;} double GetBmin() const {return fBmin;} double GetBmax() const {return fBmax;} unsigned int GetPBSize() const {return fPBSize;} - void SetPB(const vector&) const; + void SetPB(const std::vector&) const; void ConvolveGss(double); void AddBackground(double, double, double); double GetFirstMoment() const; diff --git a/src/external/libFitPofB/include/TPofTCalc.h b/src/external/libFitPofB/include/TPofTCalc.h index 34769b20..ccb87631 100644 --- a/src/external/libFitPofB/include/TPofTCalc.h +++ b/src/external/libFitPofB/include/TPofTCalc.h @@ -48,14 +48,14 @@ class TPofTCalc { public: - TPofTCalc(const TPofBCalc*, const string&, const vector&); + TPofTCalc(const TPofBCalc*, const std::string&, const std::vector&); ~TPofTCalc(); const double* DataT() const {return fT;} const double* DataPT() const {return fPT;} void DoFFT(); - void CalcPol(const vector&); - void FakeData(const string&, const vector&, const vector*); + void CalcPol(const std::vector&); + void FakeData(const std::string&, const std::vector&, const std::vector*); double Eval(double) const; private: diff --git a/src/external/libFitPofB/include/TSkewedGss.h b/src/external/libFitPofB/include/TSkewedGss.h index 4023f610..1eb97e9a 100644 --- a/src/external/libFitPofB/include/TSkewedGss.h +++ b/src/external/libFitPofB/include/TSkewedGss.h @@ -44,20 +44,20 @@ public: ~TSkewedGss(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + std::string fWisdom; ///< file name of the FFTW wisdom file ClassDef(TSkewedGss,1) }; diff --git a/src/external/libFitPofB/include/TVortex.h b/src/external/libFitPofB/include/TVortex.h index c97ed883..21c79e90 100644 --- a/src/external/libFitPofB/include/TVortex.h +++ b/src/external/libFitPofB/include/TVortex.h @@ -44,22 +44,22 @@ public: ~TBulkTriVortexLondon(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TBulkTriVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated ClassDef(TBulkTriVortexLondon,1) @@ -77,22 +77,22 @@ public: ~TBulkSqVortexLondon(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TBulkSqVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated ClassDef(TBulkSqVortexLondon,1) @@ -110,22 +110,22 @@ public: ~TBulkTriVortexML(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TBulkTriVortexMLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated ClassDef(TBulkTriVortexML,1) @@ -143,22 +143,22 @@ public: ~TBulkTriVortexAGL(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TBulkTriVortexAGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated ClassDef(TBulkTriVortexAGL,1) @@ -176,22 +176,22 @@ public: ~TBulkTriVortexAGLII(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TBulkTriVortexAGLIIFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated ClassDef(TBulkTriVortexAGLII,1) @@ -209,22 +209,22 @@ public: ~TBulkTriVortexNGL(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the model + mutable std::vector fPar; ///< parameters of the model TBulkTriVortexNGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated ClassDef(TBulkTriVortexNGL,1) @@ -245,22 +245,22 @@ public: bool IsValid() { return fValid; } - void Calc(const vector&) const; + void Calc(const std::vector&) const; const TPofTCalc* GetPolarizationPointer() const { return fPofT; } private: mutable bool fValid; ///< tag indicating if the global part has been calculated - mutable vector fPar; ///< parameter vector + mutable std::vector fPar; ///< parameter vector TBulkAnisotropicTriVortexLondonFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated // definition of the class for the ROOT-dictionary @@ -280,10 +280,10 @@ public: ~TBulkAnisotropicTriVortexLondon(); virtual bool NeedGlobalPart() const { return true; } - virtual void SetGlobalPart(vector &globalPart, unsigned int idx); + virtual void SetGlobalPart(std::vector &globalPart, unsigned int idx); virtual bool GlobalPartIsValid() const; - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: bool fValid; @@ -309,22 +309,22 @@ public: bool IsValid() { return fValid; } - void Calc(const vector&) const; + void Calc(const std::vector&) const; const TPofTCalc* GetPolarizationPointer() const { return fPofT; } private: mutable bool fValid; ///< tag indicating if the global part has been calculated - mutable vector fPar; ///< parameter vector + mutable std::vector fPar; ///< parameter vector TBulkAnisotropicTriVortexMLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated // definition of the class for the ROOT-dictionary @@ -344,10 +344,10 @@ public: ~TBulkAnisotropicTriVortexML(); virtual bool NeedGlobalPart() const { return true; } - virtual void SetGlobalPart(vector &globalPart, unsigned int idx); + virtual void SetGlobalPart(std::vector &globalPart, unsigned int idx); virtual bool GlobalPartIsValid() const; - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: bool fValid; @@ -373,22 +373,22 @@ public: bool IsValid() { return fValid; } - void Calc(const vector&) const; + void Calc(const std::vector&) const; const TPofTCalc* GetPolarizationPointer() const { return fPofT; } private: mutable bool fValid; ///< tag indicating if the global part has been calculated - mutable vector fPar; ///< parameter vector + mutable std::vector fPar; ///< parameter vector TBulkAnisotropicTriVortexAGLFieldCalc *fVortex; ///< spatial field distribution B(x,y) within the vortex lattice TPofBCalc *fPofB; ///< static field distribution P(B) TPofTCalc *fPofT; ///< muon spin polarization p(t) mutable bool fCalcNeeded; ///< tag needed to avoid unnecessary calculations if the core parameters were unchanged mutable bool fFirstCall; ///< tag for checking if the function operator is called the first time - mutable vector fParForVortex; ///< parameters for the calculation of B(x,y) - mutable vector fParForPofB; ///< parameters for the calculation of P(B) - mutable vector fParForPofT; ///< parameters for the calculation of p(t) - string fWisdom; ///< file name of the FFTW wisdom file + mutable std::vector fParForVortex; ///< parameters for the calculation of B(x,y) + mutable std::vector fParForPofB; ///< parameters for the calculation of P(B) + mutable std::vector fParForPofT; ///< parameters for the calculation of p(t) + std::string fWisdom; ///< file name of the FFTW wisdom file unsigned int fGridSteps; ///< number of points in x- and y-direction for which B(x,y) is calculated // definition of the class for the ROOT-dictionary @@ -408,10 +408,10 @@ public: ~TBulkAnisotropicTriVortexAGL(); virtual bool NeedGlobalPart() const { return true; } - virtual void SetGlobalPart(vector &globalPart, unsigned int idx); + virtual void SetGlobalPart(std::vector &globalPart, unsigned int idx); virtual bool GlobalPartIsValid() const; - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: bool fValid; diff --git a/src/external/libGapIntegrals/TGapIntegrals.cpp b/src/external/libGapIntegrals/TGapIntegrals.cpp index c2736ebc..702f1589 100644 --- a/src/external/libGapIntegrals/TGapIntegrals.cpp +++ b/src/external/libGapIntegrals/TGapIntegrals.cpp @@ -29,15 +29,12 @@ #include #include -using namespace std; - #include "BMWIntegrator.h" #include "TGapIntegrals.h" #define PI 3.14159265358979323846 #define TWOPI 6.28318530717958647692 - ClassImp(TGapSWave) ClassImp(TGapDWave) ClassImp(TGapCosSqDWave) @@ -71,7 +68,7 @@ ClassImp(TFilmMagnetizationDWave) TGapSWave::TGapSWave() { TGapIntegral *gapint = new TGapIntegral(); fGapIntegral = gapint; - gapint = 0; + gapint = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -87,7 +84,7 @@ TGapSWave::TGapSWave() { TGapDWave::TGapDWave() { TDWaveGapIntegralCuhre *gapint = new TDWaveGapIntegralCuhre(); fGapIntegral = gapint; - gapint = 0; + gapint = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -103,7 +100,7 @@ TGapDWave::TGapDWave() { TGapCosSqDWave::TGapCosSqDWave() { TCosSqDWaveGapIntegralCuhre *gapint = new TCosSqDWaveGapIntegralCuhre(); fGapIntegral = gapint; - gapint = 0; + gapint = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -119,7 +116,7 @@ TGapCosSqDWave::TGapCosSqDWave() { TGapSinSqDWave::TGapSinSqDWave() { TSinSqDWaveGapIntegralCuhre *gapint = new TSinSqDWaveGapIntegralCuhre(); fGapIntegral = gapint; - gapint = 0; + gapint = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -135,7 +132,7 @@ TGapSinSqDWave::TGapSinSqDWave() { TGapAnSWave::TGapAnSWave() { TAnSWaveGapIntegralCuhre *gapint = new TAnSWaveGapIntegralCuhre(); fGapIntegral = gapint; - gapint = 0; + gapint = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -151,7 +148,7 @@ TGapAnSWave::TGapAnSWave() { TGapNonMonDWave1::TGapNonMonDWave1() { TNonMonDWave1GapIntegralCuhre *gapint = new TNonMonDWave1GapIntegralCuhre(); fGapIntegral = gapint; - gapint = 0; + gapint = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -167,7 +164,7 @@ TGapNonMonDWave1::TGapNonMonDWave1() { TGapNonMonDWave2::TGapNonMonDWave2() { TNonMonDWave2GapIntegralCuhre *gapint = new TNonMonDWave2GapIntegralCuhre(); fGapIntegral = gapint; - gapint = 0; + gapint = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -262,7 +259,7 @@ TLambdaInvNonMonDWave2::TLambdaInvNonMonDWave2() { */ TGapSWave::~TGapSWave() { delete fGapIntegral; - fGapIntegral = 0; + fGapIntegral = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -277,7 +274,7 @@ TGapSWave::~TGapSWave() { */ TGapDWave::~TGapDWave() { delete fGapIntegral; - fGapIntegral = 0; + fGapIntegral = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -292,7 +289,7 @@ TGapDWave::~TGapDWave() { */ TGapCosSqDWave::~TGapCosSqDWave() { delete fGapIntegral; - fGapIntegral = 0; + fGapIntegral = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -307,7 +304,7 @@ TGapCosSqDWave::~TGapCosSqDWave() { */ TGapSinSqDWave::~TGapSinSqDWave() { delete fGapIntegral; - fGapIntegral = 0; + fGapIntegral = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -322,7 +319,7 @@ TGapSinSqDWave::~TGapSinSqDWave() { */ TGapAnSWave::~TGapAnSWave() { delete fGapIntegral; - fGapIntegral = 0; + fGapIntegral = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -337,7 +334,7 @@ TGapAnSWave::~TGapAnSWave() { */ TGapNonMonDWave1::~TGapNonMonDWave1() { delete fGapIntegral; - fGapIntegral = 0; + fGapIntegral = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -352,7 +349,7 @@ TGapNonMonDWave1::~TGapNonMonDWave1() { */ TGapNonMonDWave2::~TGapNonMonDWave2() { delete fGapIntegral; - fGapIntegral = 0; + fGapIntegral = nullptr; fTemp.clear(); fTempIter = fTemp.end(); @@ -367,7 +364,7 @@ TGapNonMonDWave2::~TGapNonMonDWave2() { */ TLambdaSWave::~TLambdaSWave() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -376,7 +373,7 @@ TLambdaSWave::~TLambdaSWave() { */ TLambdaDWave::~TLambdaDWave() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -385,7 +382,7 @@ TLambdaDWave::~TLambdaDWave() { */ TLambdaAnSWave::~TLambdaAnSWave() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -394,7 +391,7 @@ TLambdaAnSWave::~TLambdaAnSWave() { */ TLambdaNonMonDWave1::~TLambdaNonMonDWave1() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -403,7 +400,7 @@ TLambdaNonMonDWave1::~TLambdaNonMonDWave1() { */ TLambdaNonMonDWave2::~TLambdaNonMonDWave2() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -412,7 +409,7 @@ TLambdaNonMonDWave2::~TLambdaNonMonDWave2() { */ TLambdaInvSWave::~TLambdaInvSWave() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -421,7 +418,7 @@ TLambdaInvSWave::~TLambdaInvSWave() { */ TLambdaInvDWave::~TLambdaInvDWave() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -430,7 +427,7 @@ TLambdaInvDWave::~TLambdaInvDWave() { */ TLambdaInvAnSWave::~TLambdaInvAnSWave() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -439,7 +436,7 @@ TLambdaInvAnSWave::~TLambdaInvAnSWave() { */ TLambdaInvNonMonDWave1::~TLambdaInvNonMonDWave1() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } //-------------------------------------------------------------------- @@ -448,7 +445,7 @@ TLambdaInvNonMonDWave1::~TLambdaInvNonMonDWave1() { */ TLambdaInvNonMonDWave2::~TLambdaInvNonMonDWave2() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; } @@ -457,7 +454,7 @@ TLambdaInvNonMonDWave2::~TLambdaInvNonMonDWave2() { *

prepare the needed parameters for the integration carried out in TGapIntegral. * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (9). */ -double TGapSWave::operator()(double t, const vector &par) const { +double TGapSWave::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0 (meV), [[2] c0 (1), [3] aG (1)] @@ -506,7 +503,7 @@ double TGapSWave::operator()(double t, const vector &par) const { double ds; - vector intPar; // parameters for the integral, T & Delta(T) + std::vector intPar; // parameters for the integral, T & Delta(T) intPar.push_back(0.172346648*t); // 2 kB T, kB in meV/K = 0.086173324 meV/K if (par.size() == 2) { // Carrington/Manzano intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51))); @@ -536,7 +533,7 @@ double TGapSWave::operator()(double t, const vector &par) const { *

prepare the needed parameters for the integration carried out in TDWaveGapIntegralCuhre. * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (10). */ -double TGapDWave::operator()(double t, const vector &par) const { +double TGapDWave::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0 (meV), [[2] c0 (1), [3] aG (1)] @@ -584,7 +581,7 @@ double TGapDWave::operator()(double t, const vector &par) const { if (fCalcNeeded[vectorIndex]) { double ds; - vector intPar; // parameters for the integral, T & Delta(T) + std::vector intPar; // parameters for the integral, T & Delta(T) intPar.push_back(0.172346648*t); // 2 kB T, kB in meV/K = 0.086173324 meV/K if (par.size() == 2) { // Carrington/Manzano intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51))); @@ -620,7 +617,7 @@ double TGapDWave::operator()(double t, const vector &par) const { *

prepare the needed parameters for the integration carried out in TCosSqDWaveGapIntegralCuhre. * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (??). */ -double TGapCosSqDWave::operator()(double t, const vector &par) const { +double TGapCosSqDWave::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0_D (meV), [2] Delta0_S (meV) [[3] c0_D (1), [4] aG_D (1), [5] c0_S (1), [6] aG_S (1)] @@ -667,7 +664,7 @@ double TGapCosSqDWave::operator()(double t, const vector &par) const { if (fCalcNeeded[vectorIndex]) { double ds; - vector intPar; // parameters for the integral, T & Delta(T) + std::vector intPar; // parameters for the integral, T & Delta(T) intPar.push_back(0.172346648*t); // 2 kB T, kB in meV/K = 0.086173324 meV/K if (par.size() == 3) { // Carrington/Manzano intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51))); @@ -708,7 +705,7 @@ double TGapCosSqDWave::operator()(double t, const vector &par) const { *

prepare the needed parameters for the integration carried out in TSinSqDWaveGapIntegralCuhre. * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (??). */ -double TGapSinSqDWave::operator()(double t, const vector &par) const { +double TGapSinSqDWave::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0_D (meV), [2] Delta0_S (meV) [[3] c0_D (1), [4] aG_D (1), [5] c0_S (1), [6] aG_S (1)] @@ -756,7 +753,7 @@ double TGapSinSqDWave::operator()(double t, const vector &par) const { if (fCalcNeeded[vectorIndex]) { double ds; - vector intPar; // parameters for the integral, T & Delta(T) + std::vector intPar; // parameters for the integral, T & Delta(T) intPar.push_back(0.172346648*t); // 2 kB T, kB in meV/K = 0.086173324 meV/K if (par.size() == 3) { // Carrington/Manzano intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51))); @@ -797,7 +794,7 @@ double TGapSinSqDWave::operator()(double t, const vector &par) const { *

prepare the needed parameters for the integration carried out in TAnSWaveGapIntegralCuhre (anisotropic s-wave). * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (13). */ -double TGapAnSWave::operator()(double t, const vector &par) const { +double TGapAnSWave::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0 (meV), [2] a (1), [[3] c0 (1), [4] aG (1)] @@ -846,7 +843,7 @@ double TGapAnSWave::operator()(double t, const vector &par) const { if (fCalcNeeded[vectorIndex]) { double ds; - vector intPar; // parameters for the integral, T & Delta(T) + std::vector intPar; // parameters for the integral, T & Delta(T) intPar.push_back(0.172346648*t); // 2 kB T, kB in meV/K = 0.086173324 meV/K if (par.size() == 3) { // Carrington/Manzano intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51))); @@ -883,7 +880,7 @@ double TGapAnSWave::operator()(double t, const vector &par) const { *

prepare the needed parameters for the integration carried out in TNonMonDWave1GapIntegralCuhre. * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (11). */ -double TGapNonMonDWave1::operator()(double t, const vector &par) const { +double TGapNonMonDWave1::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0 (meV), [2] a (1), [[3] c0 (1), [4] aG (1)] @@ -931,7 +928,7 @@ double TGapNonMonDWave1::operator()(double t, const vector &par) const { if (fCalcNeeded[vectorIndex]) { double ds; - vector intPar; // parameters for the integral: 2 k_B T, Delta(T), a, E_c, phi_c + std::vector intPar; // parameters for the integral: 2 k_B T, Delta(T), a, E_c, phi_c intPar.push_back(0.172346648*t); // 2 kB T, kB in meV/K = 0.086173324 meV/K if (par.size() == 3) { // Carrington/Manzano intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51))); @@ -965,7 +962,7 @@ double TGapNonMonDWave1::operator()(double t, const vector &par) const { *

prepare the needed parameters for the integration carried out in TNonMonDWave2GapIntegralCuhre. * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (11). */ -double TGapNonMonDWave2::operator()(double t, const vector &par) const { +double TGapNonMonDWave2::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0 (meV), [2] a (1), [[3] c0 (1), [4] aG (1)] @@ -1013,7 +1010,7 @@ double TGapNonMonDWave2::operator()(double t, const vector &par) const { if (fCalcNeeded[vectorIndex]) { double ds; - vector intPar; // parameters for the integral: 2 k_B T, Delta(T), a, E_c, phi_c + std::vector intPar; // parameters for the integral: 2 k_B T, Delta(T), a, E_c, phi_c intPar.push_back(0.172346648*t); // 2 kB T, kB in meV/K = 0.086173324 meV/K if (par.size() == 3) { // Carrington/Manzano intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51))); @@ -1047,7 +1044,7 @@ double TGapNonMonDWave2::operator()(double t, const vector &par) const { *

Superfluid density in the ``two-fluid'' approximation. * For details see also the Memo GapIntegrals.pdf, especially Eq.(7) and (14). */ -double TGapPowerLaw::operator()(double t, const vector &par) const { +double TGapPowerLaw::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters: Tc, n @@ -1068,7 +1065,7 @@ double TGapPowerLaw::operator()(double t, const vector &par) const { * Here we use INTENTIONALLY the temperature dependence of the gap according * to A. Carrington and F. Manzano, Physica C 385 (2003) 205 */ -double TGapDirtySWave::operator()(double t, const vector &par) const { +double TGapDirtySWave::operator()(double t, const std::vector &par) const { // parameters: [0] Tc (K), [1] Delta0 (meV), [[2] c0 (1), [3] aG (1)] @@ -1095,7 +1092,7 @@ double TGapDirtySWave::operator()(double t, const vector &par) const { /** *

*/ -double TLambdaSWave::operator()(double t, const vector &par) const +double TLambdaSWave::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters: Tc, Delta0 @@ -1113,7 +1110,7 @@ double TLambdaSWave::operator()(double t, const vector &par) const /** *

*/ -double TLambdaDWave::operator()(double t, const vector &par) const +double TLambdaDWave::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters: Tc, Delta0 @@ -1131,7 +1128,7 @@ double TLambdaDWave::operator()(double t, const vector &par) const /** *

*/ -double TLambdaAnSWave::operator()(double t, const vector &par) const +double TLambdaAnSWave::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters: Tc, Delta0, a @@ -1149,7 +1146,7 @@ double TLambdaAnSWave::operator()(double t, const vector &par) const /** *

*/ -double TLambdaNonMonDWave1::operator()(double t, const vector &par) const +double TLambdaNonMonDWave1::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters: Tc, Delta0, a @@ -1167,7 +1164,7 @@ double TLambdaNonMonDWave1::operator()(double t, const vector &par) cons /** *

*/ -double TLambdaNonMonDWave2::operator()(double t, const vector &par) const +double TLambdaNonMonDWave2::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters: Tc, Delta0, a @@ -1185,7 +1182,7 @@ double TLambdaNonMonDWave2::operator()(double t, const vector &par) cons /** *

*/ -double TLambdaPowerLaw::operator()(double t, const vector &par) const { +double TLambdaPowerLaw::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters: Tc, N @@ -1203,7 +1200,7 @@ double TLambdaPowerLaw::operator()(double t, const vector &par) const { /** *

*/ -double TLambdaInvSWave::operator()(double t, const vector &par) const +double TLambdaInvSWave::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters: Tc, Delta0 @@ -1221,7 +1218,7 @@ double TLambdaInvSWave::operator()(double t, const vector &par) const /** *

*/ -double TLambdaInvDWave::operator()(double t, const vector &par) const +double TLambdaInvDWave::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters: Tc, Delta0 @@ -1239,7 +1236,7 @@ double TLambdaInvDWave::operator()(double t, const vector &par) const /** *

*/ -double TLambdaInvAnSWave::operator()(double t, const vector &par) const +double TLambdaInvAnSWave::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters: Tc, Delta0, a @@ -1257,7 +1254,7 @@ double TLambdaInvAnSWave::operator()(double t, const vector &par) const /** *

*/ -double TLambdaInvNonMonDWave1::operator()(double t, const vector &par) const +double TLambdaInvNonMonDWave1::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters: Tc, Delta0, a @@ -1275,7 +1272,7 @@ double TLambdaInvNonMonDWave1::operator()(double t, const vector &par) c /** *

*/ -double TLambdaInvNonMonDWave2::operator()(double t, const vector &par) const +double TLambdaInvNonMonDWave2::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters: Tc, Delta0, a @@ -1293,7 +1290,7 @@ double TLambdaInvNonMonDWave2::operator()(double t, const vector &par) c /** *

*/ -double TLambdaInvPowerLaw::operator()(double t, const vector &par) const { +double TLambdaInvPowerLaw::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters: Tc, N @@ -1323,7 +1320,7 @@ TFilmMagnetizationDWave::TFilmMagnetizationDWave() TFilmMagnetizationDWave::~TFilmMagnetizationDWave() { delete fLambdaInvSq; - fLambdaInvSq = 0; + fLambdaInvSq = nullptr; fPar.clear(); } @@ -1331,7 +1328,7 @@ TFilmMagnetizationDWave::~TFilmMagnetizationDWave() /** *

*/ -double TFilmMagnetizationDWave::operator()(double t, const vector &par) const +double TFilmMagnetizationDWave::operator()(double t, const std::vector &par) const { assert(par.size() == 4); // four parameters: Tc, Delta0, lambda0, film-thickness @@ -1340,7 +1337,7 @@ double TFilmMagnetizationDWave::operator()(double t, const vector &par) if (t >= fPar[0]) return 0.0; - vector parForGapIntegral; + std::vector parForGapIntegral; parForGapIntegral.push_back(fPar[0]); parForGapIntegral.push_back(fPar[1]); diff --git a/src/external/libGapIntegrals/TGapIntegrals.h b/src/external/libGapIntegrals/TGapIntegrals.h index 603b08a9..a0d344ee 100644 --- a/src/external/libGapIntegrals/TGapIntegrals.h +++ b/src/external/libGapIntegrals/TGapIntegrals.h @@ -32,8 +32,6 @@ #include #include -using namespace std; - #include "PUserFcnBase.h" #include "BMWIntegrator.h" @@ -48,19 +46,19 @@ public: virtual ~TGapSWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapIntegral *fGapIntegral; - mutable vector fTemp; - mutable vector::const_iterator fTempIter; - mutable vector fIntegralValues; - mutable vector fCalcNeeded; + mutable std::vector fTemp; + mutable std::vector::const_iterator fTempIter; + mutable std::vector fIntegralValues; + mutable std::vector fCalcNeeded; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TGapSWave,1) }; @@ -76,19 +74,19 @@ public: virtual ~TGapDWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TDWaveGapIntegralCuhre *fGapIntegral; - mutable vector fTemp; - mutable vector::const_iterator fTempIter; - mutable vector fIntegralValues; - mutable vector fCalcNeeded; + mutable std::vector fTemp; + mutable std::vector::const_iterator fTempIter; + mutable std::vector fIntegralValues; + mutable std::vector fCalcNeeded; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TGapDWave,1) }; @@ -104,19 +102,19 @@ public: virtual ~TGapCosSqDWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TCosSqDWaveGapIntegralCuhre *fGapIntegral; - mutable vector fTemp; - mutable vector::const_iterator fTempIter; - mutable vector fIntegralValues; - mutable vector fCalcNeeded; + mutable std::vector fTemp; + mutable std::vector::const_iterator fTempIter; + mutable std::vector fIntegralValues; + mutable std::vector fCalcNeeded; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TGapCosSqDWave,1) }; @@ -132,19 +130,19 @@ public: virtual ~TGapSinSqDWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TSinSqDWaveGapIntegralCuhre *fGapIntegral; - mutable vector fTemp; - mutable vector::const_iterator fTempIter; - mutable vector fIntegralValues; - mutable vector fCalcNeeded; + mutable std::vector fTemp; + mutable std::vector::const_iterator fTempIter; + mutable std::vector fIntegralValues; + mutable std::vector fCalcNeeded; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TGapSinSqDWave,1) }; @@ -160,19 +158,19 @@ public: virtual ~TGapAnSWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TAnSWaveGapIntegralCuhre *fGapIntegral; - mutable vector fTemp; - mutable vector::const_iterator fTempIter; - mutable vector fIntegralValues; - mutable vector fCalcNeeded; + mutable std::vector fTemp; + mutable std::vector::const_iterator fTempIter; + mutable std::vector fIntegralValues; + mutable std::vector fCalcNeeded; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TGapAnSWave,1) }; @@ -188,19 +186,19 @@ public: virtual ~TGapNonMonDWave1(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TNonMonDWave1GapIntegralCuhre *fGapIntegral; - mutable vector fTemp; - mutable vector::const_iterator fTempIter; - mutable vector fIntegralValues; - mutable vector fCalcNeeded; + mutable std::vector fTemp; + mutable std::vector::const_iterator fTempIter; + mutable std::vector fIntegralValues; + mutable std::vector fCalcNeeded; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TGapNonMonDWave1,1) }; @@ -216,19 +214,19 @@ public: virtual ~TGapNonMonDWave2(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TNonMonDWave2GapIntegralCuhre *fGapIntegral; - mutable vector fTemp; - mutable vector::const_iterator fTempIter; - mutable vector fIntegralValues; - mutable vector fCalcNeeded; + mutable std::vector fTemp; + mutable std::vector::const_iterator fTempIter; + mutable std::vector fIntegralValues; + mutable std::vector fCalcNeeded; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TGapNonMonDWave2,1) }; @@ -245,10 +243,10 @@ public: virtual ~TGapPowerLaw() {} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: @@ -266,10 +264,10 @@ public: virtual ~TGapDirtySWave() {} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: @@ -288,10 +286,10 @@ public: virtual ~TLambdaSWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapSWave *fLambdaInvSq; @@ -310,10 +308,10 @@ public: virtual ~TLambdaDWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapDWave *fLambdaInvSq; @@ -332,10 +330,10 @@ public: virtual ~TLambdaAnSWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapAnSWave *fLambdaInvSq; @@ -354,10 +352,10 @@ public: virtual ~TLambdaNonMonDWave1(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapNonMonDWave1 *fLambdaInvSq; @@ -376,10 +374,10 @@ public: virtual ~TLambdaNonMonDWave2(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapNonMonDWave2 *fLambdaInvSq; @@ -398,10 +396,10 @@ public: virtual ~TLambdaPowerLaw() {} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: @@ -419,10 +417,10 @@ public: virtual ~TLambdaInvSWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapSWave *fLambdaInvSq; @@ -441,10 +439,10 @@ public: virtual ~TLambdaInvDWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapDWave *fLambdaInvSq; @@ -463,10 +461,10 @@ public: virtual ~TLambdaInvAnSWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapAnSWave *fLambdaInvSq; @@ -485,10 +483,10 @@ public: virtual ~TLambdaInvNonMonDWave1(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapNonMonDWave1 *fLambdaInvSq; @@ -507,10 +505,10 @@ public: virtual ~TLambdaInvNonMonDWave2(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapNonMonDWave2 *fLambdaInvSq; @@ -529,10 +527,10 @@ public: virtual ~TLambdaInvPowerLaw() {} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: @@ -550,15 +548,15 @@ public: virtual ~TFilmMagnetizationDWave(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TGapDWave *fLambdaInvSq; - mutable vector fPar; + mutable std::vector fPar; ClassDef(TFilmMagnetizationDWave,1) }; diff --git a/src/external/libGbGLF/PGbGLF.cpp b/src/external/libGbGLF/PGbGLF.cpp index a3e07fde..8bc2fedb 100644 --- a/src/external/libGbGLF/PGbGLF.cpp +++ b/src/external/libGbGLF/PGbGLF.cpp @@ -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 * @@ -34,7 +34,6 @@ #include #include #include -using namespace std; #include "PMusr.h" #include "PGbGLF.h" @@ -87,7 +86,7 @@ Double_t PGbGLF::operator()(Double_t t, const std::vector &par) const do { sumM = 0.0; for (Int_t i=0; i(i) + 0.5) * dt; sumM += pz_GbG_2(tt, par); } sumM *= dt; diff --git a/src/external/libGbGLF/PGbGLF.h b/src/external/libGbGLF/PGbGLF.h index aa01f369..06ca15b7 100644 --- a/src/external/libGbGLF/PGbGLF.h +++ b/src/external/libGbGLF/PGbGLF.h @@ -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,7 +31,6 @@ #define _PGBGLF_H_ #include -using namespace std; #include "PUserFcnBase.h" @@ -46,7 +45,7 @@ class PGbGLF : public PUserFcnBase virtual ~PGbGLF() {} virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) {} + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) {} virtual Bool_t GlobalPartIsValid() const { return true; } virtual Double_t operator()(Double_t t, const std::vector ¶m) const; diff --git a/src/external/libGbGLF/PGbGLFLinkDef.h b/src/external/libGbGLF/PGbGLFLinkDef.h index 30ebc943..156f79d2 100644 --- a/src/external/libGbGLF/PGbGLFLinkDef.h +++ b/src/external/libGbGLF/PGbGLFLinkDef.h @@ -7,7 +7,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2016 by Andreas Suter * + * Copyright (C) 2016-2019 by Andreas Suter * * * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/libLFRelaxation/TLFRelaxation.cpp b/src/external/libLFRelaxation/TLFRelaxation.cpp index cc876f8d..5cf91a11 100644 --- a/src/external/libLFRelaxation/TLFRelaxation.cpp +++ b/src/external/libLFRelaxation/TLFRelaxation.cpp @@ -44,8 +44,6 @@ #include "BMWStartupHandler.h" #include "TLFRelaxation.h" -using namespace std; - #define PI 3.14159265358979323846 #define TWOPI 6.28318530717958647692 #define Nsteps 100 @@ -76,7 +74,7 @@ TLFStatGssKT::TLFStatGssKT() { */ TLFStatGssKT::~TLFStatGssKT() { delete fIntSinGss; - fIntSinGss = 0; + fIntSinGss = nullptr; } //-------------------------------------------------------------------------- @@ -88,7 +86,7 @@ TLFStatGssKT::~TLFStatGssKT() { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly νL=Bγμ/2π (MHz), σ (μs-1)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$ \endlatexonly] */ -double TLFStatGssKT::operator()(double t, const vector &par) const { +double TLFStatGssKT::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters nu=gbar*B,sigma @@ -129,7 +127,7 @@ TLFStatExpKT::TLFStatExpKT() { */ TLFStatExpKT::~TLFStatExpKT() { delete fIntBesselJ0Exp; - fIntBesselJ0Exp = 0; + fIntBesselJ0Exp = nullptr; } //-------------------------------------------------------------------------- @@ -141,7 +139,7 @@ TLFStatExpKT::~TLFStatExpKT() { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly νL=Bγμ/2π (MHz), a (μs-1)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$ \endlatexonly] */ -double TLFStatExpKT::operator()(double t, const vector &par) const { +double TLFStatExpKT::operator()(double t, const std::vector &par) const { assert(par.size() == 2); // two parameters nu=gbar*B,rate @@ -188,13 +186,13 @@ TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0) { #if !defined(_WIN32GCC) && defined(HAVE_LIBFFTW3F_THREADS) && defined(HAVE_GOMP) int init_threads(fftwf_init_threads()); if (!init_threads) - cout << "TLFDynGssKT::TLFDynGssKT: Couldn't initialize multiple FFTW-threads ..." << endl; + std::cout << "TLFDynGssKT::TLFDynGssKT: Couldn't initialize multiple FFTW-threads ..." << std::endl; else fftwf_plan_with_nthreads(omp_get_num_procs()); #endif // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -205,9 +203,9 @@ TLFDynGssKT::TLFDynGssKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0) { int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ - << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -263,7 +261,7 @@ TLFDynGssKT::~TLFDynGssKT() { FILE *wordsOfWisdomW; wordsOfWisdomW = fopen(fWisdom.c_str(), "w"); if (wordsOfWisdomW == NULL) { - cout << "TLFDynGssKT::~TLFDynGssKT(): Could not open file ... No wisdom is exported..." << endl; + std::cout << "TLFDynGssKT::~TLFDynGssKT(): Could not open file ... No wisdom is exported..." << std::endl; } else { fftwf_export_wisdom_to_file(wordsOfWisdomW); fclose(wordsOfWisdomW); @@ -276,7 +274,7 @@ TLFDynGssKT::~TLFDynGssKT() { fftwf_destroy_plan(fFFTplanBACK); free(fFFTtime); fftwf_free(fFFTfreq); - cout << "TLFDynGssKT::~TLFDynGssKT(): " << fCounter << " full FFT cycles needed..." << endl; + std::cout << "TLFDynGssKT::~TLFDynGssKT(): " << fCounter << " full FFT cycles needed..." << std::endl; } //-------------------------------------------------------------------------- @@ -288,7 +286,7 @@ TLFDynGssKT::~TLFDynGssKT() { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly νL=Bγμ/2π (MHz), σ (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] */ -double TLFDynGssKT::operator()(double t, const vector &par) const { +double TLFDynGssKT::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters nuL=gbar*B,sigma,fluct.rate nu (fourth parameter: t[us] for SG-function) @@ -459,7 +457,7 @@ TLFDynSG::~TLFDynSG() { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly νL=Bγμ/2π (MHz), a (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] */ -double TLFDynSG::operator()(double t, const vector &par) const { +double TLFDynSG::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters nuL=gbar*B, a ,fluct.rate nu @@ -513,13 +511,13 @@ TLFDynExpKT::TLFDynExpKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0), f #if !defined(_WIN32GCC) && defined(HAVE_LIBFFTW3F_THREADS) && defined(HAVE_GOMP) int init_threads(fftwf_init_threads()); if (!init_threads) - cout << "TLFDynExpKT::TLFDynExpKT: Couldn't initialize multiple FFTW-threads ..." << endl; + std::cout << "TLFDynExpKT::TLFDynExpKT: Couldn't initialize multiple FFTW-threads ..." << std::endl; else fftwf_plan_with_nthreads(omp_get_num_procs()); #endif // read startup file - string startup_path_name("BMW_startup.xml"); + std::string startup_path_name("BMW_startup.xml"); TSAXParser *saxParser = new TSAXParser(); BMWStartupHandler *startupHandler = new BMWStartupHandler(); @@ -530,9 +528,9 @@ TLFDynExpKT::TLFDynExpKT() : fCalcNeeded(true), fFirstCall(true), fCounter(0), f int status = parseXmlFile(saxParser, startup_path_name.c_str()); // check for parse errors if (status) { // error - cerr << endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ - << endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ - << endl; + std::cerr << std::endl << "**ERROR** Reading/parsing " << startup_path_name << " failed." \ + << std::endl << "**ERROR** Please make sure that the file exists in the local directory and it is set up correctly!" \ + << std::endl; assert(false); } @@ -588,7 +586,7 @@ TLFDynExpKT::~TLFDynExpKT() { FILE *wordsOfWisdomW; wordsOfWisdomW = fopen(fWisdom.c_str(), "w"); if (wordsOfWisdomW == NULL) { - cout << "TLFDynExpKT::~TLFDynExpKT(): Could not open file ... No wisdom is exported..." << endl; + std::cout << "TLFDynExpKT::~TLFDynExpKT(): Could not open file ... No wisdom is exported..." << std::endl; } else { fftwf_export_wisdom_to_file(wordsOfWisdomW); fclose(wordsOfWisdomW); @@ -601,7 +599,7 @@ TLFDynExpKT::~TLFDynExpKT() { fftwf_destroy_plan(fFFTplanBACK); free(fFFTtime); fftwf_free(fFFTfreq); - cout << "TLFDynExpKT::~TLFDynExpKT(): " << fCounter << " full FFT cyles needed..." << endl; + std::cout << "TLFDynExpKT::~TLFDynExpKT(): " << fCounter << " full FFT cyles needed..." << std::endl; } //-------------------------------------------------------------------------- @@ -613,7 +611,7 @@ TLFDynExpKT::~TLFDynExpKT() { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly νL=Bγμ/2π (MHz), a (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] */ -double TLFDynExpKT::operator()(double t, const vector &par) const { +double TLFDynExpKT::operator()(double t, const std::vector &par) const { assert(par.size() == 3); // three parameters nuL=gbar*B,sigma,fluct.rate nu @@ -799,7 +797,7 @@ TLFSGInterpolation::~TLFSGInterpolation() { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly νL=Bγμ/2π (MHz), a (μs-1), λ (μs-1), β (1) \endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\lambda~(\mu\mathrm{s}^{-1})$, $\beta~(1)$ \endlatexonly] */ -double TLFSGInterpolation::operator()(double t, const vector &par) const { +double TLFSGInterpolation::operator()(double t, const std::vector &par) const { assert(par.size() == 4); // four parameters nu=gbar*B [MHz], a [1/us], lambda [1/us], beta [1] @@ -815,7 +813,7 @@ double TLFSGInterpolation::operator()(double t, const vector &par) const double omegaL(TMath::TwoPi()*par[0]); - vector intpar(par); + std::vector intpar(par); intpar.push_back(t); double intValue = fIntegral->IntegrateFunc(0.0, t, intpar); intpar.clear(); diff --git a/src/external/libLFRelaxation/TLFRelaxation.h b/src/external/libLFRelaxation/TLFRelaxation.h index 1b000761..6db5d71a 100644 --- a/src/external/libLFRelaxation/TLFRelaxation.h +++ b/src/external/libLFRelaxation/TLFRelaxation.h @@ -34,8 +34,6 @@ #include #include -using namespace std; - #include "PUserFcnBase.h" // the following ifdef is needed for GCC 4.6 or higher, fftw 3.3 or higher and root 5.30.03 or lower @@ -61,10 +59,10 @@ public: ~TLFStatGssKT(); Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TIntSinGss *fIntSinGss; ///< integrator @@ -88,10 +86,10 @@ public: ~TLFStatExpKT(); Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TIntBesselJ0Exp *fIntBesselJ0Exp; ///< integrator @@ -122,17 +120,17 @@ public: ~TLFDynGssKT(); Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the function [\htmlonly νL=Bγμ/2π (MHz), σ (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] + mutable std::vector fPar; ///< parameters of the function [\htmlonly νL=Bγμ/2π (MHz), σ (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] mutable bool fCalcNeeded; ///< flag indicating if the expensive Laplace transform has to be done (e.g. after parameters have changed) mutable bool fFirstCall; ///< flag indicating if the function is evaluated for the first time bool fUseWisdom; ///< flag showing if a FFTW3-wisdom file is used - string fWisdom; ///< path to the wisdom file + std::string fWisdom; ///< path to the wisdom file unsigned int fNSteps; ///< length of the Laplace transform double fDt; ///< time resolution double fDw; ///< frequency resolution @@ -175,17 +173,17 @@ public: ~TLFDynExpKT(); Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the function [\htmlonly νL=Bγμ/2π (MHz), a (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] + mutable std::vector fPar; ///< parameters of the function [\htmlonly νL=Bγμ/2π (MHz), a (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $a~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] mutable bool fCalcNeeded; ///< flag indicating if the expensive Laplace transform has to be done (e.g. after parameters have changed) mutable bool fFirstCall; ///< flag indicating if the function is evaluated for the first time bool fUseWisdom; ///< flag showing if a FFTW3-wisdom file is used - string fWisdom; ///< path to the wisdom file + std::string fWisdom; ///< path to the wisdom file unsigned int fNSteps; ///< length of the Laplace transform double fDt; ///< time resolution double fDw; ///< frequency resolution @@ -230,14 +228,14 @@ public: ~TLFDynSG(); Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: - mutable vector fPar; ///< parameters of the dynamic Gaussian depolarization function [\htmlonly νL=Bγμ/2π (MHz), σ (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] - vector fLFDynGssIntegral; ///< vector of dynamic Gaussian depolarization functions for a subset of static widths + mutable std::vector fPar; ///< parameters of the dynamic Gaussian depolarization function [\htmlonly νL=Bγμ/2π (MHz), σ (μs-1), ν (MHz)\endhtmlonly \latexonly $\nu_{\mathrm{L}}=B\gamma_{\mu}/2\pi~(\mathrm{MHz})$, $\sigma~(\mu\mathrm{s}^{-1})$, $\nu~(\mathrm{MHz})$ \endlatexonly] + std::vector fLFDynGssIntegral; ///< vector of dynamic Gaussian depolarization functions for a subset of static widths ClassDef(TLFDynSG,1) }; @@ -258,10 +256,10 @@ public: ~TLFSGInterpolation(); Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TIntSGInterpolation *fIntegral; ///< integrator diff --git a/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp b/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp index b9f4780e..44375927 100644 --- a/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp +++ b/src/external/libPhotoMeissner/classes/PStartupHandler_PM.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -31,11 +31,9 @@ #include #include -using namespace std; #include "PStartupHandler_PM.h" - //-------------------------------------------------------------------------- // Constructor //-------------------------------------------------------------------------- @@ -93,7 +91,7 @@ Double_t PRgeHandler_PM::GetRgeValue(const Int_t index, const Double_t dist) { Double_t rgeVal = 0.0; - UInt_t distIdx = (UInt_t)(dist/(fRgeDataList[index].stoppingDistance[1]-fRgeDataList[index].stoppingDistance[0])); + UInt_t distIdx = static_cast(dist/(fRgeDataList[index].stoppingDistance[1]-fRgeDataList[index].stoppingDistance[0])); if (distIdx >= fRgeDataList[index].stoppingDistance.size()) { rgeVal = 0.0; @@ -141,7 +139,7 @@ Double_t PRgeHandler_PM::GetRgeValue(const Double_t energy, const Double_t dist) */ Bool_t PRgeHandler_PM::LoadRgeData(const PStringVector &rgeDataPathList, const PDoubleVector &rgeDataEnergyList) { - ifstream fin; + std::ifstream fin; PRgeData_PM data; Int_t idx=0; TString dataName, tstr; @@ -151,11 +149,11 @@ Bool_t PRgeHandler_PM::LoadRgeData(const PStringVector &rgeDataPathList, const P for (UInt_t i=0; i> PStartupHandler_PM(): **WARNING** Couldn't find photoMeissner_startup.xml in the current directory, will try default one." << endl; + std::cout << std::endl << ">> PStartupHandler_PM(): **WARNING** Couldn't find photoMeissner_startup.xml in the current directory, will try default one." << std::endl; home_path = getenv("HOME"); snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/external/photoMeissner_startup.xml", home_path); if (StartupFileExists(startup_path_name)) { @@ -250,7 +248,7 @@ PStartupHandler_PM::PStartupHandler_PM() } // init RGE handler - fRgeHandler = 0; + fRgeHandler = nullptr; } //-------------------------------------------------------------------------- @@ -286,15 +284,15 @@ void PStartupHandler_PM::OnEndDocument() fRgeHandler = new PRgeHandler_PM(fRgeFilePathList, fRgeDataEnergyList); - if (fRgeHandler == 0) { // severe problem + if (fRgeHandler == nullptr) { // severe problem fIsValid = false; - cerr << endl << ">> PStartupHandler_PM::OnEndDocument(): **ERROR** couldn't invoke RGE handler." << endl << endl; + std::cerr << std::endl << ">> PStartupHandler_PM::OnEndDocument(): **ERROR** couldn't invoke RGE handler." << std::endl << std::endl; return; } if (!fRgeHandler->IsValid()) { // severe problem fIsValid = false; - cerr << endl << ">> PStartupHandler_PM::OnEndDocument(): **ERROR** RGE handler not valid." << endl << endl; + std::cerr << std::endl << ">> PStartupHandler_PM::OnEndDocument(): **ERROR** RGE handler not valid." << std::endl << std::endl; return; } } @@ -353,9 +351,9 @@ void PStartupHandler_PM::OnCharacters(const char *str) dval = tstr.Atof(); fRgeDataEnergyList.push_back(dval); } else { - cerr << endl << "PStartupHandler_PM::OnCharacters: **ERROR** when finding energy:"; - cerr << endl << "\"" << str << "\" is not a floating point number, will ignore it."; - cerr << endl; + std::cerr << std::endl << "PStartupHandler_PM::OnCharacters: **ERROR** when finding energy:"; + std::cerr << std::endl << "\"" << str << "\" is not a floating point number, will ignore it."; + std::cerr << std::endl; } break; default: @@ -386,8 +384,8 @@ void PStartupHandler_PM::OnComment(const char *str) */ void PStartupHandler_PM::OnWarning(const char *str) { - cerr << endl << "PStartupHandler_PM **WARNING** " << str; - cerr << endl; + std::cerr << std::endl << "PStartupHandler_PM **WARNING** " << str; + std::cerr << std::endl; } //-------------------------------------------------------------------------- @@ -400,8 +398,8 @@ void PStartupHandler_PM::OnWarning(const char *str) */ void PStartupHandler_PM::OnError(const char *str) { - cerr << endl << "PStartupHandler_PM **ERROR** " << str; - cerr << endl; + std::cerr << std::endl << "PStartupHandler_PM **ERROR** " << str; + std::cerr << std::endl; } //-------------------------------------------------------------------------- @@ -414,8 +412,8 @@ void PStartupHandler_PM::OnError(const char *str) */ void PStartupHandler_PM::OnFatalError(const char *str) { - cerr << endl << "PStartupHandler_PM **FATAL ERROR** " << str; - cerr << endl; + std::cerr << std::endl << "PStartupHandler_PM **FATAL ERROR** " << str; + std::cerr << std::endl; } //-------------------------------------------------------------------------- @@ -492,7 +490,7 @@ bool PStartupHandler_PM::StartupFileExists(char *fln) { bool result = false; - ifstream ifile(fln); + std::ifstream ifile(fln); if (ifile.fail()) { result = false; diff --git a/src/external/libPhotoMeissner/include/PPhotoMeissner.h b/src/external/libPhotoMeissner/include/PPhotoMeissner.h index 071b2473..85956c76 100644 --- a/src/external/libPhotoMeissner/include/PPhotoMeissner.h +++ b/src/external/libPhotoMeissner/include/PPhotoMeissner.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -31,7 +31,6 @@ #define _PPHOTOMEISSNER_H_ #include -using namespace std; #include "PUserFcnBase.h" #include "PStartupHandler_PM.h" @@ -46,11 +45,11 @@ class PPhotoMeissner : public PUserFcnBase // global user-function-access functions, here without any functionality virtual Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } // function operator - Double_t operator()(Double_t, const vector&) const; + Double_t operator()(Double_t, const std::vector&) const; private: PStartupHandler_PM *fStartupHandler; @@ -61,8 +60,8 @@ class PPhotoMeissner : public PUserFcnBase constexpr static const Double_t fTwoPi = 6.28318530717958623; Double_t InuMinus(const Double_t nu, const Double_t x) const; - Double_t FieldFilm(const Double_t z, const vector &par) const; - Double_t FieldHalfSpace(const Double_t z, const vector &par) const; + Double_t FieldFilm(const Double_t z, const std::vector &par) const; + Double_t FieldHalfSpace(const Double_t z, const std::vector &par) const; // definition of the class for the ROOT dictionary ClassDef(PPhotoMeissner, 1) diff --git a/src/external/libPhotoMeissner/include/PPhotoMeissnerLinkDef.h b/src/external/libPhotoMeissner/include/PPhotoMeissnerLinkDef.h index 6a3e6c7f..74bb3138 100644 --- a/src/external/libPhotoMeissner/include/PPhotoMeissnerLinkDef.h +++ b/src/external/libPhotoMeissner/include/PPhotoMeissnerLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/libPhotoMeissner/include/PStartupHandler_PM.h b/src/external/libPhotoMeissner/include/PStartupHandler_PM.h index e7d90a14..8019f624 100644 --- a/src/external/libPhotoMeissner/include/PStartupHandler_PM.h +++ b/src/external/libPhotoMeissner/include/PStartupHandler_PM.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/libPhotoMeissner/include/PStartupHandler_PMLinkDef.h b/src/external/libPhotoMeissner/include/PStartupHandler_PMLinkDef.h index 8ddcea34..a0e3141a 100644 --- a/src/external/libPhotoMeissner/include/PStartupHandler_PMLinkDef.h +++ b/src/external/libPhotoMeissner/include/PStartupHandler_PMLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/libSpinValve/classes/PSkewedLorentzian.cpp b/src/external/libSpinValve/classes/PSkewedLorentzian.cpp index e76b9de6..264a2fd9 100644 --- a/src/external/libSpinValve/classes/PSkewedLorentzian.cpp +++ b/src/external/libSpinValve/classes/PSkewedLorentzian.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-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 #include #include -using namespace std; #include @@ -50,7 +49,7 @@ ClassImp(PSkewedLorentzian) // for ROOT dictionary PSkewedLorentzian::PSkewedLorentzian() { // init - fStartupHandler = 0; + fStartupHandler = nullptr; fNoOfFields = 0; fRange = 0; fValid = true; @@ -67,22 +66,22 @@ PSkewedLorentzian::PSkewedLorentzian() Int_t status = parseXmlFile(saxParser, startup_path_name); // check for parse errors if (status) { // error - cout << endl << ">> PSkewedLorentzian::PSkewedLorentzian: **WARNING** Reading/parsing skewedLorentzian_startup.xml failed."; - cout << endl; + std::cout << std::endl << ">> PSkewedLorentzian::PSkewedLorentzian: **WARNING** Reading/parsing skewedLorentzian_startup.xml failed."; + std::cout << std::endl; fValid = false; } // clean up if (saxParser) { delete saxParser; - saxParser = 0; + saxParser = nullptr; } // check if everything went fine with the startup handler if (!fStartupHandler->IsValid()) { - cout << endl << ">> PSkewedLorentzian::PSkewedLorentzian **PANIC ERROR**"; - cout << endl << ">> startup handler too unhappy. Will terminate unfriendly, sorry."; - cout << endl; + std::cout << std::endl << ">> PSkewedLorentzian::PSkewedLorentzian **PANIC ERROR**"; + std::cout << std::endl << ">> startup handler too unhappy. Will terminate unfriendly, sorry."; + std::cout << std::endl; fValid = false; } @@ -92,18 +91,18 @@ PSkewedLorentzian::PSkewedLorentzian() // check if the parameters potentially make sense if (fNoOfFields == 0) { - cout << endl << ">> PSkewedLorentzian::PSkewedLorentzian **WARNING**"; - cout << endl << ">> Found number of field value == 0. Doesn't make sense, will set it to 101." << endl; + std::cout << std::endl << ">> PSkewedLorentzian::PSkewedLorentzian **WARNING**"; + std::cout << std::endl << ">> Found number of field value == 0. Doesn't make sense, will set it to 101." << std::endl; fNoOfFields = 101; } else if (fNoOfFields > 1000) { - cout << endl << ">> PSkewedLorentzian::PSkewedLorentzian **WARNING**"; - cout << endl << ">> Found number of field value == " << fNoOfFields << "."; - cout << endl << ">> This is a very large number! Are you sure?" << endl; + std::cout << std::endl << ">> PSkewedLorentzian::PSkewedLorentzian **WARNING**"; + std::cout << std::endl << ">> Found number of field value == " << fNoOfFields << "."; + std::cout << std::endl << ">> This is a very large number! Are you sure?" << std::endl; } if (fRange < 1.0) { - cout << endl << ">> PSkewedLorentzian::PSkewedLorentzian **WARNING**"; - cout << endl << ">> Found range value < 1.0 (" << fRange << "). Doesn't make sense, will set it to 10.0." << endl; + std::cout << std::endl << ">> PSkewedLorentzian::PSkewedLorentzian **WARNING**"; + std::cout << std::endl << ">> Found range value < 1.0 (" << fRange << "). Doesn't make sense, will set it to 10.0." << std::endl; fRange = 10.0; } } @@ -129,7 +128,7 @@ PSkewedLorentzian::~PSkewedLorentzian() * \param t * \param par */ -Double_t PSkewedLorentzian::operator()(Double_t t, const vector &par) const +Double_t PSkewedLorentzian::operator()(Double_t t, const std::vector &par) const { // expected parameters: (0) B0: Peak Field, (1) beta: field width, (2) Delta: skewness width, (3) phi: detector phase assert(par.size() == 4); @@ -151,25 +150,25 @@ Double_t PSkewedLorentzian::operator()(Double_t t, const vector &par) if (fNoOfFields % 2 == 0) { // even number of sampling points dB = fieldRangeMinus / (fNoOfFields/2 + 0.5); for (Int_t j=fNoOfFields/2-1; j>=0; j--) { - dval = par[0] - dB*((Double_t)j+0.5); + dval = par[0] - dB*(static_cast(j)+0.5); if (dval > 0.0) BB.push_back(dval); // Bj = B0 - dB*(j+1/2) for Bj < B0 } dB = fieldRangePlus / (fNoOfFields/2 + 0.5); - for (Int_t j=0; j<(Int_t)(fNoOfFields/2); j++) - BB.push_back(par[0] + dB*((Double_t)j+0.5)); // Bj = B0 + dB*(j+1/2) for Bj > B0 + for (Int_t j=0; j(fNoOfFields/2); j++) + BB.push_back(par[0] + dB*(static_cast(j)+0.5)); // Bj = B0 + dB*(j+1/2) for Bj > B0 } else { // odd number of sampling points Int_t halfNoOfPoints = (fNoOfFields-1)/2; dB = fieldRangeMinus / halfNoOfPoints; for (Int_t j=halfNoOfPoints; j>0; j--) { - dval = par[0] - dB*(Double_t)j; + dval = par[0] - dB*static_cast(j); if (dval > 0.0) BB.push_back(dval); // Bj = B0 - dB*j for Bj < B0 } BB.push_back(par[0]); // Bj = B0 dB = fieldRangePlus / halfNoOfPoints; for (Int_t j=1; j<=halfNoOfPoints; j++) - BB.push_back(par[0] + dB*(Double_t)j); // Bj = B0 + dB*j for Bj > B0 + BB.push_back(par[0] + dB*static_cast(j)); // Bj = B0 + dB*j for Bj > B0 } // calculate the asymmetry diff --git a/src/external/libSpinValve/classes/PStartupHandler_SV.cpp b/src/external/libSpinValve/classes/PStartupHandler_SV.cpp index b13bdd4a..54683a25 100644 --- a/src/external/libSpinValve/classes/PStartupHandler_SV.cpp +++ b/src/external/libSpinValve/classes/PStartupHandler_SV.cpp @@ -31,7 +31,6 @@ #include #include -using namespace std; #include "PStartupHandler_SV.h" @@ -60,7 +59,7 @@ PStartupHandler_SV::PStartupHandler_SV() fStartupFileFound = true; fStartupFilePath = TString(startup_path_name); } else { // startup file is not found in the current directory - cout << endl << ">> PStartupHandler_SV(): **WARNING** Couldn't find spinValve_startup.xml in the current directory, will try default one." << endl; + std::cout << std::endl << ">> PStartupHandler_SV(): **WARNING** Couldn't find spinValve_startup.xml in the current directory, will try default one." << std::endl; home_path = getenv("HOME"); snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/external/spinValve_startup.xml", home_path); if (StartupFileExists(startup_path_name)) { @@ -145,9 +144,9 @@ void PStartupHandler_SV::OnCharacters(const char *str) if (tstr.IsDigit()) { fNoOfFields = tstr.Atoi(); } else { - cout << endl << "PStartupHandler_SV::OnCharacters: **ERROR** when finding number_of_fields:"; - cout << endl << "\"" << str << "\" is not a number, will ignore it and use the default value."; - cout << endl; + std::cout << std::endl << "PStartupHandler_SV::OnCharacters: **ERROR** when finding number_of_fields:"; + std::cout << std::endl << "\"" << str << "\" is not a number, will ignore it and use the default value."; + std::cout << std::endl; } break; case eRange: @@ -155,9 +154,9 @@ void PStartupHandler_SV::OnCharacters(const char *str) if (tstr.IsFloat()) { fRange = tstr.Atof(); } else { - cout << endl << "PStartupHandler_SV::OnCharacters: **ERROR** when finding range:"; - cout << endl << "\"" << str << "\" is not a floating point number, will ignore it and use the default value."; - cout << endl; + std::cout << std::endl << "PStartupHandler_SV::OnCharacters: **ERROR** when finding range:"; + std::cout << std::endl << "\"" << str << "\" is not a floating point number, will ignore it and use the default value."; + std::cout << std::endl; } break; default: @@ -188,8 +187,8 @@ void PStartupHandler_SV::OnComment(const char *str) */ void PStartupHandler_SV::OnWarning(const char *str) { - cout << endl << "PStartupHandler_SV **WARNING** " << str; - cout << endl; + std::cout << std::endl << "PStartupHandler_SV **WARNING** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -202,8 +201,8 @@ void PStartupHandler_SV::OnWarning(const char *str) */ void PStartupHandler_SV::OnError(const char *str) { - cout << endl << "PStartupHandler_SV **ERROR** " << str; - cout << endl; + std::cout << std::endl << "PStartupHandler_SV **ERROR** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -216,8 +215,8 @@ void PStartupHandler_SV::OnError(const char *str) */ void PStartupHandler_SV::OnFatalError(const char *str) { - cout << endl << "PStartupHandler_SV **FATAL ERROR** " << str; - cout << endl; + std::cout << std::endl << "PStartupHandler_SV **FATAL ERROR** " << str; + std::cout << std::endl; } //-------------------------------------------------------------------------- @@ -244,7 +243,7 @@ bool PStartupHandler_SV::StartupFileExists(char *fln) { bool result = false; - ifstream ifile(fln); + std::ifstream ifile(fln); if (ifile.fail()) { result = false; diff --git a/src/external/libSpinValve/include/PSkewedLorentzian.h b/src/external/libSpinValve/include/PSkewedLorentzian.h index 56ed8536..c0452aa1 100644 --- a/src/external/libSpinValve/include/PSkewedLorentzian.h +++ b/src/external/libSpinValve/include/PSkewedLorentzian.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -31,7 +31,6 @@ #define _PSKEWEDLORENTZIAN_H_ #include -using namespace std; #include "PUserFcnBase.h" #include "PStartupHandler_SV.h" @@ -46,11 +45,11 @@ class PSkewedLorentzian : public PUserFcnBase // global user-function-access functions, here without any functionality virtual Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } // function operator - Double_t operator()(Double_t, const vector&) const; + Double_t operator()(Double_t, const std::vector&) const; private: PStartupHandler_SV *fStartupHandler; diff --git a/src/external/libSpinValve/include/PSkewedLorentzianLinkDef.h b/src/external/libSpinValve/include/PSkewedLorentzianLinkDef.h index bde07766..b457a0aa 100644 --- a/src/external/libSpinValve/include/PSkewedLorentzianLinkDef.h +++ b/src/external/libSpinValve/include/PSkewedLorentzianLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/libSpinValve/include/PStartupHandler_SV.h b/src/external/libSpinValve/include/PStartupHandler_SV.h index 59730a04..aec5efc3 100644 --- a/src/external/libSpinValve/include/PStartupHandler_SV.h +++ b/src/external/libSpinValve/include/PStartupHandler_SV.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/libSpinValve/include/PStartupHandler_SVLinkDef.h b/src/external/libSpinValve/include/PStartupHandler_SVLinkDef.h index b279dd80..60316ada 100644 --- a/src/external/libSpinValve/include/PStartupHandler_SVLinkDef.h +++ b/src/external/libSpinValve/include/PStartupHandler_SVLinkDef.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2013 by Andreas Suter * + * Copyright (C) 2013-2019 by Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * diff --git a/src/external/libZFRelaxation/ZFRelaxation.cpp b/src/external/libZFRelaxation/ZFRelaxation.cpp index 7bd774ce..e2f1b6b6 100644 --- a/src/external/libZFRelaxation/ZFRelaxation.cpp +++ b/src/external/libZFRelaxation/ZFRelaxation.cpp @@ -35,8 +35,6 @@ #include #include -using namespace std; - ClassImp(ZFMagGss) ClassImp(ZFMagExp) @@ -49,7 +47,7 @@ ClassImp(ZFMagExp) * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly α (1), ν (MHz), σT; (μs-1), σL; (μs-1)\endhtmlonly \latexonly $\alpha~(1)$, $\nu~(\mathrm{MHz})$, $\sigma_{\mathrm{T}}~(\mu\mathrm{s}^{-1})$, $\sigma_{\mathrm{L}}~(\mu\mathrm{s}^{-1})$ \endlatexonly] */ -double ZFMagGss::operator()(double t, const vector &par) const { +double ZFMagGss::operator()(double t, const std::vector &par) const { assert(par.size()==4); double w(TWO_PI * par[1]), sst(par[2]*par[2]*t); return par[0] * (cos(w*t) - sst/w*sin(w*t)) * exp(-0.5*sst*t) + (1.0-par[0]) * exp(-0.5*par[3]*par[3]*t*t); @@ -64,7 +62,7 @@ double ZFMagGss::operator()(double t, const vector &par) const { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly α (1), ν (MHz), aT; (μs-1), aL; (μs-1)\endhtmlonly \latexonly $\alpha~(1)$, $\nu~(\mathrm{MHz})$, $a_{\mathrm{T}}~(\mu\mathrm{s}^{-1})$, $a_{\mathrm{L}}~(\mu\mathrm{s}^{-1})$ \endlatexonly] */ -double ZFMagExp::operator()(double t, const vector &par) const { +double ZFMagExp::operator()(double t, const std::vector &par) const { assert(par.size()==4); double w(TWO_PI * par[1]); return par[0] * (cos(w*t) - par[2]/w*sin(w*t)) * exp(-par[2]*t) + (1.0-par[0]) * exp(-par[3]*t); @@ -88,8 +86,8 @@ UniaxialStatGssKT::UniaxialStatGssKT() { *

Destructor */ UniaxialStatGssKT::~UniaxialStatGssKT() { - delete fIntFirst; fIntFirst = 0; - delete fIntSecond; fIntSecond = 0; + delete fIntFirst; fIntFirst = nullptr; + delete fIntSecond; fIntSecond = nullptr; } //-------------------------------------------------------------------------- @@ -101,27 +99,27 @@ UniaxialStatGssKT::~UniaxialStatGssKT() { * \param t time \htmlonly (μs) \endhtmlonly \latexonly ($\mu\mathrm{s}$) \endlatexonly * \param par parameters [\htmlonly σ1 (μs-1), σ2 (μs-1), Θ (°)\endhtmlonly \latexonly $\sigma_{1}~(\mu\mathrm{s}^{-1})$, $\sigma_{2}~(\mu\mathrm{s}^{-1})$, $\Theta~(^{\circ})$ \endlatexonly] */ -double UniaxialStatGssKT::operator()(double t, const vector &par) const { +double UniaxialStatGssKT::operator()(double t, const std::vector &par) const { assert(par.size() == 3); if (t < 0.0) return 1.0; // set the parameters for the integrations - vector intParam(3); + std::vector intParam(3); intParam[0] = par[0]; intParam[1] = par[1]; intParam[2] = t; if (((fabs(par[1]) < 1.0e-5) && (fabs(par[0]) > 1.0e-2)) || (fabs(par[0]/par[1]) > 1000.0)) { - cerr << endl; - cerr << ">> UniaxialStatGssKT: WARNING Ratio sigma1/sigma2 unreasonably large! Set it internally to 1000. Please check your parameters!"; - cerr << endl; + std::cerr << std::endl; + std::cerr << ">> UniaxialStatGssKT: WARNING Ratio sigma1/sigma2 unreasonably large! Set it internally to 1000. Please check your parameters!"; + std::cerr << std::endl; intParam[1] = 1.0e-3*intParam[0]; } else if (fabs(par[1]) < 1.0e-10) { - cerr << endl; - cerr << ">> UniaxialStatGssKT: WARNING sigma2 too small! Set it internally to 1.0E-10. Please check your parameters!"; - cerr << endl; + std::cerr << std::endl; + std::cerr << ">> UniaxialStatGssKT: WARNING sigma2 too small! Set it internally to 1.0E-10. Please check your parameters!"; + std::cerr << std::endl; intParam[1] = 1.0e-10; } diff --git a/src/external/libZFRelaxation/ZFRelaxation.h b/src/external/libZFRelaxation/ZFRelaxation.h index fa4ee7be..d142c5ea 100644 --- a/src/external/libZFRelaxation/ZFRelaxation.h +++ b/src/external/libZFRelaxation/ZFRelaxation.h @@ -33,7 +33,6 @@ #include "BMWIntegrator.h" #include -using namespace std; //----------------------------------------------------------------------------------------------------------------- /** @@ -52,10 +51,10 @@ public: ~ZFMagGss(){} ///< default destructor Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; ClassDef(ZFMagGss,1) }; @@ -77,10 +76,10 @@ public: ~ZFMagExp(){} ///< default destructor Bool_t NeedGlobalPart() const { return false; } - void SetGlobalPart(vector &globalPart, UInt_t idx) { } + void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; ClassDef(ZFMagExp,1) }; @@ -101,10 +100,10 @@ public: virtual ~UniaxialStatGssKT(); virtual Bool_t NeedGlobalPart() const { return false; } - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) { } + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) { } virtual Bool_t GlobalPartIsValid() const { return true; } - double operator()(double, const vector&) const; + double operator()(double, const std::vector&) const; private: TFirstUniaxialGssKTIntegral *fIntFirst; diff --git a/src/external/nexus/PNeXus.cpp b/src/external/nexus/PNeXus.cpp index f631565a..43f70853 100644 --- a/src/external/nexus/PNeXus.cpp +++ b/src/external/nexus/PNeXus.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2014 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 * @@ -34,7 +34,6 @@ #include #include -using namespace std; #include "PNeXus.h" @@ -87,9 +86,9 @@ bool PNeXusBeam1::IsValid(bool strict) bool valid = true; if (fTotalCounts == 0) { - cerr << ">> **WARNING** NXbeam total_counts not given" << endl; + std::cerr << ">> **WARNING** NXbeam total_counts not given" << std::endl; } else if (!fUnits.compare("n/a")) { - cerr << ">> **WARNING** NXbeam total_counts units not given" << endl; + std::cerr << ">> **WARNING** NXbeam total_counts units not given" << std::endl; } return valid; @@ -110,7 +109,7 @@ bool PNeXusDetector1::IsValid(bool strict) bool valid = true; if (fNumber == 0) { - cerr << ">> **WARNING** NXdetector number of detectors not given" << endl; + std::cerr << ">> **WARNING** NXdetector number of detectors not given" << std::endl; } return valid; @@ -131,7 +130,7 @@ bool PNeXusInstrument1::IsValid(bool strict) bool valid = true; if (!fName.compare("n/a")) { - cerr << ">> **ERROR** NXinstrument name not given" << endl; + std::cerr << ">> **ERROR** NXinstrument name not given" << std::endl; valid = false; } else if (!fDetector.IsValid(strict)) { valid = false; @@ -188,10 +187,10 @@ bool PNeXusSample1::IsValid(bool strict) bool valid = true; if (!fName.compare("n/a")) { - cerr << ">> **ERROR** NXsample name not given." << endl; + std::cerr << ">> **ERROR** NXsample name not given." << std::endl; valid = false; } else if (!fShape.compare("n/a")) { - cerr << ">> **WARNING** NXsample shape not given." << endl; + std::cerr << ">> **WARNING** NXsample shape not given." << std::endl; } int count=0; // at the end count holds the number of required physiscal properties. Currently these are: temperature, magnetic_field @@ -199,28 +198,28 @@ bool PNeXusSample1::IsValid(bool strict) if (!fPhysProp[i].GetName().compare("temperature")) { count++; if (!fPhysProp[i].GetUnit().compare("n/a")) { - cerr << ">> **ERROR** NXsample temperature unit not given." << endl; + std::cerr << ">> **ERROR** NXsample temperature unit not given." << std::endl; valid = false; } if (fPhysProp[i].GetValue() == 1.0e99) { - cerr << ">> **ERROR** NXsample temperature value not given." << endl; + std::cerr << ">> **ERROR** NXsample temperature value not given." << std::endl; valid = false; } } if (!fPhysProp[i].GetName().compare("magnetic_field")) { count++; if (!fPhysProp[i].GetUnit().compare("n/a")) { - cerr << ">> **ERROR** NXsample magnetic_field unit not given." << endl; + std::cerr << ">> **ERROR** NXsample magnetic_field unit not given." << std::endl; valid = false; } if (fPhysProp[i].GetValue() == 1.0e99) { - cerr << ">> **ERROR** NXsample magnetic_field value not given." << endl; + std::cerr << ">> **ERROR** NXsample magnetic_field value not given." << std::endl; valid = false; } } } if (count < 2) { - cerr << ">> **ERROR** not all required physical properties (e.g. temperature, magnetic_field) are given." << endl; + std::cerr << ">> **ERROR** not all required physical properties (e.g. temperature, magnetic_field) are given." << std::endl; valid = false; } @@ -236,7 +235,7 @@ bool PNeXusSample1::IsValid(bool strict) * \param name * \param ok */ -double PNeXusSample1::GetPhysPropValue(string name, bool &ok) +double PNeXusSample1::GetPhysPropValue(std::string name, bool &ok) { double dval=0.0; ok = false; @@ -261,7 +260,7 @@ double PNeXusSample1::GetPhysPropValue(string name, bool &ok) * \param name * \param ok */ -void PNeXusSample1::GetPhysPropUnit(string name, string &unit, bool &ok) +void PNeXusSample1::GetPhysPropUnit(std::string name, std::string &unit, bool &ok) { unit = "n/a"; ok = false; @@ -286,7 +285,7 @@ void PNeXusSample1::GetPhysPropUnit(string name, string &unit, bool &ok) * \param value of the physical property * \param idx index where to set the physical property */ -void PNeXusSample1::SetPhysProp(string name, double value, string unit, int idx) +void PNeXusSample1::SetPhysProp(std::string name, double value, std::string unit, int idx) { PNeXusProp prop; @@ -352,34 +351,34 @@ PNeXusEntry1::PNeXusEntry1() bool PNeXusEntry1::IsValid(bool strict) { if (!fProgramName.compare("n/a")) { - cerr << ">> **WARNING** NXentry: program_name not given." << endl; + std::cerr << ">> **WARNING** NXentry: program_name not given." << std::endl; } else if (!fProgramVersion.compare("n/a")) { - cerr << ">> **WARNING** NXentry: program_name/version not given." << endl; + std::cerr << ">> **WARNING** NXentry: program_name/version not given." << std::endl; } else if (fRunNumber == -1) { - cerr << ">> **ERROR** NXentry: number (i.e. run number) not given." << endl; + std::cerr << ">> **ERROR** NXentry: number (i.e. run number) not given." << std::endl; return false; } else if (!fTitle.compare("n/a")) { - cerr << ">> **ERROR** NXentry: title not given." << endl; + std::cerr << ">> **ERROR** NXentry: title not given." << std::endl; return false; } else if (!fNotes.compare("n/a")) { - cerr << ">> **WARNING** NXentry: notes not given." << endl; + std::cerr << ">> **WARNING** NXentry: notes not given." << std::endl; } else if (!fAnalysis.compare("n/a")) { - cerr << ">> **ERROR** NXentry: analysis (i.e. type of muon experiment like 'TF', 'ALC', ...) not given." << endl; + std::cerr << ">> **ERROR** NXentry: analysis (i.e. type of muon experiment like 'TF', 'ALC', ...) not given." << std::endl; return false; } else if (!fLaboratory.compare("n/a")) { - cerr << ">> **ERROR** NXentry: lab (e.g. 'PSI') not given." << endl; + std::cerr << ">> **ERROR** NXentry: lab (e.g. 'PSI') not given." << std::endl; return false; } else if (!fBeamline.compare("n/a")) { - cerr << ">> **ERROR** NXentry: beamline (e.g. 'piE3') not given." << endl; + std::cerr << ">> **ERROR** NXentry: beamline (e.g. 'piE3') not given." << std::endl; return false; } else if (!fStartTime.compare("n/a")) { - cerr << ">> **ERROR** NXentry: start_time not given." << endl; + std::cerr << ">> **ERROR** NXentry: start_time not given." << std::endl; return false; } else if (!fStopTime.compare("n/a")) { - cerr << ">> **ERROR** NXentry: stop_time not given." << endl; + std::cerr << ">> **ERROR** NXentry: stop_time not given." << std::endl; return false; } else if (fSwitchingState == -1) { - cerr << ">> **ERROR** NXentry: switching_state (i.e. '1' normal data taking, '2' red/green mode) not given." << endl; + std::cerr << ">> **ERROR** NXentry: switching_state (i.e. '1' normal data taking, '2' red/green mode) not given." << std::endl; return false; } else if (!fUser.IsValid(strict)) { return false; @@ -398,11 +397,11 @@ bool PNeXusEntry1::IsValid(bool strict) // SetStartTime (public) //------------------------------------------------------------------------------------------ /** - *

Set the start time string and check that it is ISO 8601 conform. + *

Set the start time std::string and check that it is ISO 8601 conform. * - * \param time start time string + * \param time start time std::string */ -int PNeXusEntry1::SetStartTime(string time) +int PNeXusEntry1::SetStartTime(std::string time) { struct tm tm; memset(&tm, 0, sizeof(tm)); @@ -421,11 +420,11 @@ int PNeXusEntry1::SetStartTime(string time) // SetStopTime (public) //------------------------------------------------------------------------------------------ /** - *

Set the stop time string and check that it is ISO 8601 conform. + *

Set the stop time std::string and check that it is ISO 8601 conform. * - * \param time stop time string + * \param time stop time std::string */ -int PNeXusEntry1::SetStopTime(string time) +int PNeXusEntry1::SetStopTime(std::string time) { struct tm tm; memset(&tm, 0, sizeof(tm)); @@ -505,17 +504,17 @@ PNeXusData1::~PNeXusData1() bool PNeXusData1::IsValid(bool strict) { if (GetNoOfHistos() == 0) { - cerr << ">> **ERROR** NXdata no histograms given." << endl; + std::cerr << ">> **ERROR** NXdata no histograms given." << std::endl; return false; } else if (fTimeResolution == 0.0) { - cerr << ">> **ERROR** NXdata time resolution not given." << endl; + std::cerr << ">> **ERROR** NXdata time resolution not given." << std::endl; return false; } else if (fT0.size() == 0) { - cerr << ">> **WARNING** NXdata t0 not given." << endl; + std::cerr << ">> **WARNING** NXdata t0 not given." << std::endl; } else if (fFirstGoodBin.size() == 0) { - cerr << ">> **WARNING** NXdata first good bin not given." << endl; + std::cerr << ">> **WARNING** NXdata first good bin not given." << std::endl; } else if (fLastGoodBin.size() == 0) { - cerr << ">> **WARNING** NXdata last good bin not given." << endl; + std::cerr << ">> **WARNING** NXdata last good bin not given." << std::endl; } return true; @@ -532,7 +531,7 @@ bool PNeXusData1::IsValid(bool strict) * * \param units requested units for the time resolution. */ -double PNeXusData1::GetTimeResolution(string units) +double PNeXusData1::GetTimeResolution(std::string units) { double result=0.0; @@ -610,7 +609,7 @@ int PNeXusData1::GetLastGoodBin(unsigned int idx) * \param name histogram name if idx is within range * \param ok =true if idx was within range, otherwise false */ -void PNeXusData1::GetHistoName(unsigned int idx, string &name, bool &ok) +void PNeXusData1::GetHistoName(unsigned int idx, std::string &name, bool &ok) { if (idx >= fHistoName.size()) { ok = false; @@ -644,7 +643,7 @@ unsigned int PNeXusData1::GetHistoLength(unsigned int histoNo) * * \param histoNo index of the requested histogram */ -vector *PNeXusData1::GetHisto(unsigned int histoNo) +std::vector *PNeXusData1::GetHisto(unsigned int histoNo) { if (histoNo >= fHisto.size()) return 0; @@ -663,7 +662,7 @@ vector *PNeXusData1::GetHisto(unsigned int histoNo) * \param val time resolution value * \param units time resolution units */ -void PNeXusData1::SetTimeResolution(double val, string units) +void PNeXusData1::SetTimeResolution(double val, std::string units) { if (!units.compare("fs")) fTimeResolution = val * 1.0e-3; @@ -761,7 +760,7 @@ void PNeXusData1::FlushHistos() * \param data histogram vector * \param histoNo index where to set the histogram */ -void PNeXusData1::SetHisto(vector &data, int histoNo) +void PNeXusData1::SetHisto(std::vector &data, int histoNo) { if (histoNo == -1) { fHisto.push_back(data); @@ -785,15 +784,15 @@ void PNeXusData1::SetHisto(vector &data, int histoNo) */ bool PNeXusBeamline2::IsValid(bool strict) { - string msg(""); + std::string msg(""); if (!fName.compare("n/a")) { msg = "IDF2 NXbeamline 'name' not set."; if (strict) { - cerr << ">> **ERROR** " << msg << endl; + std::cerr << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << ">> **WARNING** " << msg << endl; + std::cerr << ">> **WARNING** " << msg << std::endl; } } @@ -864,45 +863,45 @@ PNeXusDetector2::~PNeXusDetector2() */ bool PNeXusDetector2::IsValid(bool strict) { - string msg(""); + std::string msg(""); if (!fDescription.compare("n/a")) { msg = "IDF2 NXdetector 'description' not set."; if (strict) { - cerr << ">> **ERROR** " << msg << endl; + std::cerr << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << ">> **WARNING** " << msg << endl; + std::cerr << ">> **WARNING** " << msg << std::endl; } } if (fTimeResolution == 0.0) { - cerr << ">> **ERROR** IDF2 NXdetector 'histogram_resolution' is not set." << endl; + std::cerr << ">> **ERROR** IDF2 NXdetector 'histogram_resolution' is not set." << std::endl; return false; } if (fSpectrumIndex.size() == 0) { - cerr << ">> **ERROR** IDF2 NXdetector 'spectrum_index' is not set." << endl; + std::cerr << ">> **ERROR** IDF2 NXdetector 'spectrum_index' is not set." << std::endl; return false; } if ((fT0Tag != 1) && (fT0Tag !=2)) { - cerr << ">> **ERROR** IDF2 NXdetector problem with t0/first_good_bin/last_good_bin/counts settings (tagging)." << endl; + std::cerr << ">> **ERROR** IDF2 NXdetector problem with t0/first_good_bin/last_good_bin/counts settings (tagging)." << std::endl; return false; } if (fT0 == 0) { - cerr << ">> **ERROR** IDF2 NXdetector t0 settings pointer is null." << endl; + std::cerr << ">> **ERROR** IDF2 NXdetector t0 settings pointer is null." << std::endl; return false; } if (fHisto == 0) { - cerr << ">> **ERROR** IDF2 NXdetector counts settings pointer is null." << endl; + std::cerr << ">> **ERROR** IDF2 NXdetector counts settings pointer is null." << std::endl; return false; } if (fNoOfBins == -1) { - cerr << ">> **ERROR** IDF2 NXdetector fNoOfBins==-1." << endl; + std::cerr << ">> **ERROR** IDF2 NXdetector fNoOfBins==-1." << std::endl; return false; } @@ -962,7 +961,7 @@ int PNeXusDetector2::SetT0(int *t0) int result = 1; unsigned int size=0; - stringstream ss; + std::stringstream ss; switch (fT0Tag) { case -1: @@ -1072,7 +1071,7 @@ int PNeXusDetector2::SetFirstGoodBin(int *fgb) int result = 1; unsigned int size=0; - stringstream ss; + std::stringstream ss; switch (fT0Tag) { case -1: @@ -1182,7 +1181,7 @@ int PNeXusDetector2::SetLastGoodBin(int *lgb) int result = 1; unsigned int size=0; - stringstream ss; + std::stringstream ss; switch (fT0Tag) { case -1: @@ -1350,7 +1349,7 @@ int PNeXusDetector2::SetHistos(int *histo) * * \param units requested units for the time resolution. */ -double PNeXusDetector2::GetTimeResolution(string units) +double PNeXusDetector2::GetTimeResolution(std::string units) { double result=0.0; @@ -1378,7 +1377,7 @@ double PNeXusDetector2::GetTimeResolution(string units) * \param val time resolution value * \param units time resolution units */ -void PNeXusDetector2::SetTimeResolution(double val, string units) +void PNeXusDetector2::SetTimeResolution(double val, std::string units) { if (!units.compare("fs") || !units.compare("femto.second") || !units.compare("femto second") || !units.compare("femtoseconds")) fTimeResolution = val * 1.0e-3; @@ -1398,7 +1397,7 @@ void PNeXusDetector2::SetTimeResolution(double val, string units) * * \param rawTime raw time vector. */ -void PNeXusDetector2::SetRawTime(vector &rawTime) +void PNeXusDetector2::SetRawTime(std::vector &rawTime) { for (unsigned int i=0; i> **ERROR** " << msg << endl; + std::cerr << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << ">> **WARNING** " << msg << endl; + std::cerr << ">> **WARNING** " << msg << std::endl; } } @@ -1502,35 +1501,35 @@ PNeXusSource2::PNeXusSource2() */ bool PNeXusSource2::IsValid(bool strict) { - string msg(""); + std::string msg(""); if (!fName.compare("n/a")) { msg = "IDF2 NXsample 'name' not set."; if (strict) { - cerr << ">> **ERROR** " << msg << endl; + std::cerr << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << ">> **WARNING** " << msg << endl; + std::cerr << ">> **WARNING** " << msg << std::endl; } } if (!fType.compare("n/a")) { msg = "IDF2 NXsample 'type' not set."; if (strict) { - cerr << ">> **ERROR** " << msg << endl; + std::cerr << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << ">> **WARNING** " << msg << endl; + std::cerr << ">> **WARNING** " << msg << std::endl; } } if (!fProbe.compare("n/a")) { msg = "IDF2 NXsample 'probe' not set."; if (strict) { - cerr << ">> **ERROR** " << msg << endl; + std::cerr << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << ">> **WARNING** " << msg << endl; + std::cerr << ">> **WARNING** " << msg << std::endl; } } @@ -1575,26 +1574,26 @@ PNeXusSample2::~PNeXusSample2() */ bool PNeXusSample2::IsValid(bool strict) { - string msg(""); + std::string msg(""); if (!fName.compare("n/a")) { - cerr << ">> **WARNING** IDF2 NXsample 'name' not set." << msg << endl; + std::cerr << ">> **WARNING** IDF2 NXsample 'name' not set." << msg << std::endl; } if (!fDescription.compare("n/a")) { - cerr << endl << ">> **WARNING** IDF2 NXsample 'description' not set." << endl; + std::cerr << std::endl << ">> **WARNING** IDF2 NXsample 'description' not set." << std::endl; } if (!fMagneticFieldState.compare("n/a")) { - cerr << endl << ">> **WARNING** IDF2 NXsample 'magnetic_field_state' not set." << endl; + std::cerr << std::endl << ">> **WARNING** IDF2 NXsample 'magnetic_field_state' not set." << std::endl; } if (!fEnvironmentTemp.compare("n/a")) { - cerr << endl << ">> **WARNING** IDF2 NXsample 'temperature_1_env' not set." << endl; + std::cerr << std::endl << ">> **WARNING** IDF2 NXsample 'temperature_1_env' not set." << std::endl; } if (!fEnvironmentField.compare("n/a")) { - cerr << endl << ">> **WARNING** IDF2 NXsample 'magnetic_field_1_env' not set." << endl; + std::cerr << std::endl << ">> **WARNING** IDF2 NXsample 'magnetic_field_1_env' not set." << std::endl; } bool ok; @@ -1602,12 +1601,12 @@ bool PNeXusSample2::IsValid(bool strict) dummy = GetPhysPropValue("temperature_1", ok); if (!ok) { - cerr << endl << ">> **WARNING** IDF2 NXsample 'temperature_1' not set." << endl; + std::cerr << std::endl << ">> **WARNING** IDF2 NXsample 'temperature_1' not set." << std::endl; } dummy = GetPhysPropValue("magnetic_field_1", ok); if (!ok) { - cerr << endl << ">> **WARNING** IDF2 NXsample 'magnetic_field_1' not set." << endl; + std::cerr << std::endl << ">> **WARNING** IDF2 NXsample 'magnetic_field_1' not set." << std::endl; } return true; @@ -1622,7 +1621,7 @@ bool PNeXusSample2::IsValid(bool strict) * \param name * \param ok */ -double PNeXusSample2::GetPhysPropValue(string name, bool &ok) +double PNeXusSample2::GetPhysPropValue(std::string name, bool &ok) { double dval=0.0; ok = false; @@ -1647,7 +1646,7 @@ double PNeXusSample2::GetPhysPropValue(string name, bool &ok) * \param name * \param ok */ -void PNeXusSample2::GetPhysPropUnit(string name, string &unit, bool &ok) +void PNeXusSample2::GetPhysPropUnit(std::string name, std::string &unit, bool &ok) { unit = "n/a"; ok = false; @@ -1672,7 +1671,7 @@ void PNeXusSample2::GetPhysPropUnit(string name, string &unit, bool &ok) * \param value of the physical property * \param idx index where to set the physical property */ -void PNeXusSample2::SetPhysProp(string name, double value, string unit, int idx) +void PNeXusSample2::SetPhysProp(std::string name, double value, std::string unit, int idx) { PNeXusProp prop; @@ -1721,65 +1720,65 @@ PNeXusEntry2::PNeXusEntry2() */ bool PNeXusEntry2::IsValid(bool strict) { - string msg(""); + std::string msg(""); if (!fDefinition.compare("n/a")) { msg = "IDF2 NXentry definition not set."; if (strict) { - cerr << endl << ">> **ERROR** " << msg << endl; + std::cerr << std::endl << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << endl << ">> **WARNING** " << msg << endl; + std::cerr << std::endl << ">> **WARNING** " << msg << std::endl; } } if (fRunNumber == -1) { msg = "run number not set."; if (strict) { - cerr << endl << ">> **ERROR** " << msg << endl; + std::cerr << std::endl << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << endl << ">> **WARNING** " << msg << endl; + std::cerr << std::endl << ">> **WARNING** " << msg << std::endl; } } if (!fTitle.compare("n/a")) { msg = "run title not set."; if (strict) { - cerr << endl << ">> **ERROR** " << msg << endl; + std::cerr << std::endl << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << endl << ">> **WARNING** " << msg << endl; + std::cerr << std::endl << ">> **WARNING** " << msg << std::endl; } } if (!fStartTime.compare("n/a")) { msg = "start time not set."; if (strict) { - cerr << endl << ">> **ERROR** " << msg << endl; + std::cerr << std::endl << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << endl << ">> **WARNING** " << msg << endl; + std::cerr << std::endl << ">> **WARNING** " << msg << std::endl; } } if (!fStopTime.compare("n/a")) { msg = "end time not set."; if (strict) { - cerr << endl << ">> **ERROR** " << msg << endl; + std::cerr << std::endl << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << endl << ">> **WARNING** " << msg << endl; + std::cerr << std::endl << ">> **WARNING** " << msg << std::endl; } } if (!fExperimentIdentifier.compare("n/a")) { msg = "experiment identifier not set."; if (strict) { - cerr << endl << ">> **ERROR** " << msg << endl; + std::cerr << std::endl << ">> **ERROR** " << msg << std::endl; return false; } else { - cerr << endl << ">> **WARNING** " << msg << endl; + std::cerr << std::endl << ">> **WARNING** " << msg << std::endl; } } @@ -1801,11 +1800,11 @@ bool PNeXusEntry2::IsValid(bool strict) // SetStartTime (public) //------------------------------------------------------------------------------------------ /** - *

Set the start time string and check that it is ISO 8601 conform. + *

Set the start time std::string and check that it is ISO 8601 conform. * - * \param time start time string + * \param time start time std::string */ -int PNeXusEntry2::SetStartTime(string time) +int PNeXusEntry2::SetStartTime(std::string time) { struct tm tm; memset(&tm, 0, sizeof(tm)); @@ -1826,11 +1825,11 @@ int PNeXusEntry2::SetStartTime(string time) // SetStopTime (public) //------------------------------------------------------------------------------------------ /** - *

Set the stop time string and check that it is ISO 8601 conform. + *

Set the stop time std::string and check that it is ISO 8601 conform. * - * \param time stop time string + * \param time stop time std::string */ -int PNeXusEntry2::SetStopTime(string time) +int PNeXusEntry2::SetStopTime(std::string time) { struct tm tm; memset(&tm, 0, sizeof(tm)); @@ -1873,7 +1872,7 @@ PNeXus::PNeXus(const char* fileName) fFileName = fileName; if (ReadFile(fileName) != NX_OK) { - cerr << endl << fErrorMsg << " (error code=" << fErrorCode << ")" << endl << endl; + std::cerr << std::endl << fErrorMsg << " (error code=" << fErrorCode << ")" << std::endl << std::endl; } else { fValid = true; } @@ -1913,7 +1912,7 @@ PNeXus::~PNeXus() void PNeXus::SetIdfVersion(unsigned int idf) { if ((idf != 1) && (idf != 2)) { - cerr << endl << ">> **ERROR** Only IDF versions 1 and 2 are supported." << endl; + std::cerr << std::endl << ">> **ERROR** Only IDF versions 1 and 2 are supported." << std::endl; return; } @@ -1927,7 +1926,7 @@ void PNeXus::SetIdfVersion(unsigned int idf) fNxEntry1 = new PNeXusEntry1(); if (fNxEntry1 == 0) { - cerr << endl << ">> **ERROR** couldn't invoke IDF 1 object PNeXusEntry1." << endl; + std::cerr << std::endl << ">> **ERROR** couldn't invoke IDF 1 object PNeXusEntry1." << std::endl; return; } } else { // IDF 2 @@ -1938,7 +1937,7 @@ void PNeXus::SetIdfVersion(unsigned int idf) fNxEntry2 = new PNeXusEntry2(); if (fNxEntry2 == 0) { - cerr << endl << ">> **ERROR** couldn't invoke IDF 2 object PNeXusEntry1." << endl; + std::cerr << std::endl << ">> **ERROR** couldn't invoke IDF 2 object PNeXusEntry1." << std::endl; return; } } @@ -1963,7 +1962,7 @@ bool PNeXus::IsValid(bool strict) else if (fIdfVersion == 2) // IDF Version 2 valid = IsValidIdf2(strict); else { - cerr << endl << ">> **ERROR** found IDF Version " << fIdfVersion << ", which is not implemented yet." << endl << endl; + std::cerr << std::endl << ">> **ERROR** found IDF Version " << fIdfVersion << ", which is not implemented yet." << std::endl << std::endl; valid = false; } @@ -1978,7 +1977,7 @@ bool PNeXus::IsValid(bool strict) * * \param idx index of the grouped histogram to be returned. */ -vector* PNeXus::GetGroupedHisto(unsigned int idx) +std::vector* PNeXus::GetGroupedHisto(unsigned int idx) { if (idx >= fGroupedHisto.size()) return 0; @@ -2007,7 +2006,7 @@ int PNeXus::ReadFile(const char *fileName) status = NXopen(fileName, NXACC_READ, &fFileHandle); if (status != NX_OK) { fErrorCode = PNEXUS_FILE_OPEN_ERROR; - fErrorMsg = "PNeXus::ReadFile() **ERROR** Couldn't open file "+string(fileName)+"!"; + fErrorMsg = "PNeXus::ReadFile() **ERROR** Couldn't open file "+std::string(fileName)+"!"; return NX_ERROR; } @@ -2025,7 +2024,7 @@ int PNeXus::ReadFile(const char *fileName) status = NXopengroup(fFileHandle, nxname, "NXentry"); if (status != NX_OK) { fErrorCode = PNEXUS_GROUP_OPEN_ERROR; - fErrorMsg = "PNeXus::ReadFile() **ERROR** Couldn't open the NeXus group '" + string(nxname) + "'!"; + fErrorMsg = "PNeXus::ReadFile() **ERROR** Couldn't open the NeXus group '" + std::string(nxname) + "'!"; return NX_ERROR; } // 3) get the IDF @@ -2063,7 +2062,7 @@ int PNeXus::ReadFile(const char *fileName) break; default: fErrorCode = PNEXUS_IDF_NOT_IMPLEMENTED; - stringstream ss; + std::stringstream ss; ss << ">> **ERROR** idf_version=" << fIdfVersion << " not yet implemented."; fErrorMsg = ss.str(); status = NX_ERROR; @@ -2130,287 +2129,287 @@ int PNeXus::WriteFile(const char *fileName, const char *fileType, const unsigned void PNeXus::Dump() { double dval; - string str; + std::string str; bool ok; if (fIdfVersion == 1) { - cout << endl << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; - cout << endl << "NXfile:"; - cout << endl << " NeXus_version : " << fNeXusVersion; - cout << endl << " file format ver: " << fFileFormatVersion; - cout << endl << " file name : " << fFileName; - cout << endl << " file time : " << fFileTime; - cout << endl << " user : " << fCreator; - cout << endl << "NXentry:"; - cout << endl << " idf version : " << fIdfVersion; - cout << endl << " program name : " << fNxEntry1->GetProgramName() << ", version: " << fNxEntry1->GetProgramVersion(); - cout << endl << " run number : " << fNxEntry1->GetRunNumber(); - cout << endl << " title : " << fNxEntry1->GetTitle(); - cout << endl << " notes : " << fNxEntry1->GetNotes(); - cout << endl << " analysis : " << fNxEntry1->GetAnalysis(); - cout << endl << " laboratory : " << fNxEntry1->GetLaboratory(); - cout << endl << " beamline : " << fNxEntry1->GetBeamline(); - cout << endl << " start time : " << fNxEntry1->GetStartTime(); - cout << endl << " stop time : " << fNxEntry1->GetStopTime(); - cout << endl << " switching state: " << fNxEntry1->GetSwitchingState() << ", '1' normal data collection, '2' Red/Green mode"; - cout << endl << "NXuser:"; - cout << endl << " name : " << fNxEntry1->GetUser()->GetName(); - cout << endl << " exp.number : " << fNxEntry1->GetUser()->GetExperimentNumber(); - cout << endl << "NXsample:"; - cout << endl << " name : " << fNxEntry1->GetSample()->GetName(); + std::cout << std::endl << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; + std::cout << std::endl << "NXfile:"; + std::cout << std::endl << " NeXus_version : " << fNeXusVersion; + std::cout << std::endl << " file format ver: " << fFileFormatVersion; + std::cout << std::endl << " file name : " << fFileName; + std::cout << std::endl << " file time : " << fFileTime; + std::cout << std::endl << " user : " << fCreator; + std::cout << std::endl << "NXentry:"; + std::cout << std::endl << " idf version : " << fIdfVersion; + std::cout << std::endl << " program name : " << fNxEntry1->GetProgramName() << ", version: " << fNxEntry1->GetProgramVersion(); + std::cout << std::endl << " run number : " << fNxEntry1->GetRunNumber(); + std::cout << std::endl << " title : " << fNxEntry1->GetTitle(); + std::cout << std::endl << " notes : " << fNxEntry1->GetNotes(); + std::cout << std::endl << " analysis : " << fNxEntry1->GetAnalysis(); + std::cout << std::endl << " laboratory : " << fNxEntry1->GetLaboratory(); + std::cout << std::endl << " beamline : " << fNxEntry1->GetBeamline(); + std::cout << std::endl << " start time : " << fNxEntry1->GetStartTime(); + std::cout << std::endl << " stop time : " << fNxEntry1->GetStopTime(); + std::cout << std::endl << " switching state: " << fNxEntry1->GetSwitchingState() << ", '1' normal data collection, '2' Red/Green mode"; + std::cout << std::endl << "NXuser:"; + std::cout << std::endl << " name : " << fNxEntry1->GetUser()->GetName(); + std::cout << std::endl << " exp.number : " << fNxEntry1->GetUser()->GetExperimentNumber(); + std::cout << std::endl << "NXsample:"; + std::cout << std::endl << " name : " << fNxEntry1->GetSample()->GetName(); dval = fNxEntry1->GetSample()->GetPhysPropValue("temperature", ok); if (ok) - cout << endl << " temperature : " << dval; + std::cout << std::endl << " temperature : " << dval; fNxEntry1->GetSample()->GetPhysPropUnit("temperature", str, ok); if (ok) - cout << " (" << str << ")"; + std::cout << " (" << str << ")"; dval = fNxEntry1->GetSample()->GetPhysPropValue("magnetic_field", ok); if (ok) - cout << endl << " magnetic_field : " << dval; + std::cout << std::endl << " magnetic_field : " << dval; fNxEntry1->GetSample()->GetPhysPropUnit("magnetic_field", str, ok); if (ok) - cout << " (" << str << ")"; - cout << endl << " shape : " << fNxEntry1->GetSample()->GetShape(); - cout << endl << " mag.field state: " << fNxEntry1->GetSample()->GetMagneticFieldState(); - cout << endl << " environment : " << fNxEntry1->GetSample()->GetEnvironment(); + std::cout << " (" << str << ")"; + std::cout << std::endl << " shape : " << fNxEntry1->GetSample()->GetShape(); + std::cout << std::endl << " mag.field state: " << fNxEntry1->GetSample()->GetMagneticFieldState(); + std::cout << std::endl << " environment : " << fNxEntry1->GetSample()->GetEnvironment(); if (fNxEntry1->GetSample()->IsMagneticFieldVectorAvailable()) { - cout << endl << " magnetic field vector: "; + std::cout << std::endl << " magnetic field vector: "; for (unsigned int i=0; iGetSample()->GetMagneticFieldVector().size(); i++) { - cout << fNxEntry1->GetSample()->GetMagneticFieldVector().at(i) << ", "; + std::cout << fNxEntry1->GetSample()->GetMagneticFieldVector().at(i) << ", "; } - cout << "(" << fNxEntry1->GetSample()->GetMagneticFieldVectorUnits() << "), "; - cout << fNxEntry1->GetSample()->GetMagneticFieldVectorCoordinateSystem(); + std::cout << "(" << fNxEntry1->GetSample()->GetMagneticFieldVectorUnits() << "), "; + std::cout << fNxEntry1->GetSample()->GetMagneticFieldVectorCoordinateSystem(); } - cout << endl << "NXinstrument:"; - cout << endl << " name : " << fNxEntry1->GetInstrument()->GetName(); - cout << endl << " NXdetector:"; - cout << endl << " number of detectors: " << fNxEntry1->GetInstrument()->GetDetector()->GetNumber(); - cout << endl << " NXcollimator:"; - cout << endl << " type : " << fNxEntry1->GetInstrument()->GetCollimator()->GetType(); - cout << endl << " Nxbeam:"; - cout << endl << " total_counts : " << fNxEntry1->GetInstrument()->GetBeam()->GetTotalCounts() << " (" << fNxEntry1->GetInstrument()->GetBeam()->GetUnits() << ")"; - cout << endl << "NXdata:"; - cout << endl << " number of histos : " << fNxEntry1->GetData()->GetNoOfHistos(); - cout << endl << " time resolution : " << fNxEntry1->GetData()->GetTimeResolution("ns") << " (ns)"; + std::cout << std::endl << "NXinstrument:"; + std::cout << std::endl << " name : " << fNxEntry1->GetInstrument()->GetName(); + std::cout << std::endl << " NXdetector:"; + std::cout << std::endl << " number of detectors: " << fNxEntry1->GetInstrument()->GetDetector()->GetNumber(); + std::cout << std::endl << " NXcollimator:"; + std::cout << std::endl << " type : " << fNxEntry1->GetInstrument()->GetCollimator()->GetType(); + std::cout << std::endl << " Nxbeam:"; + std::cout << std::endl << " total_counts : " << fNxEntry1->GetInstrument()->GetBeam()->GetTotalCounts() << " (" << fNxEntry1->GetInstrument()->GetBeam()->GetUnits() << ")"; + std::cout << std::endl << "NXdata:"; + std::cout << std::endl << " number of histos : " << fNxEntry1->GetData()->GetNoOfHistos(); + std::cout << std::endl << " time resolution : " << fNxEntry1->GetData()->GetTimeResolution("ns") << " (ns)"; if (fNxEntry1->GetData()->GetGrouping()->size() != 0) { - cout << endl << " grouping : "; + std::cout << std::endl << " grouping : "; for (unsigned int i=0; iGetData()->GetGrouping()->size(); i++) { - cout << "(" << i << "/" << fNxEntry1->GetData()->GetGrouping()->at(i) << "), "; + std::cout << "(" << i << "/" << fNxEntry1->GetData()->GetGrouping()->at(i) << "), "; } } else { - cout << endl << " grouping : not available"; + std::cout << std::endl << " grouping : not available"; } if (fNxEntry1->GetData()->GetT0s()->size() == 0) { - cout << endl << " t0's : not available"; + std::cout << std::endl << " t0's : not available"; } else { - cout << endl << " t0's : "; + std::cout << std::endl << " t0's : "; for (unsigned int i=0; iGetData()->GetT0s()->size(); i++) { - cout << fNxEntry1->GetData()->GetT0(i) << ", "; + std::cout << fNxEntry1->GetData()->GetT0(i) << ", "; } } if (fNxEntry1->GetData()->GetFirstGoodBins()->size() == 0) { - cout << endl << " first good bins : not available"; + std::cout << std::endl << " first good bins : not available"; } else { - cout << endl << " first good bins : "; + std::cout << std::endl << " first good bins : "; for (unsigned int i=0; iGetData()->GetFirstGoodBins()->size(); i++) { - cout << fNxEntry1->GetData()->GetFirstGoodBin(i) << ", "; + std::cout << fNxEntry1->GetData()->GetFirstGoodBin(i) << ", "; } } if (fNxEntry1->GetData()->GetLastGoodBins()->size() == 0) { - cout << endl << " last good bins : not available"; + std::cout << std::endl << " last good bins : not available"; } else { - cout << endl << " last good bins : "; + std::cout << std::endl << " last good bins : "; for (unsigned int i=0; iGetData()->GetLastGoodBins()->size(); i++) { - cout << fNxEntry1->GetData()->GetLastGoodBin(i) << ", "; + std::cout << fNxEntry1->GetData()->GetLastGoodBin(i) << ", "; } } if (fNxEntry1->GetData()->GetNoOfHistos() == 0) { - cout << endl << " historgrams : not available"; + std::cout << std::endl << " historgrams : not available"; } else { - cout << endl << " historgrams : +++++++++++++"; + std::cout << std::endl << " historgrams : +++++++++++++"; for (unsigned int i=0; iGetData()->GetNoOfHistos(); i++) { - cout << endl << " histo " << i+1 << ": "; + std::cout << std::endl << " histo " << i+1 << ": "; for (unsigned int j=0; j<15; j++) { - cout << fNxEntry1->GetData()->GetHisto(i)->at(j) << ", "; + std::cout << fNxEntry1->GetData()->GetHisto(i)->at(j) << ", "; } - cout << "..."; + std::cout << "..."; } } if (fNxEntry1->GetData()->GetAlpha()->size() == 0) { - cout << endl << " alpha : not available"; + std::cout << std::endl << " alpha : not available"; } else { - cout << endl << " alpha : "; + std::cout << std::endl << " alpha : "; for (unsigned int i=0; iGetData()->GetAlpha()->size(); i++) - cout << "(" << fNxEntry1->GetData()->GetAlpha()->at(i).GetGroupFirst() << "/" << fNxEntry1->GetData()->GetAlpha()->at(i).GetGroupSecond() << "/" << fNxEntry1->GetData()->GetAlpha()->at(i).GetAlpha() << "), "; + std::cout << "(" << fNxEntry1->GetData()->GetAlpha()->at(i).GetGroupFirst() << "/" << fNxEntry1->GetData()->GetAlpha()->at(i).GetGroupSecond() << "/" << fNxEntry1->GetData()->GetAlpha()->at(i).GetAlpha() << "), "; } if (fGroupedHisto.size() == 0) { - cout << endl << " grouped historgrams : not available"; + std::cout << std::endl << " grouped historgrams : not available"; } else { - cout << endl << " grouped historgrams : +++++++++++++"; + std::cout << std::endl << " grouped historgrams : +++++++++++++"; for (unsigned int i=0; iGetDefinition(); + std::cout << std::endl << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; + std::cout << std::endl << "NXfile:"; + std::cout << std::endl << " file_name : " << fFileName; + std::cout << std::endl << " file_time : " << fFileTime; + std::cout << std::endl << " NeXus_version : " << fNeXusVersion; + std::cout << std::endl << " file format version : " << fFileFormatVersion; + std::cout << std::endl << " creator : " << fCreator; + std::cout << std::endl << "NXentry:"; + std::cout << std::endl << " idf version : " << fIdfVersion; + std::cout << std::endl << " definition : " << fNxEntry2->GetDefinition(); if (!fNxEntry2->GetProgramName().empty()) - cout << endl << " program name : " << fNxEntry2->GetProgramName() << ", version: " << fNxEntry2->GetProgramVersion(); - cout << endl << " run_number : " << fNxEntry2->GetRunNumber(); - cout << endl << " run_title : " << fNxEntry2->GetTitle(); - cout << endl << " start_time : " << fNxEntry2->GetStartTime(); - cout << endl << " end_time : " << fNxEntry2->GetStopTime(); - cout << endl << " exp.identifier : " << fNxEntry2->GetExperimentIdentifier(); - cout << endl << " NXuser:"; - cout << endl << " name : " << fNxEntry2->GetUser()->GetName(); - cout << endl << " NXsample:"; - cout << endl << " name : " << fNxEntry2->GetSample()->GetName(); - cout << endl << " description : " << fNxEntry2->GetSample()->GetDescription(); - cout << endl << " mag.field state : " << fNxEntry2->GetSample()->GetMagneticFieldState(); + std::cout << std::endl << " program name : " << fNxEntry2->GetProgramName() << ", version: " << fNxEntry2->GetProgramVersion(); + std::cout << std::endl << " run_number : " << fNxEntry2->GetRunNumber(); + std::cout << std::endl << " run_title : " << fNxEntry2->GetTitle(); + std::cout << std::endl << " start_time : " << fNxEntry2->GetStartTime(); + std::cout << std::endl << " end_time : " << fNxEntry2->GetStopTime(); + std::cout << std::endl << " exp.identifier : " << fNxEntry2->GetExperimentIdentifier(); + std::cout << std::endl << " NXuser:"; + std::cout << std::endl << " name : " << fNxEntry2->GetUser()->GetName(); + std::cout << std::endl << " NXsample:"; + std::cout << std::endl << " name : " << fNxEntry2->GetSample()->GetName(); + std::cout << std::endl << " description : " << fNxEntry2->GetSample()->GetDescription(); + std::cout << std::endl << " mag.field state : " << fNxEntry2->GetSample()->GetMagneticFieldState(); dval = fNxEntry2->GetSample()->GetPhysPropValue("temperature_1", ok); if (ok) - cout << endl << " temperature : " << dval; + std::cout << std::endl << " temperature : " << dval; fNxEntry2->GetSample()->GetPhysPropUnit("temperature_1", str, ok); if (ok) - cout << " (" << str << ")"; - cout << endl << " temp.environment : " << fNxEntry2->GetSample()->GetEnvironmentTemp(); + std::cout << " (" << str << ")"; + std::cout << std::endl << " temp.environment : " << fNxEntry2->GetSample()->GetEnvironmentTemp(); dval = fNxEntry2->GetSample()->GetPhysPropValue("magnetic_field_1", ok); if (ok) - cout << endl << " magnetic_field : " << dval; + std::cout << std::endl << " magnetic_field : " << dval; fNxEntry2->GetSample()->GetPhysPropUnit("magnetic_field_1", str, ok); if (ok) - cout << " (" << str << ")"; - cout << endl << " mag. field env. : " << fNxEntry2->GetSample()->GetEnvironmentField(); - cout << endl << " NXinstrument:"; - cout << endl << " name : " << fNxEntry2->GetInstrument()->GetName(); - cout << endl << " NXsource:"; - cout << endl << " name : " << fNxEntry2->GetInstrument()->GetSource()->GetName(); - cout << endl << " type : " << fNxEntry2->GetInstrument()->GetSource()->GetType(); - cout << endl << " probe : " << fNxEntry2->GetInstrument()->GetSource()->GetProbe(); - cout << endl << " NXbeamline:"; - cout << endl << " name : " << fNxEntry2->GetInstrument()->GetBeamline()->GetName(); - cout << endl << " NXdetector:"; - cout << endl << " description : " << fNxEntry2->GetInstrument()->GetDetector()->GetDescription(); - cout << endl << " time resolution : " << fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution("ns") << " (ns)"; + std::cout << " (" << str << ")"; + std::cout << std::endl << " mag. field env. : " << fNxEntry2->GetSample()->GetEnvironmentField(); + std::cout << std::endl << " NXinstrument:"; + std::cout << std::endl << " name : " << fNxEntry2->GetInstrument()->GetName(); + std::cout << std::endl << " NXsource:"; + std::cout << std::endl << " name : " << fNxEntry2->GetInstrument()->GetSource()->GetName(); + std::cout << std::endl << " type : " << fNxEntry2->GetInstrument()->GetSource()->GetType(); + std::cout << std::endl << " probe : " << fNxEntry2->GetInstrument()->GetSource()->GetProbe(); + std::cout << std::endl << " NXbeamline:"; + std::cout << std::endl << " name : " << fNxEntry2->GetInstrument()->GetBeamline()->GetName(); + std::cout << std::endl << " NXdetector:"; + std::cout << std::endl << " description : " << fNxEntry2->GetInstrument()->GetDetector()->GetDescription(); + std::cout << std::endl << " time resolution : " << fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution("ns") << " (ns)"; if (fNxEntry2->GetInstrument()->GetDetector()->IsT0Present()) { if (fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() == 1) { // only one t0 for all histograms - cout << endl << " t0 : " << fNxEntry2->GetInstrument()->GetDetector()->GetT0(); + std::cout << std::endl << " t0 : " << fNxEntry2->GetInstrument()->GetDetector()->GetT0(); } else if (fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() == 2) { // t0[ns] - cout << endl << " t0 (idx_s/t0) : "; + std::cout << std::endl << " t0 (idx_s/t0) : "; for (int i=0; iGetInstrument()->GetDetector()->GetNoOfSpectra(); i++) { - cout << "(" << i+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetT0(-1, i) << "), "; + std::cout << "(" << i+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetT0(-1, i) << "), "; } } else { // t0 vector of the form t0[np][ns] - cout << endl << " t0 (idx_p/idx_s/t0): "; + std::cout << std::endl << " t0 (idx_p/idx_s/t0): "; for (int i=0; iGetInstrument()->GetDetector()->GetNoOfPeriods(); i++) { for (int j=0; jGetInstrument()->GetDetector()->GetNoOfSpectra(); j++) { - cout << "(" << i+1 << "/" << j+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetT0(i,j) << "), "; + std::cout << "(" << i+1 << "/" << j+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetT0(i,j) << "), "; } } } } else { - cout << endl << " t0 : n/a"; + std::cout << std::endl << " t0 : n/a"; } if (fNxEntry2->GetInstrument()->GetDetector()->IsFirstGoodBinPresent()) { if (fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() == 1) { // only one fgb for all histograms - cout << endl << " first good bin : " << fNxEntry2->GetInstrument()->GetDetector()->GetFirstGoodBin(); + std::cout << std::endl << " first good bin : " << fNxEntry2->GetInstrument()->GetDetector()->GetFirstGoodBin(); } else if (fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() == 2) { // fgb[ns] - cout << endl << " fgb (idx_s/fgb) : "; + std::cout << std::endl << " fgb (idx_s/fgb) : "; for (int i=0; iGetInstrument()->GetDetector()->GetNoOfSpectra(); i++) { - cout << "(" << i+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetFirstGoodBin(-1,i) << ") , "; + std::cout << "(" << i+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetFirstGoodBin(-1,i) << ") , "; } } else { // fgb vector of the form fgb[np][ns] - cout << endl << " fgb (idx_p/idx_s/fgb): "; + std::cout << std::endl << " fgb (idx_p/idx_s/fgb): "; for (int i=0; iGetInstrument()->GetDetector()->GetNoOfPeriods(); i++) { for (int j=0; jGetInstrument()->GetDetector()->GetNoOfSpectra(); j++) { - cout << "(" << i+1 << "/" << j+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetFirstGoodBin(i,j); + std::cout << "(" << i+1 << "/" << j+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetFirstGoodBin(i,j); } } } } else { - cout << endl << " first good bin : n/a"; + std::cout << std::endl << " first good bin : n/a"; } if (fNxEntry2->GetInstrument()->GetDetector()->IsLastGoodBinPresent()) { if (fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() == 1) { // only one lgb for all histograms - cout << endl << " last good bin : " << fNxEntry2->GetInstrument()->GetDetector()->GetLastGoodBin(); + std::cout << std::endl << " last good bin : " << fNxEntry2->GetInstrument()->GetDetector()->GetLastGoodBin(); } else if (fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() == 2) { // lgb[ns] - cout << endl << " lgb (idx_s/lgb) : "; + std::cout << std::endl << " lgb (idx_s/lgb) : "; for (int i=0; iGetInstrument()->GetDetector()->GetNoOfSpectra(); i++) { - cout << "(" << i+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetLastGoodBin(-1,i) << "), "; + std::cout << "(" << i+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetLastGoodBin(-1,i) << "), "; } } else { // lgb vector of the form lgb[np][ns] - cout << endl << " lgb (idx_p/idx_s/lgb): "; + std::cout << std::endl << " lgb (idx_p/idx_s/lgb): "; for (int i=0; iGetInstrument()->GetDetector()->GetNoOfPeriods(); i++) { for (int j=0; jGetInstrument()->GetDetector()->GetNoOfSpectra(); j++) { - cout << "(" << i+1 << "/" << j+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetLastGoodBin(i,j) << "), "; + std::cout << "(" << i+1 << "/" << j+1 << "/" << fNxEntry2->GetInstrument()->GetDetector()->GetLastGoodBin(i,j) << "), "; } } } } else { - cout << endl << " last good bin : n/a"; + std::cout << std::endl << " last good bin : n/a"; } - cout << endl << " spectrum_index : "; + std::cout << std::endl << " spectrum_index : "; for (unsigned int i=0; iGetInstrument()->GetDetector()->GetSpectrumIndexSize(); i++) - cout << fNxEntry2->GetInstrument()->GetDetector()->GetSpectrumIndex(i) << ", "; + std::cout << fNxEntry2->GetInstrument()->GetDetector()->GetSpectrumIndex(i) << ", "; // dump data int maxDump = 15; - cout << endl << " counts : "; + std::cout << std::endl << " counts : "; if (fNxEntry2->GetInstrument()->GetDetector()->GetNoOfPeriods() > 0) { // counts[np][ns][ntc] for (int i=0; iGetInstrument()->GetDetector()->GetNoOfPeriods(); i++) { - cout << endl << " period : " << i+1; + std::cout << std::endl << " period : " << i+1; for (int j=0; jGetInstrument()->GetDetector()->GetNoOfSpectra(); j++) { - cout << endl << " spectrum : " << j+1 << ", (#bins=" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins() << ")"; + std::cout << std::endl << " spectrum : " << j+1 << ", (#bins=" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins() << ")"; if (maxDump > fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins()) maxDump = fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins(); - cout << endl << " "; + std::cout << std::endl << " "; for (int k=0; kGetInstrument()->GetDetector()->GetHistoValue(i,j,k) << ", "; + std::cout << fNxEntry2->GetInstrument()->GetDetector()->GetHistoValue(i,j,k) << ", "; } - cout << "..."; + std::cout << "..."; } } } else { if (fNxEntry2->GetInstrument()->GetDetector()->GetNoOfSpectra() > 0) { // counts[ns][ntc] for (int j=0; jGetInstrument()->GetDetector()->GetNoOfSpectra(); j++) { - cout << endl << " spectrum : " << j+1 << ", (#bins=" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins() << ")"; + std::cout << std::endl << " spectrum : " << j+1 << ", (#bins=" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins() << ")"; if (maxDump > fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins()) maxDump = fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins(); - cout << endl << " "; + std::cout << std::endl << " "; for (int k=0; kGetInstrument()->GetDetector()->GetHistoValue(0,j,k) << ", "; + std::cout << fNxEntry2->GetInstrument()->GetDetector()->GetHistoValue(0,j,k) << ", "; } - cout << "..."; + std::cout << "..."; } } else { // counts[ntc] - cout << endl << " (#bins=" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins() << ")"; + std::cout << std::endl << " (#bins=" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins() << ")"; if (maxDump > fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins()) maxDump = fNxEntry2->GetInstrument()->GetDetector()->GetNoOfBins(); - cout << endl << " "; + std::cout << std::endl << " "; for (int k=0; kGetInstrument()->GetDetector()->GetHistoValue(0,0,k) << ", "; + std::cout << fNxEntry2->GetInstrument()->GetDetector()->GetHistoValue(0,0,k) << ", "; } - cout << "..."; + std::cout << "..."; } } - cout << endl << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; - cout << endl << "that's all!"; - cout << endl << endl; + std::cout << std::endl << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; + std::cout << std::endl << "that's all!"; + std::cout << std::endl << std::endl; } } @@ -2450,12 +2449,12 @@ void PNeXus::Init() * \param errCode will set the fErrorCode of the class * \param errMsg will set the fErrorMsg of the class */ -bool PNeXus::ErrorHandler(NXstatus status, int errCode, const string &errMsg) +bool PNeXus::ErrorHandler(NXstatus status, int errCode, const std::string &errMsg) { if (status != NX_OK) { fErrorCode = errCode; fErrorMsg = errMsg; - cerr << endl << ">> **ERROR** " << fErrorMsg << endl; + std::cerr << std::endl << ">> **ERROR** " << fErrorMsg << std::endl; if (fFileHandle != 0) { NXclose(&fFileHandle); } @@ -2474,9 +2473,9 @@ bool PNeXus::ErrorHandler(NXstatus status, int errCode, const string &errMsg) * - NX_OK on success * - NX_ERROR otherwiese * - * \param str string to be fed + * \param str std::string to be fed */ -NXstatus PNeXus::GetStringData(string &str) +NXstatus PNeXus::GetStringData(std::string &str) { int i, status, rank, type, dims[32]; char cstr[1024]; @@ -2484,14 +2483,14 @@ NXstatus PNeXus::GetStringData(string &str) status = NXgetinfo(fFileHandle, &rank, dims, &type); if (status != NX_OK) { - cerr << endl << ">> **ERROR** in NXgetinfo: couldn't get meta info!" << endl; + std::cerr << std::endl << ">> **ERROR** in NXgetinfo: couldn't get meta info!" << std::endl; fErrorCode = PNEXUS_GET_META_INFO_ERROR; fErrorMsg = "PNeXus::GetStringData() **ERROR** couldn't get meta info!"; return NX_ERROR; } if ((type != NX_CHAR) || (rank > 1) || (dims[0] >= (int)sizeof(cstr))) { - cerr << endl << ">> **ERROR** in NXgetinfo: found wrong meta info!" << endl; + std::cerr << std::endl << ">> **ERROR** in NXgetinfo: found wrong meta info!" << std::endl; fErrorCode = PNEXUS_WRONG_META_INFO; fErrorMsg = "PNeXus::GetStringData() **ERROR** found wrong meta info!"; return NX_ERROR; @@ -2499,7 +2498,7 @@ NXstatus PNeXus::GetStringData(string &str) status = NXgetdata(fFileHandle, data_value); if (status != NX_OK) { - cerr << endl << ">> **ERROR** in routine NXgetdata: couldn't get data for '" << str << "'!" << endl; + std::cerr << std::endl << ">> **ERROR** in routine NXgetdata: couldn't get data for '" << str << "'!" << std::endl; fErrorCode = PNEXUS_GET_DATA_ERROR; fErrorMsg = "couldn't get data!"; return NX_ERROR; @@ -2525,9 +2524,9 @@ NXstatus PNeXus::GetStringData(string &str) * - NX_ERROR otherwiese * * \param attr attribute tag - * \param str string to be fed + * \param str std::string to be fed */ -NXstatus PNeXus::GetStringAttr(string attr, string &str) +NXstatus PNeXus::GetStringAttr(std::string attr, std::string &str) { int i, status, attlen, atttype; char cstr[VGNAMELENMAX]; @@ -2537,9 +2536,9 @@ NXstatus PNeXus::GetStringAttr(string attr, string &str) atttype = NX_CHAR; status = NXgetattr(fFileHandle, (char *)attr.c_str(), data_value, &attlen, &atttype); if (status != NX_OK) { - cerr << endl << ">> **ERROR** in routine NXgetattr: couldn't get attribute '" << attr << "'! status=" << status << endl << endl; + std::cerr << std::endl << ">> **ERROR** in routine NXgetattr: couldn't get attribute '" << attr << "'! status=" << status << std::endl << std::endl; fErrorCode = PNEXUS_GET_ATTR_ERROR; - fErrorMsg = "couldn't get string attribute data!"; + fErrorMsg = "couldn't get std::string attribute data!"; return NX_ERROR; } @@ -2616,7 +2615,7 @@ int PNeXus::GetDataSize(int type) * * \param data */ -NXstatus PNeXus::GetDoubleVectorData(vector &data) +NXstatus PNeXus::GetDoubleVectorData(std::vector &data) { // get information of the current nexus entity int rank, type, dims[32], size, noOfElements; @@ -2632,7 +2631,7 @@ NXstatus PNeXus::GetDoubleVectorData(vector &data) // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -2669,7 +2668,7 @@ NXstatus PNeXus::GetDoubleVectorData(vector &data) * * \param data */ -NXstatus PNeXus::GetIntVectorData(vector &data) +NXstatus PNeXus::GetIntVectorData(std::vector &data) { // get information of the current nexus entity int rank, type, dims[32], size, noOfElements; @@ -2685,7 +2684,7 @@ NXstatus PNeXus::GetIntVectorData(vector &data) // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -2722,7 +2721,7 @@ NXstatus PNeXus::GetIntVectorData(vector &data) */ int PNeXus::ReadFileIdf1() { - cout << endl << ">> reading NeXus IDF Version 1 file ..." << endl; + std::cout << std::endl << ">> reading NeXus IDF Version 1 file ..." << std::endl; // create first the necessary NXentry object for IDF Version 1 fNxEntry1 = new PNeXusEntry1(); @@ -2732,7 +2731,7 @@ int PNeXus::ReadFileIdf1() return NX_ERROR; } - string str; + std::string str; char cstr[128]; int ival; float fval; @@ -2757,21 +2756,21 @@ int PNeXus::ReadFileIdf1() atttype = NX_CHAR; status = NXgetattr(fFileHandle, nxAttrName, data_value, &attlen, &atttype); if (status == NX_OK) { - fFileFormatVersion = string(data_value); + fFileFormatVersion = std::string(data_value); } } else if (!strcmp(nxAttrName, "HDF5_Version")) { attlen = VGNAMELENMAX - 1; atttype = NX_CHAR; status = NXgetattr(fFileHandle, nxAttrName, data_value, &attlen, &atttype); if (status == NX_OK) { - fFileFormatVersion = string("HDF5: ")+string(data_value); + fFileFormatVersion = std::string("HDF5: ")+std::string(data_value); } } else if (!strcmp(nxAttrName, "XML_version")) { attlen = VGNAMELENMAX - 1; atttype = NX_CHAR; status = NXgetattr(fFileHandle, nxAttrName, data_value, &attlen, &atttype); if (status == NX_OK) { - fFileFormatVersion = string(data_value); + fFileFormatVersion = std::string(data_value); } } else if (!strcmp(nxAttrName, "file_name")) { if (!ErrorHandler(GetStringAttr("file_name", str), PNEXUS_GET_ATTR_ERROR, "couldn't read NXroot 'file_name' attribute!")) return NX_ERROR; @@ -2805,7 +2804,7 @@ int PNeXus::ReadFileIdf1() status = NXopengroup(fFileHandle, nxname, "NXentry"); if (status != NX_OK) { fErrorCode = PNEXUS_GROUP_OPEN_ERROR; - fErrorMsg = "PNeXus::ReadFile() **ERROR** Couldn't open the NeXus group '" + string(nxname) + "'!"; + fErrorMsg = "PNeXus::ReadFile() **ERROR** Couldn't open the NeXus group '" + std::string(nxname) + "'!"; return NX_ERROR; } @@ -2914,7 +2913,7 @@ int PNeXus::ReadFileIdf1() if (SearchInGroup("NXsample", "class", nxname, nxclass, dataType)) { if (!ErrorHandler(NXopengroup(fFileHandle, "sample", "NXsample"), PNEXUS_GROUP_OPEN_ERROR, "couldn't open NeXus subgroup 'sample'!")) return NX_ERROR; } else { - cout << endl << ">> **WARNING** unable to open subgroup NXsample, will try NXSample." << endl; + std::cout << std::endl << ">> **WARNING** unable to open subgroup NXsample, will try NXSample." << std::endl; if (!ErrorHandler(NXopengroup(fFileHandle, "sample", "NXSample"), PNEXUS_GROUP_OPEN_ERROR, "couldn't open NeXus subgroup 'sample'!")) return NX_ERROR; } @@ -2960,7 +2959,7 @@ int PNeXus::ReadFileIdf1() if (!ErrorHandler(NXgetattr(fFileHandle, cstr, &ival, &attLen, &attType), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'magnetic_field_vector available' data in sample group!")) return NX_ERROR; fNxEntry1->GetSample()->SetMagneticFieldVectorAvailable(ival); if (fNxEntry1->GetSample()->IsMagneticFieldVectorAvailable()) { - vector magVec; + std::vector magVec; if (!ErrorHandler(GetDoubleVectorData(magVec), PNEXUS_GET_DATA_ERROR, "couldn't get 'magnetic_field_vector' data!")) return NX_ERROR; fNxEntry1->GetSample()->SetMagneticFieldVector(magVec); magVec.clear(); @@ -2976,10 +2975,10 @@ int PNeXus::ReadFileIdf1() strncpy(cstr, data_value, sizeof(cstr)); str = cstr; } else { - str = string("Gauss"); + str = std::string("Gauss"); } } else { - str = string("Gauss"); + str = std::string("Gauss"); } fNxEntry1->GetSample()->SetMagneticFieldUnits(str); } @@ -3102,7 +3101,7 @@ int PNeXus::ReadFileIdf1() if (SearchAttrInData(cstr, attLen, attType)) { if (!ErrorHandler(NXgetattr(fFileHandle, cstr, &ival, &attLen, &attType), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'T0_bin' data in NXdata group!")) return NX_ERROR; } else { - cout << endl << ">> **WARNING** didn't find attribute 'T0_bin' in NXdata/counts, will try 't0_bin'." << endl; + std::cout << std::endl << ">> **WARNING** didn't find attribute 'T0_bin' in NXdata/counts, will try 't0_bin'." << std::endl; memset(cstr, '\0', sizeof(cstr)); strncpy(cstr, "t0_bin", sizeof(cstr)); if (!ErrorHandler(NXgetattr(fFileHandle, cstr, &ival, &attLen, &attType), PNEXUS_OPEN_DATA_ERROR, "couldn't open 't0_bin' data in NXdata group!")) return NX_ERROR; @@ -3140,7 +3139,7 @@ int PNeXus::ReadFileIdf1() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3160,7 +3159,7 @@ int PNeXus::ReadFileIdf1() // copy the data into the vector fNxEntry1->GetData()->FlushHistos(); - vector data; + std::vector data; for (int i=0; i0)) { fNxEntry1->GetData()->SetHisto(data); @@ -3188,7 +3187,7 @@ int PNeXus::ReadFileIdf1() strncpy(cstr, "available", sizeof(cstr)); if (!ErrorHandler(NXgetattr(fFileHandle, cstr, &ival, &attLen, &attType), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'grouping available' data in NXdata group!")) return NX_ERROR; if (ival) { - vector grouping; + std::vector grouping; if (!ErrorHandler(GetIntVectorData(grouping), PNEXUS_GET_DATA_ERROR, "couldn't read 'grouping' data in NXdata group!")) return NX_ERROR; fNxEntry1->GetData()->SetGrouping(grouping); grouping.clear(); @@ -3201,12 +3200,12 @@ int PNeXus::ReadFileIdf1() // check grouping vector for consistency if (fNxEntry1->GetData()->GetGrouping()->size() != fNxEntry1->GetData()->GetNoOfHistos()) { fNxEntry1->GetData()->FlushGrouping(); - cerr << endl << ">> **WARNING** grouping vector size (" << fNxEntry1->GetData()->GetGrouping()->size()<< ") != no of histograms (" << fNxEntry1->GetData()->GetNoOfHistos() << ") which doesn't make sence, hence grouping will be ignored." << endl; + std::cerr << std::endl << ">> **WARNING** grouping vector size (" << fNxEntry1->GetData()->GetGrouping()->size()<< ") != no of histograms (" << fNxEntry1->GetData()->GetNoOfHistos() << ") which doesn't make sence, hence grouping will be ignored." << std::endl; } // check that the grouping values do make sense, i.e. allowed range is grouping value > 0 and grouping value <= # of histos for (unsigned int i=0; iGetData()->GetGrouping()->size(); i++) { if ((fNxEntry1->GetData()->GetGrouping()->at(i) == 0) || (fNxEntry1->GetData()->GetGrouping()->at(i) > (int)fNxEntry1->GetData()->GetNoOfHistos())) { - cerr << endl << ">> **WARNING** found grouping entry '" << fNxEntry1->GetData()->GetGrouping()->at(i) << "' which doesn't make sense, hence grouping will be ignored." << endl; + std::cerr << std::endl << ">> **WARNING** found grouping entry '" << fNxEntry1->GetData()->GetGrouping()->at(i) << "' which doesn't make sense, hence grouping will be ignored." << std::endl; ok = false; break; } @@ -3235,13 +3234,13 @@ int PNeXus::ReadFileIdf1() if ((3*(noOfElements/3)-noOfElements) != 0) { fErrorCode = PNEXUS_GET_META_INFO_ERROR; fErrorMsg = "alpha NeXus structure (grp_1, grp_2, alpha_12, etc.) violation."; - cerr << endl << ">> **ERROR** " << fErrorMsg << endl; + std::cerr << std::endl << ">> **ERROR** " << fErrorMsg << std::endl; return NX_ERROR; } // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3255,7 +3254,7 @@ int PNeXus::ReadFileIdf1() // copy the data into the vector fNxEntry1->GetData()->FlushAlpha(); PNeXusAlpha1 alpha; - vector alphaVec; + std::vector alphaVec; for (int i=0; i> reading NeXus IDF Version 2 file ..." << endl; + std::cout << std::endl << ">> reading NeXus IDF Version 2 file ..." << std::endl; // create first the necessary NXentry object for IDF Version 2 fNxEntry2 = new PNeXusEntry2(); @@ -3312,7 +3311,7 @@ int PNeXus::ReadFileIdf2() return NX_ERROR; } - string str; + std::string str; int ival, attlen, atttype; float fval; NXname data_value, nxAttrName; @@ -3336,21 +3335,21 @@ int PNeXus::ReadFileIdf2() atttype = NX_CHAR; status = NXgetattr(fFileHandle, nxAttrName, data_value, &attlen, &atttype); if (status == NX_OK) { - fFileFormatVersion = string(data_value); + fFileFormatVersion = std::string(data_value); } } else if (!strcmp(nxAttrName, "HDF5_Version")) { attlen = VGNAMELENMAX - 1; atttype = NX_CHAR; status = NXgetattr(fFileHandle, nxAttrName, data_value, &attlen, &atttype); if (status == NX_OK) { - fFileFormatVersion = string("HDF5: ")+string(data_value); + fFileFormatVersion = std::string("HDF5: ")+std::string(data_value); } } else if (!strcmp(nxAttrName, "XML_version")) { attlen = VGNAMELENMAX - 1; atttype = NX_CHAR; status = NXgetattr(fFileHandle, nxAttrName, data_value, &attlen, &atttype); if (status == NX_OK) { - fFileFormatVersion = string(data_value); + fFileFormatVersion = std::string(data_value); } } else if (!strcmp(nxAttrName, "file_name")) { if (!ErrorHandler(GetStringAttr("file_name", str), PNEXUS_GET_ATTR_ERROR, "couldn't read NXroot 'file_name' attribute!")) return NX_ERROR; @@ -3389,7 +3388,7 @@ int PNeXus::ReadFileIdf2() status = NXopengroup(fFileHandle, nxname, "NXentry"); if (status != NX_OK) { fErrorCode = PNEXUS_GROUP_OPEN_ERROR; - fErrorMsg = "PNeXus::ReadFileIdf2() **ERROR** Couldn't open the NeXus group '" + string(nxname) + "'!"; + fErrorMsg = "PNeXus::ReadFileIdf2() **ERROR** Couldn't open the NeXus group '" + std::string(nxname) + "'!"; return NX_ERROR; } @@ -3451,7 +3450,7 @@ int PNeXus::ReadFileIdf2() status = NXopengroup(fFileHandle, nxname, "NXuser"); if (status != NX_OK) { fErrorCode = PNEXUS_GROUP_OPEN_ERROR; - fErrorMsg = "PNeXus::ReadFileIdf2() **ERROR** Couldn't open NXuser '" + string(nxname) + "' in NXentry!"; + fErrorMsg = "PNeXus::ReadFileIdf2() **ERROR** Couldn't open NXuser '" + std::string(nxname) + "' in NXentry!"; return NX_ERROR; } @@ -3608,7 +3607,7 @@ int PNeXus::ReadFileIdf2() fNxEntry2->GetInstrument()->GetDetector()->SetTimeResolution((double)fval, str); } else { // 3nd 'histogram_resolution' is not present, hence extract the time resolution from the 'raw_time' vector if (!ErrorHandler(NXopendata(fFileHandle, "raw_time"), PNEXUS_OPEN_DATA_ERROR, "couldn't open 'raw_time' data in NXdetector!")) return NX_ERROR; - vector rawTime; + std::vector rawTime; if (!ErrorHandler(GetDoubleVectorData(rawTime), PNEXUS_GET_DATA_ERROR, "couldn't get 'raw_time' data in NXdetector!")) return NX_ERROR; if (!ErrorHandler(GetStringAttr("units", str), PNEXUS_GET_ATTR_ERROR, "couldn't read 'raw_time' units in NXdetector!")) return NX_ERROR; if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'raw_time' data in NXdetector!")) return NX_ERROR; @@ -3630,7 +3629,7 @@ int PNeXus::ReadFileIdf2() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3657,19 +3656,19 @@ int PNeXus::ReadFileIdf2() fNxEntry2->GetInstrument()->GetDetector()->SetNoOfPeriods(-1); fNxEntry2->GetInstrument()->GetDetector()->SetNoOfSpectra(-1); fNxEntry2->GetInstrument()->GetDetector()->SetNoOfBins(-1); - cerr << endl << ">> **ERROR** found rank=" << rank << " for NXinstrument:NXdetector:counts! Allowed ranks are 1, 2, or 3." << endl; + std::cerr << std::endl << ">> **ERROR** found rank=" << rank << " for NXinstrument:NXdetector:counts! Allowed ranks are 1, 2, or 3." << std::endl; return NX_ERROR; } if (!fNxEntry2->GetInstrument()->GetDetector()->SetHistos(i_data_ptr)) { - cerr << endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << endl; + std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl; return NX_ERROR; } // clean up if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'counts' data in NXdetector!")) return NX_ERROR; @@ -3679,16 +3678,16 @@ int PNeXus::ReadFileIdf2() // check the dimensions of 'spectrum_index' if (!ErrorHandler(NXgetinfo(fFileHandle, &rank, dims, &type), PNEXUS_GET_META_INFO_ERROR, "couldn't get 'spectrum_index' info in NXdetector!")) return NX_ERROR; if (rank > 1) { - cerr << endl << ">> **ERROR** found rank=" << rank << " of spectrum_index in NXdetector. Rank needs to be == 1!" << endl; + std::cerr << std::endl << ">> **ERROR** found rank=" << rank << " of spectrum_index in NXdetector. Rank needs to be == 1!" << std::endl; return NX_ERROR; } if (dims[0] != fNxEntry2->GetInstrument()->GetDetector()->GetNoOfSpectra()) { - cerr << endl << ">> **ERROR** found spectrum_index dimension=" << dims[0] << " inconsistent with counts (" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfSpectra() << "!" << endl; + std::cerr << std::endl << ">> **ERROR** found spectrum_index dimension=" << dims[0] << " inconsistent with counts (" << fNxEntry2->GetInstrument()->GetDetector()->GetNoOfSpectra() << "!" << std::endl; return NX_ERROR; } // allocate locale memory to get the data data_ptr = new char[dims[0]*GetDataSize(type)]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } // get the data @@ -3703,7 +3702,7 @@ int PNeXus::ReadFileIdf2() // clean up if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'spectrum_index' data in NXdetector!")) return NX_ERROR; @@ -3722,7 +3721,7 @@ int PNeXus::ReadFileIdf2() } else if (rank == 2) { // t0 of the form t0[np][ns] fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(3); } else { - cerr << endl << ">> **ERROR** found 'time_zero_bin' info in NXdetector with rank=" << rank << ". Do not know how to handle." << endl; + std::cerr << std::endl << ">> **ERROR** found 'time_zero_bin' info in NXdetector with rank=" << rank << ". Do not know how to handle." << std::endl; return NX_ERROR; } @@ -3735,7 +3734,7 @@ int PNeXus::ReadFileIdf2() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3747,14 +3746,14 @@ int PNeXus::ReadFileIdf2() } if (!fNxEntry2->GetInstrument()->GetDetector()->SetT0(i_data_ptr)) { - cerr << endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << endl; + std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl; return NX_ERROR; } // clean up if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'time_zero_bin' data in NXdetector!")) return NX_ERROR; @@ -3770,7 +3769,7 @@ int PNeXus::ReadFileIdf2() } else if (rank == 2) { // t0 of the form t0[np][ns] fNxEntry2->GetInstrument()->GetDetector()->SetT0Tag(3); } else { - cerr << endl << ">> **ERROR** found 'time_zero' info in NXdetector with rank=" << rank << ". Do not know how to handle." << endl; + std::cerr << std::endl << ">> **ERROR** found 'time_zero' info in NXdetector with rank=" << rank << ". Do not know how to handle." << std::endl; return NX_ERROR; } @@ -3783,7 +3782,7 @@ int PNeXus::ReadFileIdf2() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3799,11 +3798,11 @@ int PNeXus::ReadFileIdf2() // Set T0's // check that the necessary time resolution is present if (fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str) == 0.0) { - cerr << endl << ">> **ERROR** trying to set T0's based on 'time_zero'. Need a valid time resolution to do so, but this is not given." << endl; + std::cerr << std::endl << ">> **ERROR** trying to set T0's based on 'time_zero'. Need a valid time resolution to do so, but this is not given." << std::endl; return NX_ERROR; } // set the t0's based on the t0 time stamp and the time resolution - int *pt0 = 0; + int *pt0 = nullptr; if (rank == 1) { pt0 = new int; *pt0 = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str)); @@ -3815,20 +3814,20 @@ int PNeXus::ReadFileIdf2() } if (!fNxEntry2->GetInstrument()->GetDetector()->SetT0(pt0)) { - cerr << endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << endl; + std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl; return NX_ERROR; } // clean up if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } - cerr << endl << ">> **WARNING** found only 'time_zero' will convert it to 'time_zero_bin' values" << endl; + std::cerr << std::endl << ">> **WARNING** found only 'time_zero' will convert it to 'time_zero_bin' values" << std::endl; if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'time_zero' data in NXdetector!")) return NX_ERROR; } else { - cerr << endl << ">> **WARNING** found neither 'time_zero_bin' nor 'time_zero' values ..." << endl; + std::cerr << std::endl << ">> **WARNING** found neither 'time_zero_bin' nor 'time_zero' values ..." << std::endl; } // handle first good bin @@ -3847,7 +3846,7 @@ int PNeXus::ReadFileIdf2() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3859,13 +3858,13 @@ int PNeXus::ReadFileIdf2() } if (!fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(i_data_ptr)) { - cerr << endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << endl; + std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl; return NX_ERROR; } if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'first_good_bin' data in NXdetector!")) return NX_ERROR; @@ -3884,7 +3883,7 @@ int PNeXus::ReadFileIdf2() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3896,7 +3895,7 @@ int PNeXus::ReadFileIdf2() } // set the fgb's based on the fgb time stamp and the time resolution - int *p_fgb = 0; + int *p_fgb = nullptr; if (rank == 1) { p_fgb = new int; *p_fgb = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str)); @@ -3908,7 +3907,7 @@ int PNeXus::ReadFileIdf2() } if (!fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(p_fgb)) { - cerr << endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << endl; + std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl; return NX_ERROR; } @@ -3919,12 +3918,12 @@ int PNeXus::ReadFileIdf2() } if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'first_good_time' data in NXdetector!")) return NX_ERROR; } else { - cerr << endl << ">> **WARNING** found neither 'first_good_bin' nor 'first_good_time' values ..." << endl; + std::cerr << std::endl << ">> **WARNING** found neither 'first_good_bin' nor 'first_good_time' values ..." << std::endl; } // handle last good bin @@ -3943,7 +3942,7 @@ int PNeXus::ReadFileIdf2() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3955,14 +3954,14 @@ int PNeXus::ReadFileIdf2() } if (!fNxEntry2->GetInstrument()->GetDetector()->SetLastGoodBin(i_data_ptr)) { - cerr << endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << endl; + std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl; return NX_ERROR; } // clean up if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'last_good_bin' data in NXdetector!")) return NX_ERROR; @@ -3981,7 +3980,7 @@ int PNeXus::ReadFileIdf2() // allocate locale memory to get the data char *data_ptr = new char[size]; - if (data_ptr == 0) { + if (data_ptr == nullptr) { return NX_ERROR; } @@ -3993,7 +3992,7 @@ int PNeXus::ReadFileIdf2() } // set the lgb's based on the lgb time stamp and the time resolution - int *p_lgb = 0; + int *p_lgb = nullptr; if (rank == 1) { p_lgb = new int; *p_lgb = (int)(*f_data_ptr / (float)fNxEntry2->GetInstrument()->GetDetector()->GetTimeResolution(str)); @@ -4005,7 +4004,7 @@ int PNeXus::ReadFileIdf2() } if (fNxEntry2->GetInstrument()->GetDetector()->SetFirstGoodBin(p_lgb)) { - cerr << endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << endl; + std::cerr << std::endl << ">> **ERROR** " << fNxEntry2->GetInstrument()->GetDetector()->GetErrorMsg() << std::endl; return NX_ERROR; } @@ -4016,12 +4015,12 @@ int PNeXus::ReadFileIdf2() } if (data_ptr) { delete [] data_ptr; - data_ptr = 0; + data_ptr = nullptr; } if (!ErrorHandler(NXclosedata(fFileHandle), PNEXUS_CLOSE_DATA_ERROR, "couldn't close 'last_good_time' data in NXdetector!")) return NX_ERROR; } else { - cerr << endl << ">> **WARNING** found neither 'last_good_bin' nor 'last_good_time' values ..." << endl; + std::cerr << std::endl << ">> **WARNING** found neither 'last_good_bin' nor 'last_good_time' values ..." << std::endl; } // close group NXdetector @@ -4066,7 +4065,7 @@ NXstatus PNeXus::GroupHistoData() } // make a vector of all grouping present - vector groupingValue; + std::vector groupingValue; bool newGroup = true; for (unsigned int i=0; iGetData()->GetGrouping()->size(); i++) { newGroup = true; @@ -4130,7 +4129,7 @@ NXstatus PNeXus::GroupHistoData() */ int PNeXus::WriteFileIdf1(const char* fileName, const NXaccess access) { - string str; + std::string str; char cstr[1204]; bool ok = false; int size, idata; @@ -4297,11 +4296,11 @@ int PNeXus::WriteFileIdf1(const char* fileName, const NXaccess access) size = 1; if (!ErrorHandler(NXmakedata(fFileHandle, "temperature", NX_FLOAT32, 1, &size), PNEXUS_MAKE_DATA_ERROR, "couldn't create data entry 'NXsample/temperature'.")) return NX_ERROR; if (!ErrorHandler(NXopendata(fFileHandle, "temperature"), PNEXUS_OPEN_DATA_ERROR, "couldn't open data 'NXsample/temperature' for writting.")) return NX_ERROR; - fdata = (float)fNxEntry1->GetSample()->GetPhysPropValue(string("temperature"), ok); + fdata = (float)fNxEntry1->GetSample()->GetPhysPropValue(std::string("temperature"), ok); if (!ErrorHandler(NXputdata(fFileHandle, &fdata), PNEXUS_PUT_DATA_ERROR, "couldn't put data 'NXsample/temperature'.")) return NX_ERROR; memset(cstr, '\0', sizeof(cstr)); - str = string("n/a"); - fNxEntry1->GetSample()->GetPhysPropUnit(string("temperature"), str, ok); + str = std::string("n/a"); + fNxEntry1->GetSample()->GetPhysPropUnit(std::string("temperature"), str, ok); strncpy(cstr, str.c_str(), sizeof(cstr)); if (!ErrorHandler(NXputattr(fFileHandle, "units", cstr, strlen(cstr), NX_CHAR), PNEXUS_PUT_ATTR_ERROR, "couldn't put attribute 'units' for 'NXsample/temperature'")) return NX_ERROR; NXclosedata(fFileHandle); @@ -4310,11 +4309,11 @@ int PNeXus::WriteFileIdf1(const char* fileName, const NXaccess access) size = 1; if (!ErrorHandler(NXmakedata(fFileHandle, "magnetic_field", NX_FLOAT32, 1, &size), PNEXUS_MAKE_DATA_ERROR, "couldn't create data entry 'NXsample/magnetic_field'.")) return NX_ERROR; if (!ErrorHandler(NXopendata(fFileHandle, "magnetic_field"), PNEXUS_OPEN_DATA_ERROR, "couldn't open data 'NXsample/magnetic_field' for writting.")) return NX_ERROR; - fdata = (float)fNxEntry1->GetSample()->GetPhysPropValue(string("magnetic_field"), ok); + fdata = (float)fNxEntry1->GetSample()->GetPhysPropValue(std::string("magnetic_field"), ok); if (!ErrorHandler(NXputdata(fFileHandle, &fdata), PNEXUS_PUT_DATA_ERROR, "couldn't put data 'NXsample/magnetic_field'.")) return NX_ERROR; memset(cstr, '\0', sizeof(cstr)); - str = string("n/a"); - fNxEntry1->GetSample()->GetPhysPropUnit(string("magnetic_field"), str, ok); + str = std::string("n/a"); + fNxEntry1->GetSample()->GetPhysPropUnit(std::string("magnetic_field"), str, ok); memset(cstr, '\0', sizeof(cstr)); strncpy(cstr, str.c_str(), sizeof(cstr)); if (!ErrorHandler(NXputattr(fFileHandle, "units", cstr, strlen(cstr), NX_CHAR), PNEXUS_PUT_ATTR_ERROR, "couldn't put attribute 'units' for 'NXsample/magnetic_field'")) return NX_ERROR; @@ -4576,7 +4575,7 @@ int PNeXus::WriteFileIdf1(const char* fileName, const NXaccess access) // write data 'grouping' int *grouping = new int[noOfHistos]; - vector groupNo; // keep the number of different groupings + std::vector groupNo; // keep the number of different groupings if (noOfHistos == (int)fNxEntry1->GetData()->GetGrouping()->size()) { // grouping vector seems to be properly defined bool found; groupNo.push_back(fNxEntry1->GetData()->GetGrouping()->at(0)); @@ -4666,14 +4665,14 @@ int PNeXus::WriteFileIdf1(const char* fileName, const NXaccess access) */ int PNeXus::WriteFileIdf2(const char* fileName, const NXaccess access) { - string str; + std::string str; char cstr[1204]; bool ok = false; int size, idata; float fdata; double dval; NXlink nxLink; - vector nxLinkVec; + std::vector nxLinkVec; memset(cstr, '\0', sizeof(cstr)); snprintf(cstr, sizeof(cstr), "couldn't open file '%s' for writing", fileName); @@ -5113,7 +5112,7 @@ int PNeXus::WriteFileIdf2(const char* fileName, const NXaccess access) if (!ErrorHandler(NXputdata(fFileHandle, (void*)fNxEntry2->GetInstrument()->GetDetector()->GetT0s()), PNEXUS_PUT_DATA_ERROR, "couldn't put data 'time_zero_bin' in NXdetector.")) return NX_ERROR; NXclosedata(fFileHandle); } else { - cerr << endl << ">> **WARNING** time_zero_bin with rank " << fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() << " requested. Do not know how to handle." << endl; + std::cerr << std::endl << ">> **WARNING** time_zero_bin with rank " << fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() << " requested. Do not know how to handle." << std::endl; } } @@ -5142,7 +5141,7 @@ int PNeXus::WriteFileIdf2(const char* fileName, const NXaccess access) if (!ErrorHandler(NXputdata(fFileHandle, (void*)fNxEntry2->GetInstrument()->GetDetector()->GetFirstGoodBins()), PNEXUS_PUT_DATA_ERROR, "couldn't put data 'first_good_bin' in NXdetector.")) return NX_ERROR; NXclosedata(fFileHandle); } else { - cerr << endl << ">> **WARNING** first_good_bin with rank " << fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() << " requested. Do not know how to handle." << endl; + std::cerr << std::endl << ">> **WARNING** first_good_bin with rank " << fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() << " requested. Do not know how to handle." << std::endl; } } @@ -5171,7 +5170,7 @@ int PNeXus::WriteFileIdf2(const char* fileName, const NXaccess access) if (!ErrorHandler(NXputdata(fFileHandle, (void*)fNxEntry2->GetInstrument()->GetDetector()->GetLastGoodBins()), PNEXUS_PUT_DATA_ERROR, "couldn't put data 'last_good_bin' in NXdetector.")) return NX_ERROR; NXclosedata(fFileHandle); } else { - cerr << endl << ">> **WARNING** last_good_bin with rank " << fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() << " requested. Do not know how to handle." << endl; + std::cerr << std::endl << ">> **WARNING** last_good_bin with rank " << fNxEntry2->GetInstrument()->GetDetector()->GetT0Tag() << " requested. Do not know how to handle." << std::endl; } } @@ -5187,7 +5186,7 @@ int PNeXus::WriteFileIdf2(const char* fileName, const NXaccess access) if (!ErrorHandler(NXopengroup(fFileHandle, "detector_1", "NXdata"), PNEXUS_GROUP_OPEN_ERROR, "couldn't open group 'detector_1' in NXroot.")) return NX_ERROR; for (unsigned int i=0; i> **ERROR** wrong IDF version found, namely IDF " << fIdfVersion << ", instead of IDF 1" << endl; + std::cerr << std::endl << ">> **ERROR** wrong IDF version found, namely IDF " << fIdfVersion << ", instead of IDF 1" << std::endl; return false; } @@ -5247,34 +5246,34 @@ bool PNeXus::IsValidIdf1(bool strict) bool PNeXus::IsValidIdf2(bool strict) { if (fIdfVersion != 2) { - cerr << endl << ">> **ERROR** wrong IDF version found, namely IDF " << fIdfVersion << ", instead of IDF 2" << endl; + std::cerr << std::endl << ">> **ERROR** wrong IDF version found, namely IDF " << fIdfVersion << ", instead of IDF 2" << std::endl; return false; } if (!fCreator.compare("n/a")) { if (strict) { - cerr << endl << ">> **ERROR** creator not set." << endl; + std::cerr << std::endl << ">> **ERROR** creator not set." << std::endl; return false; } else { - cerr << endl << ">> **WARNING** creator not set." << endl; + std::cerr << std::endl << ">> **WARNING** creator not set." << std::endl; } } if (!fFileName.compare("n/a")) { if (strict) { - cerr << endl << ">> **ERROR** file name not given." << endl; + std::cerr << std::endl << ">> **ERROR** file name not given." << std::endl; return false; } else { - cerr << endl << ">> **WARNING** file name not given." << endl; + std::cerr << std::endl << ">> **WARNING** file name not given." << std::endl; } } if (!fFileTime.compare("n/a")) { if (strict) { - cerr << endl << ">> **ERROR** no file creation time is given." << endl; + std::cerr << std::endl << ">> **ERROR** no file creation time is given." << std::endl; return false; } else { - cerr << endl << ">> **WARNING** no file creation time is given." << endl; + std::cerr << std::endl << ">> **WARNING** no file creation time is given." << std::endl; } } @@ -5302,7 +5301,7 @@ bool PNeXus::IsValidIdf2(bool strict) * \param nxclass 'class name' of the entry if entry is found * \param dataType of the entry if entry is found */ -bool PNeXus::SearchInGroup(string str, string tag, NXname &nxname, NXname &nxclass, int &dataType) +bool PNeXus::SearchInGroup(std::string str, std::string tag, NXname &nxname, NXname &nxclass, int &dataType) { bool found = false; int status; @@ -5321,7 +5320,7 @@ bool PNeXus::SearchInGroup(string str, string tag, NXname &nxname, NXname &nxcla break; } } else { - cerr << endl << ">> **ERROR** found tag='" << tag << "' which is not handled!" << endl; + std::cerr << std::endl << ">> **ERROR** found tag='" << tag << "' which is not handled!" << std::endl; break; } } while (!found && (status == NX_OK)); @@ -5343,7 +5342,7 @@ bool PNeXus::SearchInGroup(string str, string tag, NXname &nxname, NXname &nxcla * \param length of the attribute data it entry is found * \param dataType of the entry if entry is found */ -bool PNeXus::SearchAttrInData(string str, int &length, int &dataType) +bool PNeXus::SearchAttrInData(std::string str, int &length, int &dataType) { bool found = false; int status; diff --git a/src/external/nexus/PNeXus.h b/src/external/nexus/PNeXus.h index e93378f2..31a3be14 100644 --- a/src/external/nexus/PNeXus.h +++ b/src/external/nexus/PNeXus.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2014 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 * @@ -32,7 +32,6 @@ #include #include -using namespace std; #include "napi.h" @@ -75,18 +74,18 @@ class PNeXusProp { PNeXusProp(); virtual ~PNeXusProp() {} - virtual string GetName() { return fName; } + virtual std::string GetName() { return fName; } virtual double GetValue() { return fValue; } - virtual string GetUnit() { return fUnit; } + virtual std::string GetUnit() { return fUnit; } - virtual void SetName(string name) { fName = name; } + virtual void SetName(std::string name) { fName = name; } virtual void SetValue(double val) { fValue = val; } - virtual void SetUnit(string unit) { fUnit = unit; } + virtual void SetUnit(std::string unit) { fUnit = unit; } private: - string fName; + std::string fName; double fValue; - string fUnit; + std::string fUnit; }; class PNeXusBeam1 { @@ -97,14 +96,14 @@ class PNeXusBeam1 { virtual bool IsValid(bool strict); virtual double GetTotalCounts() { return fTotalCounts; } - virtual string GetUnits() { return fUnits; } + virtual std::string GetUnits() { return fUnits; } virtual void SetTotalCounts(double counts) { fTotalCounts = counts; } - virtual void SetUnits(string units) { fUnits = units; } + virtual void SetUnits(std::string units) { fUnits = units; } private: double fTotalCounts; ///< total number of counts - string fUnits; ///< 'units' in which total counts is given, e.g. 'Mev' + std::string fUnits; ///< 'units' in which total counts is given, e.g. 'Mev' }; class PNeXusCollimator1 { @@ -114,11 +113,11 @@ class PNeXusCollimator1 { virtual bool IsValid(bool strict) { return true; } // currently only a dummy - virtual string GetType() { return fType; } - virtual void SetType(string type) { fType = type; } + virtual std::string GetType() { return fType; } + virtual void SetType(std::string type) { fType = type; } private: - string fType; + std::string fType; }; class PNeXusDetector1 { @@ -142,18 +141,18 @@ class PNeXusInstrument1 { virtual bool IsValid(bool strict); - virtual string GetName() { return fName; } + virtual std::string GetName() { return fName; } virtual PNeXusDetector1* GetDetector() { return &fDetector; } virtual PNeXusCollimator1* GetCollimator() { return &fCollimator; } virtual PNeXusBeam1* GetBeam() { return &fBeam; } - virtual void SetName(string name) { fName = name; } + virtual void SetName(std::string name) { fName = name; } virtual void SetDetector(PNeXusDetector1 &detector) { fDetector = detector; } virtual void SetCollimator(PNeXusCollimator1 &collimator) { fCollimator = collimator; } virtual void SetBeam(PNeXusBeam1 &beam) { fBeam = beam; } private: - string fName; ///< instrument name + std::string fName; ///< instrument name PNeXusDetector1 fDetector; PNeXusCollimator1 fCollimator; PNeXusBeam1 fBeam; @@ -166,38 +165,38 @@ class PNeXusSample1 { virtual bool IsValid(bool strict); - virtual string GetName() { return fName; } - virtual string GetShape() { return fShape; } - virtual string GetMagneticFieldState() { return fMagneticFieldState; } - virtual string GetEnvironment() { return fEnvironment; } - virtual double GetPhysPropValue(string name, bool &ok); - virtual void GetPhysPropUnit(string name, string &unit, bool &ok); + virtual std::string GetName() { return fName; } + virtual std::string GetShape() { return fShape; } + virtual std::string GetMagneticFieldState() { return fMagneticFieldState; } + virtual std::string GetEnvironment() { return fEnvironment; } + virtual double GetPhysPropValue(std::string name, bool &ok); + virtual void GetPhysPropUnit(std::string name, std::string &unit, bool &ok); virtual int IsMagneticFieldVectorAvailable() { return fMagneticFieldVectorAvailable; } - virtual vector GetMagneticFieldVector() { return fMagneticFieldVector; } - virtual string GetMagneticFieldVectorUnits() { return fMagneticFieldVectorUnits; } - virtual string GetMagneticFieldVectorCoordinateSystem() { return fMagneticFieldVectorCoordinateSystem; } + virtual std::vector GetMagneticFieldVector() { return fMagneticFieldVector; } + virtual std::string GetMagneticFieldVectorUnits() { return fMagneticFieldVectorUnits; } + virtual std::string GetMagneticFieldVectorCoordinateSystem() { return fMagneticFieldVectorCoordinateSystem; } - virtual void SetName(string name) { fName = name; } - virtual void SetShape(string shape) { fShape = shape; } - virtual void SetMagneticFieldState(string magFieldState) { fMagneticFieldState = magFieldState; } - virtual void SetEnvironment(string env) { fEnvironment = env; } - virtual void SetPhysProp(string name, double value, string unit, int idx=-1); + virtual void SetName(std::string name) { fName = name; } + virtual void SetShape(std::string shape) { fShape = shape; } + virtual void SetMagneticFieldState(std::string magFieldState) { fMagneticFieldState = magFieldState; } + virtual void SetEnvironment(std::string env) { fEnvironment = env; } + virtual void SetPhysProp(std::string name, double value, std::string unit, int idx=-1); virtual void SetMagneticFieldVectorAvailable(int avail) { fMagneticFieldVectorAvailable = avail; } - virtual void SetMagneticFieldVector(vector &magVec) { fMagneticFieldVector = magVec; } - virtual void SetMagneticFieldVectorCoordinateSystem(string coord) { fMagneticFieldVectorCoordinateSystem = coord; } - virtual void SetMagneticFieldUnits(string units) { fMagneticFieldVectorUnits = units; } + virtual void SetMagneticFieldVector(std::vector &magVec) { fMagneticFieldVector = magVec; } + virtual void SetMagneticFieldVectorCoordinateSystem(std::string coord) { fMagneticFieldVectorCoordinateSystem = coord; } + virtual void SetMagneticFieldUnits(std::string units) { fMagneticFieldVectorUnits = units; } private: - string fName; ///< sample name - string fShape; ///< sample orientation - string fMagneticFieldState; ///< magnetic field state, e.g. TF, ZF, ... - string fEnvironment; ///< sample environment, e.g. CCR, Konti-1, ... - vector fPhysProp; ///< collects the temperature, magnetic field + std::string fName; ///< sample name + std::string fShape; ///< sample orientation + std::string fMagneticFieldState; ///< magnetic field state, e.g. TF, ZF, ... + std::string fEnvironment; ///< sample environment, e.g. CCR, Konti-1, ... + std::vector fPhysProp; ///< collects the temperature, magnetic field int fMagneticFieldVectorAvailable; ///< flag '0' magnetic field vector not available, '1' magnetic field vector available - vector fMagneticFieldVector; ///< magnetic field vector - string fMagneticFieldVectorUnits; ///< units in which the magnetic field vector is given - string fMagneticFieldVectorCoordinateSystem; ///< coordinate system, e.g. 'cartesian' + std::vector fMagneticFieldVector; ///< magnetic field vector + std::string fMagneticFieldVectorUnits; ///< units in which the magnetic field vector is given + std::string fMagneticFieldVectorCoordinateSystem; ///< coordinate system, e.g. 'cartesian' }; class PNeXusUser1 { @@ -207,15 +206,15 @@ class PNeXusUser1 { virtual bool IsValid(bool strict) { return true; } // currently only a dummy - virtual string GetName() { return fName; } - virtual string GetExperimentNumber() { return fExperimentNumber; } + virtual std::string GetName() { return fName; } + virtual std::string GetExperimentNumber() { return fExperimentNumber; } - virtual void SetName(string name) { fName = name; } - virtual void SetExperimentNumber(string expNum) { fExperimentNumber = expNum; } + virtual void SetName(std::string name) { fName = name; } + virtual void SetExperimentNumber(std::string expNum) { fExperimentNumber = expNum; } private: - string fName; ///< user name - string fExperimentNumber; ///< experiment number, RB number at ISIS + std::string fName; ///< user name + std::string fExperimentNumber; ///< experiment number, RB number at ISIS }; class PNeXusAlpha1 { @@ -244,41 +243,41 @@ class PNeXusData1 { virtual bool IsValid(bool strict); - virtual double GetTimeResolution(string units); - virtual vector *GetT0s() { return &fT0; } + virtual double GetTimeResolution(std::string units); + virtual std::vector *GetT0s() { return &fT0; } virtual int GetT0(unsigned int idx); - virtual vector *GetFirstGoodBins() { return &fFirstGoodBin; } + virtual std::vector *GetFirstGoodBins() { return &fFirstGoodBin; } virtual int GetFirstGoodBin(unsigned int idx); - virtual vector *GetLastGoodBins() { return &fLastGoodBin; } + virtual std::vector *GetLastGoodBins() { return &fLastGoodBin; } virtual int GetLastGoodBin(unsigned int idx); - virtual vector *GetHistoNames() { return &fHistoName; } - virtual void GetHistoName(unsigned int idx, string &name, bool &ok); + virtual std::vector *GetHistoNames() { return &fHistoName; } + virtual void GetHistoName(unsigned int idx, std::string &name, bool &ok); virtual unsigned int GetNoOfHistos() { return fHisto.size(); } virtual unsigned int GetHistoLength(unsigned int histoNo=0); - virtual vector *GetHisto(unsigned int histoNo); - virtual vector *GetGrouping() { return &fGrouping; } - virtual vector *GetAlpha() { return &fAlpha; } + virtual std::vector *GetHisto(unsigned int histoNo); + virtual std::vector *GetGrouping() { return &fGrouping; } + virtual std::vector *GetAlpha() { return &fAlpha; } - virtual void SetTimeResolution(double val, string units); + virtual void SetTimeResolution(double val, std::string units); virtual void SetT0(unsigned int t0, int idx=-1); virtual void SetFirstGoodBin(unsigned int fgb, int idx=-1); virtual void SetLastGoodBin(unsigned int lgb, int idx=-1); virtual void FlushHistos(); - virtual void SetHisto(vector &data, int histoNo=-1); + virtual void SetHisto(std::vector &data, int histoNo=-1); virtual void FlushGrouping() { fGrouping.clear(); } - virtual void SetGrouping(vector &grouping) { fGrouping = grouping; } + virtual void SetGrouping(std::vector &grouping) { fGrouping = grouping; } virtual void FlushAlpha() { fAlpha.clear(); } - virtual void SetAlpha(vector &alpha) { fAlpha = alpha; } + virtual void SetAlpha(std::vector &alpha) { fAlpha = alpha; } private: double fTimeResolution; ///< time resolution in (ps) - vector fT0; - vector fFirstGoodBin; - vector fLastGoodBin; - vector fHistoName; - vector< vector > fHisto; - vector fGrouping; - vector fAlpha; + std::vector fT0; + std::vector fFirstGoodBin; + std::vector fLastGoodBin; + std::vector fHistoName; + std::vector< std::vector > fHisto; + std::vector fGrouping; + std::vector fAlpha; }; class PNeXusEntry1 { @@ -288,32 +287,32 @@ class PNeXusEntry1 { virtual bool IsValid(bool strict); - virtual string GetProgramName() { return fProgramName; } - virtual string GetProgramVersion() { return fProgramVersion; } + virtual std::string GetProgramName() { return fProgramName; } + virtual std::string GetProgramVersion() { return fProgramVersion; } virtual int GetRunNumber() { return fRunNumber; } - virtual string GetTitle() { return fTitle; } - virtual string GetNotes() { return fNotes; } - virtual string GetAnalysis() { return fAnalysis; } - virtual string GetLaboratory() { return fLaboratory; } - virtual string GetBeamline() { return fBeamline; } - virtual string GetStartTime() { return fStartTime; } - virtual string GetStopTime() { return fStopTime; } + virtual std::string GetTitle() { return fTitle; } + virtual std::string GetNotes() { return fNotes; } + virtual std::string GetAnalysis() { return fAnalysis; } + virtual std::string GetLaboratory() { return fLaboratory; } + virtual std::string GetBeamline() { return fBeamline; } + virtual std::string GetStartTime() { return fStartTime; } + virtual std::string GetStopTime() { return fStopTime; } virtual int GetSwitchingState() { return fSwitchingState; } virtual PNeXusUser1* GetUser() { return &fUser; } virtual PNeXusSample1* GetSample() { return &fSample; } virtual PNeXusInstrument1* GetInstrument() { return &fInstrument; } virtual PNeXusData1* GetData() { return &fData; } - virtual void SetProgramName(string name) { fProgramName = name; } - virtual void SetProgramVersion(string version) { fProgramVersion = version; } + virtual void SetProgramName(std::string name) { fProgramName = name; } + virtual void SetProgramVersion(std::string version) { fProgramVersion = version; } virtual void SetRunNumber(int number) { fRunNumber = number; } - virtual void SetTitle(string title) { fTitle = title; } - virtual void SetNotes(string notes) { fNotes = notes; } - virtual void SetAnalysis(string analysis) { fAnalysis = analysis; } - virtual void SetLaboratory(string lab) { fLaboratory = lab; } - virtual void SetBeamline(string beamline) { fBeamline = beamline; } - virtual int SetStartTime(string time); - virtual int SetStopTime(string time); + virtual void SetTitle(std::string title) { fTitle = title; } + virtual void SetNotes(std::string notes) { fNotes = notes; } + virtual void SetAnalysis(std::string analysis) { fAnalysis = analysis; } + virtual void SetLaboratory(std::string lab) { fLaboratory = lab; } + virtual void SetBeamline(std::string beamline) { fBeamline = beamline; } + virtual int SetStartTime(std::string time); + virtual int SetStopTime(std::string time); virtual int SetSwitchingState(int state); virtual void SetUser(PNeXusUser1 &user) { fUser = user; } virtual void SetSample(PNeXusSample1 &sample) { fSample = sample; } @@ -321,16 +320,16 @@ class PNeXusEntry1 { virtual void SetData(PNeXusData1 &data) { fData = data; } private: - string fProgramName; ///< name of the creating program - string fProgramVersion; ///< version of the creating program + std::string fProgramName; ///< name of the creating program + std::string fProgramVersion; ///< version of the creating program int fRunNumber; ///< run number - string fTitle; ///< string containing the run title - string fNotes; ///< comments - string fAnalysis; ///< type of muon experiment "muonTD", "ALC", ... - string fLaboratory; ///< name of the laboratory where the data are taken, e.g. PSI, triumf, ISIS, J-Parc - string fBeamline; ///< name of the beamline used for the experiment, e.g. muE4 - string fStartTime; ///< start date/time of the run - string fStopTime; ///< stop date/time of the run + std::string fTitle; ///< string containing the run title + std::string fNotes; ///< comments + std::string fAnalysis; ///< type of muon experiment "muonTD", "ALC", ... + std::string fLaboratory; ///< name of the laboratory where the data are taken, e.g. PSI, triumf, ISIS, J-Parc + std::string fBeamline; ///< name of the beamline used for the experiment, e.g. muE4 + std::string fStartTime; ///< start date/time of the run + std::string fStopTime; ///< stop date/time of the run int fSwitchingState; ///< '1' normal data collection, '2' Red/Green mode PNeXusUser1 fUser; ///< NXuser info IDF Version 1 PNeXusSample1 fSample; ///< NXsample info IDF Version 1 @@ -345,18 +344,18 @@ class PNeXusSource2 { virtual bool IsValid(bool strict); - virtual string GetName() { return fName; } - virtual string GetType() { return fType; } - virtual string GetProbe() { return fProbe; } + virtual std::string GetName() { return fName; } + virtual std::string GetType() { return fType; } + virtual std::string GetProbe() { return fProbe; } - virtual void SetName(string name) { fName = name; } - virtual void SetType(string type) { fType = type; } - virtual void SetProbe(string probe) { fProbe = probe; } + virtual void SetName(std::string name) { fName = name; } + virtual void SetType(std::string type) { fType = type; } + virtual void SetProbe(std::string probe) { fProbe = probe; } private: - string fName; ///< facility name - string fType; ///< continous muon source, pulsed muon source, low energy muon source, ... - string fProbe; ///< positive muon, negative muon + std::string fName; ///< facility name + std::string fType; ///< continous muon source, pulsed muon source, low energy muon source, ... + std::string fProbe; ///< positive muon, negative muon }; class PNeXusBeamline2 { @@ -366,12 +365,12 @@ class PNeXusBeamline2 { virtual bool IsValid(bool strict); - virtual string GetName() { return fName; } + virtual std::string GetName() { return fName; } - virtual void SetName(string name) { fName = name; } + virtual void SetName(std::string name) { fName = name; } private: - string fName; + std::string fName; }; class PNeXusDetector2 { @@ -380,21 +379,21 @@ class PNeXusDetector2 { virtual ~PNeXusDetector2(); virtual bool IsValid(bool strict); - virtual string GetErrorMsg() { return fErrorMsg; } + virtual std::string GetErrorMsg() { return fErrorMsg; } - virtual string GetDescription() { return fDescription; } - virtual double GetTimeResolution(string units); - virtual vector *GetRawTime() { return &fRawTime; } - virtual string GetRawTimeName() { return fRawTimeName; } - virtual string GetRawTimeUnit() { return fRawTimeUnit; } - virtual bool IsT0Present() { return (fT0 == 0) ? false : true; } + virtual std::string GetDescription() { return fDescription; } + virtual double GetTimeResolution(std::string units); + virtual std::vector *GetRawTime() { return &fRawTime; } + virtual std::string GetRawTimeName() { return fRawTimeName; } + virtual std::string GetRawTimeUnit() { return fRawTimeUnit; } + virtual bool IsT0Present() { return (fT0 == nullptr) ? false : true; } virtual int GetT0Tag() { return fT0Tag; } virtual int GetT0(int idxp=-1, int idxs=-1); virtual int* GetT0s() { return fT0; } - virtual bool IsFirstGoodBinPresent() { return (fFirstGoodBin == 0) ? false : true; } + virtual bool IsFirstGoodBinPresent() { return (fFirstGoodBin == nullptr) ? false : true; } virtual int GetFirstGoodBin(int idxp=-1, int idxs=-1); virtual int* GetFirstGoodBins() { return fFirstGoodBin; } - virtual bool IsLastGoodBinPresent() { return (fLastGoodBin == 0) ? false : true; } + virtual bool IsLastGoodBinPresent() { return (fLastGoodBin == nullptr) ? false : true; } virtual int GetLastGoodBin(int idxp=-1, int idxs=-1); virtual int* GetLastGoodBins() { return fLastGoodBin; } virtual int GetNoOfPeriods() { return fNoOfPeriods; } @@ -403,14 +402,14 @@ class PNeXusDetector2 { virtual int GetHistoValue(int idx_p, int idx_s, int idx_b); virtual int* GetHistos() { return fHisto; } virtual unsigned int GetSpectrumIndexSize() { return fSpectrumIndex.size(); } - virtual vector *GetSpectrumIndex() { return &fSpectrumIndex; } + virtual std::vector *GetSpectrumIndex() { return &fSpectrumIndex; } virtual int GetSpectrumIndex(unsigned int idx); - virtual void SetDescription(string description) { fDescription = description; } - virtual void SetTimeResolution(double val, string units); - virtual void SetRawTime(vector &rawTime); - virtual void SetRawTimeName(string rawTimeName) { fRawTimeName = rawTimeName; } - virtual void SetRawTimeUnit(string rawTimeUnit) { fRawTimeUnit = rawTimeUnit; } + virtual void SetDescription(std::string description) { fDescription = description; } + virtual void SetTimeResolution(double val, std::string units); + virtual void SetRawTime(std::vector &rawTime); + virtual void SetRawTimeName(std::string rawTimeName) { fRawTimeName = rawTimeName; } + virtual void SetRawTimeUnit(std::string rawTimeUnit) { fRawTimeUnit = rawTimeUnit; } virtual void SetT0Tag(int tag) { fT0Tag = tag; } virtual int SetT0(int *t0); virtual int SetFirstGoodBin(int *fgb); @@ -419,17 +418,17 @@ class PNeXusDetector2 { virtual void SetNoOfSpectra(int val) { fNoOfSpectra = val; } virtual void SetNoOfBins(int val) { fNoOfBins = val; } virtual int SetHistos(int *histo); - virtual void SetSpectrumIndex(vector spectIdx) { fSpectrumIndex = spectIdx; } + virtual void SetSpectrumIndex(std::vector spectIdx) { fSpectrumIndex = spectIdx; } virtual void SetSpectrumIndex(int spectIdx, int idx=-1); private: - string fErrorMsg; ///< internal error message - string fDescription; ///< description of the detector + std::string fErrorMsg; ///< internal error message + std::string fDescription; ///< description of the detector double fTimeResolution; ///< keeps the time resolution in (ps) - vector fSpectrumIndex; ///< list of global spectra - vector fRawTime; ///< keeps a raw time vector - string fRawTimeName; ///< name of the raw time vector - string fRawTimeUnit; ///< unit of the raw time vector + std::vector fSpectrumIndex; ///< list of global spectra + std::vector fRawTime; ///< keeps a raw time vector + std::string fRawTimeName; ///< name of the raw time vector + std::string fRawTimeUnit; ///< unit of the raw time vector int fNoOfPeriods; ///< number of periods or -1 if not defined int fNoOfSpectra; ///< number of spectra or -1 if not defined @@ -449,18 +448,18 @@ class PNeXusInstrument2 { virtual bool IsValid(bool strict); - virtual string GetName() { return fName; } + virtual std::string GetName() { return fName; } virtual PNeXusSource2* GetSource() { return &fSource; } virtual PNeXusBeamline2* GetBeamline() { return &fBeamline; } virtual PNeXusDetector2* GetDetector() { return &fDetector; } - virtual void SetName(string name) { fName = name; } + virtual void SetName(std::string name) { fName = name; } virtual void SetSource(PNeXusSource2 &source) { fSource = source; } virtual void SetBeamline(PNeXusBeamline2 &beamline) { fBeamline = beamline; } virtual void SetDetector(PNeXusDetector2 &detector) { fDetector = detector; } private: - string fName; ///< name of the instrument + std::string fName; ///< name of the instrument PNeXusSource2 fSource; ///< details of the muon source used PNeXusBeamline2 fBeamline; ///< beamline description PNeXusDetector2 fDetector; ///< details of the detectors which also includes the data!! @@ -473,28 +472,28 @@ class PNeXusSample2 { virtual bool IsValid(bool strict); - virtual string GetName() { return fName; } - virtual string GetDescription() { return fDescription; } - virtual string GetMagneticFieldState() { return fMagneticFieldState; } - virtual string GetEnvironmentTemp() { return fEnvironmentTemp; } - virtual string GetEnvironmentField() { return fEnvironmentField; } - virtual double GetPhysPropValue(string name, bool &ok); - virtual void GetPhysPropUnit(string name, string &unit, bool &ok); + virtual std::string GetName() { return fName; } + virtual std::string GetDescription() { return fDescription; } + virtual std::string GetMagneticFieldState() { return fMagneticFieldState; } + virtual std::string GetEnvironmentTemp() { return fEnvironmentTemp; } + virtual std::string GetEnvironmentField() { return fEnvironmentField; } + virtual double GetPhysPropValue(std::string name, bool &ok); + virtual void GetPhysPropUnit(std::string name, std::string &unit, bool &ok); - virtual void SetName(string name) { fName = name; } - virtual void SetDescription(string description) { fDescription = description; } - virtual void SetMagneticFieldState(string magFieldState) { fMagneticFieldState = magFieldState; } - virtual void SetEnvironmentTemp(string env) { fEnvironmentTemp = env; } - virtual void SetEnvironmentField(string env) { fEnvironmentField = env; } - virtual void SetPhysProp(string name, double value, string unit, int idx=-1); + virtual void SetName(std::string name) { fName = name; } + virtual void SetDescription(std::string description) { fDescription = description; } + virtual void SetMagneticFieldState(std::string magFieldState) { fMagneticFieldState = magFieldState; } + virtual void SetEnvironmentTemp(std::string env) { fEnvironmentTemp = env; } + virtual void SetEnvironmentField(std::string env) { fEnvironmentField = env; } + virtual void SetPhysProp(std::string name, double value, std::string unit, int idx=-1); private: - string fName; ///< sample name - string fDescription; ///< sample description - string fMagneticFieldState; ///< magnetic field state, e.g. TF, ZF, ... - string fEnvironmentTemp; ///< sample environment related to temperature, e.g. CCR, Konti-1, ... - string fEnvironmentField; ///< sample environment related to field, e.g. WEW-Bruker - vector fPhysProp; ///< collects the temperature, magnetic field + std::string fName; ///< sample name + std::string fDescription; ///< sample description + std::string fMagneticFieldState; ///< magnetic field state, e.g. TF, ZF, ... + std::string fEnvironmentTemp; ///< sample environment related to temperature, e.g. CCR, Konti-1, ... + std::string fEnvironmentField; ///< sample environment related to field, e.g. WEW-Bruker + std::vector fPhysProp; ///< collects the temperature, magnetic field }; class PNeXusUser2 { @@ -504,12 +503,12 @@ class PNeXusUser2 { virtual bool IsValid(bool strict) { return true; } // currently only a dummy - virtual string GetName() { return fName; } + virtual std::string GetName() { return fName; } - virtual void SetName(string name) { fName = name; } + virtual void SetName(std::string name) { fName = name; } private: - string fName; ///< user name + std::string fName; ///< user name }; class PNeXusEntry2 { @@ -519,41 +518,41 @@ class PNeXusEntry2 { virtual bool IsValid(bool strict); - virtual string GetErrorMsg() { return fErrorMsg; } - virtual string GetDefinition() { return fDefinition; } - virtual string GetProgramName() { return fProgramName; } - virtual string GetProgramVersion() { return fProgramVersion; } + virtual std::string GetErrorMsg() { return fErrorMsg; } + virtual std::string GetDefinition() { return fDefinition; } + virtual std::string GetProgramName() { return fProgramName; } + virtual std::string GetProgramVersion() { return fProgramVersion; } virtual int GetRunNumber() { return fRunNumber; } - virtual string GetTitle() { return fTitle; } - virtual string GetStartTime() { return fStartTime; } - virtual string GetStopTime() { return fStopTime; } - virtual string GetExperimentIdentifier() { return fExperimentIdentifier; } + virtual std::string GetTitle() { return fTitle; } + virtual std::string GetStartTime() { return fStartTime; } + virtual std::string GetStopTime() { return fStopTime; } + virtual std::string GetExperimentIdentifier() { return fExperimentIdentifier; } virtual PNeXusUser2* GetUser() { return &fUser; } virtual PNeXusSample2* GetSample() { return &fSample; } virtual PNeXusInstrument2* GetInstrument() { return &fInstrument; } - virtual void SetDefinition(string def) { fDefinition = def; } - virtual void SetProgramName(string name) { fProgramName = name; } - virtual void SetProgramVersion(string version) { fProgramVersion = version; } + virtual void SetDefinition(std::string def) { fDefinition = def; } + virtual void SetProgramName(std::string name) { fProgramName = name; } + virtual void SetProgramVersion(std::string version) { fProgramVersion = version; } virtual void SetRunNumber(int number) { fRunNumber = number; } - virtual void SetTitle(string title) { fTitle = title; } - virtual int SetStartTime(string time); - virtual int SetStopTime(string time); - virtual void SetExperimentIdentifier(string expId) { fExperimentIdentifier = expId; } + virtual void SetTitle(std::string title) { fTitle = title; } + virtual int SetStartTime(std::string time); + virtual int SetStopTime(std::string time); + virtual void SetExperimentIdentifier(std::string expId) { fExperimentIdentifier = expId; } virtual void SetUser(PNeXusUser2 &user) { fUser = user; } virtual void SetSample(PNeXusSample2 &sample) { fSample = sample; } virtual void SetInstrument(PNeXusInstrument2 &instrument) { fInstrument = instrument; } private: - string fErrorMsg; ///< internal error message - string fDefinition; ///< the template (DTD name) on which the entry was based, e.g. 'pulsedTD' - string fProgramName; ///< name of the creating program - string fProgramVersion; ///< version of the creating program + std::string fErrorMsg; ///< internal error message + std::string fDefinition; ///< the template (DTD name) on which the entry was based, e.g. 'pulsedTD' + std::string fProgramName; ///< name of the creating program + std::string fProgramVersion; ///< version of the creating program int fRunNumber; ///< run number - string fTitle; ///< string containing the run title - string fStartTime; ///< start date/time of the run - string fStopTime; ///< stop date/time of the run - string fExperimentIdentifier; ///< experiment number, (for ISIS, the RB number) + std::string fTitle; ///< string containing the run title + std::string fStartTime; ///< start date/time of the run + std::string fStopTime; ///< stop date/time of the run + std::string fExperimentIdentifier; ///< experiment number, (for ISIS, the RB number) PNeXusUser2 fUser; ///< NXuser info IDF Version 2 PNeXusSample2 fSample; ///< NXsample info IDF Version 2 PNeXusInstrument2 fInstrument; ///< NXinstrument inf IDF Version 2 @@ -566,56 +565,56 @@ class PNeXus { virtual ~PNeXus(); virtual int GetIdfVersion() { return fIdfVersion; } - virtual string GetFileName() { return fFileName; } - virtual string GetFileTime() { return fFileTime; } + virtual std::string GetFileName() { return fFileName; } + virtual std::string GetFileTime() { return fFileTime; } virtual void SetIdfVersion(unsigned int idf); - virtual void SetFileName(string name) { fFileName = name; } - virtual void SetFileTime(string time) { fFileTime = time; } + virtual void SetFileName(std::string name) { fFileName = name; } + virtual void SetFileTime(std::string time) { fFileTime = time; } virtual PNeXusEntry1* GetEntryIdf1() { return fNxEntry1; } virtual PNeXusEntry2* GetEntryIdf2() { return fNxEntry2; } virtual bool IsValid(bool strict=false); virtual int GetErrorCode() { return fErrorCode; } - virtual string GetErrorMsg() { return fErrorMsg; } + virtual std::string GetErrorMsg() { return fErrorMsg; } - virtual vector* GetGroupedHisto(unsigned int idx); + virtual std::vector* GetGroupedHisto(unsigned int idx); virtual int ReadFile(const char *fileName); virtual int WriteFile(const char *fileName, const char *fileType="hdf4", const unsigned int idf=2); - virtual void SetCreator(string str) { fCreator = str; } + virtual void SetCreator(std::string str) { fCreator = str; } virtual void Dump(); private: bool fValid; int fErrorCode; - string fErrorMsg; + std::string fErrorMsg; - string fNeXusVersion; ///< version of the NeXus API used in writing the file - string fFileFormatVersion; ///< version of the HDF, HDF5, or XML library used to create the file (IDF 2 only) + std::string fNeXusVersion; ///< version of the NeXus API used in writing the file + std::string fFileFormatVersion; ///< version of the HDF, HDF5, or XML library used to create the file (IDF 2 only) unsigned int fIdfVersion; ///< version of the instrument definition - string fFileName; ///< file name of the original NeXus file to assist identification if the external name has been changed - string fFileTime; ///< date and time of file creating (IDF 2 only) + std::string fFileName; ///< file name of the original NeXus file to assist identification if the external name has been changed + std::string fFileTime; ///< date and time of file creating (IDF 2 only) NXhandle fFileHandle; - string fCreator; ///< facility of program where the file originated + std::string fCreator; ///< facility of program where the file originated PNeXusEntry1 *fNxEntry1; ///< NXentry for IDF 1 PNeXusEntry2 *fNxEntry2; ///< NXentry for IDF 2 - vector< vector > fGroupedHisto; + std::vector< std::vector > fGroupedHisto; virtual void Init(); - virtual bool ErrorHandler(NXstatus status, int errCode, const string &errMsg); - virtual NXstatus GetStringData(string &str); - virtual NXstatus GetStringAttr(string attr, string &str); + virtual bool ErrorHandler(NXstatus status, int errCode, const std::string &errMsg); + virtual NXstatus GetStringData(std::string &str); + virtual NXstatus GetStringAttr(std::string attr, std::string &str); virtual int GetDataSize(int type); - virtual NXstatus GetDoubleVectorData(vector &data); - virtual NXstatus GetIntVectorData(vector &data); + virtual NXstatus GetDoubleVectorData(std::vector &data); + virtual NXstatus GetIntVectorData(std::vector &data); virtual int ReadFileIdf1(); virtual int ReadFileIdf2(); @@ -628,8 +627,8 @@ class PNeXus { virtual bool IsValidIdf1(bool strict); virtual bool IsValidIdf2(bool strict); - virtual bool SearchInGroup(string str, string tag, NXname &nxname, NXname &nxclass, int &dataType); - virtual bool SearchAttrInData(string str, int &length, int &dataType); + virtual bool SearchInGroup(std::string str, std::string tag, NXname &nxname, NXname &nxclass, int &dataType); + virtual bool SearchAttrInData(std::string str, int &length, int &dataType); }; #endif // _PNEXUS_H_ diff --git a/src/include/PFitter.h b/src/include/PFitter.h index c9a09014..d6e12f7b 100644 --- a/src/include/PFitter.h +++ b/src/include/PFitter.h @@ -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 * diff --git a/src/include/PFitterFcn.h b/src/include/PFitterFcn.h index 94686e00..8e6c291c 100644 --- a/src/include/PFitterFcn.h +++ b/src/include/PFitterFcn.h @@ -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 * diff --git a/src/include/PFourier.h b/src/include/PFourier.h index 5edaddb9..4302e514 100644 --- a/src/include/PFourier.h +++ b/src/include/PFourier.h @@ -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,10 +31,11 @@ #define _PFOURIER_H_ #include -using namespace std; #include "fftw3.h" +#include + #include "Minuit2/FCNBase.h" #include "PMusr.h" @@ -51,7 +52,7 @@ class PFTPhaseCorrection : public ROOT::Minuit2::FCNBase { public: PFTPhaseCorrection(const Int_t minBin=-1, const Int_t maxBin=-1); - PFTPhaseCorrection(vector &reFT, vector &imFT, const Int_t minBin=-1, const Int_t maxBin=-1); + PFTPhaseCorrection(std::vector &reFT, std::vector &imFT, const Int_t minBin=-1, const Int_t maxBin=-1); virtual ~PFTPhaseCorrection() {} virtual Bool_t IsValid() { return fValid; } @@ -67,14 +68,14 @@ class PFTPhaseCorrection : public ROOT::Minuit2::FCNBase private: Bool_t fValid; - vector fReal; /// original real Fourier data set - vector fImag; /// original imag Fourier data set - mutable vector fRealPh; /// phased real Fourier data set - mutable vector fImagPh; /// phased imag Fourier data set - mutable vector fRealPhD; /// 1st derivative of fRealPh + std::vector fReal; /// original real Fourier data set + std::vector fImag; /// original imag Fourier data set + mutable std::vector fRealPh; /// phased real Fourier data set + mutable std::vector fImagPh; /// phased imag Fourier data set + mutable std::vector fRealPhD; /// 1st derivative of fRealPh - Double_t fMinBin; /// minimum bin from Fourier range to be used for the phase correction estimate - Double_t fMaxBin; /// maximum bin from Fourier range to be used for the phase correction estimate + Int_t fMinBin; /// minimum bin from Fourier range to be used for the phase correction estimate + Int_t fMaxBin; /// maximum bin from Fourier range to be used for the phase correction estimate mutable Double_t fPh_c0; /// constant part of the phase dispersion used for the phase correction mutable Double_t fPh_c1; /// linear part of the phase dispersion used for the phase correction Double_t fGamma; /// gamma parameter to balance between entropy and penalty @@ -87,7 +88,7 @@ class PFTPhaseCorrection : public ROOT::Minuit2::FCNBase virtual Double_t Entropy() const; virtual Double_t Up() const { return 1.0; } - virtual Double_t operator()(const vector&) const; + virtual Double_t operator()(const std::vector&) const; }; /** @@ -108,12 +109,12 @@ class PFourier virtual Double_t GetResolution() { return fResolution; } virtual Double_t GetMaxFreq(); virtual TH1F* GetRealFourier(const Double_t scale = 1.0); -//as virtual TH1F* GetPhaseOptRealFourier(vector &phase, const Double_t scale = 1.0, const Double_t min = -1.0, const Double_t max = -1.0); +//as virtual TH1F* GetPhaseOptRealFourier(std::vector &phase, const Double_t scale = 1.0, const Double_t min = -1.0, const Double_t max = -1.0); virtual TH1F* GetImaginaryFourier(const Double_t scale = 1.0); virtual TH1F* GetPowerFourier(const Double_t scale = 1.0); virtual TH1F* GetPhaseFourier(const Double_t scale = 1.0); - static TH1F* GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, vector &phase, + static TH1F* GetPhaseOptRealFourier(const TH1F *re, const TH1F *im, std::vector &phase, const Double_t scale = 1.0, const Double_t min = -1.0, const Double_t max = -1.0); virtual Bool_t IsValid() { return fValid; } diff --git a/src/include/PFourierCanvas.h b/src/include/PFourierCanvas.h index 05dad1e9..45cab933 100644 --- a/src/include/PFourierCanvas.h +++ b/src/include/PFourierCanvas.h @@ -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,6 +30,8 @@ #ifndef _PFOURIERCANVAS_H_ #define _PFOURIERCANVAS_H_ +#include + #include #include #include @@ -71,14 +73,14 @@ typedef struct { 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 - vector optPhase; ///< optimal phase which maximizes the real Fourier + std::vector optPhase; ///< optimal phase which maximizes the real Fourier } PFourierCanvasDataSet; //------------------------------------------------------------------------ /** *

typedef to make to code more readable: list of histogram data sets. */ -typedef vector PFourierCanvasDataList; +typedef std::vector PFourierCanvasDataList; //-------------------------------------------------------------------------- /** @@ -88,11 +90,11 @@ class PFourierCanvas : public TObject, public TQObject { public: PFourierCanvas(); - PFourierCanvas(vector &fourier, PIntVector dataSetTag, const Char_t* title, + PFourierCanvas(std::vector &fourier, PIntVector dataSetTag, const Char_t* title, const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[2], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, const Bool_t batch); - PFourierCanvas(vector &fourier, PIntVector dataSetTag, const Char_t* title, + PFourierCanvas(std::vector &fourier, PIntVector dataSetTag, const Char_t* title, const Bool_t showAverage, const Bool_t showAveragePerDataSet, const Int_t fourierPlotOpt, Double_t fourierXrange[2], Double_t phase, Int_t wtopx, Int_t wtopy, Int_t ww, Int_t wh, @@ -127,7 +129,7 @@ class PFourierCanvas : public TObject, public TQObject TString fTitle; TString fXaxisTitle; - vector fFourier; ///< keeps all the Fourier data, ownership is with the caller + std::vector fFourier; ///< keeps all the Fourier data, ownership is with the caller PFourierCanvasDataList fFourierHistos; ///< keeps all the Fourier histos PFourierCanvasDataList fFourierAverage; ///< keeps the average of the Fourier histos Double_t fCurrentFourierPhase; ///< keeps the current Fourier phase (real/imag) diff --git a/src/include/PFourierCanvasLinkDef.h b/src/include/PFourierCanvasLinkDef.h index af10deb8..c775dc8c 100644 --- a/src/include/PFourierCanvasLinkDef.h +++ b/src/include/PFourierCanvasLinkDef.h @@ -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 * diff --git a/src/include/PFunction.h b/src/include/PFunction.h index 9efd48ff..563815a7 100644 --- a/src/include/PFunction.h +++ b/src/include/PFunction.h @@ -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 * @@ -81,7 +81,7 @@ typedef struct func_tree_node { Int_t fIvalue; ///< for parameter numbers and maps Bool_t fSign; ///< for sign, true means '-', false '+' Double_t fDvalue; ///< for numbers - vector children; ///< holding sub-tree + std::vector children; ///< holding sub-tree } PFuncTreeNode; //---------------------------------------------------------------------------- @@ -96,8 +96,8 @@ class PFunction { virtual Bool_t IsValid() { return fValid; } virtual Int_t GetFuncNo() { return fFuncNo; } virtual Bool_t CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize); - virtual Double_t Eval(vector param); - virtual void SetMap(vector map) { fMap = map; } + virtual Double_t Eval(std::vector param); + virtual void SetMap(std::vector map) { fMap = map; } virtual TString* GetFuncString() { return &fFuncString; } @@ -114,8 +114,8 @@ class PFunction { private: tree_parse_info<> fInfo; ///< AST parse tree holding a single parsed msr-function in an ascii representation - vector fParam; ///< parameter vector (from the msr-file Fit Parameter block) - vector fMap; ///< map vector + std::vector fParam; ///< parameter vector (from the msr-file Fit Parameter block) + std::vector fMap; ///< map vector PFuncTreeNode fFunc; Bool_t fValid; ///< flag showing if the function is valid diff --git a/src/include/PFunctionGrammar.h b/src/include/PFunctionGrammar.h index a03bcc4c..02278d4f 100644 --- a/src/include/PFunctionGrammar.h +++ b/src/include/PFunctionGrammar.h @@ -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,9 +30,6 @@ #ifndef _PFUNCTIONGRAMMAR_H_ #define _PFUNCTIONGRAMMAR_H_ -#include -using namespace std; - //#define BOOST_SPIRIT_DEBUG #include diff --git a/src/include/PFunctionHandler.h b/src/include/PFunctionHandler.h index d8cc78b8..cfd049a8 100644 --- a/src/include/PFunctionHandler.h +++ b/src/include/PFunctionHandler.h @@ -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 * @@ -32,7 +32,6 @@ #include #include -using namespace std; #include @@ -52,7 +51,7 @@ class PFunctionHandler virtual Bool_t IsValid() { return fValid; } virtual Bool_t DoParse(); virtual Bool_t CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize); - virtual double Eval(Int_t funNo, vector map, vector param); + virtual double Eval(Int_t funNo, std::vector map, std::vector param); virtual Int_t GetFuncNo(UInt_t idx); virtual Int_t GetFuncIndex(Int_t funcNo); virtual UInt_t GetNoOfFuncs() { return fFuncs.size(); } @@ -62,8 +61,8 @@ class PFunctionHandler Bool_t fValid; ///< true = function handler has valid functions PMsrLines fLines; ///< stores the msr-file FUNCTIONS block as clear text. - vector fFuncs; ///< vector of all evaluatable functions - vector fFuncComment; ///< vector of prepended function comments + std::vector fFuncs; ///< vector of all evaluatable functions + std::vector fFuncComment; ///< vector of prepended function comments }; #endif // _PFUNCTIONHANDLER_H_ diff --git a/src/include/PMsr2Data.h b/src/include/PMsr2Data.h index 54ad1262..5c93862b 100644 --- a/src/include/PMsr2Data.h +++ b/src/include/PMsr2Data.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009-2016 by Bastian M. Wojek / Andreas Suter * + * Copyright (C) 2009-2019 by Bastian M. Wojek / Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -37,7 +37,6 @@ #include #include -using namespace std; #include "PRunDataHandler.h" #include "PStartupHandler.h" @@ -52,42 +51,42 @@ using namespace std; class PMsr2Data { public: - PMsr2Data(const string&); // File extension + PMsr2Data(const std::string&); // File extension ~PMsr2Data(); int SetRunNumbers(unsigned int); // single run given int SetRunNumbers(unsigned int, unsigned int); // run list specified through first and last run number - int SetRunNumbers(const string&); // run list file given - int SetRunNumbers(const vector&); // explicit run list specified using [ ] + int SetRunNumbers(const std::string&); // run list file given + int SetRunNumbers(const std::vector&); // explicit run list specified using [ ] unsigned int GetPresentRun() const; int DetermineRunNumberDigits(unsigned int, bool) const; int CheckRunNumbersInRange() const; int ParseXmlStartupFile(); - int ReadMsrFile(const string&) const; + int ReadMsrFile(const std::string&) const; int ReadRunDataFile(); bool PrepareNewInputFile(unsigned int, bool) const; // template - bool PrepareGlobalInputFile(unsigned int, const string&, unsigned int) const; // generate msr-input file for a global fit + bool PrepareGlobalInputFile(unsigned int, const std::string&, unsigned int) const; // generate msr-input file for a global fit - int WriteOutput(const string&, const vector&, bool, unsigned int, bool global = false, unsigned int counter = 0) const; + int WriteOutput(const std::string&, const std::vector&, bool, unsigned int, bool global = false, unsigned int counter = 0) const; private: bool PrepareNewSortedInputFile(unsigned int) const; // template PMsrHandler* GetSingleRunMsrFile() const; - void WriteValue(fstream &outFile, const double &value, const unsigned int &width) const; - void WriteValue(fstream &outFile, const double &value, const double &errValue, const unsigned int &width, const bool &db) const; + void WriteValue(std::fstream &outFile, const double &value, const unsigned int &width) const; + void WriteValue(std::fstream &outFile, const double &value, const double &errValue, const unsigned int &width, const bool &db) const; int GetFirstSignificantDigit(const double &value) const; - bool InParameterList(const unsigned int ¶mValue, const vector&) const; + bool InParameterList(const unsigned int ¶mValue, const std::vector&) const; - string fFileExtension; - vector fRunVector; - mutable vector::const_iterator fRunVectorIter; + std::string fFileExtension; + std::vector fRunVector; + mutable std::vector::const_iterator fRunVectorIter; bool fRunListFile; - vector fIndVar; - ifstream *fRunListFileStream; + std::vector fIndVar; + std::ifstream *fRunListFileStream; TSAXParser *fSaxParser; PStartupHandler *fStartupHandler; mutable PRunDataHandler *fDataHandler; diff --git a/src/include/PMsrHandler.h b/src/include/PMsrHandler.h index 0b346f6e..a283b3a1 100644 --- a/src/include/PMsrHandler.h +++ b/src/include/PMsrHandler.h @@ -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 * @@ -50,8 +50,8 @@ class PMsrHandler virtual Int_t ReadMsrFile(); virtual Int_t WriteMsrLogFile(const Bool_t messages = true); - virtual Int_t WriteMsrFile(const Char_t *filename, map *commentsPAR = 0, map *commentsTHE = 0, \ - map *commentsFUN = 0, map *commentsRUN = 0); + virtual Int_t WriteMsrFile(const Char_t *filename, std::map *commentsPAR = 0, std::map *commentsTHE = 0, \ + std::map *commentsFUN = 0, std::map *commentsRUN = 0); virtual TString* GetMsrTitle() { return &fTitle; } virtual PMsrParamList* GetMsrParamList() { return &fParam; } @@ -91,7 +91,7 @@ class PMsrHandler virtual UInt_t GetFuncIndex(Int_t funNo) { return fFuncHandler->GetFuncIndex(funNo); } virtual Bool_t CheckMapAndParamRange(UInt_t mapSize, UInt_t paramSize) { return fFuncHandler->CheckMapAndParamRange(mapSize, paramSize); } - virtual Double_t EvalFunc(UInt_t i, vector map, vector param) + virtual Double_t EvalFunc(UInt_t i, std::vector map, std::vector param) { return fFuncHandler->Eval(i,map,param); } virtual UInt_t GetNoOfFitParameters(UInt_t idx); diff --git a/src/include/PMusr.h b/src/include/PMusr.h index ccbe5d02..70cebc09 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2007-2018 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 * @@ -32,7 +32,6 @@ #include #include -using namespace std; #include @@ -152,55 +151,55 @@ using namespace std; /** *

typedef to make to code more readable. Definition of a bool vector. */ -typedef vector PBoolVector; +typedef std::vector PBoolVector; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of an unsigned int vector */ -typedef vector PUIntVector; +typedef std::vector PUIntVector; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of an int vector */ -typedef vector PIntVector; +typedef std::vector PIntVector; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of an int pair */ -typedef pair PIntPair; +typedef std::pair PIntPair; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of an int pair vector */ -typedef vector PIntPairVector; +typedef std::vector PIntPairVector; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of a double vector */ -typedef vector PDoubleVector; +typedef std::vector PDoubleVector; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of a double pair */ -typedef pair PDoublePair; +typedef std::pair PDoublePair; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of a double pair vector */ -typedef vector PDoublePairVector; +typedef std::vector PDoublePairVector; //------------------------------------------------------------- /** *

typedef to make to code more readable. Definition of a string vector */ -typedef vector PStringVector; +typedef std::vector PStringVector; //------------------------------------------------------------- /** @@ -269,8 +268,8 @@ class PNonMusrRawRunData { virtual Bool_t FromAscii() { return fFromAscii; } virtual const PStringVector* GetLabels() { return &fLabels; } virtual const PStringVector* GetDataTags() { return &fDataTags; } - virtual const vector* GetData() { return &fData; } - virtual const vector* GetErrData() { return &fErrData; } + virtual const std::vector* GetData() { return &fData; } + virtual const std::vector* GetErrData() { return &fErrData; } virtual void SetFromAscii(const Bool_t bval) { fFromAscii = bval; } virtual void AppendLabel(const TString str) { fLabels.push_back(str); } @@ -285,8 +284,8 @@ class PNonMusrRawRunData { Bool_t fFromAscii; ///< if true: data file was an ascii input file, otherwise it is a db input file PStringVector fLabels; ///< vector of all labels (used for x-, y-axis title in view) PStringVector fDataTags; ///< vector of all data tags - vector fData; ///< vector of all data - vector fErrData; ///< vector of all data errors + std::vector fData; ///< vector of all data + std::vector fErrData; ///< vector of all data errors }; //------------------------------------------------------------- @@ -356,7 +355,7 @@ class PRawRunDataVector { virtual void Set(PRawRunDataSet dataSet, Int_t idx=-1); private: - vector fDataVec; + std::vector fDataVec; }; //------------------------------------------------------------- @@ -499,7 +498,7 @@ class PRawRunData { /** *

typedef to make to code more readable. A vector of a raw musr run. */ -typedef vector PRawRunDataList; +typedef std::vector PRawRunDataList; //------------------------------------------------------------- /** @@ -514,7 +513,7 @@ typedef struct { /** *

typedef to make to code more readable: list of msr-file lines. */ -typedef vector PMsrLines; +typedef std::vector PMsrLines; //------------------------------------------------------------- /** @@ -539,7 +538,7 @@ typedef struct { /** *

typedef to make to code more readable: vector of fit parameters. */ -typedef vector PMsrParamList; +typedef std::vector PMsrParamList; //------------------------------------------------------------- /** @@ -590,7 +589,7 @@ class PMsrGlobalBlock { Int_t fFitType; ///< fit type: 0=single histo fit, 1=single histo RRF fit, 2=asymmetry fit, 4=mu^- single histo fit, 8=non muSR fit Int_t fDataRange[4]; ///< data bin range (fit type 0, 1, 2, 4) PDoubleVector fT0; ///< t0 bins (fit type 0, 1, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ... - vector fAddT0; ///< addt0 bins (fit type 0, 1, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ... + std::vector fAddT0; ///< addt0 bins (fit type 0, 1, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ... Bool_t fFitRangeInBins; ///< flag telling if fit range is given in time or in bins Double_t fFitRange[2]; ///< fit range in (us) Int_t fFitRangeOffset[2]; ///< if fit range is given in bins it can have the form fit fgb+n0 lgb-n1. This variable holds the n0 and n1. @@ -646,7 +645,7 @@ class PMsrRunBlock { virtual Int_t GetYDataIndex() { return fXYDataIndex[1]; } virtual TString* GetXDataLabel() { return &fXYDataLabel[0]; } virtual TString* GetYDataLabel() { return &fXYDataLabel[1]; } - virtual map *GetParGlobal() { return &fParGlobal; } + virtual std::map *GetParGlobal() { return &fParGlobal; } virtual PIntVector *GetMapGlobal() { return &fMapGlobal; } virtual void SetRunName(TString &str, Int_t idx=-1); @@ -700,7 +699,7 @@ class PMsrRunBlock { Int_t fBkgRange[4]; ///< background bin range (fit type 0, 2, 4) Int_t fDataRange[4]; ///< data bin range (fit type 0, 2, 4) PDoubleVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ... - vector fAddT0; ///< t0 bins for addrun's + std::vector fAddT0; ///< t0 bins for addrun's Bool_t fFitRangeInBins; ///< flag telling if fit range is given in time or in bins Double_t fFitRange[2]; ///< fit range in (us) Int_t fFitRangeOffset[2]; ///< if fit range is given in bins it can have the form fit fgb+n0 lgb-n1. This variable holds the n0 and n1. @@ -716,7 +715,7 @@ class PMsrRunBlock { // -1 -> tag not present in the RUN block // The information about global parameters in the map line is stored in an std::vector which should have the same length as the map-vector // The values in this std::vector can be the same as for the std::map of the other parameters. - map fParGlobal; ///< here is stored if the parameters used in the RUN block are global or not + std::map fParGlobal; ///< here is stored if the parameters used in the RUN block are global or not PIntVector fMapGlobal; ///< here is stored if the maps used in the RUN block are global or not }; @@ -724,7 +723,7 @@ class PMsrRunBlock { /** *

typedef to make to code more readable: list of runs with its parameters. */ -typedef vector PMsrRunList; +typedef std::vector PMsrRunList; //------------------------------------------------------------- /** @@ -772,7 +771,7 @@ typedef struct { /** *

typedef to make to code more readable: list of plots. */ -typedef vector PMsrPlotList; +typedef std::vector PMsrPlotList; //------------------------------------------------------------- /** @@ -833,18 +832,18 @@ typedef struct { class PStringNumberList { public: PStringNumberList(char *str) { fString = str; } - PStringNumberList(string str) { fString = str; } + PStringNumberList(std::string str) { fString = str; } virtual ~PStringNumberList() { fList.clear(); } - virtual bool Parse(string &errorMsg, bool ignoreFirstToken=false); + virtual bool Parse(std::string &errorMsg, bool ignoreFirstToken=false); virtual PUIntVector GetList() { return fList; } private: - string fString; + std::string fString; bool fIsValid; PUIntVector fList; - virtual bool IsNumber(string &str) { return (str.find_first_not_of("0123456789") == string::npos); } + virtual bool IsNumber(std::string &str) { return (str.find_first_not_of("0123456789") == std::string::npos); } virtual void StripSpaces(); }; diff --git a/src/include/PMusrCanvas.h b/src/include/PMusrCanvas.h index a079c611..89daca5a 100644 --- a/src/include/PMusrCanvas.h +++ b/src/include/PMusrCanvas.h @@ -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 * @@ -145,7 +145,7 @@ typedef struct { /** *

typedef to make to code more readable: list of histogram data sets. */ -typedef vector PMusrCanvasDataList; +typedef std::vector PMusrCanvasDataList; //------------------------------------------------------------------------ /** @@ -176,7 +176,7 @@ typedef struct { /** *

typedef to make to code more readable: list of error graph data sets. */ -typedef vector PMusrCanvasNonMusrDataList; +typedef std::vector PMusrCanvasNonMusrDataList; //------------------------------------------------------------------------ /** @@ -193,7 +193,7 @@ typedef struct { *

typedef to make to code more readable: vector of the above data structure. * Used if there are multiple histogramms to be dumped. */ -typedef vector PMusrCanvasAsciiDumpVector; +typedef std::vector PMusrCanvasAsciiDumpVector; //-------------------------------------------------------------------------- /** diff --git a/src/include/PMusrCanvasLinkDef.h b/src/include/PMusrCanvasLinkDef.h index c9c73b15..0b937a4c 100644 --- a/src/include/PMusrCanvasLinkDef.h +++ b/src/include/PMusrCanvasLinkDef.h @@ -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 * diff --git a/src/include/PMusrT0.h b/src/include/PMusrT0.h index 35674986..38e59d76 100644 --- a/src/include/PMusrT0.h +++ b/src/include/PMusrT0.h @@ -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 * @@ -84,7 +84,7 @@ class PMusrT0Data { virtual Int_t GetT0BinData() { return fT0Data; } virtual void SetSingleHisto(const Bool_t flag) { fSingleHisto = flag; } - virtual void SetRawRunData(const vector rawRunData) { fRawRunData = rawRunData; } + virtual void SetRawRunData(const std::vector rawRunData) { fRawRunData = rawRunData; } virtual void SetRunNo(const UInt_t runNo) { fRunNo = runNo; } virtual void SetAddRunIdx(const UInt_t addRunIdx) { fAddRunIdx = addRunIdx; } virtual void SetHistoNoIdx(const UInt_t histoNoIdx) { fHistoNoIdx = histoNoIdx; } @@ -97,7 +97,7 @@ class PMusrT0Data { private: Bool_t fSingleHisto; ///< true if single histo fit, false for asymmetry fit - vector fRawRunData; ///< holds the raw data of the needed runs, idx=0 the run, idx>0 the addruns + std::vector fRawRunData; ///< holds the raw data of the needed runs, idx=0 the run, idx>0 the addruns Int_t fRunNo; ///< msr-file run number Int_t fAddRunIdx; ///< msr-file addrun index Int_t fHistoNoIdx; ///< msr-file histo number index @@ -105,7 +105,7 @@ class PMusrT0Data { Int_t fDetectorTag; ///< detector tag. forward=0,backward=1 Int_t fCmdTag; ///< command tag. 0=get t0, 1=get data-/bkg-range, 2=get t0, and data-/bkg-range PIntVector fT0; ///< holding the t0's of the run - vector fAddT0; ///< holding the t0's of the addruns + std::vector fAddT0; ///< holding the t0's of the addruns Int_t fT0Data; ///< holding the t0 found in the current data set }; diff --git a/src/include/PMusrT0LinkDef.h b/src/include/PMusrT0LinkDef.h index d7e26cc4..2f298eec 100644 --- a/src/include/PMusrT0LinkDef.h +++ b/src/include/PMusrT0LinkDef.h @@ -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 * diff --git a/src/include/PPrepFourier.h b/src/include/PPrepFourier.h index dd40429f..666f9e7d 100644 --- a/src/include/PPrepFourier.h +++ b/src/include/PPrepFourier.h @@ -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 * @@ -32,7 +32,6 @@ #include #include -using namespace std; #include #include @@ -75,12 +74,12 @@ class PPrepFourier { TString GetInfo(const UInt_t idx); Int_t GetDataSetTag(const UInt_t idx); UInt_t GetNoOfData() { return fRawData.size(); } - vector GetData(); + std::vector GetData(); TH1F *GetData(const UInt_t idx); private: - vector fRawData; - vectorfData; + std::vector fRawData; + std::vectorfData; Int_t fBkgRange[2]; PDoubleVector fBkg; Int_t fPacking; diff --git a/src/include/PRunAsymmetry.h b/src/include/PRunAsymmetry.h index fb788c17..2d028cbb 100644 --- a/src/include/PRunAsymmetry.h +++ b/src/include/PRunAsymmetry.h @@ -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 * diff --git a/src/include/PRunAsymmetryRRF.h b/src/include/PRunAsymmetryRRF.h index 31911634..78971e76 100644 --- a/src/include/PRunAsymmetryRRF.h +++ b/src/include/PRunAsymmetryRRF.h @@ -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 * diff --git a/src/include/PRunBase.h b/src/include/PRunBase.h index 37fad18b..974e3b8e 100644 --- a/src/include/PRunBase.h +++ b/src/include/PRunBase.h @@ -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,7 +31,6 @@ #define _PRUNBASE_H_ #include -using namespace std; #include @@ -51,8 +50,8 @@ class PRunBase PRunBase(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag); virtual ~PRunBase(); - virtual Double_t CalcChiSquare(const vector& par) = 0; ///< pure virtual, i.e. needs to be implemented by the deriving class!! - virtual Double_t CalcMaxLikelihood(const vector& par) = 0; ///< pure virtual, i.e. needs to be implemented by the deriving class!! + virtual Double_t CalcChiSquare(const std::vector& par) = 0; ///< pure virtual, i.e. needs to be implemented by the deriving class!! + virtual Double_t CalcMaxLikelihood(const std::vector& par) = 0; ///< pure virtual, i.e. needs to be implemented by the deriving class!! virtual void SetFitRange(PDoublePairVector fitRange); virtual void CalcTheory() = 0; ///< pure virtual, i.e. needs to be implemented by the deriving class!! @@ -75,7 +74,7 @@ class PRunBase PRunData fData; ///< data to be fitted, viewed, i.e. binned data Double_t fTimeResolution; ///< time resolution in (us) PDoubleVector fT0s; ///< all t0 bins of a run! The derived classes will handle it. - vector fAddT0s; ///< all t0 bins of all addrun's of a run! The derived classes will handle it. + std::vector fAddT0s; ///< all t0 bins of all addrun's of a run! The derived classes will handle it. Double_t fFitStartTime; ///< fit start time Double_t fFitEndTime; ///< fit end time diff --git a/src/include/PRunDataHandler.h b/src/include/PRunDataHandler.h index f75c1428..8c3bea2b 100644 --- a/src/include/PRunDataHandler.h +++ b/src/include/PRunDataHandler.h @@ -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,9 +30,6 @@ #ifndef _PRUNDATAHANDLER_H_ #define _PRUNDATAHANDLER_H_ -#include -using namespace std; - #include #include "PMusr.h" @@ -108,7 +105,7 @@ class PRunDataHandler virtual TString GenerateOutputFileName(const TString fileName, const TString extension, Bool_t &ok); virtual TString GetFileName(const TString extension, Bool_t &ok); virtual TString FileNameFromTemplate(TString &fileNameTemplate, Int_t run, TString &year, Bool_t &ok); - virtual bool DateToISO8601(string inDate, string &iso8601Date); + virtual bool DateToISO8601(std::string inDate, std::string &iso8601Date); virtual void SplitTimeDate(TString timeDate, TString &time, TString &date, Bool_t &ok); virtual TString GetMonth(Int_t month); virtual TString GetYear(Int_t month); diff --git a/src/include/PRunListCollection.h b/src/include/PRunListCollection.h index 1c22ee51..c6c8e89c 100644 --- a/src/include/PRunListCollection.h +++ b/src/include/PRunListCollection.h @@ -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,7 +31,6 @@ #define _PRUNLISTCOLLECTION_H_ #include -using namespace std; #include "PMusr.h" #include "PMsrHandler.h" @@ -107,12 +106,12 @@ class PRunListCollection PMsrHandler *fMsrInfo; ///< pointer to the msr-file handler PRunDataHandler *fData; ///< pointer to the run-data handler - vector fRunSingleHistoList; ///< stores all processed single histogram data - vector fRunSingleHistoRRFList; ///< stores all processed single histogram RRF data - vector fRunAsymmetryList; ///< stores all processed asymmetry data - vector fRunAsymmetryRRFList; ///< stores all processed asymmetry RRF data - vector fRunMuMinusList; ///< stores all processed mu-minus data - vector fRunNonMusrList; ///< stores all processed non-muSR data + std::vector fRunSingleHistoList; ///< stores all processed single histogram data + std::vector fRunSingleHistoRRFList; ///< stores all processed single histogram RRF data + std::vector fRunAsymmetryList; ///< stores all processed asymmetry data + std::vector fRunAsymmetryRRFList; ///< stores all processed asymmetry RRF data + std::vector fRunMuMinusList; ///< stores all processed mu-minus data + std::vector fRunNonMusrList; ///< stores all processed non-muSR data }; #endif // _PRUNLISTCOLLECTION_H_ diff --git a/src/include/PRunMuMinus.h b/src/include/PRunMuMinus.h index 80297118..8c9a0e20 100644 --- a/src/include/PRunMuMinus.h +++ b/src/include/PRunMuMinus.h @@ -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 * diff --git a/src/include/PRunNonMusr.h b/src/include/PRunNonMusr.h index 49ff94ef..07fa7111 100644 --- a/src/include/PRunNonMusr.h +++ b/src/include/PRunNonMusr.h @@ -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 * diff --git a/src/include/PRunSingleHisto.h b/src/include/PRunSingleHisto.h index ba8b49d4..6b3a02d1 100644 --- a/src/include/PRunSingleHisto.h +++ b/src/include/PRunSingleHisto.h @@ -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 * diff --git a/src/include/PRunSingleHistoRRF.h b/src/include/PRunSingleHistoRRF.h index 44e7b9a5..5631bfb4 100644 --- a/src/include/PRunSingleHistoRRF.h +++ b/src/include/PRunSingleHistoRRF.h @@ -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 * diff --git a/src/include/PStartupHandler.h b/src/include/PStartupHandler.h index bbb0f10e..801a9b4e 100644 --- a/src/include/PStartupHandler.h +++ b/src/include/PStartupHandler.h @@ -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 * diff --git a/src/include/PStartupHandlerLinkDef.h b/src/include/PStartupHandlerLinkDef.h index 036977e7..058b7a00 100644 --- a/src/include/PStartupHandlerLinkDef.h +++ b/src/include/PStartupHandlerLinkDef.h @@ -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 * diff --git a/src/include/PTheory.h b/src/include/PTheory.h index b132a347..f8c29964 100644 --- a/src/include/PTheory.h +++ b/src/include/PTheory.h @@ -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 * @@ -290,7 +290,7 @@ class PTheory // variables Bool_t fValid; ///< flag to tell if the theory is valid UInt_t fType; ///< function tag - vector fParamNo; ///< holds the parameter numbers for the theory (including maps and functions, see constructor desciption) + std::vector fParamNo; ///< holds the parameter numbers for the theory (including maps and functions, see constructor desciption) UInt_t fNoOfParam; ///< number of parameters for the given function PTheory *fAdd, *fMul; ///< pointers to the add-sub-function or the multiply-sub-function diff --git a/src/include/PUserFcn.h b/src/include/PUserFcn.h index dacb4041..d796843c 100644 --- a/src/include/PUserFcn.h +++ b/src/include/PUserFcn.h @@ -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 * diff --git a/src/include/PUserFcnBase.h b/src/include/PUserFcnBase.h index a920727c..24e41325 100644 --- a/src/include/PUserFcnBase.h +++ b/src/include/PUserFcnBase.h @@ -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,7 +31,6 @@ #define _PUSERFCNBASE_H_ #include -using namespace std; #include "TObject.h" #include "TSAXParser.h" @@ -47,7 +46,7 @@ class PUserFcnBase : public TObject virtual ~PUserFcnBase(); virtual Bool_t NeedGlobalPart() const = 0; ///< if a user function needs a global part this function should return true, otherwise false - virtual void SetGlobalPart(vector &globalPart, UInt_t idx) = 0; ///< if a user function is using a global part, this function is used to invoke and retrieve the proper global object + virtual void SetGlobalPart(std::vector &globalPart, UInt_t idx) = 0; ///< if a user function is using a global part, this function is used to invoke and retrieve the proper global object virtual Bool_t GlobalPartIsValid() const = 0; ///< if a user function is using a global part, this function returns if the global object part is valid virtual Double_t operator()(Double_t t, const std::vector ¶m) const = 0; diff --git a/src/include/PUserFcnBaseLinkDef.h b/src/include/PUserFcnBaseLinkDef.h index 843c143a..5164b1ee 100644 --- a/src/include/PUserFcnBaseLinkDef.h +++ b/src/include/PUserFcnBaseLinkDef.h @@ -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 * diff --git a/src/msr2data.cpp b/src/msr2data.cpp index efc0feef..ff5ad35d 100644 --- a/src/msr2data.cpp +++ b/src/msr2data.cpp @@ -8,7 +8,7 @@ ***************************************************************************/ /*************************************************************************** - * Copyright (C) 2009-2014 by Bastian M. Wojek / Andreas Suter * + * Copyright (C) 2009-2019 by Bastian M. Wojek / Andreas Suter * * andreas.suter@psi.ch * * * * This program is free software; you can redistribute it and/or modify * @@ -46,15 +46,12 @@ #include #include #include -using namespace std; - +#include #include #include // for to_lower() in std::string -using namespace boost::algorithm; #include // for atoi-replacement -// #include // for a clean way to check if a file exists //-------------------------------------------------------------------------- /** @@ -66,7 +63,7 @@ using namespace boost::algorithm; * * \param s string */ -bool isNumber(const string &s) +bool isNumber(const std::string &s) { unsigned int number(0); try { @@ -84,86 +81,86 @@ bool isNumber(const string &s) */ void msr2data_syntax() { - cout << endl << "usage 0: msr2data [--version] | [--help]"; - cout << endl << "usage 1: msr2data options"; - cout << endl << "usage 2: msr2data options"; - cout << endl << "usage 3: msr2data \\[\\] options"; - cout << endl << "usage 4: msr2data options"; - cout << endl; - cout << endl << " can be:"; - cout << endl << " (i) , , , ... : run numbers, e.g. 123 124"; - cout << endl << " (ii) - : a range, e.g. 123-125 -> 123 124 125"; - cout << endl << " (iii) :: : a sequence, e.g. 123:127:2 -> 123 125 127"; - cout << endl << " will give the step width and has to be a positive number!"; - cout << endl << " a can also combine (i)-(iii), e.g. 123 128-130 133, etc."; - cout << endl << " : an ASCII file containing a list of run numbers and optional"; - cout << endl << " external parameters is passed to msr2data. For details see"; - cout << endl << " the online documentation: http://lmu.web.psi.ch/musrfit/user/MUSR/Msr2Data.html"; - cout << endl << " : msr-file extension, e.g. _tf_h13 for the file name 8472_tf_h13.msr"; - cout << endl; - cout << endl << "options:"; - cout << endl << " -o : specify the name of the DB or column-data output file; default: out.db/out.dat"; - cout << endl << " if the option '-o none' is used, no output file will be written."; - cout << endl << " new : before writing a new output file, delete the contents of any existing file with the same name"; - cout << endl << " data : instead of to a DB file the data are written to a simple column structure"; - cout << endl << " header : force writing of the file header to the output file"; - cout << endl << " noheader : no file header is written to the output file"; - cout << endl << " If either none or both of the header options are given, the file header will be written"; - cout << endl << " if a new file is created, but not if the output file exists already!"; - cout << endl << " nosummary : no additional data from the run data file is written to the output file"; - cout << endl << " paramList : option used to select the parameters which shall be exported."; - cout << endl << " is a list of parameter numbers to be exported. Allowed lists are:"; - cout << endl << " 1-16 will export parameters 1 to 16. 1 3 5 will export parameters 1 3 5."; - cout << endl << " A combination of both is possible, e.g. 1-16 19 31 62, and so on."; - cout << endl << " fit : invoke musrfit to fit the specified runs"; - cout << endl << " All msr input files are assumed to be present, none is newly generated!"; - cout << endl << " fit-