Exemplo n.º 1
0
Int_t Main()
{

    std::string fname;
    std::cout << "\nFor the regions ";
    ListAllFilesInDirOfType (".",".bndry");
    std::cout << "\nEnter filename : ";
    std::getline(std::cin, fname);

    std::ifstream ifile(fname.data(),std::ios::in);
    RegionFileLoader rfl(ifile);
    ifile.close();
    std::cout << "Found " << rfl.GetRegions().size() << " boundaries" << std::endl;

    std::string res_fname;
    std::cout << "\nEnter file to write output to : ";
    std::getline(std::cin,res_fname);

    std::ofstream ofile(res_fname.data());
    ofile << std::setiosflags(std::ios::scientific)
            << std::setprecision(2);
    ofile << "Results"
            << "\n--------";

    ROOT::Math::WrappedMultiFunction<> r(&Unity,2);
    SphCoordsIntegrand r_sin(r);
    RegionIntegratorMultiDim integ;

    integ.SetFunction(r_sin);

    for (UInt_t i=0; i<rfl.GetRegions().size(); i++)
    {
        Regions reg(rfl.GetRegions()[i]);
        reg *= CLHEP::deg;

        Double_t result = integ.RegionIntegral(reg);
        Double_t res_err = integ.Error()*reg.size();
        ofile << "\n" << std::setw(10) << result/(4.0*CLHEP::pi)
                << std::setw(10) << res_err/(4.0*CLHEP::pi);
    }

    ofile << std::endl;

    ofile.close();
    return 0;
}
Exemplo n.º 2
0
decimal r_sin_deg(const decimal& a,bool round)
{
	return r_sin(r_rad(a,false),round);
}