How geant4 determine the enenrgy of each optical photon

Hello,I read example/extent/optical WLS and here is the code in primarygeneratoraction.cc
auto WLSIntensity =
fMaterial->GetMaterialPropertiesTable()->GetProperty(“WLSCOMPONENT”);

    if(WLSIntensity)
    {
      G4PhysicsFreeVector* WLSIntegral =
        (G4PhysicsFreeVector*) ((*fIntegralTable)(
          fMaterial->GetIndex()));
      
      G4double CIImax   = WLSIntegral->GetMaxValue();
      G4double CIIvalue = G4UniformRand() * CIImax;

      sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
    }
  }

but i don’t relly understand what WLSIntegral and CIImax mean.
Hope you could help me.