1#ifndef __JSIRENE__JEVENTSHAPEVARIABLES__
2#define __JSIRENE__JEVENTSHAPEVARIABLES__
43 inline double getThrust(
const std::vector<Trk>::const_iterator __begin,
44 const std::vector<Trk>::const_iterator __end)
49 static const int MAX_STEPS = 20;
50 static const double epsilon = 1e-9;
53 Vec axis0(0.0, 0.0, 0.0);
57 for (vector<Trk>::const_iterator i = __begin; i != __end; ++i) {
58 if (is_finalstate(*i)) {
59 axis0 += getKineticEnergy(*i) * i->dir;
63 if (axis0.
len() < epsilon) {
65 vector<Trk>::const_iterator i = find_if(__begin, __end, is_finalstate);
68 axis0 = getKineticEnergy(*i) * i->dir;
78 double res = numeric_limits<double>::max();
80 for (
int k = 0; k < MAX_STEPS && res > epsilon; ++k) {
82 Vec axis1(0.0, 0.0, 0.0);
84 for (vector<Trk>::const_iterator i = __begin; i != __end; ++i) {
86 if (is_finalstate(*i)) {
88 const Vec p = getKineticEnergy(*i) * i->dir;
90 axis1 += (p.
dot(axis0) > 0.0 ? p : -p);
96 res = acos( axis0.
dot(axis1) );
106 for (vector<Trk>::const_iterator i = __begin; i != __end; ++i) {
108 if (is_finalstate(*i)) {
110 const Vec p = getKineticEnergy(*i) * i->dir;
112 pSum += fabs(p.
dot(axis0));
160 const std::vector<Trk>::const_iterator __end,
172 for (vector<Trk>::const_iterator i = __begin; i != __end; ++i) {
174 if (is_finalstate(*i)) {
176 const Vec p0 = getKineticEnergy(*i) * i->dir;
178 for (vector<Trk>::const_iterator j = __begin; j != __end; ++j) {
180 if (is_finalstate(*j)) {
182 const Vec p1 = getKineticEnergy(*j) * j->dir;
184 for (
int k = 0; k < (int) this->size(); ++k) {
227 return p0.
len() *
p1.len() * legendre(n, p0.
dot(
p1) / p0.
len() /
p1.len());
257 std::vector<Trk>::const_iterator __end,
258 const double r = 2.0)
265 for (vector<Trk>::const_iterator i = __begin; i != __end; ++i) {
267 if (is_finalstate(*i)) {
269 const Vec p = getKineticEnergy(*i) * i->dir;
271 const double c = pow(p.
len(), r-2);
273 a00 += c * p.
x * p.
x;
274 a01 += c * p.
x * p.
y;
275 a02 += c * p.
x * p.
z;
277 a10 += c * p.
y * p.
x;
278 a11 += c * p.
y * p.
y;
279 a12 += c * p.
y * p.
z;
281 a20 += c * p.
z * p.
x;
282 a21 += c * p.
z * p.
y;
283 a22 += c * p.
z * p.
z;
285 norm += c * p.
dot(p);
302 const double r = 2.0) :
336 return 3 *
lambda[2] / 2.0;
416 std::vector<Hit>::const_iterator __end,
422 for (vector<Hit>::const_iterator hit = __begin; hit != __end; ++hit) {
424 const JPosition3D D = sqrt(hit->a) * (getPosition(hit->pos) - reference);
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Auxiliary methods for mathematics.
Data structure for position in three dimensions.
double getY() const
Get y position.
double getLengthSquared() const
Get length squared.
double getZ() const
Get z position.
double getX() const
Get x position.
Exception for accessing a value in a collection that is outside of its range.
JMatrix3D & div(const double factor)
Scale matrix.
eigen_values getEigenValues(const double epsilon=1e-6) const
Get eigen values.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getThrust(const std::vector< Trk >::const_iterator __begin, const std::vector< Trk >::const_iterator __end)
Compute thrust for a given range of tracks.
const JCylinder3D getMaximumContainmentVolume()
Forward function declarations.
double getVisibleEnergy(const Trk &, const JCylinder3D &)
Get the visible energy of a track.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
The cylinder used for photon tracking.
Class for computing Fox-Wolfram moments.
JFoxWolframMoments()
Default constructor.
double getContribution(const Vec &p0, const Vec &p1, const size_t n)
Get contribution to Fox-Wolfram moment from two momenta.
std::vector< double >::reference reference
JFoxWolframMoments(const std::vector< Trk >::const_iterator __begin, const std::vector< Trk >::const_iterator __end, const JCylinder3D &can=getMaximumContainmentVolume(), const int N=4)
Constructor.
JFoxWolframMoments(const Evt &event, const JCylinder3D &can=getMaximumContainmentVolume(), const int N=4)
Constructor.
Class for hit inertia tensor calculations.
JHitInertiaTensor(const Evt &event, const JPosition3D &reference)
Constructor.
double getEigenvalueRatio() const
Get eigenvalue ratio.
JMatrix3S::eigen_values eigen_values
JHitInertiaTensor()
Default constructor.
eigen_values lambda
eigenvalues
JHitInertiaTensor(std::vector< Hit >::const_iterator __begin, std::vector< Hit >::const_iterator __end, const JPosition3D &reference)
Constructor.
Class for sphericity tensor calculations.
JMatrix3S::eigen_values eigen_values
JSphericityTensor()
Default constructor.
double getSphericity() const
Get sphericity.
double getAplanarity() const
Get aplanarity.
double getCircularity() const
Get circularity.
eigen_values lambda
sorted eigenvalues
const eigen_values & getEigenValues() const
Get eigenvalues.
JSphericityTensor(std::vector< Trk >::const_iterator __begin, std::vector< Trk >::const_iterator __end, const double r=2.0)
Constructor.
double getPlanarFlow() const
Get planar flow.
JSphericityTensor(const Evt &event, const double r=2.0)
Constructor.
double getC() const
Get C-variable.
double getD() const
Get D-variable.
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Vec & normalize()
Normalise this vector.
double len() const
Get length.
double dot(const Vec &v) const
Get dot product.