ATLAS Offline Software
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 
12 #include "InDetIdentifier/SCT_ID.h"
13 #include "StoreGate/ReadHandle.h"
14 #include "StoreGate/WriteHandle.h"
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 
31 StatusCode 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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
SCT_RawDataToxAOD.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SCT_RDORawData
Definition: SCT_RDORawData.h:24
SCT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: SCT_ID.h:728
SCT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: SCT_ID.h:740
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
SCT_RawDataToxAOD::m_rdoContainerName
SG::ReadHandleKey< SCT_RDO_Container > m_rdoContainerName
Definition: SCT_RawDataToxAOD.h:40
WriteHandle.h
Handle class for recording to StoreGate.
xAOD::SCTRawHitValidation_v1
Class describing an SCT Raw Data Object (RDO).
Definition: SCTRawHitValidation_v1.h:22
SCT_RawDataToxAOD::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: SCT_RawDataToxAOD.cxx:31
SCT_RawDataToxAOD::finalize
virtual StatusCode finalize() override
Definition: SCT_RawDataToxAOD.cxx:67
SCT_RawDataToxAOD::m_xAodRawHitContainerName
SG::WriteHandleKey< xAOD::SCTRawHitValidationContainer > m_xAodRawHitContainerName
Definition: SCT_RawDataToxAOD.h:41
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
SCT_RawDataToxAOD::initialize
virtual StatusCode initialize() override
Definition: SCT_RawDataToxAOD.cxx:24
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SCT_ID::layer_disk
int layer_disk(const Identifier &id) const
Definition: SCT_ID.h:734
SCTRawHitValidationAuxContainer.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SCT_RawDataToxAOD::m_SCTHelper
const SCT_ID * m_SCTHelper
Definition: SCT_RawDataToxAOD.h:38
xAOD::SCTRawHitValidation
SCTRawHitValidation_v1 SCTRawHitValidation
Reference the current persistent version:
Definition: SCTRawHitValidation.h:13
SCT_ID::eta_module
int eta_module(const Identifier &id) const
Definition: SCT_ID.h:746
SCT_RawDataToxAOD::SCT_RawDataToxAOD
SCT_RawDataToxAOD(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SCT_RawDataToxAOD.cxx:18
SCT_ID::side
int side(const Identifier &id) const
Definition: SCT_ID.h:752
ReadHandle.h
Handle class for reading from StoreGate.
Identifier
Definition: IdentifierFieldParser.cxx:14