ATLAS Offline Software
TgcOverlay.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 TgcOverlay::TgcOverlay(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 TgcOverlay::execute(const EventContext& ctx) const {
40  ATH_MSG_DEBUG("TgcOverlay::execute() begin");
41 
42 
44  if (!bkgContainer.isValid()) {
45  ATH_MSG_ERROR("Could not get background TgcDigitContainer called " << bkgContainer.name() << " from store " << bkgContainer.store());
46  return StatusCode::FAILURE;
47  }
48  ATH_MSG_DEBUG("Found background TgcDigitContainer called " << bkgContainer.name() << " in store " << bkgContainer.store());
49  ATH_MSG_DEBUG("TGC Background = " << Overlay::debugPrint(bkgContainer.cptr()));
50  ATH_MSG_VERBOSE("TGC background has digit_size " << bkgContainer->digit_size());
51 
53  if (!signalContainer.isValid() ) {
54  ATH_MSG_ERROR("Could not get signal TgcDigitContainer called " << signalContainer.name() << " from store " << signalContainer.store());
55  return StatusCode::FAILURE;
56  }
57  ATH_MSG_DEBUG("Found overlay TgcDigitContainer called " << signalContainer.name() << " in store " << signalContainer.store());
58  ATH_MSG_DEBUG("TGC Signal = " << Overlay::debugPrint(signalContainer.cptr()));
59  ATH_MSG_VERBOSE("TGC signal has digit_size " << signalContainer->digit_size());
60 
61  SG::WriteHandle<TgcDigitContainer> outputContainer(m_outputKey, ctx);
62  ATH_CHECK(outputContainer.record(std::make_unique<TgcDigitContainer>(bkgContainer->size())));
63  if (!outputContainer.isValid()) {
64  ATH_MSG_ERROR("Could not record output TgcDigitContainer called " << outputContainer.name() << " to store " << outputContainer.store());
65  return StatusCode::FAILURE;
66  }
67  ATH_MSG_DEBUG("Recorded output TgcDigitContainer called " << outputContainer.name() << " in store " << outputContainer.store());
68 
69  // Do the actual overlay
70  ATH_CHECK(overlayMultiHitContainer(bkgContainer.cptr(), signalContainer.cptr(), outputContainer.ptr()));
71  ATH_MSG_DEBUG("TGC Result = " << Overlay::debugPrint(outputContainer.cptr()));
72 
73 
74  ATH_MSG_DEBUG("TgcOverlay::execute() end");
75 
76  return StatusCode::SUCCESS;
77 }
IDC_OverlayHelpers.h
TgcOverlay::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition: TgcOverlay.cxx:39
TgcOverlay::m_signalInputKey
SG::ReadHandleKey< TgcDigitContainer > m_signalInputKey
Definition: TgcOverlay.h:31
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
TgcOverlay::TgcOverlay
TgcOverlay(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TgcOverlay.cxx:18
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
IdentifiableContainerMT::size
size_t size() const
Duplicate of fullSize for backwards compatability.
Definition: IdentifiableContainerMT.h:209
SG::WriteHandle::cptr
const_pointer_type cptr() const
Dereference the pointer.
TgcOverlay::m_outputKey
SG::WriteHandleKey< TgcDigitContainer > m_outputKey
Definition: TgcOverlay.h:32
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
WriteHandle.h
Handle class for recording to StoreGate.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TgcOverlay::initialize
virtual StatusCode initialize() override final
Definition: TgcOverlay.cxx:24
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:379
IDC_MuonOverlayBase
Definition: IDC_MuonOverlayBase.h:27
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
TgcOverlay::m_bkgInputKey
SG::ReadHandleKey< TgcDigitContainer > m_bkgInputKey
Definition: TgcOverlay.h:30
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TgcDigitContainer::digit_size
size_type digit_size() const
Definition: TgcDigitContainer.cxx:53
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TgcOverlay.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
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.
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.