Loading src/modules/DetectorHistogrammer/Cluster.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -58,11 +58,19 @@ bool Cluster::addPixelHit(const PixelHit* pixel_hit) { return false; } ROOT::Math::XYVectorD Cluster::getPosition() const { ROOT::Math::XYVectorD meanPos = ROOT::Math::XYVectorD(0., 0.); std::pair<double, double> Cluster::getIndex() const { double x = 0, y = 0; for(const auto& pixel : this->getPixelHits()) { meanPos += ROOT::Math::XYVectorD(pixel->getPixel().getIndex().x() * pixel->getSignal(), pixel->getPixel().getIndex().y() * pixel->getSignal()); x += pixel->getPixel().getIndex().x() * pixel->getSignal(); y += pixel->getPixel().getIndex().y() * pixel->getSignal(); } return {x / getCharge(), y / getCharge()}; } ROOT::Math::XYZVector Cluster::getPosition() const { ROOT::Math::XYZVector meanPos; for(const auto& pixel : this->getPixelHits()) { meanPos = pixel->getPixel().getLocalCenter() * pixel->getSignal() + meanPos; } meanPos /= getCharge(); return meanPos; Loading src/modules/DetectorHistogrammer/Cluster.hpp +9 −3 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ #ifndef ALLPIX_DETECTOR_HISTOGRAMMER_CLUSTER_H #define ALLPIX_DETECTOR_HISTOGRAMMER_CLUSTER_H #include <Math/DisplacementVector2D.h> #include <Math/Vector3D.h> #include <set> Loading Loading @@ -52,10 +52,16 @@ namespace allpix { std::pair<unsigned int, unsigned int> getSizeXY() const; /** * @brief Get the charge-weighted mean cluster position * @brief Get the charge-weighted mean cluster position in index coordinates * @return Indices of weighted mean cluster position */ std::pair<double, double> getIndex() const; /** * @brief Get the charge-weighted mean cluster position in local coordinates * @return weighted mean cluster position */ ROOT::Math::XYVectorD getPosition() const; ROOT::Math::XYZVector getPosition() const; /** * @brief Get the seed PixelHit, i.e. the PixelHit with the largest charge Loading Loading
src/modules/DetectorHistogrammer/Cluster.cpp +12 −4 Original line number Diff line number Diff line Loading @@ -58,11 +58,19 @@ bool Cluster::addPixelHit(const PixelHit* pixel_hit) { return false; } ROOT::Math::XYVectorD Cluster::getPosition() const { ROOT::Math::XYVectorD meanPos = ROOT::Math::XYVectorD(0., 0.); std::pair<double, double> Cluster::getIndex() const { double x = 0, y = 0; for(const auto& pixel : this->getPixelHits()) { meanPos += ROOT::Math::XYVectorD(pixel->getPixel().getIndex().x() * pixel->getSignal(), pixel->getPixel().getIndex().y() * pixel->getSignal()); x += pixel->getPixel().getIndex().x() * pixel->getSignal(); y += pixel->getPixel().getIndex().y() * pixel->getSignal(); } return {x / getCharge(), y / getCharge()}; } ROOT::Math::XYZVector Cluster::getPosition() const { ROOT::Math::XYZVector meanPos; for(const auto& pixel : this->getPixelHits()) { meanPos = pixel->getPixel().getLocalCenter() * pixel->getSignal() + meanPos; } meanPos /= getCharge(); return meanPos; Loading
src/modules/DetectorHistogrammer/Cluster.hpp +9 −3 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ #ifndef ALLPIX_DETECTOR_HISTOGRAMMER_CLUSTER_H #define ALLPIX_DETECTOR_HISTOGRAMMER_CLUSTER_H #include <Math/DisplacementVector2D.h> #include <Math/Vector3D.h> #include <set> Loading Loading @@ -52,10 +52,16 @@ namespace allpix { std::pair<unsigned int, unsigned int> getSizeXY() const; /** * @brief Get the charge-weighted mean cluster position * @brief Get the charge-weighted mean cluster position in index coordinates * @return Indices of weighted mean cluster position */ std::pair<double, double> getIndex() const; /** * @brief Get the charge-weighted mean cluster position in local coordinates * @return weighted mean cluster position */ ROOT::Math::XYVectorD getPosition() const; ROOT::Math::XYZVector getPosition() const; /** * @brief Get the seed PixelHit, i.e. the PixelHit with the largest charge Loading