From ea0fb9dd385ab4b9a0ebb86e3bfaf04f628f1cdb Mon Sep 17 00:00:00 2001 From: Chris Jones <jonesc@hep.phy.cam.ac.uk> Date: Fri, 27 Oct 2023 16:27:36 +0100 Subject: [PATCH] DecodedDataFromMCRichHits: Add property to enable/disable spillover --- .../component/DecodedDataFromMCRichHits.cpp | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp b/Rich/RichFutureMCUtils/src/component/DecodedDataFromMCRichHits.cpp index add3b2a2de0..d8067b837c8 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 -- GitLab