3 #include <gsl/gsl_vector.h> 4 #include <gsl/gsl_matrix.h> 5 #include <gsl/gsl_linalg.h> 6 #include <gsl/gsl_eigen.h> 7 #include <gsl/gsl_multifit_nlin.h> 8 #include <gsl/gsl_sf_gamma.h> 9 #include <gsl/gsl_integration.h> 14 : _nHits(nhits), _aHit(nhits, 0.0), _tHit(nhits, 0.0), _xHit(nhits, 0.0), _yHit(nhits, 0.0), _zHit(nhits, 0.0), _ifNotGravity(1), _ifNotWidth(1), _ifNotInertia(1), _ifNotElipsoid(1)
16 for (
int i(0); i < nhits; ++i)
27 :
_nHits(nhits),
_aHit(nhits, 0.0),
_tHit(nhits, 0.0),
_xHit(nhits, 0.0),
_yHit(nhits, 0.0),
_zHit(nhits, 0.0),
_ifNotGravity(1),
_ifNotWidth(1),
_ifNotInertia(1),
_ifNotElipsoid(1)
29 for (
int i(0); i < nhits; ++i)
42 :
_nHits(nhits),
_aHit(nhits, 0.0),
_xHit(nhits, 0.0),
_yHit(nhits, 0.0),
_zHit(nhits, 0.0),
_ifNotGravity(1),
_ifNotWidth(1),
_ifNotInertia(1),
_ifNotElipsoid(1)
44 for (
int i(0); i < nhits; ++i)
55 :
_nHits(nhits),
_aHit(nhits, 0.0),
_tHit(nhits, 0.0),
_xHit(nhits, 0.0),
_yHit(nhits, 0.0),
_zHit(nhits, 0.0),
_ifNotGravity(1),
_ifNotWidth(1),
_ifNotInertia(1),
_ifNotElipsoid(1)
57 for (
int i(0); i < nhits; ++i)
127 float r_hit_max, d_begn, d_last, r_max, proj;
145 r_hit_max = -100000.;
152 for (
int i(0); i <
_nHits; ++i)
157 r_max = sqrt(dx*dx + dy*dy + dz*dz);
159 if(r_max > r_hit_max) r_hit_max = r_max;
160 proj = dx*cx + dy*cy + dz*
cz;
181 for (
int i(0); i < 3; ++i)
184 for (
int i(0); i <
_nHits; ++i)
193 for (
int i(0); i < 3; ++i)
212 for (
int i(0); i < 3; ++i) {
213 for (
int j(0); j < 3; ++j) {
218 for (
int i(0); i <
_nHits; ++i)
221 float dY =
_yHit[i] - _analogGravity[1];
222 float dZ =
_zHit[i] - _analogGravity[2];
223 aIne[0][0] +=
_aHit[i]*(dY*dY+dZ*dZ);
224 aIne[1][1] +=
_aHit[i]*(dX*dX+dZ*dZ);
225 aIne[2][2] +=
_aHit[i]*(dX*dX+dY*dY);
226 aIne[0][1] -=
_aHit[i]*dX*dY;
227 aIne[0][2] -=
_aHit[i]*dX*dZ;
228 aIne[1][2] -=
_aHit[i]*dY*dZ;
231 for (
int i(0); i < 2; ++i) {
232 for (
int j = i+1; j < 3; ++j) {
233 aIne[j][i] = aIne[i][j];
240 gsl_matrix_view aMatrix = gsl_matrix_view_array((
double*)aIne,3,3);
241 gsl_vector* aVector = gsl_vector_alloc(3);
242 gsl_matrix* aEigenVec = gsl_matrix_alloc(3,3);
243 gsl_eigen_symmv_workspace* wa = gsl_eigen_symmv_alloc(3);
244 gsl_eigen_symmv(&aMatrix.matrix,aVector,aEigenVec,wa);
245 gsl_eigen_symmv_free(wa);
246 gsl_eigen_symmv_sort(aVector,aEigenVec,GSL_EIGEN_SORT_ABS_ASC);
248 for (
int i(0); i < 3; i++) {
250 for (
int j(0); j < 3; j++) {
259 for (
int i(0); i < 3; ++i) {
265 for (
int i(0); i < 3; ++i)
276 gsl_vector_free(aVector);
277 gsl_matrix_free(aEigenVec);
291 for (
int i(0); i <
_nHits; ++i)
320 float tx = cy*dz - cz*dy ;
321 float ty = cz*dx - cx*dz ;
322 float tz = cx*dy - cy*dx ;
323 float tt = sqrt(tx*tx+ty*ty+tz*tz) ;
324 float ti = sqrt(cx*cx+cy*cy+cz*cz) ;
Namespace for general, non-LArSoft-specific utilities.
float getTotalAmplitude()
std::vector< float > _aHit
std::vector< float > _zHit
std::vector< float > _tHit
std::vector< float > _yHit
float * getEigenValInertia()
float _ValAnalogInertia[3]
float findDistance(int i)
float _VecAnalogInertia[9]
ClusterShapes(int nhits, float *a, float *x, float *y, float *z)
float * getEigenVecInertia()
std::vector< float > _xHit
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
float * getCenterOfGravity()