14 #include "HepMC3TestUtils.h"
15 using namespace HepMC3;
19 if(inputA.failed())
return 1;
20 std::vector<std::shared_ptr<GenEvent> > evts;
21 while( !inputA.failed() )
23 std::shared_ptr<GenEvent> evt= std::make_shared<GenEvent>();
24 inputA.read_event(*evt);
25 if( inputA.failed() ) {
26 printf(
"End of file reached. Exit.\n");
36 i=rand()% evts.size();
37 j=rand()% evts.size();
40 std::vector<GenVertexPtr> selectedVtx;
41 for (std::vector<GenParticlePtr>::const_iterator p=evts.at(i)->particles().begin(); p!=evts.at(i)->particles().end(); ++p)
42 for (std::vector<GenVertexPtr>::iterator v=evts.at(j)->vertices().begin(); v!=evts.at(j)->vertices().end(); ++v)
44 selectedVtx.push_back(*v);
48 if(outputA.failed())
return 2;
49 for (
size_t i=0; i<evts.size(); i++) outputA.write_event(*evts[i]);
52 for (std::vector<GenVertexPtr>::const_iterator v=selectedVtx.begin(); v!=selectedVtx.end(); ++v)
56 if (selectedVtx.front()->parent_event())
59 if(inputB.failed())
return 3;
61 if(outputB.failed())
return 4;
62 while( !inputB.failed() )
65 inputB.read_event(evt);
66 if( inputB.failed() ) {
67 printf(
"End of file reached. Exit.\n");
70 outputB.write_event(evt);
75 return COMPARE_ASCII_FILES(
"fromfrominputDelete2.hepmc",
"inputDelete2.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.