ATLAS Offline Software
CopyPixelClusterContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 CopyPixelClusterContainer::CopyPixelClusterContainer(const std::string &name, ISvcLocator *pSvcLocator)
11  : AthReentrantAlgorithm(name, pSvcLocator) { }
12 
14 {
15  ATH_MSG_DEBUG("Initializing...");
16 
17  // Check and initialize keys
19  ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_inputKey);
21  ATH_MSG_VERBOSE("Initialized WriteHandleKey: " << m_outputKey);
22 
23  ATH_CHECK(detStore()->retrieve(m_idHelper,"PixelID"));
24 
25  return StatusCode::SUCCESS;
26 }
27 
28 StatusCode CopyPixelClusterContainer::execute(const EventContext& ctx) const
29 {
30  ATH_MSG_DEBUG("execute() begin");
31  // Reading the input container
32  ATH_MSG_VERBOSE("Retrieving input container");
33 
35  if (!inputContainer.isValid()) {
36  ATH_MSG_ERROR("Could not get pileup PixelClusterContainer " << inputContainer.name() << " from store " << inputContainer.store());
37  return StatusCode::FAILURE;
38  }
39  ATH_MSG_DEBUG("Found pileup PixelClusterContainer " << inputContainer.name() << " in store " << inputContainer.store());
40 
41  // Creating output RDO container
43  ATH_CHECK(outputContainer.record(std::make_unique<InDet::PixelClusterContainer>(m_idHelper->wafer_hash_max())));
44  if (!outputContainer.isValid()) {
45  ATH_MSG_ERROR("Could not record output PixelClusterContainer " << outputContainer.name() << " to store " << outputContainer.store());
46  return StatusCode::FAILURE;
47  }
48  ATH_MSG_DEBUG("Recorded output PixelClusterContainer container " << outputContainer.name() << " in store " << outputContainer.store());
49 
50  for(const InDet::PixelClusterCollection* col : *inputContainer){
52  newCol->setIdentifier(col->identify());
53  for(const InDet::PixelCluster* clus : *col){
54  newCol->push_back(std::make_unique<InDet::PixelCluster>(*clus));
55  }
56  ATH_CHECK(outputContainer->addCollection(newCol,newCol->identifyHash()));
57  }
58  return StatusCode::SUCCESS;
59 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
CopyPixelClusterContainer::CopyPixelClusterContainer
CopyPixelClusterContainer(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CopyPixelClusterContainer.cxx:10
PixelCluster.h
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
CopyPixelClusterContainer::initialize
virtual StatusCode initialize() override
Definition: CopyPixelClusterContainer.cxx:13
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CopyPixelClusterContainer::m_outputKey
SG::WriteHandleKey< InDet::PixelClusterContainer > m_outputKey
Definition: CopyPixelClusterContainer.h:24
CopyPixelClusterContainer::m_inputKey
SG::ReadHandleKey< InDet::PixelClusterContainer > m_inputKey
Definition: CopyPixelClusterContainer.h:23
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
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
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
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
PixelClusterCollection.h
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
CopyPixelClusterContainer::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: CopyPixelClusterContainer.cxx:28
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
PixelID::wafer_hash_max
size_type wafer_hash_max(void) const
Definition: PixelID.cxx:912
query_example.col
col
Definition: query_example.py:7
InDet::PixelCluster
Definition: InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelCluster.h:49
CopyPixelClusterContainer.h
CopyPixelClusterContainer::m_idHelper
const PixelID * m_idHelper
Definition: CopyPixelClusterContainer.h:26
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.
InDet::PixelClusterCollection
Trk::PrepRawDataCollection< PixelCluster > PixelClusterCollection
Definition: PixelClusterCollection.h:26