30#ifndef __SPH_VECTOR_H__
31#define __SPH_VECTOR_H__
35#include <siscone/reference.h>
39namespace siscone_spherical{
109 inline double phi()
const {
return atan2(
py,
px);}
167 CSphmomentum(
double _px,
double _py,
double _pz,
double _E);
230inline double sqr(
double x){
return x*x;}
235inline double dot_product3(
const CSph3vector &v1,
const CSph3vector &v2){
243 return v1.px*v2.px + v1.py*v2.py + v1.pz*v2.pz;
249inline CSph3vector cross_product3(
const CSph3vector &v1,
const CSph3vector &v2){
255 return CSph3vector(v1.py*v2.pz-v1.pz*v2.py,
256 v1.pz*v2.px-v1.px*v2.pz,
257 v1.px*v2.py-v1.py*v2.px);
263inline double norm2_cross_product3(
const CSph3vector &v1,
const CSph3vector &v2){
264 return sqr(v1.py*v2.pz-v1.pz*v2.py) + sqr(v1.pz*v2.px-v1.px*v2.pz) + sqr(v1.px*v2.py-v1.py*v2.px);
270inline double get_tan2_distance(
const CSphmomentum &v1,
const CSphmomentum &v2){
271 return norm2_cross_product3(v1,v2)/sqr(dot_product3(v1,v2));
277inline double get_distance(
const CSph3vector *v1,
const CSph3vector *v2){
278 return atan2(sqrt(norm2_cross_product3(*v1,*v2)), dot_product3(*v1,*v2));
289inline bool is_closer(
const CSph3vector *v1,
const CSph3vector *v2,
const double tan2R){
290 double dot = dot_product3(*v1,*v2);
291 return (dot>=0) && (norm2_cross_product3(*v1,*v2)<=tan2R*dot*dot);
299inline bool is_closer_safer(
const CSph3vector *v1,
const CSph3vector *v2,
const double cosR){
300 return dot_product3(*v1,*v2)>=cosR*sqrt(v1->norm2()*v2->norm2());
307inline CSph3vector operator * (
const double &r,
const CSph3vector &v){
references used for checksums.
base class for managing the spatial part of Cmomentum (defined after)
void build_norm()
build the spatial normfrom 4-momentum info !!! WARNING !!! !!! computing the norm is the only time-co...
double norm() const
3-vect norm
void get_angular_directions(CSph3vector &angular_dir1, CSph3vector &angular_dir2)
for this direction, compute the two reference directions used to measure angles
const CSph3vector operator+(const CSph3vector &v)
addition of vectors WARNING= norm is not updated
double perp2() const
computes pT^2
CSph3vector()
default ctor
CSph3vector & operator=(const CSph3vector &v)
assignment of vectors
double phi() const
3-vect azimuthal angle
double perp() const
computes pT
CSph3vector & operator+=(const CSph3vector &v)
incrementation of vectors WARNING= norm is not updated
const CSph3vector operator-(const CSph3vector &v)
subtraction of vectors WARNING= norm is not updated
CSph3vector & operator/=(const double &r)
division by a constant WARNING= norm is not updated
CSph3vector & operator-=(const CSph3vector &v)
decrementation of vectors WARNING= norm is not updated
CSph3vector & operator*=(const double &r)
multiplication by a constant WARNING= norm is not updated
double _theta
particle theta angle (available ONLY after a call to build_thetaphi)
double _phi
particle phi angle (available ONLY after a call to build_thetaphi)
const CSph3vector operator/(const double &r)
division by a constant WARNING= norm is not updated
~CSph3vector()
default dtor
double _norm
particle spatial norm (available ONLY after a call to build_norm)
double norm2() const
3-vect norm squared
siscone::Creference ref
reference number for the vector
double theta() const
3-vect polar angle
void build_thetaphi()
just a useful tool to store theta and phi locally (in _theta and _phi) in case you need repeated acce...
base class for dynamic coordinates management
CSphmomentum & operator=(const CSphmomentum &v)
assignment of vectors
const CSphmomentum operator+(const CSphmomentum &v)
addition of vectors !!! WARNING !!! no updating of eta and phi !!!
~CSphmomentum()
ctor with detailed initialisation
int index
internal particle number
double perpmass2() const
transverse mass squared, mt^2 = pt^2+m^2 = E^2 - pz^2
double mass2() const
computes m^2
double mass() const
computes m
double perpmass() const
transverse mass, mt = sqrt(pt^2+m^2) = sqrt(E^2 - pz^2)
double Et2() const
computes transverse energy (squared)
int parent_index
particle number in the parent list
CSphmomentum & operator+=(const CSphmomentum &v)
incrementation of vectors !!! WARNING !!! no updating of eta and phi !!!
CSphmomentum()
default ctor
double Et() const
computes transverse energy
CSphmomentum & operator-=(const CSphmomentum &v)
decrementation of vectors !!! WARNING !!! no updating of eta and phi !!!