ATLAS Offline Software
Loading...
Searching...
No Matches
StringVector.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 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:
13 StringVector() = default;
15 StringVector(const StringVector &) = default;
18 StringVector(const G4ThreeVector& p, G4double m);
19 StringVector(G4double x, G4double y, G4double z, G4double m);
20 ~StringVector() = default;
21 G4ThreeVector vect() const;
22 G4double mag() const;
23 G4double x() const;
24 G4double y() const;
25 G4double z() const;
26 G4double t() const;
27 G4LorentzVector lv() const;
28 StringVector reflect(const G4LorentzVector& axis) const;
29 void set(const G4ThreeVector& p, G4double m);
30 void set(G4double x, G4double y, G4double z, G4double m);
31 void operator *= (G4double a);
32
33private:
34 G4ThreeVector m_p{0,0,0};
35 G4double m_m{};
36};
37
38inline StringVector operator * (G4double a, const StringVector& s) {
39 return StringVector(a * s.vect(), a * s.mag());
40}
41
42inline StringVector operator * (const StringVector& s, G4double a) {
43 return StringVector(a * s.vect(), a * s.mag());
44}
45
46inline G4ThreeVector StringVector::vect() const {
47 return m_p;
48}
49
50inline G4double StringVector::mag() const {
51 return m_m;
52}
53
54inline G4double StringVector::x() const {
55 return m_p.x();
56}
57
58inline G4double StringVector::y() const {
59 return m_p.y();
60}
61
62inline G4double StringVector::z() const {
63 return m_p.z();
64}
65
66inline G4double StringVector::t() const {
67 return std::sqrt(m_p.mag2() + m_m*m_m);
68}
69
70inline G4LorentzVector StringVector::lv() const {
71 return G4LorentzVector(m_p, t());
72}
73
74inline StringVector StringVector::reflect(const G4LorentzVector& axis) const {
75 return StringVector(axis.vect() * (2 * lv() * axis) / axis.mag2() - m_p, m_m);
76}
77
78inline void StringVector::set(const G4ThreeVector& p, G4double m) {
79 m_p = p;
80 m_m = m;
81}
82
83inline void StringVector::set(G4double x, G4double y, G4double z, G4double m) {
84 m_p.set(x,y,z);
85 m_m = m;
86}
87
88inline void StringVector::operator *= (G4double a) {
89 m_p *= a;
90 m_m *= a;
91}
92
93#endif
static Double_t a
StringVector operator*(G4double a, const StringVector &s)
StringVector()=default
void set(const G4ThreeVector &p, G4double m)
StringVector(StringVector &&)=default
G4double m_m
StringVector & operator=(StringVector &&)=default
G4ThreeVector m_p
StringVector(const StringVector &)=default
StringVector reflect(const G4LorentzVector &axis) const
G4LorentzVector lv() const
G4double x() const
G4double z() const
~StringVector()=default
G4double mag() const
G4ThreeVector vect() const
G4double y() const
void operator*=(G4double a)
G4double t() const