From 675df01c1e2ad1226650930aa67260ff928fdb6c Mon Sep 17 00:00:00 2001 From: Walter Van Herck <w.van.herck@fz-juelich.de> Date: Tue, 16 Apr 2013 17:45:43 +0200 Subject: [PATCH] aesthetics: column width 80 --- App/src/FunctionalTestFactory.cpp | 45 ++++++++++++++------- App/src/TestIsGISAXS13.cpp | 66 +++++++++++++++++++++---------- 2 files changed, 75 insertions(+), 36 deletions(-) diff --git a/App/src/FunctionalTestFactory.cpp b/App/src/FunctionalTestFactory.cpp index 942d1d3fa0a..4ce7b945104 100644 --- a/App/src/FunctionalTestFactory.cpp +++ b/App/src/FunctionalTestFactory.cpp @@ -83,7 +83,8 @@ void FunctionalTestFactory::execute(std::string name, ProgramOptions *p_options) test = createItem( name ); } catch (std::runtime_error& e) { std::cout << e.what() << std::endl; - std::cout << "TestFactory::execute() -> Warning. No test with name '" << name << "' is defined." << std::endl; + std::cout << "TestFactory::execute() -> Warning. No test with name '" + << name << "' is defined." << std::endl; return; } @@ -104,7 +105,8 @@ void FunctionalTestFactory::profile(std::string name, ProgramOptions *p_options) test = createItem( name ); } catch (std::runtime_error& e) { std::cout << e.what() << std::endl; - std::cout << "TestFactory::execute() -> Warning. No test with name '" << name << "' is defined." << std::endl; + std::cout << "TestFactory::execute() -> Warning. No test with name '" + << name << "' is defined." << std::endl; return; } @@ -158,15 +160,18 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) p_test_factory->registerItem( "diffuse", IFactoryCreateFunction<TestDiffuseReflection, IFunctionalTest>, - "functional test: diffuse scattering from multilayer with roughness (obsolete)"); + "functional test: diffuse scattering from multilayer with roughness " + "(obsolete)"); p_test_factory->registerItem( "isgisaxs01", IFactoryCreateFunction<TestIsGISAXS1, IFunctionalTest>, - "functional test: isgisaxs ex-1 (2 types of particles without inteference on top of substrate)"); + "functional test: isgisaxs ex-1 (2 types of particles without " + "interference on top of substrate)"); p_test_factory->registerItem( "isgisaxs02", IFactoryCreateFunction<TestIsGISAXS2, IFunctionalTest>, - "functional test: isgisaxs ex-2 (mean form factors for particles with shape size distribution)"); + "functional test: isgisaxs ex-2 (mean form factors for particles with " + "shape size distribution)"); p_test_factory->registerItem( "isgisaxs03", IFactoryCreateFunction<TestIsGISAXS3, IFunctionalTest>, @@ -178,19 +183,23 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) p_test_factory->registerItem( "isgisaxs05", IFactoryCreateFunction<TestIsGISAXS5, IFunctionalTest>, - "functional test: isgisaxs ex-5 (fit with paracrystal 1d structure factor)"); + "functional test: isgisaxs ex-5 (fit with paracrystal 1d structure " + "factor)"); p_test_factory->registerItem( "isgisaxs06", IFactoryCreateFunction<TestIsGISAXS6, IFunctionalTest>, - "functional test: isgisaxs ex-6 (cylinders with lattice interference function)"); + "functional test: isgisaxs ex-6 (cylinders with lattice interference " + "function)"); p_test_factory->registerItem( "isgisaxs07", IFactoryCreateFunction<TestIsGISAXS7, IFunctionalTest>, - "functional test: isgisaxs ex-7 (particle mixture from morphology file)"); + "functional test: isgisaxs ex-7 (particle mixture from morphology " + "file)"); p_test_factory->registerItem( "isgisaxs08", IFactoryCreateFunction<TestIsGISAXS8, IFunctionalTest>, - "functional test: isgisaxs ex-8 (paracrystal lattice structure factors)"); + "functional test: isgisaxs ex-8 (paracrystal lattice structure " + "factors)"); p_test_factory->registerItem( "isgisaxs09", IFactoryCreateFunction<TestIsGISAXS9, IFunctionalTest>, @@ -198,11 +207,13 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) p_test_factory->registerItem( "isgisaxs10", IFactoryCreateFunction<TestIsGISAXS10, IFunctionalTest>, - "functional test: isgisaxs ex-10 (cylinders with interference on top of substrate)"); + "functional test: isgisaxs ex-10 (cylinders with interference on top " + "of substrate)"); p_test_factory->registerItem( "isgisaxs11", IFactoryCreateFunction<TestIsGISAXS11, IFunctionalTest>, - "functional test: isgisaxs ex-11 (core shell parallelopiped islands on top of substrate)"); + "functional test: isgisaxs ex-11 (core shell parallelopiped islands " + "on top of substrate)"); p_test_factory->registerItem( "isgisaxs12", IFactoryCreateFunction<TestIsGISAXS12, IFunctionalTest>, @@ -214,11 +225,13 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) p_test_factory->registerItem( "isgisaxs14", IFactoryCreateFunction<TestIsGISAXS14, IFunctionalTest>, - "functional test: isgisaxs ex-14 (multilayered sphere on graded interface)"); + "functional test: isgisaxs ex-14 (multilayered sphere on graded " + "interface)"); p_test_factory->registerItem( "isgisaxs15", IFactoryCreateFunction<TestIsGISAXS15, IFunctionalTest>, - "functional test: isgisaxs ex-15 (size-spacing correlation approximation)"); + "functional test: isgisaxs ex-15 (size-spacing correlation " + "approximation)"); p_test_factory->registerItem( "convolution", IFactoryCreateFunction<TestConvolution, IFunctionalTest>, @@ -266,7 +279,8 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) p_test_factory->registerItem( "fitbench", IFactoryCreateFunction<TestFittingBenchmark, IFunctionalTest>, - "functional test: test of minimizers with hard-to-minimize test functions"); + "functional test: test of minimizers with hard-to-minimize test " + "functions"); p_test_factory->registerItem( "Fourier", IFactoryCreateFunction<TestFourier, IFunctionalTest>, @@ -274,7 +288,8 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory) p_test_factory->registerItem( "fumili", IFactoryCreateFunction<TestFumiliLMA, IFunctionalTest>, - "functional test: test of ROOT's LMA-based minimizers Fumili and GSLMultiFit"); + "functional test: test of ROOT's LMA-based minimizers Fumili and " + "GSLMultiFit"); p_test_factory->registerItem( "toyexp", IFactoryCreateFunction<TestToySimulation, IFunctionalTest>, diff --git a/App/src/TestIsGISAXS13.cpp b/App/src/TestIsGISAXS13.cpp index 75c38778eb6..b698a40ed4e 100644 --- a/App/src/TestIsGISAXS13.cpp +++ b/App/src/TestIsGISAXS13.cpp @@ -1,5 +1,5 @@ // ************************************************************************** // -// +// // BornAgain: simulate and fit scattering at grazing incidence // //! @file App/src/TestIsGISAXS13.cpp @@ -61,7 +61,8 @@ TestIsGISAXS13::TestIsGISAXS13() , mp_fitSuite(0) { - setOutputPath(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-13/"); + setOutputPath(Utils::FileSystem::GetHomePath()+ + "./Examples/IsGISAXS_examples/ex-13/"); } @@ -93,29 +94,44 @@ void TestIsGISAXS13::run_isgisaxs_fit() // m_fitSuite->setMinimizer( MinimizerFactory::createMinimizer("Scan") ); // observers - mp_fitSuite->attachObserver( FitSuiteObserverFactory::createPrintObserver(10) ); - mp_fitSuite->attachObserver( FitSuiteObserverFactory::createDrawObserver(50) ); + mp_fitSuite->attachObserver( FitSuiteObserverFactory:: + createPrintObserver(10) ); + mp_fitSuite->attachObserver( FitSuiteObserverFactory:: + createDrawObserver(50) ); // fit parameters - mp_fitSuite->addFitParameter("*Normalizer/scale", 1e5, 1e3, AttLimits::limited(1e4, 2e5)); - mp_fitSuite->addFitParameter("*Normalizer/shift", 10, 0.1, AttLimits::limited(0., 20.)); - mp_fitSuite->addFitParameter("*SampleBuilder/particle_radius", 4.0e+00*Units::nanometer, 0.04*Units::nanometer, AttLimits::limited(2.0, 8.0) ); - mp_fitSuite->addFitParameter("*SampleBuilder/dispersion_radius", 0.2, 0.002, AttLimits::limited(0.01, 1.0) ); - mp_fitSuite->addFitParameter("*SampleBuilder/height_aspect_ratio", 0.8, 0.08, AttLimits::limited(0.5, 1.5) ); - mp_fitSuite->addFitParameter("*SampleBuilder/interf_distance", 15*Units::nanometer, 0.015*Units::nanometer, AttLimits::limited(0.01, 50.0) ); - mp_fitSuite->addFitParameter("*SampleBuilder/interf_width", 3*Units::nanometer, 0.03*Units::nanometer, AttLimits::limited(0.01, 10.) ); + mp_fitSuite->addFitParameter("*Normalizer/scale", 1e5, 1e3, + AttLimits::limited(1e4, 2e5)); + mp_fitSuite->addFitParameter("*Normalizer/shift", 10, 0.1, + AttLimits::limited(0., 20.)); + mp_fitSuite->addFitParameter("*SampleBuilder/particle_radius", + 4.0e+00*Units::nanometer, 0.04*Units::nanometer, + AttLimits::limited(2.0, 8.0) ); + mp_fitSuite->addFitParameter("*SampleBuilder/dispersion_radius", + 0.2, 0.002, AttLimits::limited(0.01, 1.0) ); + mp_fitSuite->addFitParameter("*SampleBuilder/height_aspect_ratio", + 0.8, 0.08, AttLimits::limited(0.5, 1.5) ); + mp_fitSuite->addFitParameter("*SampleBuilder/interf_distance", + 15*Units::nanometer, 0.015*Units::nanometer, + AttLimits::limited(0.01, 50.0) ); + mp_fitSuite->addFitParameter("*SampleBuilder/interf_width", + 3*Units::nanometer, 0.03*Units::nanometer, + AttLimits::limited(0.01, 10.) ); // reading 1D data scans defined in isgisaxs example IsGISAXSData::DataSet_t isgi_scans; - IsGISAXSData::read_datfile(getOutputPath()+"isgi_simulated_annealing.dat", isgi_scans); + IsGISAXSData::read_datfile(getOutputPath()+"isgi_simulated_annealing.dat", + isgi_scans); // chi squared module ChiSquaredModule chiModule; chiModule.setChiSquaredFunction( SquaredFunctionWithSystematicError(0.08) ); chiModule.setOutputDataNormalizer( OutputDataNormalizer() ); //chiModule.setIntensityFunction( IntensityFunctionLog() ); - for(IsGISAXSData::DataSet_t::iterator it=isgi_scans.begin(); it!= isgi_scans.end(); ++it) { - mp_fitSuite->addSimulationAndRealData(*mp_simulation, *(*it), chiModule); + for(IsGISAXSData::DataSet_t::iterator it=isgi_scans.begin(); + it!= isgi_scans.end(); ++it) { + mp_fitSuite->addSimulationAndRealData(*mp_simulation, *(*it), + chiModule); } mp_fitSuite->runFit(); @@ -148,8 +164,10 @@ void TestIsGISAXS13::run_isgisaxs_fit() for(size_t i_set=0; i_set<mp_fitSuite->getFitObjects()->size(); ++i_set) { c2->cd((int)i_set+1); const FitObject *obj = mp_fitSuite->getFitObjects()->getObject(i_set); - TH1D *hreal = IsGISAXSTools::getOutputDataScanHist(*obj->getChiSquaredModule()->getRealData(),"BornAgain_real"); - TH1D *hsimul = IsGISAXSTools::getOutputDataScanHist(*obj->getChiSquaredModule()->getSimulationData(),"BornAgain_simul"); + TH1D *hreal = IsGISAXSTools::getOutputDataScanHist(*obj-> + getChiSquaredModule()->getRealData(),"BornAgain_real"); + TH1D *hsimul = IsGISAXSTools::getOutputDataScanHist(*obj-> + getChiSquaredModule()->getSimulationData(),"BornAgain_simul"); hreal->SetLineColor(kBlue); gPad->SetLogy(); hreal->DrawCopy(); @@ -167,12 +185,15 @@ void TestIsGISAXS13::run_isgisaxs_fit() for(size_t i_set=0; i_set<mp_fitSuite->getFitObjects()->size(); ++i_set) { c2->cd(3+1); const FitObject *obj = mp_fitSuite->getFitObjects()->getObject(i_set); - OutputData<double > *real = obj->getChiSquaredModule()->getRealData()->clone(); - OutputData<double > *simul = obj->getChiSquaredModule()->getSimulationData()->clone(); + OutputData<double > *real = obj->getChiSquaredModule()-> + getRealData()->clone(); + OutputData<double > *simul = obj->getChiSquaredModule()-> + getSimulationData()->clone(); c2->cd((int)(i_set+3)); *simul /= *real; - TH1D *hratio = IsGISAXSTools::getOutputDataScanHist(*simul,"BornAgain_real_simul_ratio"); + TH1D *hratio = IsGISAXSTools::getOutputDataScanHist(*simul, + "BornAgain_real_simul_ratio"); hratio->DrawCopy(); if(i_set==0) { leg2->AddEntry(hratio,"BornAgain simul/real","lp"); @@ -197,8 +218,11 @@ void TestIsGISAXS13::initializeSimulation() delete mp_simulation; mp_simulation = new Simulation(mp_options); mp_simulation->setSampleBuilder(mp_sample_builder); - mp_simulation->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); - mp_simulation->setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); + mp_simulation->setDetectorParameters( + 100, 0.0*Units::degree, 2.0*Units::degree, + 100, 0.0*Units::degree, 2.0*Units::degree, true); + mp_simulation->setBeamParameters(1.0*Units::angstrom, + -0.2*Units::degree, 0.0*Units::degree); } -- GitLab