32 {
34
35 if ( argc != 3 )
36 {
37 std::cerr << "usage: " << argv[0] << " <v2.4 file> <v3.0 file>" << std::endl;
38 std::exit( 1 );
39 }
40
41
42 std::fstream in( argv[1], std::ios::in | std::ios::binary );
43 if ( !in )
44 {
45 std::cerr << "File `" << argv[1] << "' does not exist?!" << std::endl;
46 std::exit( 1 );
47 }
48
49 std::fstream out( argv[2], std::ios::out | std::ios::binary );
50 if ( !out )
51 {
52 std::cerr << "Cannot write to `" << argv[1] << "?!" << std::endl;
53 std::exit( 1 );
54 }
55
58
59 while ( true )
60 {
61
63 uint32_t l1id = 0;
64
66
67 try
69 {
70 std::cerr <<
" !! WARNING: found event with format version = " <<
HEX( ex.
current() )
71 << std::endl;
73 {
74 std::cerr << " -> I cannot cope with this format. Skipping..." << std::endl;
75 continue;
76 }
77 else { std::cout << " -> Event will be simply copied..." << std::endl; }
79 {
80 std::cerr <<
"Uncaught eformat issue: " << ex.
what() << std::endl;
81 std::cerr << " -> Trying to continue..." << std::endl;
82 continue;
83 } catch ( ... )
84 {
85 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
86 delete[] event;
87 delete[] nevent;
88 std::exit( 1 );
89 }
90
91 try
92 {
93
94 std::cout <<
"Event #" << fe.lvl1_id() <<
" [" <<
HEX( fe.version() ) <<
"] -> ["
95 <<
HEX( 0x03000000 ) <<
"]" << std::endl;
98 nfe.check_tree();
99 l1id = nfe.lvl1_id();
101 {
102 std::cerr <<
"Uncaught eformat issue: " << ex.
what() << std::endl;
103 std::cerr << " -> Trying to continue..." << std::endl;
104 continue;
106 {
107 std::cerr <<
"Uncaught ERS issue: " << ex.
what() << std::endl;
108 delete[] event;
109 delete[] nevent;
110 std::exit( 1 );
111 } catch ( std::exception& ex )
112 {
113 std::cerr << "Uncaught std exception: " << ex.what() << std::endl;
114 delete[] event;
115 delete[] nevent;
116 std::exit( 1 );
117 } catch ( ... )
118 {
119 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
120 delete[] event;
121 delete[] nevent;
122 std::exit( 1 );
123 }
124 out.write( reinterpret_cast<char*>( nevent ), sizeof( uint32_t ) * nevent[1] );
125
126 std::cout << " -> (new) event #" << l1id << " converted, checked and saved." << std::endl;
127 }
128
129 delete[] event;
130 delete[] nevent;
131 return 0;
132}
const size_t MAX_EVENT_SIZE
const char * what() const
Human description message.