16#include <boost/algorithm/string/classification.hpp>
17#include <boost/algorithm/string/split.hpp>
37 const std::string &mndspstr,
const std::string &mxdspstr,
const std::string &maxtofstr);
40 const std::vector<unsigned int> &getBankIDs()
const;
42 bool hasBank(
unsigned int bankid)
const;
44 double getParameter(
unsigned int bankid,
const std::string ¶mname)
const;
46 void setParameter(
unsigned int bankid,
const std::string ¶mname,
double value);
51 std::vector<double> parseStringDbl(
const std::string &instring)
const;
53 std::vector<unsigned int> parseStringUnsignedInt(
const std::string &instring)
const;
75 const size_t numbanks = bankids.size();
85 m_bankIDs.assign(bankids.begin(), bankids.end());
87 for (
size_t ib = 0; ib < numbanks; ++ib) {
97 const std::string &mndspstr,
const std::string &mxdspstr,
98 const std::string &maxtofstr)
99 : m_frequency(freq), m_bankIDs(parseStringUnsignedInt(bankidstr)), m_vecCWL(parseStringDbl(cwlstr)),
100 m_mindsps(parseStringDbl(mndspstr)), m_maxdsps(parseStringDbl(mxdspstr)), m_maxtofs(parseStringDbl(maxtofstr))
108 std::string errmsg(
"Default chopper constants have different number of elements. ");
109 throw runtime_error(errmsg);
119 for (
size_t ib = 0; ib < numbanks; ++ib) {
143 errss <<
"Bank ID and index map does not have entry for bank " << bankid;
144 throw runtime_error(errss.str());
146 size_t bindex = biter->second;
150 if (paramname ==
"TwoTheta") {
152 }
else if (paramname ==
"MinDsp") {
156 }
else if (paramname ==
"MaxDsp") {
160 }
else if (paramname ==
"MaxTOF") {
164 }
else if (paramname ==
"CWL") {
168 errss <<
"ChopperConfiguration unable to locate: Bank ID = " << bankid <<
", Parameter = " << paramname;
169 throw runtime_error(errss.str());
183 errss <<
"Chopper configuration does not have bank " << bankid;
184 throw runtime_error(errss.str());
186 size_t ibank = biter->second;
188 if (paramname ==
"2Theta")
190 else if (paramname ==
"CWL")
192 else if (paramname ==
"L1")
194 else if (paramname ==
"L2")
196 else if (paramname ==
"MinTOF") {
198 }
else if (paramname ==
"MaxTOF")
200 else if (paramname ==
"MinDsp")
202 else if (paramname ==
"MaxDsp")
206 errss <<
"In Chopper configuration's bank " << bankid <<
", there is no parameter named " << paramname;
207 throw runtime_error(errss.str());
217 boost::split(strs, instring, boost::is_any_of(
", "));
219 vector<double> vecdouble;
220 for (
const auto &str : strs) {
222 double item = std::stod(str.c_str());
223 vecdouble.emplace_back(item);
239 boost::split(strs, instring, boost::is_any_of(
", "));
241 vector<unsigned int> vecinteger;
242 for (
const auto &str : strs) {
244 int item = std::stoi(str);
246 throw runtime_error(
"Found negative number in a string for unsigned integers.");
248 vecinteger.emplace_back(
static_cast<unsigned int>(item));
262 :
API::
Algorithm(), m_instrument(), m_L1(0.),
m_L2(0.), m_2theta(0.), m_frequency(0), m_id_line(), m_sample(),
263 m_vecBankID2File(), m_gsasFileName(), m_configuration(), m_profileMap(), m_gdsp(), m_gdt(), m_galpha(), m_gbeta(),
264 m_bank_mndsp(), m_bank_mxtof() {}
272 "Name of the table workspace containing the parameters.");
274 vector<string> infileexts{
".irf"};
276 declareProperty(std::move(infileprop),
"Name of the input Fullprof resolution file (.irf).");
278 vector<string> outfileexts{
".iparam",
".prm"};
279 auto fileprop = std::make_unique<FileProperty>(
"OutputFileName",
"",
FileProperty::Save, outfileexts);
280 declareProperty(std::move(fileprop),
"Name of the output GSAS instrument file.");
283 "Bank IDs of the banks to be written to GSAS instrument file.");
285 vector<string> instruments{
"powgen",
"nomad"};
286 declareProperty(
"Instrument",
"powgen", std::make_shared<StringListValidator>(instruments),
287 "Name of the instrument that parameters are belonged to. "
288 "So far, only PG3 and NOM are supported.");
290 vector<string> vecfreq{
"10",
"30",
"60"};
291 declareProperty(
"ChopperFrequency",
"60", std::make_shared<StringListValidator>(vecfreq),
292 "Frequency of the chopper. ");
294 declareProperty(
"IDLine",
"",
"ID line to be written in GSAS instrument file");
295 declareProperty(
"Sample",
"",
"Sample information written to header (title) ");
298 mustBePositive->setLower(0.0);
302 "L2 (secondary flight path) of the instrument. "
303 "It must be given if 2Theta is not given. ");
305 "Angle of the detector bank. "
306 "It must be given if L2 is not given. ");
317 map<unsigned int, map<string, double>> bankprofileparammap;
326 for (
const auto &miter : bankprofileparammap) {
327 unsigned int bankid = miter.first;
338 Mantid::API::FrameworkManager::Instance();
348 std::string errorstr(
"FindPeaks algorithm requires the CurveFitting library");
350 throw std::runtime_error(errorstr);
359 bool loadirf =
false;
371 errss <<
"Neither input table workspace (" <<
getPropertyValue(
"InputWorkspace") <<
") nor "
372 <<
"input .irf file " <<
getPropertyValue(
"InputFileName") <<
" is valid. ";
374 throw runtime_error(errss.str());
388 throw runtime_error(
"L1 must be given!");
391 string freqtempstr =
getProperty(
"ChopperFrequency");
424 string errmsg(
"User must specify either 2theta or L2. Neither of them is given.");
426 throw runtime_error(errmsg);
464 map<
unsigned int, map<string, double>> &profilemap) {
465 size_t numbanks = ws->columnCount() - 1;
466 size_t numparams = ws->rowCount();
467 vector<map<string, double>> vec_maptemp(numbanks);
468 vector<unsigned int> vecbankindex(numbanks);
471 vector<string> colnames = ws->getColumnNames();
472 if (colnames[0] !=
"Name")
473 throw runtime_error(
"The first column must be Name");
476 for (
size_t irow = 0; irow < numparams; ++irow) {
480 if (parname !=
"BANK") {
481 for (
size_t icol = 0; icol < numbanks; ++icol) {
484 vec_maptemp[icol].emplace(parname, tmpdbl);
487 for (
size_t icol = 0; icol < numbanks; ++icol) {
490 vecbankindex[icol] =
static_cast<unsigned int>(tmpint);
497 db1ss <<
"[DBx912] Number of banks in profile table = " << vecbankindex.
size() <<
" containing bank ";
498 for (
auto bankIndex : vecbankindex)
499 db1ss << bankIndex <<
", ";
505 for (
size_t i = 0; i < vecbankindex.size(); ++i) {
506 unsigned int bankid = vecbankindex[i];
507 profilemap.emplace(bankid, vec_maptemp[i]);
518 map<unsigned int, map<string, double>>::const_iterator bmiter;
519 for (bmiter = profmap.begin(); bmiter != profmap.end(); ++bmiter) {
520 int bankid = bmiter->first;
521 bankids.emplace_back(bankid);
528 for (bmiter = profmap.begin(); bmiter != profmap.end(); ++bmiter) {
529 int bankid = bmiter->first;
540 chconfig->setParameter(bankid,
"CWL", cwl);
541 chconfig->setParameter(bankid,
"MaxTOF", maxtof);
542 chconfig->setParameter(bankid,
"MinDsp", dmin);
543 chconfig->setParameter(bankid,
"MaxDsp", dmax);
545 g_log.
information() <<
"Import bank " << bankid <<
". TOF range: " << mintof <<
", " << maxtof
546 <<
"; D-space range: " << dmin <<
", " << dmax <<
".\n";
556 string bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr;
559 switch (intfrequency) {
561 bankidstr =
"1,2,3,4,5,6,7";
562 cwlstr =
"0.533, 1.066, 1.333, 1.599, 2.665, 3.731, 4.797";
563 mndspstr =
"0.10, 0.276, 0.414, 0.552, 1.104, 1.656, 2.208";
564 mxdspstr =
"2.06, 3.090, 3.605, 4.120, 6.180, 8.240, 10.30";
565 maxtofstr =
"46.76, 70.14, 81.83, 93.52, 140.3, 187.0, 233.8";
570 cwlstr =
"1.066, 3.198, 5.33";
571 mndspstr =
"0.10, 1.104, 2.208";
572 mxdspstr =
"4.12, 8.24, 12.36";
573 maxtofstr =
"93.5, 187.0, 280.5";
588 throw runtime_error(
"Not supported");
593 return std::make_shared<ChopperConfiguration>(intfrequency, bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr);
602 string bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr;
605 switch (intfrequency) {
608 cwlstr =
"1.500, 1.5000";
609 mndspstr =
"0.052, 0.0450";
610 mxdspstr =
"2.630, 2.6000";
611 maxtofstr =
"93.52, 156.00";
616 errss <<
"NOMAD Frequency = " << intfrequency <<
" is not supported. ";
617 throw runtime_error(errss.str());
622 return std::make_shared<ChopperConfiguration>(intfrequency, bankidstr, cwlstr, mndspstr, mxdspstr, maxtofstr);
633 const std::vector<unsigned int> &outputbankids,
const std::string &gsasinstrfilename,
634 const std::map<
unsigned int, std::map<std::string, double>> &bankprofilemap) {
637 throw runtime_error(
"Not set up yet!");
640 for (
auto bankid : outputbankids) {
642 throw runtime_error(
"Chopper configuration does not have some certain bank.");
651 g_log.
information() <<
"Export header of GSAS instrument file " << gsasinstrfilename <<
".\n";
655 vector<unsigned int> banks = outputbankids;
656 sort(banks.begin(), banks.end());
657 for (
auto bankid : banks) {
664 errss <<
"Bank " << bankid <<
" does not exist in source resolution file. "
665 <<
"There are " << bankids.size() <<
" banks given, including "
667 for (
size_t i = 0; i < bankids.size(); ++i) {
669 if (i < bankids.size() - 1)
673 throw runtime_error(errss.str());
686 const std::map<
unsigned int, std::map<std::string, double>> &bankprofilemap,
unsigned int bankid) {
688 auto biter = bankprofilemap.find(bankid);
689 if (biter == bankprofilemap.end())
690 throw runtime_error(
"Bank ID cannot be found in bank-profile-map-map. 001");
691 const map<string, double> &profilemap = biter->second;
702 m_gdt.assign(90, 0.);
704 vector<double> gtof(90, 0.);
705 vector<double> gpkX(90, 0.);
728 double instC = dtt1 - 4 * (alph0 + alph1);
733 double ddstep = ((1.05 * mxdsp) - (0.9 * mndsp)) / 90.;
735 for (
size_t k = 0; k < 90; ++k) {
736 m_gdsp[k] = (0.9 * mndsp) + (
static_cast<double>(k) * ddstep);
737 double rd = 1.0 /
m_gdsp[k];
738 double dmX = mx - rd;
739 gpkX[k] = 0.5 *
erfc(mxb * dmX);
740 gtof[k] =
calTOF(gpkX[k], zero, dtt1, dtt2, zerot, dtt1t, -dtt2t,
m_gdsp[k]);
745 g_log.
debug() << k <<
"\t" << setw(20) << setprecision(10) << gtof[k] <<
"\t " << setw(20) << setprecision(10)
746 <<
m_gdsp[k] <<
"\t " << setw(20) << setprecision(10) << instC <<
"\t " << setw(20)
747 << setprecision(10) <<
m_gdt[k] <<
".\n";
755 auto numbanks =
static_cast<int>(banks.size());
758 pFile = fopen(prmfilename.c_str(),
"w");
761 errss <<
"Unable to open file " << prmfilename <<
" in write-mode";
762 throw runtime_error(errss.str());
765 "1234567890123456789012345678901234567890123456789012345678901"
767 fprintf(pFile,
"ID %s\n",
m_id_line.c_str());
768 fprintf(pFile,
"INS BANK %5d\n", numbanks);
769 fprintf(pFile,
"INS FPATH1 %f \n",
m_L1);
770 fprintf(pFile,
"INS HTYPE PNTR \n");
781 const std::map<
unsigned int, std::map<std::string, double>> &bankprofilemap,
unsigned int bankid,
782 const std::string &prmfilename) {
784 auto biter = bankprofilemap.find(bankid);
785 if (biter == bankprofilemap.end())
786 throw runtime_error(
"Bank does not exist in bank-profile-map. 002");
788 const map<string, double> &profilemap = biter->second;
807 int randint = 10001 + (rand() % (99999 - 10001 + 1));
814 double instC = dtt1 - (4 * (alph0 + alph1));
815 g_log.
debug() <<
"Bank " << bankid <<
": MaxTOF = " << maxtof <<
"; Dtt1 = " << dtt1 <<
", Alph0 = " << alph0
816 <<
", Alph1 = " << alph1 <<
", MinDsp = " << mindsp <<
".\n";
823 stringstream titless;
825 string titleline(titless.str());
829 pFile = fopen(prmfilename.c_str(),
"a");
832 errss <<
"Unable to open file " << prmfilename <<
" in append-mode";
833 throw runtime_error(errss.str());
836 fprintf(pFile,
"INS %2u ICONS%10.3f%10.3f%10.3f %10.3f%5d%10.3f\n", bankid, instC * 1.00009, 0.0, zero, 0.0,
838 fprintf(pFile,
"INS %2uBNKPAR%10.3f%10.3f%10.3f%10.3f%10.3f%5d%5d\n", bankid,
m_L2, twotheta, 0., 0., 0.2, 1, 1);
840 fprintf(pFile,
"INS %2uBAKGD 1 4 Y 0 Y\n", bankid);
841 fprintf(pFile,
"INS %2uI HEAD %s\n", bankid, titleline.c_str());
842 fprintf(pFile,
"INS %2uI ITYP%5d%10.4f%10.4f%10i\n", bankid, 0, mindsp * 0.001 * instC, maxtof, randint);
843 fprintf(pFile,
"INS %2uINAME %s \n", bankid,
m_instrument.c_str());
844 fprintf(pFile,
"INS %2uPRCF1 %5d%5d%10.5f\n", bankid, -3, 21, 0.002);
845 fprintf(pFile,
"INS %2uPRCF11%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, sig0);
846 fprintf(pFile,
"INS %2uPRCF12%15.6f%15.6f%15.6f%15.6f\n", bankid, sig1, sig2, gam0, gam1);
847 fprintf(pFile,
"INS %2uPRCF13%15.6f%15.6f%15.6f%15.6f\n", bankid, gam2, 0.0, 0.0, 0.0);
848 fprintf(pFile,
"INS %2uPRCF14%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
849 fprintf(pFile,
"INS %2uPRCF15%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
850 fprintf(pFile,
"INS %2uPRCF16%15.6f\n", bankid, 0.0);
851 fprintf(pFile,
"INS %2uPAB3 %3d\n", bankid, 90);
853 for (
size_t k = 0; k < 90; ++k) {
854 fprintf(pFile,
"INS %2uPAB3%2d%10.5f%10.5f%10.5f%10.5f\n", bankid,
static_cast<int>(k) + 1,
m_gdsp[k],
m_gdt[k],
857 fprintf(pFile,
"INS %2uPRCF2 %5i%5i%10.5f\n", bankid, -4, 27, 0.002);
858 fprintf(pFile,
"INS %2uPRCF21%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, sig1);
859 fprintf(pFile,
"INS %2uPRCF22%15.6f%15.6f%15.6f%15.6f\n", bankid, sig2, gam2, 0.0, 0.0);
860 fprintf(pFile,
"INS %2uPRCF23%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
861 fprintf(pFile,
"INS %2uPRCF24%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
862 fprintf(pFile,
"INS %2uPRCF25%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
863 fprintf(pFile,
"INS %2uPRCF26%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
864 fprintf(pFile,
"INS %2uPRCF27%15.6f%15.6f%15.6f \n", bankid, 0.0, 0.0, 0.0);
866 fprintf(pFile,
"INS %2uPAB4 %3i\n", bankid, 90);
867 for (
size_t k = 0; k < 90; ++k) {
868 fprintf(pFile,
"INS %2uPAB4%2d%10.5f%10.5f%10.5f%10.5f\n", bankid,
static_cast<int>(k) + 1,
m_gdsp[k],
m_gdt[k],
872 fprintf(pFile,
"INS %2uPRCF3 %5i%5i%10.5f\n", bankid, -5, 21, 0.002);
873 fprintf(pFile,
"INS %2uPRCF31%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, sig0);
874 fprintf(pFile,
"INS %2uPRCF32%15.6f%15.6f%15.6f%15.6f\n", bankid, sig1, sig2, gam0, gam1);
875 fprintf(pFile,
"INS %2uPRCF33%15.6f%15.6f%15.6f%15.6f\n", bankid, gam2, 0.0, 0.0, 0.0);
876 fprintf(pFile,
"INS %2uPRCF34%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
877 fprintf(pFile,
"INS %2uPRCF35%15.6f%15.6f%15.6f%15.6f\n", bankid, 0.0, 0.0, 0.0, 0.0);
878 fprintf(pFile,
"INS %2uPRCF36%15.6f\n", bankid, 0.0);
880 fprintf(pFile,
"INS %2uPAB5 %3i\n", bankid,
882 for (
size_t k = 0; k < 90; k++) {
883 fprintf(pFile,
"INS %2uPAB5%2d%10.5f%10.5f%10.5f%10.5f\n", bankid,
static_cast<int>(k) + 1,
m_gdsp[k],
m_gdt[k],
895 double l2 =
difc / (252.816 * 2.0 * sin(0.5 * twotheta * M_PI / 180.0)) - L1;
896 g_log.
debug() <<
"DIFC = " <<
difc <<
", L1 = " << L1 <<
", 2Theta = " << twotheta <<
" ==> L2 = " <<
l2 <<
".\n";
918 double te = ep + (eq * dsp) + er * 0.5 *
erfc(((1.0 / dsp) - 1.05) * 10.0);
919 double tt =
tp + (tq * dsp) + (tr / dsp);
920 double t = (
n * te) + tt - (
n * tt);
930 double ea = ea1 + (ea2 * dsp);
931 double ta = ta1 - (ta2 / dsp);
932 double am1 = (
n * ea) + ta - (
n * ta);
933 double a = 1.0 / am1;
942 std::map<std::string, double>::const_iterator piter;
943 piter = profilemap.find(parname);
944 if (piter == profilemap.end()) {
946 errss <<
"Profile parameter map does not contain parameter" << parname <<
". ";
948 throw runtime_error(errss.str());
951 double value = piter->second;
960 const string ¶mname) {
961 auto piter = profilemap.find(paramname);
962 if (piter == profilemap.end()) {
964 errss <<
"Profile map does not contain parameter " << paramname <<
". Available parameters are ";
965 for (
const auto ¶meter : profilemap) {
966 errss << parameter.first <<
", ";
969 throw runtime_error(errss.str());
972 double value = piter->second;
985 double dsp = (tof - zero) / dtt1;
1000 g_log.
error(
"SaveGSASInstrumentFile requires DataHandling library for "
1001 "LoadFullprofResolution.");
1002 throw runtime_error(
"SaveGSASInstrumentFile requires DataHandling library "
1003 "for LoadFullprofResolution.");
1006 loadfpirf->setProperty(
"Filename", irffilename);
1007 loadfpirf->setProperty(
"OutputTableWorkspace",
"outputTableWorkspace");
1009 loadfpirf->execute();
1010 if (!loadfpirf->isExecuted())
1011 throw runtime_error(
"LoadFullprof cannot be executed. ");
1013 m_inpWS = loadfpirf->getProperty(
"OutputTableWorkspace");
1015 throw runtime_error(
"Failed to obtain a table workspace from "
1016 "LoadFullprofResolution's output.");
1023 double x =
fabs(xx);
1024 double t = 1.0 / (1.0 + (0.5 *
x));
1025 double ty = (0.27886807 + t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277))));
1026 double tx = (1.00002368 + t * (0.37409196 + t * (0.09678418 + t * (-0.18628806 + t * ty))));
1027 double y = t * exp(-
x *
x - 1.26551223 + t * tx);
#define DECLARE_ALGORITHM(classname)
static std::unique_ptr< QThreadPool > tp
double value
The value of the point.
const std::vector< double > & m_L2
Base class from which all concrete algorithm classes should be derived.
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
static bool isEmpty(const NumT toCheck)
checks that the value was not set by users, uses the value in empty double/int.
@ OptionalLoad
to specify a file to read but the file doesn't have to exist
@ Save
to specify a file to write to, the file may or may not exist
TableRow represents a row in a TableWorkspace.
size_t size() const
Returns the number of rows in the TableWorkspace.
A property class for workspaces.
ChopperConfiguration(vector< int > bankids)
Constructor.
std::map< unsigned int, size_t > m_bankIDIndexMap
std::vector< double > m_mindsps
std::vector< double > m_maxdsps
double getParameter(unsigned int bankid, const std::string ¶mname) const
Get a parameter from a bank.
bool hasBank(unsigned int bankid) const
Check wehther a bank is defined.
std::vector< double > m_vecL2
std::vector< double > m_vec2Theta
std::vector< double > m_vecCWL
std::vector< double > m_maxtofs
const std::vector< unsigned int > & getBankIDs() const
Get bank IDs in configuration.
std::vector< double > parseStringDbl(const std::string &instring) const
Parse string to a double vector.
std::vector< unsigned int > parseStringUnsignedInt(const std::string &instring) const
Parse string to an integer vector.
std::vector< unsigned int > m_bankIDs
void setParameter(unsigned int bankid, const std::string ¶mname, double value)
Set a parameter to a bank.
std::vector< double > m_vecL1
std::string parseString() const
SaveGSASInstrumentFile : Convert Fullprof"s instrument resolution file (.irf) to GSAS"s instrument f...
API::ITableWorkspace_sptr m_inpWS
Input workspace.
std::string m_sample
Sample.
double calDspRange(double dtt1, double zero, double tof)
Calcualte d-space value.
void buildGSASTabulatedProfile(const std::map< unsigned int, std::map< std::string, double > > &bankprofilemap, unsigned int bankid)
Build a data structure for GSAS's tabulated peak profile.
void convertToGSAS(const std::vector< unsigned int > &outputbankids, const std::string &gsasinstrfilename, const std::map< unsigned int, std::map< std::string, double > > &bankprofilemap)
Convert to GSAS instrument file.
int m_frequency
Frequency.
std::vector< double > m_gbeta
std::string m_gsasFileName
Output file name.
std::shared_ptr< ChopperConfiguration > m_configuration
Chopper configuration.
double getProfileParameterValue(const std::map< std::string, double > &profilemap, const std::string ¶mname)
Get parameter value from class storage.
double aaba(double n, double ea1, double ea2, double ta1, double ta2, double dsp)
Calculate a value related to (alph0, alph1, alph0t, alph1t) or (beta0, beta1, beta0t,...
std::shared_ptr< ChopperConfiguration > setupInstrumentConstants(const std::map< unsigned int, std::map< std::string, double > > &profmap)
Set up chopper/instrument constant parameters from profile map.
double calL2FromDtt1(double difc, double L1, double twotheta)
Caclualte L2 from DIFFC and L1.
double calTOF(double n, double ep, double eq, double er, double tp, double tq, double tr, double dsp)
Calculate TOF difference.
std::map< unsigned int, double > m_bank_mndsp
void processProperties()
Process properties.
std::vector< double > m_gdsp
SaveGSASInstrumentFile()
Constructor.
void initConstants(const std::map< unsigned int, std::map< std::string, double > > &profmap)
Set up some constant by default.
double erfc(double xx)
Complementary error function.
std::map< unsigned int, double > m_bank_mxtof
void init() override
Initialisation code.
void loadFullprofResolutionFile(const std::string &irffilename)
Load fullprof resolution file.
std::vector< unsigned int > m_vecBankID2File
Banks IDs to process.
std::vector< double > m_galpha
std::shared_ptr< ChopperConfiguration > setupPG3Constants(int intfrequency)
Set up for PG3 chopper constants.
void parseProfileTableWorkspace(const API::ITableWorkspace_sptr &ws, std::map< unsigned int, std::map< std::string, double > > &profilemap)
Parse profile table workspace to a map.
void writePRMSingleBank(const std::map< unsigned int, std::map< std::string, double > > &bankprofilemap, unsigned int bankid, const std::string &prmfilename)
Write out .prm/.iparm file.
double getValueFromMap(const std::map< std::string, double > &profilemap, const std::string &parname)
Get parameter value from a map.
std::string m_id_line
User input ID line.
std::shared_ptr< ChopperConfiguration > setupNOMConstants(int intfrequency)
Set up for NOM chopper constants.
void exec() override
Execution code.
std::string m_instrument
Instrument.
void writePRMHeader(const std::vector< unsigned int > &banks, const std::string &prmfilename)
Write the header of the file.
std::vector< double > m_gdt
Support for a property that holds an array of values.
BoundedValidator is a validator that requires the values to be between upper or lower bounds,...
Exception for when an item is not found in a collection.
void debug(const std::string &msg)
Logs at debug level.
void error(const std::string &msg)
Logs at error level.
void information(const std::string &msg)
Logs at information level.
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< ChopperConfiguration > ChopperConfiguration_sptr
Helper class which provides the Collimation Length for SANS instruments.
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
@ Input
An input workspace.