added labels to plots
This commit is contained in:
parent
6fe5041b4c
commit
e04a34ad72
@ -394,6 +394,10 @@ void PMusrCanvas::UpdateParamTheoryPad()
|
||||
*/
|
||||
void PMusrCanvas::UpdateDataTheoryPad()
|
||||
{
|
||||
// NonMusr axis titles
|
||||
TString xAxisTitle;
|
||||
TString yAxisTitle;
|
||||
|
||||
// some checks first
|
||||
unsigned int runNo;
|
||||
PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber);
|
||||
@ -416,6 +420,11 @@ cout << endl;
|
||||
cout << endl;
|
||||
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;
|
||||
@ -498,6 +507,28 @@ cout << endl;
|
||||
if ((ymin != -999.0) && (ymax != -999.0)) {
|
||||
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
|
||||
for (unsigned int i=1; i<fData.size(); i++) {
|
||||
fData[i].data->Draw("pesame");
|
||||
@ -520,6 +551,10 @@ cout << endl;
|
||||
if ((ymin != -999.0) && (ymax != -999.0)) {
|
||||
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
|
||||
for (unsigned int i=1; i<fNonMusrData.size(); i++) {
|
||||
fNonMusrData[i].data->Draw("psame");
|
||||
|
@ -816,6 +816,8 @@ bool PRunDataHandler::ReadMudFile()
|
||||
*
|
||||
* HEADER
|
||||
* TITLE: title
|
||||
* X-AXIS-TITLE: x-axis title
|
||||
* Y-AXIS-TITLE: y-axis title
|
||||
* SETUP: setup
|
||||
* FIELD: field
|
||||
* TEMP: temperature
|
||||
@ -850,6 +852,10 @@ bool PRunDataHandler::ReadAsciiFile()
|
||||
|
||||
PRawRunData runData;
|
||||
|
||||
// init some stuff
|
||||
runData.fXAxisTitle = "??";
|
||||
runData.fYAxisTitle = "??";
|
||||
|
||||
runData.fRunName = fRunName; // keep the run name
|
||||
|
||||
int lineNo = 0;
|
||||
@ -904,6 +910,10 @@ bool PRunDataHandler::ReadAsciiFile()
|
||||
break;
|
||||
}
|
||||
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)) {
|
||||
workStr = TString(workStr.Data()+workStr.First(":")+2);
|
||||
if (!workStr.IsFloat()) {
|
||||
|
@ -478,3 +478,29 @@ const char* PRunListCollection::GetSetup(TString &runName)
|
||||
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 {
|
||||
TString fRunName; ///< name of the run
|
||||
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
|
||||
double fField; ///< magnetic field value
|
||||
double fTemp; ///< temperature during the run
|
||||
|
@ -79,6 +79,8 @@ class PRunListCollection
|
||||
virtual double GetField(TString &runName);
|
||||
virtual double GetEnergy(TString &runName);
|
||||
virtual const char* GetSetup(TString &runName);
|
||||
virtual const char* GetXAxisTitle(TString &runName);
|
||||
virtual const char* GetYAxisTitle(TString &runName);
|
||||
|
||||
private:
|
||||
PMsrHandler *fMsrInfo; ///< keeps all msr file info
|
||||
|
Loading…
x
Reference in New Issue
Block a user