.. _program_listing_file_larflow_PrepFlowMatchData_arxiv_FlowMatchMap.cxx: Program Listing for File FlowMatchMap.cxx ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``larflow/PrepFlowMatchData/arxiv/FlowMatchMap.cxx``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "FlowMatchMap.hh" #include namespace larflow { // --------------------------------------------------------- // FLOW MATCH MAP CLASS FlowMatchMap::FlowMatchMap() : _source_plane(-1), _target_plane(-1) { } FlowMatchMap::FlowMatchMap( int source_plane_index, int target_plane_index ) : _source_plane(source_plane_index), _target_plane(target_plane_index) { } void FlowMatchMap::add_matchdata( int src_pixel_index, const std::vector& target_indices, const std::vector& truth_v ) { if ( truth_v.size()!=target_indices.size() ) { throw std::runtime_error( "truth and target index vectors not the same size" ); } _target_map[src_pixel_index] = target_indices; _truth_map[src_pixel_index] = truth_v; } const std::vector& FlowMatchMap::getTargetIndices( int src_index ) const { auto it = _target_map.find( src_index ); if ( it==_target_map.end() ) { std::stringstream msg; msg << "did not find source index=" << src_index << "."; throw std::runtime_error( msg.str() ); } return it->second; } const std::vector& FlowMatchMap::getTruthVector( int src_index ) const { auto it = _truth_map.find( src_index ); if ( it==_truth_map.end() ) { std::stringstream msg; msg << "did not find source index=" << src_index << "."; throw std::runtime_error( msg.str() ); } return it->second; } }