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

DetectorHistogrammer: don't multiply with pitch but use local coordinate cluster pos

parent 1d60e64f
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -351,9 +351,11 @@ void DetectorHistogrammerModule::run(Event* event) {
        cluster_size_x->Fill(clusSizesXY.first);
        cluster_size_y->Fill(clusSizesXY.second);

        auto [cluster_x, cluster_y] = clus.getIndex();
        auto clusterPos = clus.getPosition();
        LOG(DEBUG) << "Cluster at coordinates " << clusterPos << " with charge " << Units::display(clus.getCharge(), "ke");
        cluster_map->Fill(clusterPos.x(), clusterPos.y());
        LOG(DEBUG) << "Cluster at indices " << cluster_x << ", " << cluster_y << "(" << clusterPos
                   << " local coordinates) with charge " << Units::display(clus.getCharge(), "ke");
        cluster_map->Fill(cluster_x, cluster_y);
        cluster_charge->Fill(static_cast<double>(Units::convert(clus.getCharge(), "ke")));
        charge_sum += clus.getCharge();

@@ -399,8 +401,8 @@ void DetectorHistogrammerModule::run(Event* event) {


            // Calculate residual with cluster position:
            auto residual_um_x = static_cast<double>(Units::convert(particlePos.x() - clusterPos.x() * pitch.x(), "um"));
            auto residual_um_y = static_cast<double>(Units::convert(particlePos.y() - clusterPos.y() * pitch.y(), "um"));
            auto residual_um_x = static_cast<double>(Units::convert(particlePos.x() - clusterPos.x(), "um"));
            auto residual_um_y = static_cast<double>(Units::convert(particlePos.y() - clusterPos.y(), "um"));
            residual_x->Fill(residual_um_x);
            residual_y->Fill(residual_um_y);
            residual_x_vs_x->Fill(inPixel_um_x, std::fabs(residual_um_x));
@@ -438,8 +440,8 @@ void DetectorHistogrammerModule::run(Event* event) {

        auto matched_cluster =
            std::find_if(clusters.begin(), clusters.end(), [this, &particlePos, &pitch](const Cluster& clus) {
                return (std::fabs(clus.getPosition().x() * pitch.x() - particlePos.x()) < matching_cut_.x()) &&
                       (std::fabs(clus.getPosition().y() * pitch.y() - particlePos.y()) < matching_cut_.y());
                return (std::fabs(clus.getPosition().x() - particlePos.x()) < matching_cut_.x()) &&
                       (std::fabs(clus.getPosition().y() - particlePos.y()) < matching_cut_.y());
            });

        // Do we have a match?