Unveiling photophysical and photonic phenomena by means of optical gain measurements in waveguides and solutions