Commit 1b1e55a8 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

InducedTransfer: use new method of getting neighbor channels

parent 06f4a373
Loading
Loading
Loading
Loading
+15 −23
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@ InducedTransferModule::InducedTransferModule(Configuration& config,
    model_ = detector_->getModel();

    // Set default value for config variables and store value
    config_.setDefault<XYVectorInt>("induction_matrix", XYVectorInt(3, 3));
    matrix_ = config_.get<XYVectorInt>("induction_matrix");
    config_.setDefault<unsigned int>("distance", 1);
    distance_ = config_.get<unsigned int>("distance");

    // Require propagated deposits for single detector
    messenger_->bindSingle<PropagatedChargeMessage>(this, MsgFlags::REQUIRED);
@@ -79,21 +79,14 @@ void InducedTransferModule::run(Event* event) {
                   << ", " << Units::display(propagated_charge.getGlobalTime() - deposited_charge->getGlobalTime(), "ns");

        // Loop over NxN pixels:
        for(int x = xpixel - matrix_.x() / 2; x <= xpixel + matrix_.x() / 2; x++) {
            for(int y = ypixel - matrix_.y() / 2; y <= ypixel + matrix_.y() / 2; y++) {
                // Ignore if out of pixel grid
                if(!detector_->getModel()->isWithinPixelGrid(x, y)) {
                    LOG(TRACE) << "Pixel (" << x << "," << y << ") skipped, outside the grid";
                    continue;
                }

                Pixel::Index pixel_index(static_cast<unsigned int>(x), static_cast<unsigned int>(y));
        auto idx = Pixel::Index(static_cast<unsigned int>(xpixel), static_cast<unsigned int>(ypixel));
        for(const auto& pixel_index : model_->getNeighbors(idx, distance_)) {
            auto ramo_end = detector_->getWeightingPotential(position_end, pixel_index);
            auto ramo_start = detector_->getWeightingPotential(position_start, pixel_index);

            // Induced charge on electrode is q_int = q * (phi(x1) - phi(x0))
                auto induced = static_cast<double>(propagated_charge.getSign() * propagated_charge.getCharge()) *
                               (ramo_end - ramo_start);
            auto induced =
                static_cast<double>(propagated_charge.getSign() * propagated_charge.getCharge()) * (ramo_end - ramo_start);
            LOG(TRACE) << "Pixel " << pixel_index << " dPhi = " << (ramo_end - ramo_start) << ", induced "
                       << propagated_charge.getType() << " q = " << Units::display(induced, "e");

@@ -101,7 +94,6 @@ void InducedTransferModule::run(Event* event) {
            pixel_map[pixel_index].emplace_back(induced, &propagated_charge);
        }
    }
    }

    // Send an error message if this even only contained one of the two carrier types
    if(!found_electrons || !found_holes) {
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ namespace allpix {
        std::shared_ptr<Detector> detector_;
        std::shared_ptr<DetectorModel> model_;

        // Induction matrix size in number of pixels along x and y
        ROOT::Math::DisplacementVector2D<ROOT::Math::Cartesian2D<int>> matrix_;
        // Distance of electrodes taken into account for induction
        unsigned int distance_;
    };
} // namespace allpix