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) |
uint32_t | convert_source (uint32_t old_id) |
uint32_t | convert (const uint32_t *src, uint32_t *dest, uint32_t max) |
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
old_id | The old source identifier |
Definition at line 28 of file util24.cxx.
References ERS_DEBUG_3, ERS_WARN, eformat::FULL_SD_EVENT, eformat::LAR_EM_BARREL_A_SIDE, eformat::LAR_EM_BARREL_C_SIDE, eformat::LAR_EM_ENDCAP_A_SIDE, eformat::LAR_EM_ENDCAP_C_SIDE, eformat::LAR_FCAL_A_SIDE, eformat::LAR_FCAL_C_SIDE, eformat::LAR_HAD_ENDCAP_A_SIDE, eformat::LAR_HAD_ENDCAP_C_SIDE, eformat::MUON_ANCILLARY_CRATE, eformat::MUON_CSC_ENDCAP_A_SIDE, eformat::MUON_CSC_ENDCAP_C_SIDE, eformat::MUON_MDT_BARREL_A_SIDE, eformat::MUON_MDT_BARREL_C_SIDE, eformat::MUON_MDT_ENDCAP_A_SIDE, eformat::MUON_MDT_ENDCAP_C_SIDE, eformat::MUON_RPC_BARREL_A_SIDE, eformat::MUON_RPC_BARREL_C_SIDE, eformat::MUON_TGC_ENDCAP_A_SIDE, eformat::MUON_TGC_ENDCAP_C_SIDE, eformat::OTHER, eformat::PIXEL_B_LAYER, eformat::PIXEL_BARREL, eformat::PIXEL_FORWARD_A_SIDE, eformat::PIXEL_FORWARD_C_SIDE, eformat::SCT_BARREL_A_SIDE, eformat::SCT_BARREL_C_SIDE, eformat::SCT_ENDCAP_A_SIDE, eformat::SCT_ENDCAP_C_SIDE, eformat::TDAQ_BEAM_CRATE, eformat::TDAQ_CALO_CLUSTER_PROC_DAQ, eformat::TDAQ_CALO_CLUSTER_PROC_ROI, eformat::TDAQ_CALO_JET_PROC_DAQ, eformat::TDAQ_CALO_JET_PROC_ROI, eformat::TDAQ_CALO_PREPROC, eformat::TDAQ_CTP, eformat::TDAQ_EVENT_FILTER, eformat::TDAQ_L2SV, eformat::TDAQ_LVL2, eformat::TDAQ_MUON_CTP_INTERFACE, eformat::TDAQ_SFI, eformat::TDAQ_SFO, eformat::TILECAL_BARREL_A_SIDE, eformat::TILECAL_BARREL_C_SIDE, eformat::TILECAL_EXT_A_SIDE, eformat::TILECAL_EXT_C_SIDE, eformat::TILECAL_LASER_CRATE, eformat::TRT_ANCILLARY_CRATE, eformat::TRT_BARREL_A_SIDE, eformat::TRT_BARREL_C_SIDE, eformat::TRT_ENDCAP_A_SIDE, and eformat::TRT_ENDCAP_C_SIDE.
Referenced by convert(), and convert_ros().
00029 { 00030 using namespace eformat; 00031 00032 uint16_t id = old_id & 0x00ff; 00033 uint8_t sd = ( old_id >> 8 ) & 0xff; 00034 uint8_t md = ( old_id >> 16 ) & 0xff; 00035 uint32_t retval = 0; 00036 00037 switch ((SubDetector)sd) { 00038 case FULL_SD_EVENT: 00039 case PIXEL_BARREL: 00040 case PIXEL_FORWARD_A_SIDE: 00041 case PIXEL_FORWARD_C_SIDE: 00042 case PIXEL_B_LAYER: 00043 case SCT_BARREL_A_SIDE: 00044 case SCT_BARREL_C_SIDE: 00045 case SCT_ENDCAP_A_SIDE: 00046 case SCT_ENDCAP_C_SIDE: 00047 case TRT_ANCILLARY_CRATE: 00048 case TRT_BARREL_A_SIDE: 00049 case TRT_BARREL_C_SIDE: 00050 case TRT_ENDCAP_A_SIDE: 00051 case TRT_ENDCAP_C_SIDE: 00052 case LAR_EM_BARREL_A_SIDE: 00053 case LAR_EM_BARREL_C_SIDE: 00054 case LAR_EM_ENDCAP_A_SIDE: 00055 case LAR_EM_ENDCAP_C_SIDE: 00056 case LAR_HAD_ENDCAP_A_SIDE: 00057 case LAR_HAD_ENDCAP_C_SIDE: 00058 case LAR_FCAL_A_SIDE: 00059 case LAR_FCAL_C_SIDE: 00060 case TILECAL_LASER_CRATE: 00061 case TILECAL_BARREL_A_SIDE: 00062 case TILECAL_BARREL_C_SIDE: 00063 case TILECAL_EXT_A_SIDE: 00064 case TILECAL_EXT_C_SIDE: 00065 case MUON_ANCILLARY_CRATE: 00066 case MUON_MDT_BARREL_A_SIDE: 00067 case MUON_MDT_BARREL_C_SIDE: 00068 case MUON_MDT_ENDCAP_A_SIDE: 00069 case MUON_MDT_ENDCAP_C_SIDE: 00070 case MUON_RPC_BARREL_A_SIDE: 00071 case MUON_RPC_BARREL_C_SIDE: 00072 case MUON_TGC_ENDCAP_A_SIDE: 00073 case MUON_TGC_ENDCAP_C_SIDE: 00074 case MUON_CSC_ENDCAP_A_SIDE: 00075 case MUON_CSC_ENDCAP_C_SIDE: 00076 case TDAQ_BEAM_CRATE: 00077 case TDAQ_CALO_PREPROC: 00078 case TDAQ_CALO_CLUSTER_PROC_DAQ: 00079 case OTHER: 00080 retval = sd; 00081 break; 00082 case TDAQ_CALO_CLUSTER_PROC_ROI: //old TDAQ_CALO_JET 00083 retval = 0x74; 00084 break; 00085 case TDAQ_CALO_JET_PROC_DAQ: //old TDAQ_CTP 00086 retval = 0x77; 00087 break; 00088 case TDAQ_CALO_JET_PROC_ROI: //old TDAQ_MUON_INTERFACE 00089 retval = 0x76; 00090 break; 00091 case TDAQ_MUON_CTP_INTERFACE: //old TDAQ_DATAFLOW 00092 switch (md) { 00093 case 0x02: //LVL1 ROSes 00094 case 0x04: //old SUPERVISOR 00095 retval = 0x78; //new L2SV 00096 break; 00097 case 0x06: //old SFI 00098 retval = 0x79; //new SFI 00099 break; 00100 case 0x07: //old SFO 00101 retval = 0x7a; //new SFO 00102 break; 00103 case 0x0a: //old OTHER_MODULE 00104 retval = OTHER; //new OTHER 00105 break; 00106 default: 00107 ERS_WARN("%s%x%s%s", 00108 "Propose an equivalent of the source identifier 0x", old_id, 00109 " [v2.4], for the 3.0 format, to eformat developers.", 00110 "The subdetector identifier field will be zero'd for now."); 00111 } 00112 break; 00113 case TDAQ_CTP: //old TDAQ_LVL2 00114 switch (md) { 00115 case 0x01: //old L2PU->PROS 00116 case 0x02: //old L2PU->PROS 00117 case 0x05: //old HLT_PROCESSOR 00118 retval = 0x7b; //new LVL2 00119 break; 00120 case 0x04: //old SUPERVISOR 00121 retval = 0x78; //new L2SV 00122 break; 00123 case 0x06: //old SFI marker for PROS data 00124 retval = 0x79; //new SFI 00125 break; 00126 default: 00127 ERS_WARN("%s%x%s%s", 00128 "Propose an equivalent of the source identifier 0x", old_id, 00129 " [v2.4], for the 3.0 format, to eformat developers.", 00130 "The subdetector identifier field will be zero'd for now."); 00131 } 00132 break; 00133 case TDAQ_L2SV: //old TDAQ_EVENT_FILTER 00134 switch (md) { 00135 case 0x05: //old HLT_PROCESSOR 00136 retval = 0x7b; //new LVL2 00137 default: 00138 ERS_WARN("%s%x%s%s", 00139 "Propose an equivalent of the source identifier 0x", old_id, 00140 " [v2.4], for the 3.0 format, to eformat developers.", 00141 "The subdetector identifier field will be zero'd for now."); 00142 } 00143 break; 00144 case TDAQ_SFI: 00145 case TDAQ_SFO: 00146 case TDAQ_LVL2: 00147 case TDAQ_EVENT_FILTER: 00148 default: 00149 ERS_WARN("%s%x%s%s", 00150 "Propose an equivalent of the source identifier 0x", old_id, 00151 " [v2.4], for the 3.0 format, to eformat developers.", 00152 "The subdetector identifier field will be zero'd for now."); 00153 break; 00154 } 00155 retval <<= 16; 00156 retval |= id; 00157 ERS_DEBUG_3("Source identifier 0x%x [v2.4] was converted to 0x%x [v3.0]", 00158 old_id, retval); 00159 return retval; 00160 }
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.
src | A pointer to the first word of the event, lying in a contiguous area of memory. | |
dest | The destination area of memory, preallocated | |
max | The maximum number of words that fit in the preallocated memory area "dest". |
Definition at line 248 of file util24.cxx.
References eformat::write::ROSFragment::append(), eformat::write::SubDetectorFragment::append(), eformat::old::FullEventFragment::check_tree(), eformat::old::Header::child(), convert_ros(), convert_source(), eformat::write::copy(), eformat::old::FullEventFragment::date(), EFORMAT_BAD_VERSION, EFORMAT_WRONG_MARKER, eformat::old::FullEventFragment::event_filter_info(), eformat::FULL_EVENT, eformat::old::FullEventFragment::global_id(), genRecEmupikp::i, ganga-rec::j, eformat::old::FullEventFragment::lvl1_id(), eformat::old::FullEventFragment::lvl1_trigger_type(), eformat::old::FullEventFragment::lvl2_trigger_info(), eformat::helper::Version::major2(), eformat::MAJOR_DEFAULT_VERSION, eformat::MAJOR_OLD_VERSION, eformat::helper::Version::minor2(), eformat::write::SubDetectorFragment::minor_version(), eformat::write::ROSFragment::minor_version(), eformat::write::ROBFragment::minor_version(), eformat::old::Header::noffset(), eformat::old::Header::nstatus(), eformat::write::ROBFragment::rod_minor_version(), eformat::write::ROBFragment::rod_status(), eformat::ROS, eformat::old::Header::run_no(), eformat::old::Header::source_id(), eformat::old::Header::status(), eformat::write::SubDetectorFragment::status(), eformat::write::ROSFragment::status(), and eformat::write::ROBFragment::status().
Referenced by main(), and unknown_toUtf16().
00250 { 00251 using namespace eformat; 00252 00253 if (src[0] != FULL_EVENT) { 00254 if (src[0] != ROS) { 00255 throw EFORMAT_WRONG_MARKER(src[0], FULL_EVENT); 00256 } 00257 return convert_ros(src, dest, max); 00258 } 00259 00260 //check version 00261 helper::Version version(src[3]); 00262 if (version.major2() == MAJOR_DEFAULT_VERSION) { 00263 memcpy(dest, src, sizeof(uint32_t)*src[1]); 00264 return src[1]; 00265 } 00266 if (version.major2() != MAJOR_OLD_VERSION) 00267 throw EFORMAT_BAD_VERSION(version.major2(), MAJOR_DEFAULT_VERSION); 00268 00269 //this is from the old major version of eformat, proceed with conversion 00270 old::FullEventFragment fe(src); 00271 fe.check_tree(); //this may throw 00272 00273 //create the base FullEvent 00274 /**********renzy edit***/ 00275 //write::FullEventFragment nfe(convert_source(fe.source_id()), 00276 eformat::write::FullEventFragment nfe(convert_source(fe.source_id()), 00277 /**********renzy edit***/ 00278 fe.date(), fe.global_id(), fe.run_no(), 00279 fe.lvl1_id(), fe.lvl1_trigger_type(), 00280 fe.lvl2_trigger_info(), fe.event_filter_info()); 00281 nfe.status(fe.nstatus(), fe.status()); 00282 nfe.minor_version(version.minor2()); 00283 00284 /**********renzy edit***/ 00285 /*std::vector<write::SubDetectorFragment*> acc_sd; 00286 std::vector<write::ROSFragment*> acc_ros; 00287 std::vector<write::ROBFragment*> acc_rob;*/ 00288 std::vector<eformat::write::SubDetectorFragment*> acc_sd; 00289 std::vector<eformat::write::ROSFragment*> acc_ros; 00290 std::vector<eformat::write::ROBFragment*> acc_rob; 00291 /**********renzy edit***/ 00292 for (size_t i=0; i<fe.noffset(); ++i) { 00293 old::SubDetectorFragment sd(fe.child(i)); 00294 //create the new subdetector and set _all_ relevant stuff 00295 /**********renzy edit***/ 00296 /*write::SubDetectorFragment* nsd = 00297 new write::SubDetectorFragment(convert_source(sd.source_id()));*/ 00298 eformat::write::SubDetectorFragment* nsd = 00299 new eformat::write::SubDetectorFragment(convert_source(sd.source_id())); 00300 /**********renzy edit***/ 00301 nsd->status(sd.nstatus(), sd.status()); 00302 helper::Version sd_version(sd.version()); 00303 nsd->minor_version(sd_version.minor2()); 00304 00305 for (size_t j=0; j<sd.noffset(); ++j) { 00306 old::ROSFragment ros(sd.child(j)); 00307 /**********renzy edit***/ 00308 /*write::ROSFragment* nros = 00309 new write::ROSFragment(convert_source(ros.source_id()), 00310 ros.run_no(), ros.lvl1_id(), ros.bc_id());*/ 00311 eformat::write::ROSFragment* nros = 00312 new eformat::write::ROSFragment(convert_source(ros.source_id()), 00313 ros.run_no(), ros.lvl1_id(), ros.bc_id()); 00314 /**********renzy edit***/ 00315 nros->status(ros.nstatus(), ros.status()); 00316 helper::Version ros_version(ros.version()); 00317 nros->minor_version(ros_version.minor2()); 00318 00319 for (size_t k=0; k<ros.noffset(); ++k) { 00320 old::ROBFragment rob(ros.child(k)); 00321 uint32_t source_id = rob.source_id(); 00322 00323 for (size_t l=0; l<rob.noffset(); ++l) { 00324 old::RODFragment rod(rob.rod(l)); 00325 if (rob.noffset() != 1) source_id = rod.source_id(); 00326 /**********renzy edit***/ 00327 //write::ROBFragment* nrob = new write::ROBFragment 00328 eformat::write::ROBFragment* nrob = new eformat::write::ROBFragment 00329 /**********renzy edit***/ 00330 (convert_source(source_id), rod.run_no(), rod.lvl1_id(), 00331 rod.bc_id(), rod.lvl1_trigger_type(), rod.detev_type(), 00332 rod.ndata(), rod.data(), rod.status_position()); 00333 nrob->status(rob.nstatus(), rob.status()); 00334 nrob->rod_status(rod.nstatus(), rod.status()); 00335 helper::Version rob_version(rob.version()); 00336 nrob->minor_version(rob_version.minor2()); 00337 helper::Version rod_version(rod.version()); 00338 nrob->rod_minor_version(rod_version.minor2()); 00339 00340 //make this new ROB part of the new ROS 00341 nros->append(nrob); 00342 //make sure we don't forget to delete this guy 00343 acc_rob.push_back(nrob); 00344 } 00345 } 00346 //maks this new ROS part of the new SD 00347 nsd->append(nros); 00348 //make sure we don't forget to delete this guy 00349 acc_ros.push_back(nros); 00350 } 00351 //make this new SD part of the new FE 00352 nfe.append(nsd); 00353 //make sure we don't forget to delete this guy 00354 acc_sd.push_back(nsd); 00355 } 00356 00357 //now the FullEvent is in `nfe', bind 00358 const eformat::write::node_t* top = nfe.bind(); 00359 //memcpy the list of pages into contiguous memory 00360 uint32_t retval = eformat::write::copy(*top, dest, max); 00361 00362 //delete the allocated stuff 00363 for (size_t i=0; i<acc_rob.size(); ++i) delete acc_rob[i]; 00364 for (size_t i=0; i<acc_ros.size(); ++i) delete acc_ros[i]; 00365 for (size_t i=0; i<acc_sd.size(); ++i) delete acc_sd[i]; 00366 00367 return retval; 00368 }
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
old_id | The old source identifier |
Definition at line 28 of file util24.cxx.
References ERS_DEBUG_3, ERS_WARN, eformat::FULL_SD_EVENT, eformat::LAR_EM_BARREL_A_SIDE, eformat::LAR_EM_BARREL_C_SIDE, eformat::LAR_EM_ENDCAP_A_SIDE, eformat::LAR_EM_ENDCAP_C_SIDE, eformat::LAR_FCAL_A_SIDE, eformat::LAR_FCAL_C_SIDE, eformat::LAR_HAD_ENDCAP_A_SIDE, eformat::LAR_HAD_ENDCAP_C_SIDE, eformat::MUON_ANCILLARY_CRATE, eformat::MUON_CSC_ENDCAP_A_SIDE, eformat::MUON_CSC_ENDCAP_C_SIDE, eformat::MUON_MDT_BARREL_A_SIDE, eformat::MUON_MDT_BARREL_C_SIDE, eformat::MUON_MDT_ENDCAP_A_SIDE, eformat::MUON_MDT_ENDCAP_C_SIDE, eformat::MUON_RPC_BARREL_A_SIDE, eformat::MUON_RPC_BARREL_C_SIDE, eformat::MUON_TGC_ENDCAP_A_SIDE, eformat::MUON_TGC_ENDCAP_C_SIDE, eformat::OTHER, eformat::PIXEL_B_LAYER, eformat::PIXEL_BARREL, eformat::PIXEL_FORWARD_A_SIDE, eformat::PIXEL_FORWARD_C_SIDE, eformat::SCT_BARREL_A_SIDE, eformat::SCT_BARREL_C_SIDE, eformat::SCT_ENDCAP_A_SIDE, eformat::SCT_ENDCAP_C_SIDE, eformat::TDAQ_BEAM_CRATE, eformat::TDAQ_CALO_CLUSTER_PROC_DAQ, eformat::TDAQ_CALO_CLUSTER_PROC_ROI, eformat::TDAQ_CALO_JET_PROC_DAQ, eformat::TDAQ_CALO_JET_PROC_ROI, eformat::TDAQ_CALO_PREPROC, eformat::TDAQ_CTP, eformat::TDAQ_EVENT_FILTER, eformat::TDAQ_L2SV, eformat::TDAQ_LVL2, eformat::TDAQ_MUON_CTP_INTERFACE, eformat::TDAQ_SFI, eformat::TDAQ_SFO, eformat::TILECAL_BARREL_A_SIDE, eformat::TILECAL_BARREL_C_SIDE, eformat::TILECAL_EXT_A_SIDE, eformat::TILECAL_EXT_C_SIDE, eformat::TILECAL_LASER_CRATE, eformat::TRT_ANCILLARY_CRATE, eformat::TRT_BARREL_A_SIDE, eformat::TRT_BARREL_C_SIDE, eformat::TRT_ENDCAP_A_SIDE, and eformat::TRT_ENDCAP_C_SIDE.
Referenced by convert(), and convert_ros().
00029 { 00030 using namespace eformat; 00031 00032 uint16_t id = old_id & 0x00ff; 00033 uint8_t sd = ( old_id >> 8 ) & 0xff; 00034 uint8_t md = ( old_id >> 16 ) & 0xff; 00035 uint32_t retval = 0; 00036 00037 switch ((SubDetector)sd) { 00038 case FULL_SD_EVENT: 00039 case PIXEL_BARREL: 00040 case PIXEL_FORWARD_A_SIDE: 00041 case PIXEL_FORWARD_C_SIDE: 00042 case PIXEL_B_LAYER: 00043 case SCT_BARREL_A_SIDE: 00044 case SCT_BARREL_C_SIDE: 00045 case SCT_ENDCAP_A_SIDE: 00046 case SCT_ENDCAP_C_SIDE: 00047 case TRT_ANCILLARY_CRATE: 00048 case TRT_BARREL_A_SIDE: 00049 case TRT_BARREL_C_SIDE: 00050 case TRT_ENDCAP_A_SIDE: 00051 case TRT_ENDCAP_C_SIDE: 00052 case LAR_EM_BARREL_A_SIDE: 00053 case LAR_EM_BARREL_C_SIDE: 00054 case LAR_EM_ENDCAP_A_SIDE: 00055 case LAR_EM_ENDCAP_C_SIDE: 00056 case LAR_HAD_ENDCAP_A_SIDE: 00057 case LAR_HAD_ENDCAP_C_SIDE: 00058 case LAR_FCAL_A_SIDE: 00059 case LAR_FCAL_C_SIDE: 00060 case TILECAL_LASER_CRATE: 00061 case TILECAL_BARREL_A_SIDE: 00062 case TILECAL_BARREL_C_SIDE: 00063 case TILECAL_EXT_A_SIDE: 00064 case TILECAL_EXT_C_SIDE: 00065 case MUON_ANCILLARY_CRATE: 00066 case MUON_MDT_BARREL_A_SIDE: 00067 case MUON_MDT_BARREL_C_SIDE: 00068 case MUON_MDT_ENDCAP_A_SIDE: 00069 case MUON_MDT_ENDCAP_C_SIDE: 00070 case MUON_RPC_BARREL_A_SIDE: 00071 case MUON_RPC_BARREL_C_SIDE: 00072 case MUON_TGC_ENDCAP_A_SIDE: 00073 case MUON_TGC_ENDCAP_C_SIDE: 00074 case MUON_CSC_ENDCAP_A_SIDE: 00075 case MUON_CSC_ENDCAP_C_SIDE: 00076 case TDAQ_BEAM_CRATE: 00077 case TDAQ_CALO_PREPROC: 00078 case TDAQ_CALO_CLUSTER_PROC_DAQ: 00079 case OTHER: 00080 retval = sd; 00081 break; 00082 case TDAQ_CALO_CLUSTER_PROC_ROI: //old TDAQ_CALO_JET 00083 retval = 0x74; 00084 break; 00085 case TDAQ_CALO_JET_PROC_DAQ: //old TDAQ_CTP 00086 retval = 0x77; 00087 break; 00088 case TDAQ_CALO_JET_PROC_ROI: //old TDAQ_MUON_INTERFACE 00089 retval = 0x76; 00090 break; 00091 case TDAQ_MUON_CTP_INTERFACE: //old TDAQ_DATAFLOW 00092 switch (md) { 00093 case 0x02: //LVL1 ROSes 00094 case 0x04: //old SUPERVISOR 00095 retval = 0x78; //new L2SV 00096 break; 00097 case 0x06: //old SFI 00098 retval = 0x79; //new SFI 00099 break; 00100 case 0x07: //old SFO 00101 retval = 0x7a; //new SFO 00102 break; 00103 case 0x0a: //old OTHER_MODULE 00104 retval = OTHER; //new OTHER 00105 break; 00106 default: 00107 ERS_WARN("%s%x%s%s", 00108 "Propose an equivalent of the source identifier 0x", old_id, 00109 " [v2.4], for the 3.0 format, to eformat developers.", 00110 "The subdetector identifier field will be zero'd for now."); 00111 } 00112 break; 00113 case TDAQ_CTP: //old TDAQ_LVL2 00114 switch (md) { 00115 case 0x01: //old L2PU->PROS 00116 case 0x02: //old L2PU->PROS 00117 case 0x05: //old HLT_PROCESSOR 00118 retval = 0x7b; //new LVL2 00119 break; 00120 case 0x04: //old SUPERVISOR 00121 retval = 0x78; //new L2SV 00122 break; 00123 case 0x06: //old SFI marker for PROS data 00124 retval = 0x79; //new SFI 00125 break; 00126 default: 00127 ERS_WARN("%s%x%s%s", 00128 "Propose an equivalent of the source identifier 0x", old_id, 00129 " [v2.4], for the 3.0 format, to eformat developers.", 00130 "The subdetector identifier field will be zero'd for now."); 00131 } 00132 break; 00133 case TDAQ_L2SV: //old TDAQ_EVENT_FILTER 00134 switch (md) { 00135 case 0x05: //old HLT_PROCESSOR 00136 retval = 0x7b; //new LVL2 00137 default: 00138 ERS_WARN("%s%x%s%s", 00139 "Propose an equivalent of the source identifier 0x", old_id, 00140 " [v2.4], for the 3.0 format, to eformat developers.", 00141 "The subdetector identifier field will be zero'd for now."); 00142 } 00143 break; 00144 case TDAQ_SFI: 00145 case TDAQ_SFO: 00146 case TDAQ_LVL2: 00147 case TDAQ_EVENT_FILTER: 00148 default: 00149 ERS_WARN("%s%x%s%s", 00150 "Propose an equivalent of the source identifier 0x", old_id, 00151 " [v2.4], for the 3.0 format, to eformat developers.", 00152 "The subdetector identifier field will be zero'd for now."); 00153 break; 00154 } 00155 retval <<= 16; 00156 retval |= id; 00157 ERS_DEBUG_3("Source identifier 0x%x [v2.4] was converted to 0x%x [v3.0]", 00158 old_id, retval); 00159 return retval; 00160 }
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.
src | A pointer to the first word of the event, lying in a contiguous area of memory. | |
dest | The destination area of memory, preallocated | |
max | The maximum number of words that fit in the preallocated memory area "dest". |
Definition at line 248 of file util24.cxx.
References eformat::write::SubDetectorFragment::append(), eformat::write::ROSFragment::append(), eformat::old::FullEventFragment::check_tree(), eformat::old::Header::child(), convert_ros(), convert_source(), eformat::write::copy(), eformat::old::FullEventFragment::date(), EFORMAT_BAD_VERSION, EFORMAT_WRONG_MARKER, eformat::old::FullEventFragment::event_filter_info(), eformat::FULL_EVENT, eformat::old::FullEventFragment::global_id(), genRecEmupikp::i, ganga-rec::j, eformat::old::FullEventFragment::lvl1_id(), eformat::old::FullEventFragment::lvl1_trigger_type(), eformat::old::FullEventFragment::lvl2_trigger_info(), eformat::helper::Version::major2(), eformat::MAJOR_DEFAULT_VERSION, eformat::MAJOR_OLD_VERSION, eformat::helper::Version::minor2(), eformat::write::ROBFragment::minor_version(), eformat::write::ROSFragment::minor_version(), eformat::write::SubDetectorFragment::minor_version(), eformat::old::Header::noffset(), eformat::old::Header::nstatus(), eformat::write::ROBFragment::rod_minor_version(), eformat::write::ROBFragment::rod_status(), eformat::ROS, eformat::old::Header::run_no(), eformat::old::Header::source_id(), eformat::write::ROBFragment::status(), eformat::write::ROSFragment::status(), eformat::write::SubDetectorFragment::status(), and eformat::old::Header::status().
Referenced by main(), and unknown_toUtf16().
00250 { 00251 using namespace eformat; 00252 00253 if (src[0] != FULL_EVENT) { 00254 if (src[0] != ROS) { 00255 throw EFORMAT_WRONG_MARKER(src[0], FULL_EVENT); 00256 } 00257 return convert_ros(src, dest, max); 00258 } 00259 00260 //check version 00261 helper::Version version(src[3]); 00262 if (version.major2() == MAJOR_DEFAULT_VERSION) { 00263 memcpy(dest, src, sizeof(uint32_t)*src[1]); 00264 return src[1]; 00265 } 00266 if (version.major2() != MAJOR_OLD_VERSION) 00267 throw EFORMAT_BAD_VERSION(version.major2(), MAJOR_DEFAULT_VERSION); 00268 00269 //this is from the old major version of eformat, proceed with conversion 00270 old::FullEventFragment fe(src); 00271 fe.check_tree(); //this may throw 00272 00273 //create the base FullEvent 00274 /**********renzy edit***/ 00275 //write::FullEventFragment nfe(convert_source(fe.source_id()), 00276 eformat::write::FullEventFragment nfe(convert_source(fe.source_id()), 00277 /**********renzy edit***/ 00278 fe.date(), fe.global_id(), fe.run_no(), 00279 fe.lvl1_id(), fe.lvl1_trigger_type(), 00280 fe.lvl2_trigger_info(), fe.event_filter_info()); 00281 nfe.status(fe.nstatus(), fe.status()); 00282 nfe.minor_version(version.minor2()); 00283 00284 /**********renzy edit***/ 00285 /*std::vector<write::SubDetectorFragment*> acc_sd; 00286 std::vector<write::ROSFragment*> acc_ros; 00287 std::vector<write::ROBFragment*> acc_rob;*/ 00288 std::vector<eformat::write::SubDetectorFragment*> acc_sd; 00289 std::vector<eformat::write::ROSFragment*> acc_ros; 00290 std::vector<eformat::write::ROBFragment*> acc_rob; 00291 /**********renzy edit***/ 00292 for (size_t i=0; i<fe.noffset(); ++i) { 00293 old::SubDetectorFragment sd(fe.child(i)); 00294 //create the new subdetector and set _all_ relevant stuff 00295 /**********renzy edit***/ 00296 /*write::SubDetectorFragment* nsd = 00297 new write::SubDetectorFragment(convert_source(sd.source_id()));*/ 00298 eformat::write::SubDetectorFragment* nsd = 00299 new eformat::write::SubDetectorFragment(convert_source(sd.source_id())); 00300 /**********renzy edit***/ 00301 nsd->status(sd.nstatus(), sd.status()); 00302 helper::Version sd_version(sd.version()); 00303 nsd->minor_version(sd_version.minor2()); 00304 00305 for (size_t j=0; j<sd.noffset(); ++j) { 00306 old::ROSFragment ros(sd.child(j)); 00307 /**********renzy edit***/ 00308 /*write::ROSFragment* nros = 00309 new write::ROSFragment(convert_source(ros.source_id()), 00310 ros.run_no(), ros.lvl1_id(), ros.bc_id());*/ 00311 eformat::write::ROSFragment* nros = 00312 new eformat::write::ROSFragment(convert_source(ros.source_id()), 00313 ros.run_no(), ros.lvl1_id(), ros.bc_id()); 00314 /**********renzy edit***/ 00315 nros->status(ros.nstatus(), ros.status()); 00316 helper::Version ros_version(ros.version()); 00317 nros->minor_version(ros_version.minor2()); 00318 00319 for (size_t k=0; k<ros.noffset(); ++k) { 00320 old::ROBFragment rob(ros.child(k)); 00321 uint32_t source_id = rob.source_id(); 00322 00323 for (size_t l=0; l<rob.noffset(); ++l) { 00324 old::RODFragment rod(rob.rod(l)); 00325 if (rob.noffset() != 1) source_id = rod.source_id(); 00326 /**********renzy edit***/ 00327 //write::ROBFragment* nrob = new write::ROBFragment 00328 eformat::write::ROBFragment* nrob = new eformat::write::ROBFragment 00329 /**********renzy edit***/ 00330 (convert_source(source_id), rod.run_no(), rod.lvl1_id(), 00331 rod.bc_id(), rod.lvl1_trigger_type(), rod.detev_type(), 00332 rod.ndata(), rod.data(), rod.status_position()); 00333 nrob->status(rob.nstatus(), rob.status()); 00334 nrob->rod_status(rod.nstatus(), rod.status()); 00335 helper::Version rob_version(rob.version()); 00336 nrob->minor_version(rob_version.minor2()); 00337 helper::Version rod_version(rod.version()); 00338 nrob->rod_minor_version(rod_version.minor2()); 00339 00340 //make this new ROB part of the new ROS 00341 nros->append(nrob); 00342 //make sure we don't forget to delete this guy 00343 acc_rob.push_back(nrob); 00344 } 00345 } 00346 //maks this new ROS part of the new SD 00347 nsd->append(nros); 00348 //make sure we don't forget to delete this guy 00349 acc_ros.push_back(nros); 00350 } 00351 //make this new SD part of the new FE 00352 nfe.append(nsd); 00353 //make sure we don't forget to delete this guy 00354 acc_sd.push_back(nsd); 00355 } 00356 00357 //now the FullEvent is in `nfe', bind 00358 const eformat::write::node_t* top = nfe.bind(); 00359 //memcpy the list of pages into contiguous memory 00360 uint32_t retval = eformat::write::copy(*top, dest, max); 00361 00362 //delete the allocated stuff 00363 for (size_t i=0; i<acc_rob.size(); ++i) delete acc_rob[i]; 00364 for (size_t i=0; i<acc_ros.size(); ++i) delete acc_ros[i]; 00365 for (size_t i=0; i<acc_sd.size(); ++i) delete acc_sd[i]; 00366 00367 return retval; 00368 }