コード例 #1
0
void RegionFileLoader::LoadDataFromFile(std::ifstream &file)
{
    if (file.fail())
    {
        std::cerr << "Error <RegionFileLoader::LoadDataFromFile> File is unreadable" <<  std::endl;
        return;
    }

    Double_t sa;
    std::string aline;
    std::stringstream ss;
    while(1)
    {
        std::getline(file,aline);
        if ( FileIsNotOkay(file) )
            break;
        else if ( LineShouldBeSkipped(aline) )
            continue;
        else if ( BeginningOfRegions(aline) )
        {
//            std::cout << aline << std::endl;
            Regions regions = ReadRegions(file);
            if (regions.size()>0)
                fTheRegions.push_back(regions);
        }
    }

    file.close();

}
コード例 #2
0
Double_t RegionIntegratorMultiDim::RegionIntegral(const ROOT::Math::IMultiGenFunction &f, const Regions &reg)
{
    Double_t result = 0;
    Double_t xlow[2], xhigh[2];
    for (UInt_t i=0; i<reg.size(); i++)
    {
        if (fUseCenters == true)
        {
            xlow[0] = reg[i].cntr_xlow;
            xlow[1] = reg[i].cntr_ylow;

            xhigh[0] = reg[i].cntr_xhigh;
            xhigh[1] = reg[i].cntr_yhigh;
        }
        else
        {
            xlow[0] = reg[i].grid_xlow;
            xlow[1] = reg[i].grid_ylow;

            xhigh[0] = reg[i].grid_xhigh;
            xhigh[1] = reg[i].grid_yhigh;
        }

        result += Integral(f, xlow, xhigh);
    }

    return result;
}