Test of file I/O.
#include <iostream>
int main(int argc, char **argv) {
if( argc<3 ) {
cout << "Usage: " << argv[0] << " <HepMC3_input_file> <output_file>" << endl;
exit(-1);
}
int events_parsed = 0;
if( input_file.
failed() )
break;
if(events_parsed==0) {
cout << " First event: " << endl;
Print::listing(evt);
Print::content(evt);
cout << " Testing attribute reading for the first event: " << endl;
if(cs) {
cout << " Has GenCrossSection: ";
Print::line(cs);
}
else cout << " No GenCrossSection " << endl;
if(pi) {
cout << " Has GenPdfInfo: ";
Print::line(pi);
}
else cout << " No GenPdfInfo " << endl;
if(hi) {
cout << " Has GenHeavyIon: ";
Print::line(hi);
}
else cout << " No GenHeavyIon " << endl;
}
++events_parsed;
if( events_parsed%100 == 0 ) cout<<"Events parsed: "<<events_parsed<<endl;
}
return 0;
}
Definition of class GenEvent.
Definition of static class Print.
Definition of class ReaderAscii.
Definition of class WriterAscii.
Stores additional information about cross-section.
Stores event-related information.
shared_ptr< T > attribute(const string &name, const int &id=0) const
Get attribute of type T.
Stores additional information about Heavy Ion generator.
Stores additional information about PDFs.
GenEvent I/O parsing for structured text files.
bool read_event(GenEvent &evt)
Load event from file.
void close()
Close file stream.
bool failed()
Return status of the stream.
GenEvent I/O serialization for structured text files.
void close()
Close file stream.
void write_event(const GenEvent &evt)
Write event to file.