Skip to content
Snippets Groups Projects
Commit a3fbb128 authored by Marcin Nowak's avatar Marcin Nowak :radioactive:
Browse files

Fix getPileUpEventInfo so it sets SG pointers only for new objects

parent 71dcba9d
No related branches found
No related tags found
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles,!20008migrate PileUpEventInfo to xAOD::EvenInfo
......@@ -304,7 +304,7 @@ StatusCode PileUpEventLoopMgr::nextEvent(int maxevt)
}
}
const xAOD::EventInfo* pEvent(0), *pEventSignal(0);
const xAOD::EventInfo* pEvent(nullptr), *pEventSignal(nullptr);
// loop over events if the maxevt (received as input) is different from -1.
// if evtmax is -1 it means infinite loop (till time limit that is)
......@@ -344,23 +344,11 @@ StatusCode PileUpEventLoopMgr::nextEvent(int maxevt)
pOverEvent->setStore( pOverEventAux );
ATH_MSG_INFO("MN: #subevents in orig =" << pEvent->subEvents().size());
if( pEvent->subEvents().size() > 1 ) {
ATH_MSG_INFO(" orig subev[1] link=" << pEvent->subEvents()[1].link() );
}
// Copy the eventInfo data from origStream event
*pOverEvent = *pEvent;
pOverEvent->clearSubEvents(); // start clean without any subevents
ATH_MSG_INFO("MN: #subevents in copy =" << pOverEvent->subEvents().size());
if( pOverEvent->subEvents().size() > 1 ) {
ATH_MSG_INFO(" copy subev[1] link=" << pOverEvent->subEvents()[1].link() );
}
ATH_MSG_INFO("MN: #subevents in orig =" << pEvent->subEvents().size());
if( pEvent->subEvents().size() > 1 ) {
ATH_MSG_INFO(" orig subev[1] link=" << pEvent->subEvents()[1].link() );
}
// Record the xAOD object(s):
CHECK( m_evtStore->record( pOverEventAux, "McEventInfoAux." ) );
CHECK( m_evtStore->record( pOverEvent, "McEventInfo" ) );
......@@ -437,7 +425,8 @@ StatusCode PileUpEventLoopMgr::nextEvent(int maxevt)
// link to the fresh EI added to the container:
ElementLink< xAOD::EventInfoContainer > eilink( puei_sg_key, puei->size()-1, &*m_evtStore );
xAOD::EventInfo::SubEvent subev( 0, pOverEvent->subEvents().size(), xAOD::EventInfo::Signal, eilink );
xAOD::EventInfo::SubEvent subev( 0, pOverEvent->subEvents().size(),
xAOD::EventInfo::Signal, eilink );
pOverEvent->addSubEvent( subev );
// pOverEvent->addSubEvt(0, PileUpTimeEventIndex::Signal, pEventSignal, &m_signalStream.store());
}
......@@ -465,7 +454,6 @@ StatusCode PileUpEventLoopMgr::nextEvent(int maxevt)
}
if( addpEvent ) {
ATH_MSG_INFO ( "MN: addpEvent" );
xAOD::EventInfo* ei = new xAOD::EventInfo( *pEvent );
ei->clearSubEvents(); // MN: FIX - verify that subevents should be cleared!
puei->push_back( ei );
......
......@@ -135,11 +135,15 @@ const xAOD::EventInfo* PileUpMergeSvc::getPileUpEvent( StoreGateSvc* sg, const s
: sg->tryConstRetrieve<xAOD::EventInfo>( einame );
if( xAODEventInfo ) {
ATH_MSG_INFO("Found xAOD::EventInfo");
ATH_MSG_INFO(" EventInfo has" << xAODEventInfo->subEvents().size() << " subevents" );
// the loop below serves 2 purposes: to recreate subevent links cache
// and set SG pointer in subevents
for( auto& subev : xAODEventInfo->subEvents() ) {
const_cast<xAOD::EventInfo*>(subev.ptr())->setEvtStore( sg );
ATH_MSG_INFO(" EventInfo has " << xAODEventInfo->subEvents().size() << " subevents" );
if( xAODEventInfo->evtStore() == nullptr ) {
// SG is 0 only when the xAODEventInfo is first read
xAODEventInfo->setEvtStore( sg );
// the loop below serves 2 purposes: to recreate subevent links cache
// and set SG pointer in subevents
for( auto& subev : xAODEventInfo->subEvents() ) {
subev.ptr()->setEvtStore( sg );
}
}
} else {
// Try reading old EventInfo
......@@ -154,6 +158,7 @@ const xAOD::EventInfo* PileUpMergeSvc::getPileUpEvent( StoreGateSvc* sg, const s
std::unique_ptr< xAOD::EventInfo > pxAODEventInfo( new xAOD::EventInfo() );
std::unique_ptr< xAOD::EventAuxInfo > pxAODEventAuxInfo(new xAOD::EventAuxInfo());
pxAODEventInfo->setStore( pxAODEventAuxInfo.get() );
pxAODEventInfo->setEvtStore( sg );
if( !m_xAODCnvTool->convert( pEvent, pxAODEventInfo.get(), false, false ).isSuccess() ) {
ATH_MSG_ERROR("Failed to convert xAOD::EventInfo in SG");
return nullptr;
......@@ -253,7 +258,6 @@ const xAOD::EventInfo* PileUpMergeSvc::getPileUpEvent( StoreGateSvc* sg, const s
}
if( xAODEventInfo ) {
const_cast<xAOD::EventInfo*>(xAODEventInfo)->setEvtStore( sg );
ATH_MSG_INFO("Dumping xAOD::EventInfo");
xAOD::dump( *xAODEventInfo );
} else {
......
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