Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHHepMCGenEvent.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHHepMCGenEvent.cc
1
#include "
PHHepMCGenEvent.h
"
2
3
#pragma GCC diagnostic push
4
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
5
#include <HepMC/GenEvent.h>
6
#pragma GCC diagnostic pop
7
8
#include <HepMC/SimpleVector.h>
// for FourVector
9
10
#include <CLHEP/Vector/Boost.h>
11
#include <CLHEP/Vector/LorentzRotation.h>
12
#include <CLHEP/Vector/LorentzVector.h>
13
#include <CLHEP/Vector/Rotation.h>
14
15
#include <sstream>
16
#include <utility>
// for swap
17
18
using namespace
std;
19
20
PHHepMCGenEvent::PHHepMCGenEvent
()
21
: _embedding_id(0)
22
, _isSimulated(
false
)
23
, _collisionVertex(0, 0, 0, 0)
24
, _theEvt(nullptr)
25
{
26
}
27
28
PHHepMCGenEvent::PHHepMCGenEvent
(
const
PHHepMCGenEvent
&
event
)
29
: _embedding_id(event.get_embedding_id())
30
, _isSimulated(event.is_simulated())
31
, _collisionVertex(event.get_collision_vertex())
32
, _theEvt(nullptr)
33
{
34
if
(event.
getEvent
())
35
_theEvt
=
new
HepMC::GenEvent(*event.
getEvent
());
36
return
;
37
}
38
39
PHHepMCGenEvent
&
PHHepMCGenEvent::operator=
(
const
PHHepMCGenEvent
&
event
)
40
{
41
if
(&event ==
this
)
return
*
this
;
42
43
Reset
();
44
45
_embedding_id
=
event
.get_embedding_id();
46
_isSimulated
=
event
.is_simulated();
47
_theEvt
=
new
HepMC::GenEvent(*event.
getEvent
());
48
49
return
*
this
;
50
}
51
52
PHHepMCGenEvent::~PHHepMCGenEvent
()
53
{
54
delete
_theEvt
;
55
}
56
57
void
PHHepMCGenEvent::Reset
()
58
{
59
_embedding_id
= 0;
60
_isSimulated
=
false
;
61
_collisionVertex
.set(0, 0, 0, 0);
62
delete
_theEvt
;
63
_theEvt
=
nullptr
;
64
}
65
66
HepMC::GenEvent*
PHHepMCGenEvent::getEvent
()
67
{
68
return
_theEvt
;
69
}
70
71
const
HepMC::GenEvent*
PHHepMCGenEvent::getEvent
()
const
72
{
73
return
_theEvt
;
74
}
75
76
bool
PHHepMCGenEvent::addEvent
(HepMC::GenEvent* evt)
77
{
78
// clean up old event if it exists,
79
// no check needed, one can delete null pointers
80
delete
_theEvt
;
81
82
_theEvt
= evt;
83
if
(!
_theEvt
)
return
false
;
84
return
true
;
85
}
86
87
bool
PHHepMCGenEvent::swapEvent
(HepMC::GenEvent*& evt)
88
{
89
swap
(
_theEvt
, evt);
90
91
if
(!
_theEvt
)
return
false
;
92
return
true
;
93
}
94
95
bool
PHHepMCGenEvent::addEvent
(HepMC::GenEvent& evt)
96
{
97
return
addEvent
(
new
HepMC::GenEvent(evt));
98
}
99
100
void
PHHepMCGenEvent::clearEvent
()
101
{
102
if
(
_theEvt
)
_theEvt
->clear();
103
}
104
105
void
PHHepMCGenEvent::moveVertex
(
double
x
,
double
y
,
double
z
,
double
t
)
106
{
107
_collisionVertex
.setX(
_collisionVertex
.x() +
x
);
108
_collisionVertex
.setY(
_collisionVertex
.y() +
y
);
109
_collisionVertex
.setZ(
_collisionVertex
.z() +
z
);
110
_collisionVertex
.setT(
_collisionVertex
.t() +
t
);
111
}
112
113
int
PHHepMCGenEvent::size
(
void
)
const
114
{
115
if
(
_theEvt
)
116
return
_theEvt
->particles_size();
117
else
118
return
0;
119
}
120
121
int
PHHepMCGenEvent::vertexSize
(
void
)
const
122
{
123
if
(
_theEvt
)
124
return
_theEvt
->vertices_size();
125
else
126
return
0;
127
}
128
129
//_____________________________________________________________________________
130
void
PHHepMCGenEvent::identify
(std::ostream&
os
)
const
131
{
132
os <<
"identify yourself: PHHepMCGenEvent Object"
;
133
os <<
", No of Particles: "
<<
size
();
134
os <<
", No of Vertices: "
<<
vertexSize
() << endl;
135
os <<
" embedding_id = "
<<
_embedding_id
<< endl;
136
os <<
" isSimulated = "
<<
_isSimulated
<< endl;
137
os <<
" collisionVertex = ("
<<
_collisionVertex
.x() <<
","
<<
_collisionVertex
.y() <<
","
<<
_collisionVertex
.z() <<
") cm, "
<<
_collisionVertex
.t() <<
" ns"
<< endl;
138
139
return
;
140
}
141
142
void
PHHepMCGenEvent::print
(std::ostream&
out
)
const
143
{
144
identify
(out);
145
}
146
147
void
PHHepMCGenEvent::PrintEvent
()
148
{
149
_theEvt
->print();
150
}
coresoftware
blob
master
generators
phhepmc
PHHepMCGenEvent.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:03
using
1.8.2 with
sPHENIX GitHub integration