A method based on transverse energy balance of jets for selection of direct photons and fragmentation photons in high energy pp collisions