diff --git a/App/src/FitSuiteObserverFactory.cpp b/App/src/FitSuiteObserverFactory.cpp index 7f389a594ce83081fdfef50fef15d60de3de3249..23f1b7ec42ea9d43da36ad198139c42b112ed0a9 100644 --- a/App/src/FitSuiteObserverFactory.cpp +++ b/App/src/FitSuiteObserverFactory.cpp @@ -18,7 +18,6 @@ #include "TreeEventStructure.h" #include "IsGISAXSTools.h" #include "FitSuiteParameters.h" -#include "ExperimentConstants.h" #include "TCanvas.h" #include "TPaveText.h" @@ -140,20 +139,20 @@ void FitSuiteObserverDraw::update(IObservable *subject) // drawing for(size_t i_hist=0; i_hist<data2draw.size(); ++i_hist) { const OutputData<double > *data = data2draw[i_hist]; - if( !data->getAxis(NDetector2d::ALPHA_AXIS_NAME) || !data->getAxis(NDetector2d::PHI_AXIS_NAME) ) throw LogicErrorException("FitSuiteObserverDraw::update() -> Error! Can't handle axis"); + if( !data->getAxis("alpha_f") || !data->getAxis("phi_f") ) throw LogicErrorException("FitSuiteObserverDraw::update() -> Error! Can't handle axis"); c1->cd((int)i_hist+1); gPad->SetLogz(); gPad->SetLeftMargin(0.12); gPad->SetRightMargin(0.12); - if( data->getAxis(NDetector2d::ALPHA_AXIS_NAME)->getSize() != 1 && data->getAxis(NDetector2d::PHI_AXIS_NAME)->getSize() != 1) + if( data->getAxis("alpha_f")->getSize() != 1 && data->getAxis("phi_f")->getSize() != 1) { TH2D *hist2 = IsGISAXSTools::getOutputDataTH2D( *data, hname[i_hist]); // if( i_hist == kReal || i_hist == kSimul ) hist2->SetMinimum(1); hist2->DrawCopy("COLZ"); delete hist2; - } else if(data->getAxis(NDetector2d::ALPHA_AXIS_NAME)->getSize() == 1 || data->getAxis(NDetector2d::PHI_AXIS_NAME)->getSize() == 1){ + } else if(data->getAxis("alpha_f")->getSize() == 1 || data->getAxis("phi_f")->getSize() == 1){ TH1D *hist1 = IsGISAXSTools::getOutputDataScanHist(*data, hname[i_hist]); // if( i_hist == kReal || i_hist == kSimul ) hist1->SetMinimum(1); hist1->DrawCopy(); diff --git a/App/src/IsGISAXSData.cpp b/App/src/IsGISAXSData.cpp index 82756d45e154ad376ee02e35cb7d71014777768b..05fa1e955d9ece56deae20758aee127de9d9b407 100644 --- a/App/src/IsGISAXSData.cpp +++ b/App/src/IsGISAXSData.cpp @@ -14,7 +14,6 @@ // ************************************************************************** // #include "IsGISAXSData.h" -#include "ExperimentConstants.h" #include <iostream> #include <fstream> @@ -155,8 +154,8 @@ OutputData<double> *IsGISAXSData::convert_isgi_scan(std::vector<IsgiData > &isgi "TestIsGISAXS12::convert_isgi_scan() -> " "Error! Scan can't have both angle phif,alphaf fixed"); - AxisDouble phi_axis(NDetector2d::PHI_AXIS_NAME); - AxisDouble alpha_axis(NDetector2d::ALPHA_AXIS_NAME); + AxisDouble phi_axis("phi_f"); + AxisDouble alpha_axis("alpha_f"); if( fixed_phif) { //m_isgi_fixed_phif = isgi_data.back().phif; phi_axis.push_back(isgi_data.back().phif); diff --git a/App/src/IsGISAXSTools.cpp b/App/src/IsGISAXSTools.cpp index e7153b9bc96777dd51262710502da5ef2aa5900d..5d3fa1d84b4592028e593854b6c56026aa4a54a0 100644 --- a/App/src/IsGISAXSTools.cpp +++ b/App/src/IsGISAXSTools.cpp @@ -17,7 +17,6 @@ #include "Units.h" #include "Exceptions.h" #include "MathFunctions.h" -#include "ExperimentConstants.h" #include "DrawHelper.h" #include "TCanvas.h" @@ -481,16 +480,16 @@ TLine *IsGISAXSTools::getOutputDataScanLine(const OutputData<double> &data) if(data.getNdimensions() != 2) throw LogicErrorException("IsGISAXSTools::getOutputDataScanLine() -> Error! Number of dimensions should be 2"); double x1(0), x2(0), y1(0), y2(0); - if( data.getAxis(NDetector2d::ALPHA_AXIS_NAME) && data.getAxis(NDetector2d::ALPHA_AXIS_NAME)->getSize() == 1) { + if( data.getAxis("alpha_f") && data.getAxis("alpha_f")->getSize() == 1) { // horizontal line - x1 = data.getAxis(NDetector2d::PHI_AXIS_NAME)->getMin(); - x2 = data.getAxis(NDetector2d::PHI_AXIS_NAME)->getMax(); - y1 = y2 = data.getAxis(NDetector2d::ALPHA_AXIS_NAME)->getMin(); - }else if( data.getAxis(NDetector2d::PHI_AXIS_NAME) && data.getAxis(NDetector2d::PHI_AXIS_NAME)->getSize() == 1 ) { + x1 = data.getAxis("phi_f")->getMin(); + x2 = data.getAxis("phi_f")->getMax(); + y1 = y2 = data.getAxis("alpha_f")->getMin(); + }else if( data.getAxis("phi_f") && data.getAxis("phi_f")->getSize() == 1 ) { // it's vertical line - x1 = x2 = data.getAxis(NDetector2d::PHI_AXIS_NAME)->getMin(); - y1 = data.getAxis(NDetector2d::ALPHA_AXIS_NAME)->getMin(); - y2 = data.getAxis(NDetector2d::ALPHA_AXIS_NAME)->getMax(); + x1 = x2 = data.getAxis("phi_f")->getMin(); + y1 = data.getAxis("alpha_f")->getMin(); + y2 = data.getAxis("alpha_f")->getMax(); } else { throw LogicErrorException("IsGISAXSTools::getOutputDataScanLine() -> Error! Can't handle these axes."); } @@ -512,7 +511,7 @@ TH1D *IsGISAXSTools::getOutputDataScanHist(const OutputData<double> &data, const if(data.getNdimensions() != 2) throw LogicErrorException("IsGISAXSTools::getOutputDataScanHist() -> Error! Number of dimensions should be 2"); // one of axis should have dimension 1 - if( (data.getAxis(NDetector2d::ALPHA_AXIS_NAME) && data.getAxis(NDetector2d::ALPHA_AXIS_NAME)->getSize() != 1) && (data.getAxis(NDetector2d::PHI_AXIS_NAME) && data.getAxis(NDetector2d::PHI_AXIS_NAME)->getSize() != 1)) + if( (data.getAxis("alpha_f") && data.getAxis("alpha_f")->getSize() != 1) && (data.getAxis("phi_f") && data.getAxis("phi_f")->getSize() != 1)) { throw LogicErrorException("IsGISAXSTools::getOutputDataScanHist() -> Info. Can't create 1D histogram from these axes"); //std::cout << "IsGISAXSTools::getOutputDataScanHist() -> Info. Can't create 1D histogram from these axes" << std::endl; @@ -523,12 +522,12 @@ TH1D *IsGISAXSTools::getOutputDataScanHist(const OutputData<double> &data, const TH1D *hist1(0); std::ostringstream ostr_title; - if( data.getAxis(NDetector2d::ALPHA_AXIS_NAME) && data.getAxis(NDetector2d::ALPHA_AXIS_NAME)->getSize() == 1) { + if( data.getAxis("alpha_f") && data.getAxis("alpha_f")->getSize() == 1) { hist1 = hist2->ProjectionX(); - ostr_title << hname << ", alpha_f=" << data.getAxis(NDetector2d::ALPHA_AXIS_NAME)->getMin(); - }else if( data.getAxis(NDetector2d::PHI_AXIS_NAME) && data.getAxis(NDetector2d::PHI_AXIS_NAME)->getSize() == 1 ) { + ostr_title << hname << ", alpha_f=" << data.getAxis("alpha_f")->getMin(); + }else if( data.getAxis("phi_f") && data.getAxis("phi_f")->getSize() == 1 ) { hist1 = hist2->ProjectionY(); - ostr_title << hname << ", phi_f=" << data.getAxis(NDetector2d::PHI_AXIS_NAME)->getMin(); + ostr_title << hname << ", phi_f=" << data.getAxis("phi_f")->getMin(); } else { throw LogicErrorException("IsGISAXSTools::getOutputDataScanHist() -> Error! Unexpected place"); } diff --git a/App/src/TestDiffuseReflection.cpp b/App/src/TestDiffuseReflection.cpp index 26b6392bde4f653a676eeaa1898b7e00d36f4720..8239c4a249f5c67d0320ec1b8fb1fdded7e9f47c 100644 --- a/App/src/TestDiffuseReflection.cpp +++ b/App/src/TestDiffuseReflection.cpp @@ -22,7 +22,6 @@ #include "Units.h" #include "MultiLayerRoughnessDWBASimulation.h" #include "DoubleToComplexInterpolatingFunction.h" -#include "ExperimentConstants.h" #include <iostream> #include <iomanip> @@ -95,14 +94,14 @@ void TestDiffuseReflection::execute() // offspecular reflectivity m_data_offspec = new OutputData<double >; m_data_offspec->addAxis(std::string("alpha_i"), m_npoints, m_alphaMin, m_alphaMax); - m_data_offspec->addAxis(NDetector2d::ALPHA_AXIS_NAME, m_npoints, m_alphaMin, m_alphaMax); + m_data_offspec->addAxis("alpha_f", m_npoints, m_alphaMin, m_alphaMax); OutputData<double>::iterator it = m_data_offspec->begin(); while (it != m_data_offspec->end()) { double alpha_i = m_data_offspec->getValueOfAxis("alpha_i", it.getIndex()); - double alpha_f = m_data_offspec->getValueOfAxis(NDetector2d::ALPHA_AXIS_NAME, it.getIndex()); + double alpha_f = m_data_offspec->getValueOfAxis("alpha_f", it.getIndex()); size_t index_alpha_i = m_data_offspec->getIndexOfAxis("alpha_i", it.getIndex()); - size_t index_alpha_f = m_data_offspec->getIndexOfAxis(NDetector2d::ALPHA_AXIS_NAME, it.getIndex()); + size_t index_alpha_f = m_data_offspec->getIndexOfAxis("alpha_f", it.getIndex()); ki.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); kf.setLambdaAlphaPhi(1.54*Units::angstrom, alpha_f, 0.0); calc.execute(*m_sample, ki, kf); @@ -130,11 +129,11 @@ void TestDiffuseReflection::execute() // h2.SetStats(0); // m_data_offspec = new OutputData<double >; // m_data_offspec->addAxis(std::string("alpha_i"), m_alphaMin, m_alphaMax, m_npoints); -// m_data_offspec->addAxis(std::string(NDetector2d::ALPHA_AXIS_NAME), m_alphaMin, m_alphaMax, m_npoints); +// m_data_offspec->addAxis(std::string("alpha_f"), m_alphaMin, m_alphaMax, m_npoints); // m_data_offspec->resetIndex(); // while (m_data_offspec->hasNext()) { // double alpha_i = m_data_offspec->getCurrentValueOfAxis<double>("alpha_i"); -// double alpha_f = m_data_offspec->getCurrentValueOfAxis<double>(NDetector2d::ALPHA_AXIS_NAME); +// double alpha_f = m_data_offspec->getCurrentValueOfAxis<double>("alpha_f"); // ki.setLambdaAlphaPhi(1.54*Units::angstrom, -alpha_i, 0.0); // kf.setLambdaAlphaPhi(1.54*Units::angstrom, alpha_f, 0.0); // double r = calc.execute0(*samples[0], ki, kf) - calc.execute0(*samples[0], ki, kf); @@ -191,9 +190,9 @@ void TestDiffuseReflection::draw() OutputData<double>::const_iterator it = m_data_offspec->begin(); while (it != m_data_offspec->end()) { double alpha_i = m_data_offspec->getValueOfAxis("alpha_i", it.getIndex()); - double alpha_f = m_data_offspec->getValueOfAxis(NDetector2d::ALPHA_AXIS_NAME, it.getIndex()); + double alpha_f = m_data_offspec->getValueOfAxis("alpha_f", it.getIndex()); size_t index_alpha_i = m_data_offspec->getIndexOfAxis("alpha_i", it.getIndex()); - size_t index_alpha_f = m_data_offspec->getIndexOfAxis(NDetector2d::ALPHA_AXIS_NAME, it.getIndex()); + size_t index_alpha_f = m_data_offspec->getIndexOfAxis("alpha_f", it.getIndex()); double r = *it++; hspect.Fill(r); if(index_alpha_i==5) { diff --git a/App/src/TestFittingModule3.cpp b/App/src/TestFittingModule3.cpp index 16cc8e134adaca039cc6afd12e78aa5365613888..3aca34208081bf85de1fc3a517fc114c0b08633c 100644 --- a/App/src/TestFittingModule3.cpp +++ b/App/src/TestFittingModule3.cpp @@ -17,7 +17,6 @@ #include "AttLimits.h" #include "DrawHelper.h" #include "Exceptions.h" -#include "ExperimentConstants.h" #include "FitSuite.h" #include "FitSuiteObserverFactory.h" #include "FormFactors.h" @@ -44,7 +43,6 @@ #include "TPaveText.h" - TestFittingModule3::TestFittingModule3() : m_simulation(0) , m_sample(0) @@ -52,7 +50,6 @@ TestFittingModule3::TestFittingModule3() , m_real_data(0) { m_fitSuite = new FitSuite(); - } @@ -105,7 +102,6 @@ void TestFittingModule3::initializeSimulation() m_simulation->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree,100 , 0.0*Units::degree, 2.0*Units::degree); m_simulation->setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); m_simulation->setBeamIntensity(1e10); - } @@ -154,8 +150,8 @@ void TestFittingModule3::initializeRealData() // setting up 1d scans by making slices on real data m_data_scans.clear(); - m_data_scans.push_back( OutputDataFunctions::selectRangeOnOneAxis(*m_real_data, NDetector2d::ALPHA_AXIS_NAME, 0.012, 0.012) ); - m_data_scans.push_back( OutputDataFunctions::selectRangeOnOneAxis(*m_real_data, NDetector2d::PHI_AXIS_NAME, 0.011, 0.011) ); + m_data_scans.push_back( OutputDataFunctions::selectRangeOnOneAxis(*m_real_data, "alpha_f", 0.012, 0.012) ); + m_data_scans.push_back( OutputDataFunctions::selectRangeOnOneAxis(*m_real_data, "phi_f", 0.011, 0.011) ); // drawing data and scans TCanvas *c1 = new TCanvas("c1","c1",1024, 768); diff --git a/App/src/TestFormFactor.cpp b/App/src/TestFormFactor.cpp index f4c5092f86866e27222fd3f420bc55f3a7243f4f..49ec12ccc6dba75b35208cd9c46f4ec3bcaaeaf8 100644 --- a/App/src/TestFormFactor.cpp +++ b/App/src/TestFormFactor.cpp @@ -15,7 +15,6 @@ #include "TestFormFactor.h" #include "Types.h" -#include "ExperimentConstants.h" #include "TCanvas.h" #include "TH2.h" @@ -80,8 +79,8 @@ void TestFormFactor::draw() double z_end = (*p_z_axis)[z_size-1]; TH2D *p_hist2D = new TH2D("p_hist2D", "Cylinder Formfactor", (int)y_size, y_start, y_end, (int)z_size, z_start, z_end); p_hist2D->UseCurrentStyle(); - p_hist2D->GetXaxis()->SetTitle(NDetector2d::PHI_AXIS_NAME.c_str()); - p_hist2D->GetYaxis()->SetTitle(NDetector2d::ALPHA_AXIS_NAME.c_str()); + p_hist2D->GetXaxis()->SetTitle("phi_f"); + p_hist2D->GetYaxis()->SetTitle("alpha_f"); OutputData<double>::const_iterator it = mp_intensity_output->begin(); while (it != mp_intensity_output->end()) diff --git a/App/src/TestIsGISAXS12.cpp b/App/src/TestIsGISAXS12.cpp index 08427d3baddf204844fa4cf723f5ace33de7325a..9996bc02cff8f15c53d59420b03e6b672792eb98 100644 --- a/App/src/TestIsGISAXS12.cpp +++ b/App/src/TestIsGISAXS12.cpp @@ -15,7 +15,6 @@ #include "TestIsGISAXS12.h" #include "DrawHelper.h" -#include "ExperimentConstants.h" #include "FitSuite.h" #include "FitSuiteObserverFactory.h" #include "FormFactorCylinder.h" diff --git a/App/src/TestIsGISAXS13.cpp b/App/src/TestIsGISAXS13.cpp index c711d78ab406d6580362c4e9e3fc08f479112c53..13a97ba93b77fc35cf85aa0bb782ced14de01f3b 100644 --- a/App/src/TestIsGISAXS13.cpp +++ b/App/src/TestIsGISAXS13.cpp @@ -15,7 +15,6 @@ #include "TestIsGISAXS13.h" #include "DrawHelper.h" -#include "ExperimentConstants.h" #include "FitSuite.h" #include "FitSuiteObserverFactory.h" #include "Simulation.h" diff --git a/App/src/TestIsGISAXS5.cpp b/App/src/TestIsGISAXS5.cpp index 8b87d0e2921febb1cfb3d6a5b4543a9d61b05f7c..bbc35db0038c6fac0f4d384700efd0d1a73b7d3e 100644 --- a/App/src/TestIsGISAXS5.cpp +++ b/App/src/TestIsGISAXS5.cpp @@ -15,7 +15,6 @@ #include "TestIsGISAXS5.h" #include "DrawHelper.h" -#include "ExperimentConstants.h" #include "FitSuite.h" #include "FitSuiteObserverFactory.h" #include "FormFactorCylinder.h" diff --git a/App/src/TestMiscellaneous.cpp b/App/src/TestMiscellaneous.cpp index 329622517742b97ddbd4d039aa6ed3f16f1181a6..4f10731b7dee23bc229460a42d18e7b7f89fa110 100644 --- a/App/src/TestMiscellaneous.cpp +++ b/App/src/TestMiscellaneous.cpp @@ -32,7 +32,6 @@ #include "OutputDataIOFactory.h" #include "Utils.h" #include "Types.h" -#include "ExperimentConstants.h" #include "MessageService.h" #include "TGraph.h" @@ -47,8 +46,6 @@ TestMiscellaneous::TestMiscellaneous() { } - - void TestMiscellaneous::execute() { test_LogSystem(); @@ -97,7 +94,6 @@ void TestMiscellaneous::test_LogSystem() } - /* ************************************************************************* */ // test of OutputData export to 2D array /* ************************************************************************* */ @@ -107,23 +103,22 @@ void TestMiscellaneous::test_OutputDataTo2DArray() int axis0_size = 2; int axis1_size = 4; OutputData<double> *p_output = new OutputData<double>; - p_output->addAxis(NDetector2d::PHI_AXIS_NAME, axis0_size, 0.0, double(axis0_size)); - p_output->addAxis(NDetector2d::ALPHA_AXIS_NAME, axis1_size, 0.0, double(axis1_size)); + p_output->addAxis("phi_f", axis0_size, 0.0, double(axis0_size)); + p_output->addAxis("alpha_f", axis1_size, 0.0, double(axis1_size)); p_output->setAllTo(0.0); OutputData<double>::iterator it = p_output->begin(); int nn=0; while (it != p_output->end()) { - size_t index0 = p_output->getIndexOfAxis(NDetector2d::PHI_AXIS_NAME, it.getIndex()); - size_t index1 = p_output->getIndexOfAxis(NDetector2d::ALPHA_AXIS_NAME, it.getIndex()); + size_t index0 = p_output->getIndexOfAxis("phi_f", it.getIndex()); + size_t index1 = p_output->getIndexOfAxis("alpha_f", it.getIndex()); std::cout << " index0:" << index0 << " index1:" << index1 << std::endl; *it = nn++; ++it; } } - /* ************************************************************************* */ // test of reading of OutputData from ASCII file /* ************************************************************************* */ @@ -137,8 +132,6 @@ void TestMiscellaneous::test_KVectorContainer() } } - - /* ************************************************************************* */ // test of reading of OutputData from ASCII file /* ************************************************************************* */ @@ -203,7 +196,6 @@ void TestMiscellaneous::test_FastSin() } - /* ************************************************************************* */ // opengl mesocrystal drawing /* ************************************************************************* */ @@ -213,8 +205,6 @@ void TestMiscellaneous::test_DrawMesocrystal() DrawHelper::DrawMesoCrystal(m_sample); } - - /* ************************************************************************* */ // form factor as a function of qx,qy,qz /* ************************************************************************* */ @@ -265,7 +255,6 @@ void TestMiscellaneous::test_FormFactor() vh2_yz[i]->GetYaxis()->SetTitle("z"); } - OutputData<double> *p_data = new OutputData<double>(); p_data->addAxis(std::string("qx"), nbins, qmin, qmax); p_data->addAxis(std::string("qy"), nbins, qmin, qmax); @@ -332,11 +321,8 @@ void TestMiscellaneous::test_FormFactor() int indx = i*int(nbins/ndiv); vh2_yz[indx]->Draw("surf"); } - - } - /* ************************************************************************* */ // test double to complex interpolating function /* ************************************************************************* */ @@ -345,11 +331,11 @@ void TestMiscellaneous::test_DoubleToComplexInterpolatingFunction() MultiLayer *sample = dynamic_cast<MultiLayer *>(SampleFactory::createSample("MultilayerOffspecTestcase1a")); OutputData<double > *data_alpha = new OutputData<double >; - data_alpha->addAxis(NDetector2d::ALPHA_AXIS_NAME, 200, 0.0*Units::degree, 2.0*Units::degree); + data_alpha->addAxis("alpha_f", 200, 0.0*Units::degree, 2.0*Units::degree); OpticalFresnel fresnelCalculator; - const IAxis *p_alpha_axis = data_alpha->getAxis(NDetector2d::ALPHA_AXIS_NAME); + const IAxis *p_alpha_axis = data_alpha->getAxis("alpha_f"); std::map<double, OpticalFresnel::MultiLayerCoeff_t> fresnel_coeff_map; for (size_t i=0; i<p_alpha_axis->getSize(); ++i) { double angle = (*p_alpha_axis)[i]; @@ -419,6 +405,5 @@ void TestMiscellaneous::test_DoubleToComplexInterpolatingFunction() c1->cd(3); gr3_diff->SetTitle("difference"); gr3_diff->Draw("apl"); - } diff --git a/App/src/TestMultiLayerRoughness.cpp b/App/src/TestMultiLayerRoughness.cpp index c39991f20d32cbde311b35ad2090d227ea1235b8..65bb42981b66b2358ce05eb497507f52001c4d30 100644 --- a/App/src/TestMultiLayerRoughness.cpp +++ b/App/src/TestMultiLayerRoughness.cpp @@ -19,7 +19,6 @@ #include "IsGISAXSTools.h" #include "SampleFactory.h" #include "OutputData.h" -#include "ExperimentConstants.h" #include "TCanvas.h" #include "TH2F.h" @@ -29,7 +28,6 @@ void TestMultiLayerRoughness::execute() { - ISample *sample = SampleFactory::createSample("MultilayerOffspecTestcase1a"); std::cout << *sample << std::endl; @@ -61,8 +59,8 @@ void TestMultiLayerRoughness::execute() const OutputData<double> *output = simulation.getOutputData(); OutputData<double>::const_iterator it_output = output->begin(); while (it_output != output->end()) { - double phi_f = output->getValueOfAxis(NDetector2d::PHI_AXIS_NAME, it_output.getIndex()); - double alpha_f = output->getValueOfAxis(NDetector2d::ALPHA_AXIS_NAME, it_output.getIndex()); + double phi_f = output->getValueOfAxis("phi_f", it_output.getIndex()); + double alpha_f = output->getValueOfAxis("alpha_f", it_output.getIndex()); double intensity = *it_output++; if(phi_f == 0) { h2->Fill(Units::rad2deg(alpha_i), Units::rad2deg(alpha_f), intensity); diff --git a/App/src/TestRootTree.cpp b/App/src/TestRootTree.cpp index 022d302b06b4688595ff078dfe3f2c5f9ba875e1..e27db833074411fcbddac1e7f734d8e7e39fc3a5 100644 --- a/App/src/TestRootTree.cpp +++ b/App/src/TestRootTree.cpp @@ -25,7 +25,6 @@ #include "InterferenceFunctionNone.h" #include "SampleFactory.h" #include "IsGISAXSTools.h" -#include "ExperimentConstants.h" #include "TFile.h" #include "TTree.h" @@ -54,7 +53,6 @@ void TestRootTree::execute() void TestRootTree::complex_write() { - std::string root_file_name = "testmeso.root"; std::string tree_name = "testmeso"; @@ -222,8 +220,8 @@ void TestRootTree::simple_write() tree->Branch("intens1",&intens1, "intens1/D"); tree->Branch("intens2",&intens2, "intens2/D"); tree->Branch("alpha_i",&alpha_i, "alpha_i/D"); - tree->Branch(NDetector2d::ALPHA_AXIS_NAME.c_str(),&alpha_f, "alpha_f/D"); - tree->Branch(NDetector2d::PHI_AXIS_NAME.c_str(),&phi_f, "phi_f/D"); + tree->Branch("alpha_f",&alpha_f, "alpha_f/D"); + tree->Branch("phi_f",&phi_f, "phi_f/D"); tree->Branch("nev",&nev, "nev/I"); //somevector = new std::vector<double>; //tree->Branch("somevector","vector<double >", &somevector); @@ -328,8 +326,8 @@ void TestRootTree::simple_read() tree->SetBranchAddress("intens1",&intens1); tree->SetBranchAddress("intens2",&intens2); tree->SetBranchAddress("alpha_i",&alpha_i); - tree->SetBranchAddress(NDetector2d::ALPHA_AXIS_NAME.c_str(),&alpha_f); - tree->SetBranchAddress(NDetector2d::PHI_AXIS_NAME.c_str(),&phi_f); + tree->SetBranchAddress("alpha_f",&alpha_f); + tree->SetBranchAddress("phi_f",&phi_f); tree->SetBranchAddress("nev",&nev); // loop over all records stored in the tree diff --git a/App/src/TestToySimulation.cpp b/App/src/TestToySimulation.cpp index cd5194ec7eb90f2ead84b9214c1c4c695521b4ac..c48fd1200acce33051907c231c6619393f085dcf 100644 --- a/App/src/TestToySimulation.cpp +++ b/App/src/TestToySimulation.cpp @@ -14,7 +14,6 @@ // ************************************************************************** // #include "Exceptions.h" -#include "ExperimentConstants.h" #include "FitSuite.h" #include "FitSuiteObserverFactory.h" #include "IsGISAXSTools.h" @@ -24,14 +23,18 @@ #include <iostream> +/* ************************************************************************* */ +// implement class ToySimulation +/* ************************************************************************* */ + void ToySimulation::runSimulation() { if( !m_func ) throw NullPointerException ("ToySimulation::runSimulation() -> " "Error! No function is defined."); - const std::string s_phi_f(NDetector2d::PHI_AXIS_NAME); - const std::string s_alpha_f(NDetector2d::ALPHA_AXIS_NAME); + const std::string s_phi_f("phi_f"); + const std::string s_alpha_f("alpha_f"); m_func->SetParameters(&pars[0]); m_intensity_map.setAllTo(0.0); @@ -57,10 +60,10 @@ void ToySimulation::init_parameters() } } - /* ************************************************************************* */ -// +// implement class TestToySimulation /* ************************************************************************* */ + TestToySimulation::TestToySimulation() : m_func_object(0) , m_func(0) @@ -114,22 +117,16 @@ void TestToySimulation::execute() chi_module.setChiSquaredFunction(SquaredFunctionWithGaussianError(m_sigma_noise) ); m_fitSuite->addSimulationAndRealData(*m_simulation, *m_real_data, chi_module); m_fitSuite->runFit(); - } - - -/* ************************************************************************* */ -// -/* ************************************************************************* */ void TestToySimulation::initializeSimulationAndRealData() { delete m_simulation; m_simulation = new ToySimulation(m_func); OutputData<double > tmp; - tmp.addAxis(NDetector2d::PHI_AXIS_NAME, 100, m_func->GetXmin(), m_func->GetXmax()); - tmp.addAxis(NDetector2d::ALPHA_AXIS_NAME, 100, m_func->GetYmin(), m_func->GetYmax()); + tmp.addAxis("phi_f", 100, m_func->GetXmin(), m_func->GetXmax()); + tmp.addAxis("alpha_f", 100, m_func->GetYmin(), m_func->GetYmax()); m_simulation->setDetectorParameters(tmp); // generating real data diff --git a/Core/Algorithms/src/Instrument.cpp b/Core/Algorithms/src/Instrument.cpp index e09d385d1f7419dacb1c2886431d1e7cf1810e4d..2ef9107b4d2ea8b4c91574844b5d7809d574fa02 100644 --- a/Core/Algorithms/src/Instrument.cpp +++ b/Core/Algorithms/src/Instrument.cpp @@ -41,16 +41,18 @@ void Instrument::matchDetectorParameters(const OutputData<double>& output_data) } } -void Instrument::setDetectorParameters(size_t n_phi, double phi_f_min, - double phi_f_max, size_t n_alpha, double alpha_f_min, - double alpha_f_max, bool isgisaxs_style) +void Instrument::setDetectorParameters( + size_t n_phi, double phi_f_min, double phi_f_max, + size_t n_alpha, double alpha_f_min, double alpha_f_max, + bool isgisaxs_style) { AxisParameters phi_params; phi_params.m_name = "phi_f"; phi_params.m_range = TSampledRange<double>(n_phi, phi_f_min, phi_f_max); AxisParameters alpha_params; alpha_params.m_name = "alpha_f"; - alpha_params.m_range = TSampledRange<double>(n_alpha, alpha_f_min, alpha_f_max); + alpha_params.m_range = + TSampledRange<double>(n_alpha, alpha_f_min, alpha_f_max); if (isgisaxs_style) { phi_params.m_sample_method = AxisParameters::E_ISGISAXS; alpha_params.m_sample_method = AxisParameters::E_ISGISAXS; @@ -71,11 +73,12 @@ void Instrument::setDetectorParameters(const DetectorParameters& params) m_detector.addAxis(params.m_alpha_params); } -std::string Instrument::addParametersToExternalPool(std::string path, - ParameterPool* external_pool, int copy_number) const +std::string Instrument::addParametersToExternalPool( + std::string path, + ParameterPool* external_pool, int copy_number) const { // add own parameters - std::string new_path = IParameterized::addParametersToExternalPool(path, external_pool, copy_number); + std::string new_path = IParameterized::addParametersToExternalPool(path, external_pool, copy_number); // add parameters of the beam m_beam.addParametersToExternalPool(new_path, external_pool, -1); @@ -99,9 +102,10 @@ void Instrument::normalize(OutputData<double> *p_intensity) const } void Instrument::setDetectorResolutionFunction( - IResolutionFunction2D* p_resolution_function) + IResolutionFunction2D* p_resolution_function) { - m_detector.setDetectorResolution( new ConvolutionDetectorResolution(p_resolution_function) ); + m_detector.setDetectorResolution( + new ConvolutionDetectorResolution(p_resolution_function) ); } void Instrument::applyDetectorResolution( diff --git a/Core/Algorithms/src/MultiLayerDWBASimulation.cpp b/Core/Algorithms/src/MultiLayerDWBASimulation.cpp index 7e7166e14ef0892031fd7b7c6fbd8f247adac098..c018042c77bee0e419733848cf49660992881cd2 100644 --- a/Core/Algorithms/src/MultiLayerDWBASimulation.cpp +++ b/Core/Algorithms/src/MultiLayerDWBASimulation.cpp @@ -22,7 +22,8 @@ #include "MessageService.h" MultiLayerDWBASimulation::MultiLayerDWBASimulation( - const MultiLayer* p_multi_layer) : mp_roughness_dwba_simulation(0) + const MultiLayer* p_multi_layer) + : mp_roughness_dwba_simulation(0) { mp_multi_layer = p_multi_layer->clone(); } @@ -30,7 +31,9 @@ MultiLayerDWBASimulation::MultiLayerDWBASimulation( MultiLayerDWBASimulation::~MultiLayerDWBASimulation() { delete mp_multi_layer; - for(std::map<size_t, LayerDWBASimulation*>::iterator it=m_layer_dwba_simulation_map.begin(); it!=m_layer_dwba_simulation_map.end(); ++it) + for(std::map<size_t, LayerDWBASimulation*>::iterator it = + m_layer_dwba_simulation_map.begin(); + it!=m_layer_dwba_simulation_map.end(); ++it) { delete (*it).second; } @@ -41,7 +44,8 @@ void MultiLayerDWBASimulation::init(const Simulation& simulation) { DWBASimulation::init(simulation); for (size_t i=0; i<mp_multi_layer->getNumberOfLayers(); ++i) { - LayerDWBASimulation *p_layer_dwba_sim = mp_multi_layer->getLayer(i)->createDWBASimulation(); + LayerDWBASimulation *p_layer_dwba_sim = + mp_multi_layer->getLayer(i)->createDWBASimulation(); if (p_layer_dwba_sim) { m_layer_dwba_simulation_map[i] = p_layer_dwba_sim; p_layer_dwba_sim->init(simulation); @@ -50,7 +54,8 @@ void MultiLayerDWBASimulation::init(const Simulation& simulation) // scattering from rough surfaces in DWBA for (size_t i=0; i<mp_multi_layer->getNumberOfInterfaces(); ++i) { if(mp_multi_layer->getLayerInterface(i)->getRoughness() ) { - mp_roughness_dwba_simulation = new MultiLayerRoughnessDWBASimulation(mp_multi_layer); + mp_roughness_dwba_simulation = + new MultiLayerRoughnessDWBASimulation(mp_multi_layer); mp_roughness_dwba_simulation->init(simulation); break; } @@ -60,8 +65,9 @@ void MultiLayerDWBASimulation::init(const Simulation& simulation) void MultiLayerDWBASimulation::setThreadInfo(const ThreadInfo &thread_info) { DWBASimulation::setThreadInfo(thread_info); - for (std::map<size_t, LayerDWBASimulation*>::iterator it = m_layer_dwba_simulation_map.begin(); - it != m_layer_dwba_simulation_map.end(); ++it) { + for (std::map<size_t, LayerDWBASimulation*>::iterator it = + m_layer_dwba_simulation_map.begin(); + it != m_layer_dwba_simulation_map.end(); ++it) { it->second->setThreadInfo(thread_info); } if (mp_roughness_dwba_simulation) { @@ -71,7 +77,8 @@ void MultiLayerDWBASimulation::setThreadInfo(const ThreadInfo &thread_info) void MultiLayerDWBASimulation::run() { - msglog(MSG::DEBUG) << "MultiLayerDWBASimulation::run() -> Running thread " << m_thread_info.i_thread; + msglog(MSG::DEBUG) << "MultiLayerDWBASimulation::run() -> Running thread " + << m_thread_info.i_thread; OpticalFresnel fresnelCalculator; kvector_t m_ki_real(m_ki.x().real(), m_ki.y().real(), m_ki.z().real()); @@ -80,15 +87,17 @@ void MultiLayerDWBASimulation::run() double lambda = 2.0*M_PI/m_ki_real.mag(); // collect all alpha angles and calculate Fresnel coefficients - typedef std::pair<double, OpticalFresnel::MultiLayerCoeff_t > doublefresnel_t; - std::vector<doublefresnel_t > doublefresnel_buffer; + typedef std::pair<double, OpticalFresnel::MultiLayerCoeff_t> + doublefresnel_t; + std::vector<doublefresnel_t> doublefresnel_buffer; std::set<double> alpha_set = getAlphaList(); doublefresnel_buffer.reserve(alpha_set.size()); double angle; kvector_t kvec; OpticalFresnel::MultiLayerCoeff_t coeffs; - for (std::set<double>::const_iterator it=alpha_set.begin(); it != alpha_set.end(); ++it) { + for (std::set<double>::const_iterator it = + alpha_set.begin(); it != alpha_set.end(); ++it) { angle = *it; kvec.setLambdaAlphaPhi(lambda, -angle, 0.0); fresnelCalculator.execute(*mp_multi_layer, kvec, coeffs); @@ -96,12 +105,14 @@ void MultiLayerDWBASimulation::run() } // run through layers and construct T,R functions - for(size_t i_layer=0; i_layer<mp_multi_layer->getNumberOfLayers(); ++i_layer) { - + for(size_t i_layer=0; + i_layer<mp_multi_layer->getNumberOfLayers(); ++i_layer) { DoubleToPairOfComplexMap RT_map; DoubleToComplexMap Kz_map; - for(std::vector<doublefresnel_t >::const_iterator it=doublefresnel_buffer.begin(); it!=doublefresnel_buffer.end(); ++it) { + for(std::vector<doublefresnel_t >::const_iterator it= + doublefresnel_buffer.begin(); + it!=doublefresnel_buffer.end(); ++it) { double angle = (*it).first; const OpticalFresnel::FresnelCoeff &coeff = (*it).second[i_layer]; RT_map[angle] = complexpair_t(coeff.R, coeff.T); @@ -109,18 +120,19 @@ void MultiLayerDWBASimulation::run() } // layer DWBA simulation - std::map<size_t, LayerDWBASimulation*>::const_iterator pos = m_layer_dwba_simulation_map.find(i_layer); + std::map<size_t, LayerDWBASimulation*>::const_iterator pos = + m_layer_dwba_simulation_map.find(i_layer); if(pos != m_layer_dwba_simulation_map.end() ) { LayerDWBASimulation *p_layer_dwba_sim = pos->second; p_layer_dwba_sim->setKzAndRTFunctions(Kz_map, RT_map); p_layer_dwba_sim->run(); - addDWBAIntensity( p_layer_dwba_sim->getDWBAIntensity() ); } // layer roughness DWBA if(mp_roughness_dwba_simulation) { - mp_roughness_dwba_simulation->setReflectionTransmissionFunction(i_layer, RT_map); + mp_roughness_dwba_simulation->setReflectionTransmissionFunction + (i_layer, RT_map); } } // i_layer diff --git a/Core/FormFactors/inc/FormFactorBox.h b/Core/FormFactors/inc/FormFactorBox.h index 4c010ba8b36c76cbe870d6e2dc9d6d59bd03dd68..755d77d02618f171c1adca4c5949b0bf7e355313 100644 --- a/Core/FormFactors/inc/FormFactorBox.h +++ b/Core/FormFactors/inc/FormFactorBox.h @@ -23,9 +23,9 @@ class FormFactorBox : public IFormFactorBorn { -public: + public: FormFactorBox( double radius, double width, double height); - ~FormFactorBox(); + ~FormFactorBox() {} virtual FormFactorBox *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } @@ -44,11 +44,10 @@ public: virtual double getHeight() const { return m_height; } -protected: - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool + protected: virtual void init_parameters(); -private: + private: double m_radius; double m_width; double m_height; diff --git a/Core/FormFactors/inc/FormFactorCone.h b/Core/FormFactors/inc/FormFactorCone.h index f1aa48b662177941b3251b911ff38f2f8c1fc504..1d3e5d4584ba3af5f56a3afb1dc413d3ab25cf1c 100644 --- a/Core/FormFactors/inc/FormFactorCone.h +++ b/Core/FormFactors/inc/FormFactorCone.h @@ -23,30 +23,27 @@ class FormFactorCone : public IFormFactorBorn { -public: + public: //! @brief Cone constructor //! @param height of Conee //! @param radius half of Cone's base //! @param angle in radians between base and facet FormFactorCone(double radius, double height, double alpha); - - ~FormFactorCone(); + ~FormFactorCone() {} virtual FormFactorCone* clone() const; virtual int getNumberOfStochasticParameters() const { return 3; } virtual double getHeight() const { return m_height; } -protected: + protected: virtual complex_t evaluate_for_q (const cvector_t &q) const; - - //! register some class members for later access via parameter pool virtual void init_parameters(); -private: + private: // double ConeIntegral(double Z, void* params) const; double evaluate_for_q_real() const; - complex_t evaluate_for_q_imag() const; + double evaluate_for_q_imag() const; double ConeIntegralReal(double Z, void* params) const; double ConeIntegralImaginary(double Z, void* params) const; diff --git a/Core/FormFactors/inc/FormFactorCylinder.h b/Core/FormFactors/inc/FormFactorCylinder.h index cb711979e715e7d5fbd5c7a18b3f275e852536ed..756e1ebf31167c3760ead4aeed31c81d4fc6d6eb 100644 --- a/Core/FormFactors/inc/FormFactorCylinder.h +++ b/Core/FormFactors/inc/FormFactorCylinder.h @@ -24,7 +24,7 @@ class FormFactorCylinder : public IFormFactorBorn { public: FormFactorCylinder(double height, double radius); - ~FormFactorCylinder(); + ~FormFactorCylinder() {} virtual FormFactorCylinder *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } diff --git a/Core/FormFactors/inc/FormFactorDWBAConstZ.h b/Core/FormFactors/inc/FormFactorDWBAConstZ.h index cb0a138bbe49f02a50956e5306c9523d158553fd..e4f7ca2a5977e0ca7e8c4df4d8388c2840ff7f12 100644 --- a/Core/FormFactors/inc/FormFactorDWBAConstZ.h +++ b/Core/FormFactors/inc/FormFactorDWBAConstZ.h @@ -22,23 +22,24 @@ class FormFactorDWBAConstZ: public FormFactorDWBA { -public: - FormFactorDWBAConstZ(IFormFactor* p_form_factor, double depth=0.0); - virtual ~FormFactorDWBAConstZ(); + public: + FormFactorDWBAConstZ(IFormFactor* p_form_factor, double depth=0.0); + virtual ~FormFactorDWBAConstZ() {} virtual FormFactorDWBAConstZ *clone() const; - virtual complex_t evaluate(const cvector_t &k_i, const Bin1DCVector &k_f_bin, - double alpha_i, double alpha_f) const; -protected: + virtual complex_t evaluate(const cvector_t &k_i, + const Bin1DCVector &k_f_bin, + double alpha_i, double alpha_f) const; + protected: double m_depth; -private: + private: inline complex_t getDepthPhase(const complex_t &q_z) const { - complex_t exponent = -complex_t(0.0,1.0)*q_z*m_depth; // Minus sign for depth (m_depth > 0) + complex_t exponent = -complex_t(0.0,1.0)*q_z*m_depth; + // Minus sign for depth (m_depth > 0) return std::exp(exponent); } - }; #endif /* FORMFACTORDWBACONSTZ_H_ */ diff --git a/Core/FormFactors/inc/FormFactorEllipsoid.h b/Core/FormFactors/inc/FormFactorEllipsoid.h index 9efc27287b30bd827617e38a083ff06dacc1110d..8777f92fbecd876b99223165d1870ec51669cb04 100644 --- a/Core/FormFactors/inc/FormFactorEllipsoid.h +++ b/Core/FormFactors/inc/FormFactorEllipsoid.h @@ -24,8 +24,9 @@ class FormFactorEllipsoid : public IFormFactorBorn { public: - FormFactorEllipsoid( double radius, double width, double height, double alpha); - ~FormFactorEllipsoid(); + FormFactorEllipsoid(double radius, double width, + double height, double alpha); + ~FormFactorEllipsoid() {} virtual FormFactorEllipsoid *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } diff --git a/Core/FormFactors/inc/FormFactorFullSphere.h b/Core/FormFactors/inc/FormFactorFullSphere.h index bc85a574b887d41267bbba2d82e0425dd1a26cd5..ab09531e01afbd5ca9ada6b1bb5929414d8399c8 100644 --- a/Core/FormFactors/inc/FormFactorFullSphere.h +++ b/Core/FormFactors/inc/FormFactorFullSphere.h @@ -25,7 +25,7 @@ class FormFactorFullSphere : public IFormFactorBorn { public: FormFactorFullSphere(double radius); - ~FormFactorFullSphere(); + ~FormFactorFullSphere() {} virtual FormFactorFullSphere *clone() const; virtual int getNumberOfStochasticParameters() const { return 1; } diff --git a/Core/FormFactors/inc/FormFactorFullSpheroid.h b/Core/FormFactors/inc/FormFactorFullSpheroid.h index 2a42481fa2700d28bacd0e1c3dd7ed06a1fe7555..11503f7e353045c2a0a98f8ce3a945802cb1ebf5 100644 --- a/Core/FormFactors/inc/FormFactorFullSpheroid.h +++ b/Core/FormFactors/inc/FormFactorFullSpheroid.h @@ -19,27 +19,25 @@ #include "IFormFactorBorn.h" #include "IStochasticParameter.h" -//! ? +//! Formfactor of a ? class FormFactorFullSpheroid : public IFormFactorBorn { -public: + public: FormFactorFullSpheroid(double radius, double height); double FullSpheroidIntegral(double Z, void* params) const; - ~FormFactorFullSpheroid(); + ~FormFactorFullSpheroid() {} virtual FormFactorFullSpheroid *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } virtual double getHeight() const { return m_height; } -protected: + protected: virtual complex_t evaluate_for_q(const cvector_t &q) const; - - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool virtual void init_parameters(); -private: + private: double evaluate_for_q_real() const; complex_t evaluate_for_q_imag() const; double FullSpheroidIntegralReal(double Z, void* params) const; @@ -48,7 +46,6 @@ private: double m_radius; double m_height; mutable cvector_t m_q; - }; #endif // FORMFACTORFULLSPHEROID_H diff --git a/Core/FormFactors/inc/FormFactorGauss.h b/Core/FormFactors/inc/FormFactorGauss.h index f88b4fda4eceba2fcfc668c62f7d521237d161ff..fbf18b7ba18c13138230815751e9722ecccbf350 100644 --- a/Core/FormFactors/inc/FormFactorGauss.h +++ b/Core/FormFactors/inc/FormFactorGauss.h @@ -26,7 +26,7 @@ class FormFactorGauss : public IFormFactorBorn public: FormFactorGauss(double volume); FormFactorGauss(double height, double width); - ~FormFactorGauss(); + ~FormFactorGauss() {} virtual FormFactorGauss *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } diff --git a/Core/FormFactors/inc/FormFactorHemiSpheroid.h b/Core/FormFactors/inc/FormFactorHemiSpheroid.h index c1c8a2c422ad33874493660ef63ec594212a9321..4d4129e235e7f0dc8b513fb6a064351b3754bcad 100644 --- a/Core/FormFactors/inc/FormFactorHemiSpheroid.h +++ b/Core/FormFactors/inc/FormFactorHemiSpheroid.h @@ -23,32 +23,31 @@ class FormFactorHemiSpheroid : public IFormFactorBorn { -public: + public: //! @brief Cone constructor //! @param height of Conee //! @param radius half of Cone's base //! @param angle in radians between base and facet - FormFactorHemiSpheroid(double radius, double width, double height); + FormFactorHemiSpheroid(double radius, double width, double height); double HemiSpheroidIntegral(double Z, void* params) const; - ~FormFactorHemiSpheroid(); + ~FormFactorHemiSpheroid() {} virtual FormFactorHemiSpheroid* clone() const; virtual int getNumberOfStochasticParameters() const { return 3; } virtual double getHeight() const { return m_height; } -protected: + protected: virtual complex_t evaluate_for_q (const cvector_t &q) const; -private: + private: double evaluate_for_q_real() const; - complex_t evaluate_for_q_imag() const; + double evaluate_for_q_imag() const; double HemiSpheroidIntegralReal(double Z, void* params) const; double HemiSpheroidIntegralImaginary(double Z, void* params) const; - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool virtual void init_parameters(); double m_radius; diff --git a/Core/FormFactors/inc/FormFactorLorentz.h b/Core/FormFactors/inc/FormFactorLorentz.h index d4ffc04f9b5d0a111f3921e0ef4d63a5e88d9f10..1aadf3d47bf8347ac335798f2130383766ef6c7f 100644 --- a/Core/FormFactors/inc/FormFactorLorentz.h +++ b/Core/FormFactors/inc/FormFactorLorentz.h @@ -26,7 +26,7 @@ class FormFactorLorentz : public IFormFactorBorn public: FormFactorLorentz(double volume); FormFactorLorentz(double height, double width); - ~FormFactorLorentz(); + ~FormFactorLorentz() {} virtual FormFactorLorentz *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } diff --git a/Core/FormFactors/inc/FormFactorParallelepiped.h b/Core/FormFactors/inc/FormFactorParallelepiped.h index 7fb23837333eaf67baffe1b530b3acb9c3a8c1a0..674b04053c66a94121234c61c12033761ec5dd4c 100644 --- a/Core/FormFactors/inc/FormFactorParallelepiped.h +++ b/Core/FormFactors/inc/FormFactorParallelepiped.h @@ -23,9 +23,9 @@ class FormFactorParallelepiped : public IFormFactorBorn { -public: + public: FormFactorParallelepiped(double height, double radius); - ~FormFactorParallelepiped(); + ~FormFactorParallelepiped() {} virtual FormFactorParallelepiped *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } @@ -33,19 +33,17 @@ public: //! return radius of parallelepiped double getRadius() const { return m_radius; } - virtual double getVolume() const { - return 4.0*m_height*m_radius*m_radius; - } + virtual double getVolume() const + { return 4.0*m_height*m_radius*m_radius; } virtual double getHeight() const { return m_height; } virtual complex_t evaluate_for_q(const cvector_t &q) const; -protected: - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool + protected: virtual void init_parameters(); -private: + private: double m_height; double m_radius; }; diff --git a/Core/FormFactors/inc/FormFactorPrism3.h b/Core/FormFactors/inc/FormFactorPrism3.h index f18b31b1eb4f0174bb4db80cac556ae3e81facc6..f32d7be8919bf14371314e04ad240e214227278e 100644 --- a/Core/FormFactors/inc/FormFactorPrism3.h +++ b/Core/FormFactors/inc/FormFactorPrism3.h @@ -23,9 +23,9 @@ class FormFactorPrism3 : public IFormFactorBorn { -public: + public: FormFactorPrism3(double height, double half_side); - ~FormFactorPrism3(); + ~FormFactorPrism3() {} virtual FormFactorPrism3 *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } @@ -34,11 +34,10 @@ public: virtual complex_t evaluate_for_q(const cvector_t &q) const; -protected: - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool + protected: virtual void init_parameters(); -private: + private: double m_height; double m_half_side; double m_root3; // Cached value of square root of 3 diff --git a/Core/FormFactors/inc/FormFactorPrism6.h b/Core/FormFactors/inc/FormFactorPrism6.h index e2c5003a9fd9d9e8140667be6435c1713a18d82e..a3aae653b629e59cdc3f0d40216790c82fb66933 100644 --- a/Core/FormFactors/inc/FormFactorPrism6.h +++ b/Core/FormFactors/inc/FormFactorPrism6.h @@ -21,9 +21,9 @@ class FormFactorPrism6 : public IFormFactorBorn { -public: + public: FormFactorPrism6(double height, double half_side); - ~FormFactorPrism6(); + ~FormFactorPrism6() {} virtual FormFactorPrism6 *clone() const; virtual int getNumberOfStochasticParameters() const { return 2; } @@ -32,11 +32,10 @@ public: virtual complex_t evaluate_for_q(const cvector_t &q) const; -protected: - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool + protected: virtual void init_parameters(); -private: + private: double m_height; double m_half_side; double m_root3; // Cached value of square root of 3 diff --git a/Core/FormFactors/inc/FormFactorPyramid.h b/Core/FormFactors/inc/FormFactorPyramid.h index d3301cab5d3d17297f050c8414f75cc503f91d8d..21e42f8d24e864fc383cd621ddf822f1e25acfed 100644 --- a/Core/FormFactors/inc/FormFactorPyramid.h +++ b/Core/FormFactors/inc/FormFactorPyramid.h @@ -23,14 +23,14 @@ class FormFactorPyramid : public IFormFactorBorn { -public: + public: //! @brief pyramid constructor //! @param height of pyramide //! @param half_side half of pyramid's base //! @param angle in radians between base and facet FormFactorPyramid(double height, double half_side, double alpha); - ~FormFactorPyramid(); + ~FormFactorPyramid() {} virtual FormFactorPyramid *clone() const; virtual int getNumberOfStochasticParameters() const { return 3; } @@ -39,11 +39,10 @@ public: virtual complex_t evaluate_for_q(const cvector_t &q) const; -protected: - //! register some class members for later access via parameter pool + protected: virtual void init_parameters(); -private: + private: double m_height; double m_half_side; double m_alpha; diff --git a/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h b/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h index d851443ea5cec867c75577694232ec944550c816..2dd81379fffd2cb9fc5a1fe0d308c3fed54df259 100644 --- a/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h +++ b/Core/FormFactors/inc/FormFactorSphereGaussianRadius.h @@ -3,7 +3,7 @@ // BornAgain: simulate and fit scattering at grazing incidence // //! @file FormFactors/inc/FormFactorSphereGaussianRadius.h -//! @brief Defines class FormFactorSphereGaussianRadius. +//! @brief Defines and implements (WHY ??) class FormFactorSphereGaussianRadius. //! //! @homepage http://apps.jcns.fz-juelich.de/BornAgain //! @license GNU General Public License v3 or higher (see COPYING) @@ -25,21 +25,22 @@ class FormFactorSphereGaussianRadius : public IFormFactorBorn { -public: + public: FormFactorSphereGaussianRadius(double mean, double sigma); virtual FormFactorSphereGaussianRadius *clone() const; virtual ~FormFactorSphereGaussianRadius(); virtual int getNumberOfStochasticParameters() const; virtual bool isDistributedFormFactor() const { return true; } - virtual void createDistributedFormFactors(std::vector<IFormFactor *> &form_factors, - std::vector<double> &probabilities, size_t nbr_samples) const; + virtual void createDistributedFormFactors( + std::vector<IFormFactor*>& form_factors, + std::vector<double> &probabilities, size_t nbr_samples) const; virtual double getHeight() const { return p_ff_sphere->getHeight(); } virtual complex_t evaluate_for_q(const cvector_t &q) const; -private: + private: double calculateMeanR3() const; double m_mean; //!< This is the mean radius @@ -63,7 +64,8 @@ inline FormFactorSphereGaussianRadius::FormFactorSphereGaussianRadius(double mea inline FormFactorSphereGaussianRadius* FormFactorSphereGaussianRadius::clone() const { - FormFactorSphereGaussianRadius *p_clone = new FormFactorSphereGaussianRadius(m_mean, m_sigma); + FormFactorSphereGaussianRadius *p_clone = + new FormFactorSphereGaussianRadius(m_mean, m_sigma); return p_clone; } diff --git a/Core/FormFactors/inc/IFormFactorBorn.h b/Core/FormFactors/inc/IFormFactorBorn.h index 7ccfefa6eb989060fa79f40efd5da261edbd8b68..9b5692e2708ddaedd96e8103660a0c92425eddd7 100644 --- a/Core/FormFactors/inc/IFormFactorBorn.h +++ b/Core/FormFactors/inc/IFormFactorBorn.h @@ -22,8 +22,8 @@ class IFormFactorBorn : public IFormFactor { -public: - IFormFactorBorn(); + public: + IFormFactorBorn() {} virtual ~IFormFactorBorn() {} virtual IFormFactorBorn *clone() const=0; @@ -38,14 +38,14 @@ public: //! override volume getter to avoid endless loop caused by big bin approximation virtual double getVolume() const; -protected: + protected: //! calculate radial part of scattering amplitude for large bins double bigRadialPart(const Bin1DCVector& q_bin) const; //! calculate z-part of scattering amplitude for large bins complex_t bigZPart(const Bin1DCVector& q_bin) const; -private: + private: //! determine if a large bin size approximation should be used bool useLargeBinApproximation(const Bin1DCVector &q_bin) const; diff --git a/Core/FormFactors/src/FormFactorBox.cpp b/Core/FormFactors/src/FormFactorBox.cpp index 65af88d439ba30a500c846e53447755b889d0957..831cfe80225cf1665ea3cb66e73ec99c6e1a7d34 100644 --- a/Core/FormFactors/src/FormFactorBox.cpp +++ b/Core/FormFactors/src/FormFactorBox.cpp @@ -23,10 +23,6 @@ FormFactorBox::FormFactorBox(double radius, double width, double height) { } -FormFactorBox::~FormFactorBox() -{ -} - FormFactorBox* FormFactorBox::clone() const { return new FormFactorBox(m_radius, m_width, m_height ); @@ -39,8 +35,10 @@ complex_t FormFactorBox::evaluate_for_q(const cvector_t& q) const complex_t qzHdiv2 = q.z()*m_height/2.0; complex_t phase_factor = std::exp(complex_t(0.0, 1.0)*qzHdiv2); - return getVolume() *phase_factor*MathFunctions::Sinc(qxR)*MathFunctions::Sinc(qyW) - *MathFunctions::Sinc(qzHdiv2); + return getVolume() *phase_factor* + MathFunctions::Sinc(qxR)* + MathFunctions::Sinc(qyW)* + MathFunctions::Sinc(qzHdiv2); } void FormFactorBox::init_parameters() @@ -49,5 +47,4 @@ void FormFactorBox::init_parameters() getParameterPool()->registerParameter("radius", &m_radius); getParameterPool()->registerParameter( "width", &m_width); getParameterPool()->registerParameter("height", &m_height); - } diff --git a/Core/FormFactors/src/FormFactorCone.cpp b/Core/FormFactors/src/FormFactorCone.cpp index 787dbdbd890e251e16535c7503eb8abd0083794b..1d28e2c9ea6df2ac00f46e43acfab4215f49e52a 100644 --- a/Core/FormFactors/src/FormFactorCone.cpp +++ b/Core/FormFactors/src/FormFactorCone.cpp @@ -31,10 +31,6 @@ FormFactorCone::FormFactorCone(double radius,double height,double alpha) init_parameters(); } -FormFactorCone::~FormFactorCone() -{ -} - void FormFactorCone::init_parameters() { getParameterPool()->clear(); @@ -54,10 +50,10 @@ FormFactorCone* FormFactorCone::clone() const double FormFactorCone::evaluate_for_q_real() const { double H = m_height; - MemberFunctionIntegrator<FormFactorCone>::mem_function p_mf = &FormFactorCone::ConeIntegralReal; + MemberFunctionIntegrator<FormFactorCone>::mem_function p_mf = + &FormFactorCone::ConeIntegralReal; MemberFunctionIntegrator<FormFactorCone> integrator(p_mf,this); - double RealRadial = integrator.integrate(0, H, (void *)0); - return RealRadial; + return integrator.integrate(0, H, (void *)0); } //! Integrand for real part of the integral. @@ -72,20 +68,22 @@ double FormFactorCone::ConeIntegralReal(double Z, void* params) const double tan_alpha = std::tan(m_alpha); double Rz = R-(Z/tan_alpha); double qrRz = std::abs(std::sqrt((qx)*(qx) + (qy)*(qy))*Rz); - double J1_qrRz_div_qrRz = std::abs(qrRz) > Numeric::double_epsilon ? MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : 0.5; + double J1_qrRz_div_qrRz = std::abs(qrRz) > Numeric::double_epsilon ? + MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : + 0.5; double exp_real = std::exp(complex_t(0.0, 1.0)*qz*Z).real(); return 2.0 * M_PI *Rz*Rz * J1_qrRz_div_qrRz * exp_real; } //! Imaginary part of the integral. -complex_t FormFactorCone::evaluate_for_q_imag() const +double FormFactorCone::evaluate_for_q_imag() const { double H = m_height; - MemberFunctionIntegrator<FormFactorCone>::mem_function p_mf = &FormFactorCone::ConeIntegralImaginary; + MemberFunctionIntegrator<FormFactorCone>::mem_function p_mf = + &FormFactorCone::ConeIntegralImaginary; MemberFunctionIntegrator<FormFactorCone> integrator(p_mf,this); - complex_t ImaginaryRadial = integrator.integrate(0, H, (void *)0); - return ImaginaryRadial; + return integrator.integrate(0, H, (void *)0); } //! Integrand for imaginary part of the integral. @@ -96,12 +94,13 @@ double FormFactorCone::ConeIntegralImaginary(double Z, void* params) const complex_t qz = m_q.z(); complex_t qx = m_q.x(); complex_t qy = m_q.y(); - double R = m_radius; double tan_alpha = std::tan(m_alpha); double Rz = R-(Z/tan_alpha); double qrRz = std::abs(std::sqrt((qx)*(qx) + (qy)*(qy))*Rz); - double J1_qrRz_div_qrRz = std::abs(qrRz) > Numeric::double_epsilon ? MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : 0.5; + double J1_qrRz_div_qrRz = std::abs(qrRz) > Numeric::double_epsilon ? + MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : + 0.5; double exp_imag = std::exp(complex_t(0.0, 1.0)*qz*Z).imag(); return 2.0 * M_PI *Rz*Rz * J1_qrRz_div_qrRz * exp_imag; } @@ -111,5 +110,5 @@ double FormFactorCone::ConeIntegralImaginary(double Z, void* params) const complex_t FormFactorCone::evaluate_for_q(const cvector_t &q) const { m_q = q; - return complex_t(0.0, 1.0)*evaluate_for_q_imag() + evaluate_for_q_real(); + return complex_t(evaluate_for_q_real(), evaluate_for_q_imag()); } diff --git a/Core/FormFactors/src/FormFactorCylinder.cpp b/Core/FormFactors/src/FormFactorCylinder.cpp index ce3c5479d9c9300c064d8edae19ba708b57c3e16..f735917c4a44b3e03006f97e1339f6b537edcb34 100644 --- a/Core/FormFactors/src/FormFactorCylinder.cpp +++ b/Core/FormFactors/src/FormFactorCylinder.cpp @@ -27,10 +27,6 @@ FormFactorCylinder::FormFactorCylinder(double height, double radius) init_parameters(); } -FormFactorCylinder::~FormFactorCylinder() -{ -} - //! register some class members for later access via parameter pool void FormFactorCylinder::init_parameters() @@ -51,10 +47,13 @@ complex_t FormFactorCylinder::evaluate_for_q(const cvector_t &q) const double H = m_height; complex_t qzH_half = q.z()*H/2.0; - complex_t z_part = H*MathFunctions::Sinc(qzH_half)*std::exp(complex_t(0.0, 1.0)*qzH_half); + complex_t z_part = H*MathFunctions::Sinc(qzH_half) * + std::exp(complex_t(0.0, 1.0)*qzH_half); complex_t qrR = q.magxy()*R; - complex_t J1_qrR_div_qrR = std::abs(qrR) > Numeric::double_epsilon ? MathFunctions::Bessel_J1(std::abs(qrR))/qrR : 0.5; + complex_t J1_qrR_div_qrR = std::abs(qrR) > Numeric::double_epsilon ? + MathFunctions::Bessel_J1(std::abs(qrR))/qrR : + 0.5; complex_t radial_part = 2*M_PI*R*R*J1_qrR_div_qrR; return radial_part*z_part; diff --git a/Core/FormFactors/src/FormFactorDWBAConstZ.cpp b/Core/FormFactors/src/FormFactorDWBAConstZ.cpp index b8e0d49f3ac814ef6632f01a8211191b3fa8f609..c9b59f0f3821796b243bd020235c2b0c19349d98 100644 --- a/Core/FormFactors/src/FormFactorDWBAConstZ.cpp +++ b/Core/FormFactors/src/FormFactorDWBAConstZ.cpp @@ -15,19 +15,17 @@ #include "FormFactorDWBAConstZ.h" -FormFactorDWBAConstZ::FormFactorDWBAConstZ(IFormFactor* p_form_factor, double depth) -: FormFactorDWBA(p_form_factor) -, m_depth(depth) +FormFactorDWBAConstZ::FormFactorDWBAConstZ( + IFormFactor* p_form_factor, double depth) + : FormFactorDWBA(p_form_factor) + , m_depth(depth) { setName("FormFactorDWBAConstZ"); } -FormFactorDWBAConstZ::~FormFactorDWBAConstZ() -{ -} - -complex_t FormFactorDWBAConstZ::evaluate(const cvector_t &k_i, const Bin1DCVector &k_f_bin, - double alpha_i, double alpha_f) const +complex_t FormFactorDWBAConstZ::evaluate( + const cvector_t &k_i, const Bin1DCVector &k_f_bin, + double alpha_i, double alpha_f) const { calculateTerms(k_i, k_f_bin, alpha_i, alpha_f); complex_t k_iz = k_i.z(); @@ -42,7 +40,8 @@ complex_t FormFactorDWBAConstZ::evaluate(const cvector_t &k_i, const Bin1DCVecto FormFactorDWBAConstZ* FormFactorDWBAConstZ::clone() const { - FormFactorDWBAConstZ *p_new = new FormFactorDWBAConstZ(mp_form_factor->clone(), m_depth); + FormFactorDWBAConstZ *p_new = + new FormFactorDWBAConstZ(mp_form_factor->clone(), m_depth); p_new->setReflectionTransmissionFunction(*mp_RT); return p_new; } diff --git a/Core/FormFactors/src/FormFactorEllipsoid.cpp b/Core/FormFactors/src/FormFactorEllipsoid.cpp index f4bcf76f1e8f7a065d38f1bf45a68d2d72ca97eb..39ccf210eb75a8d9141fadeb4d46f50dda6f0eab 100644 --- a/Core/FormFactors/src/FormFactorEllipsoid.cpp +++ b/Core/FormFactors/src/FormFactorEllipsoid.cpp @@ -16,7 +16,8 @@ #include "FormFactorEllipsoid.h" #include "MathFunctions.h" -FormFactorEllipsoid::FormFactorEllipsoid(double radius, double width , double height , double alpha) +FormFactorEllipsoid::FormFactorEllipsoid(double radius, double width, + double height, double alpha) { setName("FormFactorEllipsoid"); m_height = height; @@ -26,10 +27,6 @@ FormFactorEllipsoid::FormFactorEllipsoid(double radius, double width , double he init_parameters(); } -FormFactorEllipsoid::~FormFactorEllipsoid() -{ -} - FormFactorEllipsoid* FormFactorEllipsoid::clone() const { return new FormFactorEllipsoid(m_radius, m_width, m_height, m_alpha ); @@ -44,12 +41,14 @@ complex_t FormFactorEllipsoid::evaluate_for_q(const cvector_t& q) const complex_t phase_factor = std::exp(complex_t(0.0, 1.0)*qzHdiv2); complex_t gamma = std::sqrt((qxR)*(qxR) + (qyW)*(qyW)); - complex_t J1_gamma_div_gamma = std::abs(gamma) > Numeric::double_epsilon ? MathFunctions::Bessel_J1(std::abs(gamma))/gamma: 0.5; + complex_t J1_gamma_div_gamma = std::abs(gamma) > Numeric::double_epsilon ? + MathFunctions::Bessel_J1(std::abs(gamma))/gamma : + 0.5; - return M_PI * getVolume() * phase_factor * J1_gamma_div_gamma *MathFunctions::Sinc(qzHdiv2); + return M_PI * getVolume() * phase_factor * + J1_gamma_div_gamma * MathFunctions::Sinc(qzHdiv2); } - void FormFactorEllipsoid::init_parameters() { getParameterPool()->clear(); diff --git a/Core/FormFactors/src/FormFactorFullSphere.cpp b/Core/FormFactors/src/FormFactorFullSphere.cpp index a9f5c0bb3b9fa5fb359ed8e0284f887fc8820bc5..499aa1e4c7f30ae572892ddc8f2cbbdbf11e836e 100644 --- a/Core/FormFactors/src/FormFactorFullSphere.cpp +++ b/Core/FormFactors/src/FormFactorFullSphere.cpp @@ -27,12 +27,6 @@ FormFactorFullSphere::FormFactorFullSphere(double radius) init_parameters(); } -FormFactorFullSphere::~FormFactorFullSphere() -{ -} - -//! initialize pool parameters, i.e. register some of class members for later access via parameter pool - void FormFactorFullSphere::init_parameters() { getParameterPool()->clear(); diff --git a/Core/FormFactors/src/FormFactorFullSpheroid.cpp b/Core/FormFactors/src/FormFactorFullSpheroid.cpp index 86ba89f4095efc51da6a2436f90fbc56aa9e6213..89cb7f6d8341a8e28b603dd5685582801dc6d352 100644 --- a/Core/FormFactors/src/FormFactorFullSpheroid.cpp +++ b/Core/FormFactors/src/FormFactorFullSpheroid.cpp @@ -27,23 +27,17 @@ FormFactorFullSpheroid::FormFactorFullSpheroid(double radius, double height ) init_parameters(); } -FormFactorFullSpheroid::~FormFactorFullSpheroid() -{ -} - -//! initialize pool parameters, i.e. register some of class members for later access via parameter pool - void FormFactorFullSpheroid::init_parameters() { getParameterPool()->clear(); getParameterPool()->registerParameter("radius", &m_radius); getParameterPool()->registerParameter("height", &m_height); - } FormFactorFullSpheroid* FormFactorFullSpheroid::clone() const { - FormFactorFullSpheroid* ffFullSpheroid = new FormFactorFullSpheroid(m_radius, m_height); + FormFactorFullSpheroid* ffFullSpheroid = + new FormFactorFullSpheroid(m_radius, m_height); return ffFullSpheroid; } @@ -54,30 +48,35 @@ complex_t FormFactorFullSpheroid::evaluate_for_q(const cvector_t &q) const m_q = q; complex_t qz = m_q.z(); - complex_t qzH_half = qz*H/2.0; - complex_t iqzH_half = complex_t(0.0, 1.0)*qzH_half; - complex_t a_part = std::exp(iqzH_half); //a_part + complex_t qzH_half = qz*H/2.0; + complex_t iqzH_half = complex_t(0.0, 1.0)*qzH_half; + complex_t a_part = std::exp(iqzH_half); - - MemberFunctionIntegrator<FormFactorFullSpheroid>::mem_function p_mf = &FormFactorFullSpheroid::FullSpheroidIntegral; + MemberFunctionIntegrator<FormFactorFullSpheroid>::mem_function p_mf = + &FormFactorFullSpheroid::FullSpheroidIntegral; MemberFunctionIntegrator<FormFactorFullSpheroid> integrator(p_mf,this); double radial = integrator.integrate(0.0, H/2.0, (void *)0); - return a_part * radial; + return a_part * radial; } -double FormFactorFullSpheroid::FullSpheroidIntegral(double Z, void* params) const +//! Integrand. + +double FormFactorFullSpheroid::FullSpheroidIntegral( + double Z, void* params) const { (void)params; - double R = m_radius; - double H = m_height; - complex_t qz = m_q.z(); - complex_t qx = m_q.x(); - complex_t qy = m_q.y(); + double R = m_radius; + double H = m_height; + complex_t qz = m_q.z(); + complex_t qx = m_q.x(); + complex_t qy = m_q.y(); - double Rz = std::abs(R* std::sqrt(1-((4*Z*Z)/(H*H)))); - double qrRz = std::abs(std::sqrt((qx)*(qx) + (qy)*(qy))*Rz); + double Rz = std::abs(R* std::sqrt(1-((4*Z*Z)/(H*H)))); + double qrRz = std::abs(std::sqrt((qx)*(qx) + (qy)*(qy))*Rz); - double J1_qrRz_div_qrRz = std::abs(qrRz) > Numeric::double_epsilon ? MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : 0.5; - return 4.0* M_PI *Rz*Rz* J1_qrRz_div_qrRz * std::cos(qz.real()*Z); + double J1_qrRz_div_qrRz = std::abs(qrRz) > Numeric::double_epsilon ? + MathFunctions::Bessel_J1(std::abs(qrRz))/qrRz : + 0.5; + return 4.0* M_PI *Rz*Rz* J1_qrRz_div_qrRz * std::cos(qz.real()*Z); } diff --git a/Core/FormFactors/src/FormFactorGauss.cpp b/Core/FormFactors/src/FormFactorGauss.cpp index aff584324c1c5814961092b5435a2588e691cc0b..08f769fb8dad161359aa247f176043acf05217e1 100644 --- a/Core/FormFactors/src/FormFactorGauss.cpp +++ b/Core/FormFactors/src/FormFactorGauss.cpp @@ -36,10 +36,6 @@ FormFactorGauss::FormFactorGauss(double height, double width) init_parameters(); } -FormFactorGauss::~FormFactorGauss() -{ -} - //! initialize pool parameters, i.e. register some of class members for later access via parameter pool void FormFactorGauss::init_parameters() @@ -49,7 +45,6 @@ void FormFactorGauss::init_parameters() getParameterPool()->registerParameter("width", &m_width); } - FormFactorGauss* FormFactorGauss::clone() const { FormFactorGauss *p_clone = new FormFactorGauss(m_height, m_width); diff --git a/Core/FormFactors/src/FormFactorHemiSpheroid.cpp b/Core/FormFactors/src/FormFactorHemiSpheroid.cpp index cc87ba8d8936291eeb83cf755eeb466bb09daef2..e7543931e744226981c4c926176610d084d8a6de 100644 --- a/Core/FormFactors/src/FormFactorHemiSpheroid.cpp +++ b/Core/FormFactors/src/FormFactorHemiSpheroid.cpp @@ -22,7 +22,8 @@ #include <iostream> #include "MemberFunctionIntegrator.h" -FormFactorHemiSpheroid::FormFactorHemiSpheroid(double radius, double width, double height) +FormFactorHemiSpheroid::FormFactorHemiSpheroid( + double radius, double width, double height) { setName("FormFactorHemiSpheroid"); m_radius = radius; @@ -31,11 +32,7 @@ FormFactorHemiSpheroid::FormFactorHemiSpheroid(double radius, double width, doub init_parameters(); } -FormFactorHemiSpheroid::~FormFactorHemiSpheroid() -{ -} - -//! initialize pool parameters, i.e. register some of class members for later access via parameter pool. +//! Register some class members for later access via parameter pool. void FormFactorHemiSpheroid::init_parameters() { @@ -47,79 +44,86 @@ void FormFactorHemiSpheroid::init_parameters() FormFactorHemiSpheroid* FormFactorHemiSpheroid::clone() const { - FormFactorHemiSpheroid* ffSpheroid = new FormFactorHemiSpheroid(m_radius, m_width, m_height); + FormFactorHemiSpheroid* ffSpheroid = + new FormFactorHemiSpheroid(m_radius, m_width, m_height); return ffSpheroid; } -//******************Real Part of the Integral*********************************// +//! Real part of the integral. double FormFactorHemiSpheroid::evaluate_for_q_real() const - { double H = m_height; - MemberFunctionIntegrator<FormFactorHemiSpheroid>::mem_function p_mf = &FormFactorHemiSpheroid::HemiSpheroidIntegralReal; + MemberFunctionIntegrator<FormFactorHemiSpheroid>::mem_function p_mf = + &FormFactorHemiSpheroid::HemiSpheroidIntegralReal; MemberFunctionIntegrator<FormFactorHemiSpheroid> integrator(p_mf,this); - double RealRadial = integrator.integrate(0, H, (void *)0); - return RealRadial; + return integrator.integrate(0, H, (void *)0); } -double FormFactorHemiSpheroid::HemiSpheroidIntegralReal(double Z, void* params) const +//! Integrand for real part. + +double FormFactorHemiSpheroid::HemiSpheroidIntegralReal( + double Z, void* params) const { + (void)params; + double R = m_radius; + double W = m_height; + double H = m_height; + + complex_t qz = m_q.z(); + complex_t qx = m_q.x(); + complex_t qy = m_q.y(); + + double Wz = W * std::sqrt(1-((Z*Z)/(H*H))); + double Rz = R * std::sqrt(1-((Z*Z)/(H*H))); + double gamma = (std::sqrt ((( qx*Rz)*(qx*Rz)) + ((qy*Wz)*(qy*Wz)))).real(); + double J1_gamma_div_gamma = std::abs(gamma) > Numeric::double_epsilon ? + MathFunctions::Bessel_J1(std::abs(gamma))/gamma : + 0.5; + double exp_real = std::exp(complex_t(0.0, 1.0)*qz*Z).real(); + return Rz *Wz * J1_gamma_div_gamma * exp_real; +} + +//! Imaginary part of the integral. + +double FormFactorHemiSpheroid::evaluate_for_q_imag() const +{ + double H = m_height; + MemberFunctionIntegrator<FormFactorHemiSpheroid>::mem_function p_mf = + &FormFactorHemiSpheroid::HemiSpheroidIntegralImaginary; + MemberFunctionIntegrator<FormFactorHemiSpheroid> integrator(p_mf,this); + return integrator.integrate(0, H, (void *)0); +} + +//! Integrand for imaginary part. +double FormFactorHemiSpheroid::HemiSpheroidIntegralImaginary( + double Z, void* params) const +{ (void)params; double R = m_radius; double W = m_height; double H = m_height; - - complex_t qz = m_q.z(); complex_t qx = m_q.x(); complex_t qy = m_q.y(); + complex_t qz = m_q.z(); double Wz = W * std::sqrt(1-((Z*Z)/(H*H))); double Rz = R * std::sqrt(1-((Z*Z)/(H*H))); double gamma = (std::sqrt ((( qx*Rz)*(qx*Rz)) + ((qy*Wz)*(qy*Wz)))).real(); - double J1_gamma_div_gamma = std::abs(gamma) > Numeric::double_epsilon ? MathFunctions::Bessel_J1(std::abs(gamma))/gamma: 0.5; - double exp_real = std::exp(complex_t(0.0, 1.0)*qz*Z).real(); - return Rz *Wz * J1_gamma_div_gamma * exp_real; - -} - - -//*********************************Imaginary Part***************************// -complex_t FormFactorHemiSpheroid::evaluate_for_q_imag() const -{ - double H = m_height; - MemberFunctionIntegrator<FormFactorHemiSpheroid>::mem_function p_mf = &FormFactorHemiSpheroid::HemiSpheroidIntegralImaginary; - MemberFunctionIntegrator<FormFactorHemiSpheroid> integrator(p_mf,this); - double ImaginaryRadial = integrator.integrate(0, H, (void *)0); - return ImaginaryRadial; -} - -double FormFactorHemiSpheroid::HemiSpheroidIntegralImaginary(double Z, void* params) const -{ - (void)params; - double R = m_radius; - double W = m_height; - double H = m_height; - - - complex_t qx = m_q.x(); - complex_t qy = m_q.y(); - complex_t qz = m_q.z(); - - double Wz = W * std::sqrt(1-((Z*Z)/(H*H))); - double Rz = R * std::sqrt(1-((Z*Z)/(H*H))); - double gamma = (std::sqrt ((( qx*Rz)*(qx*Rz)) + ((qy*Wz)*(qy*Wz)))).real(); - double J1_gamma_div_gamma = std::abs(gamma) > Numeric::double_epsilon ? MathFunctions::Bessel_J1(std::abs(gamma))/gamma: 0.5; - double exp_imag = std::exp(complex_t(0.0,-1.0)*qz*Z).imag(); - return Rz *Wz * J1_gamma_div_gamma * exp_imag; + double J1_gamma_div_gamma = std::abs(gamma) > Numeric::double_epsilon ? + MathFunctions::Bessel_J1(std::abs(gamma))/gamma : + 0.5; + double exp_imag = std::exp(complex_t(0.0,-1.0)*qz*Z).imag(); + return Rz *Wz * J1_gamma_div_gamma * exp_imag; } +//! Complex formfactor (sum of the two integrals). -//***************************Sum of Two Integrals*****************************// complex_t FormFactorHemiSpheroid::evaluate_for_q(const cvector_t &q) const { m_q = q; - return 2.0* M_PI* complex_t(0.0, 1.0)*evaluate_for_q_imag() + evaluate_for_q_real(); + return 2*M_PI*complex_t(0.0, 1.0)*evaluate_for_q_imag() + + evaluate_for_q_real(); } diff --git a/Core/FormFactors/src/FormFactorLorentz.cpp b/Core/FormFactors/src/FormFactorLorentz.cpp index 1f0d89b126404c478858aa342545286d2a1d56ca..b13d0d399a5a55849321749bac48d514d49b1aa6 100644 --- a/Core/FormFactors/src/FormFactorLorentz.cpp +++ b/Core/FormFactors/src/FormFactorLorentz.cpp @@ -36,12 +36,6 @@ FormFactorLorentz::FormFactorLorentz(double height, double width) init_parameters(); } -FormFactorLorentz::~FormFactorLorentz() -{ -} - -//! initialize pool parameters, i.e. register some of class members for later access via parameter pool. - void FormFactorLorentz::init_parameters() { getParameterPool()->clear(); diff --git a/Core/FormFactors/src/FormFactorParallelepiped.cpp b/Core/FormFactors/src/FormFactorParallelepiped.cpp index a94614d9bffce895016fca49ddfa3bfd82510ed4..c7eddc82e672185e17ab857c9d5a341c7d1dd171 100644 --- a/Core/FormFactors/src/FormFactorParallelepiped.cpp +++ b/Core/FormFactors/src/FormFactorParallelepiped.cpp @@ -22,13 +22,10 @@ FormFactorParallelepiped::FormFactorParallelepiped(double height, double radius) { } -FormFactorParallelepiped::~FormFactorParallelepiped() -{ -} - FormFactorParallelepiped* FormFactorParallelepiped::clone() const { - FormFactorParallelepiped *p_clone = new FormFactorParallelepiped(m_height, m_radius); + FormFactorParallelepiped *p_clone = + new FormFactorParallelepiped(m_height, m_radius); return p_clone; } @@ -39,8 +36,10 @@ complex_t FormFactorParallelepiped::evaluate_for_q(const cvector_t& q) const complex_t qzHdiv2 = q.z()*m_height/2.0; complex_t phase_factor = std::exp(complex_t(0.0, 1.0)*qzHdiv2); - return getVolume()*phase_factor*MathFunctions::Sinc(qxR)*MathFunctions::Sinc(qyR) - *MathFunctions::Sinc(qzHdiv2); + return getVolume()*phase_factor* + MathFunctions::Sinc(qxR)* + MathFunctions::Sinc(qyR)* + MathFunctions::Sinc(qzHdiv2); } void FormFactorParallelepiped::init_parameters() diff --git a/Core/FormFactors/src/FormFactorPrism3.cpp b/Core/FormFactors/src/FormFactorPrism3.cpp index 7f3e65babda19ce8ad82d086321dc2b0bdde1e57..e62f53be75a58cabd2c070157a5ab5570073bcf1 100644 --- a/Core/FormFactors/src/FormFactorPrism3.cpp +++ b/Core/FormFactors/src/FormFactorPrism3.cpp @@ -27,12 +27,6 @@ FormFactorPrism3::FormFactorPrism3(double height, double half_side) init_parameters(); } -FormFactorPrism3::~FormFactorPrism3() -{ -} - -//! initialize pool parameters, i.e. register some of class members for later access via parameter pool. - void FormFactorPrism3::init_parameters() { getParameterPool()->clear(); @@ -53,7 +47,8 @@ complex_t FormFactorPrism3::evaluate_for_q(const cvector_t &q) const double H = m_height; complex_t qzH_half = qz*H/2.0; - complex_t z_part = H*MathFunctions::Sinc(qzH_half)*std::exp(complex_t(0.0, 1.0)*qzH_half); + complex_t z_part = H*MathFunctions::Sinc(qzH_half)* + std::exp(complex_t(0.0, 1.0)*qzH_half); complex_t xy_part = complex_t(0.0, 0.0); if (std::abs(q.x())==0.0 && std::abs(q.y())==0.0) { @@ -61,16 +56,19 @@ complex_t FormFactorPrism3::evaluate_for_q(const cvector_t &q) const } else { complex_t r3qyR = m_root3*q.y()*R; - complex_t expminiqyRdivr3 = std::exp(-complex_t(0.0, 1.0)*q.y()*R/m_root3); + complex_t expminiqyRdivr3 = + std::exp(-complex_t(0.0, 1.0)*q.y()*R/m_root3); if (std::abs(q.x()*q.x()-3.0*q.y()*q.y())==0.0) { xy_part = complex_t(0.0, 1.0)*m_root3*expminiqyRdivr3* - (std::sin(r3qyR)-r3qyR*std::exp(complex_t(0.0, 1.0)*r3qyR))/q.x()/q.x(); - } - else { + (std::sin(r3qyR)-r3qyR*std::exp(complex_t(0.0, 1.0)*r3qyR))/ + q.x()/q.x(); + } else { complex_t qxR = q.x()*R; - xy_part = std::exp(complex_t(0.0, 1.0)*r3qyR)-std::cos(qxR)-complex_t(0.0, 1.0)*r3qyR* - MathFunctions::Sinc(qxR); - xy_part *= 2.0*m_root3*expminiqyRdivr3/(q.x()*q.x()-3.0*q.y()*q.y()); + xy_part = std::exp(complex_t(0.0, 1.0)*r3qyR) - + std::cos(qxR)-complex_t(0.0, 1.0)*r3qyR* + MathFunctions::Sinc(qxR); + xy_part *= 2.0*m_root3*expminiqyRdivr3/ + (q.x()*q.x()-3.0*q.y()*q.y()); } } diff --git a/Core/FormFactors/src/FormFactorPrism6.cpp b/Core/FormFactors/src/FormFactorPrism6.cpp index 8e2f8a717d9ba31480c419620e414080eba3ef32..3353e2ddace5de0f9a4798dbecdc8f846ef6629c 100644 --- a/Core/FormFactors/src/FormFactorPrism6.cpp +++ b/Core/FormFactors/src/FormFactorPrism6.cpp @@ -27,12 +27,6 @@ FormFactorPrism6::FormFactorPrism6(double height, double half_side) init_parameters(); } -FormFactorPrism6::~FormFactorPrism6() -{ -} - -//! initialize pool parameters, i.e. register some of class members for later access via parameter pool - void FormFactorPrism6::init_parameters() { getParameterPool()->clear(); @@ -40,7 +34,6 @@ void FormFactorPrism6::init_parameters() getParameterPool()->registerParameter("half_side", &m_half_side); } - FormFactorPrism6* FormFactorPrism6::clone() const { return new FormFactorPrism6(m_height, m_half_side); @@ -53,21 +46,28 @@ complex_t FormFactorPrism6::evaluate_for_q(const cvector_t &q) const double H = m_height; complex_t qzH_half = qz*H/2.0; - complex_t z_part = H*MathFunctions::Sinc(qzH_half)*std::exp(complex_t(0.0, 1.0)*qzH_half); + complex_t z_part = H*MathFunctions::Sinc(qzH_half)* + std::exp(complex_t(0.0, 1.0)*qzH_half); complex_t xy_part = complex_t(0.0, 0.0); if (std::abs(q.x())==0.0 && std::abs(q.y())==0.0) { xy_part = 2*m_root3*R*R; - } - else { + } else { complex_t qxRdivr3 = (q.x()*R)/m_root3; if (std::abs(3.0*q.y()*q.y()-q.x()*q.x())==0.0) { - xy_part = m_root3 * (q.y()*R*q.y()*R* MathFunctions::Sinc(qxRdivr3) * MathFunctions::Sinc(q.y()*R) - + std::cos(qxRdivr3) - std::cos(q.y()*R) * std::cos(qxRdivr3)); + xy_part = m_root3 * (q.y()*R*q.y()*R* + MathFunctions::Sinc(qxRdivr3) * + MathFunctions::Sinc(q.y()*R) + + std::cos(qxRdivr3) - + std::cos(q.y()*R) * std::cos(qxRdivr3)); } else { - xy_part = (4.0*m_root3*(q.y()*R*q.y()*R* MathFunctions::Sinc(qxRdivr3) * MathFunctions::Sinc(q.y()*R) - + std::cos(qxRdivr3) - std::cos(q.y()*R) * std::cos(qxRdivr3)))/(3.0*q.y()*q.y()-q.x()*q.x()); + xy_part = (4.0*m_root3*(q.y()*R*q.y()*R* + MathFunctions::Sinc(qxRdivr3) * + MathFunctions::Sinc(q.y()*R) + + std::cos(qxRdivr3) - + std::cos(q.y()*R) * std::cos(qxRdivr3)))/ + (3.0*q.y()*q.y()-q.x()*q.x()); } } diff --git a/Core/FormFactors/src/FormFactorPyramid.cpp b/Core/FormFactors/src/FormFactorPyramid.cpp index 8f397059f1a6c28349f9d86e711afe5cedd82932..2e8036d88125e4b27a25f7f64c17a85e458ad262 100644 --- a/Core/FormFactors/src/FormFactorPyramid.cpp +++ b/Core/FormFactors/src/FormFactorPyramid.cpp @@ -17,7 +17,8 @@ #include "StochasticDiracDelta.h" #include "MathFunctions.h" -FormFactorPyramid::FormFactorPyramid(double height, double half_side, double alpha) +FormFactorPyramid::FormFactorPyramid( + double height, double half_side, double alpha) { setName("FormFactorPyramid"); m_height = height; @@ -26,12 +27,6 @@ FormFactorPyramid::FormFactorPyramid(double height, double half_side, double alp init_parameters(); } -FormFactorPyramid::~FormFactorPyramid() -{ -} - -//! initialize pool parameters, i.e. register some of class members for later access via parameter pool - void FormFactorPyramid::init_parameters() { getParameterPool()->clear(); @@ -42,7 +37,8 @@ void FormFactorPyramid::init_parameters() FormFactorPyramid* FormFactorPyramid::clone() const { - FormFactorPyramid *p_clone = new FormFactorPyramid(m_height, m_half_side, m_alpha); + FormFactorPyramid *p_clone = + new FormFactorPyramid(m_height, m_half_side, m_alpha); return p_clone; } diff --git a/Core/FormFactors/src/FormFactorSphere.cpp b/Core/FormFactors/src/FormFactorSphere.cpp index ac29841e714e5b97e8bcdbbf46f14463825cbe91..86d1b824015e3a04cc0087b12cfed187f093a0b0 100644 --- a/Core/FormFactors/src/FormFactorSphere.cpp +++ b/Core/FormFactors/src/FormFactorSphere.cpp @@ -40,8 +40,6 @@ FormFactorSphere::~FormFactorSphere() delete m_integrator; } -//! register some class members for later access via parameter pool - void FormFactorSphere::init_parameters() { getParameterPool()->clear(); @@ -51,7 +49,7 @@ void FormFactorSphere::init_parameters() FormFactorSphere* FormFactorSphere::clone() const { - return new FormFactorSphere(m_radius, m_height); + return new FormFactorSphere(m_radius, m_height); } //! Integrand for complex form factor. @@ -61,7 +59,8 @@ complex_t FormFactorSphere::Integrand(double Z, void* params) const (void)params; double Rz = std::sqrt( std::abs(m_radius*m_radius-Z*Z) ); complex_t q_p = m_q.magxy(); // sqrt(x*x + y*y) - return Rz*Rz*MathFunctions::Bessel_C1(std::abs(q_p*Rz)) * std::exp(complex_t(0.0, 1.0)*m_q.z()*Z); + return Rz*Rz*MathFunctions::Bessel_C1(std::abs(q_p*Rz)) * + std::exp(complex_t(0.0, 1.0)*m_q.z()*Z); } complex_t FormFactorSphere::evaluate_for_q(const cvector_t &q) const diff --git a/Core/FormFactors/src/IFormFactorBorn.cpp b/Core/FormFactors/src/IFormFactorBorn.cpp index 01ff5d81fc3d7a5021e736064765627bf07bcc72..317ec4d83253398991e8d8c6dff060348fb94d99 100644 --- a/Core/FormFactors/src/IFormFactorBorn.cpp +++ b/Core/FormFactors/src/IFormFactorBorn.cpp @@ -16,10 +16,6 @@ #include "IFormFactorBorn.h" #include "MathFunctions.h" -IFormFactorBorn::IFormFactorBorn() -{ -} - double IFormFactorBorn::bigRadialPart(const Bin1DCVector& q_bin) const { // modulus of the radial part diff --git a/Core/Geometry/inc/Transform3D.h b/Core/Geometry/inc/Transform3D.h index 620a72239f6c0e454f58c9430b801d268acdcb06..ac6bf4028c762ada142319a0180f99cb38867cfb 100644 --- a/Core/Geometry/inc/Transform3D.h +++ b/Core/Geometry/inc/Transform3D.h @@ -137,7 +137,7 @@ class Transform3D { yx_(m.yx_), yy_(m.yy_), yz_(m.yz_), zx_(m.zx_), zy_(m.zy_), zz_(m.zz_) {} - //! Destructor. + //! Destructor. //! Virtual for now as some persistency mechanism needs that, //! in future releases this might go away again. virtual ~Transform3D() {} @@ -216,7 +216,7 @@ class Transform3D { //! @author <Evgueni.Tcherniaev@cern.ch> 1996-2003 //! class Rotate3D : public Transform3D { -public: + public: //! Default constructor: sets the Identity transformation. Rotate3D() : Transform3D() {} @@ -242,7 +242,7 @@ public: //! @author <Evgueni.Tcherniaev@cern.ch> //! class RotateX3D : public Rotate3D { -public: + public: //! Default constructor: sets the Identity transformation. RotateX3D() : Rotate3D() {} @@ -260,7 +260,7 @@ public: //! @author <Evgueni.Tcherniaev@cern.ch> //! class RotateY3D : public Rotate3D { -public: + public: //! Default constructor: sets the Identity transformation. RotateY3D() : Rotate3D() {} @@ -278,7 +278,7 @@ public: //! @author <Evgueni.Tcherniaev@cern.ch> //! class RotateZ3D : public Rotate3D { -public: + public: //! Default constructor: sets the Identity transformation. RotateZ3D() : Rotate3D() {} diff --git a/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h b/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h index 74f574fa470d93bebdbe233b20087a77a5190bd1..abd1c23c4ea0b2bfc19cf646d5a2a7ae96465005 100644 --- a/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h +++ b/Tests/UnitTests/TestCore/ChiSquaredModuleTest.h @@ -24,8 +24,8 @@ protected: ChiSquaredModuleTest::ChiSquaredModuleTest() { - m_real_data.addAxis(NDetector2d::PHI_AXIS_NAME, 10, 0.0, 10.0); - m_real_data.addAxis(NDetector2d::ALPHA_AXIS_NAME, 10, 0.0, 10.0); + m_real_data.addAxis("phi_f", 10, 0.0, 10.0); + m_real_data.addAxis("alpha_f", 10, 0.0, 10.0); m_real_data.setAllTo(1.0); m_simul_data.copyFrom(m_real_data); m_simul_data.setAllTo(1.1); @@ -93,8 +93,8 @@ TEST_F(ChiSquaredModuleTest, IsGISAXSLikeModule) OutputData<double > real_data; OutputData<double > simul_data; const size_t nbins(5); - real_data.addAxis(NDetector2d::PHI_AXIS_NAME, nbins, 0.0, 1.0); - simul_data.addAxis(NDetector2d::PHI_AXIS_NAME, nbins, 0.0, 1.0); + real_data.addAxis("phi_f", nbins, 0.0, 1.0); + simul_data.addAxis("phi_f", nbins, 0.0, 1.0); const double a_real_data[nbins] = {1., 10., 100., 10., 1. }; const double a_simul_data[nbins] = {10., 100., 1000., 100., 10. }; OutputData<double >::iterator it_real = real_data.begin(); diff --git a/Tests/UnitTests/TestCore/InstrumentTest.h b/Tests/UnitTests/TestCore/InstrumentTest.h index 462fc4b75bc82b34a22afadf5133e3b8c16ae5ca..5be7b146b21e3289fec25ede2832243bc2a196f8 100644 --- a/Tests/UnitTests/TestCore/InstrumentTest.h +++ b/Tests/UnitTests/TestCore/InstrumentTest.h @@ -16,7 +16,7 @@ protected: InstrumentTest::InstrumentTest() { - m_data.addAxis(NDetector2d::PHI_AXIS_NAME, 10, 0., 10.); + m_data.addAxis("phi_f", 10, 0., 10.); m_data.addAxis("theta_f", 20, 0., 20.); } diff --git a/Tests/UnitTests/TestCore/SimulationTest.h b/Tests/UnitTests/TestCore/SimulationTest.h index 856f1bdb576e651c53869d33f2d93d8078137186..e42b5b8dc973263265d847c77cbb70349b4f18c5 100644 --- a/Tests/UnitTests/TestCore/SimulationTest.h +++ b/Tests/UnitTests/TestCore/SimulationTest.h @@ -33,7 +33,7 @@ protected: SimulationTest::SimulationTest() { - test_data.addAxis(NDetector2d::PHI_AXIS_NAME, 10, 0., 10.); + test_data.addAxis("phi_f", 10, 0., 10.); test_data.addAxis("theta_f", 20, 0., 20.); test_data.setAllTo(2.0);