#define XERR
#include "loop.ih"

//      d_pool->falsePositives(d_round * (modality + 1)) >
//        d_modalities[XRAY][modality == MAMMOGRAPHY ? MAMMO : TOMO]
//                    [screeningAge >= 40].value()


void Loop::maybeFalsePositive(ModBase *modBase, double screeningAge)
{
//xerr("specificity: " << modBase->specificity(screeningAge) << ' ' << \ <--
//d_costs.usingAt(screeningAge));

    double rnd = Random::instance().uniform();
    double spec = modBase->specificity(screeningAge);

    if (rnd <= spec)
        g_log << "      " << rnd << " <= specificity(" <<
                screeningAge << ") = " << spec << ": no false positive\n";
    else
    {
        g_log << "      " << rnd << " > specificity(" <<
                screeningAge << ") = " << spec << ": false positive\n";

        modBase->falsePositive();
        ++d_nRoundFP[d_round];
        d_roundInfo[d_round] = FALSE_POSITIVE;

        addCost(d_costs.usingAt(screeningAge));
//        addCost(d_costs.biopsy(screeningAge));
    }
}
