ATLAS Offline Software
Loading...
Searching...
No Matches
TrigDecisionCnvAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6// Gaudi/Athena include(s):
8
9// Local include(s):
10#include "TrigDecisionCnvAlg.h"
11
12namespace xAODMaker {
13
15 ISvcLocator* svcLoc )
16 : AthReentrantAlgorithm( name, svcLoc ) {
17 }
18
19
22
23
25
26 // Greet the user:
27 ATH_MSG_INFO( "Initializing" );
28 ATH_MSG_DEBUG( " AOD Key: " << m_aodKey );
29 ATH_MSG_DEBUG( "xAOD Key: " << m_xaodKey );
30
31 CHECK( m_eventInfoKey.initialize(SG::AllowEmpty) );
32 CHECK( m_aodKey.initialize() );
33 CHECK( m_xaodKey.initialize() );
34
35 // Retrieve the converter tool:
36 CHECK( m_cnvTool.retrieve() );
37
38 // Return gracefully:
39 return StatusCode::SUCCESS;
40 }
41
42 StatusCode TrigDecisionCnvAlg::execute(const EventContext& ctx) const {
43
44 // Retrieve the AOD object:
46 CHECK( aodRH.isValid() );
47 const TrigDec::TrigDecision* aod = aodRH.cptr();
48
49 // trigger Info
50 const TriggerInfo* trigInfo = nullptr;
51 if (not m_eventInfoKey.empty()) {
53 trigInfo = eiRH.isValid() ? eiRH.cptr()->trigger_info() : nullptr;
54 }
55
56 // Create the xAOD object and its auxiliary store:
57 std::unique_ptr<xAOD::TrigDecisionAuxInfo> aux = std::make_unique<xAOD::TrigDecisionAuxInfo>();
58 std::unique_ptr<xAOD::TrigDecision> xaod = std::make_unique<xAOD::TrigDecision>();
59 xaod->setStore( aux.get() );
60
61 // Fill the xAOD object:
62 CHECK( m_cnvTool->convert( aod, xaod.get(), trigInfo ) );
63
64 // Record the xAOD objects:
66 CHECK( writeHandle.record(std::move(xaod), std::move(aux)));
67
68 // Return gracefully:
69 return StatusCode::SUCCESS;
70 }
71
72} // namespace xAODMaker
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
An algorithm that can be simultaneously executed in multiple threads.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
The TrigDecision is an object which merges trigger informations from various levels.
This class contains trigger related information.
Definition TriggerInfo.h:77
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
SG::ReadHandleKey< EventInfo > m_eventInfoKey
SG::WriteHandleKey< xAOD::TrigDecision > m_xaodKey
virtual StatusCode initialize() override
Function initialising the algorithm.
ToolHandle< ITrigDecisionCnvTool > m_cnvTool
TrigDecisionCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
SG::ReadHandleKey< TrigDec::TrigDecision > m_aodKey