00001
00002
00016 #include <fstream>
00017 #include <iostream>
00018 #include <cstdlib>
00019
00020 #include "eformat/eformat.h"
00021 #include "eformat/old/eformat.h"
00022
00026 const size_t MAX_EVENT_SIZE = 2500000;
00027
00031 int main (int argc, char** argv)
00032 {
00033 using namespace eformat;
00034
00035 if ( argc != 2 ) {
00036 std::cerr << "usage: " << argv[0] << " <file>" << std::endl;
00037 std::exit(1);
00038 }
00039
00040
00041 std::fstream in(argv[1], std::ios::in|std::ios::binary);
00042 if (!in) {
00043 std::cerr << "File `" << argv[1] << "' does not exist?!" << std::endl;
00044 std::exit(1);
00045 }
00046 uint32_t* event = new uint32_t[MAX_EVENT_SIZE];
00047
00048 while (true) {
00049
00050 if (!(next_fragment(in, event, MAX_EVENT_SIZE*4))) break;
00051
00052 try {
00053 old::FullEventFragment fe(event);
00054
00055 fe.check_tree();
00056
00057
00058 std::cout << "Event " << fe.lvl1_id() << " is Ok." << std::endl;
00059 }
00060 catch (eformat::Issue& ex) {
00061 std::cerr << std::endl
00062 << "Uncaught eformat issue: " << ex.what() << std::endl;
00063 std::cout << "Trying to continue..." << std::endl;
00064 continue;
00065 }
00066 catch (ers::Issue& ex) {
00067 std::cerr << std::endl
00068 << "Uncaught ERS issue: " << ex.what() << std::endl;
00069 delete[] event;
00070 std::exit(1);
00071 }
00072 catch (std::exception& ex) {
00073 std::cerr << std::endl
00074 << "Uncaught std exception: " << ex.what() << std::endl;
00075 delete[] event;
00076 std::exit(1);
00077 }
00078 catch (...) {
00079 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
00080 delete[] event;
00081 std::exit(1);
00082 }
00083
00084 }
00085
00086 delete[] event;
00087 return 0;
00088 }