class TBRDaoESImp extends BaseDaoESImp implements TBRDao {

    @Override
    public double getTBRRatio_PI_TCs(List<TargetingChannel> tcs) throws IOException
    {
        if (CommonUtil.isEmpty(tcs))
        {
            return 0;
        }
        BoolQueryBuilder boolQueryBuilder = null;
        for (TargetingChannel tc : tcs)
        {
            if (boolQueryBuilder == null)
            {
                boolQueryBuilder = createQueryForMultiValuePlusAgeGender(tc);
            }
            else
            {
                BoolQueryBuilder boolQueryBuilder1 = createQueryForMultiValuePlusAgeGender(tc);
                boolQueryBuilder.must(boolQueryBuilder1);
            }
        }

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

        boolQueryBuilder = null;
        for (TargetingChannel tc : tcs)
        {
            if (boolQueryBuilder == null)
            {
                boolQueryBuilder = createQueryForAgeGender(tc);
            }
            else
            {
                BoolQueryBuilder boolQueryBuilder1 = createQueryForAgeGender(tc);
                boolQueryBuilder.must(boolQueryBuilder1);
            }
        }

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

        return v1 / v2;
    }

    public  TBRDaoESImp(Properties properties);

}