Commit bfb37e58 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Mobility: adjust how we detector doping dependency for custom mobility

(cherry picked from commit 6c2c45623b2f27263adbf0d11cdef458c340f14b)
parent 378d5f23
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -304,7 +304,12 @@ namespace allpix {
        std::unique_ptr<TF2> configure_mobility(const Configuration& config, const CarrierType type, bool doping) {
            std::string name = (type == CarrierType::ELECTRON ? "electrons" : "holes");
            auto function = config.get<std::string>("mobility_function_" + name);
            auto parameters = config.getArray<double>("mobility_parameters_" + name);
            auto parameters = config.getArray<double>("mobility_parameters_" + name, {});

            // Check if a doping concentration dependency can be detected by checking for a Y variable:
            if(!doping && function.find("y") != std::string::npos) {
                throw ModelUnsuitable("No doping profile available but doping dependence found");
            }

            auto mobility = std::make_unique<TF2>(("mobility_" + name).c_str(), function.c_str(), 0, 1, 0, 1);

@@ -325,11 +330,6 @@ namespace allpix {
                mobility->SetParameter(static_cast<int>(n), parameters[n]);
            }

            // Check if a doping concentration dependency can be detected by comparing min and max of the function in Y:
            if(!doping && (mobility->GetYmin() != mobility->GetYmax())) {
                throw ModelUnsuitable("No doping profile available but doping dependence found");
            }

            return mobility;
        };
    };