@@ -129,19 +129,37 @@ TEST(detector_cuda, detector_alignment) {
129
129
// for populating this vector take all transforms of the detector
130
130
// and shift them by the same translation
131
131
typename detector_host_t ::transform_container tf_store_aligned_host;
132
+ typename decltype (det_host)::transform_container::context_type ctx{};
132
133
133
- point3 shift{.100000f * unit<scalar>::mm, .200000f * unit<scalar>::mm,
134
- .300000f * unit<scalar>::mm};
134
+ point3 shift{.1f * unit<scalar>::mm, .2f * unit<scalar>::mm,
135
+ .3f * unit<scalar>::mm};
135
136
136
137
tf_store_aligned_host.reserve (
137
138
det_host.transform_store ().size (),
138
- typename decltype (det_host)::transform_container::context_type{} );
139
+ ctx );
139
140
140
141
for (const auto & tf : det_host.transform_store ()) {
141
- point3 shifted = tf.translation () + shift;
142
+ point3 shifted{tf.translation ()[0 ] + shift[0 ],
143
+ tf.translation ()[1 ] + shift[1 ],
144
+ tf.translation ()[2 ] + shift[2 ]};
142
145
tf_store_aligned_host.push_back (
143
146
transform_t {shifted, tf.x (), tf.y (), tf.z ()});
144
147
}
148
+ /*
149
+ std::cout << "Comparing translations STEP1" << std::endl;
150
+ for (unsigned int i = 0u; i < 20; i++) {
151
+ auto trstatic = det_host.transform_store().at(i,ctx).translation();
152
+ auto traligned = tf_store_aligned_host.at(i,ctx).translation();
153
+ auto trdiff = traligned - trstatic;
154
+ EXPECT_POINT3_NEAR(trdiff, shift, 1e-6);
155
+ }
156
+ */
157
+
158
+ // Corrected shift
159
+ auto tr0_static = det_host.transform_store ().at (0 ,ctx).translation ();
160
+ auto tr0_aligned = tf_store_aligned_host.at (0 ,ctx).translation ();
161
+ auto tr0_diff = tr0_aligned-tr0_static;
162
+ point3 shift_corrected{tr0_diff[0 ],tr0_diff[1 ],tr0_diff[2 ]};
145
163
146
164
// copy the vector of aligned transforms to the device
147
165
// again, use synchronous copy and fixed size buffers
@@ -173,10 +191,11 @@ TEST(detector_cuda, detector_alignment) {
173
191
surfacexf_data_static, surfacexf_data_aligned);
174
192
175
193
// check that the relevant transforms have been properly shifted
194
+ // std::cout << "Comparing translations STEP3" << std::endl;
176
195
for (unsigned int i = 0u ; i < surfacexf_device_static.size (); i++) {
177
196
auto translation_static = surfacexf_device_static[i].translation ();
178
197
auto translation_aligned = surfacexf_device_aligned[i].translation ();
179
198
auto translation_diff = translation_aligned - translation_static;
180
- EXPECT_POINT3_NEAR (translation_diff, shift , 1e-5 );
199
+ EXPECT_POINT3_NEAR (translation_diff, shift_corrected , 1e-6 );
181
200
}
182
201
}
0 commit comments