@@ -129,20 +129,39 @@ 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
- transform_t {shifted, tf.x (), tf.y (), tf.z ()});
146
+ transform_t {shifted, tf.x (), tf.y (), tf.z (), false });
144
147
}
145
148
149
+ std::cout << " Comparing translations STEP1" << std::endl;
150
+ for (unsigned int i = 0u ; i < tf_store_aligned_host.size (ctx); 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
+ std::cout << " SHIFT (" << trdiff[0 ] << " ," << trdiff[1 ] << " ," << trdiff[2 ] << " )" << std::endl;
155
+ }
156
+ /*
157
+ // Corrected shift
158
+ auto tr0_static = det_host.transform_store().at(0,ctx).translation();
159
+ auto tr0_aligned = tf_store_aligned_host.at(0,ctx).translation();
160
+ auto tr0_diff = tr0_aligned-tr0_static;
161
+ point3 shift_corrected{tr0_diff[0],tr0_diff[1],tr0_diff[2]};
162
+ std::cout << "Corrected shift : " << tr0_diff[0] << " " << tr0_diff[1] << " " << tr0_diff[2] << std::endl;
163
+ */
164
+
146
165
// copy the vector of aligned transforms to the device
147
166
// again, use synchronous copy and fixed size buffers
148
167
auto tf_buff_aligned =
@@ -173,10 +192,11 @@ TEST(detector_cuda, detector_alignment) {
173
192
surfacexf_data_static, surfacexf_data_aligned);
174
193
175
194
// check that the relevant transforms have been properly shifted
176
- for (unsigned int i = 0u ; i < surfacexf_device_static.size (); i++) {
195
+ // std::cout << "Comparing translations STEP3" << std::endl;
196
+ for (unsigned int i = 0u ; i < 20 ; i++) {
177
197
auto translation_static = surfacexf_device_static[i].translation ();
178
198
auto translation_aligned = surfacexf_device_aligned[i].translation ();
179
199
auto translation_diff = translation_aligned - translation_static;
180
- EXPECT_POINT3_NEAR (translation_diff, shift, 1e-5 );
200
+ EXPECT_POINT3_NEAR (translation_diff, shift, 1e-6 );
181
201
}
182
202
}
0 commit comments