added labels to plots
This commit is contained in:
parent
6fe5041b4c
commit
e04a34ad72
@ -394,6 +394,10 @@ void PMusrCanvas::UpdateParamTheoryPad()
|
|||||||
*/
|
*/
|
||||||
void PMusrCanvas::UpdateDataTheoryPad()
|
void PMusrCanvas::UpdateDataTheoryPad()
|
||||||
{
|
{
|
||||||
|
// NonMusr axis titles
|
||||||
|
TString xAxisTitle;
|
||||||
|
TString yAxisTitle;
|
||||||
|
|
||||||
// some checks first
|
// some checks first
|
||||||
unsigned int runNo;
|
unsigned int runNo;
|
||||||
PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber);
|
PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber);
|
||||||
@ -416,6 +420,11 @@ cout << endl;
|
|||||||
cout << endl;
|
cout << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// check if NonMusr type plot and if yes get x- and y-axis title
|
||||||
|
if (plotInfo.fPlotType == MSR_PLOT_NO_MUSR) {
|
||||||
|
xAxisTitle = fRunList->GetXAxisTitle(runs[runNo].fRunName);
|
||||||
|
yAxisTitle = fRunList->GetYAxisTitle(runs[runNo].fRunName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRunData *data;
|
PRunData *data;
|
||||||
@ -498,6 +507,28 @@ cout << endl;
|
|||||||
if ((ymin != -999.0) && (ymax != -999.0)) {
|
if ((ymin != -999.0) && (ymax != -999.0)) {
|
||||||
fData[0].data->GetYaxis()->SetRangeUser(ymin, ymax);
|
fData[0].data->GetYaxis()->SetRangeUser(ymin, ymax);
|
||||||
}
|
}
|
||||||
|
// set x-axis label
|
||||||
|
fData[0].data->GetXaxis()->SetTitle("time (#mus)");
|
||||||
|
// set y-axis label
|
||||||
|
TString yAxisTitle;
|
||||||
|
PMsrRunList *runList = fMsrHandler->GetMsrRunList();
|
||||||
|
switch (plotInfo.fPlotType) {
|
||||||
|
case MSR_PLOT_SINGLE_HISTO:
|
||||||
|
if (runList->at(0).fLifetimeCorrection) { // lifetime correction
|
||||||
|
yAxisTitle = "asymmetry";
|
||||||
|
} else { // no liftime correction
|
||||||
|
yAxisTitle = "N(t) per bin";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MSR_PLOT_ASYM:
|
||||||
|
case MSR_PLOT_ASYM_RRF:
|
||||||
|
yAxisTitle = "asymmetry";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
yAxisTitle = "??";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fData[0].data->GetYaxis()->SetTitle(yAxisTitle.Data());
|
||||||
// plot all remaining data
|
// plot all remaining data
|
||||||
for (unsigned int i=1; i<fData.size(); i++) {
|
for (unsigned int i=1; i<fData.size(); i++) {
|
||||||
fData[i].data->Draw("pesame");
|
fData[i].data->Draw("pesame");
|
||||||
@ -520,6 +551,10 @@ cout << endl;
|
|||||||
if ((ymin != -999.0) && (ymax != -999.0)) {
|
if ((ymin != -999.0) && (ymax != -999.0)) {
|
||||||
fNonMusrData[0].data->GetYaxis()->SetRangeUser(ymin, ymax);
|
fNonMusrData[0].data->GetYaxis()->SetRangeUser(ymin, ymax);
|
||||||
}
|
}
|
||||||
|
// set x-axis label
|
||||||
|
fNonMusrData[0].data->GetXaxis()->SetTitle(xAxisTitle.Data());
|
||||||
|
// set y-axis label
|
||||||
|
fNonMusrData[0].data->GetYaxis()->SetTitle(yAxisTitle.Data());
|
||||||
// plot all remaining data
|
// plot all remaining data
|
||||||
for (unsigned int i=1; i<fNonMusrData.size(); i++) {
|
for (unsigned int i=1; i<fNonMusrData.size(); i++) {
|
||||||
fNonMusrData[i].data->Draw("psame");
|
fNonMusrData[i].data->Draw("psame");
|
||||||
|
@ -816,6 +816,8 @@ bool PRunDataHandler::ReadMudFile()
|
|||||||
*
|
*
|
||||||
* HEADER
|
* HEADER
|
||||||
* TITLE: title
|
* TITLE: title
|
||||||
|
* X-AXIS-TITLE: x-axis title
|
||||||
|
* Y-AXIS-TITLE: y-axis title
|
||||||
* SETUP: setup
|
* SETUP: setup
|
||||||
* FIELD: field
|
* FIELD: field
|
||||||
* TEMP: temperature
|
* TEMP: temperature
|
||||||
@ -850,6 +852,10 @@ bool PRunDataHandler::ReadAsciiFile()
|
|||||||
|
|
||||||
PRawRunData runData;
|
PRawRunData runData;
|
||||||
|
|
||||||
|
// init some stuff
|
||||||
|
runData.fXAxisTitle = "??";
|
||||||
|
runData.fYAxisTitle = "??";
|
||||||
|
|
||||||
runData.fRunName = fRunName; // keep the run name
|
runData.fRunName = fRunName; // keep the run name
|
||||||
|
|
||||||
int lineNo = 0;
|
int lineNo = 0;
|
||||||
@ -904,6 +910,10 @@ bool PRunDataHandler::ReadAsciiFile()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
runData.fField = workStr.Atof();
|
runData.fField = workStr.Atof();
|
||||||
|
} else if (workStr.BeginsWith("x-axis-title:", TString::kIgnoreCase)) {
|
||||||
|
runData.fXAxisTitle = TString(workStr.Data()+workStr.First(":")+2);
|
||||||
|
} else if (workStr.BeginsWith("y-axis-title:", TString::kIgnoreCase)) {
|
||||||
|
runData.fYAxisTitle = TString(workStr.Data()+workStr.First(":")+2);
|
||||||
} else if (workStr.BeginsWith("temp:", TString::kIgnoreCase)) {
|
} else if (workStr.BeginsWith("temp:", TString::kIgnoreCase)) {
|
||||||
workStr = TString(workStr.Data()+workStr.First(":")+2);
|
workStr = TString(workStr.Data()+workStr.First(":")+2);
|
||||||
if (!workStr.IsFloat()) {
|
if (!workStr.IsFloat()) {
|
||||||
|
@ -478,3 +478,29 @@ const char* PRunListCollection::GetSetup(TString &runName)
|
|||||||
return fData->GetRunData(runName)->fSetup.Data();
|
return fData->GetRunData(runName)->fSetup.Data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetXAxisTitle
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* \param runName
|
||||||
|
*/
|
||||||
|
const char* PRunListCollection::GetXAxisTitle(TString &runName)
|
||||||
|
{
|
||||||
|
return fData->GetRunData(runName)->fXAxisTitle.Data();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetYAxisTitle
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* \param runName
|
||||||
|
*/
|
||||||
|
const char* PRunListCollection::GetYAxisTitle(TString &runName)
|
||||||
|
{
|
||||||
|
return fData->GetRunData(runName)->fYAxisTitle.Data();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -147,6 +147,8 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
TString fRunName; ///< name of the run
|
TString fRunName; ///< name of the run
|
||||||
TString fRunTitle; ///< run title
|
TString fRunTitle; ///< run title
|
||||||
|
TString fXAxisTitle; ///< x-axis title for noMusr view
|
||||||
|
TString fYAxisTitle; ///< x-axis title for noMusr view
|
||||||
TString fSetup; ///< description of the setup of this run
|
TString fSetup; ///< description of the setup of this run
|
||||||
double fField; ///< magnetic field value
|
double fField; ///< magnetic field value
|
||||||
double fTemp; ///< temperature during the run
|
double fTemp; ///< temperature during the run
|
||||||
|
@ -79,6 +79,8 @@ class PRunListCollection
|
|||||||
virtual double GetField(TString &runName);
|
virtual double GetField(TString &runName);
|
||||||
virtual double GetEnergy(TString &runName);
|
virtual double GetEnergy(TString &runName);
|
||||||
virtual const char* GetSetup(TString &runName);
|
virtual const char* GetSetup(TString &runName);
|
||||||
|
virtual const char* GetXAxisTitle(TString &runName);
|
||||||
|
virtual const char* GetYAxisTitle(TString &runName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PMsrHandler *fMsrInfo; ///< keeps all msr file info
|
PMsrHandler *fMsrInfo; ///< keeps all msr file info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user