changed to explicit std namespace.

This commit is contained in:
suter_a 2020-04-28 12:07:10 +02:00
parent 4ebb5bb377
commit 572e0f96a5
8 changed files with 160 additions and 168 deletions

View File

@ -29,7 +29,6 @@
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
using namespace std;
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
@ -314,10 +313,10 @@ bool PParamDataHandler::ReadParamFile(const QStringList fln, QString &errorMsg)
// since the db-file should now be present, just load it // since the db-file should now be present, just load it
collection = ReadDbFile(pathName, valid, errorMsg); collection = ReadDbFile(pathName, valid, errorMsg);
if (!valid) { if (!valid) {
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** read db-file failure (" << pathName.toLatin1().data() << "." << endl; std::cerr << "**ERROR** read db-file failure (" << pathName.toLatin1().data() << "." << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
return false; return false;
} }
collName.remove(".db"); collName.remove(".db");
@ -336,10 +335,10 @@ bool PParamDataHandler::ReadParamFile(const QStringList fln, QString &errorMsg)
int idx = fln[i].lastIndexOf("/"); int idx = fln[i].lastIndexOf("/");
if (idx == -1) { // should never happen if (idx == -1) { // should never happen
errorMsg = QString("found '%1' which shouldn't be possible!").arg(fln[i]); errorMsg = QString("found '%1' which shouldn't be possible!").arg(fln[i]);
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** " << errorMsg.toLatin1().data() << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
return false; return false;
} }
QString relPath = fln[i].left(idx); QString relPath = fln[i].left(idx);
@ -369,10 +368,10 @@ bool PParamDataHandler::ReadParamFile(const QStringList fln, QString &errorMsg)
fCollection.push_back(collection); fCollection.push_back(collection);
} else { } else {
errorMsg = QString("unkown file type for ")+fln[i]; errorMsg = QString("unkown file type for ")+fln[i];
cerr << endl; std::cerr << std::endl;
cerr << "*********" << endl; std::cerr << "*********" << std::endl;
cerr << "**ERROR** " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** " << errorMsg.toLatin1().data() << std::endl;
cerr << "*********" << endl; std::cerr << "*********" << std::endl;
return false; return false;
} }
} }
@ -399,10 +398,10 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
QFile file(fln); QFile file(fln);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
errorMsg = QString("couldn't open ") + fln; errorMsg = QString("couldn't open ") + fln;
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** " << errorMsg.toLatin1().data() << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
valid = false; valid = false;
return collection; return collection;
} }
@ -428,10 +427,10 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
token = line.split(",", QString::SkipEmptyParts); token = line.split(",", QString::SkipEmptyParts);
if (token.size()==0) { if (token.size()==0) {
errorMsg = fln + QString(". No parameter tokens."); errorMsg = fln + QString(". No parameter tokens.");
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** in " << errorMsg.toLatin1().data() << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
file.close(); file.close();
valid = false; valid = false;
return collection; return collection;
@ -451,10 +450,10 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
errorMsg += QString(" first run (#%1) has %2 params.\n").arg(collection.GetRun(0).GetNumber()).arg(collection.GetRun(0).GetNoOfParam()); errorMsg += QString(" first run (#%1) has %2 params.\n").arg(collection.GetRun(0).GetNumber()).arg(collection.GetRun(0).GetNoOfParam());
errorMsg += QString(" current run (#%1) has %2 params.\n").arg(run.GetNumber()).arg(run.GetNoOfParam()); errorMsg += QString(" current run (#%1) has %2 params.\n").arg(run.GetNumber()).arg(run.GetNoOfParam());
errorMsg += QString(" Inspect your db-file!"); errorMsg += QString(" Inspect your db-file!");
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** in " << errorMsg.toLatin1().data() << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
file.close(); file.close();
valid = false; valid = false;
return collection; return collection;
@ -464,20 +463,20 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
run.Clear(); run.Clear();
} else { // parameter } else { // parameter
if (token.size() != 4) { // wrong number of parameter tokens if (token.size() != 4) { // wrong number of parameter tokens
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in" << fln.toLatin1().data() <<". # parameter tokens != 4." << endl; std::cerr << "**ERROR** in" << fln.toLatin1().data() <<". # parameter tokens != 4." << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
file.close(); file.close();
valid = false; valid = false;
return collection; return collection;
} }
subTok = token[0].split("="); subTok = token[0].split("=");
if (subTok.size() != 2) { if (subTok.size() != 2) {
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter name=value token missing." << endl; std::cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter name=value token missing." << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
file.close(); file.close();
valid = false; valid = false;
return collection; return collection;
@ -489,10 +488,10 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
if (ok) { if (ok) {
param.SetValue(dval); param.SetValue(dval);
} else { } else {
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter name=value token missing or wrong?!" << endl; std::cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter name=value token missing or wrong?!" << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
file.close(); file.close();
valid = false; valid = false;
return collection; return collection;
@ -502,10 +501,10 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
if (ok) { if (ok) {
param.SetPosErr(dval); param.SetPosErr(dval);
} else { } else {
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter pos. error not a number?!" << endl; std::cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter pos. error not a number?!" << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
file.close(); file.close();
valid = false; valid = false;
return collection; return collection;
@ -515,10 +514,10 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
if (ok) { if (ok) {
param.SetNegErr(dval); param.SetNegErr(dval);
} else { } else {
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter neg. error not a number?!" << endl; std::cerr << "**ERROR** in" << fln.toLatin1().data() <<". parameter neg. error not a number?!" << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
file.close(); file.close();
valid = false; valid = false;
return collection; return collection;
@ -528,10 +527,10 @@ PmuppCollection PParamDataHandler::ReadDbFile(const QString fln, bool &valid, QS
} }
} }
if (!param_found) { if (!param_found) {
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** in" << fln.toLatin1().data() <<". No parameter found." << endl; std::cerr << "**ERROR** in" << fln.toLatin1().data() <<". No parameter found." << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
} }
file.close(); file.close();
@ -557,10 +556,10 @@ PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool &
QFile file(fln); QFile file(fln);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
errorMsg = QString("couldn't open ")+fln; errorMsg = QString("couldn't open ")+fln;
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** " << errorMsg.toLatin1().data() << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
valid = false; valid = false;
return collection; return collection;
} }
@ -608,10 +607,10 @@ PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool &
// paranoia check // paranoia check
if (token.size() != headerInfo.size()) { if (token.size() != headerInfo.size()) {
errorMsg = QString("size mismatch between header and parameter int line: %1 (header=%2 / param=%3)").arg(lineNo).arg(headerInfo.size()).arg(token.size()); errorMsg = QString("size mismatch between header and parameter int line: %1 (header=%2 / param=%3)").arg(lineNo).arg(headerInfo.size()).arg(token.size());
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** " << errorMsg.toLatin1().data() << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
valid = false; valid = false;
file.close(); file.close();
return collection; return collection;
@ -623,10 +622,10 @@ PmuppCollection PParamDataHandler::ReadColumnParamFile(const QString fln, bool &
dval = token[i].toDouble(&ok); dval = token[i].toDouble(&ok);
if (!ok) { if (!ok) {
errorMsg = QString("unrecognized token ('%1') in line %2 (line number: %3)").arg(token[i].toLatin1().data()).arg(line.toLatin1().data()).arg(lineNo); errorMsg = QString("unrecognized token ('%1') in line %2 (line number: %3)").arg(token[i].toLatin1().data()).arg(line.toLatin1().data()).arg(lineNo);
cerr << endl; std::cerr << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
cerr << "**ERROR** " << errorMsg.toLatin1().data() << endl; std::cerr << "**ERROR** " << errorMsg.toLatin1().data() << std::endl;
cerr << "----" << endl; std::cerr << "----" << std::endl;
valid = false; valid = false;
file.close(); file.close();
return collection; return collection;
@ -966,18 +965,18 @@ void PParamDataHandler::Dump()
PmuppParam param; PmuppParam param;
for (int i=0; i<fCollection.size(); i++) { for (int i=0; i<fCollection.size(); i++) {
cout << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" << endl; std::cout << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" << std::endl;
cout << "debug> collection name: " << fCollection[i].GetName().toLatin1().data() << endl; std::cout << "debug> collection name: " << fCollection[i].GetName().toLatin1().data() << std::endl;
cout << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" << endl; std::cout << "debug> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-" << std::endl;
for (int j=0; j<fCollection[i].GetNoOfRuns(); j++) { for (int j=0; j<fCollection[i].GetNoOfRuns(); j++) {
cout << "debug> ----------------------------------" << endl; std::cout << "debug> ----------------------------------" << std::endl;
run = fCollection[i].GetRun(j); run = fCollection[i].GetRun(j);
cout << "debug>> run number: " << run.GetNumber() << endl; std::cout << "debug>> run number: " << run.GetNumber() << std::endl;
cout << "debug>> run name : " << run.GetName().toLatin1().data() << endl; std::cout << "debug>> run name : " << run.GetName().toLatin1().data() << std::endl;
cout << "debug>> ---------------------------------" << endl; std::cout << "debug>> ---------------------------------" << std::endl;
for (int k=0; k<run.GetNoOfParam(); k++) { for (int k=0; k<run.GetNoOfParam(); k++) {
param = run.GetParam(k); param = run.GetParam(k);
cout << "debug>>> " << param.GetName().toLatin1().data() << ": " << param.GetValue() << " -+ " << param.GetNegErr() << " / " << param.GetPosErr() << endl; std::cout << "debug>>> " << param.GetName().toLatin1().data() << ": " << param.GetValue() << " -+ " << param.GetNegErr() << " / " << param.GetPosErr() << std::endl;
} }
} }
} }

View File

@ -29,7 +29,6 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
using namespace std;
#include <QMessageBox> #include <QMessageBox>
#include <QString> #include <QString>
@ -501,7 +500,7 @@ void PmuppAdmin::saveRecentFiles()
QVector<QString> data; QVector<QString> data;
QFile file(fln); QFile file(fln);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
cerr << endl << ">> PmuppAdmin::saveRecentFile: **ERROR** Cannot open " << fln.toLatin1().data() << " for reading." << endl; std::cerr << std::endl << ">> PmuppAdmin::saveRecentFile: **ERROR** Cannot open " << fln.toLatin1().data() << " for reading." << std::endl;
return; return;
} }
QTextStream fin(&file); QTextStream fin(&file);
@ -526,7 +525,7 @@ void PmuppAdmin::saveRecentFiles()
} }
if (i == data.size()) { if (i == data.size()) {
cerr << endl << ">> PmuppAdmin::saveRecentFile: **ERROR** " << fln.toLatin1().data() << " seems to be corrupt." << endl; std::cerr << std::endl << ">> PmuppAdmin::saveRecentFile: **ERROR** " << fln.toLatin1().data() << " seems to be corrupt." << std::endl;
return; return;
} }
i++; i++;
@ -536,7 +535,7 @@ void PmuppAdmin::saveRecentFiles()
} }
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
cerr << endl << ">> PmuppAdmin::saveRecentFile: **ERROR** Cannot open " << fln.toLatin1().data() << " for reading." << endl; std::cerr << std::endl << ">> PmuppAdmin::saveRecentFile: **ERROR** Cannot open " << fln.toLatin1().data() << " for reading." << std::endl;
return; return;
} }
fin.setDevice(&file); fin.setDevice(&file);

View File

@ -34,7 +34,6 @@
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
using namespace std;
#include <QApplication> #include <QApplication>
#include <QToolBar> #include <QToolBar>
@ -437,7 +436,7 @@ void PmuppGui::aboutToQuit()
msqid = msgget(key, flags | S_IRUSR | S_IWUSR); msqid = msgget(key, flags | S_IRUSR | S_IWUSR);
if (msqid != -1) { if (msqid != -1) {
if (msgctl(msqid, IPC_RMID, NULL) == -1) { if (msgctl(msqid, IPC_RMID, NULL) == -1) {
cerr << "**ERROR** couldn't removed the message queue (msqid=" << msqid << ")." << endl << endl; std::cerr << "**ERROR** couldn't removed the message queue (msqid=" << msqid << ")." << std::endl << std::endl;
} }
} }
} }
@ -865,10 +864,10 @@ void PmuppGui::readCmdHistory()
QFile file(pathName); QFile file(pathName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
cerr << endl; std::cerr << std::endl;
cerr << "***********" << endl; std::cerr << "***********" << std::endl;
cerr << "**WARNING** readCmdHistory(): couldn't open mupp_history.txt for reading ..." << endl;; std::cerr << "**WARNING** readCmdHistory(): couldn't open mupp_history.txt for reading ..." << std::endl;;
cerr << "***********" << endl; std::cerr << "***********" << std::endl;
return; return;
} }

View File

@ -30,7 +30,6 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
using namespace std;
#include <TColor.h> #include <TColor.h>
#include <TROOT.h> #include <TROOT.h>
@ -104,7 +103,7 @@ PMuppCanvas::PMuppCanvas(const Char_t *title, Int_t wtopx, Int_t wtopy,
fCheckMsgQueue = new TTimer(); fCheckMsgQueue = new TTimer();
if (fCheckMsgQueue == 0) { if (fCheckMsgQueue == 0) {
fValid = false; fValid = false;
cerr << "**ERROR** couldn't start IPC message queue timer..." << endl; std::cerr << "**ERROR** couldn't start IPC message queue timer..." << std::endl;
return; return;
} }
fCheckMsgQueue->Connect("Timeout()", "PMuppCanvas", this, "CheckIPCMsgQueue()"); fCheckMsgQueue->Connect("Timeout()", "PMuppCanvas", this, "CheckIPCMsgQueue()");
@ -199,7 +198,6 @@ void PMuppCanvas::HandleMenuPopup(Int_t id)
*/ */
void PMuppCanvas::LastCanvasClosed() void PMuppCanvas::LastCanvasClosed()
{ {
// cout << endl << ">> in last canvas closed check ...";
if (gROOT->GetListOfCanvases()->IsEmpty()) { if (gROOT->GetListOfCanvases()->IsEmpty()) {
Done(0); Done(0);
} }
@ -255,8 +253,8 @@ void PMuppCanvas::InitMuppCanvas(const Char_t *title, Int_t wtopx, Int_t wtopy,
TString canvasName = TString("fMuppCanvas"); TString canvasName = TString("fMuppCanvas");
fMainCanvas = new TCanvas(canvasName.Data(), title, wtopx, wtopy, ww, wh); fMainCanvas = new TCanvas(canvasName.Data(), title, wtopx, wtopy, ww, wh);
if (fMainCanvas == 0) { if (fMainCanvas == 0) {
cerr << endl << ">> PMuppCanvas::InitMuppCanvas(): **PANIC ERROR** Couldn't invoke " << canvasName.Data(); std::cerr << std::endl << ">> PMuppCanvas::InitMuppCanvas(): **PANIC ERROR** Couldn't invoke " << canvasName.Data();
cerr << endl; std::cerr << std::endl;
return; return;
} }
@ -301,16 +299,16 @@ void PMuppCanvas::CheckIPCMsgQueue()
if (fFtokName.IsWhitespace()) { if (fFtokName.IsWhitespace()) {
strncpy(str, getenv("HOME"), sizeof(str)-1); strncpy(str, getenv("HOME"), sizeof(str)-1);
if (strlen(str) == 0) { if (strlen(str) == 0) {
cerr << endl; std::cerr << std::endl;
cerr << "**ERROR** couldn't get value of the environment variable HOME." << endl << endl; std::cerr << "**ERROR** couldn't get value of the environment variable HOME." << std::endl << std::endl;
return; return;
} }
memset(str, '\0', sizeof(str)); memset(str, '\0', sizeof(str));
snprintf(str, sizeof(str), "%s/.musrfit/mupp/_mupp_ftok_%d.dat", getenv("HOME"), fMuppInstance); snprintf(str, sizeof(str), "%s/.musrfit/mupp/_mupp_ftok_%d.dat", getenv("HOME"), fMuppInstance);
ifstream fin(str, ifstream::in); std::ifstream fin(str, std::ifstream::in);
if (!fin.is_open()) { if (!fin.is_open()) {
cerr << endl; std::cerr << std::endl;
cerr << "**ERROR** couldn't open " << str << endl; std::cerr << "**ERROR** couldn't open " << str << std::endl;
return; return;
} }
fin.getline(str, 1024); fin.getline(str, 1024);
@ -322,8 +320,8 @@ void PMuppCanvas::CheckIPCMsgQueue()
flags = IPC_CREAT; flags = IPC_CREAT;
msqid = msgget(key, flags | S_IRUSR | S_IWUSR); msqid = msgget(key, flags | S_IRUSR | S_IWUSR);
if (msqid == -1) { if (msqid == -1) {
cerr << endl; std::cerr << std::endl;
cerr << "**ERROR** couldn't get msqid." << endl << endl; std::cerr << "**ERROR** couldn't get msqid." << std::endl << std::endl;
return; return;
} }
@ -335,7 +333,7 @@ void PMuppCanvas::CheckIPCMsgQueue()
if (msgLen > 0) { if (msgLen > 0) {
status = ReadPlotData(msg.mtext); status = ReadPlotData(msg.mtext);
if (status != 0) { if (status != 0) {
cerr << "**ERROR** reading " << msg.mtext << endl; std::cerr << "**ERROR** reading " << msg.mtext << std::endl;
} }
} }
} }
@ -348,11 +346,11 @@ void PMuppCanvas::CheckIPCMsgQueue()
*/ */
int PMuppCanvas::ReadPlotData(const Char_t *fln) int PMuppCanvas::ReadPlotData(const Char_t *fln)
{ {
ifstream fin(fln, ifstream::in); std::ifstream fin(fln, std::ifstream::in);
char line[1024]; char line[1024];
if (!fin.is_open()) { if (!fin.is_open()) {
cerr << "**ERROR** Couldn't open " << fln << endl; std::cerr << "**ERROR** Couldn't open " << fln << std::endl;
return -1; return -1;
} }
@ -383,12 +381,12 @@ int PMuppCanvas::ReadPlotData(const Char_t *fln)
str = line; str = line;
tok = str.Tokenize(":,"); tok = str.Tokenize(":,");
if (tok == 0) { if (tok == 0) {
cerr << "**ERROR** Couldn't tokenize the label line." << endl; std::cerr << "**ERROR** Couldn't tokenize the label line." << std::endl;
fin.close(); fin.close();
return -2; return -2;
} }
if (tok->GetEntries() < 4) { if (tok->GetEntries() < 4) {
cerr << "**ERROR** label line doesn't contain sufficient information." << endl; std::cerr << "**ERROR** label line doesn't contain sufficient information." << std::endl;
fin.close(); fin.close();
return -3; return -3;
} }
@ -408,12 +406,12 @@ int PMuppCanvas::ReadPlotData(const Char_t *fln)
str = line; str = line;
tok = str.Tokenize(", "); tok = str.Tokenize(", ");
if (tok == 0) { if (tok == 0) {
cerr << "**ERROR** Couldn't tokenize data line." << endl; std::cerr << "**ERROR** Couldn't tokenize data line." << std::endl;
fin.close(); fin.close();
return -4; return -4;
} }
if (tok->GetEntries() != (noOfDataTokens-1)*3+1) { if (tok->GetEntries() != (noOfDataTokens-1)*3+1) {
cerr << "**ERROR** number of token in data line (" << tok->GetEntries() << ") is inconsistent with no of labels (" << noOfDataTokens << ")." << endl; std::cerr << "**ERROR** number of token in data line (" << tok->GetEntries() << ") is inconsistent with no of labels (" << noOfDataTokens << ")." << std::endl;
fin.close(); fin.close();
return -4; return -4;
} }
@ -426,7 +424,7 @@ int PMuppCanvas::ReadPlotData(const Char_t *fln)
ostr = dynamic_cast<TObjString*>(tok->At(0)); ostr = dynamic_cast<TObjString*>(tok->At(0));
str = ostr->GetString(); str = ostr->GetString();
if (!str.IsFloat()) { if (!str.IsFloat()) {
cerr << "**ERROR** token found in data line is not a number (" << str << ")." << endl; std::cerr << "**ERROR** token found in data line is not a number (" << str << ")." << std::endl;
fin.close(); fin.close();
return -5; return -5;
} }
@ -439,7 +437,7 @@ int PMuppCanvas::ReadPlotData(const Char_t *fln)
ostr = dynamic_cast<TObjString*>(tok->At(i)); ostr = dynamic_cast<TObjString*>(tok->At(i));
str = ostr->GetString(); str = ostr->GetString();
if (!str.IsFloat()) { if (!str.IsFloat()) {
cerr << "**ERROR** token found in data line is not a number (" << str << ")." << endl; std::cerr << "**ERROR** token found in data line is not a number (" << str << ")." << std::endl;
fin.close(); fin.close();
return -5; return -5;
} }
@ -449,7 +447,7 @@ int PMuppCanvas::ReadPlotData(const Char_t *fln)
ostr = dynamic_cast<TObjString*>(tok->At(i+1)); ostr = dynamic_cast<TObjString*>(tok->At(i+1));
str = ostr->GetString(); str = ostr->GetString();
if (!str.IsFloat()) { if (!str.IsFloat()) {
cerr << "**ERROR** token found in data line is not a number (" << str << ")." << endl; std::cerr << "**ERROR** token found in data line is not a number (" << str << ")." << std::endl;
fin.close(); fin.close();
return -5; return -5;
} }
@ -459,7 +457,7 @@ int PMuppCanvas::ReadPlotData(const Char_t *fln)
ostr = dynamic_cast<TObjString*>(tok->At(i+2)); ostr = dynamic_cast<TObjString*>(tok->At(i+2));
str = ostr->GetString(); str = ostr->GetString();
if (!str.IsFloat()) { if (!str.IsFloat()) {
cerr << "**ERROR** token found in data line is not a number (" << str << ")." << endl; std::cerr << "**ERROR** token found in data line is not a number (" << str << ")." << std::endl;
fin.close(); fin.close();
return -5; return -5;
} }
@ -480,23 +478,23 @@ int PMuppCanvas::ReadPlotData(const Char_t *fln)
// check if data structure makes sense // check if data structure makes sense
for (UInt_t i=0; i<fPlotData.size(); i++) { for (UInt_t i=0; i<fPlotData.size(); i++) {
cerr << "debug> collection " << i << endl; std::cerr << "debug> collection " << i << std::endl;
cerr << "debug> name : " << fPlotData[i].name << endl; std::cerr << "debug> name : " << fPlotData[i].name << std::endl;
cerr << "debug> x-label : " << fPlotData[i].xLabel << endl; std::cerr << "debug> x-label : " << fPlotData[i].xLabel << std::endl;
cerr << "debug> x-vales : " << endl; std::cerr << "debug> x-vales : " << std::endl;
cerr << "debug> "; std::cerr << "debug> ";
for (UInt_t j=0; j<fPlotData[i].xValue.size(); j++) { for (UInt_t j=0; j<fPlotData[i].xValue.size(); j++) {
cerr << fPlotData[i].xValue[j] << ", "; std::cerr << fPlotData[i].xValue[j] << ", ";
} }
cerr << endl; std::cerr << std::endl;
for (UInt_t j=0; j<fPlotData[i].yValue.size(); j++) { for (UInt_t j=0; j<fPlotData[i].yValue.size(); j++) {
cerr << "debug> y-label : " << fPlotData[i].yLabel[j] << endl; std::cerr << "debug> y-label : " << fPlotData[i].yLabel[j] << std::endl;
cerr << "debug> y-values " << j << ": " << endl; std::cerr << "debug> y-values " << j << ": " << std::endl;
for (UInt_t k=0; k<fPlotData[i].yValue[j].size(); k++) { for (UInt_t k=0; k<fPlotData[i].yValue[j].size(); k++) {
cerr << "debug> " << k << ": " << fPlotData[i].yValue[j][k].y << "(" << fPlotData[i].yValue[j][k].eYneg << "/" << fPlotData[i].yValue[j][k].eYpos << ")" << endl; std::cerr << "debug> " << k << ": " << fPlotData[i].yValue[j][k].y << "(" << fPlotData[i].yValue[j][k].eYneg << "/" << fPlotData[i].yValue[j][k].eYpos << ")" << std::endl;
} }
} }
cerr << endl; std::cerr << std::endl;
} }
// feed graph objects // feed graph objects
@ -591,12 +589,12 @@ void PMuppCanvas::UpdateGraphs()
fMultiGraph = new TMultiGraph(); fMultiGraph = new TMultiGraph();
if (fMultiGraph == 0) { if (fMultiGraph == 0) {
cerr << "**ERROR** couldn't create necessary TMultiGraph object." << endl; std::cerr << "**ERROR** couldn't create necessary TMultiGraph object." << std::endl;
return; return;
} }
if (fGraphE.size() == 0) { if (fGraphE.size() == 0) {
cerr << "**ERROR** NO graphs present! This should never happen." << endl; std::cerr << "**ERROR** NO graphs present! This should never happen." << std::endl;
return; return;
} }

View File

@ -31,7 +31,6 @@
#define _PMUPPCANVAS_H_ #define _PMUPPCANVAS_H_
#include <vector> #include <vector>
using namespace std;
#include <TObject.h> #include <TObject.h>
#include <TQObject.h> #include <TQObject.h>
@ -63,7 +62,7 @@ typedef struct {
TString xLabel; TString xLabel;
PStringVector yLabel; PStringVector yLabel;
PDoubleVector xValue; PDoubleVector xValue;
vector< vector<PDataPoint> > yValue; std::vector< std::vector<PDataPoint> > yValue;
} PDataCollection; } PDataCollection;
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -95,7 +94,7 @@ private:
TString fFtokName; TString fFtokName;
TTimer *fCheckMsgQueue; ///< timer needed to check if a message in the IPC message queue is pending TTimer *fCheckMsgQueue; ///< timer needed to check if a message in the IPC message queue is pending
vector<PDataCollection> fPlotData; std::vector<PDataCollection> fPlotData;
TStyle *fStyle; ///< A collection of all graphics attributes TStyle *fStyle; ///< A collection of all graphics attributes
@ -107,7 +106,7 @@ private:
// canvas related variables // canvas related variables
TCanvas *fMainCanvas; ///< main canvas TCanvas *fMainCanvas; ///< main canvas
TMultiGraph *fMultiGraph; ///< main multi graph TMultiGraph *fMultiGraph; ///< main multi graph
vector<TGraphAsymmErrors*> fGraphE; ///< all error graphs std::vector<TGraphAsymmErrors*> fGraphE; ///< all error graphs
// perdefined markers, colors // perdefined markers, colors
PIntVector fMarkerStyleList; PIntVector fMarkerStyleList;

View File

@ -29,7 +29,6 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
using namespace std;
#include "PMuppStartupHandler.h" #include "PMuppStartupHandler.h"
@ -53,14 +52,14 @@ ClassImpQ(PMuppStartupHandler)
int parseXmlFile(TSAXParser *saxParser, const char *startup_path_name) int parseXmlFile(TSAXParser *saxParser, const char *startup_path_name)
{ {
int status; int status;
fstream xmlFile; std::fstream xmlFile;
unsigned int xmlSize = 0; unsigned int xmlSize = 0;
char *xmlBuffer = 0; char *xmlBuffer = 0;
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 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) 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 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.read(xmlBuffer, xmlSize); // read in the whole XML file into the buffer
xmlFile.close(); // close the XML file xmlFile.close(); // close the XML file
@ -203,13 +202,13 @@ void PMuppStartupHandler::OnCharacters(const Char_t *str)
tstr = TString(str); tstr = TString(str);
tokens = tstr.Tokenize(","); tokens = tstr.Tokenize(",");
if (tokens == 0) { if (tokens == 0) {
cerr << endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a marker code, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a marker code, will ignore it";
cerr << endl; std::cerr << std::endl;
return; return;
} }
if (tokens->GetEntries() != 2) { if (tokens->GetEntries() != 2) {
cerr << endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a marker code, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a marker code, will ignore it";
cerr << endl; std::cerr << std::endl;
return; return;
} }
// get marker style // get marker style
@ -218,8 +217,8 @@ void PMuppStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsDigit()) { if (tstr.IsDigit()) {
fMarkerStyleList.push_back(tstr.Atoi()); fMarkerStyleList.push_back(tstr.Atoi());
} else { } else {
cerr << endl << "PMuppStartupHandler **WARNING** marker style '" << str << "' is not a number, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** marker style '" << str << "' is not a number, will ignore it";
cerr << endl; std::cerr << std::endl;
} }
// get marker size // get marker size
ostr = dynamic_cast<TObjString*>(tokens->At(1)); ostr = dynamic_cast<TObjString*>(tokens->At(1));
@ -227,8 +226,8 @@ void PMuppStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsFloat()) { if (tstr.IsFloat()) {
fMarkerSizeList.push_back(tstr.Atof()); fMarkerSizeList.push_back(tstr.Atof());
} else { } else {
cerr << endl << "PMuppStartupHandler **WARNING** marker size '" << str << "' is not a float, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** marker size '" << str << "' is not a float, will ignore it";
cerr << endl; std::cerr << std::endl;
} }
// clean up tokens // clean up tokens
if (tokens) { if (tokens) {
@ -242,14 +241,14 @@ void PMuppStartupHandler::OnCharacters(const Char_t *str)
tokens = tstr.Tokenize(","); tokens = tstr.Tokenize(",");
// check that there any tokens // check that there any tokens
if (tokens == 0) { if (tokens == 0) {
cerr << endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
cerr << endl; std::cerr << std::endl;
return; return;
} }
// check there is the right number of tokens // check there is the right number of tokens
if (tokens->GetEntries() < 3) { if (tokens->GetEntries() < 3) {
cerr << endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** '" << str << "' is not a rbg code, will ignore it";
cerr << endl; std::cerr << std::endl;
return; return;
} }
// get r // get r
@ -258,8 +257,8 @@ void PMuppStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsDigit()) { if (tstr.IsDigit()) {
r = tstr.Atoi(); r = tstr.Atoi();
} else { } else {
cerr << endl << "PMuppStartupHandler **WARNING** r within the rgb code is not a number, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** r within the rgb code is not a number, will ignore it";
cerr << endl; std::cerr << std::endl;
return; return;
} }
// get g // get g
@ -268,8 +267,8 @@ void PMuppStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsDigit()) { if (tstr.IsDigit()) {
g = tstr.Atoi(); g = tstr.Atoi();
} else { } else {
cerr << endl << "PMuppStartupHandler **WARNING** g within the rgb code is not a number, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** g within the rgb code is not a number, will ignore it";
cerr << endl; std::cerr << std::endl;
return; return;
} }
// get b // get b
@ -278,8 +277,8 @@ void PMuppStartupHandler::OnCharacters(const Char_t *str)
if (tstr.IsDigit()) { if (tstr.IsDigit()) {
b = tstr.Atoi(); b = tstr.Atoi();
} else { } else {
cerr << endl << "PMuppStartupHandler **WARNING** b within the rgb code is not a number, will ignore it"; std::cerr << std::endl << "PMuppStartupHandler **WARNING** b within the rgb code is not a number, will ignore it";
cerr << endl; std::cerr << std::endl;
return; return;
} }
// clean up tokens // clean up tokens
@ -320,8 +319,8 @@ void PMuppStartupHandler::OnComment(const Char_t *str)
*/ */
void PMuppStartupHandler::OnWarning(const Char_t *str) void PMuppStartupHandler::OnWarning(const Char_t *str)
{ {
cerr << endl << "PMuppStartupHandler **WARNING** " << str; std::cerr << std::endl << "PMuppStartupHandler **WARNING** " << str;
cerr << endl; std::cerr << std::endl;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -334,8 +333,8 @@ void PMuppStartupHandler::OnWarning(const Char_t *str)
*/ */
void PMuppStartupHandler::OnError(const Char_t *str) void PMuppStartupHandler::OnError(const Char_t *str)
{ {
cerr << endl << "PMuppStartupHandler **ERROR** " << str; std::cerr << std::endl << "PMuppStartupHandler **ERROR** " << str;
cerr << endl; std::cerr << std::endl;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -348,8 +347,8 @@ void PMuppStartupHandler::OnError(const Char_t *str)
*/ */
void PMuppStartupHandler::OnFatalError(const Char_t *str) void PMuppStartupHandler::OnFatalError(const Char_t *str)
{ {
cerr << endl << "PMuppStartupHandler **FATAL ERROR** " << str; std::cerr << std::endl << "PMuppStartupHandler **FATAL ERROR** " << str;
cerr << endl; std::cerr << std::endl;
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -444,7 +443,7 @@ Bool_t PMuppStartupHandler::StartupFileExists(Char_t *fln)
{ {
Bool_t result = false; Bool_t result = false;
ifstream ifile(fln); std::ifstream ifile(fln);
if (ifile.fail()) { if (ifile.fail()) {
result = false; result = false;

View File

@ -28,7 +28,6 @@
***************************************************************************/ ***************************************************************************/
#include <iostream> #include <iostream>
using namespace std;
#include <TApplication.h> #include <TApplication.h>
#include <TSAXParser.h> #include <TSAXParser.h>
@ -59,8 +58,8 @@ int main(int argc, char *argv[])
TSAXParser *saxParser = new TSAXParser(); TSAXParser *saxParser = new TSAXParser();
PMuppStartupHandler *startupHandler = new PMuppStartupHandler(); PMuppStartupHandler *startupHandler = new PMuppStartupHandler();
if (!startupHandler->StartupFileFound()) { if (!startupHandler->StartupFileFound()) {
cerr << endl << ">> mupp_plot **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data(); std::cerr << std::endl << ">> mupp_plot **WARNING** couldn't find " << startupHandler->GetStartupFilePath().Data();
cerr << endl; std::cerr << std::endl;
// clean up // clean up
if (saxParser) { if (saxParser) {
delete saxParser; delete saxParser;
@ -78,9 +77,9 @@ int main(int argc, char *argv[])
Int_t status = parseXmlFile(saxParser, startup_path_name); Int_t status = parseXmlFile(saxParser, startup_path_name);
// check for parse errors // check for parse errors
if (status) { // error if (status) { // error
cerr << endl << ">> mupp_plot **WARNING** Reading/parsing mupp_startup.xml failed."; std::cerr << std::endl << ">> mupp_plot **WARNING** Reading/parsing mupp_startup.xml failed.";
cerr << endl << ">> Graph will appear with random symbols and colors!"; std::cerr << std::endl << ">> Graph will appear with random symbols and colors!";
cerr << endl; std::cerr << std::endl;
// clean up // clean up
if (saxParser) { if (saxParser) {
delete saxParser; delete saxParser;
@ -110,13 +109,13 @@ int main(int argc, char *argv[])
TQObject::Connect("TCanvas", "Closed()", "PMuppCanvas", muppCanvas, "LastCanvasClosed()"); TQObject::Connect("TCanvas", "Closed()", "PMuppCanvas", muppCanvas, "LastCanvasClosed()");
muppCanvas->Connect("Done(Int_t)", "TApplication", &app, "Terminate(Int_t)"); muppCanvas->Connect("Done(Int_t)", "TApplication", &app, "Terminate(Int_t)");
} else { } else {
cerr << endl << ">> mupp_plot **SEVERE ERROR** invoke object is invalid, will quit."; std::cerr << std::endl << ">> mupp_plot **SEVERE ERROR** invoke object is invalid, will quit.";
cerr << endl; std::cerr << std::endl;
ok = false; ok = false;
} }
} else { } else {
cerr << endl << ">> mupp_plot **SEVERE ERROR** Couldn't invoke all necessary objects, will quit."; std::cerr << std::endl << ">> mupp_plot **SEVERE ERROR** Couldn't invoke all necessary objects, will quit.";
cerr << endl; std::cerr << std::endl;
ok = false; ok = false;
} }

View File

@ -31,7 +31,7 @@
#define _MUPP_PLOT_H_ #define _MUPP_PLOT_H_
#include <vector> #include <vector>
using namespace std; #include <utility>
#include <TROOT.h> #include <TROOT.h>
#include <TString.h> #include <TString.h>
@ -40,54 +40,54 @@ using namespace std;
/** /**
* <p>typedef to make to code more readable. Definition of a bool vector. * <p>typedef to make to code more readable. Definition of a bool vector.
*/ */
typedef vector<Bool_t> PBoolVector; typedef std::vector<Bool_t> PBoolVector;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of an unsigned int vector * <p>typedef to make to code more readable. Definition of an unsigned int vector
*/ */
typedef vector<UInt_t> PUIntVector; typedef std::vector<UInt_t> PUIntVector;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of an int vector * <p>typedef to make to code more readable. Definition of an int vector
*/ */
typedef vector<Int_t> PIntVector; typedef std::vector<Int_t> PIntVector;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of an int pair * <p>typedef to make to code more readable. Definition of an int pair
*/ */
typedef pair<Int_t, Int_t> PIntPair; typedef std::pair<Int_t, Int_t> PIntPair;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of an int pair vector * <p>typedef to make to code more readable. Definition of an int pair vector
*/ */
typedef vector<PIntPair> PIntPairVector; typedef std::vector<PIntPair> PIntPairVector;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of a double vector * <p>typedef to make to code more readable. Definition of a double vector
*/ */
typedef vector<Double_t> PDoubleVector; typedef std::vector<Double_t> PDoubleVector;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of a double pair * <p>typedef to make to code more readable. Definition of a double pair
*/ */
typedef pair<Double_t, Double_t> PDoublePair; typedef std::pair<Double_t, Double_t> PDoublePair;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of a double pair vector * <p>typedef to make to code more readable. Definition of a double pair vector
*/ */
typedef vector<PDoublePair> PDoublePairVector; typedef std::vector<PDoublePair> PDoublePairVector;
//------------------------------------------------------------- //-------------------------------------------------------------
/** /**
* <p>typedef to make to code more readable. Definition of a string vector * <p>typedef to make to code more readable. Definition of a string vector
*/ */
typedef vector<TString> PStringVector; typedef std::vector<TString> PStringVector;
#endif // _MUPP_PLOT_H_ #endif // _MUPP_PLOT_H_