BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
eformat::old Namespace Reference

Classes

class  FullEventFragment
 
class  Header
 
class  ROBFragment
 
class  RODFragment
 
class  ROSFragment
 
class  SubDetectorFragment
 

Functions

uint32_t convert_source (uint32_t old_id)
 
uint32_t convert (const uint32_t *src, uint32_t *dest, uint32_t max)
 

Detailed Description

Includes classes and non-member methods that allows provisional reading from event format v2.4. The main purpose of this functionality is conversion from the old to the new event format.

Function Documentation

◆ convert()

uint32_t eformat::old::convert ( const uint32_t *  src,
uint32_t *  dest,
uint32_t  max 
)

Converts a full event fragment, from the old to new format, using the space of contiguous memory storage area given. If the event given is already on v3.0 format, no conversion takes place.

Parameters
srcA pointer to the first word of the event, lying in a contiguous area of memory.
destThe destination area of memory, preallocated
maxThe maximum number of words that fit in the preallocated memory area "dest".
Returns
A counter, for the number of words copied from the source to the destination. If that number is zero, something wrong happened.

Definition at line 248 of file util24.cxx.

250{
251 using namespace eformat;
252
253 if (src[0] != FULL_EVENT) {
254 if (src[0] != ROS) {
255 throw EFORMAT_WRONG_MARKER(src[0], FULL_EVENT);
256 }
257 return convert_ros(src, dest, max);
258 }
259
260 //check version
261 helper::Version version(src[3]);
262 if (version.major2() == MAJOR_DEFAULT_VERSION) {
263 memcpy(dest, src, sizeof(uint32_t)*src[1]);
264 return src[1];
265 }
266 if (version.major2() != MAJOR_OLD_VERSION)
267 throw EFORMAT_BAD_VERSION(version.major2(), MAJOR_DEFAULT_VERSION);
268
269 //this is from the old major version of eformat, proceed with conversion
271 fe.check_tree(); //this may throw
272
273 //create the base FullEvent
274/**********renzy edit***/
275 //write::FullEventFragment nfe(convert_source(fe.source_id()),
277/**********renzy edit***/
278 fe.date(), fe.global_id(), fe.run_no(),
279 fe.lvl1_id(), fe.lvl1_trigger_type(),
280 fe.lvl2_trigger_info(), fe.event_filter_info());
281 nfe.status(fe.nstatus(), fe.status());
282 nfe.minor_version(version.minor2());
283
284/**********renzy edit***/
285 /*std::vector<write::SubDetectorFragment*> acc_sd;
286 std::vector<write::ROSFragment*> acc_ros;
287 std::vector<write::ROBFragment*> acc_rob;*/
288 std::vector<eformat::write::SubDetectorFragment*> acc_sd;
289 std::vector<eformat::write::ROSFragment*> acc_ros;
290 std::vector<eformat::write::ROBFragment*> acc_rob;
291/**********renzy edit***/
292 for (size_t i=0; i<fe.noffset(); ++i) {
293 old::SubDetectorFragment sd(fe.child(i));
294 //create the new subdetector and set _all_ relevant stuff
295/**********renzy edit***/
296 /*write::SubDetectorFragment* nsd =
297 new write::SubDetectorFragment(convert_source(sd.source_id()));*/
300/**********renzy edit***/
301 nsd->status(sd.nstatus(), sd.status());
302 helper::Version sd_version(sd.version());
303 nsd->minor_version(sd_version.minor2());
304
305 for (size_t j=0; j<sd.noffset(); ++j) {
306 old::ROSFragment ros(sd.child(j));
307/**********renzy edit***/
308 /*write::ROSFragment* nros =
309 new write::ROSFragment(convert_source(ros.source_id()),
310 ros.run_no(), ros.lvl1_id(), ros.bc_id());*/
312 new eformat::write::ROSFragment(convert_source(ros.source_id()),
313 ros.run_no(), ros.lvl1_id(), ros.bc_id());
314/**********renzy edit***/
315 nros->status(ros.nstatus(), ros.status());
316 helper::Version ros_version(ros.version());
317 nros->minor_version(ros_version.minor2());
318
319 for (size_t k=0; k<ros.noffset(); ++k) {
320 old::ROBFragment rob(ros.child(k));
321 uint32_t source_id = rob.source_id();
322
323 for (size_t l=0; l<rob.noffset(); ++l) {
324 old::RODFragment rod(rob.rod(l));
325 if (rob.noffset() != 1) source_id = rod.source_id();
326/**********renzy edit***/
327 //write::ROBFragment* nrob = new write::ROBFragment
329/**********renzy edit***/
330 (convert_source(source_id), rod.run_no(), rod.lvl1_id(),
331 rod.bc_id(), rod.lvl1_trigger_type(), rod.detev_type(),
332 rod.ndata(), rod.data(), rod.status_position());
333 nrob->status(rob.nstatus(), rob.status());
334 nrob->rod_status(rod.nstatus(), rod.status());
335 helper::Version rob_version(rob.version());
336 nrob->minor_version(rob_version.minor2());
337 helper::Version rod_version(rod.version());
338 nrob->rod_minor_version(rod_version.minor2());
339
340 //make this new ROB part of the new ROS
341 nros->append(nrob);
342 //make sure we don't forget to delete this guy
343 acc_rob.push_back(nrob);
344 }
345 }
346 //maks this new ROS part of the new SD
347 nsd->append(nros);
348 //make sure we don't forget to delete this guy
349 acc_ros.push_back(nros);
350 }
351 //make this new SD part of the new FE
352 nfe.append(nsd);
353 //make sure we don't forget to delete this guy
354 acc_sd.push_back(nsd);
355 }
356
357 //now the FullEvent is in `nfe', bind
358 const eformat::write::node_t* top = nfe.bind();
359 //memcpy the list of pages into contiguous memory
360 uint32_t retval = eformat::write::copy(*top, dest, max);
361
362 //delete the allocated stuff
363 for (size_t i=0; i<acc_rob.size(); ++i) delete acc_rob[i];
364 for (size_t i=0; i<acc_ros.size(); ++i) delete acc_ros[i];
365 for (size_t i=0; i<acc_sd.size(); ++i) delete acc_sd[i];
366
367 return retval;
368}
#define EFORMAT_BAD_VERSION(current, supported)
#define EFORMAT_WRONG_MARKER(current, expected)
void status(uint32_t n, const uint32_t *status)
void rod_status(uint32_t n, const uint32_t *status)
void rod_minor_version(uint16_t v)
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)
uint32_t convert_source(uint32_t old_id)
Definition: util24.cxx:28
uint32_t copy(const node_t &list, uint32_t *dest, size_t max)
Definition: node.cxx:64
uint32_t convert_ros(const uint32_t *src, uint32_t *dest, uint32_t max)
Definition: util24.cxx:176

◆ convert_source()

uint32_t eformat::old::convert_source ( uint32_t  old_id)

Gets an old source identitifier (v2.4) and transforms it into a new one, for version 3.0 of the event format

Parameters
old_idThe old source identifier

Definition at line 28 of file util24.cxx.

29{
30 using namespace eformat;
31
32 uint16_t id = old_id & 0x00ff;
33 uint8_t sd = ( old_id >> 8 ) & 0xff;
34 uint8_t md = ( old_id >> 16 ) & 0xff;
35 uint32_t retval = 0;
36
37 switch ((SubDetector)sd) {
38 case FULL_SD_EVENT:
39 case PIXEL_BARREL:
42 case PIXEL_B_LAYER:
58 case LAR_FCAL_A_SIDE:
59 case LAR_FCAL_C_SIDE:
76 case TDAQ_BEAM_CRATE:
79 case OTHER:
80 retval = sd;
81 break;
82 case TDAQ_CALO_CLUSTER_PROC_ROI: //old TDAQ_CALO_JET
83 retval = 0x74;
84 break;
85 case TDAQ_CALO_JET_PROC_DAQ: //old TDAQ_CTP
86 retval = 0x77;
87 break;
88 case TDAQ_CALO_JET_PROC_ROI: //old TDAQ_MUON_INTERFACE
89 retval = 0x76;
90 break;
91 case TDAQ_MUON_CTP_INTERFACE: //old TDAQ_DATAFLOW
92 switch (md) {
93 case 0x02: //LVL1 ROSes
94 case 0x04: //old SUPERVISOR
95 retval = 0x78; //new L2SV
96 break;
97 case 0x06: //old SFI
98 retval = 0x79; //new SFI
99 break;
100 case 0x07: //old SFO
101 retval = 0x7a; //new SFO
102 break;
103 case 0x0a: //old OTHER_MODULE
104 retval = OTHER; //new OTHER
105 break;
106 default:
107 ERS_WARN("%s%x%s%s",
108 "Propose an equivalent of the source identifier 0x", old_id,
109 " [v2.4], for the 3.0 format, to eformat developers.",
110 "The subdetector identifier field will be zero'd for now.");
111 }
112 break;
113 case TDAQ_CTP: //old TDAQ_LVL2
114 switch (md) {
115 case 0x01: //old L2PU->PROS
116 case 0x02: //old L2PU->PROS
117 case 0x05: //old HLT_PROCESSOR
118 retval = 0x7b; //new LVL2
119 break;
120 case 0x04: //old SUPERVISOR
121 retval = 0x78; //new L2SV
122 break;
123 case 0x06: //old SFI marker for PROS data
124 retval = 0x79; //new SFI
125 break;
126 default:
127 ERS_WARN("%s%x%s%s",
128 "Propose an equivalent of the source identifier 0x", old_id,
129 " [v2.4], for the 3.0 format, to eformat developers.",
130 "The subdetector identifier field will be zero'd for now.");
131 }
132 break;
133 case TDAQ_L2SV: //old TDAQ_EVENT_FILTER
134 switch (md) {
135 case 0x05: //old HLT_PROCESSOR
136 retval = 0x7b; //new LVL2
137 default:
138 ERS_WARN("%s%x%s%s",
139 "Propose an equivalent of the source identifier 0x", old_id,
140 " [v2.4], for the 3.0 format, to eformat developers.",
141 "The subdetector identifier field will be zero'd for now.");
142 }
143 break;
144 case TDAQ_SFI:
145 case TDAQ_SFO:
146 case TDAQ_LVL2:
148 default:
149 ERS_WARN("%s%x%s%s",
150 "Propose an equivalent of the source identifier 0x", old_id,
151 " [v2.4], for the 3.0 format, to eformat developers.",
152 "The subdetector identifier field will be zero'd for now.");
153 break;
154 }
155 retval <<= 16;
156 retval |= id;
157 ERS_DEBUG_3("Source identifier 0x%x [v2.4] was converted to 0x%x [v3.0]",
158 old_id, retval);
159 return retval;
160}
#define ERS_DEBUG_3(...)
#define ERS_WARN(...)
@ TILECAL_BARREL_C_SIDE
@ TILECAL_EXT_C_SIDE
@ MUON_CSC_ENDCAP_C_SIDE
@ TILECAL_LASER_CRATE
@ MUON_TGC_ENDCAP_C_SIDE
@ MUON_CSC_ENDCAP_A_SIDE
@ LAR_EM_ENDCAP_A_SIDE
@ TDAQ_MUON_CTP_INTERFACE
@ MUON_MDT_BARREL_A_SIDE
@ MUON_MDT_ENDCAP_C_SIDE
@ LAR_HAD_ENDCAP_C_SIDE
@ MUON_TGC_ENDCAP_A_SIDE
@ LAR_EM_BARREL_A_SIDE
@ LAR_EM_BARREL_C_SIDE
@ MUON_MDT_ENDCAP_A_SIDE
@ TDAQ_CALO_JET_PROC_ROI
@ LAR_HAD_ENDCAP_A_SIDE
@ TDAQ_CALO_CLUSTER_PROC_ROI
@ TILECAL_EXT_A_SIDE
@ TDAQ_CALO_CLUSTER_PROC_DAQ
@ TDAQ_CALO_JET_PROC_DAQ
@ TRT_ANCILLARY_CRATE
@ PIXEL_FORWARD_C_SIDE
@ PIXEL_FORWARD_A_SIDE
@ MUON_RPC_BARREL_C_SIDE
@ TILECAL_BARREL_A_SIDE
@ MUON_ANCILLARY_CRATE
@ LAR_EM_ENDCAP_C_SIDE
@ MUON_RPC_BARREL_A_SIDE
@ MUON_MDT_BARREL_C_SIDE

Referenced by convert().