ATLAS Offline Software
Loading...
Searching...
No Matches
offline_eformat::v50 Namespace Reference

Functions

uint32_t convert_to_40 (const uint32_t *src, uint32_t *dest, uint32_t max, eformat::CheckSum event_checksum, eformat::CheckSum rob_checksum)

Function Documentation

◆ convert_to_40()

uint32_t offline_eformat::v50::convert_to_40 ( const uint32_t * src,
uint32_t * dest,
uint32_t max,
eformat::CheckSum event_checksum,
eformat::CheckSum rob_checksum )

Definition at line 42 of file v50_util.cxx.

46{
47 // this has to do the opposite of what eformat::v40::convert
48 // is doing (for current = v50).
49
50 eformat::helper::Version version(0, eformat::MAJOR_V40_VERSION);
51
52 eformat::read::FullEventFragment fe(src);
53 fe.check(); //this may throw
54
55 // new version has 64-bit global id, cast it explicitly
56 uint32_t global_id = static_cast<uint32_t>(fe.global_id());
57
58 //create the base FullEvent
59 auto nfe = std::make_unique<v40_write::FullEventFragment>
60 (fe.source_id(), fe.bc_time_seconds(),
61 fe.bc_time_nanoseconds(),
62 global_id, fe.run_type(),
63 fe.run_no(), fe.lumi_block(),
64 fe.lvl1_id(), fe.bc_id(),
65 fe.lvl1_trigger_type());
66
67 nfe->lvl1_trigger_info(fe.nlvl1_trigger_info(), fe.lvl1_trigger_info());
68 nfe->lvl2_trigger_info(fe.nlvl2_trigger_info(), fe.lvl2_trigger_info());
69 nfe->event_filter_info(fe.nevent_filter_info(), fe.event_filter_info());
70 nfe->stream_tag(fe.nstream_tag(), fe.stream_tag());
71 nfe->status(fe.nstatus(), fe.status());
72 nfe->minor_version(version.minor_version());
73 nfe->checksum_type(event_checksum);
74
75 std::vector<v40_write::ROBFragment*> acc_rob;
76 for (size_t i=0; i<fe.nchildren(); ++i) {
77 try {
78 eformat::read::ROBFragment rob(fe.child(i));
79 rob.check(MAJOR_V50_VERSION);
81 new v40_write::ROBFragment(rob.source_id(),
82 rob.rod_run_no(),
83 rob.rod_lvl1_id(), rob.rod_bc_id(),
84 rob.rod_lvl1_trigger_type(),
85 rob.rod_detev_type(),
86 rob.rod_ndata(), rob.rod_data(),
87 rob.rod_status_position());
88 nrob->status(rob.nstatus(), rob.status());
89 nrob->rod_status(rob.rod_nstatus(), rob.rod_status());
90 eformat::helper::Version rob_version(rob.rod_version());
91 nrob->minor_version(rob_version.minor_version());
92 eformat::helper::Version rod_version(rob.rod_version());
93 nrob->rod_minor_version(rod_version.minor_version());
94 nrob->checksum_type(rob_checksum);
95
96 //make this new ROB part of the new ROS
97 nfe->append(nrob);
98 //make sure we don't forget to delete this guy
99 acc_rob.push_back(nrob);
100 }
101 catch (eformat::Issue& e) {
102 ers::warning(e);
103 ers::warning(EFORMAT_SKIPPED_FRAGMENT("ROB","FULL_EVENT",0));
104 //we skip this fragment, but do not loose the whole event
105 continue;
106 }
107 }
108
109 //now the FullEvent is in `nfe', bind
110 const eformat::write::node_t* top = nfe->bind();
111 //memcpy the list of pages into contiguous memory
112 uint32_t retval = eformat::write::copy(*top, dest, max);
113
114 //delete the allocated stuff
115 for (size_t i=0; i<acc_rob.size(); ++i) delete acc_rob[i];
116
117 return retval;
118}
@ top
#define max(a, b)
Definition cfImp.cxx:41
Defines a helper class to aid the creation of ROB fragments.
void checksum_type(uint32_t s)
Changes the check sum type for this fragment.
void rod_minor_version(uint16_t v)
Changes the minor version number of the underlying ROD fragment.
void status(uint32_t n, const uint32_t *status)
Changes the number of status words and the status words themselves from the fragment.
void rod_status(uint32_t n, const uint32_t *status)
Changes the number of status words and the status words themselves from the ROD fragment.
void minor_version(uint16_t v)
Changes the minor version number of the fragment.
setEventNumber uint32_t
#define EFORMAT_SKIPPED_FRAGMENT(ftype, ptype, sid)