Study of high transverse momentum direct photon production in interaction of 500 GeV/c piminus and proton beams on a beryllum target