BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
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

◆ main()

int main ( int  ,
char **   
)

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

24{
25 using namespace eformat;
26
27 //create the dummy ROD contents
28 uint32_t dummy_data[256];
29 for (size_t i=0; i<256; ++i) dummy_data[i] = i;
30
31 helper::SourceIdentifier src1(LAR_EM_BARREL_A_SIDE, 0);
32 helper::SourceIdentifier src2(LAR_EM_BARREL_A_SIDE, 1);
33 helper::SourceIdentifier src3(LAR_EM_BARREL_A_SIDE, 2);
34 const uint32_t run_no = 1001;
35 const uint32_t lvl1_id = 2222;
36 const uint32_t bc_id = 3333;
37 const uint32_t lvl1_type = 2;
38 const uint32_t event_type = 1;
39 const uint32_t global_id = 5555;
40 const uint32_t lvl2_info = 3;
41 const uint32_t ef_info[4] = { 0, 1, 2, 3 };
42
43 write::ROBFragment rob1(src1.code(), run_no, lvl1_id, bc_id,
44 lvl1_type, event_type, 256, dummy_data,
46 write::ROBFragment rob2(src2.code(), run_no, lvl1_id, bc_id,
47 lvl1_type, event_type, 256, dummy_data,
49 write::ROBFragment rob3(src3.code(), run_no, lvl1_id, bc_id,
50 lvl1_type, event_type, 256, dummy_data,
52
53 write::ROSFragment ros(src1.code(), run_no, lvl1_id, bc_id);
54 ros.append(&rob1);
55 ros.append(&rob2);
56 ros.append(&rob3);
57
58 write::SubDetectorFragment sd(src1.code());
59 sd.append(&ros);
60
61 write::FullEventFragment fe(src1.code(), time(0), global_id, run_no,
62 lvl1_id, lvl1_type, lvl2_info, ef_info);
63 fe.append(&sd);
64
65 //get a handle to the top node
66 const write::node_t* fe_list = fe.bind();
67 struct iovec iov[128];
68 uint32_t total_pages = write::shallow_copy(*fe_list, iov, 128);
69 PagedMemory<> mem(iov, total_pages);
70
71 try {
72 FullEventFragment <PagedMemory<>::const_iterator> ferd(mem.begin());
73 ferd.check_tree();
74 //if check is ok, print the lvl1 identifier
75 std::cout << "Generated event seems Ok." << std::endl;
76 }
77 catch (eformat::Issue& ex) {
78 std::cerr << std::endl
79 << "Uncaught eformat issue: " << ex.what() << std::endl;
80 }
81 catch (ers::Issue& ex) {
82 std::cerr << std::endl
83 << "Uncaught ERS issue: " << ex.what() << std::endl;
84 }
85 catch (std::exception& ex) {
86 std::cerr << std::endl
87 << "Uncaught std exception: " << ex.what() << std::endl;
88 }
89 catch (...) {
90 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
91 }
92
93 return 0;
94}
Double_t time
Root Issue class.
const char * what() const
Human description message.
const uint32_t STATUS_FRONT
status goes in front of data block
Definition: Status.h:38