restG4 simulation producing 0 entries are deleted!

REST version : v2.2.15
REST commit : 0953c623

I have seen the following code at the end of restG4 that removes the generated output file in case no entries are found. Still the number of primaries simulated is important to re-normalize the final contribution.

    // some verification
    if (restRun->GetEntries() <= 0) {
        // if no events are registered we exit with error
        cout << "ERROR: No events deposited energy in sensitive volume" << endl;
        // we also delete the file
        string fileToRemove = (string)restRun->GetOutputFileName();
        if (remove(fileToRemove.c_str()) == 0) {
            cout << "deleted: " << fileToRemove << endl;
        } else {
            cout << "error deleting: " << fileToRemove << endl;
        }
        throw std::exception();
    }

This is not the appropriate thing to do. In the scenario that we launch thousands of simulations that produce output files with a number of entries in the poissonian regime, we will not be able, or it will be difficult, to compute the total number of events simulated, since the files with 0 entries will be removed.

I will comment out that code in a commit

This trap also troubled us in the previous time…