10 #include "HepMC3TestUtils.h"
11 using namespace HepMC3;
15 if(inputA.failed())
return 1;
16 std::vector<std::shared_ptr<GenEvent> > evts;
17 while( !inputA.failed() )
19 std::shared_ptr<GenEvent> evt= std::make_shared<GenEvent>();
20 inputA.read_event(*evt);
21 if( inputA.failed() ) {printf(
"End of file reached. Exit.\n");
break;}
29 i=rand()% evts.size();
30 j=rand()% evts.size();
33 std::vector<GenVertexPtr> selectedVtx;
34 for (std::vector<GenParticlePtr>::const_iterator p=evts.at(i)->particles().begin();p!=evts.at(i)->particles().end();++p)
35 for (std::vector<GenVertexPtr>::iterator v=evts.at(j)->vertices().begin();v!=evts.at(j)->vertices().end();++v)
37 selectedVtx.push_back(*v);
41 if(outputA.failed())
return 2;
42 for (
size_t i=0;i<evts.size();i++) outputA.write_event(*evts[i]);
45 for (std::vector<GenVertexPtr>::const_iterator v=selectedVtx.begin();v!=selectedVtx.end();++v)
49 if (selectedVtx.front()->parent_event())
52 if(inputB.failed())
return 3;
54 if(outputB.failed())
return 4;
55 while( !inputB.failed() )
58 inputB.read_event(evt);
59 if( inputB.failed() ) {printf(
"End of file reached. Exit.\n");
break;}
60 outputB.write_event(evt);
65 return COMPARE_ASCII_FILES(
"fromfrominputDelete2.hepmc",
"inputDelete.hepmc");
GenEvent I/O serialization for structured text files.
GenEvent I/O parsing for structured text files.
Definition of class GenParticle.
Definition of class GenVertex.
Definition of class WriterAscii.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
Parser for HepMC2 I/O files.
Definition of class ReaderAsciiHepMC2.
Stores event-related information.
Definition of class ReaderAscii.
static void line(std::ostream &os, const GenEvent &event, bool attributes=false)
Print one-line info.
Definition of class WriterAsciiHepMC2.
Definition of static class Print.
int main(int argc, char **argv)
Definition of class GenEvent.
GenEvent I/O serialization for structured text files.