Commit 217f54d3 authored by Daniil Rastorguev's avatar Daniil Rastorguev
Browse files

DepositionLaser: fixed user input of optical properties

parent 60b1aa89
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -86,10 +86,25 @@ DepositionLaserModule::DepositionLaserModule(Configuration& config, Messenger* m
    }

    // FIXME less hardcoded values

    is_user_optics_ = (config_.count({"absorption_length", "refractive_index"}) == 2);

    if(config_.count({"absorption_length", "refractive_index", "wavelength"}) == 3) {
        throw InvalidCombinationError(config_,
                                      {"absorption_length", "refractive_index", "wavelength"},
                                      "User definition for optical parameters an wavelength are mutually exclusive!");
    }

    if(is_user_optics_) {
        absorption_length_ = config_.get<double>("absorption_length");
        refractive_index_ = config_.get<double>("refractive_index");
        LOG(DEBUG) << "Setting user-defined optical properties for sensor material";
    } else {
        wavelength_ = config_.get<double>("wavelength");
        if(Units::convert(wavelength_, "nm") < 250 || Units::convert(wavelength_, "nm") > 1450) {
            throw InvalidValueError(config_, "wavelength", "Currently supported wavelengths are 250 -- 1450 nm");
        }
    }

    config_.setDefault<bool>("output_plots", false);
    output_plots_ = config.get<bool>("output_plots");
@@ -97,12 +112,7 @@ DepositionLaserModule::DepositionLaserModule(Configuration& config, Messenger* m

void DepositionLaserModule::initialize() {
    // Check if there are user-specified optical properties for materials
    is_user_optics_ = (config_.count({"absorption_length", "refractive_index"}) == 2);
    if(is_user_optics_) {
        absorption_length_ = config_.get<double>("absorption_length");
        refractive_index_ = config_.get<double>("refractive_index");
        LOG(DEBUG) << "Setting user-defined optical properties for sensor material";
    } else {
    if(!is_user_optics_) {
        // wavelength: {absorption_length, refractive_index}
        std::map<double, std::pair<double, double>> optics_lut;
        double wl = 0;
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ namespace allpix {
        double focal_distance_;

        size_t number_of_photons_;
        double wavelength_;
        double wavelength_{0.};
        double absorption_length_{0.};
        double refractive_index_{0.};
        double pulse_duration_;
+3 −2
Original line number Diff line number Diff line
@@ -55,7 +55,8 @@ and temporal distribution.

* `number_of_photons`: number of incident photons, generated in *one* event. Defaults to 10000. The total deposited charge
  will also depend on wavelength and geometry.
* `wavelength` of the laser. Supported values are 250 -- 1450 nm.
* `wavelength` of the laser. If specified, it is used to retrieve sensor optical properties from the lookup table (data is available for the range of 250 -- 1450 nm). The only supported material is silicon.
* `absorption_length` and `refractive_index`: if both are specified, given values are used instead of the lookup table. This also allows use of sensor materials other than silicon.
* `pulse_duration`: gaussian width of pulse temporal profile. Defaults to 0.5 ns.
* `source_position`: a 3D position vector.
* `beam_direction`: a 3D direction vector.
@@ -66,7 +67,7 @@ and temporal distribution.
  source.
* `beam_convergence_angle`: max angle between tracks and `beam_direction`. Needs to be specified for a `converging` beam.
* `output_plots`: if set `true`, this module will produce histograms to monitor beam shape and also 3D distributions of charges, deposited in each detector. Histograms would look sensible even for one-event runs. Defaults to `false`.
* `absorption_length` and `refractive_index`: if both are specified, they override corresponding values from the lookup table. This also allows use of sensor materials other than silicon.


## Usage
A simulation pipeline to build an analog detector response would include `DepositionLaser`, `TransientPropagation` and