37 const auto *parentAlg =
dynamic_cast< const INamedInterface*
>(parent());
46 incidentSvc->addListener(
this,
"EndInputFile", 40);
49 ATH_MSG_DEBUG(
"Creating new xAOD::FileMetaData object to fill");
50 m_info = std::make_unique< xAOD::FileMetaData >();
51 m_aux = std::make_unique< xAOD::FileMetaDataAuxInfo >();
59 return StatusCode::SUCCESS;
65 if (inc.type() ==
"EndInputFile") {
69 ATH_MSG_DEBUG(
"Failed to fill FileMetaData with non-event info");
75 return StatusCode::SUCCESS;
80 return StatusCode::SUCCESS;
85 return StatusCode::SUCCESS;
93 ATH_MSG_DEBUG(
"Not writing empty or incomplete FileMetaData object");
94 return StatusCode::SUCCESS;
101 auto info = std::make_unique<xAOD::FileMetaData>();
102 auto aux = std::make_unique<xAOD::FileMetaDataAuxInfo>();
103 info->setStore(
aux.get());
111 float orig_mcProcID = -1;
112 std::vector<uint32_t> orig_runNumbers, orig_lumiBlocks;
115 if (!output->value(
"runNumbers", orig_runNumbers))
117 if (!output->value(
"lumiBlocks", orig_lumiBlocks))
122 ATH_MSG_DEBUG(
"FileMetaData payload replaced in store with content created for this stream");
125 ATH_MSG_DEBUG(
"Event information was not filled, restoring what we had");
128 if (!output->setValue(
"runNumbers", orig_runNumbers))
130 if (!output->setValue(
"lumiBlocks", orig_lumiBlocks))
138 return StatusCode::SUCCESS;
143 return StatusCode::SUCCESS;
153 ATH_MSG_DEBUG(
"Failed to fill FileMetaData with non-event info");
158 return StatusCode::SUCCESS;
163 StatusCode
sc = StatusCode::FAILURE;
170 if (eventInfo &&
sc.isSuccess()) {
186 }
catch (std::exception&) {
194 <<
", runNumbers, or lumiBlockNumbers");
200 return StatusCode::SUCCESS;
212 return StatusCode::SUCCESS;
231 std::string beamEnergy =
m_tagInfoMgr->findTag(
"beam_energy");
234 std::stof(beamEnergy));
235 }
catch (std::invalid_argument& e) {
236 ATH_MSG_DEBUG(
"beam energy \"" << beamEnergy <<
"\" tag could not be converted to float");
237 }
catch (std::out_of_range& e) {
238 ATH_MSG_DEBUG(
"converted beam energy value (\"" << beamEnergy <<
"\") outside float range");
241 std::string dataYear =
m_tagInfoMgr->findTag(
"data_year");
242 if (!dataYear.empty()) {
245 static_cast<uint32_t
>(std::stoul(dataYear)));
246 }
catch (std::invalid_argument& e) {
247 ATH_MSG_DEBUG(
"data year \"" << dataYear <<
"\" tag could not be converted to unsigned long");
248 }
catch (std::out_of_range& e) {
249 ATH_MSG_DEBUG(
"converted data year value (\"" << dataYear <<
"\") outside unsigned long range");
255 StatusCode
sc = StatusCode::FAILURE;
261 const coral::AttributeList * attrList =
nullptr;
262 if (simInfo &&
sc.isSuccess()) {
264 for (
const auto& itr : *payload) {
265 attrList = &(itr.second);
270 bool simFlavourSet{};
271 bool isDataOverlaySet{};
274 std::string key =
"SimulationFlavour";
275 if (attrList->exists(key)) {
276 std::string value = (*attrList)[key].data< std::string >();
279 if (value ==
"default")
283 simFlavourSet =
true;
288 std::string key =
"IsDataOverlay";
289 if (attrList->exists(key)) {
290 std::string attr = (*attrList)[key].data< std::string >();
292 isDataOverlaySet =
true;
297 if (!simFlavourSet || !isDataOverlaySet) {
302 <<
". Trying to get them from input metadata store." );
308 if (!simFlavourSet) {
309 std::string orig_simFlavour =
"none";
312 "Could not get xAOD::FileMetaData::simFlavour "
313 "from input metadata "
323 if (!isDataOverlaySet) {
324 bool orig_isDataOverlay =
false;
328 "xAOD::FileMetaData::isDataOverlay from input "
333 << orig_isDataOverlay);
350 }
catch (std::exception&) {
359 return StatusCode::SUCCESS;
367 if (
m_info->setValue(key, value))
370 ATH_MSG_DEBUG(
"error setting " << key <<
" to " << std::boolalpha << value
371 << std::noboolalpha);
372 }
catch (std::exception&) {
383 if (
m_info->setValue(key, value))
387 }
catch (std::exception&) {
398 if (
m_info->setValue(key, value))
402 }
catch (std::exception&) {
411 const std::string& value) {
412 if (value.empty())
return;
414 if (
m_info->setValue(key, value))
418 }
catch (std::exception&) {
425 const std::string&
type, uint32_t value) {
427 std::vector<uint32_t> list;
435 auto it = std::lower_bound(list.begin(), list.end(), value);
436 if (it == list.end() || (*it) != value) {
437 list.insert(it, value);
443 }
catch (std::exception& e) {
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
This class is a collection of AttributeLists where each one is associated with a channel number.
uint32_t lumiBlock() const
The current event's luminosity block number.
uint32_t runNumber() const
The current event's run number.
uint32_t mcChannelNumber() const
The MC generator's channel number.
::StatusCode StatusCode
StatusCode definition for legacy code.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
EventInfo_v1 EventInfo
Definition of the latest event info version.
FileMetaData_v1 FileMetaData
Declare the latest version of the class.