EvtGen
2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
src
EvtGenBase
EvtSecondary.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/EvtSecondary.hh
"
22
23
#include "
EvtGenBase/EvtPDL.hh
"
24
#include "
EvtGenBase/EvtParticle.hh
"
25
#include "
EvtGenBase/EvtReport.hh
"
26
27
#include <iostream>
28
using
std::endl;
29
using
std::ostream;
30
31
void
EvtSecondary::init
()
32
{
33
m_npart
= 0;
34
}
35
36
int
EvtSecondary::getNPart
()
37
{
38
return
m_npart
;
39
}
40
41
void
EvtSecondary::createSecondary
(
int
stdhepindex,
EvtParticle
* prnt )
42
{
43
m_stdhepindex
[
m_npart
] = stdhepindex;
44
if
( prnt->
getNDaug
() == 0 ) {
45
m_id1
[
m_npart
] = 0;
46
m_id2
[
m_npart
] = 0;
47
m_id3
[
m_npart
] = 0;
48
m_npart
++;
49
return
;
50
}
51
if
( prnt->
getNDaug
() == 1 ) {
52
m_id1
[
m_npart
] =
EvtPDL::getStdHep
( prnt->
getDaug
( 0 )->
getId
() );
53
m_id2
[
m_npart
] = 0;
54
m_id3
[
m_npart
] = 0;
55
m_npart
++;
56
return
;
57
}
58
if
( prnt->
getNDaug
() == 2 ) {
59
m_id1
[
m_npart
] =
EvtPDL::getStdHep
( prnt->
getDaug
( 0 )->
getId
() );
60
m_id2
[
m_npart
] =
EvtPDL::getStdHep
( prnt->
getDaug
( 1 )->
getId
() );
61
m_id3
[
m_npart
] = 0;
62
m_npart
++;
63
return
;
64
}
65
if
( prnt->
getNDaug
() == 3 ) {
66
m_id1
[
m_npart
] =
EvtPDL::getStdHep
( prnt->
getDaug
( 0 )->
getId
() );
67
m_id2
[
m_npart
] =
EvtPDL::getStdHep
( prnt->
getDaug
( 1 )->
getId
() );
68
m_id3
[
m_npart
] =
EvtPDL::getStdHep
( prnt->
getDaug
( 2 )->
getId
() );
69
m_npart
++;
70
return
;
71
}
72
73
EvtGenReport
(
EVTGEN_ERROR
,
"EvtGen"
)
74
<<
"More than 3 decay products in a secondary particle!"
<< endl;
75
}
76
77
ostream&
operator<<
( ostream& s,
const
EvtSecondary
& secondary )
78
{
79
s << endl;
80
s <<
"Secondary decays:"
<< endl;
81
82
int
i;
83
for
( i = 0; i < secondary.
m_npart
; i++ ) {
84
EvtGenReport
(
EVTGEN_INFO
,
"EvtGen"
)
85
<< i <<
" "
<< secondary.
m_stdhepindex
[i] <<
" "
86
<< secondary.
m_id1
[i] <<
" "
<< secondary.
m_id2
[i] <<
" "
87
<< secondary.
m_id3
[i] << endl;
88
}
89
90
s << endl;
91
92
return
s;
93
}
EvtPDL.hh
EvtParticle.hh
EvtReport.hh
EvtGenReport
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition
EvtReport.cpp:32
EVTGEN_INFO
@ EVTGEN_INFO
Definition
EvtReport.hh:52
EVTGEN_ERROR
@ EVTGEN_ERROR
Definition
EvtReport.hh:49
operator<<
ostream & operator<<(ostream &s, const EvtSecondary &secondary)
Definition
EvtSecondary.cpp:77
EvtSecondary.hh
EvtPDL::getStdHep
static int getStdHep(EvtId id)
Definition
EvtPDL.cpp:356
EvtParticle
Definition
EvtParticle.hh:45
EvtParticle::getId
EvtId getId() const
Definition
EvtParticle.cpp:124
EvtParticle::getDaug
EvtParticle * getDaug(const int i)
Definition
EvtParticle.hh:173
EvtParticle::getNDaug
size_t getNDaug() const
Definition
EvtParticle.cpp:154
EvtSecondary
Definition
EvtSecondary.hh:29
EvtSecondary::m_id2
int m_id2[EVTSECONDARYLENGTH]
Definition
EvtSecondary.hh:51
EvtSecondary::createSecondary
void createSecondary(int stdhepindex, EvtParticle *prnt)
Definition
EvtSecondary.cpp:41
EvtSecondary::m_stdhepindex
int m_stdhepindex[EVTSECONDARYLENGTH]
Definition
EvtSecondary.hh:49
EvtSecondary::m_npart
int m_npart
Definition
EvtSecondary.hh:48
EvtSecondary::m_id3
int m_id3[EVTSECONDARYLENGTH]
Definition
EvtSecondary.hh:52
EvtSecondary::m_id1
int m_id1[EVTSECONDARYLENGTH]
Definition
EvtSecondary.hh:50
EvtSecondary::getNPart
int getNPart()
Definition
EvtSecondary.cpp:36
EvtSecondary::init
void init()
Definition
EvtSecondary.cpp:31
Generated by
1.16.1