BmnRoot
Loading...
Searching...
No Matches
BmnMCInfoDst.cxx
Go to the documentation of this file.
1/********************************************************************************
2 * BmnMCInfoDst.cxx *
3 *******************************************************************************/
4#include "BmnMCInfoDst.h"
5
6// Default constructor
8 : TNamed("BmnMCInfoDST", "MC")
9 , fB(0.)
10 , fX(0.)
11 , fY(0.)
12 , fZ(0.)
13 , fRotX(0.)
14 , fRotY(0.)
15 , fRotZ(0.)
16{
17 fMCTracks = new TClonesArray("CbmMCTrack");
18}
19
20// Copy constructor
22 : TNamed("BmnMCInfoDST", "MC")
23 , fB{other.fB}
24 , fX(other.fX)
25 , fY(other.fY)
26 , fZ(other.fZ)
27 , fRotX(other.fRotX)
28 , fRotY(other.fRotY)
29 , fRotZ(other.fRotZ)
30{
31 if (other.fMCTracks)
32 fMCTracks = new TClonesArray(*other.fMCTracks);
33 else
34 fMCTracks = nullptr;
35}
36
37// Copy assignment operator
39{
40 if (&other != this) {
41 fB = other.fB;
42 fX = other.fX;
43 fY = other.fY;
44 fZ = other.fZ;
45 fRotX = other.fRotX;
46 fRotY = other.fRotY;
47 fRotZ = other.fRotZ;
48
49 // delete the previous fMCTrack
50 if (fMCTracks) {
51 fMCTracks->Delete();
52 delete fMCTracks;
53 }
54 if (other.fMCTracks)
55 fMCTracks = new TClonesArray(*other.fMCTracks);
56 else
57 fMCTracks = nullptr;
58 }
59 return *this;
60}
61
62// Move constructor
64 : TNamed("BmnMCInfoDST", "MC")
65 , fB{other.fB}
66 , fX(other.fX)
67 , fY(other.fY)
68 , fZ(other.fZ)
69 , fRotX(other.fRotX)
70 , fRotY(other.fRotY)
71 , fRotZ(other.fRotZ)
72{
73 fMCTracks = std::exchange(other.fMCTracks, nullptr);
74}
75
76// Move assignment operator
78{
79 fB = other.fB;
80 fX = other.fX;
81 fY = other.fY;
82 fZ = other.fZ;
83 fRotX = other.fRotX;
84 fRotY = other.fRotY;
85 fRotZ = other.fRotZ;
86
87 // delete the previous fMCTrack
88 if (fMCTracks) {
89 fMCTracks->Delete();
90 delete fMCTracks;
91 }
92 fMCTracks = std::exchange(other.fMCTracks, nullptr);
93
94 return *this;
95}
96
97void BmnMCInfoDst::SetVertex(Double_t x, Double_t y, Double_t z)
98{
99 fX = x;
100 fY = y;
101 fZ = z;
102}
103
104void BmnMCInfoDst::Reset()
105{
106 fX = fY = fZ = fB = 0.;
107 fRotX = fRotY = fRotZ = 0.;
108 if (fMCTracks)
109 fMCTracks->Delete();
110}
111
112// Destructor
114{
115 if (fMCTracks) {
116 fMCTracks->Delete();
117 delete fMCTracks;
118 }
119}
BmnMCInfoDst & operator=(const BmnMCInfoDst &other)
void SetVertex(Double_t x, Double_t y, Double_t z)