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