Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
abb123e6
Commit
abb123e6
authored
Jan 15, 2016
by
Hahn, Steven
Browse files
Refs #14988. Ran modernize-loop-convert on DataHandling.
parent
1e6af932
Changes
71
Hide whitespace changes
Inline
Side-by-side
Framework/DataHandling/src/AppendGeometryToSNSNexus.cpp
View file @
abb123e6
...
...
@@ -222,11 +222,11 @@ void AppendGeometryToSNSNexus::exec() {
polar_angle
.
reserve
(
dets
.
size
());
azimuthal_angle
.
reserve
(
dets
.
size
());
for
(
std
::
size_t
i
=
0
;
i
<
dets
.
size
();
i
++
)
{
pixel_id
.
push_back
(
det
s
[
i
]
->
getID
());
distance
.
push_back
(
det
s
[
i
]
->
getDistance
(
*
sample
));
azimuthal_angle
.
push_back
(
det
s
[
i
]
->
getPhi
());
polar_angle
.
push_back
(
ws
->
detectorTwoTheta
(
det
s
[
i
]
));
for
(
auto
&
det
:
dets
)
{
pixel_id
.
push_back
(
det
->
getID
());
distance
.
push_back
(
det
->
getDistance
(
*
sample
));
azimuthal_angle
.
push_back
(
det
->
getPhi
());
polar_angle
.
push_back
(
ws
->
detectorTwoTheta
(
det
));
}
// Write Pixel ID to file
...
...
Framework/DataHandling/src/CreateChunkingFromInstrument.cpp
View file @
abb123e6
...
...
@@ -246,17 +246,17 @@ string parentName(IComponent_const_sptr comp, const string &prefix) {
*/
string
parentName
(
IComponent_const_sptr
comp
,
const
vector
<
string
>
&
names
)
{
// handle the special case of the component has the name
for
(
auto
name
=
names
.
begin
();
name
!=
names
.
end
();
++
name
)
if
(
name
->
compare
(
comp
->
getName
())
==
0
)
return
(
*
name
)
;
for
(
const
auto
&
name
:
names
)
if
(
name
.
compare
(
comp
->
getName
())
==
0
)
return
name
;
// find the parent with the correct name
IComponent_const_sptr
parent
=
comp
->
getParent
();
if
(
parent
)
{
// see if this is the parent
for
(
auto
name
=
names
.
begin
();
name
!=
names
.
end
();
++
name
)
if
(
name
->
compare
(
parent
->
getName
())
==
0
)
return
(
*
name
)
;
for
(
const
auto
&
name
:
names
)
if
(
name
.
compare
(
parent
->
getName
())
==
0
)
return
name
;
// or recurse
return
parentName
(
parent
,
names
);
...
...
@@ -448,10 +448,9 @@ void CreateChunkingFromInstrument::exec() {
throw
std
::
runtime_error
(
"Failed to find any banks in the instrument"
);
// fill in the table workspace
for
(
auto
group
=
grouping
.
begin
();
group
!=
grouping
.
end
();
++
group
)
{
for
(
auto
&
group
:
grouping
)
{
stringstream
banks
;
for
(
auto
bank
=
group
->
second
.
begin
();
bank
!=
group
->
second
.
end
();
++
bank
)
for
(
auto
bank
=
group
.
second
.
begin
();
bank
!=
group
.
second
.
end
();
++
bank
)
banks
<<
(
*
bank
)
<<
","
;
// remove the trailing comma
...
...
Framework/DataHandling/src/CreateSimulationWorkspace.cpp
View file @
abb123e6
...
...
@@ -302,12 +302,12 @@ MantidVecPtr CreateSimulationWorkspace::createBinBoundaries() const {
*/
void
CreateSimulationWorkspace
::
applyDetectorMapping
()
{
size_t
wsIndex
(
0
);
for
(
auto
iter
=
m_detGroup
s
.
begin
();
iter
!=
m_detGroups
.
end
();
++
iter
)
{
for
(
auto
&
m_detGroup
:
m_detGroups
)
{
ISpectrum
*
spectrum
=
m_outputWS
->
getSpectrum
(
wsIndex
);
spectrum
->
setSpectrumNo
(
static_cast
<
specid_t
>
(
wsIndex
+
1
));
// Ensure a contiguous mapping
spectrum
->
clearDetectorIDs
();
spectrum
->
addDetectorIDs
(
iter
->
second
);
spectrum
->
addDetectorIDs
(
m_detGroup
.
second
);
++
wsIndex
;
}
}
...
...
Framework/DataHandling/src/DetermineChunking.cpp
View file @
abb123e6
...
...
@@ -148,8 +148,8 @@ void DetermineChunking::exec() {
string
dataDir
;
LoadPreNexus
lp
;
lp
.
parseRuninfo
(
filename
,
dataDir
,
eventFilenames
);
for
(
size_t
i
=
0
;
i
<
eventFilenames
.
size
();
i
++
)
{
BinaryFile
<
DasEvent
>
eventfile
(
dataDir
+
eventFilename
s
[
i
]
);
for
(
auto
&
eventFilename
:
eventFilenames
)
{
BinaryFile
<
DasEvent
>
eventfile
(
dataDir
+
eventFilename
);
// Factor of 2 for compression
filesize
+=
static_cast
<
double
>
(
eventfile
.
getNumElements
())
*
48.0
/
(
1024.0
*
1024.0
*
1024.0
);
...
...
@@ -326,8 +326,8 @@ std::string DetermineChunking::setTopEntryName(std::string filename) {
*/
FileType
DetermineChunking
::
getFileType
(
const
string
&
filename
)
{
// check for prenexus
for
(
int
i
=
0
;
i
<
NUM_EXT_
PRENEXUS
;
++
i
)
{
if
(
filename
.
find
(
PRENEXUS_EXT
[
i
]
)
!=
std
::
string
::
npos
)
{
for
(
const
auto
&
i
:
PRENEXUS
_EXT
)
{
if
(
filename
.
find
(
i
)
!=
std
::
string
::
npos
)
{
g_log
.
information
()
<<
"Determined
\'
"
<<
filename
<<
"
\'
is a prenexus file
\n
"
;
return
PRENEXUS_FILE
;
...
...
@@ -335,8 +335,8 @@ FileType DetermineChunking::getFileType(const string &filename) {
}
// check for histogram nexus
for
(
int
i
=
0
;
i
<
NUM_EXT_
HISTO_NEXUS
;
++
i
)
{
if
(
filename
.
find
(
HISTO_NEXUS_EXT
[
i
]
)
!=
std
::
string
::
npos
)
{
for
(
const
auto
&
i
:
HISTO_NEXUS
_EXT
)
{
if
(
filename
.
find
(
i
)
!=
std
::
string
::
npos
)
{
g_log
.
information
()
<<
"Determined
\'
"
<<
filename
<<
"
\'
is a histogram nexus file
\n
"
;
return
HISTO_NEXUS_FILE
;
...
...
@@ -344,8 +344,8 @@ FileType DetermineChunking::getFileType(const string &filename) {
}
// check for event nexus - must be last because a valid extension is ".nxs"
for
(
int
i
=
0
;
i
<
NUM_EXT_
EVENT_NEXUS
;
++
i
)
{
if
(
filename
.
find
(
EVENT_NEXUS_EXT
[
i
]
)
!=
std
::
string
::
npos
)
{
for
(
const
auto
&
i
:
EVENT_NEXUS
_EXT
)
{
if
(
filename
.
find
(
i
)
!=
std
::
string
::
npos
)
{
g_log
.
information
()
<<
"Determined
\'
"
<<
filename
<<
"
\'
is an event nexus file
\n
"
;
return
EVENT_NEXUS_FILE
;
...
...
@@ -353,8 +353,8 @@ FileType DetermineChunking::getFileType(const string &filename) {
}
// check for isis raw files
for
(
int
i
=
0
;
i
<
NUM_EXT_RAW
;
++
i
)
{
if
(
filename
.
find
(
RAW_EXT
[
i
]
)
!=
std
::
string
::
npos
)
{
for
(
const
auto
&
i
:
RAW_EXT
)
{
if
(
filename
.
find
(
i
)
!=
std
::
string
::
npos
)
{
g_log
.
information
()
<<
"Determined
\'
"
<<
filename
<<
"
\'
is an ISIS raw file
\n
"
;
return
RAW_FILE
;
...
...
Framework/DataHandling/src/DownloadInstrument.cpp
View file @
abb123e6
...
...
@@ -107,9 +107,9 @@ void DownloadInstrument::exec() {
<<
" from the instrument repository"
<<
std
::
endl
;
}
for
(
auto
itMap
=
fileMap
.
begin
();
itMap
!=
fileMap
.
end
();
++
itMap
)
{
for
(
auto
&
itMap
:
fileMap
)
{
// download a file
doDownloadFile
(
itMap
->
first
,
itMap
->
second
);
doDownloadFile
(
itMap
.
first
,
itMap
.
second
);
}
setProperty
(
"FileDownloadCount"
,
static_cast
<
int
>
(
fileMap
.
size
()));
...
...
@@ -180,8 +180,7 @@ DownloadInstrument::StringToStringMap DownloadInstrument::processRepository() {
std
::
set
<
std
::
string
>
repoFilenames
;
for
(
Json
::
ArrayIndex
i
=
0
;
i
<
serverContents
.
size
();
++
i
)
{
const
auto
&
serverElement
=
serverContents
[
i
];
for
(
auto
&
serverElement
:
serverContents
)
{
std
::
string
name
=
serverElement
.
get
(
"name"
,
""
).
asString
();
repoFilenames
.
insert
(
name
);
Poco
::
Path
filePath
(
localPath
,
name
);
...
...
@@ -303,8 +302,8 @@ size_t DownloadInstrument::removeOrphanedFiles(
// delete any identified files
try
{
for
(
auto
it
=
filesToDelete
.
begin
();
it
!=
filesToDelete
.
end
();
++
it
)
{
Poco
::
File
file
(
*
it
);
for
(
const
auto
&
it
:
filesToDelete
)
{
Poco
::
File
file
(
it
);
file
.
remove
();
}
}
catch
(
Poco
::
Exception
&
ex
)
{
...
...
Framework/DataHandling/src/EventWorkspaceCollection.cpp
View file @
abb123e6
...
...
@@ -29,9 +29,9 @@ void copyLogs(const EventWorkspace_sptr &from, EventWorkspace_sptr &to) {
// from the logs, get all the properties that don't overwrite any
// prop. already set in the sink workspace (like 'filename').
auto
props
=
from
->
mutableRun
().
getLogData
();
for
(
size_t
j
=
0
;
j
<
props
.
size
();
j
++
)
{
if
(
!
to
->
mutableRun
().
hasProperty
(
prop
s
[
j
]
->
name
()))
{
to
->
mutableRun
().
addLogData
(
prop
s
[
j
]
->
clone
());
for
(
auto
&
prop
:
props
)
{
if
(
!
to
->
mutableRun
().
hasProperty
(
prop
->
name
()))
{
to
->
mutableRun
().
addLogData
(
prop
->
clone
());
}
}
}
...
...
@@ -110,8 +110,8 @@ void EventWorkspaceCollection::setNPeriods(
}
void
EventWorkspaceCollection
::
reserveEventListAt
(
size_t
wi
,
size_t
size
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
getEventList
(
wi
).
reserve
(
size
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
getEventList
(
wi
).
reserve
(
size
);
}
}
...
...
@@ -128,8 +128,8 @@ API::Workspace_sptr EventWorkspaceCollection::combinedWorkspace() {
final
=
getSingleHeldWorkspace
();
}
else
{
auto
wsg
=
boost
::
make_shared
<
API
::
WorkspaceGroup
>
();
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
wsg
->
addWorkspace
(
m_WsVec
[
i
]
);
for
(
auto
&
i
:
m_WsVec
)
{
wsg
->
addWorkspace
(
i
);
}
final
=
wsg
;
}
...
...
@@ -160,10 +160,10 @@ EventWorkspaceCollection::getSpectrum(const size_t index) const {
void
EventWorkspaceCollection
::
setSpectrumNumbersFromUniqueSpectra
(
const
std
::
set
<
int
>
uniqueSpectra
)
{
// For each workspace, update all the spectrum numbers
for
(
auto
ws
=
m_WsVec
.
begin
();
ws
!=
m_WsVec
.
end
();
++
ws
)
{
for
(
auto
&
ws
:
m_WsVec
)
{
size_t
counter
=
0
;
for
(
auto
it
=
uniqueSpectra
.
begin
();
it
!=
uniqueSpectra
.
end
();
++
it
)
{
(
*
ws
)
->
getSpectrum
(
counter
)
->
setSpectrumNo
(
*
it
);
for
(
value_type
it
:
uniqueSpectra
)
{
ws
->
getSpectrum
(
counter
)
->
setSpectrumNo
(
it
);
++
counter
;
}
}
...
...
@@ -171,16 +171,16 @@ void EventWorkspaceCollection::setSpectrumNumbersFromUniqueSpectra(
void
EventWorkspaceCollection
::
setSpectrumNumberForAllPeriods
(
const
size_t
spectrumNumber
,
const
specid_t
specid
)
{
for
(
auto
ws
=
m_WsVec
.
begin
();
ws
!=
m_WsVec
.
end
();
++
ws
)
{
auto
spec
=
(
*
ws
)
->
getSpectrum
(
spectrumNumber
);
for
(
auto
&
ws
:
m_WsVec
)
{
auto
spec
=
ws
->
getSpectrum
(
spectrumNumber
);
spec
->
setSpectrumNo
(
specid
);
}
}
void
EventWorkspaceCollection
::
setDetectorIdsForAllPeriods
(
const
size_t
spectrumNumber
,
const
detid_t
id
)
{
for
(
auto
ws
=
m_WsVec
.
begin
();
ws
!=
m_WsVec
.
end
();
++
ws
)
{
auto
spec
=
(
*
ws
)
->
getSpectrum
(
spectrumNumber
);
for
(
auto
&
ws
:
m_WsVec
)
{
auto
spec
=
ws
->
getSpectrum
(
spectrumNumber
);
spec
->
setDetectorID
(
id
);
}
}
...
...
@@ -228,40 +228,40 @@ Kernel::DateAndTime EventWorkspaceCollection::getFirstPulseTime() const {
return
m_WsVec
[
0
]
->
getFirstPulseTime
();
}
void
EventWorkspaceCollection
::
setAllX
(
Kernel
::
cow_ptr
<
MantidVec
>
&
x
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
setAllX
(
x
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
setAllX
(
x
);
}
}
size_t
EventWorkspaceCollection
::
getNumberEvents
()
const
{
return
m_WsVec
[
0
]
->
getNumberEvents
();
// Should be the sum across all periods?
}
void
EventWorkspaceCollection
::
resizeTo
(
const
size_t
size
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
resizeTo
(
size
);
// Creates the EventLists
for
(
auto
&
i
:
m_WsVec
)
{
i
->
resizeTo
(
size
);
// Creates the EventLists
}
}
void
EventWorkspaceCollection
::
padSpectra
(
const
std
::
vector
<
int32_t
>
&
padding
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
padSpectra
(
padding
);
// Set detector ids and spectrum numbers
for
(
auto
&
i
:
m_WsVec
)
{
i
->
padSpectra
(
padding
);
// Set detector ids and spectrum numbers
}
}
void
EventWorkspaceCollection
::
setInstrument
(
const
Geometry
::
Instrument_const_sptr
&
inst
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
setInstrument
(
inst
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
setInstrument
(
inst
);
}
}
void
EventWorkspaceCollection
::
setMonitorWorkspace
(
const
boost
::
shared_ptr
<
API
::
MatrixWorkspace
>
&
monitorWS
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
setMonitorWorkspace
(
for
(
auto
&
i
:
m_WsVec
)
{
i
->
setMonitorWorkspace
(
monitorWS
);
// TODO, do we really set the same monitor on all periods???
}
}
void
EventWorkspaceCollection
::
updateSpectraUsing
(
const
API
::
SpectrumDetectorMapping
&
map
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
updateSpectraUsing
(
map
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
updateSpectraUsing
(
map
);
}
}
...
...
@@ -271,43 +271,43 @@ DataObjects::EventList *EventWorkspaceCollection::getEventListPtr(size_t i) {
}
void
EventWorkspaceCollection
::
populateInstrumentParameters
()
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
populateInstrumentParameters
();
for
(
auto
&
i
:
m_WsVec
)
{
i
->
populateInstrumentParameters
();
}
}
void
EventWorkspaceCollection
::
setGeometryFlag
(
const
int
flag
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
mutableSample
().
setGeometryFlag
(
flag
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
mutableSample
().
setGeometryFlag
(
flag
);
}
}
void
EventWorkspaceCollection
::
setThickness
(
const
float
flag
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
mutableSample
().
setThickness
(
flag
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
mutableSample
().
setThickness
(
flag
);
}
}
void
EventWorkspaceCollection
::
setHeight
(
const
float
flag
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
mutableSample
().
setHeight
(
flag
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
mutableSample
().
setHeight
(
flag
);
}
}
void
EventWorkspaceCollection
::
setWidth
(
const
float
flag
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
mutableSample
().
setWidth
(
flag
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
mutableSample
().
setWidth
(
flag
);
}
}
void
EventWorkspaceCollection
::
setTitle
(
std
::
string
title
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
m_WsVec
[
i
]
->
setTitle
(
title
);
for
(
auto
&
i
:
m_WsVec
)
{
i
->
setTitle
(
title
);
}
}
void
EventWorkspaceCollection
::
applyFilter
(
boost
::
function
<
void
(
MatrixWorkspace_sptr
)
>
func
)
{
for
(
size_t
i
=
0
;
i
<
m_WsVec
.
size
();
++
i
)
{
func
(
m_WsVec
[
i
]
);
for
(
auto
&
i
:
m_WsVec
)
{
func
(
i
);
}
}
...
...
Framework/DataHandling/src/FilterEventsByLogValuePreNexus.cpp
View file @
abb123e6
...
...
@@ -173,14 +173,12 @@ static string generateMappingfileName(EventWorkspace_sptr &wksp) {
const
string
CAL
(
"_CAL"
);
const
size_t
CAL_LEN
=
CAL
.
length
();
// cache to make life easier
vector
<
string
>
files
;
for
(
size_t
i
=
0
;
i
<
dirs
.
size
();
++
i
)
{
if
((
dirs
[
i
].
length
()
>
CAL_LEN
)
&&
(
dirs
[
i
].
compare
(
dirs
[
i
].
length
()
-
CAL
.
length
(),
CAL
.
length
(),
CAL
)
==
0
))
{
if
(
Poco
::
File
(
base
.
path
()
+
"/"
+
dirs
[
i
]
+
"/calibrations/"
+
mapping
)
for
(
auto
&
dir
:
dirs
)
{
if
((
dir
.
length
()
>
CAL_LEN
)
&&
(
dir
.
compare
(
dir
.
length
()
-
CAL
.
length
(),
CAL
.
length
(),
CAL
)
==
0
))
{
if
(
Poco
::
File
(
base
.
path
()
+
"/"
+
dir
+
"/calibrations/"
+
mapping
)
.
exists
())
files
.
push_back
(
base
.
path
()
+
"/"
+
dirs
[
i
]
+
"/calibrations/"
+
mapping
);
files
.
push_back
(
base
.
path
()
+
"/"
+
dir
+
"/calibrations/"
+
mapping
);
}
}
...
...
@@ -515,8 +513,8 @@ void FilterEventsByLogValuePreNexus::processProperties() {
m_loadOnlySomeSpectra
=
(
this
->
m_spectraList
.
size
()
>
0
);
// Turn the spectra list into a map, for speed of access
for
(
auto
it
=
m_spectraList
.
begin
();
it
!=
m_spectraList
.
end
();
it
++
)
spectraLoadMap
[
*
it
]
=
true
;
for
(
long
long
&
it
:
m_spectraList
)
spectraLoadMap
[
it
]
=
true
;
//---------------------------------------------------------------------------
// Other features
...
...
@@ -783,8 +781,8 @@ void FilterEventsByLogValuePreNexus::runLoadInstrument(
vector
<
string
>
eventExts
(
EVENT_EXTS
,
EVENT_EXTS
+
NUM_EXT
);
std
::
reverse
(
eventExts
.
begin
(),
eventExts
.
end
());
for
(
size_t
i
=
0
;
i
<
eventExts
.
size
();
++
i
)
{
size_t
pos
=
instrument
.
find
(
eventExt
s
[
i
]
);
for
(
auto
&
eventExt
:
eventExts
)
{
size_t
pos
=
instrument
.
find
(
eventExt
);
if
(
pos
!=
string
::
npos
)
{
instrument
=
instrument
.
substr
(
0
,
pos
);
break
;
...
...
@@ -1428,13 +1426,13 @@ void FilterEventsByLogValuePreNexus::unmaskVetoEventIndexes() {
size_t
numerror
=
0
;
PRAGMA_OMP
(
parallel
for
schedule
(
dynamic
,
1
)
)
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
m_vecEventIndex
.
size
());
++
i
)
{
for
(
unsigned
long
long
&
i
:
m_vecEventIndex
)
{
PARALLEL_START_INTERUPT_REGION
uint64_t
eventindex
=
m_vecEventIndex
[
i
]
;
uint64_t
eventindex
=
i
;
if
(
eventindex
>
static_cast
<
uint64_t
>
(
m_numEvents
))
{
uint64_t
realeventindex
=
eventindex
&
VETOFLAG
;
m_vecEventIndex
[
i
]
=
realeventindex
;
i
=
realeventindex
;
}
PARALLEL_END_INTERUPT_REGION
}
...
...
@@ -2250,13 +2248,13 @@ void FilterEventsByLogValuePreNexus::setupPixelSpectrumMap(
eventws
->
getInstrument
()
->
getDetectors
(
detector_map
);
// Set up
for
(
auto
it
=
detector_map
.
begin
();
it
!=
detector_map
.
end
();
it
++
)
{
if
(
!
it
->
second
->
isMonitor
())
{
for
(
auto
&
it
:
detector_map
)
{
if
(
!
it
.
second
->
isMonitor
())
{
// Add non-monitor detector ID
size_t
workspaceIndex
=
m_pixelToWkspindex
[
it
->
first
];
size_t
workspaceIndex
=
m_pixelToWkspindex
[
it
.
first
];
// this->m_pixelToWkspindex[it->first] = workspaceIndex;
EventList
&
spec
=
eventws
->
getOrAddEventList
(
workspaceIndex
);
spec
.
addDetectorID
(
it
->
first
);
spec
.
addDetectorID
(
it
.
first
);
// Start the spectrum number at 1
spec
.
setSpectrumNo
(
specid_t
(
workspaceIndex
+
1
));
}
...
...
Framework/DataHandling/src/FindDetectorsPar.cpp
View file @
abb123e6
...
...
@@ -378,16 +378,16 @@ void FindDetectorsPar::extractAndLinearize(
this
->
detID
.
resize
(
nDetectors
);
nDetectors
=
0
;
for
(
size_t
i
=
0
;
i
<
detPar
.
size
();
i
++
)
{
if
(
detPar
[
i
]
.
detID
<
0
)
for
(
const
auto
&
i
:
detPar
)
{
if
(
i
.
detID
<
0
)
continue
;
azimuthal
[
nDetectors
]
=
detPar
[
i
]
.
azimutAngle
;
polar
[
nDetectors
]
=
detPar
[
i
]
.
polarAngle
;
azimuthalWidth
[
nDetectors
]
=
detPar
[
i
]
.
azimWidth
;
polarWidth
[
nDetectors
]
=
detPar
[
i
]
.
polarWidth
;
secondaryFlightpath
[
nDetectors
]
=
detPar
[
i
]
.
secondaryFlightPath
;
detID
[
nDetectors
]
=
static_cast
<
size_t
>
(
detPar
[
i
]
.
detID
);
azimuthal
[
nDetectors
]
=
i
.
azimutAngle
;
polar
[
nDetectors
]
=
i
.
polarAngle
;
azimuthalWidth
[
nDetectors
]
=
i
.
azimWidth
;
polarWidth
[
nDetectors
]
=
i
.
polarWidth
;
secondaryFlightpath
[
nDetectors
]
=
i
.
secondaryFlightPath
;
detID
[
nDetectors
]
=
static_cast
<
size_t
>
(
i
.
detID
);
nDetectors
++
;
}
// store caluclated value
...
...
Framework/DataHandling/src/GroupDetectors2.cpp
View file @
abb123e6
...
...
@@ -531,8 +531,7 @@ void GroupDetectors2::processXMLFile(std::string fname,
std
::
vector
<
size_t
>
&
wsindexes
=
sit
->
second
;
for
(
size_t
i
=
0
;
i
<
detids
.
size
();
i
++
)
{
detid_t
detid
=
detids
[
i
];
for
(
int
detid
:
detids
)
{
auto
ind
=
detIdToWiMap
.
find
(
detid
);
if
(
ind
!=
detIdToWiMap
.
end
())
{
size_t
wsid
=
ind
->
second
;
...
...
@@ -560,8 +559,7 @@ void GroupDetectors2::processXMLFile(std::string fname,
std
::
vector
<
size_t
>
&
wsindexes
=
sit
->
second
;
for
(
size_t
i
=
0
;
i
<
spectra
.
size
();
i
++
)
{
int
specid
=
spectra
[
i
];
for
(
int
specid
:
spectra
)
{
auto
ind
=
specs2index
.
find
(
specid
);
if
(
ind
!=
specs2index
.
end
())
{
size_t
wsid
=
ind
->
second
;
...
...
@@ -621,9 +619,8 @@ void GroupDetectors2::processGroupingWorkspace(
det_ids
.
push_back
(
det
->
getID
());
}
for
(
auto
dit
=
det_ids
.
begin
();
dit
!=
det_ids
.
end
();
++
dit
)
{
for
(
int
det_id
:
det_ids
)
{
// translate detectors to target det ws indexes
detid_t
det_id
=
*
dit
;
size_t
targetWSIndex
=
detIdToWiMap
[
det_id
];
targetWSIndexSet
.
insert
(
targetWSIndex
);
// mark as used
...
...
@@ -638,10 +635,9 @@ void GroupDetectors2::processGroupingWorkspace(
}
// Build m_GroupSpecInds (group -> list of ws indices)
for
(
auto
dit
=
group2WSIndexSetmap
.
begin
();
dit
!=
group2WSIndexSetmap
.
end
();
++
dit
)
{
size_t
groupid
=
dit
->
first
;
std
::
set
<
size_t
>
&
targetWSIndexSet
=
dit
->
second
;
for
(
auto
&
dit
:
group2WSIndexSetmap
)
{
size_t
groupid
=
dit
.
first
;
std
::
set
<
size_t
>
&
targetWSIndexSet
=
dit
.
second
;
std
::
vector
<
size_t
>
tempv
;
tempv
.
assign
(
targetWSIndexSet
.
begin
(),
targetWSIndexSet
.
end
());
m_GroupSpecInds
.
insert
(
...
...
@@ -690,9 +686,8 @@ void GroupDetectors2::processMatrixWorkspace(
if
(
detGroup
)
{
det_ids
=
detGroup
->
getDetectorIDs
();
for
(
auto
dit
=
det_ids
.
begin
();
dit
!=
det_ids
.
end
();
++
dit
)
{
for
(
int
det_id
:
det_ids
)
{
// translate detectors to target det ws indexes
detid_t
det_id
=
*
dit
;
size_t
targetWSIndex
=
detIdToWiMap
[
det_id
];
targetWSIndexSet
.
insert
(
targetWSIndex
);
// mark as used
...
...
@@ -707,10 +702,9 @@ void GroupDetectors2::processMatrixWorkspace(
}
// Build m_GroupSpecInds (group -> list of ws indices)
for
(
auto
dit
=
group2WSIndexSetmap
.
begin
();
dit
!=
group2WSIndexSetmap
.
end
();
++
dit
)
{
size_t
groupid
=
dit
->
first
;
std
::
set
<
size_t
>
&
targetWSIndexSet
=
dit
->
second
;
for
(
auto
&
dit
:
group2WSIndexSetmap
)
{
size_t
groupid
=
dit
.
first
;
std
::
set
<
size_t
>
&
targetWSIndexSet
=
dit
.
second
;
if
(
!
targetWSIndexSet
.
empty
())
{
std
::
vector
<
size_t
>
tempv
;
tempv
.
assign
(
targetWSIndexSet
.
begin
(),
targetWSIndexSet
.
end
());
...
...
@@ -856,11 +850,11 @@ void GroupDetectors2::readSpectraIndexes(std::string line,
std
::
string
seperator
)
{
// remove comments and white space
Poco
::
StringTokenizer
dataComment
(
line
,
seperator
,
IGNORE_SPACES
);
for
(
auto
itr
=
dataComment
.
begin
();
itr
!=
dataComment
.
end
();
++
itr
)
{
for
(
const
auto
&
itr
:
dataComment
)
{
std
::
vector
<
size_t
>
specNums
;
specNums
.
reserve
(
output
.
capacity
());
RangeHelper
::
getList
(
*
itr
,
specNums
);
RangeHelper
::
getList
(
itr
,
specNums
);
std
::
vector
<
size_t
>::
const_iterator
specN
=
specNums
.
begin
();
for
(;
specN
!=
specNums
.
end
();
++
specN
)
{
...
...
@@ -963,10 +957,7 @@ size_t GroupDetectors2::formGroups(API::MatrixWorkspace_const_sptr inputWS,
size_t
nonMaskedSpectra
(
0
);
beh
->
dataX
(
outIndex
)[
0
]
=
0.0
;
beh
->
dataE
(
outIndex
)[
0
]
=
0.0
;
for
(
auto
wsIter
=
it
->
second
.
cbegin
();
wsIter
!=
it
->
second
.
cend
();
++
wsIter
)
{
const
size_t
originalWI
=
*
wsIter
;
for
(
unsigned
long
originalWI
:
it
->
second
)
{
// detectors to add to firstSpecNum
const
ISpectrum
*
fromSpectrum
=
inputWS
->
getSpectrum
(
originalWI
);
...
...
@@ -1071,10 +1062,7 @@ GroupDetectors2::formGroupsEvent(DataObjects::EventWorkspace_const_sptr inputWS,
size_t
nonMaskedSpectra
(
0
);
beh
->
dataX
(
outIndex
)[
0
]
=
0.0
;
beh
->
dataE
(
outIndex
)[
0
]
=
0.0
;
for
(
auto
wsIter
=
it
->
second
.
cbegin
();
wsIter
!=
it
->
second
.
cend
();
++
wsIter
)
{
const
size_t
originalWI
=
*
wsIter
;
for
(
unsigned
long
originalWI
:
it
->
second
)
{
const
EventList
&
fromEL
=
inputWS
->
getEventList
(
originalWI
);
// Add the event lists with the operator
outEL
+=
fromEL
;
...
...
@@ -1141,11 +1129,10 @@ void GroupDetectors2::moveOthers(const std::set<int64_t> &unGroupedSet,
static_cast
<
double
>
(
unGroupedSet
.
size
());
// go thorugh all the spectra in the input workspace
for
(
auto
copyFrIt
=
unGroupedSet
.
cbegin
();
copyFrIt
!=
unGroupedSet
.
cend
();
++
copyFrIt
)
{
if
(
*
copyFrIt
==
USED
)
for
(
value_type
copyFrIt
:
unGroupedSet
)
{
if
(
copyFrIt
==
USED
)