Commit e18b866b authored by Petja Skomina's avatar Petja Skomina
Browse files

In favour of efficiency, changed how time unit conversion is done, when using...

In favour of efficiency, changed how time unit conversion is done, when using model GRAPH in CSADigitizer.
parent 42535050
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ CSADigitizerModule::CSADigitizerModule(Configuration& config, Messenger* messeng
        config_.setDefault<double>("transconductance", Units::get(50e-6, "C/s/V"));
        config_.setDefault<double>("weak_inversion_slope", 1.5);
        config_.setDefault<double>("temperature", 293.15);
    } else if(model_ == DigitizerType::GRAPH) {
        config_.setDefault<double>("graph_time_unit_", Units::get(1, "s"));
    }

    // Copy some variables from configuration to avoid lookups:
@@ -170,7 +172,7 @@ CSADigitizerModule::CSADigitizerModule(Configuration& config, Messenger* messeng
    } else if(model_ == DigitizerType::GRAPH) {
        const auto graph_path = config_.getPath("graph_file", true);
        graph_impulse_response_ = std::make_unique<TGraph>(graph_path.c_str(), "%lg,%lg");
        graph_time_unit_ = config_.get<std::string>("graph_time_unit", "s");
        graph_time_unit_ = config_.get<double>("graph_time_unit");
    }

    output_plots_ = config_.get<bool>("output_plots");
@@ -256,9 +258,10 @@ void CSADigitizerModule::run(Event* event) {
                        calculate_impulse_response_->Eval(timestep * static_cast<double>(itimepoint)));
                } else {
                    LOG(TRACE) << timestep * static_cast<double>(itimepoint) << ", "
                               << graph_impulse_response_->Eval(timestep * static_cast<double>(itimepoint));
                    impulse_response_function_.push_back(graph_impulse_response_->Eval(
                        static_cast<double>(Units::convert(timestep * static_cast<double>(itimepoint), graph_time_unit_))));
                               << graph_impulse_response_->Eval(timestep * static_cast<double>(itimepoint) /
                                                                graph_time_unit_);
                    impulse_response_function_.push_back(
                        graph_impulse_response_->Eval(timestep * static_cast<double>(itimepoint) / graph_time_unit_));
                }
            }

+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ namespace allpix {
        // Graph to store interpolated data points as response function
        std::unique_ptr<TGraph> graph_impulse_response_;
        // Time unit on the response function graph
        std::string graph_time_unit_;
        double graph_time_unit_;

        // Parameters of the electronics: Noise, time-over-threshold logic
        double sigmaNoise_{}, clockToT_{}, clockToA_{}, threshold_{};
+3 −2
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ If this behavior is not desired, the `ignore_polarity` parameter can be set to c
### Parameters for the graph model

* `graph_file`: The path to the .csv file containing the graph of the response function.
* `graph_time_unit`: Time unit in which the time on the response function graph is expressed.
* The file should be written in the following format: `x,y` (comma separated values), where x is the time and y the amplitude of the response function at that time point. Each pair of values should be written in a new line.
* `graph_time_unit`: Time unit in which the time on the response function graph is expressed. Should be a double.

### Plotting parameters

@@ -143,7 +144,7 @@ Example for the `graph` model:
model = "graph"
graph_file = /path/to/response_function.csv
integration_time = 10ns
graph_time_unit = "s"
graph_time_unit = 1s
```

[@kleczek]: https://doi.org/10.1109/MIXDES.2015.7208529