Skip to content
Snippets Groups Projects
Commit b8028e34 authored by Frank Berghaus's avatar Frank Berghaus :cityscape:
Browse files

Update generation parameter channel number on EVNT-to-EVNT filtering

Cange the channel number where the generation parameters are found in
the conditions attributes when updating run and MC channel numbers
during generator level filtering. Also update the MC channel number in
the /TagInfo if it exists.
parent 0da07186
No related branches found
No related tags found
1 merge request!39434Sweep IOV channel number fix to master
...@@ -12,11 +12,11 @@ atlas_add_library( EvgenProdToolsLib ...@@ -12,11 +12,11 @@ atlas_add_library( EvgenProdToolsLib
PUBLIC_HEADERS EvgenProdTools PUBLIC_HEADERS EvgenProdTools
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AtlasHepMCsearchLib AthenaBaseComps TruthHelper GeneratorModulesLib GenInterfacesLib LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AtlasHepMCsearchLib AthenaBaseComps TruthHelper GeneratorModulesLib GenInterfacesLib
PRIVATE_LINK_LIBRARIES AthenaKernel EventInfo GaudiKernel TruthUtils ) PRIVATE_LINK_LIBRARIES AthenaKernel EventInfo GaudiKernel TruthUtils IOVDbDataModel AthenaPoolUtilities )
atlas_add_component( EvgenProdTools atlas_add_component( EvgenProdTools
src/components/*.cxx src/components/*.cxx
LINK_LIBRARIES EvgenProdToolsLib ) LINK_LIBRARIES EvgenProdToolsLib IOVDbDataModel AthenaPoolUtilities )
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
......
...@@ -28,6 +28,8 @@ public: ...@@ -28,6 +28,8 @@ public:
private: private:
ServiceHandle< StoreGateSvc > m_metaDataStore{
"StoreGateSvc/MetaDataStore", name()};
int m_nPass; int m_nPass;
int m_nCount; int m_nCount;
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
#include "EventInfo/EventInfo.h" #include "EventInfo/EventInfo.h"
#include "EventInfo/EventID.h" #include "EventInfo/EventID.h"
#include "EventInfo/EventType.h" #include "EventInfo/EventType.h"
#include "IOVDbDataModel/IOVMetaDataContainer.h"
#include "IOVDbDataModel/IOVPayloadContainer.h"
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include <cmath> #include <cmath>
#include <cassert> #include <cassert>
...@@ -100,10 +103,12 @@ else{ ...@@ -100,10 +103,12 @@ else{
// Change the EventID in the eventinfo header // Change the EventID in the eventinfo header
const EventInfo* pInputEvt(0); const EventInfo* pInputEvt(0);
ATH_MSG_INFO("Set new run number called !!" << m_newRunNumber); ATH_MSG_INFO("Set new run number called !!" << m_newRunNumber);
unsigned int oldRunNumber = 0;
if (evtStore()->retrieve(pInputEvt).isSuccess()) { if (evtStore()->retrieve(pInputEvt).isSuccess()) {
assert(pInputEvt); assert(pInputEvt);
EventID* eventID = const_cast<EventID*>(pInputEvt->event_ID()); EventID* eventID = const_cast<EventID*>(pInputEvt->event_ID());
ATH_MSG_INFO("git eventid !! " ); ATH_MSG_INFO("git eventid !! " );
oldRunNumber = eventID->run_number();
eventID->set_run_number(m_newRunNumber); eventID->set_run_number(m_newRunNumber);
ATH_MSG_INFO("Set new run number" << m_newRunNumber); ATH_MSG_INFO("Set new run number" << m_newRunNumber);
ATH_MSG_DEBUG("Set new run number in event_ID"); ATH_MSG_DEBUG("Set new run number in event_ID");
...@@ -118,6 +123,65 @@ else{ ...@@ -118,6 +123,65 @@ else{
ATH_MSG_ERROR("No EventInfo object found"); ATH_MSG_ERROR("No EventInfo object found");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
{
// change the channel number where /Generation/Parameters are found
auto newChannelNumber =
static_cast< const CondAttrListCollection::ChanNum >(m_newRunNumber);
auto oldChannelNumber =
static_cast< const CondAttrListCollection::ChanNum >(oldRunNumber);
const char* key = "/Generation/Parameters";
const IOVMetaDataContainer * iovContainer = nullptr;
if (m_metaDataStore->retrieve(iovContainer, key).isSuccess()
&& iovContainer) {
// get a hold of the payload
const IOVPayloadContainer * payloadContainer =
iovContainer->payloadContainer();
// Grab the attribute list
for (CondAttrListCollection* collection : *payloadContainer) {
for(unsigned int index = 0; index < collection->size(); ++index) {
if (collection->chanNum(index) != oldChannelNumber) {
ATH_MSG_INFO("Not updating \"" << key << "\" on channel number "
<< collection->chanNum(index));
continue;
}
if (collection->fixChanNum(oldChannelNumber, newChannelNumber))
ATH_MSG_INFO("Updated \"" << key << "\" channel number from "
<< oldChannelNumber << " to " << newChannelNumber);
else
ATH_MSG_ERROR("Channel number update from " << oldChannelNumber
<< " to " << newChannelNumber << " on \"" << key
<< "\" FAILED");
}
}
{
// Update the MC channel number in the "/TagInfo"
const char* key = "/TagInfo";
const IOVMetaDataContainer * iovContainer = nullptr;
if (m_metaDataStore->retrieve(iovContainer, key).isSuccess()
&& iovContainer) {
// get a hold of the payload
const IOVPayloadContainer * payloadContainer =
iovContainer->payloadContainer();
// Grab the attribute list
for (CondAttrListCollection* collection : *payloadContainer) {
for (auto pair : *collection) {
// pair is a pair of Channel number and AttributeList
if (pair.second.exists("mc_channel_number"))
pair.second["mc_channel_number"].setValue(m_newRunNumber);
}
}
}
}
} else {
ATH_MSG_INFO("Could not retrieve \"" << key << "\" from MetaDataStore");
}
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment