ATLAS Offline Software
EventInfoSelectorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #include "EventInfoSelectorTool.h"
11 #include "EventInfo/EventInfo.h"
14 
15 namespace xAODMaker {
16 
17  //___________________________________________________________________________
18  EventInfoSelectorTool::EventInfoSelectorTool(const std::string& type, const std::string& name, const IInterface* parent) :
20  declareInterface<IAthenaSelectorTool>(this);
21  declareProperty( "AODKey", m_aodKey = "" );
22  declareProperty( "xAODKey", m_xaodKey = "EventInfo" );
23  }
24 
25  //___________________________________________________________________________
27  }
28 
29  //__________________________________________________________________________
31  ATH_MSG_DEBUG("EventInfoSelectorTool::postNext");
32 
33  // Check if anything needs to be done:
34  if( evtStore()->contains< xAOD::EventInfo >( m_xaodKey ) ) {
35  ATH_MSG_DEBUG( "xAOD::EventInfo with key \"" << m_xaodKey
36  << "\" is already in StoreGate" );
37  return StatusCode::SUCCESS;
38  }
39 
40  const EventInfo* aod = nullptr;
41  if( m_aodKey.empty() ) {
42  CHECK( evtStore()->retrieve( aod ) );
43  } else {
44  CHECK( evtStore()->retrieve( aod, m_aodKey ) );
45  }
46 
47  // Create the xAOD object(s):
48  xAOD::EventInfo* xaod = new xAOD::EventInfo();
49  CHECK( evtStore()->record( xaod, m_xaodKey ) );
50 
52  CHECK( evtStore()->record( aux, m_xaodKey + "Aux." ) );
53 
54  xaod->setStore( aux );
55 
56  // Do the translation:
57  CHECK( const_cast<EventInfoSelectorTool*>(this)->convert( aod, xaod ) );
58  return StatusCode::SUCCESS;
59  }
60  //__________________________________________________________________________
62  return(StatusCode::SUCCESS);
63  }
64  //__________________________________________________________________________
65 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition: IEventInfoCnvTool.h:17
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAODMaker::EventInfoSelectorTool::m_xaodKey
std::string m_xaodKey
StoreGate key for the output object.
Definition: EventInfoSelectorTool.h:43
xAOD::EventAuxInfo_v3
Auxiliary information about the event.
Definition: EventAuxInfo_v3.h:28
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::EventInfoSelectorTool::postNext
virtual StatusCode postNext() const
Called at the end of next.
Definition: EventInfoSelectorTool.cxx:30
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAODMaker::EventInfoCnvTool
Implementation for the IEventInfoCnvTool interface.
Definition: EventInfoCnvTool.h:43
EventInfoSelectorTool.h
This file contains the class definition for the EventInfoSelectorTool class.
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::EventInfoSelectorTool::~EventInfoSelectorTool
virtual ~EventInfoSelectorTool()
Destructor.
Definition: EventInfoSelectorTool.cxx:26
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAODMaker::EventInfoCnvTool::convert
virtual StatusCode convert(const EventInfo *aod, xAOD::EventInfo *xaod, bool pileUpInfo=false, bool copyPileUpLinks=true, const EventContext &ctx=Gaudi::Hive::currentContext()) const override
Function that fills an existing xAOD::EventInfo object with data.
Definition: EventInfoCnvTool.cxx:103
xAOD::EventAuxInfo
EventAuxInfo_v3 EventAuxInfo
Definition of the latest event auxiliary info version.
Definition: EventAuxInfo.h:15
EventAuxInfo.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:42
xAODMaker::EventInfoSelectorTool::EventInfoSelectorTool
EventInfoSelectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Service Constructor.
Definition: EventInfoSelectorTool.cxx:18
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAODMaker::EventInfoSelectorTool::m_aodKey
std::string m_aodKey
StoreGate key for the input object.
Definition: EventInfoSelectorTool.h:41
xAODMaker::EventInfoSelectorTool::preNext
virtual StatusCode preNext() const
Called at the beginning of next.
Definition: EventInfoSelectorTool.cxx:61
xAODMaker::EventInfoSelectorTool
Definition: EventInfoSelectorTool.h:24