Mantid
Loading...
Searching...
No Matches
Unit.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2008 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------------------------------------------------------
10// Includes
11//----------------------------------------------------------------------
13#include <utility>
14
15#include <algorithm>
16#include <unordered_map>
17#include <vector>
18#ifndef Q_MOC_RUN
19#include <memory>
20#endif
21
22#include "tbb/concurrent_unordered_map.h"
23
24namespace Mantid {
25namespace Kernel {
26
28
29// list of parameter names and values - some code may relay on map behaviour
30// where [] creates element with value 0 if param name not present
31using UnitParametersMap = std::unordered_map<UnitParams, double>;
32
42class MANTID_KERNEL_DLL Unit {
43public:
45 Unit();
47 virtual ~Unit() = default;
48
50 virtual Unit *clone() const = 0;
51
58 virtual const std::string unitID() const = 0;
61 virtual const std::string caption() const = 0;
62
65 virtual const UnitLabel label() const = 0;
66
69 virtual bool isConvertible() const { return true; }
70
71 // Equality operators based on the value returned by unitID();
72 bool operator==(const Unit &u) const;
73 bool operator!=(const Unit &u) const;
74
75 // Check whether the unit can be converted to another via a simple factor
76 bool quickConversion(const Unit &destination, double &factor, double &power) const;
77 bool quickConversion(std::string destUnitName, double &factor, double &power) const;
78
92 void toTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
93 std::initializer_list<std::pair<const UnitParams, double>> params);
94 void toTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
95 const UnitParametersMap &params);
96
112 template <typename Iterator>
113 void toTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode,
114 UnitParametersMap const &params) {
115 this->initialize(l1, emode, params);
116 std::transform(xbegin, xend, xbegin, [this](double const x) { return this->singleToTOF(x); });
117 }
118
120 double convertSingleToTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap &params);
121
135 void fromTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
136 std::initializer_list<std::pair<const UnitParams, double>> params);
137
138 void fromTOF(std::vector<double> &xdata, std::vector<double> const &ydata, const double &_l1, const int &_emode,
139 const UnitParametersMap &params);
140
156 template <typename Iterator>
157 void fromTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode,
158 UnitParametersMap const &params) {
159 this->initialize(l1, emode, params);
160 std::transform(xbegin, xend, xbegin, [this](double const tof) { return this->singleFromTOF(tof); });
161 }
162
164 double convertSingleFromTOF(const double xvalue, const double &l1, const int &emode, const UnitParametersMap &params);
165
167 void initialize(const double &_l1, const int &_emode, const UnitParametersMap &params);
168
171 virtual void init() = 0;
172
177 virtual double singleToTOF(const double x) const = 0;
178
183 virtual double singleFromTOF(const double tof) const = 0;
184
186 bool isInitialized() const { return initialized; }
187
191 virtual double conversionTOFMin() const = 0;
192
195 virtual double conversionTOFMax() const = 0;
196
199 virtual std::pair<double, double> conversionRange() const;
200
201protected:
202 // Add a 'quick conversion' for a unit pair
203 void addConversion(std::string to, const double &factor, const double &power = 1.0) const;
204
205 // validate the contents of the unit parameters map. Throw
206 // std::invalid_argument if it's a global error or std::runtime_error if it's
207 // a detector specific error
208 virtual void validateUnitParams(const int emode, const UnitParametersMap &params);
209
213 double l1;
216 int emode;
223
224private:
227 using ConstantAndPower = std::pair<double, double>;
230 using UnitConversions = tbb::concurrent_unordered_map<std::string, ConstantAndPower>;
233 using ConversionsMap = tbb::concurrent_unordered_map<std::string, UnitConversions>;
236};
237
239using Unit_sptr = std::shared_ptr<Unit>;
241using Unit_const_sptr = std::shared_ptr<const Unit>;
242
243//----------------------------------------------------------------------
244// Now the concrete units classes
245//----------------------------------------------------------------------
246
248namespace Units {
249
250//=================================================================================================
252class MANTID_KERNEL_DLL Empty : public Unit {
253public:
254 const std::string unitID() const override;
255 const std::string caption() const override { return ""; }
256 const UnitLabel label() const override;
257
258 bool isConvertible() const override { return false; }
259 double singleToTOF(const double x) const override;
260 double singleFromTOF(const double tof) const override;
261 void init() override;
262 Unit *clone() const override;
263
264 double conversionTOFMin() const override;
265 double conversionTOFMax() const override;
266
268 Empty() : Unit() {}
269};
270
271//=================================================================================================
273class MANTID_KERNEL_DLL Label : public Empty {
274public:
275 const std::string unitID() const override;
276 const std::string caption() const override { return m_caption; }
277 const UnitLabel label() const override;
278
279 Label();
280 Label(const std::string &caption, const std::string &label);
281 void setLabel(const std::string &cpt, const UnitLabel &lbl = UnitLabel(""));
282 Unit *clone() const override;
283
284private:
286 std::string m_caption;
289};
290
291//=================================================================================================
293class MANTID_KERNEL_DLL TOF : public Unit {
294public:
295 const std::string unitID() const override;
296 const std::string caption() const override { return "Time-of-flight"; }
297 const UnitLabel label() const override;
298
299 TOF();
300 void init() override;
301 double singleToTOF(const double x) const override;
302 double singleFromTOF(const double tof) const override;
303 Unit *clone() const override;
305 double conversionTOFMin() const override;
307 double conversionTOFMax() const override;
308};
309
310//=================================================================================================
312class MANTID_KERNEL_DLL Wavelength : public Unit {
313public:
314 const std::string unitID() const override;
315 const std::string caption() const override { return "Wavelength"; }
316 const UnitLabel label() const override;
317
318 double singleToTOF(const double x) const override;
319 double singleFromTOF(const double tof) const override;
320 void init() override;
321 Unit *clone() const override;
322
323 double conversionTOFMin() const override;
324 double conversionTOFMax() const override;
325
327 Wavelength();
328
329protected:
330 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
331 double efixed;
332 double sfpTo;
333 double factorTo;
334 double sfpFrom;
335 double factorFrom;
337};
338
339//=================================================================================================
341class MANTID_KERNEL_DLL Energy : public Unit {
342public:
343 const std::string unitID() const override;
344 const std::string caption() const override { return "Energy"; }
345 const UnitLabel label() const override;
346
347 double singleToTOF(const double x) const override;
348 double singleFromTOF(const double tof) const override;
349 void init() override;
350 Unit *clone() const override;
351
352 double conversionTOFMin() const override;
353 double conversionTOFMax() const override;
354
356 Energy();
357
358protected:
359 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
360 double factorTo;
361 double factorFrom;
362};
363
364//=================================================================================================
366class MANTID_KERNEL_DLL Energy_inWavenumber : public Unit {
367public:
368 const std::string unitID() const override;
369 const std::string caption() const override { return "Energy"; }
370 const UnitLabel label() const override;
371
372 double singleToTOF(const double x) const override;
373 double singleFromTOF(const double tof) const override;
374 void init() override;
375 Unit *clone() const override;
376 double conversionTOFMin() const override;
377 double conversionTOFMax() const override;
378
381
382protected:
383 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
384 double factorTo;
385 double factorFrom;
386};
387
388MANTID_KERNEL_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta,
389 const double offset);
390
391MANTID_KERNEL_DLL double calculateDIFCCorrection(const double l1, const double l2, const double twotheta,
392 const double offset, const double binWidth);
393
394//=================================================================================================
396class MANTID_KERNEL_DLL dSpacing : public Unit {
397public:
398 const std::string unitID() const override;
399 const std::string caption() const override { return "d-Spacing"; }
400 const UnitLabel label() const override;
401 double singleToTOF(const double x) const override;
402 double singleFromTOF(const double tof) const override;
403 void init() override;
404 Unit *clone() const override;
405 double conversionTOFMin() const override;
406 double conversionTOFMax() const override;
407 double calcTofMin(const double difc, const double difa, const double tzero, const double tofmin = 0.);
408 double calcTofMax(const double difc, const double difa, const double tzero, const double tofmax = 0.);
409
411 dSpacing();
412
413protected:
414 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
415 std::string toDSpacingError;
416 double difa;
417 double difc;
418 double tzero;
419};
420
421//=================================================================================================
423class MANTID_KERNEL_DLL dSpacingPerpendicular : public Unit {
424public:
425 const std::string unitID() const override;
426 const std::string caption() const override { return "d-SpacingPerpendicular"; }
427 const UnitLabel label() const override;
428
429 double singleToTOF(const double x) const override;
430 double singleFromTOF(const double tof) const override;
431 void init() override;
432 Unit *clone() const override;
433 double conversionTOFMin() const override;
434 double conversionTOFMax() const override;
435
438
439protected:
440 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
441 double twoTheta;
442 double factorTo;
443 double sfpTo;
444 double factorFrom;
445 double sfpFrom;
446};
447
448//=================================================================================================
450class MANTID_KERNEL_DLL MomentumTransfer : public Unit {
451public:
452 const std::string unitID() const override;
453 const std::string caption() const override { return "q"; }
454 const UnitLabel label() const override;
455
456 double singleToTOF(const double x) const override;
457 double singleFromTOF(const double tof) const override;
458 void init() override;
459 Unit *clone() const override;
460 double conversionTOFMin() const override;
461 double conversionTOFMax() const override;
464
465protected:
466 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
467 double difc;
468};
469
470//=================================================================================================
472class MANTID_KERNEL_DLL QSquared : public MomentumTransfer {
473public:
474 const std::string unitID() const override;
475 const std::string caption() const override { return "Q2"; }
476 const UnitLabel label() const override;
477
478 double singleToTOF(const double x) const override;
479 double singleFromTOF(const double tof) const override;
480 Unit *clone() const override;
481 double conversionTOFMin() const override;
482 double conversionTOFMax() const override;
483
485 QSquared();
486};
487
488//=================================================================================================
490class MANTID_KERNEL_DLL DeltaE : public Unit {
491public:
492 const std::string unitID() const override;
493 const std::string caption() const override { return "Energy transfer"; }
494 const UnitLabel label() const override;
495
496 double singleToTOF(const double x) const override;
497 double singleFromTOF(const double tof) const override;
498 void init() override;
499 Unit *clone() const override;
500
501 double conversionTOFMin() const override;
502 double conversionTOFMax() const override;
503
505 DeltaE();
506
507protected:
508 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
509 double efixed;
510 double factorTo;
511 double factorFrom;
512 double t_other;
513 double t_otherFrom;
514 double unitScaling;
515};
516
517//=================================================================================================
519class MANTID_KERNEL_DLL DeltaE_inWavenumber : public DeltaE {
520public:
521 const std::string unitID() const override;
522 const UnitLabel label() const override;
523
524 void init() override;
525 Unit *clone() const override;
528};
529
530//=================================================================================================
532class MANTID_KERNEL_DLL DeltaE_inFrequency : public DeltaE {
533public:
534 const std::string unitID() const override;
535 const UnitLabel label() const override;
536
537 void init() override;
538 Unit *clone() const override;
541};
542
543//=================================================================================================
545class MANTID_KERNEL_DLL Momentum : public Unit {
546public:
547 const std::string unitID() const override;
548 const std::string caption() const override { return "Momentum"; }
549 const UnitLabel label() const override;
550
551 double singleToTOF(const double ki) const override;
552 double singleFromTOF(const double tof) const override;
553 void init() override;
554 Unit *clone() const override;
555 double conversionTOFMin() const override;
556 double conversionTOFMax() const override;
557
559 Momentum();
560
561protected:
562 void validateUnitParams(const int emode, const UnitParametersMap &params) override;
563 double efixed;
564 double sfpTo;
565 double factorTo;
566 double sfpFrom;
567 double factorFrom;
569};
570
571//=================================================================================================
573class MANTID_KERNEL_DLL SpinEchoLength : public Wavelength {
574public:
575 const std::string unitID() const override;
576 const std::string caption() const override { return "Spin Echo Length"; }
577 const UnitLabel label() const override;
578
579 double singleToTOF(const double x) const override;
580 double singleFromTOF(const double tof) const override;
581 void init() override;
582 Unit *clone() const override;
583 double conversionTOFMin() const override;
584 double conversionTOFMax() const override;
585
588
589private:
590 double efixed;
591};
592
593//=================================================================================================
595class MANTID_KERNEL_DLL SpinEchoTime : public Wavelength {
596public:
597 const std::string unitID() const override;
598 const std::string caption() const override { return "Spin Echo Time"; }
599 const UnitLabel label() const override;
600
601 double singleToTOF(const double x) const override;
602 double singleFromTOF(const double tof) const override;
603 void init() override;
604 Unit *clone() const override;
605 double conversionTOFMin() const override;
606 double conversionTOFMax() const override;
607
609 SpinEchoTime();
610
611private:
612 double efixed;
613};
614
615//=================================================================================================
617class MANTID_KERNEL_DLL Time : public Unit {
618public:
619 const std::string unitID() const override;
620 const std::string caption() const override { return "t"; }
621 const UnitLabel label() const override;
622
623 bool isConvertible() const override { return false; }
624 double singleToTOF(const double x) const override;
625 double singleFromTOF(const double tof) const override;
626 double conversionTOFMax() const override;
627 double conversionTOFMin() const override;
628 void init() override;
629 Unit *clone() const override;
630
632 Time();
633
634protected:
635 double factorTo;
636 double factorFrom;
637};
638
639//=================================================================================================
641class MANTID_KERNEL_DLL Degrees : public Empty {
642public:
643 Degrees();
644 const std::string unitID() const override;
645 const std::string caption() const override { return "Scattering angle"; }
646 const UnitLabel label() const override;
647
648 Unit *clone() const override;
649
650 double singleToTOF(const double x) const override;
651 double singleFromTOF(const double tof) const override;
652
653private:
655};
656
657//=================================================================================================
659class MANTID_KERNEL_DLL Phi : public Degrees {
660 const std::string unitID() const override;
661 const std::string caption() const override { return "Phi"; }
662 Unit *clone() const override { return new Phi(*this); }
663};
664
665//=================================================================================================
667class MANTID_KERNEL_DLL Temperature : public Empty {
668public:
669 Temperature();
670 const std::string unitID() const override;
671 const std::string caption() const override { return "Temperature"; }
672 const UnitLabel label() const override;
673
674 Unit *clone() const override;
675
676 double singleToTOF(const double x) const override;
677 double singleFromTOF(const double tof) const override;
678
679private:
681};
682
683//=================================================================================================
685class MANTID_KERNEL_DLL AtomicDistance : public Empty {
686public:
688 const std::string unitID() const override;
689 const std::string caption() const override { return "Atomic Distance"; }
690 const UnitLabel label() const override;
691
692 Unit *clone() const override;
693
694 double singleToTOF(const double x) const override;
695 double singleFromTOF(const double tof) const override;
696
697private:
699};
700
701//=================================================================================================
702
703MANTID_KERNEL_DLL double timeConversionValue(const std::string &input_unit, const std::string &output_unit);
704
705template <typename T>
706void timeConversionVector(std::vector<T> &vec, const std::string &input_unit, const std::string &output_unit) {
707 double factor = timeConversionValue(std::move(input_unit), std::move(output_unit));
708 if (factor != 1.0)
709 std::transform(vec.begin(), vec.end(), vec.begin(), [factor](T x) -> T { return x * static_cast<T>(factor); });
710}
711
712} // namespace Units
713
714} // namespace Kernel
715} // namespace Mantid
std::vector< T > const * vec
A base-class for the a class that is able to return unit labels in different representations.
Definition UnitLabel.h:20
The base units (abstract) class.
Definition Unit.h:42
virtual Unit * clone() const =0
const UnitParametersMap * m_params
additional parameters l2 :: distance from sample to detector (in metres) twoTheta :: scattering angle...
Definition Unit.h:222
virtual void init()=0
Finalize the initialization.
virtual ~Unit()=default
Virtual destructor.
virtual const UnitLabel label() const =0
A label for the unit to be printed on axes,.
void toTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode, UnitParametersMap const &params)
Convert a range of X values in place from the concrete unit to time-of-flight.
Definition Unit.h:113
virtual double conversionTOFMin() const =0
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF val...
virtual double conversionTOFMax() const =0
This function returns maximal TOF value still reversibly convertible into the unit.
virtual double singleToTOF(const double x) const =0
Convert a single X value to TOF.
virtual bool isConvertible() const
Returns if the unit can be used in conversions.
Definition Unit.h:69
bool initialized
The unit values have been initialized.
Definition Unit.h:211
virtual const std::string caption() const =0
The full name of the unit.
tbb::concurrent_unordered_map< std::string, UnitConversions > ConversionsMap
The possible 'quick conversions' are held in a map with the starting unit as the key.
Definition Unit.h:233
virtual const std::string unitID() const =0
The name of the unit.
std::pair< double, double > ConstantAndPower
A 'quick conversion' requires the constant by which to multiply the input and the power to which to r...
Definition Unit.h:227
virtual double singleFromTOF(const double tof) const =0
Convert a single tof value to this unit.
tbb::concurrent_unordered_map< std::string, ConstantAndPower > UnitConversions
Lists, for a given starting unit, the units to which a 'quick conversion' can be made.
Definition Unit.h:230
void fromTOF(Iterator const xbegin, Iterator const xend, double const l1, int const emode, UnitParametersMap const &params)
Convert a range of X values in place from time-of-flight to the concrete unit.
Definition Unit.h:157
double l1
l1 :: The source-sample distance (in metres)
Definition Unit.h:213
static ConversionsMap s_conversionFactors
The table of possible 'quick conversions'.
Definition Unit.h:235
int emode
emode :: The energy mode (0=elastic, 1=direct geometry, 2=indirect geometry)
Definition Unit.h:216
bool isInitialized() const
Definition Unit.h:186
Atomic Distance in Angstroms.
Definition Unit.h:685
const std::string caption() const override
The full name of the unit.
Definition Unit.h:689
const std::string unitID() const override
"AtomicDistance"
Degrees that has degrees as unit and "Scattering angle" as title.
Definition Unit.h:641
const std::string unitID() const override
The name of the unit.
const std::string caption() const override
< Degrees
Definition Unit.h:645
Energy transfer in units of frequency (MHz)
Definition Unit.h:532
const std::string unitID() const override
"DeltaE_inFrequency"
Energy transfer in units of wavenumber (cm^-1)
Definition Unit.h:519
const std::string unitID() const override
"DeltaE_inWavenumber"
Energy transfer in milli-electronvolts.
Definition Unit.h:490
const std::string unitID() const override
"DeltaE"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:493
double factorFrom
Constant factor for from conversion.
Definition Unit.h:511
double factorTo
Constant factor for to conversion.
Definition Unit.h:510
double t_otherFrom
Energy mode dependent factor in from conversion.
Definition Unit.h:513
double unitScaling
Apply unit scaling to energy value.
Definition Unit.h:514
double t_other
Energy mode dependent factor in to conversion.
Definition Unit.h:512
const std::string caption() const override
The full name of the unit.
Definition Unit.h:255
Empty()
Constructor.
Definition Unit.h:268
const std::string unitID() const override
"Empty"
bool isConvertible() const override
Returns if the unit can be used in conversions.
Definition Unit.h:258
Absolute energy in units of wavenumber (cm^-1)
Definition Unit.h:366
const std::string unitID() const override
"Energy_inWavenumber"
double factorFrom
Constant factor for from conversion.
Definition Unit.h:385
const std::string caption() const override
The full name of the unit.
Definition Unit.h:369
double factorTo
Constant factor for to conversion.
Definition Unit.h:384
Energy in milli-electronvolts.
Definition Unit.h:341
const std::string unitID() const override
"Energy"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:344
double factorTo
Constant factor for to conversion.
Definition Unit.h:360
double factorFrom
Constant factor for from conversion.
Definition Unit.h:361
const std::string caption() const override
The full name of the unit.
Definition Unit.h:276
UnitLabel m_label
Label.
Definition Unit.h:288
std::string m_caption
Caption.
Definition Unit.h:286
const std::string unitID() const override
"Label"
Momentum Transfer in Angstrom^-1.
Definition Unit.h:450
const std::string unitID() const override
"MomentumTransfer"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:453
Momentum in Angstrom^-1.
Definition Unit.h:545
double sfpTo
Extra correction factor in to conversion.
Definition Unit.h:564
const std::string unitID() const override
"Momentum"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:548
double sfpFrom
Extra correction factor in from conversion.
Definition Unit.h:566
bool do_sfpFrom
Apply the sfpFrom value.
Definition Unit.h:568
double factorTo
Constant factor for to conversion.
Definition Unit.h:565
double factorFrom
Constant factor for from conversion.
Definition Unit.h:567
Phi that has degrees as unit and "Phi" as title.
Definition Unit.h:659
const std::string caption() const override
< Degrees
Definition Unit.h:661
Unit * clone() const override
Definition Unit.h:662
const std::string unitID() const override
The name of the unit.
Momentum transfer squared in Angstrom^-2.
Definition Unit.h:472
const std::string unitID() const override
"QSquared"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:475
SpinEchoLength in nm.
Definition Unit.h:573
const std::string unitID() const override
"SpinEchoLength"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:576
SpinEchoTime in ns.
Definition Unit.h:595
const std::string unitID() const override
"SpinEchoTime"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:598
Time of flight in microseconds.
Definition Unit.h:293
const std::string caption() const override
The full name of the unit.
Definition Unit.h:296
const std::string unitID() const override
"TOF"
Temperature in kelvin.
Definition Unit.h:667
const std::string unitID() const override
"Temperature"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:671
Time In Second.
Definition Unit.h:617
double factorFrom
Constant factor for from conversion.
Definition Unit.h:636
const std::string caption() const override
The full name of the unit.
Definition Unit.h:620
const std::string unitID() const override
"Time"
bool isConvertible() const override
Returns if the unit can be used in conversions.
Definition Unit.h:623
double factorTo
Constant factor for to conversion.
Definition Unit.h:635
Wavelength in Angstrom.
Definition Unit.h:312
const std::string caption() const override
The full name of the unit.
Definition Unit.h:315
const std::string unitID() const override
"Wavelength"
bool do_sfpFrom
Apply the sfpFrom value.
Definition Unit.h:336
double sfpFrom
Extra correction factor in from conversion.
Definition Unit.h:334
double factorTo
Constant factor for to conversion.
Definition Unit.h:333
double sfpTo
Extra correction factor in to conversion.
Definition Unit.h:332
double factorFrom
Constant factor for from conversion.
Definition Unit.h:335
d-SpacingPerpendicular in Angstrom
Definition Unit.h:423
const std::string caption() const override
The full name of the unit.
Definition Unit.h:426
double sfpFrom
Extra correction factor in to conversion.
Definition Unit.h:445
double factorFrom
Constant factor for from conversion.
Definition Unit.h:444
double factorTo
Constant factor for to conversion.
Definition Unit.h:442
const std::string unitID() const override
"dSpacingPerpendicular"
double sfpTo
Extra correction factor in to conversion.
Definition Unit.h:443
d-Spacing in Angstrom
Definition Unit.h:396
const std::string unitID() const override
"dSpacing"
const std::string caption() const override
The full name of the unit.
Definition Unit.h:399
void timeConversionVector(std::vector< T > &vec, const std::string &input_unit, const std::string &output_unit)
Definition Unit.h:706
MANTID_KERNEL_DLL double calculateDIFCCorrection(const double l1, const double l2, const double twotheta, const double offset, const double binWidth)
Calculate DIFC in case of logarithmic binning, used in CalculateDIFC with Signed mode.
Definition Unit.cpp:565
MANTID_KERNEL_DLL double tofToDSpacingFactor(const double l1, const double l2, const double twoTheta, const double offset)
Calculate and return conversion factor from tof to d-spacing.
Definition Unit.cpp:589
MANTID_KERNEL_DLL double timeConversionValue(const std::string &input_unit, const std::string &output_unit)
Definition Unit.cpp:1430
std::unordered_map< UnitParams, double > UnitParametersMap
Definition Unit.h:31
std::shared_ptr< const Unit > Unit_const_sptr
Shared pointer to the Unit base class (const version)
Definition Unit.h:241
std::shared_ptr< Unit > Unit_sptr
Shared pointer to the Unit base class.
Definition Unit.h:239
Helper class which provides the Collimation Length for SANS instruments.
constexpr bool operator==(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)
constexpr bool operator!=(const wide_integer< Bits, Signed > &lhs, const wide_integer< Bits2, Signed2 > &rhs)