BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
HltBuilder Class Reference

#include <HltBuilder.h>

+ Inheritance diagram for HltBuilder:

Public Member Functions

 HltBuilder ()
 
virtual ~HltBuilder ()
 
StatusCode initialize (string &initFile)
 
uint32_t getTEID (uint32_t reid)
 
uint32_t getREID (uint32_t teid)
 
void unPack (uint32_t reDigi, uint32_t n, uint32_t &REId, uint32_t &TEData1, uint32_t &TEData2)
 
StatusCode pack (HltRawCol *digiCol, WriteRawEvent *&re)
 
virtual StatusCode initialize (string &initFile)
 
virtual uint32_t getTEID (uint32_t teid)=0
 
virtual uint32_t getREID (uint32_t reid)=0
 

Additional Inherited Members

- Public Types inherited from Builder
typedef std::map< uint32_t, uint32_t > TE2REMAP
 
- Static Public Member Functions inherited from Builder
static bool expect (ifstream &f, string msg, string fname)
 
static bool expectInt (ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2)
 
static bool expectLong (ifstream &f, string msg, string fname, uint64_t &val)
 
static bool find (ifstream &f, string msg, string fname)
 
- Protected Member Functions inherited from Builder
 Builder ()
 
virtual ~Builder ()
 
void append2event (WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
 
- Protected Attributes inherited from Builder
PropertyMgr m_propMgr
 
uint32_t * m_buf
 
uint32_t m_status
 
- Static Protected Attributes inherited from Builder
static string m_confFile
 

Detailed Description

Definition at line 9 of file HltBuilder.h.

Constructor & Destructor Documentation

◆ HltBuilder()

HltBuilder::HltBuilder ( )

Definition at line 7 of file HltBuilder.cxx.

8 :Builder()
9{
10 // set vector size (2^14) and initialize to -1
11 m_re2te = new uint32_t[256]; // we have 2^8 different REID
12 memset((void*)m_re2te, 0xFF, 256*sizeof(uint32_t));
13
15}
Builder()
Definition: Builder.cxx:8
StatusCode initialize(string &initFile)
Definition: HltBuilder.cxx:98

◆ ~HltBuilder()

HltBuilder::~HltBuilder ( )
virtual

Definition at line 17 of file HltBuilder.cxx.

18{
19 delete m_re2te;
20}

Member Function Documentation

◆ getREID()

uint32_t HltBuilder::getREID ( uint32_t  teid)
virtual

Implements Builder.

Definition at line 143 of file HltBuilder.cxx.

144{
145
146 TE2REMAP::iterator itr = m_te2reMap.find(teid);
147
148 uint32_t reid = 0;
149 if(itr!= m_te2reMap.end())
150 reid = (*itr).second;
151 else
152 {
153 cout<<"wrong teid in emc "<<teid<<endl;
154 exit(8);
155 }
156
157 return reid;
158
159}

◆ getTEID()

uint32_t HltBuilder::getTEID ( uint32_t  reid)
inlinevirtual

Implements Builder.

Definition at line 16 of file HltBuilder.h.

16{ return m_re2te[reid]; }

Referenced by RawDataHltRawCnv::createObj().

◆ initialize()

StatusCode HltBuilder::initialize ( string &  initFile)
virtual

Reimplemented from Builder.

Definition at line 98 of file HltBuilder.cxx.

99{
100 ifstream f;
101
102 //-----------------------------------------------------------
103 // read initFile
104 f.open( initFile.c_str());
105
106 if( f.bad() )
107 {
108 cerr << "Error: could not open file " << initFile << endl;
109 return false;
110 }
111
112 if (!Builder::find( f, "##HltRawConf", initFile)) {
113 cerr << "Error: could not find '##HltRawConf' in file " << initFile << endl;
114 return StatusCode::FAILURE;
115 }
116
117 if( !Builder::expect( f, "#Index,mask", initFile) ||
118 !Builder::expectInt( f, "id", initFile, m_idIndex, m_idMask) ||
119 !Builder::expectInt( f, "alg", initFile, m_algIndex, m_algMask) ||
120 !Builder::expectInt( f, "cri", initFile, m_criIndex, m_criMask) ||
121 !Builder::expectInt( f, "var", initFile, m_varIndex, m_varMask))
122 return false;
123 f.close();
124
125 cout<<"HltBuilder:: #Index mask"<<endl
126 <<" "<<m_idIndex<<" "<<m_idMask<<endl
127 <<" "<<m_algIndex<<" "<<m_algMask<<endl
128 <<" "<<m_criIndex<<" "<<m_criMask<<endl
129 <<" "<<m_varIndex<<" "<<m_varMask<<endl;
130
131 //-----------------------------------------------------------
132 //Build re2te table
133 for (uint32_t i = 0; i < 256; i++) {
134 m_re2te[i] = (0x50000000 | i); //m_re2te[i]=0x50000000+0x00000000+i;
135 //if(i>4) m_re2te[i]+=0x00000000;
136 m_te2reMap.insert(TE2REMAP::value_type(m_re2te[i], i)) ;
137 }
138 // return successful initialization
139 return StatusCode::SUCCESS;
140}
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
static bool expectInt(ifstream &f, string msg, string fname, uint32_t &val1, uint32_t &val2)
Definition: Builder.cxx:44
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
std::ifstream ifstream
Definition: bpkt_streams.h:44

Referenced by HltBuilder().

◆ pack()

StatusCode HltBuilder::pack ( HltRawCol digiCol,
WriteRawEvent *&  re 
)

Definition at line 47 of file HltBuilder.cxx.

48{
49 if (digiCol == 0 ) {
50 cerr << "HltBuilder::pack can't get digiCol" << endl;
51 return StatusCode::FAILURE;
52 }
53
54 uint32_t size = 0;
55 uint32_t hltdigi = 0;
56 Identifier id;
57 uint32_t event_filter[4]={0,0,0,0};
58
59 HltRawCol::const_iterator pHltDigi = digiCol->begin();
60 for ( ; pHltDigi!= digiCol->end(); pHltDigi++) {
61 id = (*pHltDigi)->identify();
62 if(HltID::is_algorithm(id)){
63 uint32_t alg= (*pHltDigi)->getIntChannel();
64 uint32_t cri=0;
65 //cout << " debug by fucd: alg=" << alg << endl;
66 pHltDigi++;
67 if(!HltID::is_criteria((*pHltDigi)->identify())) {
68 pHltDigi--;
69 }
70 else {
71 cri= (*pHltDigi)->getIntChannel();
72 }
73 hltdigi = ((alg<<m_algIndex)&m_algMask) | ((cri<<m_algIndex)&m_criMask);
74 event_filter[1] =hltdigi;
75 }
76 else if(HltID::is_criteria(id)){
77 cerr<< "HltBuilder::pack(): HLT raw data error!" << endl;
78 return StatusCode::FAILURE;
79 }
80 else{
81 hltdigi = (*pHltDigi)->getIntChannel();
82 if(HltID::is_eventtype(id)) event_filter[0]=hltdigi;
83 else if(HltID::is_version(id)) event_filter[2]=hltdigi;
84 else if(HltID::is_energy(id)) event_filter[3]=hltdigi;
85 else m_buf[size++] = hltdigi;
86 }
87 //cout << " debug by fucd: digi="<< hex << hltdigi << dec <<endl;
88 }
89
90 re->event_filter_info(&event_filter[0]);
91 append2event(re, 0x7c0000, size);
92
93 return StatusCode::SUCCESS;
94}
void append2event(WriteRawEvent *&re, uint32_t source_id, uint32_t size, uint32_t shift=0)
Definition: Builder.cxx:76
static bool is_version(const Identifier &id)
Definition: HltID.cxx:90
static bool is_eventtype(const Identifier &id)
Definition: HltID.cxx:72
static bool is_algorithm(const Identifier &id)
Definition: HltID.cxx:78
static bool is_criteria(const Identifier &id)
Definition: HltID.cxx:84
static bool is_energy(const Identifier &id)
Definition: HltID.cxx:96

Referenced by RawDataHltRawCnv::createRep().

◆ unPack()

void HltBuilder::unPack ( uint32_t  reDigi,
uint32_t  n,
uint32_t &  REId,
uint32_t &  TEData1,
uint32_t &  TEData2 
)

Definition at line 22 of file HltBuilder.cxx.

24{
25 if ( n == 0 ) {
26 REId = 0;
27 TEData1 = reDigi;
28 TEData2 = 0;
29 }
30 else if ( n == 1 ) {
31 REId = 1;
32 TEData1 = (reDigi&m_algMask) >> m_algIndex;
33 TEData2 = (reDigi&m_criMask) >> m_criIndex;
34 //cout<<hex<<reDigi<<"=>"<<TEData1<<","<<TEData2<<endl
35 // <<m_algMask<<" "<<m_algIndex<<" "<<m_criMask
36 // <<" "<<m_criIndex<<dec<<endl;
37 }
38 else {
39 REId = n+1;
40 TEData1 =reDigi;
41 TEData2 =0;
42 }
43
44 return;
45}

Referenced by RawDataHltRawCnv::createObj().


The documentation for this class was generated from the following files: