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