15#include "HepMC3/ReaderFactory.h"
16#include "HepMC3TestUtils.h"
20 std::shared_ptr<Reader> input =
deduce_reader(
"inputReaderFactory2.hepmc");
21 if(input->failed())
return 1;
22 WriterAscii outputA(
"frominputReaderFactory2.hepmc3");
26 if(outputA.failed())
return 2;
27 if(outputB.failed())
return 3;
28 if(outputC.failed())
return 4;
29 if(outputD.failed())
return 5;
30 while( !input->failed() )
33 input->read_event(evt);
34 if( input->failed() ) {
35 printf(
"End of file reached. Exit.\n");
38 outputA.write_event(evt);
39 outputB.write_event(evt);
40 outputC.write_event(evt);
41 outputD.write_event(evt);
50 std::vector<std::shared_ptr<Reader> > inputv;
51 inputv.push_back(
deduce_reader(
"frominputReaderFactory2.hepmc3"));
52 inputv.push_back(
deduce_reader(
"frominputReaderFactory2.hepmc2"));
53 inputv.push_back(
deduce_reader(
"frominputReaderFactory2.hepevt"));
54 inputv.push_back(
deduce_reader(
"frominputReaderFactory2.root"));
56 std::vector<WriterAsciiHepMC2*> outputv;
63 for (
size_t i=0; i<inputv.size(); i++)
64 while( !inputv.at(i)->failed() )
67 inputv.at(i)->read_event(evt);
68 if( inputv.at(i)->failed() ) {
69 printf(
"End of file reached. Exit.\n");
72 outputv.at(i)->write_event(evt);
75 for (
size_t i=0; i<outputv.size(); i++) outputv.at(i)->close();
77 return COMPARE_ASCII_FILES(
"AA.hepmc2",
"BB.hepmc2")+COMPARE_ASCII_FILES(
"BB.hepmc2",
"DD.hepmc2");
Definition of class GenEvent.
Definition of class ReaderAsciiHepMC2.
Definition of class ReaderAscii.
Definition of class ReaderHEPEVT.
Definition of class ReaderRootTree.
Definition of class WriterAsciiHepMC2.
Definition of class WriterAscii.
Definition of class WriterHEPEVT.
Definition of class WriterRootTree.
Stores event-related information.
GenEvent I/O serialization for structured text files.
GenEvent I/O serialization for structured text files.
GenEvent I/O serialization for HEPEVT files.
GenEvent I/O serialization for root files based on root TTree.
std::shared_ptr< Reader > deduce_reader(std::istream &stream)
This function will deduce the type of input stream based on its content and will return appropriate R...