ATLAS Offline Software
v50_util.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <algorithm>
6 
7 #include "v50_util.h"
8 #include "eformat/FullEventFragmentNoTemplates.h"
9 #include "eformat/ROBFragmentNoTemplates.h"
10 #include "v40_FullEventFragment.h"
12 #include "eformat/Issue.h"
13 
14 namespace {
15 
16 // This should have been defined in eformat itself but it's not
17 const uint16_t MAJOR_V50_VERSION = 0x0500;
18 
22 ERS_DECLARE_ISSUE_BASE(offline_eformat_err, SkippedFragmentIssue, eformat::Issue,
23  "Skipping " << ftype << " fragment in " << ptype
24  << " fragment with identifier 0x"
25  << EFORMAT_HEX(source_id), ERS_EMPTY,
26  ((std::string) ftype) ((std::string) ptype) ((uint32_t) source_id))
27 
28 
34 #define EFORMAT_SKIPPED_FRAGMENT(ftype,ptype,sid) \
35  offline_eformat_err::SkippedFragmentIssue(ERS_HERE, ftype, ptype, sid)
36 
37 }
38 
39 namespace offline_eformat {
40 namespace v50 {
41 
43  eformat::CheckSum event_checksum,
44  eformat::CheckSum rob_checksum)
45 
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 
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  v40_write::FullEventFragment nfe(fe.source_id(), fe.bc_time_seconds(),
60  fe.bc_time_nanoseconds(),
61  global_id, fe.run_type(),
62  fe.run_no(), fe.lumi_block(),
63  fe.lvl1_id(), fe.bc_id(),
64  fe.lvl1_trigger_type());
65 
66  nfe.lvl1_trigger_info(fe.nlvl1_trigger_info(), fe.lvl1_trigger_info());
67  nfe.lvl2_trigger_info(fe.nlvl2_trigger_info(), fe.lvl2_trigger_info());
68  nfe.event_filter_info(fe.nevent_filter_info(), fe.event_filter_info());
69  nfe.stream_tag(fe.nstream_tag(), fe.stream_tag());
70  nfe.status(fe.nstatus(), fe.status());
71  nfe.minor_version(version.minor_version());
72  nfe.checksum_type(event_checksum);
73 
74  std::vector<v40_write::ROBFragment*> acc_rob;
75  for (size_t i=0; i<fe.nchildren(); ++i) {
76  try {
77  eformat::read::ROBFragment rob(fe.child(i));
78  rob.check(MAJOR_V50_VERSION);
80  new v40_write::ROBFragment(rob.source_id(),
81  rob.rod_run_no(),
82  rob.rod_lvl1_id(), rob.rod_bc_id(),
83  rob.rod_lvl1_trigger_type(),
84  rob.rod_detev_type(),
85  rob.rod_ndata(), rob.rod_data(),
86  rob.rod_status_position());
87  nrob->status(rob.nstatus(), rob.status());
88  nrob->rod_status(rob.rod_nstatus(), rob.rod_status());
89  eformat::helper::Version rob_version(rob.rod_version());
90  nrob->minor_version(rob_version.minor_version());
91  eformat::helper::Version rod_version(rob.rod_version());
92  nrob->rod_minor_version(rod_version.minor_version());
93  nrob->checksum_type(rob_checksum);
94 
95  //make this new ROB part of the new ROS
96  nfe.append(nrob);
97  //make sure we don't forget to delete this guy
98  acc_rob.push_back(nrob);
99  }
100  catch (eformat::Issue& e) {
101  ers::warning(e);
102  ers::warning(EFORMAT_SKIPPED_FRAGMENT("ROB","FULL_EVENT",0));
103  //we skip this fragment, but do not loose the whole event
104  continue;
105  }
106  }
107 
108  //now the FullEvent is in `nfe', bind
109  const eformat::write::node_t* top = nfe.bind();
110  //memcpy the list of pages into contiguous memory
112 
113  //delete the allocated stuff
114  for (size_t i=0; i<acc_rob.size(); ++i) delete acc_rob[i];
115 
116  return retval;
117 }
118 
119 }} // namespace offline_eformat::v50
offline_eformat::v40_write::ROBFragment::minor_version
void minor_version(uint16_t v)
Changes the minor version number of the fragment.
Definition: v40_write_ROBFragment.h:208
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
max
#define max(a, b)
Definition: cfImp.cxx:41
v40_write_FullEventFragment.h
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
Issue
Configuration Issue
Definition: PscIssues.h:31
offline_eformat
Definition: util.h:19
EFORMAT_SKIPPED_FRAGMENT
#define EFORMAT_SKIPPED_FRAGMENT(ftype, ptype, sid)
offline_eformat::v40_write::ROBFragment::rod_minor_version
void rod_minor_version(uint16_t v)
Changes the minor version number of the underlying ROD fragment.
Definition: v40_write_ROBFragment.h:258
perfmonmt-printer.dest
dest
Definition: perfmonmt-printer.py:189
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment
eformat::FullEventFragment< PointerType > FullEventFragment
Definition: RawEvent.h:26
offline_eformat::v40_write::ROBFragment::rod_status
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.
Definition: v40_write_ROBFragment.cxx:289
offline_eformat::v40_write::FullEventFragment::bind
const eformat::write::node_t * bind(void)
Returns the first node of a list of nodes that represent the fragment you have constructed.
Definition: v40_write_FullEventFragment.cxx:273
offline_eformat::v40_write::FullEventFragment::minor_version
void minor_version(uint16_t v)
Changes the minor version number of the fragment.
Definition: v40_write_FullEventFragment.h:127
v40_FullEventFragment.h
LArCellBinning_test.retval
def retval
Definition: LArCellBinning_test.py:112
offline_eformat::v40_write::FullEventFragment::checksum_type
void checksum_type(uint32_t s)
Changes the check-sum type for this fragment.
Definition: v40_write_FullEventFragment.cxx:312
offline_eformat::v40_write::FullEventFragment::status
void status(uint32_t n, const uint32_t *status)
Changes the number of status words and the status words themselves from the fragment.
Definition: v40_write_FullEventFragment.cxx:171
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
offline_eformat::v40_write::FullEventFragment::lvl1_trigger_info
void lvl1_trigger_info(uint32_t n, const uint32_t *data)
Changes the LVL1 trigger info words from the fragment.
Definition: v40_write_FullEventFragment.cxx:185
lumiFormat.i
int i
Definition: lumiFormat.py:92
offline_eformat::v40_write::FullEventFragment::stream_tag
void stream_tag(uint32_t n, const uint32_t *data)
Changes the stream tag words from the fragment.
Definition: v40_write_FullEventFragment.cxx:227
offline_eformat::v40_write::FullEventFragment
Defines a helper class to aid the creation of FullEvent fragments.
Definition: v40_write_FullEventFragment.h:39
ERS_EMPTY
Configuration ERS_EMPTY
Definition: PscIssues.h:32
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition: RawEvent.h:27
offline_eformat::v40_write::FullEventFragment::lvl2_trigger_info
void lvl2_trigger_info(uint32_t n, const uint32_t *data)
Changes the LVL2 trigger info words from the fragment.
Definition: v40_write_FullEventFragment.cxx:199
offline_eformat::v40_write::FullEventFragment::append
void append(v40_write::ROBFragment *rob)
Appends a new ROB fragment to this FullEvent fragment.
Definition: v40_write_FullEventFragment.cxx:241
offline_eformat::v50::convert_to_40
uint32_t convert_to_40(const uint32_t *src, uint32_t *dest, uint32_t max, eformat::CheckSum event_checksum, eformat::CheckSum rob_checksum)
Definition: v50_util.cxx:42
get_generator_info.version
version
Definition: get_generator_info.py:33
v50_util.h
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
offline_eformat::v40_write::ROBFragment::checksum_type
void checksum_type(uint32_t s)
Changes the check sum type for this fragment.
Definition: v40_write_ROBFragment.cxx:334
ERS_DECLARE_ISSUE_BASE
ERS_DECLARE_ISSUE_BASE(afp, CantReadCool, dqm_core::Exception, "Cannot read folder '"<< folder<< "' from COOL database '"<< database<< "'", ERS_EMPTY,((std::string) database)((std::string) folder))
offline_eformat::v40_write::ROBFragment::status
void status(uint32_t n, const uint32_t *status)
Changes the number of status words and the status words themselves from the fragment.
Definition: v40_write_ROBFragment.cxx:274
offline_eformat::v40_write::ROBFragment
Defines a helper class to aid the creation of ROB fragments.
Definition: v40_write_ROBFragment.h:35
calibdata.copy
bool copy
Definition: calibdata.py:27
offline_eformat::v40_write::FullEventFragment::event_filter_info
void event_filter_info(uint32_t n, const uint32_t *data)
Changes the EF trigger info words from the fragment.
Definition: v40_write_FullEventFragment.cxx:213