class TBRDaoESImp extends BaseDaoESImp implements TBRDao {

    @Override
    public double getTBRRatio_PI_BNs_DOT_qBAR(List<TargetingChannel> bns, TargetingChannel q) throws IOException
    {
        BoolQueryBuilder tcqb1 = createAndQueryForMultiValuePlusAgeGender(bns);
        BoolQueryBuilder tcqb2 = createQueryForMultiValuePlusAgeGender(q);
        tcqb2 = createInvQuery(tcqb2);
        tcqb1 = tcqb1.must(tcqb2);

        double v1 = getSumForQuery(tcqb1);
        if (v1 == 0)
        {
            return 0;
        }

        tcqb1 = createAndQueryForAgeGender(bns);
        tcqb2 = createQueryForAgeGender(q);
        tcqb2 = createInvQuery(tcqb2);
        tcqb1 = tcqb1.must(tcqb2);

        double v2 = getSumForQuery(tcqb1);
        if (v2 == 0)
        {
            LOGGER.info("Inconsistent data in TBR");
            v2 = 1;
        }

        return v1 / v2;
    }

    public  TBRDaoESImp(Properties properties);

}