ATLAS Offline Software
Loading...
Searching...
No Matches
CopyTRT_DriftCircleContainer.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
10CopyTRT_DriftCircleContainer::CopyTRT_DriftCircleContainer(const std::string &name, ISvcLocator *pSvcLocator)
11 : AthReentrantAlgorithm(name, pSvcLocator) { }
12
14{
15 ATH_MSG_DEBUG("Initializing...");
16
17 // Check and initialize keys
18 ATH_CHECK( m_inputKey.initialize() );
19 ATH_MSG_VERBOSE("Initialized ReadHandleKey: " << m_inputKey);
20 ATH_CHECK( m_outputKey.initialize() );
21 ATH_MSG_VERBOSE("Initialized WriteHandleKey: " << m_outputKey);
22
23 ATH_CHECK(detStore()->retrieve(m_idHelper,"TRT_ID"));
24
25 return StatusCode::SUCCESS;
26}
27
28StatusCode CopyTRT_DriftCircleContainer::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 TRT_DriftCircleContainer " << inputContainer.name() << " from store " << inputContainer.store());
37 return StatusCode::FAILURE;
38 }
39 ATH_MSG_DEBUG("Found pileup TRT_DriftCircleContainer " << inputContainer.name() << " in store " << inputContainer.store());
40
41 // Creating output RDO container
43 ATH_CHECK(outputContainer.record(std::make_unique<InDet::TRT_DriftCircleContainer>(m_idHelper->straw_layer_hash_max())));
44 if (!outputContainer.isValid()) {
45 ATH_MSG_ERROR("Could not record output TRT_DriftCircleContainer " << outputContainer.name() << " to store " << outputContainer.store());
46 return StatusCode::FAILURE;
47 }
48 ATH_MSG_DEBUG("Recorded output TRT_DriftCircleContainer container " << outputContainer.name() << " in store " << outputContainer.store());
49
50 for(const InDet::TRT_DriftCircleCollection* col : *inputContainer){
51 InDet::TRT_DriftCircleCollection* newCol=new InDet::TRT_DriftCircleCollection(col->identifyHash());
52 newCol->setIdentifier(col->identify());
53 for(const InDet::TRT_DriftCircle* clus : *col){
54 newCol->push_back(std::make_unique<InDet::TRT_DriftCircle>(*clus));
55 }
56 ATH_CHECK(outputContainer->addCollection(newCol,newCol->identifyHash()));
57 }
58 return StatusCode::SUCCESS;
59}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the TRT subdetector.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_inputKey
virtual StatusCode initialize() override
SG::WriteHandleKey< InDet::TRT_DriftCircleContainer > m_outputKey
CopyTRT_DriftCircleContainer(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::string store() const
Return the name of the store holding the object we are proxying.
const std::string & name() const
Return the StoreGate ID for the referenced object.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
virtual bool isValid() override final
Can the handle be successfully dereferenced?