diff --git a/Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp b/Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp index add3b2a2de019c415c3bf3cc364ef0f59900404e..d8067b837c8302ccee88edcc76fee507a433236e 100644 --- a/Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp +++ b/Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp @@ -98,33 +98,32 @@ namespace Rich::Future::MC { for ( const auto mchit : mchits ) { const auto id = mchit->sensDetID(); if ( id.isValid() ) { - // Apply all sorts MC based filtering here, e.g. signal only, timing windows etc. // To be extended as needed if ( m_rejectBackground && mchit->isBackground() ) { _ri_verbo << id << " Rejected as background" << endmsg; continue; } - // finally save this id -> hit mapping hitsPerPix[id].push_back( mchit ); - } // hit is valid } // mc hit loop }; - // Spillover locations - auto addSpilloverHits = [&]( auto const& mchits ) { - if ( mchits.exist() ) { addMCHits( *mchits.get() ); } - }; - - // add the hits + // add the main event hits addMCHits( main_mchits ); - addSpilloverHits( m_prevHits ); - addSpilloverHits( m_prevPrevHits ); - addSpilloverHits( m_nextHits ); - addSpilloverHits( m_nextNextHits ); - addSpilloverHits( m_lhcBkgHits ); + + // ... and if requested spillover hits + if ( m_enableSpillover ) { + auto addSpilloverHits = [&]( auto const& mchits ) { + if ( mchits.exist() ) { addMCHits( *mchits.get() ); } + }; + addSpilloverHits( m_prevHits ); + addSpilloverHits( m_prevPrevHits ); + addSpilloverHits( m_nextHits ); + addSpilloverHits( m_nextNextHits ); + addSpilloverHits( m_lhcBkgHits ); + } // Form list of unique IDs LHCb::RichSmartID::Vector ids; @@ -216,6 +215,9 @@ namespace Rich::Future::MC { /// Reject background hits Gaudi::Property<bool> m_rejectBackground{this, "RejectBackground", false}; + + /// Include spillover events + Gaudi::Property<bool> m_enableSpillover{this, "EnableSpillover", true}; }; // Declaration of the Algorithm Factory