added fourier default infos to the startup handler

This commit is contained in:
nemu 2008-12-20 13:29:04 +00:00
parent d29375c912
commit acc5d663ef
3 changed files with 99 additions and 5 deletions

View File

@ -73,6 +73,18 @@ PStartupHandler::~PStartupHandler()
void PStartupHandler::OnStartDocument()
{
fKey = eEmpty;
// init fourier default variables
fFourierDefaults.fFourierBlockPresent = false;
fFourierDefaults.fUnits = FOURIER_UNIT_FIELD;
fFourierDefaults.fFourierPower = 0;
fFourierDefaults.fApodization = FOURIER_APOD_NONE;
fFourierDefaults.fPlotTag = FOURIER_PLOT_REAL_AND_IMAG;
fFourierDefaults.fPhase = 0.0;
fFourierDefaults.fRangeForPhaseCorrection[0] = 0.0;
fFourierDefaults.fRangeForPhaseCorrection[1] = 0.0;
fFourierDefaults.fPlotRange[0] = 0.0;
fFourierDefaults.fPlotRange[1] = 0.0;
}
//--------------------------------------------------------------------------
@ -104,6 +116,16 @@ void PStartupHandler::OnStartElement(const char *str, const TList *attributes)
fKey = eMarker;
} else if (!strcmp(str, "color")) {
fKey = eColor;
} else if (!strcmp(str, "units")) {
fKey = eUnits;
} else if (!strcmp(str, "fourier_power")) {
fKey = eFourierPower;
} else if (!strcmp(str, "apodization")) {
fKey = eApodization;
} else if (!strcmp(str, "plot")) {
fKey = ePlot;
} else if (!strcmp(str, "phase")) {
fKey = ePhase;
}
}
@ -133,7 +155,7 @@ void PStartupHandler::OnCharacters(const char *str)
TObjArray *tokens;
TObjString *ostr;
TString tstr;
Int_t color, r, g, b;
Int_t color, r, g, b, ival;
switch (fKey) {
case eDataPath:
@ -208,6 +230,68 @@ void PStartupHandler::OnCharacters(const char *str)
// add the color code to the color list
fColorList.push_back(color);
break;
case eUnits:
tstr = TString(str);
if (!tstr.CompareTo("gauss", TString::kIgnoreCase)) {
fFourierDefaults.fUnits = FOURIER_UNIT_FIELD;
} else if (!tstr.CompareTo("mhz", TString::kIgnoreCase)) {
fFourierDefaults.fUnits = FOURIER_UNIT_FREQ;
} else if (!tstr.CompareTo("mc/s", TString::kIgnoreCase)) {
fFourierDefaults.fUnits = FOURIER_UNIT_CYCLES;
} else {
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid unit, will ignore it.";
cout << endl;
}
break;
case eFourierPower:
tstr = TString(str);
if (tstr.IsDigit()) {
ival = tstr.Atoi();
if ((ival >= 0) && (ival <= 20)) {
fFourierDefaults.fFourierPower = ival;
} else {
cout << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
cout << endl;
}
} else {
cout << endl << "PStartupHandler **WARNING** fourier power '" << str << "' is not a valid number (0..20), will ignore it.";
cout << endl;
}
break;
case eApodization:
tstr = TString(str);
if (!tstr.CompareTo("none", TString::kIgnoreCase)) {
fFourierDefaults.fApodization = FOURIER_APOD_NONE;
} else if (!tstr.CompareTo("weak", TString::kIgnoreCase)) {
fFourierDefaults.fApodization = FOURIER_APOD_WEAK;
} else if (!tstr.CompareTo("medium", TString::kIgnoreCase)) {
fFourierDefaults.fApodization = FOURIER_APOD_MEDIUM;
} else if (!tstr.CompareTo("strong", TString::kIgnoreCase)) {
fFourierDefaults.fApodization = FOURIER_APOD_STRONG;
} else {
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid apodization, will ignore it.";
cout << endl;
}
break;
case ePlot:
tstr = TString(str);
if (!tstr.CompareTo("real", TString::kIgnoreCase)) {
fFourierDefaults.fPlotTag = FOURIER_PLOT_REAL;
} else if (!tstr.CompareTo("imag", TString::kIgnoreCase)) {
fFourierDefaults.fPlotTag = FOURIER_PLOT_IMAG;
} else if (!tstr.CompareTo("real_and_imag", TString::kIgnoreCase)) {
fFourierDefaults.fPlotTag = FOURIER_PLOT_REAL_AND_IMAG;
} else if (!tstr.CompareTo("power", TString::kIgnoreCase)) {
fFourierDefaults.fPlotTag = FOURIER_PLOT_POWER;
} else if (!tstr.CompareTo("phase", TString::kIgnoreCase)) {
fFourierDefaults.fPlotTag = FOURIER_PLOT_PHASE;
} else {
cout << endl << "PStartupHandler **WARNING** '" << str << "' is not a valid plot option, will ignore it.";
cout << endl;
}
break;
case ePhase:
break;
default:
break;
}

View File

@ -58,16 +58,19 @@ class PStartupHandler : public TObject, public TQObject
virtual void CheckLists();
virtual const PMsrFourierStructure* GetFourierDefaults() const { return &fFourierDefaults; }
virtual const PStringVector GetDataPathList() const { return fDataPathList; }
virtual const PIntVector GetMarkerList() const { return fMarkerList; }
virtual const PIntVector GetColorList() const { return fColorList; }
private:
enum EKeyWords {eEmpty, eComment, eDataPath,
eFourierSettings, eUnits, eFourierPower, eApodization, ePlot, ePhase,
eRootSettings, eMarkerList, eMarker,
eColorList, eColor};
EKeyWords fKey;
PMsrFourierStructure fFourierDefaults;
PStringVector fDataPathList;
PIntVector fMarkerList;
PIntVector fColorList;

View File

@ -6,6 +6,13 @@
</comment>
<data_path>/mnt/data/nemu/his</data_path>
<data_path>/mnt/data/nemu/wkm</data_path>
<fourier_settings>
<units>Gauss</units>
<fourier_power>0</fourier_power>
<apodization>none</apodization>
<plot>real_and_imag</plot>
<phase>0.0</phase>
</fourier_settings>
<root_settings>
<marker_list>
<!-- Root marker numbers -->