some improvements for non-musr type handling
This commit is contained in:
@ -70,6 +70,7 @@ PMusrCanvas::PMusrCanvas()
|
|||||||
fParameterPad = 0;
|
fParameterPad = 0;
|
||||||
fTheoryPad = 0;
|
fTheoryPad = 0;
|
||||||
fInfoPad = 0;
|
fInfoPad = 0;
|
||||||
|
fMultiGraphLegend = 0;
|
||||||
|
|
||||||
fMultiGraphData = 0;
|
fMultiGraphData = 0;
|
||||||
fMultiGraphDiff = 0;
|
fMultiGraphDiff = 0;
|
||||||
@ -143,6 +144,28 @@ PMusrCanvas::~PMusrCanvas()
|
|||||||
delete fTitlePad;
|
delete fTitlePad;
|
||||||
fTitlePad = 0;
|
fTitlePad = 0;
|
||||||
}
|
}
|
||||||
|
if (fData.size() > 0) {
|
||||||
|
for (unsigned int i=0; i<fData.size(); i++)
|
||||||
|
CleanupDataSet(fData[i]);
|
||||||
|
fData.clear();
|
||||||
|
}
|
||||||
|
if (fNonMusrData.size() > 0) {
|
||||||
|
for (unsigned int i=0; i<fNonMusrData.size(); i++)
|
||||||
|
CleanupDataSet(fNonMusrData[i]);
|
||||||
|
fNonMusrData.clear();
|
||||||
|
}
|
||||||
|
if (fMultiGraphData) {
|
||||||
|
delete fMultiGraphData;
|
||||||
|
fMultiGraphData = 0;
|
||||||
|
}
|
||||||
|
if (fMultiGraphDiff) {
|
||||||
|
delete fMultiGraphDiff;
|
||||||
|
fMultiGraphDiff = 0;
|
||||||
|
}
|
||||||
|
if (fCurrentFourierPhaseText) {
|
||||||
|
delete fCurrentFourierPhaseText;
|
||||||
|
fCurrentFourierPhaseText = 0;
|
||||||
|
}
|
||||||
if (fDataTheoryPad) {
|
if (fDataTheoryPad) {
|
||||||
delete fDataTheoryPad;
|
delete fDataTheoryPad;
|
||||||
fDataTheoryPad = 0;
|
fDataTheoryPad = 0;
|
||||||
@ -162,32 +185,15 @@ PMusrCanvas::~PMusrCanvas()
|
|||||||
delete fInfoPad;
|
delete fInfoPad;
|
||||||
fInfoPad = 0;
|
fInfoPad = 0;
|
||||||
}
|
}
|
||||||
|
if (fMultiGraphLegend) {
|
||||||
|
fMultiGraphLegend->Clear();
|
||||||
|
delete fMultiGraphLegend;
|
||||||
|
fMultiGraphLegend = 0;
|
||||||
|
}
|
||||||
if (fMainCanvas) {
|
if (fMainCanvas) {
|
||||||
delete fMainCanvas;
|
delete fMainCanvas;
|
||||||
fMainCanvas = 0;
|
fMainCanvas = 0;
|
||||||
}
|
}
|
||||||
if (fData.size() > 0) {
|
|
||||||
for (unsigned int i=0; i<fData.size(); i++)
|
|
||||||
CleanupDataSet(fData[i]);
|
|
||||||
fData.clear();
|
|
||||||
}
|
|
||||||
if (fMultiGraphData) {
|
|
||||||
delete fMultiGraphData;
|
|
||||||
fMultiGraphData = 0;
|
|
||||||
}
|
|
||||||
if (fMultiGraphDiff) {
|
|
||||||
delete fMultiGraphDiff;
|
|
||||||
fMultiGraphDiff = 0;
|
|
||||||
}
|
|
||||||
if (fNonMusrData.size() > 0) {
|
|
||||||
for (unsigned int i=0; i<fNonMusrData.size(); i++)
|
|
||||||
CleanupDataSet(fNonMusrData[i]);
|
|
||||||
fNonMusrData.clear();
|
|
||||||
}
|
|
||||||
if (fCurrentFourierPhaseText) {
|
|
||||||
delete fCurrentFourierPhaseText;
|
|
||||||
fCurrentFourierPhaseText = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -1013,6 +1019,7 @@ void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, In
|
|||||||
fParameterPad = 0;
|
fParameterPad = 0;
|
||||||
fTheoryPad = 0;
|
fTheoryPad = 0;
|
||||||
fInfoPad = 0;
|
fInfoPad = 0;
|
||||||
|
fMultiGraphLegend = 0;
|
||||||
|
|
||||||
// invoke canvas
|
// invoke canvas
|
||||||
TString canvasName = TString("fMainCanvas");
|
TString canvasName = TString("fMainCanvas");
|
||||||
@ -2265,12 +2272,36 @@ void PMusrCanvas::PlotData()
|
|||||||
} else {
|
} else {
|
||||||
fMultiGraphData->GetYaxis()->UnZoom();
|
fMultiGraphData->GetYaxis()->UnZoom();
|
||||||
}
|
}
|
||||||
// set x-axis label
|
|
||||||
fMultiGraphData->GetXaxis()->SetTitle(xAxisTitle.Data());
|
// set x-, y-axis label only if there is just one data set
|
||||||
// set y-axis label
|
if (fNonMusrData.size() == 1) {
|
||||||
fMultiGraphData->GetYaxis()->SetTitle(yAxisTitle.Data());
|
// set x-axis label
|
||||||
|
fMultiGraphData->GetXaxis()->SetTitle(xAxisTitle.Data());
|
||||||
|
// set y-axis label
|
||||||
|
fMultiGraphData->GetYaxis()->SetTitle(yAxisTitle.Data());
|
||||||
|
} else { // more than one data set present, hence add a legend
|
||||||
|
if (fMultiGraphLegend) {
|
||||||
|
delete fMultiGraphLegend;
|
||||||
|
}
|
||||||
|
fMultiGraphLegend = new TLegend(0.8, 0.8, 1.0, 1.0);
|
||||||
|
assert(fMultiGraphLegend != 0);
|
||||||
|
PStringVector legendLabel;
|
||||||
|
for (unsigned int i=0; i<plotInfo.fRuns.size(); i++) {
|
||||||
|
runNo = (unsigned int)plotInfo.fRuns[i].Re()-1;
|
||||||
|
xAxisTitle = fRunList->GetXAxisTitle(runs[runNo].fRunName[0], runNo);
|
||||||
|
yAxisTitle = fRunList->GetYAxisTitle(runs[runNo].fRunName[0], runNo);
|
||||||
|
legendLabel.push_back(xAxisTitle + " vs. " + yAxisTitle);
|
||||||
|
}
|
||||||
|
for (unsigned int i=0; i<fNonMusrData.size(); i++) {
|
||||||
|
fMultiGraphLegend->AddEntry(fNonMusrData[i].data, legendLabel[i].Data(), "p");
|
||||||
|
}
|
||||||
|
legendLabel.clear();
|
||||||
|
}
|
||||||
|
|
||||||
fMultiGraphData->Draw("a");
|
fMultiGraphData->Draw("a");
|
||||||
|
|
||||||
|
if (fMultiGraphLegend)
|
||||||
|
fMultiGraphLegend->Draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +935,7 @@ bool PRunDataHandler::ReadAsciiFile()
|
|||||||
// open file
|
// open file
|
||||||
ifstream f;
|
ifstream f;
|
||||||
|
|
||||||
// open dump-file
|
// open data-file
|
||||||
f.open(fRunPathName.Data(), ifstream::in);
|
f.open(fRunPathName.Data(), ifstream::in);
|
||||||
if (!f.is_open()) {
|
if (!f.is_open()) {
|
||||||
cout << endl << "PRunDataHandler::ReadAsciiFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ...";
|
cout << endl << "PRunDataHandler::ReadAsciiFile **ERROR** Couldn't open data file (" << fRunPathName.Data() << ") for reading, sorry ...";
|
||||||
@ -946,8 +946,7 @@ bool PRunDataHandler::ReadAsciiFile()
|
|||||||
PRawRunData runData;
|
PRawRunData runData;
|
||||||
|
|
||||||
// init some stuff
|
// init some stuff
|
||||||
runData.fDataNonMusr.fXIndex = 0;
|
runData.fDataNonMusr.fFromAscii = true;
|
||||||
runData.fDataNonMusr.fYIndex = 1;
|
|
||||||
runData.fDataNonMusr.fLabels.push_back("??"); // x default label
|
runData.fDataNonMusr.fLabels.push_back("??"); // x default label
|
||||||
runData.fDataNonMusr.fLabels.push_back("??"); // y default label
|
runData.fDataNonMusr.fLabels.push_back("??"); // y default label
|
||||||
|
|
||||||
@ -1253,8 +1252,7 @@ bool PRunDataHandler::ReadDBFile()
|
|||||||
|
|
||||||
PRawRunData runData;
|
PRawRunData runData;
|
||||||
|
|
||||||
runData.fDataNonMusr.fXIndex = -1;
|
runData.fDataNonMusr.fFromAscii = false;
|
||||||
runData.fDataNonMusr.fYIndex = -1;
|
|
||||||
|
|
||||||
int lineNo = 0;
|
int lineNo = 0;
|
||||||
int idx;
|
int idx;
|
||||||
|
@ -489,14 +489,27 @@ const char* PRunListCollection::GetSetup(TString &runName)
|
|||||||
*/
|
*/
|
||||||
const char* PRunListCollection::GetXAxisTitle(TString &runName, const unsigned int idx)
|
const char* PRunListCollection::GetXAxisTitle(TString &runName, const unsigned int idx)
|
||||||
{
|
{
|
||||||
|
//cout << endl << ">> PRunListCollection::GetXAxisTitle: runName = " << runName.Data() << ", idx = " << idx;
|
||||||
|
//cout << endl << ">> PRunListCollection::GetXAxisTitle: fRunNonMusrList.size() = " << fRunNonMusrList.size();
|
||||||
|
//cout << endl;
|
||||||
|
|
||||||
PRawRunData *runData = fData->GetRunData(runName);
|
PRawRunData *runData = fData->GetRunData(runName);
|
||||||
|
|
||||||
int index = fRunNonMusrList[idx]->GetXIndex();
|
const char *result = 0;
|
||||||
|
|
||||||
// cout << endl << ">>PRunListCollection::GetXAxisTitle, x-index = " << index;
|
if (runData->fDataNonMusr.fFromAscii) {
|
||||||
// cout << endl;
|
result = runData->fDataNonMusr.fLabels[0].Data();
|
||||||
|
} else {
|
||||||
|
for (unsigned int i=0; i<fRunNonMusrList.size(); i++) {
|
||||||
|
if (fRunNonMusrList[i]->GetRunNo() == idx) {
|
||||||
|
int index = fRunNonMusrList[i]->GetXIndex();
|
||||||
|
result = runData->fDataNonMusr.fLabels[index].Data();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return runData->fDataNonMusr.fLabels[index].Data();
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -510,13 +523,25 @@ const char* PRunListCollection::GetXAxisTitle(TString &runName, const unsigned i
|
|||||||
*/
|
*/
|
||||||
const char* PRunListCollection::GetYAxisTitle(TString &runName, const unsigned int idx)
|
const char* PRunListCollection::GetYAxisTitle(TString &runName, const unsigned int idx)
|
||||||
{
|
{
|
||||||
|
//cout << endl << ">> PRunListCollection::GetYAxisTitle: runName = " << runName.Data() << ", idx = " << idx;
|
||||||
|
//cout << endl;
|
||||||
|
|
||||||
PRawRunData *runData = fData->GetRunData(runName);
|
PRawRunData *runData = fData->GetRunData(runName);
|
||||||
|
|
||||||
int index = fRunNonMusrList[idx]->GetYIndex();
|
const char *result = 0;
|
||||||
|
|
||||||
// cout << endl << ">>PRunListCollection::GetYAxisTitle, y-index = " << index;
|
if (runData->fDataNonMusr.fFromAscii) {
|
||||||
// cout << endl;
|
result = runData->fDataNonMusr.fLabels[1].Data();
|
||||||
|
} else {
|
||||||
|
for (unsigned int i=0; i<fRunNonMusrList.size(); i++) {
|
||||||
|
if (fRunNonMusrList[i]->GetRunNo() == idx) {
|
||||||
|
int index = fRunNonMusrList[i]->GetYIndex();
|
||||||
|
result = runData->fDataNonMusr.fLabels[index].Data();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return runData->fDataNonMusr.fLabels[index].Data();
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ bool PRunNonMusr::PrepareData()
|
|||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
cout << endl << "in PRunNonMusr::PrepareData(): will feed fFitData";
|
//cout << endl << "in PRunNonMusr::PrepareData(): will feed fFitData";
|
||||||
|
|
||||||
if (fRunInfo->fRunName.size() > 1) { // ADDRUN present which is not supported for NonMusr
|
if (fRunInfo->fRunName.size() > 1) { // ADDRUN present which is not supported for NonMusr
|
||||||
cout << endl << ">> PRunNonMusr::PrepareData(): **WARNING** ADDRUN NOT SUPPORTED FOR THIS FIT TYPE, WILL IGNORE IT." << endl;
|
cout << endl << ">> PRunNonMusr::PrepareData(): **WARNING** ADDRUN NOT SUPPORTED FOR THIS FIT TYPE, WILL IGNORE IT." << endl;
|
||||||
@ -374,10 +374,10 @@ unsigned int PRunNonMusr::GetXIndex()
|
|||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
//cout << endl << ">> PRunNonMusr::GetXIndex: fRawRunData->fDataNonMusr.fXIndex = " << fRawRunData->fDataNonMusr.fXIndex;
|
//cout << endl << ">> PRunNonMusr::GetXIndex: fRawRunData->fDataNonMusr.fFromAscii = " << fRawRunData->fDataNonMusr.fFromAscii;
|
||||||
if (fRawRunData->fDataNonMusr.fXIndex >= 0) { // ascii-file format
|
if (fRawRunData->fDataNonMusr.fFromAscii) { // ascii-file format
|
||||||
//cout << endl << ">> PRunNonMusr::GetXIndex: ascii-file format";
|
//cout << endl << ">> PRunNonMusr::GetXIndex: ascii-file format";
|
||||||
index = fRawRunData->fDataNonMusr.fXIndex;
|
index = 0;
|
||||||
found = true;
|
found = true;
|
||||||
} else { // db-file format
|
} else { // db-file format
|
||||||
//cout << endl << ">> PRunNonMusr::GetXIndex: db-file format";
|
//cout << endl << ">> PRunNonMusr::GetXIndex: db-file format";
|
||||||
@ -421,8 +421,8 @@ unsigned int PRunNonMusr::GetYIndex()
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
// cout << endl << ">> PRunNonMusr::GetYIndex:";
|
// cout << endl << ">> PRunNonMusr::GetYIndex:";
|
||||||
if (fRawRunData->fDataNonMusr.fYIndex >= 0) { // ascii-file format
|
if (fRawRunData->fDataNonMusr.fFromAscii) { // ascii-file format
|
||||||
index = fRawRunData->fDataNonMusr.fYIndex;
|
index = 1;
|
||||||
found = true;
|
found = true;
|
||||||
} else { // db-file format
|
} else { // db-file format
|
||||||
if (fRunInfo->fXYDataIndex[1] > 0) { // xy-data already indices
|
if (fRunInfo->fXYDataIndex[1] > 0) { // xy-data already indices
|
||||||
|
@ -166,8 +166,7 @@ typedef struct {
|
|||||||
* <p>
|
* <p>
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fXIndex; ///< index for the x-data vector
|
bool fFromAscii; ///< if true: data file was an ascii input file, otherwise it is a db input file
|
||||||
int fYIndex; ///< index for the y-data vector
|
|
||||||
PStringVector fLabels; ///< vector of all labels (used for x-, y-axis title in view)
|
PStringVector fLabels; ///< vector of all labels (used for x-, y-axis title in view)
|
||||||
PStringVector fDataTags; ///< vector of all data tags
|
PStringVector fDataTags; ///< vector of all data tags
|
||||||
vector<PDoubleVector> fData; ///< vector of all data
|
vector<PDoubleVector> fData; ///< vector of all data
|
||||||
|
@ -200,6 +200,7 @@ class PMusrCanvas : public TObject, public TQObject
|
|||||||
TPaveText *fParameterPad;
|
TPaveText *fParameterPad;
|
||||||
TPaveText *fTheoryPad;
|
TPaveText *fTheoryPad;
|
||||||
TLegend *fInfoPad;
|
TLegend *fInfoPad;
|
||||||
|
TLegend *fMultiGraphLegend;
|
||||||
|
|
||||||
#ifndef __MAKECINT__
|
#ifndef __MAKECINT__
|
||||||
PMsrHandler *fMsrHandler;
|
PMsrHandler *fMsrHandler;
|
||||||
|
Reference in New Issue
Block a user