Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
5c18dad3
Unverified
Commit
5c18dad3
authored
Sep 21, 2021
by
Gemma Guest
Committed by
GitHub
Sep 21, 2021
Browse files
Merge pull request #29849 from mantidproject/ILL_loaders_cleanup
ILL loaders cleanup
parents
b2a7f4a9
58e8b0cf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/inc/MantidDataHandling/LoadILLIndirect2.h
View file @
5c18dad3
...
...
@@ -19,6 +19,7 @@ namespace DataHandling {
*/
class
DLLExport
LoadILLIndirect2
:
public
API
::
IFileLoader
<
Kernel
::
NexusDescriptor
>
{
public:
LoadILLIndirect2
();
/// Returns a confidence value that this algorithm can load a file
int
confidence
(
Kernel
::
NexusDescriptor
&
descriptor
)
const
override
;
...
...
@@ -53,17 +54,17 @@ private:
std
::
string
m_instrumentName
;
///< Name of the instrument
// Variables describing the data in the detector
size_t
m_numberOfTubes
{
16
}
;
// number of tubes - X
size_t
m_numberOfPixelsPerTube
{
128
};
// number of pixels per tube - Y
size_t
m_numberOfChannels
{
1024
};
// time channels - Z
size_t
m_numberOfSimpleDetectors
{
8
}
;
// number of simple detector
size_t
m_numberOfMonitors
{
1
}
;
// number of monitors
std
::
set
<
int
>
m_activeSDIndices
;
// set of Single Detector indices,
// that were actually active
bool
m_bats
{
false
};
// A flag marking the BATS mode
size_t
m_firstTubeAngleRounded
{
251
};
// A flag holding the rounded angle of the first tube
size_t
m_numberOfTubes
;
// number of tubes - X
size_t
m_numberOfPixelsPerTube
;
// number of pixels per tube - Y
size_t
m_numberOfChannels
;
// time channels - Z
size_t
m_numberOfSimpleDetectors
;
// number of simple detector
size_t
m_numberOfMonitors
;
// number of monitors
std
::
set
<
int
>
m_activeSDIndices
;
// set of Single Detector indices,
// that were actually active
bool
m_bats
;
// A flag marking the BATS mode
size_t
m_firstTubeAngleRounded
;
// A flag holding the rounded angle of the first tube
std
::
vector
<
std
::
string
>
m_supportedInstruments
{
"IN16B"
}
;
std
::
vector
<
std
::
string
>
m_supportedInstruments
;
LoadHelper
m_loader
;
std
::
string
m_loadOption
;
};
...
...
Framework/DataHandling/inc/MantidDataHandling/LoadILLTOF2.h
View file @
5c18dad3
...
...
@@ -62,19 +62,19 @@ private:
API
::
MatrixWorkspace_sptr
m_localWorkspace
;
std
::
string
m_instrumentName
=
""
;
///< Name of the instrument
std
::
string
m_instrumentPath
=
""
;
///< Name of the instrument path
std
::
string
m_instrumentName
;
///< Name of the instrument
std
::
string
m_instrumentPath
;
///< Name of the instrument path
// Variables describing the data in the detector
size_t
m_numberOfTubes
=
0
;
// number of tubes - X
size_t
m_numberOfPixelsPerTube
=
0
;
// number of pixels per tube - Y
size_t
m_numberOfChannels
=
0
;
// time channels - Z
size_t
m_numberOfHistograms
=
0
;
size_t
m_numberOfTubes
;
// number of tubes - X
size_t
m_numberOfPixelsPerTube
;
// number of pixels per tube - Y
size_t
m_numberOfChannels
;
// time channels - Z
size_t
m_numberOfHistograms
;
/* Values parsed from the nexus file */
double
m_wavelength
=
0
;
double
m_channelWidth
=
0
;
double
m_timeOfFlightDelay
=
0
;
double
m_wavelength
;
double
m_channelWidth
;
double
m_timeOfFlightDelay
;
std
::
string
m_monitorName
;
LoadHelper
m_loader
;
...
...
Framework/DataHandling/src/LoadILLIndirect2.cpp
View file @
5c18dad3
...
...
@@ -33,6 +33,13 @@ using namespace NeXus;
// Register the algorithm into the AlgorithmFactory
DECLARE_NEXUS_FILELOADER_ALGORITHM
(
LoadILLIndirect2
)
//----------------------------------------------------------------------------------------------
/** Constructor
*/
LoadILLIndirect2
::
LoadILLIndirect2
()
:
m_numberOfTubes
{
16
},
m_numberOfChannels
{
1024
},
m_numberOfSimpleDetectors
{
8
},
m_numberOfMonitors
{
1
},
m_bats
{
false
},
m_firstTubeAngleRounded
{
251
},
m_supportedInstruments
{
"IN16B"
}
{}
//----------------------------------------------------------------------------------------------
/// Algorithm's name for identification. @see Algorithm::name
const
std
::
string
LoadILLIndirect2
::
name
()
const
{
return
"LoadILLIndirect"
;
}
...
...
@@ -217,7 +224,8 @@ void LoadILLIndirect2::loadDataDetails(NeXus::NXEntry &entry) {
firstTubeAngle
.
load
();
m_firstTubeAngleRounded
=
static_cast
<
size_t
>
(
std
::
round
(
10
*
firstTubeAngle
[
0
]));
}
catch
(...)
{
g_log
.
information
()
<<
"Unable to read first tube anlge, assuming 25.1"
;
m_firstTubeAngleRounded
=
251
;
g_log
.
information
()
<<
"Unable to read first tube angle, assuming 251"
;
}
}
else
{
m_numberOfSimpleDetectors
=
0
;
...
...
Framework/DataHandling/src/LoadILLPolarizedDiffraction.cpp
View file @
5c18dad3
...
...
@@ -36,14 +36,9 @@ using namespace NeXus;
using
Types
::
Core
::
DateAndTime
;
namespace
{
// This defines the number of detector banks in D7
constexpr
size_t
D7_NUMBER_BANKS
=
3
;
// This defines the number of physical pixels in D7
constexpr
size_t
D7_NUMBER_PIXELS
=
132
;
// This defines the number of pixels per bank in D7
constexpr
size_t
D7_NUMBER_PIXELS_BANK
=
44
;
// This defines the number of monitors in the instrument. If there are cases
// where this is no longer one this decleration should be moved.
// This defines the number of monitors in the instrument.
constexpr
size_t
NUMBER_MONITORS
=
2
;
// This defines Time Of Flight measurement mode switch value
constexpr
size_t
TOF_MODE_ON
=
1
;
...
...
@@ -320,13 +315,14 @@ void LoadILLPolarizedDiffraction::loadInstrument(const API::MatrixWorkspace_sptr
std
::
vector
<
double
>
LoadILLPolarizedDiffraction
::
loadTwoThetaDetectors
(
const
API
::
MatrixWorkspace_sptr
&
workspace
,
const
NXEntry
&
entry
,
const
int
bankId
)
{
std
::
vector
<
double
>
twoTheta
(
static_cast
<
int
>
(
D7_NUMBER_PIXELS_BANK
));
auto
const
nPixelsPerBank
=
workspace
->
getInstrument
()
->
getIntParameter
(
"number_pixels_per_bank"
)[
0
];
std
::
vector
<
double
>
twoTheta
(
static_cast
<
int
>
(
nPixelsPerBank
));
if
(
getPropertyValue
(
"PositionCalibration"
)
==
"Nexus"
)
{
NXFloat
twoThetaPixels
=
entry
.
openNXFloat
(
"D7/Detector/bank"
+
std
::
to_string
(
bankId
)
+
"_offset"
);
twoThetaPixels
.
load
();
float
*
twoThetaDataStart
=
twoThetaPixels
();
float
*
twoThetaDataEnd
=
twoThetaDataStart
+
D7_NUMBER_PIXELS_BANK
;
float
*
twoThetaDataEnd
=
twoThetaDataStart
+
nPixelsPerBank
;
twoTheta
.
assign
(
twoThetaDataStart
,
twoThetaDataEnd
);
}
else
{
auto
loadIpf
=
createChildAlgorithm
(
"LoadParameterFile"
);
...
...
@@ -339,7 +335,7 @@ std::vector<double> LoadILLPolarizedDiffraction::loadTwoThetaDetectors(const API
m_wavelength
=
currentBank
->
getNumberParameter
(
"wavelength"
)[
0
];
for
(
auto
pixel_no
=
0
;
pixel_no
<
static_cast
<
int
>
(
D7_NUMBER_PIXELS_BANK
);
pixel_no
++
)
{
for
(
auto
pixel_no
=
0
;
pixel_no
<
static_cast
<
int
>
(
nPixelsPerBank
);
pixel_no
++
)
{
twoTheta
[
pixel_no
]
=
currentBank
->
getNumberParameter
(
"twoTheta_pixel_"
+
std
::
to_string
(
pixel_no
+
1
))[
0
];
}
}
...
...
@@ -375,9 +371,11 @@ std::vector<double> LoadILLPolarizedDiffraction::loadBankParameters(const API::M
void
LoadILLPolarizedDiffraction
::
moveTwoTheta
(
const
NXEntry
&
entry
,
const
API
::
MatrixWorkspace_sptr
&
workspace
)
{
Instrument_const_sptr
instrument
=
workspace
->
getInstrument
();
auto
const
nBanks
=
instrument
->
getIntParameter
(
"number_banks"
)[
0
];
auto
const
nPixelsPerBank
=
instrument
->
getIntParameter
(
"number_pixels_per_bank"
)[
0
];
auto
&
componentInfo
=
workspace
->
mutableComponentInfo
();
for
(
auto
bank_no
=
0
;
bank_no
<
static_cast
<
int
>
(
D7_NUMBER_BANKS
);
++
bank_no
)
{
for
(
auto
bank_no
=
0
;
bank_no
<
static_cast
<
int
>
(
nBanks
);
++
bank_no
)
{
NXFloat
twoThetaBank
=
entry
.
openNXFloat
(
"D7/2theta/actual_bank"
+
std
::
to_string
(
bank_no
+
2
));
// detector bank IDs start at 2
twoThetaBank
.
load
();
...
...
@@ -393,8 +391,8 @@ void LoadILLPolarizedDiffraction::moveTwoTheta(const NXEntry &entry, const API::
if
(
getPropertyValue
(
"PositionCalibration"
)
==
"YIGFile"
)
{
bankParameters
=
loadBankParameters
(
workspace
,
bank_no
+
2
);
}
for
(
auto
pixel_no
=
0
;
pixel_no
<
static_cast
<
int
>
(
D7_NUMBER_PIXELS_BANK
);
++
pixel_no
)
{
auto
const
pixelIndex
=
bank_no
*
static_cast
<
int
>
(
D7_NUMBER_PIXELS_BANK
)
+
pixel_no
;
for
(
auto
pixel_no
=
0
;
pixel_no
<
static_cast
<
int
>
(
nPixelsPerBank
);
++
pixel_no
)
{
auto
const
pixelIndex
=
bank_no
*
static_cast
<
int
>
(
nPixelsPerBank
)
+
pixel_no
;
auto
const
pixel
=
componentInfo
.
componentID
(
pixelIndex
);
V3D
position
=
pixel
->
getPos
();
double
radius
,
theta
,
phi
;
...
...
instrument/D20_Parameters.xml
View file @
5c18dad3
<?xml version="1.0" encoding="UTF-8" ?>
<parameter-file
instrument=
"D20"
valid-from=
"1900-01-31 23:59:59"
>
<component-link
name=
"D20"
>
<!-- The detector name for the height axis used in SumOverlappingTubes -->
<parameter
name=
"detector_for_height_axis"
type=
"string"
visible=
"false"
>
<value
val=
"panel_1"
/>
...
...
instrument/D7_Parameters.xml
View file @
5c18dad3
...
...
@@ -2,6 +2,13 @@
<parameter-file
instrument=
"D7"
valid-from=
"1900-01-01T00:00:00"
>
<component-link
name=
"D7"
>
<parameter
name=
"number_banks"
type=
"int"
visible=
"false"
>
<value
val=
"3"
/>
</parameter>
<parameter
name=
"number_pixels_per_bank"
type=
"int"
visible=
"false"
>
<value
val=
"44"
/>
</parameter>
<!-- formula for Detector efficiency calculation. Algorithm: DetectorEfficiencyCorUser
See http://muparser.sourceforge.net/mup_features.html#idDef2 for available
operators -->
...
...
@@ -39,4 +46,3 @@
</component-link>
</parameter-file>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment