From 661a4078434106ccb1d32378fd553435d3d3f6e8 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Fri, 5 May 2023 09:26:28 +0200
Subject: [PATCH] set mask and ROI only for detector, not for simulation

---
 Sim/Export/PyFmt2.cpp                   |  12 +-
 Sim/Simulation/ScatteringSimulation.cpp |  15 -
 Sim/Simulation/ScatteringSimulation.h   |  13 -
 Tests/Functional/Fitting/FitTests.cpp   |  10 +-
 Tests/SimFactory/MakeSimulations.cpp    |  42 ++-
 auto/Wrap/libBornAgainSim.py            |  12 -
 auto/Wrap/libBornAgainSim_wrap.cpp      | 361 +++++-------------------
 7 files changed, 103 insertions(+), 362 deletions(-)

diff --git a/Sim/Export/PyFmt2.cpp b/Sim/Export/PyFmt2.cpp
index b07bc5c26d2..91cd1fdee03 100644
--- a/Sim/Export/PyFmt2.cpp
+++ b/Sim/Export/PyFmt2.cpp
@@ -50,12 +50,12 @@ std::string Py::Fmt2::representShape2D(const std::string& indent, const IShape2D
                 result << ", ";
         }
         result << "]\n";
-        result << indent << "simulation.addMask("
+        result << indent << "detector.addMask("
                << "ba.Polygon(points), " << Py::Fmt::printBool(mask_value) << ")\n";
     } else if (dynamic_cast<const InfinitePlane*>(ishape))
-        result << indent << "simulation.maskAll()\n";
+        result << indent << "detector.maskAll()\n";
     else if (const auto* shape = dynamic_cast<const Ellipse*>(ishape)) {
-        result << indent << "simulation.addMask(";
+        result << indent << "detector.addMask(";
         result << "ba.Ellipse(" << printValueFunc(shape->getCenterX()) << ", "
                << printValueFunc(shape->getCenterY()) << ", " << printValueFunc(shape->radiusX())
                << ", " << printValueFunc(shape->radiusY());
@@ -65,7 +65,7 @@ std::string Py::Fmt2::representShape2D(const std::string& indent, const IShape2D
     }
 
     else if (const auto* shape = dynamic_cast<const Rectangle*>(ishape)) {
-        result << indent << "simulation.addMask(";
+        result << indent << "detector.addMask(";
         result << "ba.Rectangle(" << printValueFunc(shape->getXlow()) << ", "
                << printValueFunc(shape->getYlow()) << ", " << printValueFunc(shape->getXup())
                << ", " << printValueFunc(shape->getYup()) << "), " << Py::Fmt::printBool(mask_value)
@@ -73,13 +73,13 @@ std::string Py::Fmt2::representShape2D(const std::string& indent, const IShape2D
     }
 
     else if (const auto* shape = dynamic_cast<const VerticalLine*>(ishape)) {
-        result << indent << "simulation.addMask(";
+        result << indent << "detector.addMask(";
         result << "ba.VerticalLine(" << printValueFunc(shape->getXpos()) << "), "
                << Py::Fmt::printBool(mask_value) << ")\n";
     }
 
     else if (const auto* shape = dynamic_cast<const HorizontalLine*>(ishape)) {
-        result << indent << "simulation.addMask(";
+        result << indent << "detector.addMask(";
         result << "ba.HorizontalLine(" << printValueFunc(shape->getYpos()) << "), "
                << Py::Fmt::printBool(mask_value) << ")\n";
     } else
diff --git a/Sim/Simulation/ScatteringSimulation.cpp b/Sim/Simulation/ScatteringSimulation.cpp
index bb295580538..511230441c5 100644
--- a/Sim/Simulation/ScatteringSimulation.cpp
+++ b/Sim/Simulation/ScatteringSimulation.cpp
@@ -38,21 +38,6 @@ ScatteringSimulation::ScatteringSimulation(const Beam& beam, const MultiLayer& s
 
 ScatteringSimulation::~ScatteringSimulation() = default;
 
-void ScatteringSimulation::addMask(const IShape2D& shape, bool mask_value)
-{
-    m_detector->addMask(shape, mask_value);
-}
-
-void ScatteringSimulation::maskAll()
-{
-    m_detector->maskAll();
-}
-
-void ScatteringSimulation::setRegionOfInterest(double xlow, double ylow, double xup, double yup)
-{
-    m_detector->setRegionOfInterest(xlow, ylow, xup, yup);
-}
-
 const ICoordSystem* ScatteringSimulation::simCoordSystem() const
 {
     auto* const det2D = dynamic_cast<const IDetector*>(getDetector());
diff --git a/Sim/Simulation/ScatteringSimulation.h b/Sim/Simulation/ScatteringSimulation.h
index 73fd544bf16..bb0a5828086 100644
--- a/Sim/Simulation/ScatteringSimulation.h
+++ b/Sim/Simulation/ScatteringSimulation.h
@@ -35,19 +35,6 @@ public:
 
     std::string className() const final { return "ScatteringSimulation"; }
 
-    //! Adds mask of given shape to the stack of detector masks. The mask value 'true' means
-    //! that the channel will be excluded from the simulation. The mask which is added last
-    //! has priority.
-    //! @param shape The shape of mask (Rectangle, Polygon, Line, Ellipse)
-    //! @param mask_value The value of mask
-    void addMask(const IShape2D& shape, bool mask_value = true);
-
-    //! Put the mask for all detector channels (i.e. exclude whole detector from the analysis)
-    void maskAll();
-
-    //! Sets rectangular region of interest with lower left and upper right corners defined.
-    void setRegionOfInterest(double xlow, double ylow, double xup, double yup);
-
     Beam& beam() { return *m_beam; }
     IDetector& detector() { return *m_detector; }
 
diff --git a/Tests/Functional/Fitting/FitTests.cpp b/Tests/Functional/Fitting/FitTests.cpp
index 5f929a3f1db..badc2694908 100644
--- a/Tests/Functional/Fitting/FitTests.cpp
+++ b/Tests/Functional/Fitting/FitTests.cpp
@@ -72,16 +72,16 @@ const auto build_CylBA_Masked =
     [](const mumufit::Parameters& params) -> std::unique_ptr<ISimulation> {
     double detector_distance(500.0);
     double width(20.0), height(18.0);
-    RectangularDetector det(20u, width, 18u, height);
-    det.setPerpendicularToSampleX(detector_distance, width / 2., 0.0);
+    RectangularDetector detector(20u, width, 18u, height);
+    detector.setPerpendicularToSampleX(detector_distance, width / 2., 0.0);
+    detector.setRegionOfInterest(5.0, 6.0, 15.0, 12.0);
+    detector.addMask(Rectangle(0.0, 0.0, 2.0, 2.0), true);
 
     Beam beam(Beam(1, 1.0 * Units::angstrom, 0.2 * deg));
 
     std::unique_ptr<ScatteringSimulation> result(
-        new ScatteringSimulation(beam, *build_CylBA(params), det));
+        new ScatteringSimulation(beam, *build_CylBA(params), detector));
 
-    result->setRegionOfInterest(5.0, 6.0, 15.0, 12.0);
-    result->addMask(Rectangle(0.0, 0.0, 2.0, 2.0), true);
     return result;
 };
 
diff --git a/Tests/SimFactory/MakeSimulations.cpp b/Tests/SimFactory/MakeSimulations.cpp
index cf02717f2c8..2a3c15742db 100644
--- a/Tests/SimFactory/MakeSimulations.cpp
+++ b/Tests/SimFactory/MakeSimulations.cpp
@@ -143,30 +143,28 @@ test::makeSimulation::MiniGISASBeamDivergence(const MultiLayer& sample)
 std::unique_ptr<ScatteringSimulation> test::makeSimulation::GISASWithMasks(const MultiLayer& sample)
 {
     SphericalDetector detector(50, -1 * deg, 1 * deg, 50, 0, 2 * deg);
-    std::unique_ptr<ScatteringSimulation> result =
-        std::make_unique<ScatteringSimulation>(powerBeam, sample, detector);
 
-    result->maskAll();
+    detector.maskAll();
     // pacman
-    result->addMask(Ellipse(0.0 * deg, 1.0 * deg, 0.5 * deg, 0.5 * deg), false);
-    result->addMask(Ellipse(0.11 * deg, 1.25 * deg, 0.05 * deg, 0.05 * deg), true);
+    detector.addMask(Ellipse(0.0 * deg, 1.0 * deg, 0.5 * deg, 0.5 * deg), false);
+    detector.addMask(Ellipse(0.11 * deg, 1.25 * deg, 0.05 * deg, 0.05 * deg), true);
 
     std::vector<std::pair<double, double>> points = {{0.0 * deg, 1.0 * deg},
                                                      {0.5 * deg, 1.2 * deg},
                                                      {0.5 * deg, 0.8 * deg},
                                                      {0.0 * deg, 1.0 * deg}};
-    result->addMask(Polygon(points), true);
+    detector.addMask(Polygon(points), true);
 
-    result->addMask(Rectangle(0.45 * deg, 0.95 * deg, 0.55 * deg, 1.05 * deg), false);
-    result->addMask(Rectangle(0.61 * deg, 0.95 * deg, 0.71 * deg, 1.05 * deg), false);
-    result->addMask(Rectangle(0.75 * deg, 0.95 * deg, 0.85 * deg, 1.05 * deg), false);
+    detector.addMask(Rectangle(0.45 * deg, 0.95 * deg, 0.55 * deg, 1.05 * deg), false);
+    detector.addMask(Rectangle(0.61 * deg, 0.95 * deg, 0.71 * deg, 1.05 * deg), false);
+    detector.addMask(Rectangle(0.75 * deg, 0.95 * deg, 0.85 * deg, 1.05 * deg), false);
 
     // more masks
-    result->addMask(Ellipse(-0.5 * deg, 1.5 * deg, 0.3 * deg, 0.1 * deg, 45. * deg), false);
-    result->addMask(VerticalLine(-0.6 * deg), true);
-    result->addMask(HorizontalLine(0.3 * deg), false);
+    detector.addMask(Ellipse(-0.5 * deg, 1.5 * deg, 0.3 * deg, 0.1 * deg, 45. * deg), false);
+    detector.addMask(VerticalLine(-0.6 * deg), true);
+    detector.addMask(HorizontalLine(0.3 * deg), false);
 
-    return result;
+    return std::make_unique<ScatteringSimulation>(powerBeam, sample, detector);
 }
 
 //! GISAS simulation with detector resolution.
@@ -268,21 +266,21 @@ std::unique_ptr<ScatteringSimulation>
 test::makeSimulation::SphericalDetWithRoi(const MultiLayer& sample)
 {
     SphericalDetector detector(40, -2 * deg, 2 * deg, 30, 0, 3 * deg);
-    std::unique_ptr<ScatteringSimulation> result =
-        std::make_unique<ScatteringSimulation>(stdBeam, sample, detector);
-    result->addMask(Rectangle(-0.5 * deg, 0.3 * deg, -0.2 * deg, 0.6 * deg));
-    result->setRegionOfInterest(-1.5 * deg, 0.25 * deg, 1.5 * deg, 1.75 * deg);
-    return result;
+    detector.addMask(Rectangle(-0.5 * deg, 0.3 * deg, -0.2 * deg, 0.6 * deg));
+    detector.setRegionOfInterest(-1.5 * deg, 0.25 * deg, 1.5 * deg, 1.75 * deg);
+
+    return std::make_unique<ScatteringSimulation>(stdBeam, sample, detector);
 }
 
 //! GISAS simulation with rectangular detector, region of interest and mask.
 
 std::unique_ptr<ScatteringSimulation> test::makeSimulation::RectDetWithRoi(const MultiLayer& sample)
 {
-    std::unique_ptr<ScatteringSimulation> result = RectDetectorPerpToDirectBeam(sample);
-    result->addMask(Rectangle(3.0, 4.0, 5.0, 7.0));
-    result->setRegionOfInterest(2.0, 3.0, 18.0, 15.0);
-    return result;
+    RectangularDetector detector(rdet_nbinsx, rdet_width, rdet_nbinsy, rdet_height);
+    detector.setPerpendicularToDirectBeam(rdet_distance, rdet_width / 2., 1.0);
+    detector.addMask(Rectangle(3.0, 4.0, 5.0, 7.0));
+    detector.setRegionOfInterest(2.0, 3.0, 18.0, 15.0);
+    return std::make_unique<ScatteringSimulation>(stdBeam, sample, detector);
 }
 
 //! GISAS simulation with an extra long wavelength
diff --git a/auto/Wrap/libBornAgainSim.py b/auto/Wrap/libBornAgainSim.py
index cd86c441c36..d54590e296d 100644
--- a/auto/Wrap/libBornAgainSim.py
+++ b/auto/Wrap/libBornAgainSim.py
@@ -2705,18 +2705,6 @@ class ScatteringSimulation(ISimulation):
         r"""className(ScatteringSimulation self) -> std::string"""
         return _libBornAgainSim.ScatteringSimulation_className(self)
 
-    def addMask(self, shape, mask_value=True):
-        r"""addMask(ScatteringSimulation self, IShape2D const & shape, bool mask_value=True)"""
-        return _libBornAgainSim.ScatteringSimulation_addMask(self, shape, mask_value)
-
-    def maskAll(self):
-        r"""maskAll(ScatteringSimulation self)"""
-        return _libBornAgainSim.ScatteringSimulation_maskAll(self)
-
-    def setRegionOfInterest(self, xlow, ylow, xup, yup):
-        r"""setRegionOfInterest(ScatteringSimulation self, double xlow, double ylow, double xup, double yup)"""
-        return _libBornAgainSim.ScatteringSimulation_setRegionOfInterest(self, xlow, ylow, xup, yup)
-
     def beam(self):
         r"""beam(ScatteringSimulation self) -> Beam &"""
         return _libBornAgainSim.ScatteringSimulation_beam(self)
diff --git a/auto/Wrap/libBornAgainSim_wrap.cpp b/auto/Wrap/libBornAgainSim_wrap.cpp
index f329166dcdc..7e680b55513 100644
--- a/auto/Wrap/libBornAgainSim_wrap.cpp
+++ b/auto/Wrap/libBornAgainSim_wrap.cpp
@@ -3404,79 +3404,78 @@ namespace Swig {
 #define SWIGTYPE_p_IIntensityFunction swig_types[15]
 #define SWIGTYPE_p_INode swig_types[16]
 #define SWIGTYPE_p_ISampleNode swig_types[17]
-#define SWIGTYPE_p_IShape2D swig_types[18]
-#define SWIGTYPE_p_ISimulation swig_types[19]
-#define SWIGTYPE_p_IVarianceFunction swig_types[20]
-#define SWIGTYPE_p_IntensityFunctionLog swig_types[21]
-#define SWIGTYPE_p_IntensityFunctionSqrt swig_types[22]
-#define SWIGTYPE_p_IterationInfo swig_types[23]
-#define SWIGTYPE_p_MultiLayer swig_types[24]
-#define SWIGTYPE_p_OffspecDetector swig_types[25]
-#define SWIGTYPE_p_OffspecSimulation swig_types[26]
-#define SWIGTYPE_p_PoissonBackground swig_types[27]
-#define SWIGTYPE_p_PyBuilderCallback swig_types[28]
-#define SWIGTYPE_p_PyObserverCallback swig_types[29]
-#define SWIGTYPE_p_QzScan swig_types[30]
-#define SWIGTYPE_p_Rotation3DT_double_t swig_types[31]
-#define SWIGTYPE_p_ScatteringSimulation swig_types[32]
-#define SWIGTYPE_p_SimulationOptions swig_types[33]
-#define SWIGTYPE_p_SimulationResult swig_types[34]
-#define SWIGTYPE_p_SpecularSimulation swig_types[35]
-#define SWIGTYPE_p_VarianceConstantFunction swig_types[36]
-#define SWIGTYPE_p_VarianceSimFunction swig_types[37]
-#define SWIGTYPE_p_Vec3T_double_t swig_types[38]
-#define SWIGTYPE_p_Vec3T_int_t swig_types[39]
-#define SWIGTYPE_p_Vec3T_std__complexT_double_t_t swig_types[40]
-#define SWIGTYPE_p_allocator_type swig_types[41]
-#define SWIGTYPE_p_char swig_types[42]
-#define SWIGTYPE_p_difference_type swig_types[43]
-#define SWIGTYPE_p_first_type swig_types[44]
-#define SWIGTYPE_p_int swig_types[45]
-#define SWIGTYPE_p_key_type swig_types[46]
-#define SWIGTYPE_p_long_long swig_types[47]
-#define SWIGTYPE_p_mapped_type swig_types[48]
-#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[49]
-#define SWIGTYPE_p_mumufit__Parameters swig_types[50]
-#define SWIGTYPE_p_p_PyObject swig_types[51]
-#define SWIGTYPE_p_second_type swig_types[52]
-#define SWIGTYPE_p_short swig_types[53]
-#define SWIGTYPE_p_signed_char swig_types[54]
-#define SWIGTYPE_p_size_type swig_types[55]
-#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[56]
-#define SWIGTYPE_p_std__allocatorT_Vec3T_double_t_t swig_types[57]
-#define SWIGTYPE_p_std__allocatorT_double_t swig_types[58]
-#define SWIGTYPE_p_std__allocatorT_int_t swig_types[59]
-#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[60]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[61]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[62]
-#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[63]
-#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[64]
-#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[65]
-#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[66]
-#define SWIGTYPE_p_std__complexT_double_t swig_types[67]
-#define SWIGTYPE_p_std__invalid_argument swig_types[68]
-#define SWIGTYPE_p_std__lessT_std__string_t swig_types[69]
-#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[70]
-#define SWIGTYPE_p_std__pairT_double_double_t swig_types[71]
-#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[72]
-#define SWIGTYPE_p_std__vectorT_ParaMeta_std__allocatorT_ParaMeta_t_t swig_types[73]
-#define SWIGTYPE_p_std__vectorT_Vec3T_double_t_std__allocatorT_Vec3T_double_t_t_t swig_types[74]
-#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[75]
-#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[76]
-#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[77]
-#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[78]
-#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[79]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[80]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[81]
-#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[82]
-#define SWIGTYPE_p_swig__SwigPyIterator swig_types[83]
-#define SWIGTYPE_p_unsigned_char swig_types[84]
-#define SWIGTYPE_p_unsigned_int swig_types[85]
-#define SWIGTYPE_p_unsigned_long_long swig_types[86]
-#define SWIGTYPE_p_unsigned_short swig_types[87]
-#define SWIGTYPE_p_value_type swig_types[88]
-static swig_type_info *swig_types[90];
-static swig_module_info swig_module = {swig_types, 89, 0, 0, 0, 0};
+#define SWIGTYPE_p_ISimulation swig_types[18]
+#define SWIGTYPE_p_IVarianceFunction swig_types[19]
+#define SWIGTYPE_p_IntensityFunctionLog swig_types[20]
+#define SWIGTYPE_p_IntensityFunctionSqrt swig_types[21]
+#define SWIGTYPE_p_IterationInfo swig_types[22]
+#define SWIGTYPE_p_MultiLayer swig_types[23]
+#define SWIGTYPE_p_OffspecDetector swig_types[24]
+#define SWIGTYPE_p_OffspecSimulation swig_types[25]
+#define SWIGTYPE_p_PoissonBackground swig_types[26]
+#define SWIGTYPE_p_PyBuilderCallback swig_types[27]
+#define SWIGTYPE_p_PyObserverCallback swig_types[28]
+#define SWIGTYPE_p_QzScan swig_types[29]
+#define SWIGTYPE_p_Rotation3DT_double_t swig_types[30]
+#define SWIGTYPE_p_ScatteringSimulation swig_types[31]
+#define SWIGTYPE_p_SimulationOptions swig_types[32]
+#define SWIGTYPE_p_SimulationResult swig_types[33]
+#define SWIGTYPE_p_SpecularSimulation swig_types[34]
+#define SWIGTYPE_p_VarianceConstantFunction swig_types[35]
+#define SWIGTYPE_p_VarianceSimFunction swig_types[36]
+#define SWIGTYPE_p_Vec3T_double_t swig_types[37]
+#define SWIGTYPE_p_Vec3T_int_t swig_types[38]
+#define SWIGTYPE_p_Vec3T_std__complexT_double_t_t swig_types[39]
+#define SWIGTYPE_p_allocator_type swig_types[40]
+#define SWIGTYPE_p_char swig_types[41]
+#define SWIGTYPE_p_difference_type swig_types[42]
+#define SWIGTYPE_p_first_type swig_types[43]
+#define SWIGTYPE_p_int swig_types[44]
+#define SWIGTYPE_p_key_type swig_types[45]
+#define SWIGTYPE_p_long_long swig_types[46]
+#define SWIGTYPE_p_mapped_type swig_types[47]
+#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[48]
+#define SWIGTYPE_p_mumufit__Parameters swig_types[49]
+#define SWIGTYPE_p_p_PyObject swig_types[50]
+#define SWIGTYPE_p_second_type swig_types[51]
+#define SWIGTYPE_p_short swig_types[52]
+#define SWIGTYPE_p_signed_char swig_types[53]
+#define SWIGTYPE_p_size_type swig_types[54]
+#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[55]
+#define SWIGTYPE_p_std__allocatorT_Vec3T_double_t_t swig_types[56]
+#define SWIGTYPE_p_std__allocatorT_double_t swig_types[57]
+#define SWIGTYPE_p_std__allocatorT_int_t swig_types[58]
+#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[59]
+#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[60]
+#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[61]
+#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[62]
+#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[63]
+#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[64]
+#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[65]
+#define SWIGTYPE_p_std__complexT_double_t swig_types[66]
+#define SWIGTYPE_p_std__invalid_argument swig_types[67]
+#define SWIGTYPE_p_std__lessT_std__string_t swig_types[68]
+#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[69]
+#define SWIGTYPE_p_std__pairT_double_double_t swig_types[70]
+#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[71]
+#define SWIGTYPE_p_std__vectorT_ParaMeta_std__allocatorT_ParaMeta_t_t swig_types[72]
+#define SWIGTYPE_p_std__vectorT_Vec3T_double_t_std__allocatorT_Vec3T_double_t_t_t swig_types[73]
+#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[74]
+#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[75]
+#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[76]
+#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[77]
+#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[78]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[79]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[80]
+#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[81]
+#define SWIGTYPE_p_swig__SwigPyIterator swig_types[82]
+#define SWIGTYPE_p_unsigned_char swig_types[83]
+#define SWIGTYPE_p_unsigned_int swig_types[84]
+#define SWIGTYPE_p_unsigned_long_long swig_types[85]
+#define SWIGTYPE_p_unsigned_short swig_types[86]
+#define SWIGTYPE_p_value_type swig_types[87]
+static swig_type_info *swig_types[89];
+static swig_module_info swig_module = {swig_types, 88, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -7275,20 +7274,6 @@ SWIGINTERNINLINE PyObject*
 }
 
 
-SWIGINTERN int
-SWIG_AsVal_bool (PyObject *obj, bool *val)
-{
-  int r;
-  if (!PyBool_Check(obj))
-    return SWIG_ERROR;
-  r = PyObject_IsTrue(obj);
-  if (r == -1)
-    return SWIG_ERROR;
-  if (val) *val = r ? true : false;
-  return SWIG_OK;
-}
-
-
 
 /* ---------------------------------------------------
  * C++ director class methods
@@ -33192,201 +33177,6 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_ScatteringSimulation_addMask__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  ScatteringSimulation *arg1 = (ScatteringSimulation *) 0 ;
-  IShape2D *arg2 = 0 ;
-  bool arg3 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  bool val3 ;
-  int ecode3 = 0 ;
-  
-  if ((nobjs < 3) || (nobjs > 3)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ScatteringSimulation, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ScatteringSimulation_addMask" "', argument " "1"" of type '" "ScatteringSimulation *""'"); 
-  }
-  arg1 = reinterpret_cast< ScatteringSimulation * >(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_IShape2D,  0  | 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ScatteringSimulation_addMask" "', argument " "2"" of type '" "IShape2D const &""'"); 
-  }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ScatteringSimulation_addMask" "', argument " "2"" of type '" "IShape2D const &""'"); 
-  }
-  arg2 = reinterpret_cast< IShape2D * >(argp2);
-  ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ScatteringSimulation_addMask" "', argument " "3"" of type '" "bool""'");
-  } 
-  arg3 = static_cast< bool >(val3);
-  (arg1)->addMask((IShape2D const &)*arg2,arg3);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ScatteringSimulation_addMask__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  ScatteringSimulation *arg1 = (ScatteringSimulation *) 0 ;
-  IShape2D *arg2 = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  
-  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ScatteringSimulation, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ScatteringSimulation_addMask" "', argument " "1"" of type '" "ScatteringSimulation *""'"); 
-  }
-  arg1 = reinterpret_cast< ScatteringSimulation * >(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_IShape2D,  0  | 0);
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ScatteringSimulation_addMask" "', argument " "2"" of type '" "IShape2D const &""'"); 
-  }
-  if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ScatteringSimulation_addMask" "', argument " "2"" of type '" "IShape2D const &""'"); 
-  }
-  arg2 = reinterpret_cast< IShape2D * >(argp2);
-  (arg1)->addMask((IShape2D const &)*arg2);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ScatteringSimulation_addMask(PyObject *self, PyObject *args) {
-  Py_ssize_t argc;
-  PyObject *argv[4] = {
-    0
-  };
-  
-  if (!(argc = SWIG_Python_UnpackTuple(args, "ScatteringSimulation_addMask", 0, 3, argv))) SWIG_fail;
-  --argc;
-  if (argc == 2) {
-    int _v = 0;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ScatteringSimulation, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_IShape2D, SWIG_POINTER_NO_NULL | 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        return _wrap_ScatteringSimulation_addMask__SWIG_1(self, argc, argv);
-      }
-    }
-  }
-  if (argc == 3) {
-    int _v = 0;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ScatteringSimulation, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_IShape2D, SWIG_POINTER_NO_NULL | 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        {
-          int res = SWIG_AsVal_bool(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          return _wrap_ScatteringSimulation_addMask__SWIG_0(self, argc, argv);
-        }
-      }
-    }
-  }
-  
-fail:
-  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'ScatteringSimulation_addMask'.\n"
-    "  Possible C/C++ prototypes are:\n"
-    "    ScatteringSimulation::addMask(IShape2D const &,bool)\n"
-    "    ScatteringSimulation::addMask(IShape2D const &)\n");
-  return 0;
-}
-
-
-SWIGINTERN PyObject *_wrap_ScatteringSimulation_maskAll(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  ScatteringSimulation *arg1 = (ScatteringSimulation *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ScatteringSimulation, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ScatteringSimulation_maskAll" "', argument " "1"" of type '" "ScatteringSimulation *""'"); 
-  }
-  arg1 = reinterpret_cast< ScatteringSimulation * >(argp1);
-  (arg1)->maskAll();
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ScatteringSimulation_setRegionOfInterest(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  ScatteringSimulation *arg1 = (ScatteringSimulation *) 0 ;
-  double arg2 ;
-  double arg3 ;
-  double arg4 ;
-  double arg5 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  double val3 ;
-  int ecode3 = 0 ;
-  double val4 ;
-  int ecode4 = 0 ;
-  double val5 ;
-  int ecode5 = 0 ;
-  PyObject *swig_obj[5] ;
-  
-  if (!SWIG_Python_UnpackTuple(args, "ScatteringSimulation_setRegionOfInterest", 5, 5, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ScatteringSimulation, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ScatteringSimulation_setRegionOfInterest" "', argument " "1"" of type '" "ScatteringSimulation *""'"); 
-  }
-  arg1 = reinterpret_cast< ScatteringSimulation * >(argp1);
-  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ScatteringSimulation_setRegionOfInterest" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ScatteringSimulation_setRegionOfInterest" "', argument " "3"" of type '" "double""'");
-  } 
-  arg3 = static_cast< double >(val3);
-  ecode4 = SWIG_AsVal_double(swig_obj[3], &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "ScatteringSimulation_setRegionOfInterest" "', argument " "4"" of type '" "double""'");
-  } 
-  arg4 = static_cast< double >(val4);
-  ecode5 = SWIG_AsVal_double(swig_obj[4], &val5);
-  if (!SWIG_IsOK(ecode5)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "ScatteringSimulation_setRegionOfInterest" "', argument " "5"" of type '" "double""'");
-  } 
-  arg5 = static_cast< double >(val5);
-  (arg1)->setRegionOfInterest(arg2,arg3,arg4,arg5);
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_ScatteringSimulation_beam(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   ScatteringSimulation *arg1 = (ScatteringSimulation *) 0 ;
@@ -36370,9 +36160,6 @@ static PyMethodDef SwigMethods[] = {
 	 { "new_ScatteringSimulation", _wrap_new_ScatteringSimulation, METH_VARARGS, "new_ScatteringSimulation(Beam const & beam, MultiLayer const & sample, IDetector const & detector) -> ScatteringSimulation"},
 	 { "delete_ScatteringSimulation", _wrap_delete_ScatteringSimulation, METH_O, "delete_ScatteringSimulation(ScatteringSimulation self)"},
 	 { "ScatteringSimulation_className", _wrap_ScatteringSimulation_className, METH_O, "ScatteringSimulation_className(ScatteringSimulation self) -> std::string"},
-	 { "ScatteringSimulation_addMask", _wrap_ScatteringSimulation_addMask, METH_VARARGS, "ScatteringSimulation_addMask(ScatteringSimulation self, IShape2D const & shape, bool mask_value=True)"},
-	 { "ScatteringSimulation_maskAll", _wrap_ScatteringSimulation_maskAll, METH_O, "ScatteringSimulation_maskAll(ScatteringSimulation self)"},
-	 { "ScatteringSimulation_setRegionOfInterest", _wrap_ScatteringSimulation_setRegionOfInterest, METH_VARARGS, "ScatteringSimulation_setRegionOfInterest(ScatteringSimulation self, double xlow, double ylow, double xup, double yup)"},
 	 { "ScatteringSimulation_beam", _wrap_ScatteringSimulation_beam, METH_O, "ScatteringSimulation_beam(ScatteringSimulation self) -> Beam &"},
 	 { "ScatteringSimulation_detector", _wrap_ScatteringSimulation_detector, METH_O, "ScatteringSimulation_detector(ScatteringSimulation self) -> IDetector &"},
 	 { "ScatteringSimulation_swigregister", ScatteringSimulation_swigregister, METH_O, NULL},
@@ -36597,7 +36384,6 @@ static swig_type_info _swigt__p_IDistribution1D = {"_p_IDistribution1D", "IDistr
 static swig_type_info _swigt__p_IFootprintFactor = {"_p_IFootprintFactor", "IFootprintFactor *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IIntensityFunction = {"_p_IIntensityFunction", "IIntensityFunction *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_INode = {"_p_INode", "std::vector< INode const * >::value_type|INode *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_IShape2D = {"_p_IShape2D", "IShape2D *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ISimulation = {"_p_ISimulation", "ISimulation *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IVarianceFunction = {"_p_IVarianceFunction", "IVarianceFunction *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_IntensityFunctionLog = {"_p_IntensityFunctionLog", "IntensityFunctionLog *", 0, 0, (void*)0, 0};
@@ -36688,7 +36474,6 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_IIntensityFunction,
   &_swigt__p_INode,
   &_swigt__p_ISampleNode,
-  &_swigt__p_IShape2D,
   &_swigt__p_ISimulation,
   &_swigt__p_IVarianceFunction,
   &_swigt__p_IntensityFunctionLog,
@@ -36779,7 +36564,6 @@ static swig_cast_info _swigc__p_IDistribution1D[] = {  {&_swigt__p_IDistribution
 static swig_cast_info _swigc__p_IFootprintFactor[] = {  {&_swigt__p_IFootprintFactor, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IIntensityFunction[] = {  {&_swigt__p_IIntensityFunction, 0, 0, 0},  {&_swigt__p_IntensityFunctionLog, _p_IntensityFunctionLogTo_p_IIntensityFunction, 0, 0},  {&_swigt__p_IntensityFunctionSqrt, _p_IntensityFunctionSqrtTo_p_IIntensityFunction, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_INode[] = {  {&_swigt__p_INode, 0, 0, 0},  {&_swigt__p_AlphaScan, _p_AlphaScanTo_p_INode, 0, 0},  {&_swigt__p_ConstantBackground, _p_ConstantBackgroundTo_p_INode, 0, 0},  {&_swigt__p_DepthprobeSimulation, _p_DepthprobeSimulationTo_p_INode, 0, 0},  {&_swigt__p_IBackground, _p_IBackgroundTo_p_INode, 0, 0},  {&_swigt__p_IBeamScan, _p_IBeamScanTo_p_INode, 0, 0},  {&_swigt__p_ISampleNode, _p_ISampleNodeTo_p_INode, 0, 0},  {&_swigt__p_ISimulation, _p_ISimulationTo_p_INode, 0, 0},  {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_INode, 0, 0},  {&_swigt__p_PoissonBackground, _p_PoissonBackgroundTo_p_INode, 0, 0},  {&_swigt__p_QzScan, _p_QzScanTo_p_INode, 0, 0},  {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_INode, 0, 0},  {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_INode, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IShape2D[] = {  {&_swigt__p_IShape2D, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ISimulation[] = {  {&_swigt__p_ISimulation, 0, 0, 0},  {&_swigt__p_DepthprobeSimulation, _p_DepthprobeSimulationTo_p_ISimulation, 0, 0},  {&_swigt__p_OffspecSimulation, _p_OffspecSimulationTo_p_ISimulation, 0, 0},  {&_swigt__p_ScatteringSimulation, _p_ScatteringSimulationTo_p_ISimulation, 0, 0},  {&_swigt__p_SpecularSimulation, _p_SpecularSimulationTo_p_ISimulation, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IVarianceFunction[] = {  {&_swigt__p_IVarianceFunction, 0, 0, 0},  {&_swigt__p_VarianceConstantFunction, _p_VarianceConstantFunctionTo_p_IVarianceFunction, 0, 0},  {&_swigt__p_VarianceSimFunction, _p_VarianceSimFunctionTo_p_IVarianceFunction, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IntensityFunctionLog[] = {  {&_swigt__p_IntensityFunctionLog, 0, 0, 0},{0, 0, 0, 0}};
@@ -36870,7 +36654,6 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_IIntensityFunction,
   _swigc__p_INode,
   _swigc__p_ISampleNode,
-  _swigc__p_IShape2D,
   _swigc__p_ISimulation,
   _swigc__p_IVarianceFunction,
   _swigc__p_IntensityFunctionLog,
-- 
GitLab