Merged muonspin/musrfit into master

This commit is contained in:
Zaher Salman 2015-03-02 11:29:27 +01:00
commit 7b36edc241
6 changed files with 57 additions and 25 deletions

View File

@ -1170,6 +1170,8 @@ void PFourierCanvas::HandleAverage()
currentTag = fDataSetTag[j];
}
}
if (start == -1)
start = fDataSetTag.size()-1;
if (end == -1)
end = fDataSetTag.size()-1;
@ -1197,7 +1199,7 @@ void PFourierCanvas::HandleAverage()
// real average
for (Int_t j=0; j<fFourierHistos[0].dataFourierRe->GetNbinsX(); j++) {
dval = 0.0;
for (Int_t k=start; k<end; k++) {
for (Int_t k=start; k<=end; k++) {
if (j < fFourierHistos[k].dataFourierRe->GetNbinsX())
dval += GetInterpolatedValue(fFourierHistos[k].dataFourierRe, fFourierHistos[0].dataFourierRe->GetBinCenter(j));
}
@ -1212,7 +1214,7 @@ void PFourierCanvas::HandleAverage()
// imaginary average
for (Int_t j=0; j<fFourierHistos[0].dataFourierIm->GetNbinsX(); j++) {
dval = 0.0;
for (Int_t k=start; k<end; k++) {
for (Int_t k=start; k<=end; k++) {
if (j < fFourierHistos[k].dataFourierIm->GetNbinsX())
dval += GetInterpolatedValue(fFourierHistos[k].dataFourierIm, fFourierHistos[0].dataFourierIm->GetBinCenter(j));
}
@ -1227,7 +1229,7 @@ void PFourierCanvas::HandleAverage()
// power average
for (Int_t j=0; j<fFourierHistos[0].dataFourierPwr->GetNbinsX(); j++) {
dval = 0.0;
for (Int_t k=start; k<end; k++) {
for (Int_t k=start; k<=end; k++) {
if (j < fFourierHistos[k].dataFourierPwr->GetNbinsX())
dval += GetInterpolatedValue(fFourierHistos[k].dataFourierPwr, fFourierHistos[0].dataFourierPwr->GetBinCenter(j));
}
@ -1242,7 +1244,7 @@ void PFourierCanvas::HandleAverage()
// phase average
for (Int_t j=0; j<fFourierHistos[0].dataFourierPhase->GetNbinsX(); j++) {
dval = 0.0;
for (Int_t k=start; k<end; k++) {
for (Int_t k=start; k<=end; k++) {
if (j < fFourierHistos[k].dataFourierPhase->GetNbinsX())
dval += GetInterpolatedValue(fFourierHistos[k].dataFourierPhase, fFourierHistos[0].dataFourierPhase->GetBinCenter(j));
}

View File

@ -3698,20 +3698,26 @@ Bool_t PMsrHandler::HandleFourierEntry(PMsrLines &lines)
ostr = dynamic_cast<TObjString*>(tokens->At(1));
str = ostr->GetString();
if (str.BeginsWith("par", TString::kIgnoreCase)) { // parameter value
Int_t no = 0;
if (FilterNumber(str, "par", 0, no)) {
// check that the parameter is in range
if ((Int_t)fParam.size() < no) {
if (fFourierOnly) {
cerr << endl << ">> PMsrHandler::HandleFourierEntry: **WARNING** Found phase parameter for Fourier only.";
cerr << endl << ">> This is currently not supported. Will set the phase to 0." << endl;
fourier.fPhase = 0.0;
} else {
Int_t no = 0;
if (FilterNumber(str, "par", 0, no)) {
// check that the parameter is in range
if ((Int_t)fParam.size() < no) {
error = true;
continue;
}
// keep the parameter number
fourier.fPhaseParamNo = no;
// get parameter value
fourier.fPhase = fParam[no-1].fValue;
} else {
error = true;
continue;
}
// keep the parameter number
fourier.fPhaseParamNo = no;
// get parameter value
fourier.fPhase = fParam[no-1].fValue;
} else {
error = true;
continue;
}
} else if (str.IsFloat()) { // phase value
fourier.fPhase = str.Atof();

View File

@ -280,7 +280,8 @@ void PRunDataHandler::ReadData()
fAllDataAvailable = ReadRootFile();
} else if ((fFileFormat == "NeXus") || (fFileFormat == "nexus")) {
fAllDataAvailable = ReadNexusFile();
} else if ((fFileFormat == "PsiBin") || (fFileFormat == "psibin")) {
} else if ((fFileFormat == "PsiBin") || (fFileFormat == "psibin") ||
(fFileFormat == "PsiMdu") || (fFileFormat == "psimdu")) {
fAllDataAvailable = ReadPsiBinFile();
} else if ((fFileFormat == "Mud") || (fFileFormat == "mud")) {
fAllDataAvailable = ReadMudFile();

View File

@ -61,7 +61,7 @@ class PRunDataHandler
virtual Bool_t IsAllDataAvailable() const { return fAllDataAvailable; }
virtual PRawRunData* GetRunData(const TString &runName);
virtual PRawRunData* GetRunData(const UInt_t idx=0);
virtual TString GetRunPathName() {return fRunPathName; }
virtual Int_t GetNoOfRunData() {return fData.size(); }
private:
PMsrHandler *fMsrInfo; ///< pointer to the msr-file handler

View File

@ -1151,12 +1151,6 @@ Int_t main(Int_t argc, Char_t *argv[])
}
// get meta info, time resolution, time range, raw data sets
// check if the data set path-name has changed
if (prevDataSetPathName.CompareTo(runDataHandler[i]->GetRunPathName())) { // i.e. data set path-name changed
rd.dataSetTag = dataSetTagCounter++;
prevDataSetPathName = runDataHandler[i]->GetRunPathName();
}
if (i < msrHandler.size()) { // obtain info from msr-files
// keep title if not overwritten by the command line
if (startupParam.title.Length() == 0)
@ -1212,7 +1206,20 @@ Int_t main(Int_t argc, Char_t *argv[])
startupParam.fourierPower = fourierBlock->fFourierPower;
}
// get apodization tag
apodTag = fourierBlock->fApodization;
switch (fourierBlock->fApodization) {
case FOURIER_APOD_WEAK:
startupParam.apodization = "weak";
break;
case FOURIER_APOD_MEDIUM:
startupParam.apodization = "medium";
break;
case FOURIER_APOD_STRONG:
startupParam.apodization = "strong";
break;
default:
startupParam.apodization = "none";
break;
}
// get range
if ((startupParam.fourierRange[0] == -1) && (startupParam.fourierRange[1] == -1)) { // no Fourier range given from the command line
startupParam.fourierRange[0] = fourierBlock->fPlotRange[0];
@ -1231,6 +1238,13 @@ Int_t main(Int_t argc, Char_t *argv[])
// loop over all runs listed in the msr-file PLOT block
for (UInt_t j=0; j<runList.size(); j++) {
// check if the data set name has changed
str = *(runs->at(runList[j]-1).GetRunName()); // get the name from the msr-file RUN block
if (prevDataSetPathName.CompareTo(str)) { // i.e. data set name changed
rd.dataSetTag = dataSetTagCounter++;
prevDataSetPathName = str;
}
// keep forward histo list
PIntVector histoList;
for (UInt_t k=0; k<runs->at(runList[j]-1).GetForwardHistoNoSize(); k++) {
@ -1238,7 +1252,7 @@ Int_t main(Int_t argc, Char_t *argv[])
}
// handle meta information
fln = runDataHandler[i]->GetRunPathName();
fln = *(runs->at(runList[j]-1).GetRunName()); // get the name from the msr-file RUN block
musrFT_getMetaInfo(fln, rawRunData, str);
TString hh("");
hh = TString::Format("h%d", histoList[0]);
@ -1294,6 +1308,14 @@ Int_t main(Int_t argc, Char_t *argv[])
data.SetBkgRange(startupParam.bkg_range);
}
} else { // obtain info from command line options for direct data-file read
// check if the data set name has changed
// since data-files are given, each PRunDataHandler object contains only a SINGLE data file.
str = *(runDataHandler[i]->GetRunData()->GetFileName()); // get the data set name
if (prevDataSetPathName.CompareTo(str)) { // i.e. data set name changed
rd.dataSetTag = dataSetTagCounter++;
prevDataSetPathName = str;
}
musrFT_getMetaInfo(startupParam.dataFln[i-msrHandler.size()], rawRunData, str);
for (UInt_t j=0; j<startupParam.histo.size(); j++) {
idx = startupParam.histo[j];

View File

@ -552,6 +552,7 @@ void PGetMusrFTOptionsDialog::resetAll()
fFourierRangeStart_lineEdit->setText("");
fFourierRangeEnd_lineEdit->setText("");
fAveragedView_checkBox->setCheckState(Qt::Unchecked);
fAveragePerDataSet_checkBox->setCheckState(Qt::Unchecked);
fCreateMsrFile_checkBox->setCheckState(Qt::Unchecked);
fFourierTitle_lineEdit->setText("");
}