12 #include "HepMC/GenEvent.h"
13 #include "HepMC/IO_GenEvent.h"
15 typedef std::vector<HepMC::GenParticle*> FlowVec;
33 const char outfile[] =
"testFlow.out";
34 std::ofstream os( outfile );
36 std::cerr <<
"cannot open " << outfile << std::endl;
44 std::ofstream xout4(
"testFlow.out4" );
45 std::ofstream xout5(
"testFlow.out5" );
67 evt->
use_units(HepMC::Units::GEV, HepMC::Units::MM);
129 FlowVec::iterator it;
130 os <<
"dangling partners of particle " << p1->
barcode() << std::endl;
131 for( it = result1.begin(); it != result1.end(); ++it ) {
132 os << (*it)->barcode() <<
" " ;
134 os << (*it)->pdg_id() <<
" " << (*it)->flow(1) << std::endl;
136 os <<
"all partners of particle " << p1->
barcode() << std::endl;
137 for( it = result2.begin(); it != result2.end(); ++it ) {
138 os << (*it)->barcode() <<
" " ;
140 os << (*it)->pdg_id() <<
" " << (*it)->flow(1) << std::endl;
144 os <<
"dangling partners of particle " << p2->
barcode() << std::endl;
145 for( it = result3.begin(); it != result3.end(); ++it ) {
146 os << (*it)->barcode() <<
" " ;
148 os << (*it)->pdg_id() <<
" " << (*it)->flow(1) << std::endl;
150 os <<
"all partners of particle " << p2->
barcode() << std::endl;
151 for( it = result4.begin(); it != result4.end(); ++it ) {
152 os << (*it)->barcode() <<
" " ;
154 os << (*it)->pdg_id() <<
" " << (*it)->flow(1) << std::endl;
168 if ( result4 != result5 ) {
169 std::cerr <<
"ERROR: list of partners has changed after adding flow" << std::endl;
178 std::cerr <<
"ERROR: first erase was NOT successful" << std::endl;
183 std::cerr <<
"ERROR: second erase was successful" << std::endl;
187 if ( result4 != result6 ) {
188 std::cerr <<
"ERROR: list of partners has changed after removing flow" << std::endl;
198 if( numbad > 0 ) std::cerr << numbad <<
" errors in testFlow" << std::endl;
void set_signal_process_vertex(GenVertex *)
set pointer to the vertex containing the signal process
void add_particle_in(GenParticle *inparticle)
add incoming particle
int barcode() const
particle barcode
void set_flow(const Flow &f)
set particle flow
std::vector< HepMC::GenParticle * > connected_partners(int code, int code_index=1, int num_indices=2) const
GenVertex contains information about decay vertices.
The GenEvent class is the core of HepMC.
IO_GenEvent also deals with HeavyIon and PdfInfo.
void add_particle_out(GenParticle *outparticle)
add outgoing particle
bool add_vertex(GenVertex *vtx)
adds to evt and adopts
std::ostream & write(std::ostream &)
void print(std::ostream &ostr=std::cout) const
dumps to ostr
const Flow & flow() const
particle flow
std::vector< HepMC::GenParticle * > dangling_connected_partners(int code, int code_index=1, int num_indices=2) const
FourVector is a simple representation of a physics 4 vector.
bool erase(int code_index)
empty flow pattern container
void use_units(Units::MomentumUnit, Units::LengthUnit)
int icode(int code_index=1) const
flow code
The GenParticle class contains information about generated particles.