Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2024-2026 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 // Local include(s).
0009 #include "traccc/io/csv/make_measurement_edm.hpp"
0010 
0011 // Project include(s).
0012 #include "traccc/definitions/track_parametrization.hpp"
0013 
0014 // Detray include(s).
0015 #include <detray/geometry/identifier.hpp>
0016 
0017 namespace traccc::io::csv {
0018 
0019 void make_measurement_edm(
0020     const traccc::io::csv::measurement& csv_meas,
0021     edm::measurement_collection::host::proxy_type& meas,
0022     const std::map<geometry_id, geometry_id>* acts_to_detray_id,
0023     const traccc::detector_design_description::host* det_desc,
0024     const std::map<geometry_id, std::size_t>*
0025         geometry_id_to_detector_description_index) {
0026   // Construct the measurement object.
0027   std::array<detray::dindex_type<default_algebra>, 2u> indices{0u, 0u};
0028   meas.dimensions() = 0u;
0029 
0030   // Local key is a 8 bit char and first and last bit are dummy value. 2 -
0031   // 7th bits are for 6 bound track parameters.
0032   // Ex1) 0000010 or 2 -> meas dim = 1 and [loc0] active -> strip or wire
0033   // Ex2) 0000110 or 6 -> meas dim = 2 and [loc0, loc1] active -> pixel
0034   // Ex3) 0000100 or 4 -> meas dim = 1 and [loc1] active -> annulus
0035   for (unsigned int ipar = 0; ipar < 2u; ++ipar) {
0036     if (((csv_meas.local_key) & (1 << (ipar + 1))) != 0) {
0037       switch (ipar) {
0038         case e_bound_loc0: {
0039           meas.local_position()[0] = csv_meas.local0;
0040           meas.local_variance()[0] = csv_meas.var_local0;
0041           indices[meas.dimensions()++] = ipar;
0042         }; break;
0043         case e_bound_loc1: {
0044           meas.local_position()[1] = csv_meas.local1;
0045           meas.local_variance()[1] = csv_meas.var_local1;
0046           indices[meas.dimensions()++] = ipar;
0047         }; break;
0048       }
0049     }
0050   }
0051 
0052   meas.time() = csv_meas.time;
0053 
0054   if (acts_to_detray_id) {
0055     meas.surface_link() = detray::geometry::identifier{
0056         acts_to_detray_id->at(csv_meas.geometry_id)};
0057   } else {
0058     meas.surface_link() = detray::geometry::identifier{csv_meas.geometry_id};
0059   }
0060   if (det_desc != nullptr) {
0061     std::size_t dd_idx = geometry_id_to_detector_description_index->at(
0062         meas.surface_link().value());
0063     meas.dimensions() = det_desc->dimensions().at(dd_idx);
0064     meas.set_subspace(det_desc->subspace().at(dd_idx));
0065   } else {
0066     meas.set_subspace(indices);
0067   }
0068 }
0069 
0070 }  // namespace traccc::io::csv