A device and an algorithm for the separation of visible and near infrared signals in a monolithic Silicon sensor