Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:27

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2025 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 // Project include(s).
0009 #include "traccc/bfield/magnetic_field.hpp"
0010 #include "traccc/bfield/magnetic_field_types.hpp"
0011 #include "traccc/io/read_magnetic_field.hpp"
0012 
0013 // GTest include(s).
0014 #include <gtest/gtest.h>
0015 
0016 TEST(io_bfield, read_odd_binary_field) {
0017   // Read in the binary ODD file.
0018   traccc::magnetic_field field;
0019   traccc::io::read_magnetic_field(field, "geometries/odd/odd-bfield.cvf",
0020                                   traccc::data_format::binary);
0021 
0022   // Check that the field is about 2 Tesla in the center of the detector.
0023   auto field_view =
0024       field.as_view<traccc::host::inhom_bfield_backend_t<traccc::scalar>>();
0025   EXPECT_NEAR(
0026       static_cast<float>(field_view.at(0, 0, 0)[0]) / traccc::unit<float>::T,
0027       0.f, 0.01f);
0028   EXPECT_NEAR(
0029       static_cast<float>(field_view.at(0, 0, 0)[1]) / traccc::unit<float>::T,
0030       0.f, 0.01f);
0031   EXPECT_NEAR(
0032       static_cast<float>(field_view.at(0, 0, 0)[2]) / traccc::unit<float>::T,
0033       2.f, 0.01f);
0034 }