ATLAS Offline Software
Loading...
Searching...
No Matches
StringVector.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef STRINGVECTOR_H
6#define STRINGVECTOR_H
7
8#include "G4ThreeVector.hh"
9#include "G4LorentzVector.hh"
10
12public:
14 StringVector(const G4ThreeVector& p, G4double m);
15 StringVector(G4double x, G4double y, G4double z, G4double m);
17 G4ThreeVector vect() const;
18 G4double mag() const;
19 G4double x() const;
20 G4double y() const;
21 G4double z() const;
22 G4double t() const;
23 G4LorentzVector lv() const;
24 StringVector reflect(const G4LorentzVector& axis) const;
25 void set(const G4ThreeVector& p, G4double m);
26 void set(G4double x, G4double y, G4double z, G4double m);
27 void operator *= (G4double a);
28
29private:
30 G4ThreeVector m_p;
31 G4double m_m;
32};
33
34inline StringVector operator * (G4double a, const StringVector& s) {
35 return StringVector(a * s.vect(), a * s.mag());
36}
37
38inline StringVector operator * (const StringVector& s, G4double a) {
39 return StringVector(a * s.vect(), a * s.mag());
40}
41
42inline G4ThreeVector StringVector::vect() const {
43 return m_p;
44}
45
46inline G4double StringVector::mag() const {
47 return m_m;
48}
49
50inline G4double StringVector::x() const {
51 return m_p.x();
52}
53
54inline G4double StringVector::y() const {
55 return m_p.y();
56}
57
58inline G4double StringVector::z() const {
59 return m_p.z();
60}
61
62inline G4double StringVector::t() const {
63 return std::sqrt(m_p.mag2() + m_m*m_m);
64}
65
66inline G4LorentzVector StringVector::lv() const {
67 return G4LorentzVector(m_p, t());
68}
69
70inline StringVector StringVector::reflect(const G4LorentzVector& axis) const {
71 return StringVector(axis.vect() * (2 * lv() * axis) / axis.mag2() - m_p, m_m);
72}
73
74inline void StringVector::set(const G4ThreeVector& p, G4double m) {
75 m_p = p;
76 m_m = m;
77}
78
79inline void StringVector::set(G4double x, G4double y, G4double z, G4double m) {
80 m_p.set(x,y,z);
81 m_m = m;
82}
83
84inline void StringVector::operator *= (G4double a) {
85 m_p *= a;
86 m_m *= a;
87}
88
89#endif
static Double_t a
StringVector operator*(G4double a, const StringVector &s)
void set(const G4ThreeVector &p, G4double m)
G4double m_m
G4ThreeVector m_p
StringVector reflect(const G4LorentzVector &axis) const
G4LorentzVector lv() const
G4double x() const
G4double z() const
G4double mag() const
G4ThreeVector vect() const
G4double y() const
void operator*=(G4double a)
G4double t() const