cosmetic in the musrview legend concerning the units

This commit is contained in:
nemu
2011-05-05 12:34:32 +00:00
parent 2fe5c035e5
commit 89ea4cb63f
3 changed files with 21 additions and 5 deletions

View File

@ -749,8 +749,13 @@ void PMusrCanvas::UpdateInfoPad()
if (dval == PMUSR_UNDEFINED) {
tstr += TString("??,");
} else {
sprintf(sval, "%0.2lf", dval);
tstr += TString(sval) + TString("G,");
if (dval < 1.0e4) { // Gauss makes sense as a unit
sprintf(sval, "%0.2lf", dval);
tstr += TString(sval) + TString("G,");
} else { // Tesla makes sense as a unit
sprintf(sval, "%0.2lf", dval/1.0e4);
tstr += TString(sval) + TString("T,");
}
}
// energy if present
tstr += TString("E=");
@ -758,8 +763,13 @@ void PMusrCanvas::UpdateInfoPad()
if (dval == PMUSR_UNDEFINED) {
tstr += TString("??,");
} else {
sprintf(sval, "%0.2lf", dval);
tstr += TString(sval) + TString("keV,");
if (dval < 1.0e3) { // keV makes sense as a unit
sprintf(sval, "%0.2lf", dval);
tstr += TString(sval) + TString("keV,");
} else { // MeV makes sense as a unit
sprintf(sval, "%0.2lf", dval/1.0e3);
tstr += TString(sval) + TString("MeV,");
}
}
// setup if present
tstr += fRunList->GetSetup(*runs[runNo].GetRunName());

View File

@ -1679,9 +1679,14 @@ Bool_t PRunDataHandler::ReadPsiBinFile()
runData.SetEnergy(PMUSR_UNDEFINED);
runData.SetTransport(PMUSR_UNDEFINED);
// get field
Double_t scale = 0.0;
if (psiBin.get_field().find("G"));
scale = 1.0;
if (psiBin.get_field().find("T"));
scale = 1.0e4;
status = sscanf(psiBin.get_field().c_str(), "%lfG", &dval);
if (status == 1)
runData.SetField(dval);
runData.SetField(scale*dval);
// get temperature
PDoubleVector tempVec(psiBin.get_temperatures_vector());
PDoubleVector tempDevVec(psiBin.get_devTemperatures_vector());