BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
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
12class BmnNdetPoint
13 : public FairMCPoint
14 , public BmnNdetAddressMixin<BmnNdetPoint>
15{
16 public:
17 //! Default constructor
19 : FairMCPoint()
20 , fAddress(0)
21 {
22 fDetectorID = kNDET;
23 }
24
25 /*! Constructor with arguments
26 *@param trackID Index of MCTrack
27 *@param address see BmnNdetAddress
28 *@param pos Coordinates [cm]
29 *@param mom Momentum of track [GeV]
30 *@param tof Time of flight [ns]
31 *@param length Track length since creation [cm]
32 *@param eLoss Energy deposit [GeV]
33 */
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
46 //! Copy constructor
48 : FairMCPoint(point)
49 , fAddress(point.fAddress)
50 {}
51
52 //! Move constructor
54 : FairMCPoint(std::move(point))
55 , fAddress(point.fAddress)
56 {
57 point.fAddress = 0;
58 }
59
60 //! Copy assignment operator
62 {
63 if (this != &point) {
64 FairMCPoint::operator=(point);
65 fAddress = point.fAddress;
66 }
67 return *this;
68 }
69
70 //! Move assignment operator
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
81 //! Destructor
82 virtual ~BmnNdetPoint() = default;
83
84 uint32_t GetAddress() const { return fAddress; }
85 void SetAddress(uint32_t address) { fAddress = address; }
86
87 //! Output to screen
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
103};
104
105#endif /* BMNNDETPOINT_H */
int Int_t
double Double_t
const char Option_t
#define ClassDef(name, id)
@ 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)
Constructor with arguments.
void SetAddress(uint32_t address)
uint32_t fAddress
BmnNdetPoint & operator=(const BmnNdetPoint &point)
Copy assignment operator.
BmnNdetPoint & operator=(BmnNdetPoint &&point) noexcept
Move assignment operator.
BmnNdetPoint()
Default constructor.
Definition json.hpp:4446
*brief exchanges the values of two JSON objects *sa nlohmann::NLOHMANN_BASIC_JSON_TPL &j2 noexcept(is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
Definition json.hpp:20347