19#include "MyRunClass.h" 
   31int main(
int argc, 
char **argv) {
 
   34        std::cout << 
"Usage: " << argv[0] << 
" <input_root_file> <output_hepmc3_file>" << std::endl;
 
   43    int events_parsed = 0;
 
   46    auto *my_run = (
MyRunClass*)fo.Get(
"MyRunClass");
 
   47    std::shared_ptr<GenRunInfo> run_info;
 
   49    if( my_run ) run_info.reset(my_run->GetRunInfo());
 
   52    fo.GetListOfKeys()->Print();
 
   54    TIter next(fo.GetListOfKeys());
 
   57    while ((key=(TKey*)next()))
 
   59        const char *cl = key->GetClassName();
 
   61        if( strncmp(cl,
"MyClass",7) != 0 ) 
continue;
 
   63        fo.GetObject(key->GetName(), myevent);
 
   65        std::cout << 
"Event: " << key->GetName() << std::endl;
 
   67        if( events_parsed == 0 ) {
 
   68            std::cout << 
"First event: " << std::endl;
 
   73            std::cout << 
"Setting run info" << std::endl;
 
   78        text_output.write_event(*(myevent->
GetEvent()));
 
   81        if( events_parsed%100 == 0 ) {
 
   82            std::cout << 
"Event: " << events_parsed << std::endl;
 
   91    std::cout << 
"Events parsed and written: " << events_parsed << std::endl;
 
Definition of class GenEvent.
Definition of class GenRunInfo.
Definition of static class Print.
Definition of class WriterAscii.
void set_run_info(std::shared_ptr< GenRunInfo > run)
Set the GenRunInfo object by smart pointer.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
GenEvent I/O serialization for structured text files.
Sample class for root I/O test.
GenEvent * GetEvent()
Get HepMC event.
Sample class for root I/O test.