int main() { std::string fname; std::cout << "enter file name : "; 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::vector<Double_t> pars(4,0); pars[2] = 1; pars[3] = 1; Plane plane(pars); RegionIntegratorMultiDim rimd; rimd.SetFunction(plane); Double_t result = rimd.RegionIntegral(rfl.GetRegions().front()); std::cout << "integral (grid) = " << result << std::endl; rimd.SetUsingCenter(true); result = rimd.RegionIntegral(rfl.GetRegions().front()); std::cout << "integral (cntr) = " << result << std::endl; std::cout << "ideally should be = " << ::acos(-1)*9.0 << std::endl; return 0; }
/* Synopsis: outputs the gradings corresponding to the various real forms defined for Cartan #cn. The gradings are output in the same order as the corresponding orbits are output in the "cartan" command. */ std::ostream& printGradings(std::ostream& strm, size_t cn, Interface& CI) { ComplexReductiveGroup& G = CI.complexGroup(); const CartanClass& cc = G.cartan(cn); RealFormNbrList rfl(cc.numRealForms()); const realform_io::Interface& rfi = CI.realFormInterface(); for (cartanclass::adjoint_fiber_orbit i = 0; i < rfl.size(); ++i) rfl[i] = rfi.out(G.realFormLabels(cn)[i]); cartan_io::printGradings(strm,cc.fiber(),rfl,G.rootDatum()); return strm; }
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; }
Int_t VisualizeRegionIntegratedSurface() { std::string fname = GetRootFile(); TGraph2DErrors* gr = GetGraph(fname); gr->SetMarkerColor(kOrange); gr->SetLineColor(kOrange+3); std::string parfname = GetParamFile(); std::ifstream pfile(parfname.data(),std::ios::in); Parameters params(pfile); if (! params.KeysAreSensible()) return -1; AngDist W(params); W.SetConstrainedRange(false); SphCoordsIntegrand Wsph(W); std::string regfname = GetRegionFile(); std::ifstream rfile(regfname.data()); RegionFileLoader rfl(rfile); rfile.close(); std::vector<Regions> regs = rfl.GetRegions(); TGraph2DErrors* grint = GenerateRegionIntegratedSurface(gr, Wsph, regs); grint->SetMarkerColor(kAzure); grint->SetLineColor(kAzure+3); TCanvas* c = new TCanvas("c"); c->Divide(2,1); c->cd(1); grint->Draw("p0 tri1 err"); c->cd(2); gr->Draw("p0 tri1 err"); return 0; }