ATLAS Offline Software
RpcOverlay.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Andrei Gaponenko <agaponenko@lbl.gov>, 2006, 2007
6 // Ketevi A. Assamagan <ketevi@bnl.gov>, March 2008
7 // Piyali Banerjee <Piyali.Banerjee@cern.ch>, March 2011
8 
10 
11 #include <StoreGate/ReadHandle.h>
12 #include <StoreGate/WriteHandle.h>
13 
15 
16 
17 //================================================================
18 RpcOverlay::RpcOverlay(const std::string &name, ISvcLocator *pSvcLocator) :
19  IDC_MuonOverlayBase(name, pSvcLocator)
20 {
21 }
22 
23 //================================================================
25 {
26  ATH_MSG_DEBUG("Initializing...");
27 
29  ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_bkgInputKey );
31  ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_signalInputKey );
33  ATH_MSG_VERBOSE("Initialized WriteHandleKey: " << m_outputKey );
34 
35  return StatusCode::SUCCESS;
36 }
37 
38 //================================================================
39 StatusCode RpcOverlay::execute(const EventContext& ctx) const
40 {
41  ATH_MSG_DEBUG("RpcOverlay::execute() begin");
42 
43 
45  if (!bkgContainer.isValid()) {
46  ATH_MSG_ERROR("Could not get background RPC container " << bkgContainer.name() << " from store " << bkgContainer.store());
47  return StatusCode::FAILURE;
48  }
49  ATH_MSG_DEBUG("Found background RpcDigitContainer called " << bkgContainer.name() << " in store " << bkgContainer.store());
50  ATH_MSG_DEBUG("RPC Background = " << Overlay::debugPrint(bkgContainer.cptr()));
51  ATH_MSG_VERBOSE("RPC background has digit_size " << bkgContainer->digit_size());
52 
54  if (!signalContainer.isValid() ) {
55  ATH_MSG_ERROR("Could not get signal RPC container " << signalContainer.name() << " from store " << signalContainer.store());
56  return StatusCode::FAILURE;
57  }
58  ATH_MSG_DEBUG("Found signal RpcDigitContainer called " << signalContainer.name() << " in store " << signalContainer.store());
59  ATH_MSG_DEBUG("RPC Signal = " << Overlay::debugPrint(signalContainer.cptr()));
60  ATH_MSG_VERBOSE("RPC signal has digit_size " << signalContainer->digit_size());
61 
62  SG::WriteHandle<RpcDigitContainer> outputContainer(m_outputKey, ctx);
63  ATH_CHECK(outputContainer.record(std::make_unique<RpcDigitContainer>(bkgContainer->size())));
64  if (!outputContainer.isValid()) {
65  ATH_MSG_ERROR("Could not record output RpcDigitContainer called " << outputContainer.name() << " to store " << outputContainer.store());
66  return StatusCode::FAILURE;
67  }
68  ATH_MSG_DEBUG("Recorded output RpcDigitContainer called " << outputContainer.name() << " in store " << outputContainer.store());
69 
70  // Do the actual overlay
71  ATH_CHECK(overlayMultiHitContainer(bkgContainer.cptr(), signalContainer.cptr(), outputContainer.ptr()));
72  ATH_MSG_DEBUG("RPC Result = " << Overlay::debugPrint(outputContainer.cptr()));
73 
74 
75  ATH_MSG_DEBUG("RpcOverlay::execute() end");
76 
77  return StatusCode::SUCCESS;
78 }
IDC_OverlayHelpers.h
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
RpcOverlay::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: RpcOverlay.cxx:39
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
RpcOverlay::m_bkgInputKey
SG::ReadHandleKey< RpcDigitContainer > m_bkgInputKey
Definition: RpcOverlay.h:32
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:206
SG::WriteHandle::cptr
const_pointer_type cptr() const
Dereference the pointer.
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
RpcOverlay::RpcOverlay
RpcOverlay(const std::string &name, ISvcLocator *pSvcLocator)
Definition: RpcOverlay.cxx:18
WriteHandle.h
Handle class for recording to StoreGate.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition: StoreGate/src/VarHandleBase.cxx:376
IDC_MuonOverlayBase
Definition: IDC_MuonOverlayBase.h:27
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
RpcOverlay.h
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
RpcOverlay::m_signalInputKey
SG::ReadHandleKey< RpcDigitContainer > m_signalInputKey
Definition: RpcOverlay.h:33
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
RpcOverlay::m_outputKey
SG::WriteHandleKey< RpcDigitContainer > m_outputKey
Definition: RpcOverlay.h:34
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ReadHandle.h
Handle class for reading from StoreGate.
RpcOverlay::initialize
virtual StatusCode initialize() override final
Definition: RpcOverlay.cxx:24
IDC_MuonOverlayBase::overlayMultiHitContainer
StatusCode overlayMultiHitContainer(const IDC_Container *bkgContainer, const IDC_Container *signalContainer, IDC_Container *outputContainer) const
Definition: IDC_MuonOverlayBase.h:42
Overlay::debugPrint
std::string debugPrint(const IDC_Container *container, unsigned numprint=25)
Diagnostic output of Identifiable Containers.
RpcDigitContainer::digit_size
size_type digit_size() const
Definition: RpcDigitContainer.cxx:52