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
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
22
23#include "EvtGenBase/EvtPDL.hh"
26
27#include <iostream>
28using std::endl;
29using std::ostream;
30
32{
33 m_npart = 0;
34}
35
37{
38 return m_npart;
39}
40
41void 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
77ostream& 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}
std::ostream & EvtGenReport(EvtGenSeverity severity, const char *facility=nullptr)
Definition EvtReport.cpp:32
@ EVTGEN_INFO
Definition EvtReport.hh:52
@ EVTGEN_ERROR
Definition EvtReport.hh:49
ostream & operator<<(ostream &s, const EvtSecondary &secondary)
static int getStdHep(EvtId id)
Definition EvtPDL.cpp:356
EvtId getId() const
EvtParticle * getDaug(const int i)
size_t getNDaug() const
int m_id2[EVTSECONDARYLENGTH]
void createSecondary(int stdhepindex, EvtParticle *prnt)
int m_stdhepindex[EVTSECONDARYLENGTH]
int m_id3[EVTSECONDARYLENGTH]
int m_id1[EVTSECONDARYLENGTH]