ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_RawDataToxAOD.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
6// SCT_RawDataToxAOD.cxx
7// Implementation file for class SCT_RawDataToxAOD
9
10#include "SCT_RawDataToxAOD.h"
11
15// xAOD container type
17
19 ISvcLocator* pSvcLocator)
20 : AthReentrantAlgorithm(name, pSvcLocator)
21{
22}
23
25 ATH_CHECK(detStore()->retrieve(m_SCTHelper, "SCT_ID"));
26 ATH_CHECK(m_rdoContainerName.initialize());
28 return StatusCode::SUCCESS;
29}
30
31StatusCode SCT_RawDataToxAOD::execute(const EventContext& ctx) const {
33 if (not rdoContainer.isValid()) return StatusCode::SUCCESS;
34 unsigned nRDOs{0};
35 for (const SCT_RDO_Collection* collection: *rdoContainer) {
36 nRDOs += collection->size();
37 }
38
39 // Create the output xAOD container and its auxiliary store:
41 ATH_CHECK(xaod.record(std::make_unique<xAOD::SCTRawHitValidationContainer>(),
42 std::make_unique<xAOD::SCTRawHitValidationAuxContainer>()));
43 xaod->reserve(nRDOs);
44
46 for (const SCT_RDO_Collection* collection: *rdoContainer) {
47 for (const SCT_RDORawData* rdo: *collection) {
48 // create and add xAOD object
50 xaod->push_back(xrdo);
52 const Identifier id{rdo->identify()};
53 xrdo->setIdentifier(id.get_compact());
54 xrdo->setWord(rdo->getWord());
55 // setting additional decorations based on identifier
56 xrdo->setBec(m_SCTHelper->barrel_ec(id));
57 xrdo->setLayer(m_SCTHelper->layer_disk(id));
58 xrdo->setPhi_module(m_SCTHelper->phi_module(id));
59 xrdo->setEta_module(m_SCTHelper->eta_module(id));
60 xrdo->setSide(m_SCTHelper->side(id));
61 }
62 }
63 ATH_MSG_DEBUG(" recorded SCT_RawData objects: size " << xaod->size());
64 return StatusCode::SUCCESS;
65}
66
68 return StatusCode::SUCCESS;
69}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the SCT subdetector.
InDetRawDataCollection< SCT_RDORawData > SCT_RDO_Collection
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadHandleKey< SCT_RDO_Container > m_rdoContainerName
SG::WriteHandleKey< xAOD::SCTRawHitValidationContainer > m_xAodRawHitContainerName
virtual StatusCode finalize() override
SCT_RawDataToxAOD(const std::string &name, ISvcLocator *pSvcLocator)
const SCT_ID * m_SCTHelper
virtual StatusCode initialize() override
virtual StatusCode execute(const EventContext &ctx) const override
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setSide(int new_side)
set side of this RDO
void setBec(int new_bec)
set bec of this RDO
void setEta_module(int new_eta_module)
set eta_module of this RDO
void setWord(uint32_t new_word)
set data word of this RDO
void setLayer(int new_layer)
set layer of this RDO
void setPhi_module(int new_phi_module)
set phi_module of this RDO
void setIdentifier(uint64_t new_identifier)
set identifier of this RDO
SCTRawHitValidation_v1 SCTRawHitValidation
Reference the current persistent version: