.. _program_listing_file_larflow_FlowContourMatch_makehitsfrompixels.cxx: Program Listing for File makehitsfrompixels.cxx =============================================== |exhale_lsh| :ref:`Return to documentation for file ` (``larflow/FlowContourMatch/makehitsfrompixels.cxx``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "makehitsfrompixels.h" #include "LArUtil/Geometry.h" namespace larflow { larlite::event_hit makeHitsFromWholeImagePixels( const larcv::Image2D& src_adc, const float threshold ) { larlite::event_hit evhit_v; evhit_v.clear(); evhit_v.reserve(int(0.01*src_adc.meta().rows()*src_adc.meta().cols())); int maxcol = src_adc.meta().cols(); int maxcol_plane = maxcol; if ( src_adc.meta().plane()<2 ) { maxcol_plane = src_adc.meta().col(2399)+1; // maxwire } else { maxcol_plane = src_adc.meta().col(3455)+1; // maxwire } maxcol = ( maxcol>maxcol_plane) ? maxcol_plane : maxcol; // we loop over all source pixels and make "hits" for all pixels above threshold int ihit = 0; for (int irow=0; irow<(int)src_adc.meta().rows(); irow++) { float hit_tick = src_adc.meta().pos_y( irow )-2400.0; for (int icol=0; icolPlaneWireToChannel( wireid.Plane, wireid.Wire ); h.set_channel( ch ); h.set_view( (larlite::geo::View_t)wireid.Plane ); h.set_wire( wireid ); h.set_signal_type( larutil::Geometry::GetME()->SignalType( ch ) ); evhit_v.emplace_back( std::move(h) ); ihit++; } } return evhit_v; } }