13 #include <Eigen/Dense> 15 #define _USE_MATH_DEFINES 26 void LArEigenHelper::Vectorize(
const T &caloHitContainer, Eigen::MatrixXf &hitMatrix)
29 for (
const CaloHit *
const pCaloHit : caloHitContainer)
31 const CartesianVector &pos{pCaloHit->GetPositionVector()};
32 hitMatrix(i, 0) = pos.GetX();
33 hitMatrix(i, 1) = pos.GetZ();
41 void LArEigenHelper::Vectorize(
const T &caloHitContainer, Eigen::MatrixXf ¢re, Eigen::MatrixXf &low, Eigen::MatrixXf &high)
43 LArEigenHelper::Vectorize(caloHitContainer, centre);
45 for (
const CaloHit *
const pCaloHit : caloHitContainer)
47 const CartesianVector &pos{pCaloHit->GetPositionVector()};
48 low(i, 0) = pos.GetX() - pCaloHit->GetCellSize1() * 0.5f;
49 low(i, 1) = pos.GetZ();
50 high(i, 0) = pos.GetX() + pCaloHit->GetCellSize1() * 0.5f;
51 high(i, 1) = pos.GetZ();
58 void LArEigenHelper::GetAngles(
const Eigen::MatrixXf &hitMatrix,
const Eigen::RowVectorXf &
origin, Eigen::RowVectorXf &phis)
60 const float pi{
static_cast<float>(M_PI)};
61 Eigen::RowVectorXf piVec{Eigen::RowVectorXf::Constant(hitMatrix.rows(),
pi)};
62 Eigen::RowVectorXf zeroVec{Eigen::RowVectorXf::Zero(hitMatrix.rows())};
63 Eigen::MatrixXf deltas(hitMatrix.rowwise() -
origin);
64 for (
int i = 0; i < deltas.rows(); ++i)
65 phis(i) = std::atan2(deltas(i, 1), deltas(i, 0));
67 phis = (phis.array() < 0).select(piVec * 2 + phis, phis);
68 phis = (phis.array() < 2 *
pi).select(phis, zeroVec);
73 template void LArEigenHelper::Vectorize(
const CaloHitList &, Eigen::MatrixXf &);
74 template void LArEigenHelper::Vectorize(
const CaloHitVector &, Eigen::MatrixXf &);
75 template void LArEigenHelper::Vectorize(
const CaloHitList &, Eigen::MatrixXf &, Eigen::MatrixXf &, Eigen::MatrixXf &);
76 template void LArEigenHelper::Vectorize(
const CaloHitVector &, Eigen::MatrixXf &, Eigen::MatrixXf &, Eigen::MatrixXf &);
Header file for the principal curve analysis helper class.
Header file for the object helper class.
Header file for the cluster helper class.
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
constexpr Point origin()
Returns a origin position with a point of the specified type.