Test of file I/O.
 
#include <iostream>
 
int main(int argc, char **argv) {
 
    if( argc<3 ) {
        std::cout << "Usage: " << argv[0] << " <HepMC3_input_file> <output_file>" << std::endl;
        exit(-1);
    }
 
 
    int events_parsed = 0;
 
 
        
 
        
        if( input_file.
failed() ) 
break;
 
 
        
 
        if(events_parsed==0) {
            std::cout << " First event: " << std::endl;
 
            std::cout << " Testing attribute reading for the first event: " << std::endl;
 
 
            if(cs) {
                std::cout << " Has GenCrossSection:   ";
            }
            else std::cout << " No GenCrossSection " << std::endl;
 
            if(pi) {
                std::cout << " Has GenPdfInfo:        ";
            }
            else std::cout << " No GenPdfInfo " << std::endl;
 
            if(hi) {
                std::cout << " Has GenHeavyIon:       ";
            }
            else std::cout << " No GenHeavyIon " << std::endl;
        }
 
        ++events_parsed;
        if( events_parsed%100 == 0 ) std::cout<<"Events parsed: "<<events_parsed<<std::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.
std::shared_ptr< T > attribute(const std::string &name, const int &id=0) const
Get attribute of type T.
Stores additional information about Heavy Ion generator.
Stores additional information about PDFs.
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
static void line(std::ostream &os, const GenEvent &event, bool attributes=false)
Print one-line info.
GenEvent I/O parsing for structured text files.
bool read_event(GenEvent &evt) override
Load event from file.
bool failed() override
Return status of the stream.
void close() override
Close file stream.
GenEvent I/O serialization for structured text files.
void close() override
Close file stream.
void write_event(const GenEvent &evt) override
Write event to file.