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.
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/EvtPatches.hh"
25 
26 #include <iomanip>
27 #include <iostream>
28 using namespace std;
29 
31 {
32  _npart = 0;
33 }
34 
36 {
37  return _npart;
38 }
39 
41  int prntlast, int id )
42 {
43  _p4[_npart] = p4;
44  _x[_npart] = x;
45  _prntfirst[_npart] = prntfirst;
46  _prntlast[_npart] = prntlast;
47  _daugfirst[_npart] = -1;
48  _dauglast[_npart] = -1;
49  _id[_npart] = id;
50  _istat[_npart] = 1;
51 
52  //we also need to fix up the parents pointer to the daughter!
53 
54  if ( prntfirst >= 0 ) {
55  int i;
56  for ( i = prntfirst; i <= prntlast; i++ ) {
57  _istat[i] = 2;
58  if ( _daugfirst[i] == -1 )
59  _daugfirst[i] = _npart;
60  if ( _dauglast[i] < _npart )
61  _dauglast[i] = _npart;
62  }
63  }
64 
65  _npart++;
66 }
67 
69 {
70  int i;
71  for ( i = 0; i < _npart; i++ ) {
72  _x[i] += d;
73  }
74 }
75 
76 /*
77 ostream& operator<<(ostream& s, const EvtStdHep& stdhep){
78 
79  int w=s.width();
80  int p=s.precision();
81  std::ios::fmtflags f=s.flags();
82 
83 
84  s <<endl;
85  s << " N Id Ist M1 M2 DF DL px py pz E t x y z"<<endl;
86  int i;
87  for(i=0;i<stdhep._npart;i++){
88 
89  s.width(3);
90  s<<i<<" ";
91  s.width(7);
92  s<<stdhep._id[i]<<" ";
93  s.width(3);
94  s<<stdhep._istat[i]<<" ";
95  s.width(4);
96  s<<stdhep._prntfirst[i]<<" ";
97  s.width(4);
98  s<<stdhep._prntlast[i]<<" ";
99  s.width(4);
100  s<<stdhep._daugfirst[i]<<" ";
101  s.width(4);
102  s<<stdhep._dauglast[i]<<" ";
103  s.width(7);
104  s.precision(4);
105  s<<setiosflags( ios::right|ios::fixed );
106  s<<stdhep._p4[i].get(1)<<" ";
107  s.width(7);
108  s.precision(4);
109  s<<setiosflags( ios::right|ios::fixed );
110  s<<stdhep._p4[i].get(2)<<" ";
111  s.width(7);
112  s.precision(4);
113  s<<setiosflags( ios::right|ios::fixed );
114  s<<stdhep._p4[i].get(3)<<" ";
115  s.width(7);
116  s.precision(4);
117  s<<setiosflags( ios::right|ios::fixed );
118  s<<stdhep._p4[i].get(0)<<" ";
119  s.width(7);
120  s.precision(4);
121  s<<setiosflags( ios::right|ios::fixed );
122  s<<stdhep._x[i].get(0)<<" ";
123  s.width(7);
124  s.precision(4);
125  s<<setiosflags( ios::right|ios::fixed );
126  s<<stdhep._x[i].get(1)<<" ";
127  s.width(7);
128  s.precision(4);
129  s<<setiosflags( ios::right|ios::fixed );
130  s<<stdhep._x[i].get(2)<<" ";
131  s.width(7);
132  s.precision(4);
133  s<<setiosflags( ios::right|ios::fixed );
134  s<<stdhep._x[i].get(3)<<endl;
135  s.width(0);
136  }
137 
138  s<<endl;
139 
140  s.width(w);
141  s.precision(p);
142  s.flags((std::ios::fmtflags)f);
143 
144  return s;
145 
146 }
147 
148 */
void createParticle(EvtVector4R p4, EvtVector4R x, int prntfirst, int prntlast, int id)
Definition: EvtStdHep.cpp:40
int getNPart()
Definition: EvtStdHep.cpp:35
void translate(EvtVector4R d)
Definition: EvtStdHep.cpp:68
void init()
Definition: EvtStdHep.cpp:30