BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
Builder.cxx
Go to the documentation of this file.
1#include "GaudiKernel/Bootstrap.h"
2#include "GaudiKernel/ISvcLocator.h"
3#include "GaudiKernel/IJobOptionsSvc.h"
5
7
9{
10 // default 128k bytes buffer size, it's dangerous!!!
11 // a smarter method is expected !!!
12 m_buf = new uint32_t[32768];
13
14 if (!m_confFile.empty()) return;
15 m_propMgr.declareProperty("RawDataCnvConfFile", m_confFile);
16 m_propMgr.declareProperty("Status", m_status=0xFFFFFFFF); //fucd
17
18 // Get a pointer to the Job Options Service
19 IJobOptionsSvc* jobSvc;
20 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
21 jobSvc->setMyProperties("Builder", &m_propMgr);
22}
23
25 delete m_buf;
26}
27
28bool Builder::expect( ifstream &f, string msg, string fname )
29{
30 string str;
31 if( f.bad() )
32 {
33 cerr << "Error: file " << fname << " is bad" << endl;
34 return false;
35 }
36 f >> str;
37 if( str == msg )
38 return true;
39
40 cerr << "Error: expected `" << msg << "|" << str <<"` in " << fname << endl;
41 return false;
42}
43
44bool Builder::expectInt( ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2 )
45{
46 if( !expect( f, msg, fname ) || f.bad() )
47 return false;
48 f >> val1 >> val2;
49 return true;
50}
51
52bool Builder::expectLong(ifstream &f, string msg, string fname, uint64_t &val)
53{
54 if ( !expect(f, msg, fname) || f.bad() )
55 return false;
56 f >> val;
57 return true;
58}
59
60bool Builder::find( ifstream &f, string msg, string fname )
61{
62 if ( f.bad() ) {
63 cerr << "Error: file " << fname << " bad checked" << endl;
64 return false;
65 }
66
67 string str;
68 while ( !f.eof() ) {
69 f >> str;
70 if ( str == msg ) return true;
71 }
72
73 return false;
74}
75
76void Builder::append2event(WriteRawEvent*& re, uint32_t source_id, uint32_t size, uint32_t shift)
77{
78 uint32_t run_no = re->run_no();
79 uint32_t lvl1_id = re->lvl1_id();
80 uint32_t bc_id = 0; // ?
81 // ROB
83 source_id, // source_id
84 run_no, // run_no
85 lvl1_id, // lvl1_id
86 bc_id, // bc_id
87 0, // lvl1_type
88 0, // detev_type
89 size, // ndata
90 m_buf+shift, // data
91 0 // status_position
92 );
93 if(m_status==0xFFFFFFFF){
94 nrob->status(0, NULL);
95 nrob->rod_status(0, NULL);
96 }
97 else{ //fucd
98 nrob->status(1, &m_status);
99 nrob->rod_status(1, &m_status);
100 }
101 // ROS
103 source_id, // source_id
104 run_no, // run_no
105 lvl1_id, // lvl1_id
106 bc_id // bc_id
107 );
108 if(m_status==0xFFFFFFFF) nros->status(0, NULL);
109 else nros->status(1, &m_status); //fucd
110 // SubDetector
112 if(m_status==0xFFFFFFFF) nsd->status(0, NULL);
113 else nsd->status(1, &m_status); //fucd
114 // append to FullEventFragment
115 nros->append(nrob);
116 nsd->append(nros);
117 re->append(nsd);
118}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
#define NULL
void append2event(WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
Definition: Builder.cxx:76
static bool find(ifstream &f, string msg, string fname)
Definition: Builder.cxx:60
static bool expect(ifstream &f, string msg, string fname)
Definition: Builder.cxx:28
virtual ~Builder()
Definition: Builder.cxx:24
static bool expectLong(ifstream &f, string msg, string fname, uint64_t &val)
Definition: Builder.cxx:52
static bool expectInt(ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2)
Definition: Builder.cxx:44
Builder()
Definition: Builder.cxx:8
void append(eformat::write::SubDetectorFragment *sd)
void status(uint32_t n, const uint32_t *status)
void rod_status(uint32_t n, const uint32_t *status)
void status(uint32_t n, const uint32_t *status)
void append(eformat::write::ROBFragment *rob)
void status(uint32_t n, const uint32_t *status)
void append(eformat::write::ROSFragment *ros)