EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Toggle main menu visibility
Loading...
Searching...
No Matches
src
EvtGenBase
EvtStdHep.cpp
Go to the documentation of this file.
1
2
/***********************************************************************
3
* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4
* *
5
* This file is part of EvtGen. *
6
* *
7
* EvtGen is free software: you can redistribute it and/or modify *
8
* it under the terms of the GNU General Public License as published by *
9
* the Free Software Foundation, either version 3 of the License, or *
10
* (at your option) any later version. *
11
* *
12
* EvtGen is distributed in the hope that it will be useful, *
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
* GNU General Public License for more details. *
16
* *
17
* You should have received a copy of the GNU General Public License *
18
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19
***********************************************************************/
20
21
#include "
EvtGenBase/EvtStdHep.hh
"
22
23
#include "
EvtGenBase/EvtVector4R.hh
"
24
25
#include <iomanip>
26
#include <iostream>
27
using namespace
std;
28
29
void
EvtStdHep::init
()
30
{
31
m_npart
= 0;
32
}
33
34
int
EvtStdHep::getNPart
()
35
{
36
return
m_npart
;
37
}
38
39
void
EvtStdHep::createParticle
(
EvtVector4R
p4,
EvtVector4R
x,
int
prntfirst,
40
int
prntlast,
int
id
)
41
{
42
m_p4
[
m_npart
] = p4;
43
m_x
[
m_npart
] = x;
44
m_prntfirst
[
m_npart
] = prntfirst;
45
m_prntlast
[
m_npart
] = prntlast;
46
m_daugfirst
[
m_npart
] = -1;
47
m_dauglast
[
m_npart
] = -1;
48
m_id
[
m_npart
] = id;
49
m_istat
[
m_npart
] = 1;
50
51
//we also need to fix up the parents pointer to the daughter!
52
53
if
( prntfirst >= 0 ) {
54
int
i;
55
for
( i = prntfirst; i <= prntlast; i++ ) {
56
m_istat
[i] = 2;
57
if
(
m_daugfirst
[i] == -1 )
58
m_daugfirst
[i] =
m_npart
;
59
if
(
m_dauglast
[i] <
m_npart
)
60
m_dauglast
[i] =
m_npart
;
61
}
62
}
63
64
m_npart
++;
65
}
66
67
void
EvtStdHep::translate
(
EvtVector4R
d )
68
{
69
int
i;
70
for
( i = 0; i <
m_npart
; i++ ) {
71
m_x
[i] += d;
72
}
73
}
74
75
ostream&
operator<<
( ostream& s,
const
EvtStdHep
& stdhep )
76
{
77
int
w = s.width();
78
int
p = s.precision();
79
std::ios::fmtflags f = s.flags();
80
81
s << endl;
82
s <<
" N Id Ist M1 M2 DF DL px py pz E t x y z"
83
<< endl;
84
int
i;
85
for
( i = 0; i < stdhep.
m_npart
; i++ ) {
86
s.width( 3 );
87
s << i <<
" "
;
88
s.width( 7 );
89
s << stdhep.
m_id
[i] <<
" "
;
90
s.width( 3 );
91
s << stdhep.
m_istat
[i] <<
" "
;
92
s.width( 4 );
93
s << stdhep.
m_prntfirst
[i] <<
" "
;
94
s.width( 4 );
95
s << stdhep.
m_prntlast
[i] <<
" "
;
96
s.width( 4 );
97
s << stdhep.
m_daugfirst
[i] <<
" "
;
98
s.width( 4 );
99
s << stdhep.
m_dauglast
[i] <<
" "
;
100
s.width( 7 );
101
s.precision( 4 );
102
s << setiosflags( ios::right | ios::fixed );
103
s << stdhep.
m_p4
[i].
get
( 1 ) <<
" "
;
104
s.width( 7 );
105
s.precision( 4 );
106
s << setiosflags( ios::right | ios::fixed );
107
s << stdhep.
m_p4
[i].
get
( 2 ) <<
" "
;
108
s.width( 7 );
109
s.precision( 4 );
110
s << setiosflags( ios::right | ios::fixed );
111
s << stdhep.
m_p4
[i].
get
( 3 ) <<
" "
;
112
s.width( 7 );
113
s.precision( 4 );
114
s << setiosflags( ios::right | ios::fixed );
115
s << stdhep.
m_p4
[i].
get
( 0 ) <<
" "
;
116
s.width( 7 );
117
s.precision( 4 );
118
s << setiosflags( ios::right | ios::fixed );
119
s << stdhep.
m_x
[i].
get
( 0 ) <<
" "
;
120
s.width( 7 );
121
s.precision( 4 );
122
s << setiosflags( ios::right | ios::fixed );
123
s << stdhep.
m_x
[i].
get
( 1 ) <<
" "
;
124
s.width( 7 );
125
s.precision( 4 );
126
s << setiosflags( ios::right | ios::fixed );
127
s << stdhep.
m_x
[i].
get
( 2 ) <<
" "
;
128
s.width( 7 );
129
s.precision( 4 );
130
s << setiosflags( ios::right | ios::fixed );
131
s << stdhep.
m_x
[i].
get
( 3 ) << endl;
132
s.width( 0 );
133
}
134
135
s << endl;
136
137
s.width( w );
138
s.precision( p );
139
s.flags( (std::ios::fmtflags)f );
140
141
return
s;
142
}
operator<<
ostream & operator<<(ostream &s, const EvtStdHep &stdhep)
Definition
EvtStdHep.cpp:75
EvtStdHep.hh
EvtVector4R.hh
EvtStdHep
Definition
EvtStdHep.hh:30
EvtStdHep::m_daugfirst
int m_daugfirst[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:62
EvtStdHep::m_prntfirst
int m_prntfirst[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:60
EvtStdHep::translate
void translate(EvtVector4R d)
Definition
EvtStdHep.cpp:67
EvtStdHep::m_x
EvtVector4R m_x[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:59
EvtStdHep::m_id
int m_id[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:64
EvtStdHep::m_prntlast
int m_prntlast[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:61
EvtStdHep::m_npart
int m_npart
Definition
EvtStdHep.hh:57
EvtStdHep::createParticle
void createParticle(EvtVector4R p4, EvtVector4R x, int prntfirst, int prntlast, int id)
Definition
EvtStdHep.cpp:39
EvtStdHep::init
void init()
Definition
EvtStdHep.cpp:29
EvtStdHep::m_p4
EvtVector4R m_p4[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:58
EvtStdHep::m_istat
int m_istat[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:65
EvtStdHep::m_dauglast
int m_dauglast[EVTSTDHEPLENGTH]
Definition
EvtStdHep.hh:63
EvtStdHep::getNPart
int getNPart()
Definition
EvtStdHep.cpp:34
EvtVector4R
Definition
EvtVector4R.hh:29
EvtVector4R::get
double get(int i) const
Definition
EvtVector4R.hh:163
Generated by
1.17.0