added a first legend

This commit is contained in:
nemu 2008-04-17 06:00:51 +00:00
parent 499684fc8b
commit e5fa134ad8
5 changed files with 100 additions and 2 deletions

View File

@ -153,7 +153,6 @@ void PMusrCanvas::InitMusrCanvas(const char* title, Int_t wtopx, Int_t wtopy, In
TString canvasName = TString("fMainCanvas");
canvasName += fPlotNumber;
fMainCanvas = new TCanvas(canvasName.Data(), title, wtopx, wtopy, ww, wh);
cout << canvasName.Data() << " = " << fMainCanvas << endl;
if (fMainCanvas == 0) {
cout << endl << "PMusrCanvas::PMusrCanvas: **PANIC ERROR**: Couldn't invoke " << canvasName.Data();
cout << endl;
@ -545,6 +544,8 @@ void PMusrCanvas::UpdateInfoPad()
fInfoPad->SetHeader(tstr);
// get/set run plot info
double dval;
char sval[128];
unsigned int runNo;
PMsrPlotStructure plotInfo = fMsrHandler->GetMsrPlotList()->at(fPlotNumber);
PMsrRunList runs = *fMsrHandler->GetMsrRunList();
@ -565,9 +566,34 @@ void PMusrCanvas::UpdateInfoPad()
tstr += TString(",");
}
// temperature if present
tstr += TString("T=");
dval = fRunList->GetTemp(runs[runNo].fRunName);
if (isnan(dval)) {
tstr += TString("??,");
} else {
sprintf(sval, "%0.2lf", dval);
tstr += TString(sval) + TString("(K),");
}
// field if present
tstr += TString("B=");
dval = fRunList->GetField(runs[runNo].fRunName);
if (isnan(dval)) {
tstr += TString("??,");
} else {
sprintf(sval, "%0.2lf", dval);
tstr += TString(sval) + TString("(G),");
}
// energy if present
// more stuff if present
tstr += TString("E=");
dval = fRunList->GetEnergy(runs[runNo].fRunName);
if (isnan(dval)) {
tstr += TString("??,");
} else {
sprintf(sval, "%0.2lf", dval);
tstr += TString(sval) + TString("(keV),");
}
// setup if present
tstr += fRunList->GetSetup(runs[runNo].fRunName);
// add entry
fInfoPad->AddEntry(fData[i].data, tstr.Data(), "p");
}

View File

@ -356,6 +356,18 @@ bool PRunDataHandler::ReadRootFile()
return false;
}
// get temperature
runData.fTemp = runHeader->GetSampleTemperature();
// get field
runData.fField = runHeader->GetSampleBField();
// get implantation energy
runData.fEnergy = runHeader->GetImpEnergy();
// get setup
runData.fSetup = runHeader->GetLemSetup().GetString();
// get time resolution
runData.fTimeResolution = runHeader->GetTimeResolution();
@ -463,6 +475,7 @@ bool PRunDataHandler::ReadNemuFile()
runData.fSetup = TString("");
runData.fField = nan("NAN");
runData.fTemp = nan("NAN");
runData.fEnergy = nan("NAN");
runData.fTimeResolution = nan("NAN");
// open file

View File

@ -423,3 +423,56 @@ PRunData* PRunListCollection::GetNonMusr(unsigned int index, EDataSwitch tag)
return 0;
}
//--------------------------------------------------------------------------
// GetTemp
//--------------------------------------------------------------------------
/**
* <p>
*
* \param runName
*/
double PRunListCollection::GetTemp(TString &runName)
{
return fData->GetRunData(runName)->fTemp;
}
//--------------------------------------------------------------------------
// GetField
//--------------------------------------------------------------------------
/**
* <p>
*
* \param runName
*/
double PRunListCollection::GetField(TString &runName)
{
return fData->GetRunData(runName)->fField;
}
//--------------------------------------------------------------------------
// GetEnergy
//--------------------------------------------------------------------------
/**
* <p>
*
* \param runName
*/
double PRunListCollection::GetEnergy(TString &runName)
{
return fData->GetRunData(runName)->fEnergy;
}
//--------------------------------------------------------------------------
// GetSetup
//--------------------------------------------------------------------------
/**
* <p>
*
* \param runName
*/
const char* PRunListCollection::GetSetup(TString &runName)
{
return fData->GetRunData(runName)->fSetup.Data();
}

View File

@ -148,6 +148,7 @@ typedef struct {
TString fSetup; ///< description of the setup of this run
double fField; ///< magnetic field value
double fTemp; ///< temperature during the run
double fEnergy; ///< implantation energy of the muon
double fTimeResolution; ///< time resolution of the run
PDoubleVector fT0s; ///< vector of t0's of a run
vector<PDoubleVector> fDataBin; ///< vector of all histos of a run

View File

@ -75,6 +75,11 @@ class PRunListCollection
virtual PRunData* GetRRF(unsigned int index, EDataSwitch tag=kIndex);
virtual PRunData* GetNonMusr(unsigned int index, EDataSwitch tag=kIndex);
virtual double GetTemp(TString &runName);
virtual double GetField(TString &runName);
virtual double GetEnergy(TString &runName);
virtual const char* GetSetup(TString &runName);
private:
PMsrHandler *fMsrInfo; ///< keeps all msr file info
PRunDataHandler *fData; ///< handles all raw data