added a theory translator for DKS
This commit is contained in:
parent
d9a35a25bb
commit
d9782c55c8
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
changes since 0.17.0
|
changes since 0.17.0
|
||||||
===================================
|
===================================
|
||||||
|
NEW 2016-03-08 added a theory translator for DKS
|
||||||
NEW 2016-02-23 It is now possible to export the averaged data/Fourier
|
NEW 2016-02-23 It is now possible to export the averaged data/Fourier
|
||||||
|
|
||||||
changes since 0.16.0
|
changes since 0.16.0
|
||||||
|
@ -6032,6 +6032,125 @@ Double_t PMsrHandler::GetAlphaEstimateN0()
|
|||||||
return fStartupOptions->alphaEstimateN0;
|
return fStartupOptions->alphaEstimateN0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetDKSTheoryString (public)
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>returns the theory string in a c++ compatible string. This is needed
|
||||||
|
* for DKS/GPU.
|
||||||
|
*
|
||||||
|
* \return the theory in a c++ like string.
|
||||||
|
*/
|
||||||
|
std::string PMsrHandler::GetDKSTheoryString()
|
||||||
|
{
|
||||||
|
std::string result("");
|
||||||
|
PStringVector args;
|
||||||
|
|
||||||
|
TString tp = TString::Format("%.15lf", TMath::TwoPi());
|
||||||
|
TString ph = TString::Format("%.15lf", TMath::Pi() / 180.0);
|
||||||
|
|
||||||
|
for (UInt_t i=1; i<fTheory.size(); i++) { // start with 1, since fTheory[0].fLine == "THEORY"
|
||||||
|
if (i > 1) {
|
||||||
|
if (!fTheory[i-1].fLine.BeginsWith("+")) {
|
||||||
|
result += " * ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HandleTheoryArguments(fTheory[i].fLine, args);
|
||||||
|
|
||||||
|
if (fTheory[i].fLine.BeginsWith("asymmetry ", TString::kIgnoreCase) ||
|
||||||
|
fTheory[i].fLine.BeginsWith("a ", TString::kIgnoreCase)) {
|
||||||
|
result += args[0].Data();
|
||||||
|
} else if (fTheory[i].fLine.BeginsWith("simplExpo ", TString::kIgnoreCase) ||
|
||||||
|
fTheory[i].fLine.BeginsWith("se ")) { // se -> se(t,lambda)
|
||||||
|
result += "se(t, ";
|
||||||
|
result += args[0].Data();
|
||||||
|
result += ")";
|
||||||
|
} else if (fTheory[i].fLine.BeginsWith("simpleGss ", TString::kIgnoreCase) ||
|
||||||
|
fTheory[i].fLine.BeginsWith("sg ")) { // sg -> sg(t,sigma)
|
||||||
|
result += "sg(t, ";
|
||||||
|
result += args[0].Data();
|
||||||
|
result += ")";
|
||||||
|
} else if (fTheory[i].fLine.BeginsWith("TFieldCos ", TString::kIgnoreCase) ||
|
||||||
|
fTheory[i].fLine.BeginsWith("tf ")) { // tf -> tf(t, phi (°), nu (MHz))
|
||||||
|
result += "tf(t, ";
|
||||||
|
result += args[0].Data();
|
||||||
|
result += ", ";
|
||||||
|
result += args[1].Data();
|
||||||
|
result += ")";
|
||||||
|
} else if (fTheory[i].fLine.BeginsWith("+")) {
|
||||||
|
result.erase(result.end()-3, result.end()); // remove the '*' at the end
|
||||||
|
result += " + ";
|
||||||
|
} else {
|
||||||
|
result = string("??"); // not yet available in DKS
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// HandleTheoryArguments (private)
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>tokenizes the theory function arguments and transforms them for DKS
|
||||||
|
*
|
||||||
|
* \param theo
|
||||||
|
* \param args vector of the transformed arguments
|
||||||
|
*/
|
||||||
|
void PMsrHandler::HandleTheoryArguments(const TString theo, PStringVector &args)
|
||||||
|
{
|
||||||
|
TObjArray *tok=theo.Tokenize(" \t");
|
||||||
|
TObjString *ostr=0;
|
||||||
|
TString str, argStr;
|
||||||
|
Int_t ival;
|
||||||
|
|
||||||
|
args.clear(); // make sure vector is empty
|
||||||
|
|
||||||
|
if (tok == 0) {
|
||||||
|
cerr << ">> PMsrHandler::HandleTheoryArguments(): **ERROR** couldn't tokensize '" << theo << "'" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Int_t i=0; i<tok->GetEntries(); i++) {
|
||||||
|
ostr = dynamic_cast<TObjString*>(tok->At(i));
|
||||||
|
str = ostr->GetString();
|
||||||
|
if (str.BeginsWith("#") || str.BeginsWith("(")) { // comment or description
|
||||||
|
continue;
|
||||||
|
} else if (str.IsDigit()) { // parameter
|
||||||
|
ival = str.Atoi();
|
||||||
|
ival -= 1;
|
||||||
|
str = TString::Format("%d",ival);
|
||||||
|
argStr = "p["+ str +"]";
|
||||||
|
args.push_back(argStr);
|
||||||
|
} else if (str.BeginsWith("map", TString::kIgnoreCase)) { // map
|
||||||
|
str.Remove(0,3);
|
||||||
|
if (!str.IsDigit()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ival = str.Atoi();
|
||||||
|
ival -= 1;
|
||||||
|
str = TString::Format("%d",ival);
|
||||||
|
argStr = "p[m[" + str + "]]";
|
||||||
|
args.push_back(argStr);
|
||||||
|
} else if (str.BeginsWith("fun", TString::kIgnoreCase)) { // function
|
||||||
|
str.Remove(0,3);
|
||||||
|
if (!str.IsDigit()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ival = str.Atoi();
|
||||||
|
ival -= 1;
|
||||||
|
str = TString::Format("%d",ival);
|
||||||
|
argStr = "f[" + str + "]";
|
||||||
|
args.push_back(argStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
delete tok;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// NeededPrecision (private)
|
// NeededPrecision (private)
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#ifndef _PMSRHANDLER_H_
|
#ifndef _PMSRHANDLER_H_
|
||||||
#define _PMSRHANDLER_H_
|
#define _PMSRHANDLER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include <TString.h>
|
#include <TString.h>
|
||||||
#include <TComplex.h>
|
#include <TComplex.h>
|
||||||
|
|
||||||
@ -109,6 +111,8 @@ class PMsrHandler
|
|||||||
virtual Bool_t EstimateN0();
|
virtual Bool_t EstimateN0();
|
||||||
virtual Double_t GetAlphaEstimateN0();
|
virtual Double_t GetAlphaEstimateN0();
|
||||||
|
|
||||||
|
virtual std::string GetDKSTheoryString();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Bool_t fFourierOnly; ///< flag indicating if Fourier transform only is wished. If yes, some part of the msr-file blocks are not needed.
|
Bool_t fFourierOnly; ///< flag indicating if Fourier transform only is wished. If yes, some part of the msr-file blocks are not needed.
|
||||||
PStartupOptions *fStartupOptions; ///< contains information about startup options from the musrfit_startup.xml
|
PStartupOptions *fStartupOptions; ///< contains information about startup options from the musrfit_startup.xml
|
||||||
@ -156,6 +160,8 @@ class PMsrHandler
|
|||||||
virtual void MakeDetectorGroupingString(TString str, PIntVector &group, TString &result, Bool_t includeDetector = true);
|
virtual void MakeDetectorGroupingString(TString str, PIntVector &group, TString &result, Bool_t includeDetector = true);
|
||||||
|
|
||||||
virtual void CheckLegacyLifetimecorrection();
|
virtual void CheckLegacyLifetimecorrection();
|
||||||
|
|
||||||
|
virtual void HandleTheoryArguments(const TString theo, PStringVector &args);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _PMSRHANDLER_H_
|
#endif // _PMSRHANDLER_H_
|
||||||
|
@ -712,6 +712,10 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cout << "debug> ++++++++++++" << endl;
|
||||||
|
cout << "debug> msrHandler->GetDKSTheoryString()='" << msrHandler->GetDKSTheoryString() << "'" << endl;
|
||||||
|
cout << "debug> ++++++++++++" << endl;
|
||||||
|
|
||||||
// check if dump is wanted
|
// check if dump is wanted
|
||||||
if (success && !dump.IsNull()) {
|
if (success && !dump.IsNull()) {
|
||||||
cout << endl << "will write dump file ..." << endl;
|
cout << endl << "will write dump file ..." << endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user