Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaBeamInfo.h
Go to the documentation of this file.
1#ifndef Podd_THaBeamInfo_h_
2#define Podd_THaBeamInfo_h_
3
5//
6// THaBeamInfo
7//
9
10#include "TVector3.h"
11#include "DataType.h"
12
13class THaBeam;
14
16public:
18 fOK(0), fBeam(nullptr) {}
19 THaBeamInfo( const TVector3& pvect, const TVector3& position,
20 Double_t pol = 0.0 )
21 : fPosition(position), fPvect(pvect), fPol(pol), fOK(1), fBeam(nullptr) {}
22 THaBeamInfo( Double_t p, const TVector3& vect, const TVector3& position,
23 Double_t pol = 0.0 )
24 : fPosition(position), fPvect(vect), fPol(pol), fOK(1), fBeam(nullptr)
25 { SetP(p); }
26
27 THaBeamInfo( const THaBeamInfo& t ) = default;
29 if( this != &rhs ) {
30 fPosition = rhs.fPosition;
31 fPvect = rhs.fPvect;
32 fPol = rhs.fPol;
33 fOK = rhs.fOK;
34 fBeam = rhs.fBeam;
35 }
36 return *this;
37 }
38 virtual ~THaBeamInfo() = default;
39
40 void Clear( Option_t* opt="" );
41 Bool_t IsOK() const { return fOK; }
42 Double_t GetPx() const { return fPvect.X(); }
43 Double_t GetPy() const { return fPvect.Y(); }
44 Double_t GetPz() const { return fPvect.Z(); }
45 Double_t GetP() const { return fPvect.Mag(); }
46 Double_t GetX() const { return fPosition.X(); }
47 Double_t GetY() const { return fPosition.Y(); }
48 Double_t GetZ() const { return fPosition.Z(); }
49 Double_t GetTheta() const { return (GetPz() != 0.0) ? GetPx()/GetPz():kBig;}
50 Double_t GetPhi() const { return (GetPz() != 0.0) ? GetPy()/GetPz():kBig;}
51 Double_t GetPol() const { return fPol; }
52 Double_t GetE() const;
53 Double_t GetM() const;
54 Int_t GetQ() const;
55 Double_t GetdE() const;
56 const TVector3& GetPvect() const { return fPvect; }
57 const TVector3& GetPosition() const { return fPosition; }
58
59 THaBeam* GetBeam() const { return fBeam; }
60
61 void SetP( Double_t p ) { fPvect.SetMag(p); }
62 void SetPol( Double_t pol ) { fPol = pol; }
63 void Set( const TVector3& pvect, const TVector3& position,
64 Double_t pol = 0.0 ) {
65 fPvect = pvect; fPosition = position; SetPol(pol); fOK = 1;
66 }
67 void Set( Double_t p, const TVector3& vect, const TVector3& position,
68 Double_t pol = 0.0 ) {
69 fPvect = vect; SetP(p); fPosition = position; SetPol(pol); fOK = 1;
70 }
71 void SetBeam(THaBeam* obj) { fBeam = obj; }
72
73protected:
74 TVector3 fPosition; // Reference position in lab frame (m)
75 TVector3 fPvect; // Momentum vector in lab (GeV/c)
76 Double_t fPol; // Beam polarization
77 Int_t fOK; // Data ok (0:no 1:yes)
78
80
81 ClassDef(THaBeamInfo,1) // Beam information for physics modules
82};
83
84//_____________________________________________________________________________
85inline
87{
90 fPol = 0.0;
91 fOK = 0;
92}
93
94#endif
95
int Int_t
const Data_t kBig
Definition DataType.h:15
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
TVector3 fPosition
Definition THaBeamInfo.h:74
virtual ~THaBeamInfo()=default
Double_t GetPol() const
Definition THaBeamInfo.h:51
THaBeam * GetBeam() const
Definition THaBeamInfo.h:59
void SetBeam(THaBeam *obj)
Definition THaBeamInfo.h:71
void Set(Double_t p, const TVector3 &vect, const TVector3 &position, Double_t pol=0.0)
Definition THaBeamInfo.h:67
Double_t fPol
Definition THaBeamInfo.h:76
const TVector3 & GetPosition() const
Definition THaBeamInfo.h:57
Double_t GetPy() const
Definition THaBeamInfo.h:43
void SetPol(Double_t pol)
Definition THaBeamInfo.h:62
void Clear(Option_t *opt="")
Definition THaBeamInfo.h:86
Double_t GetY() const
Definition THaBeamInfo.h:47
Double_t GetTheta() const
Definition THaBeamInfo.h:49
TVector3 fPvect
Definition THaBeamInfo.h:75
Double_t GetP() const
Definition THaBeamInfo.h:45
Double_t GetM() const
void SetP(Double_t p)
Definition THaBeamInfo.h:61
Double_t GetZ() const
Definition THaBeamInfo.h:48
Double_t GetE() const
THaBeamInfo(const TVector3 &pvect, const TVector3 &position, Double_t pol=0.0)
Definition THaBeamInfo.h:19
Double_t GetPhi() const
Definition THaBeamInfo.h:50
Double_t GetPz() const
Definition THaBeamInfo.h:44
Double_t GetdE() const
void Set(const TVector3 &pvect, const TVector3 &position, Double_t pol=0.0)
Definition THaBeamInfo.h:63
Double_t GetX() const
Definition THaBeamInfo.h:46
THaBeam * fBeam
Definition THaBeamInfo.h:79
Bool_t IsOK() const
Definition THaBeamInfo.h:41
THaBeamInfo & operator=(const THaBeamInfo &rhs)
Definition THaBeamInfo.h:28
const TVector3 & GetPvect() const
Definition THaBeamInfo.h:56
Int_t GetQ() const
THaBeamInfo(const THaBeamInfo &t)=default
Double_t GetPx() const
Definition THaBeamInfo.h:42
THaBeamInfo(Double_t p, const TVector3 &vect, const TVector3 &position, Double_t pol=0.0)
Definition THaBeamInfo.h:22
Double_t Z() const
void SetXYZ(Double_t x, Double_t y, Double_t z)
Double_t Y() const
Double_t X() const
Double_t Mag() const
void SetMag(Double_t)