create view rich700_trb3lookup_data_view
  (vers_id, trbnet_address, channel, pixel_col, pixel_row)
as
  select a.vers_id, a.trbnet_address,
         a.channel_id, c.pixel_x, c.pixel_y
    from rich700_trb3lookup_data a,
         rich700_pixel b,
         rich700_pixel_grid c
    where a.pmt_id = b.pmt_id 
      AND a.pmt_pixel = b.pmt_pixel 
      AND b.pixel_id = c.pixel_id;

COMMENT ON TABLE rich700_trb3lookup_data_view IS 'Lookup table used by the TRB3 unpacker of the RICH700 detector (used in hydra2)';
COMMENT ON COLUMN rich700_trb3lookup_data_view.vers_id IS 'Identifier for the version of the parameter set, references rich700_trb3lookup
_vers.vers_id';
COMMENT ON COLUMN rich700_trb3lookup_data_view.trbnet_address IS 'Trbnet address (0x1200..0x1600) PRELIMINARY';
COMMENT ON COLUMN rich700_trb3lookup_data_view.channel IS 'Dirich channel id (0..31)';
COMMENT ON COLUMN rich700_trb3lookup_data_view.pixel_col IS 'Pixel column (X position) on RICH700 detector plane (1...200)';
COMMENT ON COLUMN rich700_trb3lookup_data_view.pixel_row IS 'Pixel row    (Y position) on RICH700 detector plane (1...200)';

