BmnRoot
Loading...
Searching...
No Matches
BmnNdetPoint.h
Go to the documentation of this file.
1#ifndef BMNNDETPOINT_H
2#define BMNNDETPOINT_H
3
5#include "FairMCPoint.h"
6#include "TVector3.h"
7
8#include <iostream>
9
10using namespace std;
11
13 : public FairMCPoint
14 , public BmnNdetAddressMixin<BmnNdetPoint>
15{
16 public:
19 : FairMCPoint()
20 , fAddress(0)
21 {
22 fDetectorID = kNDET;
23 }
24
34 BmnNdetPoint(Int_t trackID,
35 uint32_t address,
36 const TVector3& pos,
37 const TVector3& mom,
38 Double_t tof,
39 Double_t length,
40 Double_t eLoss,
41 UInt_t EventId = 0)
42 : FairMCPoint(trackID, kNDET, pos, mom, tof, length, eLoss, EventId)
43 , fAddress(address)
44 {}
45
48 : FairMCPoint(point)
49 , fAddress(point.fAddress)
50 {}
51
53 BmnNdetPoint(BmnNdetPoint&& point) noexcept
54 : FairMCPoint(std::move(point))
55 , fAddress(point.fAddress)
56 {
57 point.fAddress = 0;
58 }
59
62 {
63 if (this != &point) {
64 FairMCPoint::operator=(point);
65 fAddress = point.fAddress;
66 }
67 return *this;
68 }
69
72 {
73 if (this != &point) {
74 FairMCPoint::operator=(std::move(point));
75 fAddress = point.fAddress;
76 point.fAddress = 0;
77 }
78 return *this;
79 }
80
82 virtual ~BmnNdetPoint() = default;
83
84 uint32_t GetAddress() const { return fAddress; }
85 void SetAddress(uint32_t address) { fAddress = address; }
86
88 virtual const char* GetClassName() const { return "BmnNdetPoint"; }
89 virtual void Print(const Option_t* opt = "") const
90 {
91 printf("%s: %s\n", GetClassName(), BmnNdetAddress::GetInfoString(fAddress).c_str());
92 printf(" track %d\n", GetTrackID());
93 printf(" Position (%.2f, %.2f, %.2f) cm\n", GetX(), GetY(), GetZ());
94 printf(" Momentum (%.2f, %.2f, %.2f) GeV\n", GetPx(), GetPy(), GetPz());
95 printf(" Time %.2f ns, Length %.2f cm\n", GetTime(), GetLength());
96 printf(" Energy loss %.6f GeV\n", GetEnergyLoss());
97 }
98
99 private:
100 uint32_t fAddress;
101
102 ClassDef(BmnNdetPoint, 5)
103};
104
105#endif /* BMNNDETPOINT_H */
@ kNDET
interface to use the address methods
static std::string GetInfoString(uint32_t address)
Return a formatted string with all address components.
virtual const char * GetClassName() const
Output to screen.
BmnNdetPoint(BmnNdetPoint &&point) noexcept
Move constructor.
virtual void Print(const Option_t *opt="") const
uint32_t GetAddress() const
virtual ~BmnNdetPoint()=default
Destructor.
BmnNdetPoint(const BmnNdetPoint &point)
Copy constructor.
BmnNdetPoint(Int_t trackID, uint32_t address, const TVector3 &pos, const TVector3 &mom, Double_t tof, Double_t length, Double_t eLoss, UInt_t EventId=0)
void SetAddress(uint32_t address)
BmnNdetPoint & operator=(const BmnNdetPoint &point)
Copy assignment operator.
BmnNdetPoint & operator=(BmnNdetPoint &&point) noexcept
Move assignment operator.
BmnNdetPoint()
Default constructor.
STL namespace.