Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
694ba302
Commit
694ba302
authored
7 years ago
by
Hahn, Steven
Browse files
Options
Downloads
Patches
Plain Diff
clang-format
parent
8b3c33fc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Framework/MDAlgorithms/src/MDNormDirectSC.cpp
+60
-61
60 additions, 61 deletions
Framework/MDAlgorithms/src/MDNormDirectSC.cpp
with
60 additions
and
61 deletions
Framework/MDAlgorithms/src/MDNormDirectSC.cpp
+
60
−
61
View file @
694ba302
...
@@ -462,71 +462,70 @@ void MDNormDirectSC::calculateNormalization(
...
@@ -462,71 +462,70 @@ void MDNormDirectSC::calculateNormalization(
std
::
vector
<
coord_t
>
pos
,
posNew
;
std
::
vector
<
coord_t
>
pos
,
posNew
;
auto
prog
=
make_unique
<
API
::
Progress
>
(
this
,
0.3
,
1.0
,
ndets
);
auto
prog
=
make_unique
<
API
::
Progress
>
(
this
,
0.3
,
1.0
,
ndets
);
PRAGMA_OMP
(
parallel
for
private
(
intersections
,
pos
,
posNew
))
PRAGMA_OMP
(
parallel
for
private
(
intersections
,
pos
,
posNew
))
for
(
int64_t
i
=
0
;
i
<
ndets
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
ndets
;
i
++
)
{
PARALLEL_START_INTERUPT_REGION
PARALLEL_START_INTERUPT_REGION
if
(
!
spectrumInfo
.
hasDetectors
(
i
)
||
spectrumInfo
.
isMonitor
(
i
)
||
if
(
!
spectrumInfo
.
hasDetectors
(
i
)
||
spectrumInfo
.
isMonitor
(
i
)
||
spectrumInfo
.
isMasked
(
i
))
{
spectrumInfo
.
isMasked
(
i
))
{
continue
;
continue
;
}
}
const
auto
&
detector
=
spectrumInfo
.
detector
(
i
);
const
auto
&
detector
=
spectrumInfo
.
detector
(
i
);
double
theta
=
detector
.
getTwoTheta
(
m_samplePos
,
m_beamDir
);
double
theta
=
detector
.
getTwoTheta
(
m_samplePos
,
m_beamDir
);
double
phi
=
detector
.
getPhi
();
double
phi
=
detector
.
getPhi
();
// If the detector is a group, this should be the ID of the first detector
// If the detector is a group, this should be the ID of the first detector
const
auto
detID
=
detector
.
getID
();
const
auto
detID
=
detector
.
getID
();
// Intersections
// Intersections
this
->
calculateIntersections
(
intersections
,
theta
,
phi
);
this
->
calculateIntersections
(
intersections
,
theta
,
phi
);
if
(
intersections
.
empty
())
if
(
intersections
.
empty
())
continue
;
// Get solid angle for this contribution
double
solid
=
protonCharge
;
if
(
haveSA
)
{
solid
=
solidAngleWS
->
y
(
solidAngDetToIdx
.
find
(
detID
)
->
second
)[
0
]
*
protonCharge
;
}
// Compute final position in HKL
// pre-allocate for efficiency and copy non-hkl dim values into place
pos
.
resize
(
vmdDims
+
otherValues
.
size
()
+
1
);
std
::
copy
(
otherValues
.
begin
(),
otherValues
.
end
(),
pos
.
begin
()
+
vmdDims
);
pos
.
push_back
(
1.
);
auto
intersectionsBegin
=
intersections
.
begin
();
for
(
auto
it
=
intersectionsBegin
+
1
;
it
!=
intersections
.
end
();
++
it
)
{
const
auto
&
curIntSec
=
*
it
;
const
auto
&
prevIntSec
=
*
(
it
-
1
);
// the full vector isn't used so compute only what is necessary
double
delta
=
(
curIntSec
[
3
]
*
curIntSec
[
3
]
-
prevIntSec
[
3
]
*
prevIntSec
[
3
])
/
energyToK
;
if
(
delta
<
1e-10
)
continue
;
// Assume zero contribution if difference is small
// Average between two intersections for final position
std
::
transform
(
curIntSec
.
data
(),
curIntSec
.
data
()
+
vmdDims
,
prevIntSec
.
data
(),
pos
.
begin
(),
VectorHelper
::
SimpleAverage
<
coord_t
>
());
// transform kf to energy transfer
pos
[
3
]
=
static_cast
<
coord_t
>
(
m_Ei
-
pos
[
3
]
*
pos
[
3
]
/
energyToK
);
affineTrans
.
multiplyPoint
(
pos
,
posNew
);
size_t
linIndex
=
m_normWS
->
getLinearIndexAtCoord
(
posNew
.
data
());
if
(
linIndex
==
size_t
(
-
1
))
continue
;
continue
;
// Get solid angle for this contribution
// signal = integral between two consecutive intersections *solid angle
double
solid
=
protonCharge
;
// *PC
if
(
haveSA
)
{
double
signal
=
solid
*
delta
;
solid
=
solidAngleWS
->
y
(
solidAngDetToIdx
.
find
(
detID
)
->
second
)[
0
]
*
Mantid
::
Kernel
::
AtomicOp
(
signalArray
[
linIndex
],
signal
,
protonCharge
;
std
::
plus
<
signal_t
>
());
}
// Compute final position in HKL
// pre-allocate for efficiency and copy non-hkl dim values into place
pos
.
resize
(
vmdDims
+
otherValues
.
size
()
+
1
);
std
::
copy
(
otherValues
.
begin
(),
otherValues
.
end
(),
pos
.
begin
()
+
vmdDims
);
pos
.
push_back
(
1.
);
auto
intersectionsBegin
=
intersections
.
begin
();
for
(
auto
it
=
intersectionsBegin
+
1
;
it
!=
intersections
.
end
();
++
it
)
{
const
auto
&
curIntSec
=
*
it
;
const
auto
&
prevIntSec
=
*
(
it
-
1
);
// the full vector isn't used so compute only what is necessary
double
delta
=
(
curIntSec
[
3
]
*
curIntSec
[
3
]
-
prevIntSec
[
3
]
*
prevIntSec
[
3
])
/
energyToK
;
if
(
delta
<
1e-10
)
continue
;
// Assume zero contribution if difference is small
// Average between two intersections for final position
std
::
transform
(
curIntSec
.
data
(),
curIntSec
.
data
()
+
vmdDims
,
prevIntSec
.
data
(),
pos
.
begin
(),
VectorHelper
::
SimpleAverage
<
coord_t
>
());
// transform kf to energy transfer
pos
[
3
]
=
static_cast
<
coord_t
>
(
m_Ei
-
pos
[
3
]
*
pos
[
3
]
/
energyToK
);
affineTrans
.
multiplyPoint
(
pos
,
posNew
);
size_t
linIndex
=
m_normWS
->
getLinearIndexAtCoord
(
posNew
.
data
());
if
(
linIndex
==
size_t
(
-
1
))
continue
;
// signal = integral between two consecutive intersections *solid angle
// *PC
double
signal
=
solid
*
delta
;
Mantid
::
Kernel
::
AtomicOp
(
signalArray
[
linIndex
],
signal
,
std
::
plus
<
signal_t
>
());
}
prog
->
report
();
PARALLEL_END_INTERUPT_REGION
}
}
PARALLEL_CHECK_INTERUPT_REGION
prog
->
report
();
std
::
copy
(
signalArray
.
cbegin
(),
signalArray
.
cend
(),
m_normWS
->
getSignalArray
());
PARALLEL_END_INTERUPT_REGION
}
PARALLEL_CHECK_INTERUPT_REGION
std
::
copy
(
signalArray
.
cbegin
(),
signalArray
.
cend
(),
m_normWS
->
getSignalArray
());
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment