SRLorentzVector.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file SRLorentzVector3D.h
3 /// \brief 4-vector class with more efficient storage than TLorentzVector.
4 /// Ported from NOvA StandardRecord.
5 /// \author C. Backhouse <c.backhouse@ucl.ac.uk>
6 /// \date Sept. 2021
7 ////////////////////////////////////////////////////////////////////////
8 
9 #ifndef DUNEANAOBJ_SRLORENTZVECTOR_H
10 #define DUNEANAOBJ_SRLORENTZVECTOR_H
11 
12 #if !defined(__GCCXML__) && !defined(__castxml__)
13 
14 #include <cmath>
15 #include <limits>
16 
17 #include "TMath.h"
18 #include "TLorentzVector.h"
19 #include "TVector3.h"
20 
21 #endif
22 
23 
24 
25 namespace caf
26 {
28  {
29  public:
31  virtual ~SRLorentzVector() = default;
32 
33 #if !defined(__GCCXML__) && !defined(__castxml__)
34 
35  SRLorentzVector(const TLorentzVector& v);
36 
37  /// Recommend users convert back to TLorentzVector for boosts etc
38  operator TLorentzVector() const;
39 
40  // For access as a position vector. For momentum use the member variables
41  // directly.
42  float T() const {return E;}
43  float X() const {return px;}
44  float Y() const {return py;}
45  float Z() const {return pz;}
46  float Mag() const {return sqrt(px*px + py*py + pz*pz);}
47  float Beta() const {return Mag()/E;}
48  float Gamma() const {return 1.0/sqrt(1-Beta()*Beta());}
49 
50  TVector3 Vect() const {return TVector3(px, py, pz);}
51 #endif
52 
53  float E;
54  float px;
55  float py;
56  float pz;
57  };
58 
59 }
60 #endif //DUNEANAOBJ_SRLORENTZVECTOR_H
TVector3 Vect() const
float Gamma() const
virtual ~SRLorentzVector()=default
float Mag() const
Common Analysis Files.
Definition: SRGAr.h:13
float Beta() const