/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/eformat/eformat-00-00-04/test/simple-event.cxx File Reference

#include "eformat/eformat.h"
#include "eformat/write/eformat.h"
#include <sys/uio.h>
#include <cstdlib>
#include <ctime>
#include <iostream>

Go to the source code of this file.

Functions

int main (int, char **)


Detailed Description

Author:
Andre DOS ANJOS
Author
zhangy
Revision
1.1.1.1
Date
2009/06/19 07:35:41
This application will create a very simple event that contains 1 subdetector, that in turn contains 1 ROS, that in turn contains 1 ROB that contain 2 ROD's with equal contents, but different source identifiers. The event is then checked for conformity.

Definition in file simple-event.cxx.


Function Documentation

int main ( int  ,
char **   
)

Definition at line 23 of file simple-event.cxx.

References genRecEmupikp::i, eformat::LAR_EM_BARREL_A_SIDE, eformat::write::shallow_copy(), eformat::STATUS_FRONT, and ers::Issue::what().

00024 {
00025   using namespace eformat;
00026 
00027   //create the dummy ROD contents
00028   uint32_t dummy_data[256];
00029   for (size_t i=0; i<256; ++i) dummy_data[i] = i;
00030 
00031   helper::SourceIdentifier src1(LAR_EM_BARREL_A_SIDE, 0);
00032   helper::SourceIdentifier src2(LAR_EM_BARREL_A_SIDE, 1);
00033   helper::SourceIdentifier src3(LAR_EM_BARREL_A_SIDE, 2);
00034   const uint32_t run_no = 1001;
00035   const uint32_t lvl1_id = 2222;
00036   const uint32_t bc_id = 3333;
00037   const uint32_t lvl1_type = 2;
00038   const uint32_t event_type = 1;
00039   const uint32_t global_id = 5555;
00040   const uint32_t lvl2_info = 3;
00041   const uint32_t ef_info[4] = { 0, 1, 2, 3 };
00042 
00043   write::ROBFragment rob1(src1.code(), run_no, lvl1_id, bc_id,
00044                           lvl1_type, event_type, 256, dummy_data, 
00045                           eformat::STATUS_FRONT);
00046   write::ROBFragment rob2(src2.code(), run_no, lvl1_id, bc_id,
00047                           lvl1_type, event_type, 256, dummy_data, 
00048                           eformat::STATUS_FRONT);
00049   write::ROBFragment rob3(src3.code(), run_no, lvl1_id, bc_id,
00050                           lvl1_type, event_type, 256, dummy_data, 
00051                           eformat::STATUS_FRONT);
00052 
00053   write::ROSFragment ros(src1.code(), run_no, lvl1_id, bc_id);
00054   ros.append(&rob1);
00055   ros.append(&rob2);
00056   ros.append(&rob3);
00057   
00058   write::SubDetectorFragment sd(src1.code());
00059   sd.append(&ros);
00060 
00061   write::FullEventFragment fe(src1.code(), time(0), global_id, run_no,
00062                               lvl1_id, lvl1_type, lvl2_info, ef_info);
00063   fe.append(&sd);
00064 
00065   //get a handle to the top node
00066   const write::node_t* fe_list = fe.bind();
00067   struct iovec iov[128];
00068   uint32_t total_pages = write::shallow_copy(*fe_list, iov, 128);
00069   PagedMemory<> mem(iov, total_pages);
00070   
00071   try {
00072     FullEventFragment <PagedMemory<>::const_iterator> ferd(mem.begin());
00073     ferd.check_tree();
00074     //if check is ok, print the lvl1 identifier
00075     std::cout << "Generated event seems Ok." << std::endl;
00076   }
00077   catch (eformat::Issue& ex) {
00078     std::cerr << std::endl
00079               << "Uncaught eformat issue: " << ex.what() << std::endl;
00080   }
00081   catch (ers::Issue& ex) {
00082     std::cerr << std::endl
00083               << "Uncaught ERS issue: " << ex.what() << std::endl;
00084   }
00085   catch (std::exception& ex) {
00086     std::cerr << std::endl
00087               << "Uncaught std exception: " << ex.what() << std::endl;
00088   }
00089   catch (...) {
00090     std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
00091   }
00092   
00093   return 0;
00094 }


Generated on Tue Nov 29 23:15:04 2016 for BOSS_7.0.2 by  doxygen 1.4.7