ATLAS Offline Software
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 
12 namespace xAODMaker {
13 
15  ISvcLocator* svcLoc )
16  : AthReentrantAlgorithm( name, svcLoc ) {
17  }
18 
19 
21  }
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 
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
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAODMaker::TrigDecisionCnvAlg::m_eventInfoKey
SG::ReadHandleKey< EventInfo > m_eventInfoKey
Definition: TrigDecisionCnvAlg.h:56
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::TrigDecisionCnvAlg::m_cnvTool
ToolHandle< ITrigDecisionCnvTool > m_cnvTool
Definition: TrigDecisionCnvAlg.h:60
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
TrigDec::TrigDecision
The TrigDecision is an object which merges trigger informations from various levels.
Definition: Trigger/TrigEvent/TrigDecisionEvent/TrigDecisionEvent/TrigDecision.h:61
xAODMaker::TrigDecisionCnvAlg::m_aodKey
SG::ReadHandleKey< TrigDec::TrigDecision > m_aodKey
Definition: TrigDecisionCnvAlg.h:57
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
xAODMaker::TrigDecisionCnvAlg::TrigDecisionCnvAlg
TrigDecisionCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular Algorithm constructor.
Definition: TrigDecisionCnvAlg.cxx:14
SG::AuxElement::setStore
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
Definition: AuxElement.cxx:221
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
xAODMaker::TrigDecisionCnvAlg::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition: TrigDecisionCnvAlg.cxx:24
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TriggerInfo
This class contains trigger related information.
Definition: TriggerInfo.h:77
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
xAODMaker::TrigDecisionCnvAlg::m_xaodKey
SG::WriteHandleKey< xAOD::TrigDecision > m_xaodKey
Definition: TrigDecisionCnvAlg.h:58
xAODMaker::TrigDecisionCnvAlg::~TrigDecisionCnvAlg
virtual ~TrigDecisionCnvAlg()
Definition: TrigDecisionCnvAlg.cxx:20
TrigDecisionCnvAlg.h
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
xAODMaker::TrigDecisionCnvAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm.
Definition: TrigDecisionCnvAlg.cxx:42