122 {
123
124
125#ifndef OnlineMode
126
127 m_re->reset();
128
129 try {
131 const uint32_t* ef = 0;
132 do {
133 f.assign( m_reader->nextEvent());
135 std::cerr << "Found invalid event (traceback):" << std::endl;
136 std::exit(1);
137 }
138
139
140
141
142
143
144
145 f.event_filter_info(ef);
146 if ( !ef ) {
147
148 exit(1);
149 }
150 else {
151
152
153 if ( ! m_keepRdm && ((*ef)>>31) != 0 ) {
154 continue;
155 }
156 }
157 break;
158 } while (true);
159
160 m_re->setRunNo(
f.run_no());
161 m_re->setEventNo(
f.global_id());
162 m_re->setTime(
f.time());
163 m_re->addReHltRaw((uint32_t*)ef, 4);
164
165
166 uint32_t hv_status = 0;
167 int nrobs = 0;
169 for ( int sdi = 0; sdi < nsds; ++sdi ) {
170 eformat::SubDetectorFragment<const uint32_t*> sd(m_sds[sdi]);
171
172 if ( sd.nspecific() != 0 ) {
173 const uint32_t* specific_header;
174 sd.specific_header(specific_header);
175 uint32_t source_id_number = sd.source_id();
176 source_id_number <<= 8;
177 source_id_number >>= 24;
178 switch( source_id_number ) {
179 case 161:
180 hv_status |= ((8 | ((*specific_header)&0x7)) << 8);
181 break;
182 case 162:
183 hv_status |= ((8 | ((*specific_header)&0x7)) << 4);
184 break;
185 case 164:
186 hv_status |= (8 | ((*specific_header)&0x7));
187 break;
188 default:
189 break;
190 }
191 }
192
194 }
195
196 m_re->setFlag1( hv_status );
197
198
199 for (int robi = 0; robi < nrobs; robi++) {
200 eformat::ROBFragment<uint32_t*> rob((uint32_t*)m_robs[robi]);
201
202 uint32_t* dataptr =
NULL;
203 rob.rod_data(dataptr);
204
205
206 uint32_t source_id_number = rob.rod_source_id();
207
208 source_id_number <<= 8;
209 source_id_number >>= 24;
210
211
212 if ((rob.rod_detev_type() & 0x2) != 0) {
213 if ( source_id_number == 165 ) {
214 m_re->addReEtsDigi(dataptr, rob.rod_ndata());
215 }
216 continue;
217 }
218
219
220 switch(source_id_number) {
221 case 161:
222 m_re->addReMdcDigi(dataptr, rob.rod_ndata());
223 break;
224 case 163:
225 m_re->addReEmcDigi(dataptr, rob.rod_ndata());
226 break;
227 case 162:
228 m_re->addReTofDigi(dataptr, rob.rod_ndata());
229 break;
230 case 167:
231 m_re->addReEtfDigi(dataptr, rob.rod_ndata());
232 break;
233 case 164:
234 m_re->addReMucDigi(dataptr, rob.rod_ndata());
235 break;
236 case 165:
237
238
239
240
241 m_re->addReTrigGTD(dataptr, rob.rod_ndata());
242 break;
243 case 166:
244 m_re->addReZddDigi(dataptr, rob.rod_ndata());
245 break;
246 case 124:
247 m_re->addReHltRaw(dataptr, rob.rod_ndata());
248 break;
249 case 241:
250 m_re->addMcParticle(dataptr, rob.rod_ndata());
251 break;
252 default:
253
254 break;
255 }
256 }
257 }
258 catch (RawFileException& ex) {
260 if ( m_reader->stat()&4 ) {
261 std::cerr << std::endl << "reading ifstream error !!!" << std::endl;
262 exit(1);
263 }
264 delete m_re;
266 }
267 catch (eformat::Issue& ex) {
268 std::cerr << std::endl <<
"Uncaught eformat issue: " << ex.
what() << std::endl;
269 }
270 catch (ers::Issue& ex) {
271 std::cerr << std::endl <<
"Uncaught ERS issue: " << ex.
what() << std::endl;
272 }
273 catch (std::exception& ex) {
274 std::cerr << std::endl << "Uncaught std exception: " << ex.what() << std::endl;
275 }
276 catch (...) {
277 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
278 }
279#endif
280
281 return m_re;
282}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
eformat::FullEventFragment< const uint32_t * > RawEvent
const char * what() const
Human description message.