ATLAS Offline Software
Loading...
Searching...
No Matches
UnassociatedHitsDecorator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Author: Olivier Arnaez ( olivier.arnaez@cern.ch )
6
10
11#include <vector>
12#include <utility>
13#include <string>
14
15namespace DerivationFramework {
16
18 {
19
20 if (m_sgName.empty()) {
21 ATH_MSG_WARNING("No decoration prefix name provided for the output of UnassociatedHitsDecorator!");
22 }
23
24 if (m_eventInfoKey.empty()) {
25 ATH_MSG_ERROR("No EventInfo collection provided for UnassociatedHitsDecorator!");
26 return StatusCode::FAILURE;
27 }
28 ATH_CHECK(m_eventInfoKey.initialize() );
29 // retrieve PRD association tool
31
32 { // FIXME DecorHandleKeys should be properly configured in the python layer
33 std::vector<std::string> names;
34 names.resize(kNIntDecor);
35 names[knPixelUADecor] ="nPixelUA";
36 names[knBlayerUADecor] ="nBlayerUA";
37 names[knPixelBarrelUADecor] ="nPixelBarrelUA";
38 names[knPixelEndCapAUADecor] ="nPixelEndCapAUA";
39 names[knPixelEndCapCUADecor] ="nPixelEndCapCUA";
40 names[knSCTUADecor] ="nSCTUA";
41 names[knSCTBarrelUADecor] ="nSCTBarrelUA";
42 names[knSCTEndCapAUADecor] ="nSCTEndCapAUA";
43 names[knSCTEndCapCUADecor] ="nSCTEndCapCUA";
44 names[knTRTUADecor] ="nTRTUA";
45 names[knTRTBarrelUADecor] ="nTRTBarrelUA";
46 names[knTRTEndCapAUADecor] ="nTRTEndCapAUA";
47 names[knTRTEndCapCUADecor] ="nTRTEndCapCUA";
49 }
50 return StatusCode::SUCCESS;
51 }
52
53
54 StatusCode UnassociatedHitsDecorator::addBranches(const EventContext& ctx) const
55 {
56 ATH_MSG_DEBUG("Adding unassociated hits info to EventInfo");
57
59 CHECK( eventInfo.isValid() ? StatusCode::SUCCESS : StatusCode::FAILURE );
60
62 std::vector<SG::WriteDecorHandle<xAOD::EventInfo,int> >
64 if (prdAssoc) {
65 intDecorators[knPixelUADecor](*eventInfo) = prdAssoc->nPixelUA;
66 intDecorators[knBlayerUADecor](*eventInfo) = prdAssoc->nBlayerUA;
67 intDecorators[knPixelBarrelUADecor](*eventInfo) = prdAssoc->nPixelBarrelUA;
68 intDecorators[knPixelEndCapAUADecor](*eventInfo) = prdAssoc->nPixelEndCapAUA;
69 intDecorators[knPixelEndCapCUADecor](*eventInfo) = prdAssoc->nPixelEndCapCUA;
70 intDecorators[knSCTUADecor](*eventInfo) = prdAssoc->nSCTUA;
71 intDecorators[knSCTBarrelUADecor](*eventInfo) = prdAssoc->nSCTBarrelUA;
72 intDecorators[knSCTEndCapAUADecor](*eventInfo) = prdAssoc->nSCTEndCapAUA;
73 intDecorators[knSCTEndCapCUADecor](*eventInfo) = prdAssoc->nSCTEndCapCUA;
74 intDecorators[knTRTUADecor](*eventInfo) = prdAssoc->nTRTUA;
75 intDecorators[knTRTBarrelUADecor](*eventInfo) = prdAssoc->nTRTBarrelUA;
76 intDecorators[knTRTEndCapAUADecor](*eventInfo) = prdAssoc->nTRTEndCapAUA;
77 intDecorators[knTRTEndCapCUADecor](*eventInfo) = prdAssoc->nTRTEndCapCUA;
78
79 ATH_MSG_DEBUG("Decorating unassociated hits with nPixelBarrelUA = ");
81
82 m_UnassociatedHitsGetterTool->releaseObject(prdAssoc);
83 }
84 else
85 ATH_MSG_WARNING("Could not retrieve Unassociated hits information");
86
87 return StatusCode::SUCCESS;
88 }
89
90}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode addBranches(const EventContext &ctx) const override final
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
std::vector< SG::WriteDecorHandleKey< xAOD::EventInfo > > m_intDecorKeys
ToolHandle< IUnassociatedHitsGetterTool > m_UnassociatedHitsGetterTool
virtual bool isValid() override final
Can the handle be successfully dereferenced?
THE reconstruction tool.
std::vector< SG::WriteDecorHandle< T_Cont, T > > createDecorators(const std::vector< SG::WriteDecorHandleKey< T_Cont > > &keys, const EventContext &ctx)
void createDecoratorKeys(T_Parent &parent, const SG::ReadHandleKey< T_Cont > &container_key, const std::string &prefix, const std::vector< std::string > &decor_names, std::vector< SG::WriteDecorHandleKey< T_Cont > > &decor_out)